diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2009-04-14 17:17:47 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-04-16 14:13:11 -0400 |
commit | f544847fbaf099278343f875987a983f2b913134 (patch) | |
tree | 3d0fa173125c6e5725c441d1af27fb38baa07241 /drivers | |
parent | cd97824994042b809493807ea644ba26c0c23290 (diff) |
drm/i915: allow tiled front buffers on 965+
This patch corrects a pretty big oversight in the KMS code for 965+
chips. The current code is missing tiled surface register programming,
so userland can allocate a tiled surface and use it for mode setting,
resulting in corruption. This patch fixes that, allowing for tiled
front buffers on 965+.
Cc: stable@kernel.org
Tested-by: Arkadiusz Miskiewicz <arekm@maven.pl>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/i915/i915_reg.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_display.c | 9 |
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h index e805b590ae71..521194732266 100644 --- a/drivers/gpu/drm/i915/i915_reg.h +++ b/drivers/gpu/drm/i915/i915_reg.h | |||
@@ -1446,6 +1446,7 @@ | |||
1446 | #define DISPPLANE_NO_LINE_DOUBLE 0 | 1446 | #define DISPPLANE_NO_LINE_DOUBLE 0 |
1447 | #define DISPPLANE_STEREO_POLARITY_FIRST 0 | 1447 | #define DISPPLANE_STEREO_POLARITY_FIRST 0 |
1448 | #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18) | 1448 | #define DISPPLANE_STEREO_POLARITY_SECOND (1<<18) |
1449 | #define DISPPLANE_TILED (1<<10) | ||
1449 | #define DSPAADDR 0x70184 | 1450 | #define DSPAADDR 0x70184 |
1450 | #define DSPASTRIDE 0x70188 | 1451 | #define DSPASTRIDE 0x70188 |
1451 | #define DSPAPOS 0x7018C /* reserved */ | 1452 | #define DSPAPOS 0x7018C /* reserved */ |
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index c2c8e95ff14d..bdcda36953b0 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c | |||
@@ -657,6 +657,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
657 | int dspbase = (pipe == 0 ? DSPAADDR : DSPBADDR); | 657 | int dspbase = (pipe == 0 ? DSPAADDR : DSPBADDR); |
658 | int dspsurf = (pipe == 0 ? DSPASURF : DSPBSURF); | 658 | int dspsurf = (pipe == 0 ? DSPASURF : DSPBSURF); |
659 | int dspstride = (pipe == 0) ? DSPASTRIDE : DSPBSTRIDE; | 659 | int dspstride = (pipe == 0) ? DSPASTRIDE : DSPBSTRIDE; |
660 | int dsptileoff = (pipe == 0 ? DSPATILEOFF : DSPBTILEOFF); | ||
660 | int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR; | 661 | int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR; |
661 | u32 dspcntr, alignment; | 662 | u32 dspcntr, alignment; |
662 | int ret; | 663 | int ret; |
@@ -733,6 +734,13 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
733 | mutex_unlock(&dev->struct_mutex); | 734 | mutex_unlock(&dev->struct_mutex); |
734 | return -EINVAL; | 735 | return -EINVAL; |
735 | } | 736 | } |
737 | if (IS_I965G(dev)) { | ||
738 | if (obj_priv->tiling_mode != I915_TILING_NONE) | ||
739 | dspcntr |= DISPPLANE_TILED; | ||
740 | else | ||
741 | dspcntr &= ~DISPPLANE_TILED; | ||
742 | } | ||
743 | |||
736 | I915_WRITE(dspcntr_reg, dspcntr); | 744 | I915_WRITE(dspcntr_reg, dspcntr); |
737 | 745 | ||
738 | Start = obj_priv->gtt_offset; | 746 | Start = obj_priv->gtt_offset; |
@@ -745,6 +753,7 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y, | |||
745 | I915_READ(dspbase); | 753 | I915_READ(dspbase); |
746 | I915_WRITE(dspsurf, Start); | 754 | I915_WRITE(dspsurf, Start); |
747 | I915_READ(dspsurf); | 755 | I915_READ(dspsurf); |
756 | I915_WRITE(dsptileoff, (y << 16) | x); | ||
748 | } else { | 757 | } else { |
749 | I915_WRITE(dspbase, Start + Offset); | 758 | I915_WRITE(dspbase, Start + Offset); |
750 | I915_READ(dspbase); | 759 | I915_READ(dspbase); |