r300-gallium: Properly offset scissors.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Fri, 20 Mar 2009 07:15:03 +0000 (00:15 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Fri, 20 Mar 2009 21:53:20 +0000 (14:53 -0700)
As per r300_reg, classic Mesa, and xf86-video-ati.

src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_surface.c

index 58bce22fc81a2090bdf580e620c104bc9df0d8f7..2a026e7fcacec03cfe39f5f220dd0eb7924e2c27 100644 (file)
@@ -515,12 +515,22 @@ static void r300_set_scissor_state(struct pipe_context* pipe,
     struct r300_context* r300 = r300_context(pipe);
     draw_flush(r300->draw);
 
-    r300->scissor_state->scissor_top_left =
-        (state->minx << R300_SCISSORS_X_SHIFT) |
-        (state->miny << R300_SCISSORS_Y_SHIFT);
-    r300->scissor_state->scissor_bottom_right =
-        (state->maxx << R300_SCISSORS_X_SHIFT) |
-        (state->maxy << R300_SCISSORS_Y_SHIFT);
+    if (r300_screen(r300->context.screen)->caps->is_r500) {
+        r300->scissor_state->scissor_top_left =
+            (state->minx << R300_SCISSORS_X_SHIFT) |
+            (state->miny << R300_SCISSORS_Y_SHIFT);
+        r300->scissor_state->scissor_bottom_right =
+            (state->maxx << R300_SCISSORS_X_SHIFT) |
+            (state->maxy << R300_SCISSORS_Y_SHIFT);
+    } else {
+        /* Offset of 1440 in non-R500 chipsets. */
+        r300->scissor_state->scissor_top_left =
+            ((state->minx + 1440) << R300_SCISSORS_X_SHIFT) |
+            ((state->miny + 1440) << R300_SCISSORS_Y_SHIFT);
+        r300->scissor_state->scissor_bottom_right =
+            ((state->maxx + 1440) << R300_SCISSORS_X_SHIFT) |
+            ((state->maxy + 1440) << R300_SCISSORS_Y_SHIFT);
+    }
 
     r300->dirty_state |= R300_NEW_SCISSOR;
 }
index 2cc0677e52c83dd08c1ebce8f453d82e9429b746..3672f60b1b802d7ee763966c8954d029cd00b9d4 100644 (file)
@@ -80,8 +80,16 @@ static void r300_surface_fill(struct pipe_context* pipe,
 
     /* Pixel scissors */
     OUT_CS_REG_SEQ(R300_SC_SCISSORS_TL, 2);
-    OUT_CS((x << R300_SCISSORS_X_SHIFT) | (y << R300_SCISSORS_Y_SHIFT));
-    OUT_CS((w << R300_SCISSORS_X_SHIFT) | (h << R300_SCISSORS_Y_SHIFT));
+    if (caps->is_r500) {
+        OUT_CS((x << R300_SCISSORS_X_SHIFT) | (y << R300_SCISSORS_Y_SHIFT));
+        OUT_CS((w << R300_SCISSORS_X_SHIFT) | (h << R300_SCISSORS_Y_SHIFT));
+    } else {
+        /* Non-R500 chipsets have an offset of 1440 in their scissors. */
+        OUT_CS(((x + 1440) << R300_SCISSORS_X_SHIFT) |
+                ((y + 1440) << R300_SCISSORS_Y_SHIFT));
+        OUT_CS(((w + 1440) << R300_SCISSORS_X_SHIFT) |
+                ((h + 1440) << R300_SCISSORS_Y_SHIFT));
+    }
 
     /* The size of the point we're about to draw, in sixths of pixels */
     OUT_CS_REG(R300_GA_POINT_SIZE,