aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_display.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_display.c')
-rw-r--r--drivers/gpu/drm/i915/intel_display.c84
1 files changed, 65 insertions, 19 deletions
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 73f036bddb6f..3cddd508d110 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -2156,7 +2156,7 @@ static int ironlake_update_plane(struct drm_crtc *crtc,
2156 else 2156 else
2157 dspcntr &= ~DISPPLANE_TILED; 2157 dspcntr &= ~DISPPLANE_TILED;
2158 2158
2159 if (IS_HASWELL(dev)) 2159 if (IS_HASWELL(dev) || IS_BROADWELL(dev))
2160 dspcntr &= ~DISPPLANE_TRICKLE_FEED_DISABLE; 2160 dspcntr &= ~DISPPLANE_TRICKLE_FEED_DISABLE;
2161 else 2161 else
2162 dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE; 2162 dspcntr |= DISPPLANE_TRICKLE_FEED_DISABLE;
@@ -2176,7 +2176,7 @@ static int ironlake_update_plane(struct drm_crtc *crtc,
2176 I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]); 2176 I915_WRITE(DSPSTRIDE(plane), fb->pitches[0]);
2177 I915_MODIFY_DISPBASE(DSPSURF(plane), 2177 I915_MODIFY_DISPBASE(DSPSURF(plane),
2178 i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset); 2178 i915_gem_obj_ggtt_offset(obj) + intel_crtc->dspaddr_offset);
2179 if (IS_HASWELL(dev)) { 2179 if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
2180 I915_WRITE(DSPOFFSET(plane), (y << 16) | x); 2180 I915_WRITE(DSPOFFSET(plane), (y << 16) | x);
2181 } else { 2181 } else {
2182 I915_WRITE(DSPTILEOFF(plane), (y << 16) | x); 2182 I915_WRITE(DSPTILEOFF(plane), (y << 16) | x);
@@ -3393,15 +3393,26 @@ void hsw_enable_ips(struct intel_crtc *crtc)
3393 * only after intel_enable_plane. And intel_enable_plane already waits 3393 * only after intel_enable_plane. And intel_enable_plane already waits
3394 * for a vblank, so all we need to do here is to enable the IPS bit. */ 3394 * for a vblank, so all we need to do here is to enable the IPS bit. */
3395 assert_plane_enabled(dev_priv, crtc->plane); 3395 assert_plane_enabled(dev_priv, crtc->plane);
3396 I915_WRITE(IPS_CTL, IPS_ENABLE); 3396 if (IS_BROADWELL(crtc->base.dev)) {
3397 3397 mutex_lock(&dev_priv->rps.hw_lock);
3398 /* The bit only becomes 1 in the next vblank, so this wait here is 3398 WARN_ON(sandybridge_pcode_write(dev_priv, DISPLAY_IPS_CONTROL, 0xc0000000));
3399 * essentially intel_wait_for_vblank. If we don't have this and don't 3399 mutex_unlock(&dev_priv->rps.hw_lock);
3400 * wait for vblanks until the end of crtc_enable, then the HW state 3400 /* Quoting Art Runyan: "its not safe to expect any particular
3401 * readout code will complain that the expected IPS_CTL value is not the 3401 * value in IPS_CTL bit 31 after enabling IPS through the
3402 * one we read. */ 3402 * mailbox." Therefore we need to defer waiting on the state
3403 if (wait_for(I915_READ_NOTRACE(IPS_CTL) & IPS_ENABLE, 50)) 3403 * change.
3404 DRM_ERROR("Timed out waiting for IPS enable\n"); 3404 * TODO: need to fix this for state checker
3405 */
3406 } else {
3407 I915_WRITE(IPS_CTL, IPS_ENABLE);
3408 /* The bit only becomes 1 in the next vblank, so this wait here
3409 * is essentially intel_wait_for_vblank. If we don't have this
3410 * and don't wait for vblanks until the end of crtc_enable, then
3411 * the HW state readout code will complain that the expected
3412 * IPS_CTL value is not the one we read. */
3413 if (wait_for(I915_READ_NOTRACE(IPS_CTL) & IPS_ENABLE, 50))
3414 DRM_ERROR("Timed out waiting for IPS enable\n");
3415 }
3405} 3416}
3406 3417
3407void hsw_disable_ips(struct intel_crtc *crtc) 3418void hsw_disable_ips(struct intel_crtc *crtc)
@@ -3413,7 +3424,12 @@ void hsw_disable_ips(struct intel_crtc *crtc)
3413 return; 3424 return;
3414 3425
3415 assert_plane_enabled(dev_priv, crtc->plane); 3426 assert_plane_enabled(dev_priv, crtc->plane);
3416 I915_WRITE(IPS_CTL, 0); 3427 if (IS_BROADWELL(crtc->base.dev)) {
3428 mutex_lock(&dev_priv->rps.hw_lock);
3429 WARN_ON(sandybridge_pcode_write(dev_priv, DISPLAY_IPS_CONTROL, 0));
3430 mutex_unlock(&dev_priv->rps.hw_lock);
3431 } else
3432 I915_WRITE(IPS_CTL, 0);
3417 POSTING_READ(IPS_CTL); 3433 POSTING_READ(IPS_CTL);
3418 3434
3419 /* We need to wait for a vblank before we can disable the plane. */ 3435 /* We need to wait for a vblank before we can disable the plane. */
@@ -4244,7 +4260,7 @@ static bool ironlake_check_fdi_lanes(struct drm_device *dev, enum pipe pipe,
4244 return false; 4260 return false;
4245 } 4261 }
4246 4262
4247 if (IS_HASWELL(dev)) { 4263 if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
4248 if (pipe_config->fdi_lanes > 2) { 4264 if (pipe_config->fdi_lanes > 2) {
4249 DRM_DEBUG_KMS("only 2 lanes on haswell, required: %i lanes\n", 4265 DRM_DEBUG_KMS("only 2 lanes on haswell, required: %i lanes\n",
4250 pipe_config->fdi_lanes); 4266 pipe_config->fdi_lanes);
@@ -5818,14 +5834,16 @@ static void intel_set_pipe_csc(struct drm_crtc *crtc)
5818 5834
5819static void haswell_set_pipeconf(struct drm_crtc *crtc) 5835static void haswell_set_pipeconf(struct drm_crtc *crtc)
5820{ 5836{
5821 struct drm_i915_private *dev_priv = crtc->dev->dev_private; 5837 struct drm_device *dev = crtc->dev;
5838 struct drm_i915_private *dev_priv = dev->dev_private;
5822 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 5839 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
5840 enum pipe pipe = intel_crtc->pipe;
5823 enum transcoder cpu_transcoder = intel_crtc->config.cpu_transcoder; 5841 enum transcoder cpu_transcoder = intel_crtc->config.cpu_transcoder;
5824 uint32_t val; 5842 uint32_t val;
5825 5843
5826 val = 0; 5844 val = 0;
5827 5845
5828 if (intel_crtc->config.dither) 5846 if (IS_HASWELL(dev) && intel_crtc->config.dither)
5829 val |= (PIPECONF_DITHER_EN | PIPECONF_DITHER_TYPE_SP); 5847 val |= (PIPECONF_DITHER_EN | PIPECONF_DITHER_TYPE_SP);
5830 5848
5831 if (intel_crtc->config.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE) 5849 if (intel_crtc->config.adjusted_mode.flags & DRM_MODE_FLAG_INTERLACE)
@@ -5838,6 +5856,33 @@ static void haswell_set_pipeconf(struct drm_crtc *crtc)
5838 5856
5839 I915_WRITE(GAMMA_MODE(intel_crtc->pipe), GAMMA_MODE_MODE_8BIT); 5857 I915_WRITE(GAMMA_MODE(intel_crtc->pipe), GAMMA_MODE_MODE_8BIT);
5840 POSTING_READ(GAMMA_MODE(intel_crtc->pipe)); 5858 POSTING_READ(GAMMA_MODE(intel_crtc->pipe));
5859
5860 if (IS_BROADWELL(dev)) {
5861 val = 0;
5862
5863 switch (intel_crtc->config.pipe_bpp) {
5864 case 18:
5865 val |= PIPEMISC_DITHER_6_BPC;
5866 break;
5867 case 24:
5868 val |= PIPEMISC_DITHER_8_BPC;
5869 break;
5870 case 30:
5871 val |= PIPEMISC_DITHER_10_BPC;
5872 break;
5873 case 36:
5874 val |= PIPEMISC_DITHER_12_BPC;
5875 break;
5876 default:
5877 /* Case prevented by pipe_config_set_bpp. */
5878 BUG();
5879 }
5880
5881 if (intel_crtc->config.dither)
5882 val |= PIPEMISC_DITHER_ENABLE | PIPEMISC_DITHER_TYPE_SP;
5883
5884 I915_WRITE(PIPEMISC(pipe), val);
5885 }
5841} 5886}
5842 5887
5843static bool ironlake_compute_clocks(struct drm_crtc *crtc, 5888static bool ironlake_compute_clocks(struct drm_crtc *crtc,
@@ -7159,7 +7204,7 @@ static void ivb_update_cursor(struct drm_crtc *crtc, u32 base)
7159 cntl &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE); 7204 cntl &= ~(CURSOR_MODE | MCURSOR_GAMMA_ENABLE);
7160 cntl |= CURSOR_MODE_DISABLE; 7205 cntl |= CURSOR_MODE_DISABLE;
7161 } 7206 }
7162 if (IS_HASWELL(dev)) { 7207 if (IS_HASWELL(dev) || IS_BROADWELL(dev)) {
7163 cntl |= CURSOR_PIPE_CSC_ENABLE; 7208 cntl |= CURSOR_PIPE_CSC_ENABLE;
7164 cntl &= ~CURSOR_TRICKLE_FEED_DISABLE; 7209 cntl &= ~CURSOR_TRICKLE_FEED_DISABLE;
7165 } 7210 }
@@ -7215,7 +7260,7 @@ static void intel_crtc_update_cursor(struct drm_crtc *crtc,
7215 if (!visible && !intel_crtc->cursor_visible) 7260 if (!visible && !intel_crtc->cursor_visible)
7216 return; 7261 return;
7217 7262
7218 if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev)) { 7263 if (IS_IVYBRIDGE(dev) || IS_HASWELL(dev) || IS_BROADWELL(dev)) {
7219 I915_WRITE(CURPOS_IVB(pipe), pos); 7264 I915_WRITE(CURPOS_IVB(pipe), pos);
7220 ivb_update_cursor(crtc, base); 7265 ivb_update_cursor(crtc, base);
7221 } else { 7266 } else {
@@ -9901,7 +9946,7 @@ int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
9901 9946
9902 if (!drmmode_obj) { 9947 if (!drmmode_obj) {
9903 DRM_ERROR("no such CRTC id\n"); 9948 DRM_ERROR("no such CRTC id\n");
9904 return -EINVAL; 9949 return -ENOENT;
9905 } 9950 }
9906 9951
9907 crtc = to_intel_crtc(obj_to_crtc(drmmode_obj)); 9952 crtc = to_intel_crtc(obj_to_crtc(drmmode_obj));
@@ -10337,7 +10382,7 @@ static void intel_init_display(struct drm_device *dev)
10337 dev_priv->display.write_eld = ironlake_write_eld; 10382 dev_priv->display.write_eld = ironlake_write_eld;
10338 dev_priv->display.modeset_global_resources = 10383 dev_priv->display.modeset_global_resources =
10339 ivb_modeset_global_resources; 10384 ivb_modeset_global_resources;
10340 } else if (IS_HASWELL(dev)) { 10385 } else if (IS_HASWELL(dev) || IS_GEN8(dev)) {
10341 dev_priv->display.fdi_link_train = hsw_fdi_link_train; 10386 dev_priv->display.fdi_link_train = hsw_fdi_link_train;
10342 dev_priv->display.write_eld = haswell_write_eld; 10387 dev_priv->display.write_eld = haswell_write_eld;
10343 dev_priv->display.modeset_global_resources = 10388 dev_priv->display.modeset_global_resources =
@@ -10369,6 +10414,7 @@ static void intel_init_display(struct drm_device *dev)
10369 dev_priv->display.queue_flip = intel_gen6_queue_flip; 10414 dev_priv->display.queue_flip = intel_gen6_queue_flip;
10370 break; 10415 break;
10371 case 7: 10416 case 7:
10417 case 8: /* FIXME(BDW): Check that the gen8 RCS flip works. */
10372 dev_priv->display.queue_flip = intel_gen7_queue_flip; 10418 dev_priv->display.queue_flip = intel_gen7_queue_flip;
10373 break; 10419 break;
10374 } 10420 }