diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-04-25 11:54:44 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-04-25 15:21:49 -0400 |
commit | d8b322474941fa565ba5c58292ccc54be92cca41 (patch) | |
tree | debd7ae36b9de06b0b93e6f23a524afe1aa702d0 /drivers/gpu/drm/i915 | |
parent | c6bb353815c30c3f8a33b436314926706f4b6360 (diff) |
drm/i915: use pipe_config for lvds dithering
Up to now we've relied on the bios to get this right for us. Let's try
out whether our code has improved a bit, since we should dither
always when the output bpp doesn't match the plane bpp.
- gen5+ should be fine, since we only use the bios hint as an upgrade.
- gen4 changes, since here dithering is still controlled in the lvds
register.
- gen2/3 has implicit dithering depeding upon whether you use 2 or 3
lvds pairs (which makes sense, since it only supports 8bpc pipe
outpu configurations).
- hsw doesn't support lvds.
v2: Remove redudant dither setting.
v3: Completly drop reliance on dev_priv->lvds_dither.
v4: Enable dithering on gen2/3 only when we have a 18bpp panel, since
up-dithering to a 24bpp panel is not supported by the hw. Spotted by
Ville.
v5: Also only enable lvds port dithering on gen4 for 18bpp modes. In
practice this only excludes dithering a 10bpc plane down for a 24bpp
lvds panel. Not something we truly care about. Again noticed by Ville.
v6: Actually git add.
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915')
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 25 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_lvds.c | 15 |
3 files changed, 22 insertions, 23 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 26acc421f0c6..38465f0e9710 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -5146,8 +5146,7 @@ static int ironlake_get_refclk(struct drm_crtc *crtc) | |||
5146 | } | 5146 | } |
5147 | 5147 | ||
5148 | static void ironlake_set_pipeconf(struct drm_crtc *crtc, | 5148 | static void ironlake_set_pipeconf(struct drm_crtc *crtc, |
5149 | struct drm_display_mode *adjusted_mode, | 5149 | struct drm_display_mode *adjusted_mode) |
5150 | bool dither) | ||
5151 | { | 5150 | { |
5152 | struct drm_i915_private *dev_priv = crtc->dev->dev_private; | 5151 | struct drm_i915_private *dev_priv = crtc->dev->dev_private; |
5153 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 5152 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
@@ -5176,7 +5175,7 @@ static void ironlake_set_pipeconf(struct drm_crtc *crtc, | |||
5176 | } | 5175 | } |
5177 | 5176 | ||
5178 | val &= ~(PIPECONF_DITHER_EN | PIPECONF_DITHER_TYPE_MASK); | 5177 | val &= ~(PIPECONF_DITHER_EN | PIPECONF_DITHER_TYPE_MASK); |
5179 | if (dither) | 5178 | if (intel_crtc->config.dither) |
5180 | val |= (PIPECONF_DITHER_EN | PIPECONF_DITHER_TYPE_SP); | 5179 | val |= (PIPECONF_DITHER_EN | PIPECONF_DITHER_TYPE_SP); |
5181 | 5180 | ||
5182 | val &= ~PIPECONF_INTERLACE_MASK; | 5181 | val &= ~PIPECONF_INTERLACE_MASK; |
@@ -5259,8 +5258,7 @@ static void intel_set_pipe_csc(struct drm_crtc *crtc) | |||
5259 | } | 5258 | } |
5260 | 5259 | ||
5261 | static void haswell_set_pipeconf(struct drm_crtc *crtc, | 5260 | static void haswell_set_pipeconf(struct drm_crtc *crtc, |
5262 | struct drm_display_mode *adjusted_mode, | 5261 | struct drm_display_mode *adjusted_mode) |
5263 | bool dither) | ||
5264 | { | 5262 | { |
5265 | struct drm_i915_private *dev_priv = crtc->dev->dev_private; | 5263 | struct drm_i915_private *dev_priv = crtc->dev->dev_private; |
5266 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 5264 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
@@ -5270,7 +5268,7 @@ static void haswell_set_pipeconf(struct drm_crtc *crtc, | |||
5270 | val = I915_READ(PIPECONF(cpu_transcoder)); | 5268 | val = I915_READ(PIPECONF(cpu_transcoder)); |
5271 | 5269 | ||
5272 | val &= ~(PIPECONF_DITHER_EN | PIPECONF_DITHER_TYPE_MASK); | 5270 | val &= ~(PIPECONF_DITHER_EN | PIPECONF_DITHER_TYPE_MASK); |
5273 | if (dither) | 5271 | if (intel_crtc->config.dither) |
5274 | val |= (PIPECONF_DITHER_EN | PIPECONF_DITHER_TYPE_SP); | 5272 | val |= (PIPECONF_DITHER_EN | PIPECONF_DITHER_TYPE_SP); |
5275 | 5273 | ||
5276 | val &= ~PIPECONF_INTERLACE_MASK_HSW; | 5274 | val &= ~PIPECONF_INTERLACE_MASK_HSW; |
@@ -5631,7 +5629,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5631 | bool is_lvds = false; | 5629 | bool is_lvds = false; |
5632 | struct intel_encoder *encoder; | 5630 | struct intel_encoder *encoder; |
5633 | int ret; | 5631 | int ret; |
5634 | bool dither, fdi_config_ok; | 5632 | bool fdi_config_ok; |
5635 | 5633 | ||
5636 | for_each_encoder_on_crtc(dev, crtc, encoder) { | 5634 | for_each_encoder_on_crtc(dev, crtc, encoder) { |
5637 | switch (encoder->type) { | 5635 | switch (encoder->type) { |
@@ -5666,11 +5664,6 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5666 | /* Ensure that the cursor is valid for the new mode before changing... */ | 5664 | /* Ensure that the cursor is valid for the new mode before changing... */ |
5667 | intel_crtc_update_cursor(crtc, true); | 5665 | intel_crtc_update_cursor(crtc, true); |
5668 | 5666 | ||
5669 | /* determine panel color depth */ | ||
5670 | dither = intel_crtc->config.dither; | ||
5671 | if (is_lvds && dev_priv->lvds_dither) | ||
5672 | dither = true; | ||
5673 | |||
5674 | DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe_name(pipe)); | 5667 | DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe_name(pipe)); |
5675 | drm_mode_debug_printmodeline(mode); | 5668 | drm_mode_debug_printmodeline(mode); |
5676 | 5669 | ||
@@ -5737,7 +5730,7 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5737 | 5730 | ||
5738 | fdi_config_ok = ironlake_check_fdi_lanes(intel_crtc); | 5731 | fdi_config_ok = ironlake_check_fdi_lanes(intel_crtc); |
5739 | 5732 | ||
5740 | ironlake_set_pipeconf(crtc, adjusted_mode, dither); | 5733 | ironlake_set_pipeconf(crtc, adjusted_mode); |
5741 | 5734 | ||
5742 | /* Set up the display plane register */ | 5735 | /* Set up the display plane register */ |
5743 | I915_WRITE(DSPCNTR(plane), DISPPLANE_GAMMA_ENABLE); | 5736 | I915_WRITE(DSPCNTR(plane), DISPPLANE_GAMMA_ENABLE); |
@@ -5814,7 +5807,6 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc, | |||
5814 | bool is_cpu_edp = false; | 5807 | bool is_cpu_edp = false; |
5815 | struct intel_encoder *encoder; | 5808 | struct intel_encoder *encoder; |
5816 | int ret; | 5809 | int ret; |
5817 | bool dither; | ||
5818 | 5810 | ||
5819 | for_each_encoder_on_crtc(dev, crtc, encoder) { | 5811 | for_each_encoder_on_crtc(dev, crtc, encoder) { |
5820 | switch (encoder->type) { | 5812 | switch (encoder->type) { |
@@ -5850,9 +5842,6 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc, | |||
5850 | /* Ensure that the cursor is valid for the new mode before changing... */ | 5842 | /* Ensure that the cursor is valid for the new mode before changing... */ |
5851 | intel_crtc_update_cursor(crtc, true); | 5843 | intel_crtc_update_cursor(crtc, true); |
5852 | 5844 | ||
5853 | /* determine panel color depth */ | ||
5854 | dither = intel_crtc->config.dither; | ||
5855 | |||
5856 | DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe_name(pipe)); | 5845 | DRM_DEBUG_KMS("Mode for pipe %c:\n", pipe_name(pipe)); |
5857 | drm_mode_debug_printmodeline(mode); | 5846 | drm_mode_debug_printmodeline(mode); |
5858 | 5847 | ||
@@ -5866,7 +5855,7 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc, | |||
5866 | if (intel_crtc->config.has_pch_encoder) | 5855 | if (intel_crtc->config.has_pch_encoder) |
5867 | ironlake_fdi_set_m_n(crtc); | 5856 | ironlake_fdi_set_m_n(crtc); |
5868 | 5857 | ||
5869 | haswell_set_pipeconf(crtc, adjusted_mode, dither); | 5858 | haswell_set_pipeconf(crtc, adjusted_mode); |
5870 | 5859 | ||
5871 | intel_set_pipe_csc(crtc); | 5860 | intel_set_pipe_csc(crtc); |
5872 | 5861 | ||
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 3595c8204649..a5fe976364e1 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -213,6 +213,11 @@ struct intel_crtc_config { | |||
213 | /* DP has a bunch of special case unfortunately, so mark the pipe | 213 | /* DP has a bunch of special case unfortunately, so mark the pipe |
214 | * accordingly. */ | 214 | * accordingly. */ |
215 | bool has_dp_encoder; | 215 | bool has_dp_encoder; |
216 | |||
217 | /* | ||
218 | * Enable dithering, used when the selected pipe bpp doesn't match the | ||
219 | * plane bpp. | ||
220 | */ | ||
216 | bool dither; | 221 | bool dither; |
217 | 222 | ||
218 | /* Controls for the clock computation, to override various stages. */ | 223 | /* Controls for the clock computation, to override various stages. */ |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index 563f5052fcfc..84085454b104 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -136,7 +136,10 @@ static void intel_pre_pll_enable_lvds(struct intel_encoder *encoder) | |||
136 | * special lvds dither control bit on pch-split platforms, dithering is | 136 | * special lvds dither control bit on pch-split platforms, dithering is |
137 | * only controlled through the PIPECONF reg. */ | 137 | * only controlled through the PIPECONF reg. */ |
138 | if (INTEL_INFO(dev)->gen == 4) { | 138 | if (INTEL_INFO(dev)->gen == 4) { |
139 | if (dev_priv->lvds_dither) | 139 | /* Bspec wording suggests that LVDS port dithering only exists |
140 | * for 18bpp panels. */ | ||
141 | if (intel_crtc->config.dither && | ||
142 | intel_crtc->config.pipe_bpp == 18) | ||
140 | temp |= LVDS_ENABLE_DITHER; | 143 | temp |= LVDS_ENABLE_DITHER; |
141 | else | 144 | else |
142 | temp &= ~LVDS_ENABLE_DITHER; | 145 | temp &= ~LVDS_ENABLE_DITHER; |
@@ -335,7 +338,13 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder, | |||
335 | DRM_DEBUG_KMS("forcing display bpp (was %d) to LVDS (%d)\n", | 338 | DRM_DEBUG_KMS("forcing display bpp (was %d) to LVDS (%d)\n", |
336 | pipe_config->pipe_bpp, lvds_bpp); | 339 | pipe_config->pipe_bpp, lvds_bpp); |
337 | pipe_config->pipe_bpp = lvds_bpp; | 340 | pipe_config->pipe_bpp = lvds_bpp; |
341 | |||
342 | /* Make sure pre-965 set dither correctly for 18bpp panels. */ | ||
343 | if (INTEL_INFO(dev)->gen < 4 && lvds_bpp == 18) | ||
344 | pfit_control |= PANEL_8TO6_DITHER_ENABLE; | ||
345 | |||
338 | } | 346 | } |
347 | |||
339 | /* | 348 | /* |
340 | * We have timings from the BIOS for the panel, put them in | 349 | * We have timings from the BIOS for the panel, put them in |
341 | * to the adjusted mode. The CRTC will be set up for this mode, | 350 | * to the adjusted mode. The CRTC will be set up for this mode, |
@@ -470,10 +479,6 @@ out: | |||
470 | pfit_pgm_ratios = 0; | 479 | pfit_pgm_ratios = 0; |
471 | } | 480 | } |
472 | 481 | ||
473 | /* Make sure pre-965 set dither correctly */ | ||
474 | if (INTEL_INFO(dev)->gen < 4 && dev_priv->lvds_dither) | ||
475 | pfit_control |= PANEL_8TO6_DITHER_ENABLE; | ||
476 | |||
477 | if (pfit_control != lvds_encoder->pfit_control || | 482 | if (pfit_control != lvds_encoder->pfit_control || |
478 | pfit_pgm_ratios != lvds_encoder->pfit_pgm_ratios) { | 483 | pfit_pgm_ratios != lvds_encoder->pfit_pgm_ratios) { |
479 | lvds_encoder->pfit_control = pfit_control; | 484 | lvds_encoder->pfit_control = pfit_control; |