All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats
@ 2018-12-01 11:31 Hans de Goede
  2018-12-01 11:31 ` [PATCH 2/4] drm/i915/dsi: Enable dithering for 6 bpc panels Hans de Goede
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Hans de Goede @ 2018-12-01 11:31 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Ville Syrjälä
  Cc: Hans de Goede, intel-gfx, dri-devel

There are 3 problems with the dsi code's pipe_bpp handling for 6 bpc
pixel-formats which this commit addresses:

1) It assumes that the pipe_bpp is the same as the bpp going over the dsi
lanes. This assumption is not valid for MIPI_DSI_FMT_RGB666, where pipe_bpp
should be 18 so that we do proper dithering but we actually send 24 bpp
over the dsi lanes (MIPI_DSI_FMT_RGB666_PACKED sends 18 bpp).

This assumption is enforced by an assert in *_dsi_get_pclk(). This assert
triggers on the initial hw-state readback on BYT/CHT devices which use
MIPI_DSI_FMT_RGB666, such as the Prowise PT301 tablet. PIPECONF is set to
6BPC / 18 bpp by the GOP, while mipi_dsi_pixel_format_to_bpp() returns 24.

This commits switches the calculations in *_dsi_get_pclk() to use the bpp
from mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format) which
returns the bpp going over the mipi lanes and drops the assert.

2) On BXT bxt_dsi_get_pipe_config() wrongly overrides the pipe_bpp which
i9xx_get_pipe_config() reads from PIPECONF with the return value from
mipi_dsi_pixel_format_to_bpp(). This avoids the assert from 1. but is wrong
since the pipe is actually running at the value configured in PIPECONF.

This commit drops the override of pipe_bpp from bxt_dsi_get_pipe_config().

3) The dsi encoder's compute_config() never assigns a value to pipe_bpp,
unlike most other encoders. Falling back on compute_baseline_pipe_bpp()
which always picks 24. 24 is only correct for MIPI_DSI_FMT_RGB88 for the
others we should use 18 bpp so that we correctly do 6bpc color dithering.

This commit adds code to intel_dsi_compute_config() to properly set
pipe_bpp based on intel_dsi->pixel_format.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/gpu/drm/i915/intel_dsi.h   |  4 ++--
 drivers/gpu/drm/i915/vlv_dsi.c     | 17 ++++++++--------
 drivers/gpu/drm/i915/vlv_dsi_pll.c | 31 ++++++------------------------
 3 files changed, 17 insertions(+), 35 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
index c888c219835f..c796a2962a43 100644
--- a/drivers/gpu/drm/i915/intel_dsi.h
+++ b/drivers/gpu/drm/i915/intel_dsi.h
@@ -160,7 +160,7 @@ int vlv_dsi_pll_compute(struct intel_encoder *encoder,
 void vlv_dsi_pll_enable(struct intel_encoder *encoder,
 			const struct intel_crtc_state *config);
 void vlv_dsi_pll_disable(struct intel_encoder *encoder);
-u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
+u32 vlv_dsi_get_pclk(struct intel_encoder *encoder,
 		     struct intel_crtc_state *config);
 void vlv_dsi_reset_clocks(struct intel_encoder *encoder, enum port port);
 
@@ -170,7 +170,7 @@ int bxt_dsi_pll_compute(struct intel_encoder *encoder,
 void bxt_dsi_pll_enable(struct intel_encoder *encoder,
 			const struct intel_crtc_state *config);
 void bxt_dsi_pll_disable(struct intel_encoder *encoder);
-u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
+u32 bxt_dsi_get_pclk(struct intel_encoder *encoder,
 		     struct intel_crtc_state *config);
 void bxt_dsi_reset_clocks(struct intel_encoder *encoder, enum port port);
 
diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
index be3af5f6c7a0..c10def5efa22 100644
--- a/drivers/gpu/drm/i915/vlv_dsi.c
+++ b/drivers/gpu/drm/i915/vlv_dsi.c
@@ -322,6 +322,11 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
 	/* DSI uses short packets for sync events, so clear mode flags for DSI */
 	adjusted_mode->flags = 0;
 
+	if (intel_dsi->pixel_format == MIPI_DSI_FMT_RGB888)
+		pipe_config->pipe_bpp = 24;
+	else
+		pipe_config->pipe_bpp = 18;
+
 	if (IS_GEN9_LP(dev_priv)) {
 		/* Enable Frame time stamp based scanline reporting */
 		adjusted_mode->private_flags |=
@@ -1097,10 +1102,8 @@ static void bxt_dsi_get_pipe_config(struct intel_encoder *encoder,
 	}
 
 	fmt = I915_READ(MIPI_DSI_FUNC_PRG(port)) & VID_MODE_FORMAT_MASK;
-	pipe_config->pipe_bpp =
-			mipi_dsi_pixel_format_to_bpp(
-				pixel_format_from_register_bits(fmt));
-	bpp = pipe_config->pipe_bpp;
+	bpp = mipi_dsi_pixel_format_to_bpp(
+			pixel_format_from_register_bits(fmt));
 
 	/* Enable Frame time stamo based scanline reporting */
 	adjusted_mode->private_flags |=
@@ -1238,11 +1241,9 @@ static void intel_dsi_get_config(struct intel_encoder *encoder,
 
 	if (IS_GEN9_LP(dev_priv)) {
 		bxt_dsi_get_pipe_config(encoder, pipe_config);
-		pclk = bxt_dsi_get_pclk(encoder, pipe_config->pipe_bpp,
-					pipe_config);
+		pclk = bxt_dsi_get_pclk(encoder, pipe_config);
 	} else {
-		pclk = vlv_dsi_get_pclk(encoder, pipe_config->pipe_bpp,
-					pipe_config);
+		pclk = vlv_dsi_get_pclk(encoder, pipe_config);
 	}
 
 	if (pclk) {
diff --git a/drivers/gpu/drm/i915/vlv_dsi_pll.c b/drivers/gpu/drm/i915/vlv_dsi_pll.c
index a132a8037ecc..954d5a8c4fa7 100644
--- a/drivers/gpu/drm/i915/vlv_dsi_pll.c
+++ b/drivers/gpu/drm/i915/vlv_dsi_pll.c
@@ -252,20 +252,12 @@ void bxt_dsi_pll_disable(struct intel_encoder *encoder)
 		DRM_ERROR("Timeout waiting for PLL lock deassertion\n");
 }
 
-static void assert_bpp_mismatch(enum mipi_dsi_pixel_format fmt, int pipe_bpp)
-{
-	int bpp = mipi_dsi_pixel_format_to_bpp(fmt);
-
-	WARN(bpp != pipe_bpp,
-	     "bpp match assertion failure (expected %d, current %d)\n",
-	     bpp, pipe_bpp);
-}
-
-u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
+u32 vlv_dsi_get_pclk(struct intel_encoder *encoder,
 		     struct intel_crtc_state *config)
 {
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
+	int bpp = mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format);
 	u32 dsi_clock, pclk;
 	u32 pll_ctl, pll_div;
 	u32 m = 0, p = 0, n;
@@ -319,15 +311,12 @@ u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
 
 	dsi_clock = (m * refclk) / (p * n);
 
-	/* pixel_format and pipe_bpp should agree */
-	assert_bpp_mismatch(intel_dsi->pixel_format, pipe_bpp);
-
-	pclk = DIV_ROUND_CLOSEST(dsi_clock * intel_dsi->lane_count, pipe_bpp);
+	pclk = DIV_ROUND_CLOSEST(dsi_clock * intel_dsi->lane_count, bpp);
 
 	return pclk;
 }
 
-u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
+u32 bxt_dsi_get_pclk(struct intel_encoder *encoder,
 		     struct intel_crtc_state *config)
 {
 	u32 pclk;
@@ -335,12 +324,7 @@ u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
 	u32 dsi_ratio;
 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
 	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
-
-	/* Divide by zero */
-	if (!pipe_bpp) {
-		DRM_ERROR("Invalid BPP(0)\n");
-		return 0;
-	}
+	int bpp = mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format);
 
 	config->dsi_pll.ctrl = I915_READ(BXT_DSI_PLL_CTL);
 
@@ -348,10 +332,7 @@ u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
 
 	dsi_clk = (dsi_ratio * BXT_REF_CLOCK_KHZ) / 2;
 
-	/* pixel_format and pipe_bpp should agree */
-	assert_bpp_mismatch(intel_dsi->pixel_format, pipe_bpp);
-
-	pclk = DIV_ROUND_CLOSEST(dsi_clk * intel_dsi->lane_count, pipe_bpp);
+	pclk = DIV_ROUND_CLOSEST(dsi_clk * intel_dsi->lane_count, bpp);
 
 	DRM_DEBUG_DRIVER("Calculated pclk=%u\n", pclk);
 	return pclk;
-- 
2.19.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 2/4] drm/i915/dsi: Enable dithering for 6 bpc panels
  2018-12-01 11:31 [PATCH 1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats Hans de Goede
@ 2018-12-01 11:31 ` Hans de Goede
  2019-01-15 14:55   ` Ville Syrjälä
  2018-12-01 11:31 ` [PATCH 3/4] drm/i915/dsi: Adjust crtc_clock for burst_mode_ratio Hans de Goede
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Hans de Goede @ 2018-12-01 11:31 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Ville Syrjälä
  Cc: Hans de Goede, intel-gfx, dri-devel

The display engine has 2 dithering enable bits which both need to be set
for dithering to happen, 1 in the PIPECONF register which is taken care of
by i9xx_set_pipeconf() and a second bit at the encoder level.

The dsi code was not setting the encoder level dithering enable bit causing
dithering to be disabled, this commit fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/gpu/drm/i915/vlv_dsi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
index c10def5efa22..c21cbfa9653c 100644
--- a/drivers/gpu/drm/i915/vlv_dsi.c
+++ b/drivers/gpu/drm/i915/vlv_dsi.c
@@ -711,6 +711,10 @@ static void intel_dsi_port_enable(struct intel_encoder *encoder,
 					LANE_CONFIGURATION_DUAL_LINK_B :
 					LANE_CONFIGURATION_DUAL_LINK_A;
 		}
+
+		if (intel_dsi->pixel_format != MIPI_DSI_FMT_RGB888)
+			temp |= DITHERING_ENABLE;
+
 		/* assert ip_tg_enable signal */
 		I915_WRITE(port_ctrl, temp | DPI_ENABLE);
 		POSTING_READ(port_ctrl);
