r300-gallium: Simplify/neaten up packet3.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Fri, 20 Mar 2009 07:43:29 +0000 (00:43 -0700)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Fri, 20 Mar 2009 21:53:21 +0000 (14:53 -0700)
Deck chairs on the Hindenburg. :3

src/gallium/drivers/r300/r300_cs.h
src/gallium/drivers/r300/r300_cs_inlines.h
src/gallium/drivers/r300/r300_surface.c
src/gallium/drivers/r300/r300_swtcl_emit.c

index d8038ff1e198a4c16568d305e61a19b4967fc0e1..443dfc0233d9f3bf361e891218230e715bc08928 100644 (file)
@@ -47,9 +47,6 @@
 #define CP_PACKET0(register, count) \
     (RADEON_CP_PACKET0 | ((count) << 16) | ((register) >> 2))
 
-#define CP_PACKET3(op, count) \
-    (RADEON_CP_PACKET3 | (op) | ((count) << 16))
-
 #define CS_LOCALS(context) \
     struct r300_winsys* cs_winsys = context->winsys; \
     struct radeon_cs* cs = cs_winsys->cs; \
index 03bb608eb9a106218c5f4fbf97dd42b9e1e22263..64bd58193a7e95f8da8411ea441168637823b527 100644 (file)
     OUT_CS(CP_PACKET0(register, ((count) - 1)) | RADEON_ONE_REG_WR); \
 } while (0)
 
+/* XXX might no longer be needed */
 #define R300_PACIFY do { \
     OUT_CS_REG(RADEON_WAIT_UNTIL, (1 << 14) | (1 << 15) | (1 << 16) | (1 << 17) | \
         (1 << 18)); \
 } while (0)
 
+/* XXX do we still use this? */
 #define R300_SCREENDOOR do { \
     OUT_CS_REG(R300_SC_SCREENDOOR, 0x0); \
     R300_PACIFY; \
     OUT_CS_REG(R300_SC_SCREENDOOR, 0xffffff); \
 } while (0)
 
+#define CP_PACKET3(op, count) \
+    (RADEON_CP_PACKET3 | (op) | ((count) << 16))
+
+#define R300_CS_PKT3(op, count) do { \
+    OUT_CS(CP_PACKET3(op, count)); \
+} while (0)
+
 #endif /* R300_CS_H */
index 86fe3fc4f974a3c23c2595282e905886cd1cd74e..db18975a10f05bdbc6022a0906d930a1c0a4a870 100644 (file)
@@ -129,8 +129,8 @@ static void r300_surface_fill(struct pipe_context* pipe,
         ((h * 6) & R300_POINTSIZE_Y_MASK) |
         ((w * 6) << R300_POINTSIZE_X_SHIFT));
 
-    /* XXX Packet3 */
-    OUT_CS(CP_PACKET3(R200_3D_DRAW_IMMD_2, 8));
+    /* Packet3 with our point vertex */
+    OUT_CS_PKT3(R200_3D_DRAW_IMMD_2, 8);
     OUT_CS(R300_PRIM_TYPE_POINT | R300_PRIM_WALK_RING |
     (1 << R300_PRIM_NUM_VERTICES_SHIFT));
     OUT_CS_32F(w / 2.0);
index c82ee9c087bc644a72934ff4cec26a3a5d44f210..83c25f496bf2202cf37c367f38f3c857732774f7 100644 (file)
@@ -194,7 +194,7 @@ static void prepare_render(struct r300_swtcl_render* render, unsigned count)
      * VBPNTR  [relocated BO]
      */
     BEGIN_CS(7);
-    OUT_CS(CP_PACKET3(R300_PACKET3_3D_LOAD_VBPNTR, 3));
+    OUT_CS_PKT3(R300_PACKET3_3D_LOAD_VBPNTR, 3);
     OUT_CS(1);
     OUT_CS(r300->vertex_info.vinfo.size |
             (r300->vertex_info.vinfo.size << 8));
@@ -219,7 +219,7 @@ static void r300_swtcl_render_draw_arrays(struct vbuf_render* render,
     debug_printf("r300: Doing vbuf render, count %d\n", count);
 
     BEGIN_CS(2);
-    OUT_CS(CP_PACKET3(R300_PACKET3_3D_DRAW_VBUF_2, 0));
+    OUT_CS_PKT3(R300_PACKET3_3D_DRAW_VBUF_2, 0);
     OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_VERTEX_LIST | (count << 16) |
            r300render->hwprim);
     END_CS;
@@ -254,11 +254,11 @@ static void r300_swtcl_render_draw(struct vbuf_render* render,
     debug_printf("r300: Doing indexbuf render, count %d\n", count);
 
     BEGIN_CS(5);
-    OUT_CS(CP_PACKET3(R300_PACKET3_3D_DRAW_INDX_2, 0));
+    OUT_CS_PKT3(R300_PACKET3_3D_DRAW_INDX_2, 0);
     OUT_CS(R300_VAP_VF_CNTL__PRIM_WALK_INDICES | (count << 16) |
            r300render->hwprim | R300_VAP_VF_CNTL__INDEX_SIZE_32bit);
 
-    OUT_CS(CP_PACKET3(R300_PACKET3_INDX_BUFFER, 2));
+    OUT_CS_PKT3(R300_PACKET3_INDX_BUFFER, 2);
     OUT_CS(R300_INDX_BUFFER_ONE_REG_WR | (R300_VAP_PORT_IDX0 >> 2));
     OUT_CS_RELOC(index_buffer, 0, RADEON_GEM_DOMAIN_GTT, 0, 0);
     END_CS;