i915: Fix surface operations
authorJakob Bornecrantz <wallbraker@gmail.com>
Fri, 30 Jan 2009 00:53:50 +0000 (01:53 +0100)
committerJakob Bornecrantz <wallbraker@gmail.com>
Fri, 30 Jan 2009 00:53:50 +0000 (01:53 +0100)
src/gallium/drivers/i915simple/i915_blit.c
src/gallium/drivers/i915simple/i915_blit.h
src/gallium/drivers/i915simple/i915_surface.c

index 5a4b82921096ca0552ad89dcc50e3f942030b605..448a4708ce8023baec02e720bd2231a8141ce1e0 100644 (file)
@@ -38,7 +38,7 @@
 void
 i915_fill_blit(struct i915_context *i915,
               unsigned cpp,
-              short dst_pitch,
+              unsigned short dst_pitch,
               struct pipe_buffer *dst_buffer,
               unsigned dst_offset,
               short x, short y, 
@@ -47,15 +47,23 @@ i915_fill_blit(struct i915_context *i915,
 {
    unsigned BR13, CMD;
 
+
+   I915_DBG(i915,
+       "%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n",
+       __FUNCTION__,
+       dst_buffer, dst_pitch, dst_offset, x, y, w, h);
+
    switch (cpp) {
    case 1:
    case 2:
    case 3:
-      BR13 = dst_pitch | (0xF0 << 16) | (1 << 24);
+      BR13 = (((int) dst_pitch) & 0xffff) |
+        (0xF0 << 16) | (1 << 24);
       CMD = XY_COLOR_BLT_CMD;
       break;
    case 4:
-      BR13 = dst_pitch | (0xF0 << 16) | (1 << 24) | (1 << 25);
+      BR13 = (((int) dst_pitch) & 0xffff) |
+        (0xF0 << 16) | (1 << 24) | (1 << 25);
       CMD = (XY_COLOR_BLT_CMD | XY_COLOR_BLT_WRITE_ALPHA |
              XY_COLOR_BLT_WRITE_RGB);
       break;
@@ -63,10 +71,6 @@ i915_fill_blit(struct i915_context *i915,
       return;
    }
 
-//   DBG("%s dst:buf(%p)/%d+%d %d,%d sz:%dx%d\n",
-//       __FUNCTION__, dst_buffer, dst_pitch, dst_offset, x, y, w, h);
-
-
    if (!BEGIN_BATCH(6, 1)) {
       FLUSH_BATCH(NULL);
       assert(BEGIN_BATCH(6, 1));
@@ -85,10 +89,10 @@ void
 i915_copy_blit( struct i915_context *i915,
                   unsigned do_flip,
                   unsigned cpp,
-                  short src_pitch,
+                  unsigned short src_pitch,
                   struct pipe_buffer *src_buffer,
                   unsigned src_offset,
-                  short dst_pitch,
+                  unsigned short dst_pitch,
                   struct pipe_buffer *dst_buffer,
                   unsigned dst_offset,
                   short src_x, short src_y,
@@ -106,20 +110,16 @@ i915_copy_blit( struct i915_context *i915,
        src_buffer, src_pitch, src_offset, src_x, src_y,
        dst_buffer, dst_pitch, dst_offset, dst_x, dst_y, w, h);
 
-   src_pitch *= (short) cpp;
-   dst_pitch *= (short) cpp;
-
    switch (cpp) {
    case 1:
    case 2:
    case 3:
-      BR13 = (((int) dst_pitch) & 0xffff) | 
+      BR13 = (((int) dst_pitch) & 0xffff) |
         (0xCC << 16) | (1 << 24);
       CMD = XY_SRC_COPY_BLT_CMD;
       break;
    case 4:
-      BR13 =
-         (((int) dst_pitch) & 0xffff) | 
+      BR13 = (((int) dst_pitch) & 0xffff) |
         (0xCC << 16) | (1 << 24) | (1 << 25);
       CMD =
          (XY_SRC_COPY_BLT_CMD | XY_SRC_COPY_BLT_WRITE_ALPHA |
index 6e5b44e12479d1921898ceffbdf7ba75177039b1..0bb34538611e358026deeb4e1053b2bddb7dedfa 100644 (file)
 extern void i915_copy_blit(struct i915_context *i915,
                            unsigned do_flip,
                           unsigned cpp,
-                          short src_pitch,
+                          unsigned short src_pitch,
                           struct pipe_buffer *src_buffer,
                           unsigned src_offset,
-                          short dst_pitch,
+                          unsigned short dst_pitch,
                           struct pipe_buffer *dst_buffer,
                           unsigned dst_offset,
                           short srcx, short srcy,
@@ -45,7 +45,7 @@ extern void i915_copy_blit(struct i915_context *i915,
 
 extern void i915_fill_blit(struct i915_context *i915,
                           unsigned cpp,
-                          short dst_pitch,
+                          unsigned short dst_pitch,
                           struct pipe_buffer *dst_buffer,
                           unsigned dst_offset,
                           short x, short y,
index 62f1926644a61de8e340a4f7743306f70a1a1f27..3b3d9217a0c0faf2db7f88c603ba8f39b965dc98 100644 (file)
@@ -79,8 +79,8 @@ i915_surface_copy(struct pipe_context *pipe,
       i915_copy_blit( i915_context(pipe),
                       do_flip,
                       dst->block.size,
-                     (short) src->stride, src->buffer, src->offset,
-                     (short) dst->stride, dst->buffer, dst->offset,
+                     (unsigned short) src->stride, src->buffer, src->offset,
+                     (unsigned short) dst->stride, dst->buffer, dst->offset,
                      (short) srcx, (short) srcy, (short) dstx, (short) dsty, (short) width, (short) height );
    }
 }
@@ -106,7 +106,7 @@ i915_surface_fill(struct pipe_context *pipe,
       assert(dst->block.height == 1);
       i915_fill_blit( i915_context(pipe),
                      dst->block.size,
-                     (short) dst->stride,
+                     (unsigned short) dst->stride,
                      dst->buffer, dst->offset,
                      (short) dstx, (short) dsty,
                      (short) width, (short) height,