-- 
2.19.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 3/4] drm/i915/dsi: Adjust crtc_clock for burst_mode_ratio
  2018-12-01 11:31 [PATCH 1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats Hans de Goede
  2018-12-01 11:31 ` [PATCH 2/4] drm/i915/dsi: Enable dithering for 6 bpc panels Hans de Goede
@ 2018-12-01 11:31 ` Hans de Goede
  2019-01-15 15:00   ` Ville Syrjälä
  2018-12-01 11:31 ` [PATCH 4/4] drm/i915/dsi: Call drm_connector_cleanup on vlv_dsi_init error exit path Hans de Goede
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Hans de Goede @ 2018-12-01 11:31 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Ville Syrjälä
  Cc: Hans de Goede, intel-gfx, dri-devel

On devices with a burst_mode_ratio which is not 100 (1:1), the pclk
will have a different value then drm_display_mode.clock .

On a Prowise PT301 tablet where vbt.lfp_lvds_vbt_mode.clock is 66100 and
burst_mode_ratio is 130 this leads to the following errors:

[drm:pipe_config_err [i915]] *ERROR* mismatch in
pixel_rate (expected 66100, found 86458)
[drm:pipe_config_err [i915]] *ERROR* mismatch in
base.adjusted_mode.crtc_clock (expected 66100, found 86458)
[drm:pipe_config_err [i915]] *ERROR* mismatch in
port_clock (expected 66100, found 86458)

This commit makes intel_dsi_compute_config() set
pipe_config.adjusted_mode.crtc_clock, taking the burst_mode_ratio into
account fixing this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/gpu/drm/i915/vlv_dsi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
index c21cbfa9653c..d72ccf557a9c 100644
--- a/drivers/gpu/drm/i915/vlv_dsi.c
+++ b/drivers/gpu/drm/i915/vlv_dsi.c
@@ -347,6 +347,10 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
 			return false;
 	}
 
+	adjusted_mode->crtc_clock =
+		DIV_ROUND_UP(adjusted_mode->crtc_clock *
+					 intel_dsi->burst_mode_ratio, 100);
+
 	pipe_config->clock_set = true;
 
 	return true;
-- 
2.19.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [PATCH 4/4] drm/i915/dsi: Call drm_connector_cleanup on vlv_dsi_init error exit path
  2018-12-01 11:31 [PATCH 1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats Hans de Goede
  2018-12-01 11:31 ` [PATCH 2/4] drm/i915/dsi: Enable dithering for 6 bpc panels Hans de Goede
  2018-12-01 11:31 ` [PATCH 3/4] drm/i915/dsi: Adjust crtc_clock for burst_mode_ratio Hans de Goede
@ 2018-12-01 11:31 ` Hans de Goede
  2019-01-25 21:05   ` Ville Syrjälä
  2018-12-01 12:01 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats Patchwork
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 17+ messages in thread
From: Hans de Goede @ 2018-12-01 11:31 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Ville Syrjälä
  Cc: Hans de Goede, intel-gfx, dri-devel

If we exit vlv_dsi_init() because we failed to find a fixed_mode, then
we've already called drm_connector_init() and we should call
drm_connector_cleanup() to unregister the connector object.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/gpu/drm/i915/vlv_dsi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
index d72ccf557a9c..7ca5aafcdf93 100644
--- a/drivers/gpu/drm/i915/vlv_dsi.c
+++ b/drivers/gpu/drm/i915/vlv_dsi.c
@@ -1861,7 +1861,7 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv)
 
 	if (!fixed_mode) {
 		DRM_DEBUG_KMS("no fixed mode\n");
-		goto err;
+		goto err_cleanup_connector;
 	}
 
 	connector->display_info.width_mm = fixed_mode->width_mm;
@@ -1874,6 +1874,8 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv)
 
 	return;
 
+err_cleanup_connector:
+	drm_connector_cleanup(&intel_connector->base);
 err:
 	drm_encoder_cleanup(&intel_encoder->base);
 	kfree(intel_dsi);
