more r500 vs r300 kickin
authorDave Airlie <airlied@redhat.com>
Wed, 19 Mar 2008 06:29:11 +0000 (16:29 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 19 Mar 2008 06:29:11 +0000 (16:29 +1000)
src/mesa/drivers/dri/r300/r300_cmdbuf.c
src/mesa/drivers/dri/r300/r300_context.h
src/mesa/drivers/dri/r300/r300_ioctl.c

index 883b41a349b0016be5337a9582eb4ef6b8e26255..a92bb87d7d0622b344748cb1613fa5cf93db489e 100644 (file)
@@ -379,7 +379,7 @@ void r300InitCmdBuf(r300ContextPtr r300)
        ALLOC_STATE(rc, always, R300_RC_CMDSIZE, 0);
        r300->hw.rc.cmd[R300_RC_CMD_0] = cmdpacket0(R300_RS_COUNT, 2);
        if (is_r500) {
-               ALLOC_STATE(ri, always, R300_RI_CMDSIZE, 0);
+               ALLOC_STATE(ri, always, R500_RI_CMDSIZE, 0);
                r300->hw.ri.cmd[R300_RI_CMD_0] = cmdpacket0(R500_RS_IP_0, 16);
                ALLOC_STATE(rr, variable, R300_RR_CMDSIZE, 0);
                r300->hw.rr.cmd[R300_RR_CMD_0] = cmdpacket0(R500_RS_INST_0, 1);
@@ -393,23 +393,23 @@ void r300InitCmdBuf(r300ContextPtr r300)
        r300->hw.sc_hyperz.cmd[0] = cmdpacket0(R300_SC_HYPERZ, 2);
        ALLOC_STATE(sc_screendoor, always, 2, 0);
        r300->hw.sc_screendoor.cmd[0] = cmdpacket0(R300_SC_SCREENDOOR, 1);
-       ALLOC_STATE(fp, always, R300_FP_CMDSIZE, 0);
-       r300->hw.fp.cmd[R300_FP_CMD_0] = cmdpacket0(R300_PFS_CNTL_0, 3);
-       r300->hw.fp.cmd[R300_FP_CMD_1] = cmdpacket0(R300_PFS_NODE_0, 4);
-       ALLOC_STATE(fpt, variable, R300_FPT_CMDSIZE, 0);
-       r300->hw.fpt.cmd[R300_FPT_CMD_0] = cmdpacket0(R300_PFS_TEXI_0, 0);
        ALLOC_STATE(us_out_fmt, always, 6, 0);
        r300->hw.us_out_fmt.cmd[0] = cmdpacket0(R500_US_OUT_FMT, 5);
 
        if (is_r500) {
                ALLOC_STATE(r500fp, variable, R300_FPI_CMDSIZE, 0);
-               r300->hw.r500fp.cmd[R300_FPI_CMD_0] = cmdr500fp(0, 1);
+               r300->hw.r500fp.cmd[R300_FPI_CMD_0] = cmdr500fp(0, 0);
        }
 
-       if (0/*is_r500*/) {
+       if (is_r500) {
+
+       } else {
+               ALLOC_STATE(fp, always, R300_FP_CMDSIZE, 0);
+               r300->hw.fp.cmd[R300_FP_CMD_0] = cmdpacket0(R300_PFS_CNTL_0, 3);
+               r300->hw.fp.cmd[R300_FP_CMD_1] = cmdpacket0(R300_PFS_NODE_0, 4);
+               ALLOC_STATE(fpt, variable, R300_FPT_CMDSIZE, 0);
+               r300->hw.fpt.cmd[R300_FPT_CMD_0] = cmdpacket0(R300_PFS_TEXI_0, 0);
 
-       }/* else*/
-       {
                ALLOC_STATE(fpi[0], variable, R300_FPI_CMDSIZE, 0);
                r300->hw.fpi[0].cmd[R300_FPI_CMD_0] = cmdpacket0(R300_PFS_INSTR0_0, 1);
                ALLOC_STATE(fpi[1], variable, R300_FPI_CMDSIZE, 1);
index 1b8b9a82222c4667fe946f5cece4150e84a7e5a7..4f8b7591c20972495e7b52319cefb7a1bd8b22cd 100644 (file)
@@ -330,6 +330,8 @@ struct r300_state_atom {
 #define R300_RI_INTERP_7       8
 #define R300_RI_CMDSIZE                9
 
+#define R500_RI_CMDSIZE               17
+
 #define R300_RR_CMD_0          0       /* rr is variable size (at least 1) */
 #define R300_RR_ROUTE_0                1
 #define R300_RR_ROUTE_1                2
index 02c67e8ef9c63238337c0c36ac00057c8bd7f5f7..2ad1bc3bcd5d428a6efef68e8a92111e9fbd0c00 100644 (file)
@@ -186,10 +186,15 @@ static void r300EmitClearState(GLcontext * ctx)
        int cmd_written = 0;
        drm_radeon_cmd_header_t *cmd = NULL;
        int has_tcl = 1;
+       int is_r500 = 0;
 
        if (!(r300->radeon.radeonScreen->chip_flags & RADEON_CHIPSET_TCL))
                has_tcl = 0;
 
+        if (r300->radeon.radeonScreen->chip_family >= CHIP_FAMILY_RV515)
+                is_r500 = 1;
+
+
        /* FIXME: the values written to R300_VAP_INPUT_ROUTE_0_0 and
         * R300_VAP_INPUT_ROUTE_0_1 are in fact known, however, the values are
         * quite complex; see the functions in r300_emit.c.
@@ -271,49 +276,53 @@ static void r300EmitClearState(GLcontext * ctx)
        e32(((dPriv->w * 6) << R300_POINTSIZE_X_SHIFT) |
            ((dPriv->h * 6) << R300_POINTSIZE_Y_SHIFT));
 
-       R300_STATECHANGE(r300, ri);
-       reg_start(R300_RS_IP_0, 8);
-       for (i = 0; i < 8; ++i) {
-               e32(R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3));
-       }
+       if (!is_r500) {
+               R300_STATECHANGE(r300, ri);
+               reg_start(R300_RS_IP_0, 8);
+               for (i = 0; i < 8; ++i) {
+                       e32(R300_RS_SEL_T(1) | R300_RS_SEL_R(2) | R300_RS_SEL_Q(3));
+               }
 
-       R300_STATECHANGE(r300, rc);
-       /* The second constant is needed to get glxgears display anything .. */
-       reg_start(R300_RS_COUNT, 1);
-       e32((1 << R300_IC_COUNT_SHIFT) | R300_HIRES_EN);
-       e32(0x0);
+               R300_STATECHANGE(r300, rc);
+               /* The second constant is needed to get glxgears display anything .. */
+               reg_start(R300_RS_COUNT, 1);
+               e32((1 << R300_IC_COUNT_SHIFT) | R300_HIRES_EN);
+               e32(0x0);
 
-       R300_STATECHANGE(r300, rr);
-       reg_start(R300_RS_ROUTE_0, 0);
-       e32(R300_RS_ROUTE_0_COLOR);
+               R300_STATECHANGE(r300, rr);
+               reg_start(R300_RS_ROUTE_0, 0);
+               e32(R300_RS_ROUTE_0_COLOR);
+       }
 
-       R300_STATECHANGE(r300, fp);
-       reg_start(R300_PFS_CNTL_0, 2);
-       e32(0x0);
-       e32(0x0);
-       e32(0x0);
-       reg_start(R300_PFS_NODE_0, 3);
-       e32(0x0);
-       e32(0x0);
-       e32(0x0);
-       e32(R300_PFS_NODE_OUTPUT_COLOR);
+       if (!is_r500) {
+               R300_STATECHANGE(r300, fp);
+               reg_start(R300_PFS_CNTL_0, 2);
+               e32(0x0);
+               e32(0x0);
+               e32(0x0);
+               reg_start(R300_PFS_NODE_0, 3);
+               e32(0x0);
+               e32(0x0);
+               e32(0x0);
+               e32(R300_PFS_NODE_OUTPUT_COLOR);
 
-       R300_STATECHANGE(r300, fpi[0]);
-       R300_STATECHANGE(r300, fpi[1]);
-       R300_STATECHANGE(r300, fpi[2]);
-       R300_STATECHANGE(r300, fpi[3]);
+               R300_STATECHANGE(r300, fpi[0]);
+               R300_STATECHANGE(r300, fpi[1]);
+               R300_STATECHANGE(r300, fpi[2]);
+               R300_STATECHANGE(r300, fpi[3]);
 
-       reg_start(R300_PFS_INSTR0_0, 0);
-       e32(FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO)));
+               reg_start(R300_PFS_INSTR0_0, 0);
+               e32(FP_INSTRC(MAD, FP_ARGC(SRC0C_XYZ), FP_ARGC(ONE), FP_ARGC(ZERO)));
 
-       reg_start(R300_PFS_INSTR1_0, 0);
-       e32(FP_SELC(0, NO, XYZ, FP_TMP(0), 0, 0));
+               reg_start(R300_PFS_INSTR1_0, 0);
+               e32(FP_SELC(0, NO, XYZ, FP_TMP(0), 0, 0));
 
-       reg_start(R300_PFS_INSTR2_0, 0);
-       e32(FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO)));
+               reg_start(R300_PFS_INSTR2_0, 0);
+               e32(FP_INSTRA(MAD, FP_ARGA(SRC0A), FP_ARGA(ONE), FP_ARGA(ZERO)));
 
-       reg_start(R300_PFS_INSTR3_0, 0);
-       e32(FP_SELA(0, NO, W, FP_TMP(0), 0, 0));
+               reg_start(R300_PFS_INSTR3_0, 0);
+               e32(FP_SELA(0, NO, W, FP_TMP(0), 0, 0));
+       }
 
        if (has_tcl) {
                R300_STATECHANGE(r300, pvs);