drm/i915: Handle tiled buffers in vblank tasklet
authorKeith Packard <keithp@keithp.com>
Mon, 21 Apr 2008 06:31:10 +0000 (16:31 +1000)
committerDave Airlie <airlied@linux.ie>
Sat, 26 Apr 2008 07:48:54 +0000 (17:48 +1000)
The vblank tasklet update code must build 2D blt commands with the appropriate
tiled flags

Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/char/drm/i915_drv.h
drivers/char/drm/i915_irq.c

index 675d88b..50cd68d 100644 (file)
@@ -566,6 +566,8 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
 #define XY_SRC_COPY_BLT_CMD            ((2<<29)|(0x53<<22)|6)
 #define XY_SRC_COPY_BLT_WRITE_ALPHA    (1<<21)
 #define XY_SRC_COPY_BLT_WRITE_RGB      (1<<20)
+#define XY_SRC_COPY_BLT_SRC_TILED      (1<<15)
+#define XY_SRC_COPY_BLT_DST_TILED      (1<<11)
 
 #define MI_BATCH_BUFFER                ((0x30<<23)|1)
 #define MI_BATCH_BUFFER_START  (0x31<<23)
index 5a6f830..f7f16e7 100644 (file)
@@ -57,10 +57,20 @@ static void i915_vblank_tasklet(struct drm_device *dev)
                                XY_SRC_COPY_BLT_WRITE_ALPHA |
                                XY_SRC_COPY_BLT_WRITE_RGB)
                             : XY_SRC_COPY_BLT_CMD;
-       u32 pitchropcpp = (sarea_priv->pitch * cpp) | (0xcc << 16) |
-                         (cpp << 23) | (1 << 24);
+       u32 src_pitch = sarea_priv->pitch * cpp;
+       u32 dst_pitch = sarea_priv->pitch * cpp;
+       u32 ropcpp = (0xcc << 16) | ((cpp - 1) << 24);
        RING_LOCALS;
 
+       if (sarea_priv->front_tiled) {
+               cmd |= XY_SRC_COPY_BLT_DST_TILED;
+               dst_pitch >>= 2;
+       }
+       if (sarea_priv->back_tiled) {
+               cmd |= XY_SRC_COPY_BLT_SRC_TILED;
+               src_pitch >>= 2;
+       }
+
        DRM_DEBUG("\n");
 
        INIT_LIST_HEAD(&hits);
@@ -194,12 +204,12 @@ static void i915_vblank_tasklet(struct drm_device *dev)
                                BEGIN_LP_RING(8);
 
                                OUT_RING(cmd);
-                               OUT_RING(pitchropcpp);
+                               OUT_RING(ropcpp | dst_pitch);
                                OUT_RING((y1 << 16) | rect->x1);
                                OUT_RING((y2 << 16) | rect->x2);
                                OUT_RING(sarea_priv->front_offset);
                                OUT_RING((y1 << 16) | rect->x1);
-                               OUT_RING(pitchropcpp & 0xffff);
+                               OUT_RING(src_pitch);
                                OUT_RING(sarea_priv->back_offset);
 
                                ADVANCE_LP_RING();