-- 
2.19.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats
  2018-12-01 11:31 [PATCH 1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats Hans de Goede
                   ` (2 preceding siblings ...)
  2018-12-01 11:31 ` [PATCH 4/4] drm/i915/dsi: Call drm_connector_cleanup on vlv_dsi_init error exit path Hans de Goede
@ 2018-12-01 12:01 ` Patchwork
  2018-12-01 12:20 ` ✓ Fi.CI.BAT: success " Patchwork
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Patchwork @ 2018-12-01 12:01 UTC (permalink / raw)
  To: Hans de Goede; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats
URL   : https://patchwork.freedesktop.org/series/53352/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
7325fa834a45 drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats
-:87: CHECK:OPEN_ENDED_LINE: Lines should not end with a '('
#87: FILE: drivers/gpu/drm/i915/vlv_dsi.c:1066:
+	bpp = mipi_dsi_pixel_format_to_bpp(

total: 0 errors, 0 warnings, 1 checks, 115 lines checked
4b3cb6708b5e drm/i915/dsi: Enable dithering for 6 bpc panels
292eb644fe44 drm/i915/dsi: Adjust crtc_clock for burst_mode_ratio
2481df3b8753 drm/i915/dsi: Call drm_connector_cleanup on vlv_dsi_init error exit path

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* ✓ Fi.CI.BAT: success for series starting with [1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats
  2018-12-01 11:31 [PATCH 1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats Hans de Goede
                   ` (3 preceding siblings ...)
  2018-12-01 12:01 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats Patchwork
@ 2018-12-01 12:20 ` Patchwork
  2018-12-01 22:45 ` ✓ Fi.CI.IGT: " Patchwork
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Patchwork @ 2018-12-01 12:20 UTC (permalink / raw)
  To: Hans de Goede; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats
URL   : https://patchwork.freedesktop.org/series/53352/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5237 -> Patchwork_10992
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/53352/revisions/1/mbox/

Possible new issues
-------------------

  Here are the unknown changes that may have been introduced in Patchwork_10992:

### IGT changes ###

#### Possible regressions ####

  * {igt@runner@aborted}:
    - fi-glk-dsi:         NOTRUN -> FAIL
    - fi-bxt-dsi:         NOTRUN -> FAIL

  
Known issues
------------

  Here are the changes found in Patchwork_10992 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@kms_pipe_crc_basic@nonblocking-crc-pipe-a-frame-sequence:
    - fi-byt-clapper:     PASS -> FAIL [fdo#103191] / [fdo#107362]

  * {igt@runner@aborted}:
    - {fi-icl-y}:         NOTRUN -> FAIL [fdo#108070]

  
#### Possible fixes ####

  * igt@kms_pipe_crc_basic@hang-read-crc-pipe-a:
    - fi-byt-clapper:     FAIL [fdo#103191] / [fdo#107362] -> PASS

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
  [fdo#108070]: https://bugs.freedesktop.org/show_bug.cgi?id=108070


Participating hosts (49 -> 42)
------------------------------

  Additional (1): fi-icl-y 
  Missing    (8): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-pnv-d510 fi-kbl-7560u 


Build changes
-------------

    * Linux: CI_DRM_5237 -> Patchwork_10992

  CI_DRM_5237: 2f99c4889e4124f9cf50b745d037f432318c4bb4 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4736: 285ebfb3b7adc56586031afa5150c4e5ad40c229 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_10992: 2481df3b8753c0420eb8c6e4b2b9d5e1b9f98262 @ git://anongit.freedesktop.org/gfx-ci/linux


== Linux commits ==

2481df3b8753 drm/i915/dsi: Call drm_connector_cleanup on vlv_dsi_init error exit path
292eb644fe44 drm/i915/dsi: Adjust crtc_clock for burst_mode_ratio
4b3cb6708b5e drm/i915/dsi: Enable dithering for 6 bpc panels
7325fa834a45 drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10992/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* ✓ Fi.CI.IGT: success for series starting with [1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats
  2018-12-01 11:31 [PATCH 1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats Hans de Goede
                   ` (4 preceding siblings ...)
  2018-12-01 12:20 ` ✓ Fi.CI.BAT: success " Patchwork
@ 2018-12-01 22:45 ` Patchwork
  2019-01-15 14:51 ` [PATCH 1/4] " Ville Syrjälä
  2019-04-05  6:34 ` Jani Nikula
  7 siblings, 0 replies; 17+ messages in thread
From: Patchwork @ 2018-12-01 22:45 UTC (permalink / raw)
  To: Hans de Goede; +Cc: intel-gfx

== Series Details ==

Series: series starting with [1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats
URL   : https://patchwork.freedesktop.org/series/53352/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5237_full -> Patchwork_10992_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  

Known issues
------------

  Here are the changes found in Patchwork_10992_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@i915_suspend@shrink:
    - shard-hsw:          NOTRUN -> DMESG-WARN [fdo#108784]
    - {shard-iclb}:       NOTRUN -> DMESG-WARN [fdo#108784]

  * igt@kms_busy@extended-modeset-hang-newfb-render-a:
    - shard-snb:          PASS -> DMESG-WARN [fdo#107956]

  * igt@kms_cursor_crc@cursor-256x256-onscreen:
    - shard-glk:          PASS -> FAIL [fdo#103232]

  * igt@kms_cursor_crc@cursor-64x21-sliding:
    - {shard-iclb}:       NOTRUN -> FAIL [fdo#103232] +2

  * igt@kms_draw_crc@draw-method-xrgb2101010-mmap-cpu-ytiled:
    - shard-apl:          PASS -> DMESG-WARN [fdo#103558] / [fdo#105602] +30

  * igt@kms_draw_crc@draw-method-xrgb8888-render-ytiled:
    - {shard-iclb}:       PASS -> WARN [fdo#108336]

  * igt@kms_flip@dpms-off-confusion:
    - {shard-iclb}:       PASS -> DMESG-WARN [fdo#107724] +6

  * igt@kms_flip@flip-vs-expired-vblank:
    - shard-glk:          PASS -> FAIL [fdo#102887] / [fdo#105363]

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-draw-mmap-cpu:
    - shard-apl:          PASS -> FAIL [fdo#103167] +2

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-fullscreen:
    - shard-glk:          PASS -> FAIL [fdo#103167] +1

  * igt@kms_frontbuffer_tracking@fbc-1p-rte:
    - shard-kbl:          PASS -> DMESG-WARN [fdo#103313] / [fdo#103558]

  * igt@kms_frontbuffer_tracking@fbc-badstride:
    - {shard-iclb}:       PASS -> DMESG-FAIL [fdo#107724] +4

  * igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-mmap-cpu:
    - {shard-iclb}:       NOTRUN -> FAIL [fdo#103167]

  * igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-fullscreen:
    - {shard-iclb}:       PASS -> FAIL [fdo#103167] +5

  * igt@kms_plane_alpha_blend@pipe-b-alpha-transparant-fb:
    - shard-kbl:          NOTRUN -> FAIL [fdo#108145]

  * igt@kms_plane_multiple@atomic-pipe-a-tiling-yf:
    - {shard-iclb}:       PASS -> FAIL [fdo#103166]

  * igt@kms_plane_multiple@atomic-pipe-b-tiling-x:
    - shard-apl:          PASS -> FAIL [fdo#103166] +1

  * igt@kms_plane_multiple@atomic-pipe-c-tiling-x:
    - shard-glk:          PASS -> FAIL [fdo#103166]

  * igt@kms_plane_multiple@atomic-pipe-c-tiling-y:
    - {shard-iclb}:       NOTRUN -> FAIL [fdo#103166]

  * igt@kms_rotation_crc@primary-y-tiled-reflect-x-270:
    - {shard-iclb}:       PASS -> DMESG-WARN [fdo#107724] / [fdo#108336] +1

  * igt@kms_setmode@basic:
    - shard-apl:          PASS -> FAIL [fdo#99912]

  * igt@kms_vblank@pipe-c-ts-continuation-dpms-suspend:
    - shard-kbl:          PASS -> DMESG-WARN [fdo#103558] / [fdo#103841] / [fdo#105079] / [fdo#105602]

  * igt@kms_vblank@pipe-c-wait-busy:
    - shard-kbl:          PASS -> DMESG-WARN [fdo#103313] / [fdo#103558] / [fdo#105602] +2

  * igt@pm_rpm@dpms-non-lpsp:
    - shard-kbl:          PASS -> DMESG-WARN [fdo#103558] / [fdo#105602] +4

  * {igt@runner@aborted}:
    - shard-kbl:          NOTRUN -> FAIL [fdo#103841]

  
#### Possible fixes ####

  * igt@gem_ctx_isolation@rcs0-s3:
    - shard-snb:          DMESG-WARN [fdo#102365] -> PASS

  * igt@gem_ppgtt@blt-vs-render-ctxn:
    - shard-kbl:          INCOMPLETE [fdo#103665] / [fdo#106023] / [fdo#106887] -> PASS

  * igt@kms_cursor_crc@cursor-64x64-onscreen:
    - shard-apl:          FAIL [fdo#103232] -> PASS +2

  * igt@kms_frontbuffer_tracking@fbc-1p-primscrn-cur-indfb-draw-mmap-cpu:
    - shard-glk:          FAIL [fdo#103167] -> PASS +2

  * igt@kms_plane@plane-position-covered-pipe-c-planes:
    - {shard-iclb}:       FAIL [fdo#103166] -> PASS

  * igt@kms_plane_multiple@atomic-pipe-b-tiling-y:
    - shard-apl:          FAIL [fdo#103166] -> PASS +2

  * igt@kms_plane_scaling@pipe-b-scaler-with-rotation:
    - {shard-iclb}:       DMESG-WARN [fdo#107724] -> PASS

  * igt@kms_vblank@pipe-b-ts-continuation-suspend:
    - {shard-iclb}:       INCOMPLETE [fdo#107713] -> PASS

  * igt@pm_rpm@legacy-planes:
    - {shard-iclb}:       DMESG-WARN [fdo#108654] -> PASS

  
#### Warnings ####

  * igt@i915_suspend@shrink:
    - shard-snb:          INCOMPLETE [fdo#105411] / [fdo#106886] -> DMESG-WARN [fdo#108784]

  * igt@kms_available_modes_crc@available_mode_test_crc:
    - shard-apl:          FAIL [fdo#106641] -> DMESG-FAIL [fdo#103558] / [fdo#105602] / [fdo#106641]

  * igt@kms_frontbuffer_tracking@psr-1p-primscrn-spr-indfb-draw-mmap-wc:
    - {shard-iclb}:       FAIL [fdo#103167] -> DMESG-WARN [fdo#107724] / [fdo#108336]

  * igt@kms_plane_alpha_blend@pipe-c-alpha-7efc:
    - shard-kbl:          FAIL [fdo#108145] / [fdo#108590] -> DMESG-FAIL [fdo#103313] / [fdo#103558] / [fdo#105602] / [fdo#108145]
    - shard-apl:          FAIL [fdo#108145] -> DMESG-FAIL [fdo#103558] / [fdo#105602] / [fdo#108145]

  * igt@kms_plane_alpha_blend@pipe-c-alpha-opaque-fb:
    - shard-kbl:          FAIL [fdo#108145] -> DMESG-FAIL [fdo#103558] / [fdo#105602] / [fdo#108145]

  
  {name}: This element is suppressed. This means it is ignored when computing
          the status of the difference (SUCCESS, WARNING, or FAILURE).

  [fdo#102365]: https://bugs.freedesktop.org/show_bug.cgi?id=102365
  [fdo#102887]: https://bugs.freedesktop.org/show_bug.cgi?id=102887
  [fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
  [fdo#103313]: https://bugs.freedesktop.org/show_bug.cgi?id=103313
  [fdo#103558]: https://bugs.freedesktop.org/show_bug.cgi?id=103558
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#103841]: https://bugs.freedesktop.org/show_bug.cgi?id=103841
  [fdo#105079]: https://bugs.freedesktop.org/show_bug.cgi?id=105079
  [fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
  [fdo#105411]: https://bugs.freedesktop.org/show_bug.cgi?id=105411
  [fdo#105602]: https://bugs.freedesktop.org/show_bug.cgi?id=105602
  [fdo#106023]: https://bugs.freedesktop.org/show_bug.cgi?id=106023
  [fdo#106641]: https://bugs.freedesktop.org/show_bug.cgi?id=106641
  [fdo#106886]: https://bugs.freedesktop.org/show_bug.cgi?id=106886
  [fdo#106887]: https://bugs.freedesktop.org/show_bug.cgi?id=106887
  [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
  [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
  [fdo#107956]: https://bugs.freedesktop.org/show_bug.cgi?id=107956
  [fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
  [fdo#108336]: https://bugs.freedesktop.org/show_bug.cgi?id=108336
  [fdo#108590]: https://bugs.freedesktop.org/show_bug.cgi?id=108590
  [fdo#108654]: https://bugs.freedesktop.org/show_bug.cgi?id=108654
  [fdo#108784]: https://bugs.freedesktop.org/show_bug.cgi?id=108784
  [fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912


Participating hosts (7 -> 7)
------------------------------

  No changes in participating hosts


Build changes
-------------

    * Linux: CI_DRM_5237 -> Patchwork_10992

  CI_DRM_5237: 2f99c4889e4124f9cf50b745d037f432318c4bb4 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGT_4736: 285ebfb3b7adc56586031afa5150c4e5ad40c229 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  Patchwork_10992: 2481df3b8753c0420eb8c6e4b2b9d5e1b9f98262 @ git://anongit.freedesktop.org/gfx-ci/linux
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_10992/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats
  2018-12-01 11:31 [PATCH 1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats Hans de Goede
                   ` (5 preceding siblings ...)
  2018-12-01 22:45 ` ✓ Fi.CI.IGT: " Patchwork
@ 2019-01-15 14:51 ` Ville Syrjälä
  2019-01-21  9:53   ` Hans de Goede
  2019-04-05  6:34 ` Jani Nikula
  7 siblings, 1 reply; 17+ messages in thread
From: Ville Syrjälä @ 2019-01-15 14:51 UTC (permalink / raw)
  To: Hans de Goede; +Cc: intel-gfx, dri-devel

On Sat, Dec 01, 2018 at 12:31:45PM +0100, Hans de Goede wrote:
> There are 3 problems with the dsi code's pipe_bpp handling for 6 bpc
> pixel-formats which this commit addresses:
> 
> 1) It assumes that the pipe_bpp is the same as the bpp going over the dsi
> lanes. This assumption is not valid for MIPI_DSI_FMT_RGB666, where pipe_bpp
> should be 18 so that we do proper dithering but we actually send 24 bpp
> over the dsi lanes (MIPI_DSI_FMT_RGB666_PACKED sends 18 bpp).
> 
> This assumption is enforced by an assert in *_dsi_get_pclk(). This assert
> triggers on the initial hw-state readback on BYT/CHT devices which use
> MIPI_DSI_FMT_RGB666, such as the Prowise PT301 tablet. PIPECONF is set to
> 6BPC / 18 bpp by the GOP, while mipi_dsi_pixel_format_to_bpp() returns 24.
> 
> This commits switches the calculations in *_dsi_get_pclk() to use the bpp
> from mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format) which
> returns the bpp going over the mipi lanes and drops the assert.
> 
> 2) On BXT bxt_dsi_get_pipe_config() wrongly overrides the pipe_bpp which
> i9xx_get_pipe_config() reads from PIPECONF with the return value from
> mipi_dsi_pixel_format_to_bpp(). This avoids the assert from 1. but is wrong
> since the pipe is actually running at the value configured in PIPECONF.
> 
> This commit drops the override of pipe_bpp from bxt_dsi_get_pipe_config().
> 
> 3) The dsi encoder's compute_config() never assigns a value to pipe_bpp,
> unlike most other encoders. Falling back on compute_baseline_pipe_bpp()
> which always picks 24. 24 is only correct for MIPI_DSI_FMT_RGB88 for the
> others we should use 18 bpp so that we correctly do 6bpc color dithering.
> 
> This commit adds code to intel_dsi_compute_config() to properly set
> pipe_bpp based on intel_dsi->pixel_format.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

lgtm
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

That said, I think we could make everything less confusing by doing
something like this:

compute_config() {
	port_clock = bitrate;
}

get_config() {
	port_clock = readout from pll;
	crtc_clock = derive from port_clock;
}

> ---
>  drivers/gpu/drm/i915/intel_dsi.h   |  4 ++--
>  drivers/gpu/drm/i915/vlv_dsi.c     | 17 ++++++++--------
>  drivers/gpu/drm/i915/vlv_dsi_pll.c | 31 ++++++------------------------
>  3 files changed, 17 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
> index c888c219835f..c796a2962a43 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.h
> +++ b/drivers/gpu/drm/i915/intel_dsi.h
> @@ -160,7 +160,7 @@ int vlv_dsi_pll_compute(struct intel_encoder *encoder,
>  void vlv_dsi_pll_enable(struct intel_encoder *encoder,
>  			const struct intel_crtc_state *config);
>  void vlv_dsi_pll_disable(struct intel_encoder *encoder);
> -u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
> +u32 vlv_dsi_get_pclk(struct intel_encoder *encoder,
>  		     struct intel_crtc_state *config);
>  void vlv_dsi_reset_clocks(struct intel_encoder *encoder, enum port port);
>  
> @@ -170,7 +170,7 @@ int bxt_dsi_pll_compute(struct intel_encoder *encoder,
>  void bxt_dsi_pll_enable(struct intel_encoder *encoder,
>  			const struct intel_crtc_state *config);
>  void bxt_dsi_pll_disable(struct intel_encoder *encoder);
> -u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
> +u32 bxt_dsi_get_pclk(struct intel_encoder *encoder,
>  		     struct intel_crtc_state *config);
>  void bxt_dsi_reset_clocks(struct intel_encoder *encoder, enum port port);
>  
> diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
> index be3af5f6c7a0..c10def5efa22 100644
> --- a/drivers/gpu/drm/i915/vlv_dsi.c
> +++ b/drivers/gpu/drm/i915/vlv_dsi.c
> @@ -322,6 +322,11 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>  	/* DSI uses short packets for sync events, so clear mode flags for DSI */
>  	adjusted_mode->flags = 0;
>  
> +	if (intel_dsi->pixel_format == MIPI_DSI_FMT_RGB888)
> +		pipe_config->pipe_bpp = 24;
> +	else
> +		pipe_config->pipe_bpp = 18;
> +
>  	if (IS_GEN9_LP(dev_priv)) {
>  		/* Enable Frame time stamp based scanline reporting */
>  		adjusted_mode->private_flags |=
> @@ -1097,10 +1102,8 @@ static void bxt_dsi_get_pipe_config(struct intel_encoder *encoder,
>  	}
>  
>  	fmt = I915_READ(MIPI_DSI_FUNC_PRG(port)) & VID_MODE_FORMAT_MASK;
> -	pipe_config->pipe_bpp =
> -			mipi_dsi_pixel_format_to_bpp(
> -				pixel_format_from_register_bits(fmt));
> -	bpp = pipe_config->pipe_bpp;
> +	bpp = mipi_dsi_pixel_format_to_bpp(
> +			pixel_format_from_register_bits(fmt));
>  
>  	/* Enable Frame time stamo based scanline reporting */
>  	adjusted_mode->private_flags |=
> @@ -1238,11 +1241,9 @@ static void intel_dsi_get_config(struct intel_encoder *encoder,
>  
>  	if (IS_GEN9_LP(dev_priv)) {
>  		bxt_dsi_get_pipe_config(encoder, pipe_config);
> -		pclk = bxt_dsi_get_pclk(encoder, pipe_config->pipe_bpp,
> -					pipe_config);
> +		pclk = bxt_dsi_get_pclk(encoder, pipe_config);
>  	} else {
> -		pclk = vlv_dsi_get_pclk(encoder, pipe_config->pipe_bpp,
> -					pipe_config);
> +		pclk = vlv_dsi_get_pclk(encoder, pipe_config);
>  	}
>  
>  	if (pclk) {
> diff --git a/drivers/gpu/drm/i915/vlv_dsi_pll.c b/drivers/gpu/drm/i915/vlv_dsi_pll.c
> index a132a8037ecc..954d5a8c4fa7 100644
> --- a/drivers/gpu/drm/i915/vlv_dsi_pll.c
> +++ b/drivers/gpu/drm/i915/vlv_dsi_pll.c
> @@ -252,20 +252,12 @@ void bxt_dsi_pll_disable(struct intel_encoder *encoder)
>  		DRM_ERROR("Timeout waiting for PLL lock deassertion\n");
>  }
>  
> -static void assert_bpp_mismatch(enum mipi_dsi_pixel_format fmt, int pipe_bpp)
> -{
> -	int bpp = mipi_dsi_pixel_format_to_bpp(fmt);
> -
> -	WARN(bpp != pipe_bpp,
> -	     "bpp match assertion failure (expected %d, current %d)\n",
> -	     bpp, pipe_bpp);
> -}
> -
> -u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
> +u32 vlv_dsi_get_pclk(struct intel_encoder *encoder,
>  		     struct intel_crtc_state *config)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
> +	int bpp = mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format);
>  	u32 dsi_clock, pclk;
>  	u32 pll_ctl, pll_div;
>  	u32 m = 0, p = 0, n;
> @@ -319,15 +311,12 @@ u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
>  
>  	dsi_clock = (m * refclk) / (p * n);
>  
> -	/* pixel_format and pipe_bpp should agree */
> -	assert_bpp_mismatch(intel_dsi->pixel_format, pipe_bpp);
> -
> -	pclk = DIV_ROUND_CLOSEST(dsi_clock * intel_dsi->lane_count, pipe_bpp);
> +	pclk = DIV_ROUND_CLOSEST(dsi_clock * intel_dsi->lane_count, bpp);
>  
>  	return pclk;
>  }
>  
> -u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
> +u32 bxt_dsi_get_pclk(struct intel_encoder *encoder,
>  		     struct intel_crtc_state *config)
>  {
>  	u32 pclk;
> @@ -335,12 +324,7 @@ u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
>  	u32 dsi_ratio;
>  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> -
> -	/* Divide by zero */
> -	if (!pipe_bpp) {
> -		DRM_ERROR("Invalid BPP(0)\n");
> -		return 0;
> -	}
> +	int bpp = mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format);
>  
>  	config->dsi_pll.ctrl = I915_READ(BXT_DSI_PLL_CTL);
>  
> @@ -348,10 +332,7 @@ u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
>  
>  	dsi_clk = (dsi_ratio * BXT_REF_CLOCK_KHZ) / 2;
>  
> -	/* pixel_format and pipe_bpp should agree */
> -	assert_bpp_mismatch(intel_dsi->pixel_format, pipe_bpp);
> -
> -	pclk = DIV_ROUND_CLOSEST(dsi_clk * intel_dsi->lane_count, pipe_bpp);
> +	pclk = DIV_ROUND_CLOSEST(dsi_clk * intel_dsi->lane_count, bpp);
>  
>  	DRM_DEBUG_DRIVER("Calculated pclk=%u\n", pclk);
>  	return pclk;
> -- 
> 2.19.1

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/4] drm/i915/dsi: Enable dithering for 6 bpc panels
  2018-12-01 11:31 ` [PATCH 2/4] drm/i915/dsi: Enable dithering for 6 bpc panels Hans de Goede
@ 2019-01-15 14:55   ` Ville Syrjälä
  2019-01-21  9:54     ` Hans de Goede
  0 siblings, 1 reply; 17+ messages in thread
From: Ville Syrjälä @ 2019-01-15 14:55 UTC (permalink / raw)
  To: Hans de Goede; +Cc: intel-gfx, dri-devel

On Sat, Dec 01, 2018 at 12:31:46PM +0100, Hans de Goede wrote:
> The display engine has 2 dithering enable bits which both need to be set
> for dithering to happen, 1 in the PIPECONF register which is taken care of
> by i9xx_set_pipeconf() and a second bit at the encoder level.
> 
> The dsi code was not setting the encoder level dithering enable bit causing
> dithering to be disabled, this commit fixes this.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/gpu/drm/i915/vlv_dsi.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
> index c10def5efa22..c21cbfa9653c 100644
> --- a/drivers/gpu/drm/i915/vlv_dsi.c
> +++ b/drivers/gpu/drm/i915/vlv_dsi.c
> @@ -711,6 +711,10 @@ static void intel_dsi_port_enable(struct intel_encoder *encoder,
>  					LANE_CONFIGURATION_DUAL_LINK_B :
>  					LANE_CONFIGURATION_DUAL_LINK_A;
>  		}
> +
> +		if (intel_dsi->pixel_format != MIPI_DSI_FMT_RGB888)
> +			temp |= DITHERING_ENABLE;

The docs say this was only made to work in C0 stepping. Not sure any
BYT-Ts were ever shipped with B2/3, nor am I sure if setting the bit
would have any effect there. IMO let's just set the bit and hope for
the best.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> +
>  		/* assert ip_tg_enable signal */
>  		I915_WRITE(port_ctrl, temp | DPI_ENABLE);
>  		POSTING_READ(port_ctrl);
> -- 
> 2.19.1

-- 
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/4] drm/i915/dsi: Adjust crtc_clock for burst_mode_ratio
  2018-12-01 11:31 ` [PATCH 3/4] drm/i915/dsi: Adjust crtc_clock for burst_mode_ratio Hans de Goede
@ 2019-01-15 15:00   ` Ville Syrjälä
  2019-01-21 14:26     ` Hans de Goede
  0 siblings, 1 reply; 17+ messages in thread
From: Ville Syrjälä @ 2019-01-15 15:00 UTC (permalink / raw)
  To: Hans de Goede; +Cc: intel-gfx, dri-devel, Rodrigo Vivi

On Sat, Dec 01, 2018 at 12:31:47PM +0100, Hans de Goede wrote:
> On devices with a burst_mode_ratio which is not 100 (1:1), the pclk
> will have a different value then drm_display_mode.clock .
> 
> On a Prowise PT301 tablet where vbt.lfp_lvds_vbt_mode.clock is 66100 and
> burst_mode_ratio is 130 this leads to the following errors:
> 
> [drm:pipe_config_err [i915]] *ERROR* mismatch in
> pixel_rate (expected 66100, found 86458)
> [drm:pipe_config_err [i915]] *ERROR* mismatch in
> base.adjusted_mode.crtc_clock (expected 66100, found 86458)
> [drm:pipe_config_err [i915]] *ERROR* mismatch in
> port_clock (expected 66100, found 86458)
> 
> This commit makes intel_dsi_compute_config() set
> pipe_config.adjusted_mode.crtc_clock, taking the burst_mode_ratio into
> account fixing this.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/gpu/drm/i915/vlv_dsi.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
> index c21cbfa9653c..d72ccf557a9c 100644
> --- a/drivers/gpu/drm/i915/vlv_dsi.c
> +++ b/drivers/gpu/drm/i915/vlv_dsi.c
> @@ -347,6 +347,10 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>  			return false;
>  	}
>  
> +	adjusted_mode->crtc_clock =
> +		DIV_ROUND_UP(adjusted_mode->crtc_clock *
> +					 intel_dsi->burst_mode_ratio, 100);

Hmm. Won't this cause incorrect refresh rate to be used in eg.
vblank timestmap calculations?

OTOH if the pipe is really fetching data at the higher burst
rate then we should rather want to calculate the watermarks/cdclk
based on that higher rate. We do have pixel_rate in the crtc state
but atm that is computed in generic code. We might have to push that
to be encoder specific to do this correctly...

> +
>  	pipe_config->clock_set = true;
>  
>  	return true;
> -- 
> 2.19.1

-- 
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats
  2019-01-15 14:51 ` [PATCH 1/4] " Ville Syrjälä
@ 2019-01-21  9:53   ` Hans de Goede
  0 siblings, 0 replies; 17+ messages in thread
From: Hans de Goede @ 2019-01-21  9:53 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx, dri-devel

Hi,

On 15-01-19 15:51, Ville Syrjälä wrote:
> On Sat, Dec 01, 2018 at 12:31:45PM +0100, Hans de Goede wrote:
>> There are 3 problems with the dsi code's pipe_bpp handling for 6 bpc
>> pixel-formats which this commit addresses:
>>
>> 1) It assumes that the pipe_bpp is the same as the bpp going over the dsi
>> lanes. This assumption is not valid for MIPI_DSI_FMT_RGB666, where pipe_bpp
>> should be 18 so that we do proper dithering but we actually send 24 bpp
>> over the dsi lanes (MIPI_DSI_FMT_RGB666_PACKED sends 18 bpp).
>>
>> This assumption is enforced by an assert in *_dsi_get_pclk(). This assert
>> triggers on the initial hw-state readback on BYT/CHT devices which use
>> MIPI_DSI_FMT_RGB666, such as the Prowise PT301 tablet. PIPECONF is set to
>> 6BPC / 18 bpp by the GOP, while mipi_dsi_pixel_format_to_bpp() returns 24.
>>
>> This commits switches the calculations in *_dsi_get_pclk() to use the bpp
>> from mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format) which
>> returns the bpp going over the mipi lanes and drops the assert.
>>
>> 2) On BXT bxt_dsi_get_pipe_config() wrongly overrides the pipe_bpp which
>> i9xx_get_pipe_config() reads from PIPECONF with the return value from
>> mipi_dsi_pixel_format_to_bpp(). This avoids the assert from 1. but is wrong
>> since the pipe is actually running at the value configured in PIPECONF.
>>
>> This commit drops the override of pipe_bpp from bxt_dsi_get_pipe_config().
>>
>> 3) The dsi encoder's compute_config() never assigns a value to pipe_bpp,
>> unlike most other encoders. Falling back on compute_baseline_pipe_bpp()
>> which always picks 24. 24 is only correct for MIPI_DSI_FMT_RGB88 for the
>> others we should use 18 bpp so that we correctly do 6bpc color dithering.
>>
>> This commit adds code to intel_dsi_compute_config() to properly set
>> pipe_bpp based on intel_dsi->pixel_format.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> 
> lgtm
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Thank you.

> That said, I think we could make everything less confusing by doing
> something like this:
> 
> compute_config() {
> 	port_clock = bitrate;
> }
> 
> get_config() {
> 	port_clock = readout from pll;
> 	crtc_clock = derive from port_clock;
> }

Currently the code assumes that port_clock == crtc_clock, if make port_clock
reflect the actual pll clock, without compensating for number of lanes
and bpp, I think we need to make changes in more places.

Regards,

Hans





> 
>> ---
>>   drivers/gpu/drm/i915/intel_dsi.h   |  4 ++--
>>   drivers/gpu/drm/i915/vlv_dsi.c     | 17 ++++++++--------
>>   drivers/gpu/drm/i915/vlv_dsi_pll.c | 31 ++++++------------------------
>>   3 files changed, 17 insertions(+), 35 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
>> index c888c219835f..c796a2962a43 100644
>> --- a/drivers/gpu/drm/i915/intel_dsi.h
>> +++ b/drivers/gpu/drm/i915/intel_dsi.h
>> @@ -160,7 +160,7 @@ int vlv_dsi_pll_compute(struct intel_encoder *encoder,
>>   void vlv_dsi_pll_enable(struct intel_encoder *encoder,
>>   			const struct intel_crtc_state *config);
>>   void vlv_dsi_pll_disable(struct intel_encoder *encoder);
>> -u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
>> +u32 vlv_dsi_get_pclk(struct intel_encoder *encoder,
>>   		     struct intel_crtc_state *config);
>>   void vlv_dsi_reset_clocks(struct intel_encoder *encoder, enum port port);
>>   
>> @@ -170,7 +170,7 @@ int bxt_dsi_pll_compute(struct intel_encoder *encoder,
>>   void bxt_dsi_pll_enable(struct intel_encoder *encoder,
>>   			const struct intel_crtc_state *config);
>>   void bxt_dsi_pll_disable(struct intel_encoder *encoder);
>> -u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
>> +u32 bxt_dsi_get_pclk(struct intel_encoder *encoder,
>>   		     struct intel_crtc_state *config);
>>   void bxt_dsi_reset_clocks(struct intel_encoder *encoder, enum port port);
>>   
>> diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
>> index be3af5f6c7a0..c10def5efa22 100644
>> --- a/drivers/gpu/drm/i915/vlv_dsi.c
>> +++ b/drivers/gpu/drm/i915/vlv_dsi.c
>> @@ -322,6 +322,11 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>>   	/* DSI uses short packets for sync events, so clear mode flags for DSI */
>>   	adjusted_mode->flags = 0;
>>   
>> +	if (intel_dsi->pixel_format == MIPI_DSI_FMT_RGB888)
>> +		pipe_config->pipe_bpp = 24;
>> +	else
>> +		pipe_config->pipe_bpp = 18;
>> +
>>   	if (IS_GEN9_LP(dev_priv)) {
>>   		/* Enable Frame time stamp based scanline reporting */
>>   		adjusted_mode->private_flags |=
>> @@ -1097,10 +1102,8 @@ static void bxt_dsi_get_pipe_config(struct intel_encoder *encoder,
>>   	}
>>   
>>   	fmt = I915_READ(MIPI_DSI_FUNC_PRG(port)) & VID_MODE_FORMAT_MASK;
>> -	pipe_config->pipe_bpp =
>> -			mipi_dsi_pixel_format_to_bpp(
>> -				pixel_format_from_register_bits(fmt));
>> -	bpp = pipe_config->pipe_bpp;
>> +	bpp = mipi_dsi_pixel_format_to_bpp(
>> +			pixel_format_from_register_bits(fmt));
>>   
>>   	/* Enable Frame time stamo based scanline reporting */
>>   	adjusted_mode->private_flags |=
>> @@ -1238,11 +1241,9 @@ static void intel_dsi_get_config(struct intel_encoder *encoder,
>>   
>>   	if (IS_GEN9_LP(dev_priv)) {
>>   		bxt_dsi_get_pipe_config(encoder, pipe_config);
>> -		pclk = bxt_dsi_get_pclk(encoder, pipe_config->pipe_bpp,
>> -					pipe_config);
>> +		pclk = bxt_dsi_get_pclk(encoder, pipe_config);
>>   	} else {
>> -		pclk = vlv_dsi_get_pclk(encoder, pipe_config->pipe_bpp,
>> -					pipe_config);
>> +		pclk = vlv_dsi_get_pclk(encoder, pipe_config);
>>   	}
>>   
>>   	if (pclk) {
>> diff --git a/drivers/gpu/drm/i915/vlv_dsi_pll.c b/drivers/gpu/drm/i915/vlv_dsi_pll.c
>> index a132a8037ecc..954d5a8c4fa7 100644
>> --- a/drivers/gpu/drm/i915/vlv_dsi_pll.c
>> +++ b/drivers/gpu/drm/i915/vlv_dsi_pll.c
>> @@ -252,20 +252,12 @@ void bxt_dsi_pll_disable(struct intel_encoder *encoder)
>>   		DRM_ERROR("Timeout waiting for PLL lock deassertion\n");
>>   }
>>   
>> -static void assert_bpp_mismatch(enum mipi_dsi_pixel_format fmt, int pipe_bpp)
>> -{
>> -	int bpp = mipi_dsi_pixel_format_to_bpp(fmt);
>> -
>> -	WARN(bpp != pipe_bpp,
>> -	     "bpp match assertion failure (expected %d, current %d)\n",
>> -	     bpp, pipe_bpp);
>> -}
>> -
>> -u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
>> +u32 vlv_dsi_get_pclk(struct intel_encoder *encoder,
>>   		     struct intel_crtc_state *config)
>>   {
>>   	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>>   	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
>> +	int bpp = mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format);
>>   	u32 dsi_clock, pclk;
>>   	u32 pll_ctl, pll_div;
>>   	u32 m = 0, p = 0, n;
>> @@ -319,15 +311,12 @@ u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
>>   
>>   	dsi_clock = (m * refclk) / (p * n);
>>   
>> -	/* pixel_format and pipe_bpp should agree */
>> -	assert_bpp_mismatch(intel_dsi->pixel_format, pipe_bpp);
>> -
>> -	pclk = DIV_ROUND_CLOSEST(dsi_clock * intel_dsi->lane_count, pipe_bpp);
>> +	pclk = DIV_ROUND_CLOSEST(dsi_clock * intel_dsi->lane_count, bpp);
>>   
>>   	return pclk;
>>   }
>>   
>> -u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
>> +u32 bxt_dsi_get_pclk(struct intel_encoder *encoder,
>>   		     struct intel_crtc_state *config)
>>   {
>>   	u32 pclk;
>> @@ -335,12 +324,7 @@ u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
>>   	u32 dsi_ratio;
>>   	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
>>   	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>> -
>> -	/* Divide by zero */
>> -	if (!pipe_bpp) {
>> -		DRM_ERROR("Invalid BPP(0)\n");
>> -		return 0;
>> -	}
>> +	int bpp = mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format);
>>   
>>   	config->dsi_pll.ctrl = I915_READ(BXT_DSI_PLL_CTL);
>>   
>> @@ -348,10 +332,7 @@ u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
>>   
>>   	dsi_clk = (dsi_ratio * BXT_REF_CLOCK_KHZ) / 2;
>>   
>> -	/* pixel_format and pipe_bpp should agree */
>> -	assert_bpp_mismatch(intel_dsi->pixel_format, pipe_bpp);
>> -
>> -	pclk = DIV_ROUND_CLOSEST(dsi_clk * intel_dsi->lane_count, pipe_bpp);
>> +	pclk = DIV_ROUND_CLOSEST(dsi_clk * intel_dsi->lane_count, bpp);
>>   
>>   	DRM_DEBUG_DRIVER("Calculated pclk=%u\n", pclk);
>>   	return pclk;
>> -- 
>> 2.19.1
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 2/4] drm/i915/dsi: Enable dithering for 6 bpc panels
  2019-01-15 14:55   ` Ville Syrjälä
@ 2019-01-21  9:54     ` Hans de Goede
  0 siblings, 0 replies; 17+ messages in thread
From: Hans de Goede @ 2019-01-21  9:54 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx, dri-devel

Hi,

On 15-01-19 15:55, Ville Syrjälä wrote:
> On Sat, Dec 01, 2018 at 12:31:46PM +0100, Hans de Goede wrote:
>> The display engine has 2 dithering enable bits which both need to be set
>> for dithering to happen, 1 in the PIPECONF register which is taken care of
>> by i9xx_set_pipeconf() and a second bit at the encoder level.
>>
>> The dsi code was not setting the encoder level dithering enable bit causing
>> dithering to be disabled, this commit fixes this.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   drivers/gpu/drm/i915/vlv_dsi.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
>> index c10def5efa22..c21cbfa9653c 100644
>> --- a/drivers/gpu/drm/i915/vlv_dsi.c
>> +++ b/drivers/gpu/drm/i915/vlv_dsi.c
>> @@ -711,6 +711,10 @@ static void intel_dsi_port_enable(struct intel_encoder *encoder,
>>   					LANE_CONFIGURATION_DUAL_LINK_B :
>>   					LANE_CONFIGURATION_DUAL_LINK_A;
>>   		}
>> +
>> +		if (intel_dsi->pixel_format != MIPI_DSI_FMT_RGB888)
>> +			temp |= DITHERING_ENABLE;
> 
> The docs say this was only made to work in C0 stepping. Not sure any
> BYT-Ts were ever shipped with B2/3, nor am I sure if setting the bit
> would have any effect there. IMO let's just set the bit and hope for
> the best.
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Thank you, I've pushed patches 1 and 2 of this series to dinq.

Regards,

Hans

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/4] drm/i915/dsi: Adjust crtc_clock for burst_mode_ratio
  2019-01-15 15:00   ` Ville Syrjälä
@ 2019-01-21 14:26     ` Hans de Goede
  2019-01-21 15:30       ` Hans de Goede
  0 siblings, 1 reply; 17+ messages in thread
From: Hans de Goede @ 2019-01-21 14:26 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx, dri-devel, Rodrigo Vivi

Hi,

On 15-01-19 16:00, Ville Syrjälä wrote:
> On Sat, Dec 01, 2018 at 12:31:47PM +0100, Hans de Goede wrote:
>> On devices with a burst_mode_ratio which is not 100 (1:1), the pclk
>> will have a different value then drm_display_mode.clock .
>>
>> On a Prowise PT301 tablet where vbt.lfp_lvds_vbt_mode.clock is 66100 and
>> burst_mode_ratio is 130 this leads to the following errors:
>>
>> [drm:pipe_config_err [i915]] *ERROR* mismatch in
>> pixel_rate (expected 66100, found 86458)
>> [drm:pipe_config_err [i915]] *ERROR* mismatch in
>> base.adjusted_mode.crtc_clock (expected 66100, found 86458)
>> [drm:pipe_config_err [i915]] *ERROR* mismatch in
>> port_clock (expected 66100, found 86458)
>>
>> This commit makes intel_dsi_compute_config() set
>> pipe_config.adjusted_mode.crtc_clock, taking the burst_mode_ratio into
>> account fixing this.
>>
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>>   drivers/gpu/drm/i915/vlv_dsi.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
>> index c21cbfa9653c..d72ccf557a9c 100644
>> --- a/drivers/gpu/drm/i915/vlv_dsi.c
>> +++ b/drivers/gpu/drm/i915/vlv_dsi.c
>> @@ -347,6 +347,10 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>>   			return false;
>>   	}
>>   
>> +	adjusted_mode->crtc_clock =
>> +		DIV_ROUND_UP(adjusted_mode->crtc_clock *
>> +					 intel_dsi->burst_mode_ratio, 100);
> 
> Hmm. Won't this cause incorrect refresh rate to be used in eg.
> vblank timestmap calculations?

I guess so.

Note that this patch does not change any values actually written to
the hardware. It seems that devices which actually use the burst mode
are quite rare (this is the first one encounter in probably over 40
different byt/cht devices I've tested).

I've a feeling that the entire pipeline is actually running at
the higher rate and that the framerate really is 30% higher.

Looking at the code, it seems that what a burst_mode_ratio of 130'does is make
all the values in the "modeline" except for the visual area 30% larger, which
means that we are probably already messing up the vblank calculations
anyways, since using either the uncorrected or the corrected clock is
wrong when using htotal from the original modeline, as looking at
txbyteclkhs we will use bigger values for all drm_display_mode
values except for the active region.

I think that the right way to deal with this is to isolate the
burst_ratio handling to intel_dsi_vbt.c and adjust the modeline
coming from the VBT by multiplying the clock and all timing
parameters (except h/vdisplay) there by the burst_ratio and
then recalculating h/vtotal.

This should lead to getting the vblank timestamp stuff right and
allows removing of burst_mode_ratio from all code except for the
vbt code.

If that is too invasive, given that this setup is quite rate,
then I suggest we just go with this patch. My main concern is fixing
the WARN_ON. This patch successfully does that.

> OTOH if the pipe is really fetching data at the higher burst
> rate then we should rather want to calculate the watermarks/cdclk
> based on that higher rate.

Right, the more I think about this, the more I believe calculating
a new modeline correcting for burst_ratio inside the vbt code and
dropping burst_mode_ratio handling everywhere else is the right thing
to do.

Regards,

Hans

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 3/4] drm/i915/dsi: Adjust crtc_clock for burst_mode_ratio
  2019-01-21 14:26     ` Hans de Goede
@ 2019-01-21 15:30       ` Hans de Goede
  0 siblings, 0 replies; 17+ messages in thread
From: Hans de Goede @ 2019-01-21 15:30 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx, dri-devel

Hi,

On 21-01-19 15:26, Hans de Goede wrote:
> Hi,
> 
> On 15-01-19 16:00, Ville Syrjälä wrote:
>> On Sat, Dec 01, 2018 at 12:31:47PM +0100, Hans de Goede wrote:
>>> On devices with a burst_mode_ratio which is not 100 (1:1), the pclk
>>> will have a different value then drm_display_mode.clock .
>>>
>>> On a Prowise PT301 tablet where vbt.lfp_lvds_vbt_mode.clock is 66100 and
>>> burst_mode_ratio is 130 this leads to the following errors:
>>>
>>> [drm:pipe_config_err [i915]] *ERROR* mismatch in
>>> pixel_rate (expected 66100, found 86458)
>>> [drm:pipe_config_err [i915]] *ERROR* mismatch in
>>> base.adjusted_mode.crtc_clock (expected 66100, found 86458)
>>> [drm:pipe_config_err [i915]] *ERROR* mismatch in
>>> port_clock (expected 66100, found 86458)
>>>
>>> This commit makes intel_dsi_compute_config() set
>>> pipe_config.adjusted_mode.crtc_clock, taking the burst_mode_ratio into
>>> account fixing this.
>>>
>>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>>> ---
>>>   drivers/gpu/drm/i915/vlv_dsi.c | 4 ++++
>>>   1 file changed, 4 insertions(+)
>>>
>>> diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
>>> index c21cbfa9653c..d72ccf557a9c 100644
>>> --- a/drivers/gpu/drm/i915/vlv_dsi.c
>>> +++ b/drivers/gpu/drm/i915/vlv_dsi.c
>>> @@ -347,6 +347,10 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>>>               return false;
>>>       }
>>> +    adjusted_mode->crtc_clock =
>>> +        DIV_ROUND_UP(adjusted_mode->crtc_clock *
>>> +                     intel_dsi->burst_mode_ratio, 100);
>>
>> Hmm. Won't this cause incorrect refresh rate to be used in eg.
>> vblank timestmap calculations?
> 
> I guess so.
> 
> Note that this patch does not change any values actually written to
> the hardware. It seems that devices which actually use the burst mode
> are quite rare (this is the first one encounter in probably over 40
> different byt/cht devices I've tested).
> 
> I've a feeling that the entire pipeline is actually running at
> the higher rate and that the framerate really is 30% higher.
> 
> Looking at the code, it seems that what a burst_mode_ratio of 130'does is make
> all the values in the "modeline" except for the visual area 30% larger, which
> means that we are probably already messing up the vblank calculations
> anyways, since using either the uncorrected or the corrected clock is
> wrong when using htotal from the original modeline, as looking at
> txbyteclkhs we will use bigger values for all drm_display_mode
> values except for the active region.
> 
> I think that the right way to deal with this is to isolate the
> burst_ratio handling to intel_dsi_vbt.c and adjust the modeline
> coming from the VBT by multiplying the clock and all timing
> parameters (except h/vdisplay) there by the burst_ratio and
> then recalculating h/vtotal.
> 
> This should lead to getting the vblank timestamp stuff right and
> allows removing of burst_mode_ratio from all code except for the
> vbt code.
> 
> If that is too invasive, given that this setup is quite rate,
> then I suggest we just go with this patch. My main concern is fixing
> the WARN_ON. This patch successfully does that.
> 
>> OTOH if the pipe is really fetching data at the higher burst
>> rate then we should rather want to calculate the watermarks/cdclk
>> based on that higher rate.
> 
> Right, the more I think about this, the more I believe calculating
> a new modeline correcting for burst_ratio inside the vbt code and
> dropping burst_mode_ratio handling everywhere else is the right thing
> to do.
> 
> Regards,
> 
> Hans

p.s.

The 4th patch in this series is independent of the others, it fixes
a small bug (not freeing a resource) in an exit error path which I
noticed. It would be great if someone can review the 4th patch then
I can push that one too and then this patch will be the only unmerged
patch from this series.

Regards,

Hans


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 4/4] drm/i915/dsi: Call drm_connector_cleanup on vlv_dsi_init error exit path
  2018-12-01 11:31 ` [PATCH 4/4] drm/i915/dsi: Call drm_connector_cleanup on vlv_dsi_init error exit path Hans de Goede
@ 2019-01-25 21:05   ` Ville Syrjälä
  0 siblings, 0 replies; 17+ messages in thread
From: Ville Syrjälä @ 2019-01-25 21:05 UTC (permalink / raw)
  To: Hans de Goede; +Cc: intel-gfx, dri-devel, Rodrigo Vivi

On Sat, Dec 01, 2018 at 12:31:48PM +0100, Hans de Goede wrote:
> If we exit vlv_dsi_init() because we failed to find a fixed_mode, then
> we've already called drm_connector_init() and we should call
> drm_connector_cleanup() to unregister the connector object.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/vlv_dsi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
> index d72ccf557a9c..7ca5aafcdf93 100644
> --- a/drivers/gpu/drm/i915/vlv_dsi.c
> +++ b/drivers/gpu/drm/i915/vlv_dsi.c
> @@ -1861,7 +1861,7 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv)
>  
>  	if (!fixed_mode) {
>  		DRM_DEBUG_KMS("no fixed mode\n");
> -		goto err;
> +		goto err_cleanup_connector;
>  	}
>  
>  	connector->display_info.width_mm = fixed_mode->width_mm;
> @@ -1874,6 +1874,8 @@ void vlv_dsi_init(struct drm_i915_private *dev_priv)
>  
>  	return;
>  
> +err_cleanup_connector:
> +	drm_connector_cleanup(&intel_connector->base);
>  err:
>  	drm_encoder_cleanup(&intel_encoder->base);
>  	kfree(intel_dsi);
> -- 
> 2.19.1

-- 
Ville Syrjälä
Intel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [PATCH 1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats
  2018-12-01 11:31 [PATCH 1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats Hans de Goede
                   ` (6 preceding siblings ...)
  2019-01-15 14:51 ` [PATCH 1/4] " Ville Syrjälä
@ 2019-04-05  6:34 ` Jani Nikula
  2019-04-05  6:59   ` [Intel-gfx] " Saarinen, Jani
  7 siblings, 1 reply; 17+ messages in thread
From: Jani Nikula @ 2019-04-05  6:34 UTC (permalink / raw)
  To: Joonas Lahtinen, Rodrigo Vivi, Ville Syrjälä
  Cc: Hans de Goede, intel-gfx, dri-devel

On Sat, 01 Dec 2018, Hans de Goede <hdegoede@redhat.com> wrote:
> There are 3 problems with the dsi code's pipe_bpp handling for 6 bpc
> pixel-formats which this commit addresses:
>
> 1) It assumes that the pipe_bpp is the same as the bpp going over the dsi
> lanes. This assumption is not valid for MIPI_DSI_FMT_RGB666, where pipe_bpp
> should be 18 so that we do proper dithering but we actually send 24 bpp
> over the dsi lanes (MIPI_DSI_FMT_RGB666_PACKED sends 18 bpp).
>
> This assumption is enforced by an assert in *_dsi_get_pclk(). This assert
> triggers on the initial hw-state readback on BYT/CHT devices which use
> MIPI_DSI_FMT_RGB666, such as the Prowise PT301 tablet. PIPECONF is set to
> 6BPC / 18 bpp by the GOP, while mipi_dsi_pixel_format_to_bpp() returns 24.
>
> This commits switches the calculations in *_dsi_get_pclk() to use the bpp
> from mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format) which
> returns the bpp going over the mipi lanes and drops the assert.
>
> 2) On BXT bxt_dsi_get_pipe_config() wrongly overrides the pipe_bpp which
> i9xx_get_pipe_config() reads from PIPECONF with the return value from
> mipi_dsi_pixel_format_to_bpp(). This avoids the assert from 1. but is wrong
> since the pipe is actually running at the value configured in PIPECONF.
>
> This commit drops the override of pipe_bpp from bxt_dsi_get_pipe_config().
>
> 3) The dsi encoder's compute_config() never assigns a value to pipe_bpp,
> unlike most other encoders. Falling back on compute_baseline_pipe_bpp()
> which always picks 24. 24 is only correct for MIPI_DSI_FMT_RGB88 for the
> others we should use 18 bpp so that we correctly do 6bpc color dithering.
>
> This commit adds code to intel_dsi_compute_config() to properly set
> pipe_bpp based on intel_dsi->pixel_format.
>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/gpu/drm/i915/intel_dsi.h   |  4 ++--
>  drivers/gpu/drm/i915/vlv_dsi.c     | 17 ++++++++--------
>  drivers/gpu/drm/i915/vlv_dsi_pll.c | 31 ++++++------------------------
>  3 files changed, 17 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dsi.h b/drivers/gpu/drm/i915/intel_dsi.h
> index c888c219835f..c796a2962a43 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.h
> +++ b/drivers/gpu/drm/i915/intel_dsi.h
> @@ -160,7 +160,7 @@ int vlv_dsi_pll_compute(struct intel_encoder *encoder,
>  void vlv_dsi_pll_enable(struct intel_encoder *encoder,
>  			const struct intel_crtc_state *config);
>  void vlv_dsi_pll_disable(struct intel_encoder *encoder);
> -u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
> +u32 vlv_dsi_get_pclk(struct intel_encoder *encoder,
>  		     struct intel_crtc_state *config);
>  void vlv_dsi_reset_clocks(struct intel_encoder *encoder, enum port port);
>  
> @@ -170,7 +170,7 @@ int bxt_dsi_pll_compute(struct intel_encoder *encoder,
>  void bxt_dsi_pll_enable(struct intel_encoder *encoder,
>  			const struct intel_crtc_state *config);
>  void bxt_dsi_pll_disable(struct intel_encoder *encoder);
> -u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
> +u32 bxt_dsi_get_pclk(struct intel_encoder *encoder,
>  		     struct intel_crtc_state *config);
>  void bxt_dsi_reset_clocks(struct intel_encoder *encoder, enum port port);
>  
> diff --git a/drivers/gpu/drm/i915/vlv_dsi.c b/drivers/gpu/drm/i915/vlv_dsi.c
> index be3af5f6c7a0..c10def5efa22 100644
> --- a/drivers/gpu/drm/i915/vlv_dsi.c
> +++ b/drivers/gpu/drm/i915/vlv_dsi.c
> @@ -322,6 +322,11 @@ static bool intel_dsi_compute_config(struct intel_encoder *encoder,
>  	/* DSI uses short packets for sync events, so clear mode flags for DSI */
>  	adjusted_mode->flags = 0;
>  
> +	if (intel_dsi->pixel_format == MIPI_DSI_FMT_RGB888)
> +		pipe_config->pipe_bpp = 24;
> +	else
> +		pipe_config->pipe_bpp = 18;
> +
>  	if (IS_GEN9_LP(dev_priv)) {
>  		/* Enable Frame time stamp based scanline reporting */
>  		adjusted_mode->private_flags |=
> @@ -1097,10 +1102,8 @@ static void bxt_dsi_get_pipe_config(struct intel_encoder *encoder,
>  	}
>  
>  	fmt = I915_READ(MIPI_DSI_FUNC_PRG(port)) & VID_MODE_FORMAT_MASK;
> -	pipe_config->pipe_bpp =
> -			mipi_dsi_pixel_format_to_bpp(
> -				pixel_format_from_register_bits(fmt));

This part here was crucial for BXT/GLK hardware state readout. The CI
found it, but the result was ignored. :(

https://bugs.freedesktop.org/show_bug.cgi?id=109516

BR,
Jani.


> -	bpp = pipe_config->pipe_bpp;
> +	bpp = mipi_dsi_pixel_format_to_bpp(
> +			pixel_format_from_register_bits(fmt));
>  
>  	/* Enable Frame time stamo based scanline reporting */
>  	adjusted_mode->private_flags |=
> @@ -1238,11 +1241,9 @@ static void intel_dsi_get_config(struct intel_encoder *encoder,
>  
>  	if (IS_GEN9_LP(dev_priv)) {
>  		bxt_dsi_get_pipe_config(encoder, pipe_config);
> -		pclk = bxt_dsi_get_pclk(encoder, pipe_config->pipe_bpp,
> -					pipe_config);
> +		pclk = bxt_dsi_get_pclk(encoder, pipe_config);
>  	} else {
> -		pclk = vlv_dsi_get_pclk(encoder, pipe_config->pipe_bpp,
> -					pipe_config);
> +		pclk = vlv_dsi_get_pclk(encoder, pipe_config);
>  	}
>  
>  	if (pclk) {
> diff --git a/drivers/gpu/drm/i915/vlv_dsi_pll.c b/drivers/gpu/drm/i915/vlv_dsi_pll.c
> index a132a8037ecc..954d5a8c4fa7 100644
> --- a/drivers/gpu/drm/i915/vlv_dsi_pll.c
> +++ b/drivers/gpu/drm/i915/vlv_dsi_pll.c
> @@ -252,20 +252,12 @@ void bxt_dsi_pll_disable(struct intel_encoder *encoder)
>  		DRM_ERROR("Timeout waiting for PLL lock deassertion\n");
>  }
>  
> -static void assert_bpp_mismatch(enum mipi_dsi_pixel_format fmt, int pipe_bpp)
> -{
> -	int bpp = mipi_dsi_pixel_format_to_bpp(fmt);
> -
> -	WARN(bpp != pipe_bpp,
> -	     "bpp match assertion failure (expected %d, current %d)\n",
> -	     bpp, pipe_bpp);
> -}
> -
> -u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
> +u32 vlv_dsi_get_pclk(struct intel_encoder *encoder,
>  		     struct intel_crtc_state *config)
>  {
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
>  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
> +	int bpp = mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format);
>  	u32 dsi_clock, pclk;
>  	u32 pll_ctl, pll_div;
>  	u32 m = 0, p = 0, n;
> @@ -319,15 +311,12 @@ u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
>  
>  	dsi_clock = (m * refclk) / (p * n);
>  
> -	/* pixel_format and pipe_bpp should agree */
> -	assert_bpp_mismatch(intel_dsi->pixel_format, pipe_bpp);
> -
> -	pclk = DIV_ROUND_CLOSEST(dsi_clock * intel_dsi->lane_count, pipe_bpp);
> +	pclk = DIV_ROUND_CLOSEST(dsi_clock * intel_dsi->lane_count, bpp);
>  
>  	return pclk;
>  }
>  
> -u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
> +u32 bxt_dsi_get_pclk(struct intel_encoder *encoder,
>  		     struct intel_crtc_state *config)
>  {
>  	u32 pclk;
> @@ -335,12 +324,7 @@ u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
>  	u32 dsi_ratio;
>  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
>  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> -
> -	/* Divide by zero */
> -	if (!pipe_bpp) {
> -		DRM_ERROR("Invalid BPP(0)\n");
> -		return 0;
> -	}
> +	int bpp = mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format);
>  
>  	config->dsi_pll.ctrl = I915_READ(BXT_DSI_PLL_CTL);
>  
> @@ -348,10 +332,7 @@ u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
>  
>  	dsi_clk = (dsi_ratio * BXT_REF_CLOCK_KHZ) / 2;
>  
> -	/* pixel_format and pipe_bpp should agree */
> -	assert_bpp_mismatch(intel_dsi->pixel_format, pipe_bpp);
> -
> -	pclk = DIV_ROUND_CLOSEST(dsi_clk * intel_dsi->lane_count, pipe_bpp);
> +	pclk = DIV_ROUND_CLOSEST(dsi_clk * intel_dsi->lane_count, bpp);
>  
>  	DRM_DEBUG_DRIVER("Calculated pclk=%u\n", pclk);
>  	return pclk;

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

* RE: [Intel-gfx] [PATCH 1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats
  2019-04-05  6:34 ` Jani Nikula
@ 2019-04-05  6:59   ` Saarinen, Jani
  0 siblings, 0 replies; 17+ messages in thread
From: Saarinen, Jani @ 2019-04-05  6:59 UTC (permalink / raw)
  To: Jani Nikula, Hans de Goede, Joonas Lahtinen, Vivi, Rodrigo,
	Ville Syrjälä
  Cc: intel-gfx, dri-devel

Hi, 

> -----Original Message-----
> From: Intel-gfx [mailto:intel-gfx-bounces@lists.freedesktop.org] On Behalf Of Jani
> Nikula
> Sent: perjantai 5. huhtikuuta 2019 9.35
> To: Hans de Goede <hdegoede@redhat.com>; Joonas Lahtinen
> <joonas.lahtinen@linux.intel.com>; Vivi, Rodrigo <rodrigo.vivi@intel.com>; Ville
> Syrjälä <ville.syrjala@linux.intel.com>
> Cc: intel-gfx <intel-gfx@lists.freedesktop.org>; dri-devel@lists.freedesktop.org
> Subject: Re: [Intel-gfx] [PATCH 1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc
> pixel-formats
> 
> On Sat, 01 Dec 2018, Hans de Goede <hdegoede@redhat.com> wrote:
> > There are 3 problems with the dsi code's pipe_bpp handling for 6 bpc
> > pixel-formats which this commit addresses:
> >
> > 1) It assumes that the pipe_bpp is the same as the bpp going over the
> > dsi lanes. This assumption is not valid for MIPI_DSI_FMT_RGB666, where
> > pipe_bpp should be 18 so that we do proper dithering but we actually
> > send 24 bpp over the dsi lanes (MIPI_DSI_FMT_RGB666_PACKED sends 18 bpp).
> >
> > This assumption is enforced by an assert in *_dsi_get_pclk(). This
> > assert triggers on the initial hw-state readback on BYT/CHT devices
> > which use MIPI_DSI_FMT_RGB666, such as the Prowise PT301 tablet.
> > PIPECONF is set to 6BPC / 18 bpp by the GOP, while
> mipi_dsi_pixel_format_to_bpp() returns 24.
> >
> > This commits switches the calculations in *_dsi_get_pclk() to use the
> > bpp from mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format) which
> > returns the bpp going over the mipi lanes and drops the assert.
> >
> > 2) On BXT bxt_dsi_get_pipe_config() wrongly overrides the pipe_bpp
> > which
> > i9xx_get_pipe_config() reads from PIPECONF with the return value from
> > mipi_dsi_pixel_format_to_bpp(). This avoids the assert from 1. but is
> > wrong since the pipe is actually running at the value configured in PIPECONF.
> >
> > This commit drops the override of pipe_bpp from bxt_dsi_get_pipe_config().
> >
> > 3) The dsi encoder's compute_config() never assigns a value to
> > pipe_bpp, unlike most other encoders. Falling back on
> > compute_baseline_pipe_bpp() which always picks 24. 24 is only correct
> > for MIPI_DSI_FMT_RGB88 for the others we should use 18 bpp so that we
> correctly do 6bpc color dithering.
> >
> > This commit adds code to intel_dsi_compute_config() to properly set
> > pipe_bpp based on intel_dsi->pixel_format.
> >
> > Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> > ---
> >  drivers/gpu/drm/i915/intel_dsi.h   |  4 ++--
> >  drivers/gpu/drm/i915/vlv_dsi.c     | 17 ++++++++--------
> >  drivers/gpu/drm/i915/vlv_dsi_pll.c | 31
> > ++++++------------------------
> >  3 files changed, 17 insertions(+), 35 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_dsi.h
> > b/drivers/gpu/drm/i915/intel_dsi.h
> > index c888c219835f..c796a2962a43 100644
> > --- a/drivers/gpu/drm/i915/intel_dsi.h
> > +++ b/drivers/gpu/drm/i915/intel_dsi.h
> > @@ -160,7 +160,7 @@ int vlv_dsi_pll_compute(struct intel_encoder
> > *encoder,  void vlv_dsi_pll_enable(struct intel_encoder *encoder,
> >  			const struct intel_crtc_state *config);  void
> > vlv_dsi_pll_disable(struct intel_encoder *encoder);
> > -u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
> > +u32 vlv_dsi_get_pclk(struct intel_encoder *encoder,
> >  		     struct intel_crtc_state *config);  void
> > vlv_dsi_reset_clocks(struct intel_encoder *encoder, enum port port);
> >
> > @@ -170,7 +170,7 @@ int bxt_dsi_pll_compute(struct intel_encoder
> > *encoder,  void bxt_dsi_pll_enable(struct intel_encoder *encoder,
> >  			const struct intel_crtc_state *config);  void
> > bxt_dsi_pll_disable(struct intel_encoder *encoder);
> > -u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
> > +u32 bxt_dsi_get_pclk(struct intel_encoder *encoder,
> >  		     struct intel_crtc_state *config);  void
> > bxt_dsi_reset_clocks(struct intel_encoder *encoder, enum port port);
> >
> > diff --git a/drivers/gpu/drm/i915/vlv_dsi.c
> > b/drivers/gpu/drm/i915/vlv_dsi.c index be3af5f6c7a0..c10def5efa22
> > 100644
> > --- a/drivers/gpu/drm/i915/vlv_dsi.c
> > +++ b/drivers/gpu/drm/i915/vlv_dsi.c
> > @@ -322,6 +322,11 @@ static bool intel_dsi_compute_config(struct
> intel_encoder *encoder,
> >  	/* DSI uses short packets for sync events, so clear mode flags for DSI */
> >  	adjusted_mode->flags = 0;
> >
> > +	if (intel_dsi->pixel_format == MIPI_DSI_FMT_RGB888)
> > +		pipe_config->pipe_bpp = 24;
> > +	else
> > +		pipe_config->pipe_bpp = 18;
> > +
> >  	if (IS_GEN9_LP(dev_priv)) {
> >  		/* Enable Frame time stamp based scanline reporting */
> >  		adjusted_mode->private_flags |=
> > @@ -1097,10 +1102,8 @@ static void bxt_dsi_get_pipe_config(struct
> intel_encoder *encoder,
> >  	}
> >
> >  	fmt = I915_READ(MIPI_DSI_FUNC_PRG(port)) &
> VID_MODE_FORMAT_MASK;
> > -	pipe_config->pipe_bpp =
> > -			mipi_dsi_pixel_format_to_bpp(
> > -				pixel_format_from_register_bits(fmt));
> 
> This part here was crucial for BXT/GLK hardware state readout. The CI found it, but
> the result was ignored. :(
Indeed: https://patchwork.freedesktop.org/series/53352/
> 
> https://bugs.freedesktop.org/show_bug.cgi?id=109516
> 
> BR,
> Jani.
> 
> 
> > -	bpp = pipe_config->pipe_bpp;
> > +	bpp = mipi_dsi_pixel_format_to_bpp(
> > +			pixel_format_from_register_bits(fmt));
> >
> >  	/* Enable Frame time stamo based scanline reporting */
> >  	adjusted_mode->private_flags |=
> > @@ -1238,11 +1241,9 @@ static void intel_dsi_get_config(struct
> > intel_encoder *encoder,
> >
> >  	if (IS_GEN9_LP(dev_priv)) {
> >  		bxt_dsi_get_pipe_config(encoder, pipe_config);
> > -		pclk = bxt_dsi_get_pclk(encoder, pipe_config->pipe_bpp,
> > -					pipe_config);
> > +		pclk = bxt_dsi_get_pclk(encoder, pipe_config);
> >  	} else {
> > -		pclk = vlv_dsi_get_pclk(encoder, pipe_config->pipe_bpp,
> > -					pipe_config);
> > +		pclk = vlv_dsi_get_pclk(encoder, pipe_config);
> >  	}
> >
> >  	if (pclk) {
> > diff --git a/drivers/gpu/drm/i915/vlv_dsi_pll.c
> > b/drivers/gpu/drm/i915/vlv_dsi_pll.c
> > index a132a8037ecc..954d5a8c4fa7 100644
> > --- a/drivers/gpu/drm/i915/vlv_dsi_pll.c
> > +++ b/drivers/gpu/drm/i915/vlv_dsi_pll.c
> > @@ -252,20 +252,12 @@ void bxt_dsi_pll_disable(struct intel_encoder *encoder)
> >  		DRM_ERROR("Timeout waiting for PLL lock deassertion\n");  }
> >
> > -static void assert_bpp_mismatch(enum mipi_dsi_pixel_format fmt, int
> > pipe_bpp) -{
> > -	int bpp = mipi_dsi_pixel_format_to_bpp(fmt);
> > -
> > -	WARN(bpp != pipe_bpp,
> > -	     "bpp match assertion failure (expected %d, current %d)\n",
> > -	     bpp, pipe_bpp);
> > -}
> > -
> > -u32 vlv_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
> > +u32 vlv_dsi_get_pclk(struct intel_encoder *encoder,
> >  		     struct intel_crtc_state *config)  {
> >  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> >  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
> > +	int bpp = mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format);
> >  	u32 dsi_clock, pclk;
> >  	u32 pll_ctl, pll_div;
> >  	u32 m = 0, p = 0, n;
> > @@ -319,15 +311,12 @@ u32 vlv_dsi_get_pclk(struct intel_encoder
> > *encoder, int pipe_bpp,
> >
> >  	dsi_clock = (m * refclk) / (p * n);
> >
> > -	/* pixel_format and pipe_bpp should agree */
> > -	assert_bpp_mismatch(intel_dsi->pixel_format, pipe_bpp);
> > -
> > -	pclk = DIV_ROUND_CLOSEST(dsi_clock * intel_dsi->lane_count, pipe_bpp);
> > +	pclk = DIV_ROUND_CLOSEST(dsi_clock * intel_dsi->lane_count, bpp);
> >
> >  	return pclk;
> >  }
> >
> > -u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int pipe_bpp,
> > +u32 bxt_dsi_get_pclk(struct intel_encoder *encoder,
> >  		     struct intel_crtc_state *config)  {
> >  	u32 pclk;
> > @@ -335,12 +324,7 @@ u32 bxt_dsi_get_pclk(struct intel_encoder *encoder, int
> pipe_bpp,
> >  	u32 dsi_ratio;
> >  	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
> >  	struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);
> > -
> > -	/* Divide by zero */
> > -	if (!pipe_bpp) {
> > -		DRM_ERROR("Invalid BPP(0)\n");
> > -		return 0;
> > -	}
> > +	int bpp = mipi_dsi_pixel_format_to_bpp(intel_dsi->pixel_format);
> >
> >  	config->dsi_pll.ctrl = I915_READ(BXT_DSI_PLL_CTL);
> >
> > @@ -348,10 +332,7 @@ u32 bxt_dsi_get_pclk(struct intel_encoder
> > *encoder, int pipe_bpp,
> >
> >  	dsi_clk = (dsi_ratio * BXT_REF_CLOCK_KHZ) / 2;
> >
> > -	/* pixel_format and pipe_bpp should agree */
> > -	assert_bpp_mismatch(intel_dsi->pixel_format, pipe_bpp);
> > -
> > -	pclk = DIV_ROUND_CLOSEST(dsi_clk * intel_dsi->lane_count, pipe_bpp);
> > +	pclk = DIV_ROUND_CLOSEST(dsi_clk * intel_dsi->lane_count, bpp);
> >
> >  	DRM_DEBUG_DRIVER("Calculated pclk=%u\n", pclk);
> >  	return pclk;
> 
> --
> Jani Nikula, Intel Open Source Graphics Center
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2019-04-05  6:59 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-01 11:31 [PATCH 1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats Hans de Goede
2018-12-01 11:31 ` [PATCH 2/4] drm/i915/dsi: Enable dithering for 6 bpc panels Hans de Goede
2019-01-15 14:55   ` Ville Syrjälä
2019-01-21  9:54     ` Hans de Goede
2018-12-01 11:31 ` [PATCH 3/4] drm/i915/dsi: Adjust crtc_clock for burst_mode_ratio Hans de Goede
2019-01-15 15:00   ` Ville Syrjälä
2019-01-21 14:26     ` Hans de Goede
2019-01-21 15:30       ` Hans de Goede
2018-12-01 11:31 ` [PATCH 4/4] drm/i915/dsi: Call drm_connector_cleanup on vlv_dsi_init error exit path Hans de Goede
2019-01-25 21:05   ` Ville Syrjälä
2018-12-01 12:01 ` ✗ Fi.CI.CHECKPATCH: warning for series starting with [1/4] drm/i915/dsi: Fix pipe_bpp for handling for 6 bpc pixel-formats Patchwork
2018-12-01 12:20 ` ✓ Fi.CI.BAT: success " Patchwork
2018-12-01 22:45 ` ✓ Fi.CI.IGT: " Patchwork
2019-01-15 14:51 ` [PATCH 1/4] " Ville Syrjälä
2019-01-21  9:53   ` Hans de Goede
2019-04-05  6:34 ` Jani Nikula
2019-04-05  6:59   ` [Intel-gfx] " Saarinen, Jani

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.