diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-03-26 19:44:57 -0400 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-03-27 20:09:29 -0400 |
commit | 965e0c489f360df1beeb567e4540777a09b8896e (patch) | |
tree | 89710f6280e7b83c7434ddf74634602f2c86be4f /drivers/gpu/drm | |
parent | 50f3b016b055dbc83094bc2d7a91c3c69edbc88b (diff) |
drm/i915: introduce pipe_config->dither|pipe_bpp
We want to compute this earlier. To avoid a big complicated patch,
this patch here just does the big search&replace and still calls the
old functions at the same places.
Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/i915/intel_ddi.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 25 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_hdmi.c | 2 |
5 files changed, 26 insertions, 15 deletions
diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c index baeb4700e5e6..3d09df0d4b9d 100644 --- a/drivers/gpu/drm/i915/intel_ddi.c +++ b/drivers/gpu/drm/i915/intel_ddi.c | |||
@@ -931,7 +931,7 @@ void intel_ddi_set_pipe_settings(struct drm_crtc *crtc) | |||
931 | if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) { | 931 | if (type == INTEL_OUTPUT_DISPLAYPORT || type == INTEL_OUTPUT_EDP) { |
932 | 932 | ||
933 | temp = TRANS_MSA_SYNC_CLK; | 933 | temp = TRANS_MSA_SYNC_CLK; |
934 | switch (intel_crtc->bpp) { | 934 | switch (intel_crtc->config.pipe_bpp) { |
935 | case 18: | 935 | case 18: |
936 | temp |= TRANS_MSA_6_BPC; | 936 | temp |= TRANS_MSA_6_BPC; |
937 | break; | 937 | break; |
@@ -947,7 +947,7 @@ void intel_ddi_set_pipe_settings(struct drm_crtc *crtc) | |||
947 | default: | 947 | default: |
948 | temp |= TRANS_MSA_8_BPC; | 948 | temp |= TRANS_MSA_8_BPC; |
949 | WARN(1, "%d bpp unsupported by DDI function\n", | 949 | WARN(1, "%d bpp unsupported by DDI function\n", |
950 | intel_crtc->bpp); | 950 | intel_crtc->config.pipe_bpp); |
951 | } | 951 | } |
952 | I915_WRITE(TRANS_MSA_MISC(cpu_transcoder), temp); | 952 | I915_WRITE(TRANS_MSA_MISC(cpu_transcoder), temp); |
953 | } | 953 | } |
@@ -969,7 +969,7 @@ void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) | |||
969 | temp = TRANS_DDI_FUNC_ENABLE; | 969 | temp = TRANS_DDI_FUNC_ENABLE; |
970 | temp |= TRANS_DDI_SELECT_PORT(port); | 970 | temp |= TRANS_DDI_SELECT_PORT(port); |
971 | 971 | ||
972 | switch (intel_crtc->bpp) { | 972 | switch (intel_crtc->config.pipe_bpp) { |
973 | case 18: | 973 | case 18: |
974 | temp |= TRANS_DDI_BPC_6; | 974 | temp |= TRANS_DDI_BPC_6; |
975 | break; | 975 | break; |
@@ -984,7 +984,7 @@ void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) | |||
984 | break; | 984 | break; |
985 | default: | 985 | default: |
986 | WARN(1, "%d bpp unsupported by transcoder DDI function\n", | 986 | WARN(1, "%d bpp unsupported by transcoder DDI function\n", |
987 | intel_crtc->bpp); | 987 | intel_crtc->config.pipe_bpp); |
988 | } | 988 | } |
989 | 989 | ||
990 | if (crtc->mode.flags & DRM_MODE_FLAG_PVSYNC) | 990 | if (crtc->mode.flags & DRM_MODE_FLAG_PVSYNC) |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index dfcdfca6b230..4cc46ef9ca9f 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -4665,6 +4665,10 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, | |||
4665 | const intel_limit_t *limit; | 4665 | const intel_limit_t *limit; |
4666 | int ret; | 4666 | int ret; |
4667 | 4667 | ||
4668 | /* temporary hack */ | ||
4669 | intel_crtc->config.dither = | ||
4670 | adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC; | ||
4671 | |||
4668 | for_each_encoder_on_crtc(dev, crtc, encoder) { | 4672 | for_each_encoder_on_crtc(dev, crtc, encoder) { |
4669 | switch (encoder->type) { | 4673 | switch (encoder->type) { |
4670 | case INTEL_OUTPUT_LVDS: | 4674 | case INTEL_OUTPUT_LVDS: |
@@ -4765,7 +4769,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, | |||
4765 | /* default to 8bpc */ | 4769 | /* default to 8bpc */ |
4766 | pipeconf &= ~(PIPECONF_BPC_MASK | PIPECONF_DITHER_EN); | 4770 | pipeconf &= ~(PIPECONF_BPC_MASK | PIPECONF_DITHER_EN); |
4767 | if (is_dp) { | 4771 | if (is_dp) { |
4768 | if (adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) { | 4772 | if (intel_crtc->config.dither) { |
4769 | pipeconf |= PIPECONF_6BPC | | 4773 | pipeconf |= PIPECONF_6BPC | |
4770 | PIPECONF_DITHER_EN | | 4774 | PIPECONF_DITHER_EN | |
4771 | PIPECONF_DITHER_TYPE_SP; | 4775 | PIPECONF_DITHER_TYPE_SP; |
@@ -4773,7 +4777,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, | |||
4773 | } | 4777 | } |
4774 | 4778 | ||
4775 | if (IS_VALLEYVIEW(dev) && intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP)) { | 4779 | if (IS_VALLEYVIEW(dev) && intel_pipe_has_type(crtc, INTEL_OUTPUT_EDP)) { |
4776 | if (adjusted_mode->private_flags & INTEL_MODE_DP_FORCE_6BPC) { | 4780 | if (intel_crtc->config.dither) { |
4777 | pipeconf |= PIPECONF_6BPC | | 4781 | pipeconf |= PIPECONF_6BPC | |
4778 | PIPECONF_ENABLE | | 4782 | PIPECONF_ENABLE | |
4779 | I965_PIPECONF_ACTIVE; | 4783 | I965_PIPECONF_ACTIVE; |
@@ -5162,7 +5166,7 @@ static void ironlake_set_pipeconf(struct drm_crtc *crtc, | |||
5162 | val = I915_READ(PIPECONF(pipe)); | 5166 | val = I915_READ(PIPECONF(pipe)); |
5163 | 5167 | ||
5164 | val &= ~PIPECONF_BPC_MASK; | 5168 | val &= ~PIPECONF_BPC_MASK; |
5165 | switch (intel_crtc->bpp) { | 5169 | switch (intel_crtc->config.pipe_bpp) { |
5166 | case 18: | 5170 | case 18: |
5167 | val |= PIPECONF_6BPC; | 5171 | val |= PIPECONF_6BPC; |
5168 | break; | 5172 | break; |
@@ -5499,13 +5503,14 @@ static void ironlake_set_m_n(struct drm_crtc *crtc) | |||
5499 | 5503 | ||
5500 | if (!lane) | 5504 | if (!lane) |
5501 | lane = ironlake_get_lanes_required(target_clock, link_bw, | 5505 | lane = ironlake_get_lanes_required(target_clock, link_bw, |
5502 | intel_crtc->bpp); | 5506 | intel_crtc->config.pipe_bpp); |
5503 | 5507 | ||
5504 | intel_crtc->fdi_lanes = lane; | 5508 | intel_crtc->fdi_lanes = lane; |
5505 | 5509 | ||
5506 | if (intel_crtc->config.pixel_multiplier > 1) | 5510 | if (intel_crtc->config.pixel_multiplier > 1) |
5507 | link_bw *= intel_crtc->config.pixel_multiplier; | 5511 | link_bw *= intel_crtc->config.pixel_multiplier; |
5508 | intel_link_compute_m_n(intel_crtc->bpp, lane, target_clock, link_bw, &m_n); | 5512 | intel_link_compute_m_n(intel_crtc->config.pipe_bpp, lane, target_clock, |
5513 | link_bw, &m_n); | ||
5509 | 5514 | ||
5510 | I915_WRITE(PIPE_DATA_M1(cpu_transcoder), TU_SIZE(m_n.tu) | m_n.gmch_m); | 5515 | I915_WRITE(PIPE_DATA_M1(cpu_transcoder), TU_SIZE(m_n.tu) | m_n.gmch_m); |
5511 | I915_WRITE(PIPE_DATA_N1(cpu_transcoder), m_n.gmch_n); | 5516 | I915_WRITE(PIPE_DATA_N1(cpu_transcoder), m_n.gmch_n); |
@@ -5668,8 +5673,10 @@ static int ironlake_crtc_mode_set(struct drm_crtc *crtc, | |||
5668 | intel_crtc_update_cursor(crtc, true); | 5673 | intel_crtc_update_cursor(crtc, true); |
5669 | 5674 | ||
5670 | /* determine panel color depth */ | 5675 | /* determine panel color depth */ |
5671 | dither = intel_choose_pipe_bpp_dither(crtc, fb, &intel_crtc->bpp, | 5676 | dither = intel_choose_pipe_bpp_dither(crtc, fb, |
5677 | &intel_crtc->config.pipe_bpp, | ||
5672 | adjusted_mode); | 5678 | adjusted_mode); |
5679 | intel_crtc->config.dither = dither; | ||
5673 | if (is_lvds && dev_priv->lvds_dither) | 5680 | if (is_lvds && dev_priv->lvds_dither) |
5674 | dither = true; | 5681 | dither = true; |
5675 | 5682 | ||
@@ -5834,8 +5841,10 @@ static int haswell_crtc_mode_set(struct drm_crtc *crtc, | |||
5834 | intel_crtc_update_cursor(crtc, true); | 5841 | intel_crtc_update_cursor(crtc, true); |
5835 | 5842 | ||
5836 | /* determine panel color depth */ | 5843 | /* determine panel color depth */ |
5837 | dither = intel_choose_pipe_bpp_dither(crtc, fb, &intel_crtc->bpp, | 5844 | dither = intel_choose_pipe_bpp_dither(crtc, fb, |
5845 | &intel_crtc->config.pipe_bpp, | ||
5838 | adjusted_mode); | 5846 | adjusted_mode); |
5847 | intel_crtc->config.dither = dither; | ||
5839 | 5848 | ||
5840 | DRM_DEBUG_KMS("Mode for pipe %d:\n", pipe); | 5849 | DRM_DEBUG_KMS("Mode for pipe %d:\n", pipe); |
5841 | drm_mode_debug_printmodeline(mode); | 5850 | drm_mode_debug_printmodeline(mode); |
@@ -8296,7 +8305,7 @@ static void intel_crtc_init(struct drm_device *dev, int pipe) | |||
8296 | dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base; | 8305 | dev_priv->plane_to_crtc_mapping[intel_crtc->plane] = &intel_crtc->base; |
8297 | dev_priv->pipe_to_crtc_mapping[intel_crtc->pipe] = &intel_crtc->base; | 8306 | dev_priv->pipe_to_crtc_mapping[intel_crtc->pipe] = &intel_crtc->base; |
8298 | 8307 | ||
8299 | intel_crtc->bpp = 24; /* default for pre-Ironlake */ | 8308 | intel_crtc->config.pipe_bpp = 24; /* default for pre-Ironlake */ |
8300 | 8309 | ||
8301 | drm_crtc_helper_add(&intel_crtc->base, &intel_helper_funcs); | 8310 | drm_crtc_helper_add(&intel_crtc->base, &intel_helper_funcs); |
8302 | } | 8311 | } |
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index 80ac7d77e053..22c40d37c242 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -801,7 +801,7 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, | |||
801 | * the number of bytes_per_pixel post-LUT, which we always | 801 | * the number of bytes_per_pixel post-LUT, which we always |
802 | * set up for 8-bits of R/G/B, or 3 bytes total. | 802 | * set up for 8-bits of R/G/B, or 3 bytes total. |
803 | */ | 803 | */ |
804 | intel_link_compute_m_n(intel_crtc->bpp, lane_count, | 804 | intel_link_compute_m_n(intel_crtc->config.pipe_bpp, lane_count, |
805 | mode->clock, adjusted_mode->clock, &m_n); | 805 | mode->clock, adjusted_mode->clock, &m_n); |
806 | 806 | ||
807 | if (HAS_DDI(dev)) { | 807 | if (HAS_DDI(dev)) { |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 63160c650cf9..0ca0d7691e35 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -195,6 +195,9 @@ struct intel_crtc_config { | |||
195 | */ | 195 | */ |
196 | bool limited_color_range; | 196 | bool limited_color_range; |
197 | 197 | ||
198 | bool dither; | ||
199 | int pipe_bpp; | ||
200 | |||
198 | /* Used by SDVO (and if we ever fix it, HDMI). */ | 201 | /* Used by SDVO (and if we ever fix it, HDMI). */ |
199 | unsigned pixel_multiplier; | 202 | unsigned pixel_multiplier; |
200 | }; | 203 | }; |
@@ -230,7 +233,6 @@ struct intel_crtc { | |||
230 | int16_t cursor_x, cursor_y; | 233 | int16_t cursor_x, cursor_y; |
231 | int16_t cursor_width, cursor_height; | 234 | int16_t cursor_width, cursor_height; |
232 | bool cursor_visible; | 235 | bool cursor_visible; |
233 | unsigned int bpp; | ||
234 | 236 | ||
235 | struct intel_crtc_config config; | 237 | struct intel_crtc_config config; |
236 | 238 | ||
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 5508687ea2a6..0731ba660aac 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -609,7 +609,7 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder, | |||
609 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) | 609 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) |
610 | hdmi_val |= SDVO_HSYNC_ACTIVE_HIGH; | 610 | hdmi_val |= SDVO_HSYNC_ACTIVE_HIGH; |
611 | 611 | ||
612 | if (intel_crtc->bpp > 24) | 612 | if (intel_crtc->config.pipe_bpp > 24) |
613 | hdmi_val |= HDMI_COLOR_FORMAT_12bpc; | 613 | hdmi_val |= HDMI_COLOR_FORMAT_12bpc; |
614 | else | 614 | else |
615 | hdmi_val |= SDVO_COLOR_FORMAT_8bpc; | 615 | hdmi_val |= SDVO_COLOR_FORMAT_8bpc; |