r300: Use chip caps for something.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Tue, 20 Jan 2009 09:11:08 +0000 (01:11 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 2 Feb 2009 07:30:24 +0000 (23:30 -0800)
Step two: Integration. Yay?

Time to stop messing around with this and actually go do things.

src/gallium/drivers/r300/r300_chipset.c
src/gallium/drivers/r300/r300_chipset.h
src/gallium/drivers/r300/r300_emit.c
src/gallium/drivers/r300/r300_screen.c

index 926a9dda50224341a65b1b704ae26ad2cb3dd094..1dc9b8cf3c5a26e3f4831307ed39670f76442a39 100644 (file)
 /* Parse a PCI ID and fill an r300_capabilities struct with information. */
 void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
 {
+    /* Reasonable defaults */
     caps->pci_id = pci_id;
+    caps->has_tcl = TRUE;
+    caps->is_r500 = FALSE;
 
     /* Note: These are not ordered by PCI ID. I leave that task to GCC,
      * which will perform the ordering while collating jump tables. Instead,
@@ -37,8 +40,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x4144:
             caps->family = CHIP_FAMILY_R300;
             caps->num_pipes = 1;
-            caps->has_tcl = TRUE;
-            caps->has_us = FALSE;
             break;
 
         case 0x4145:
@@ -50,8 +51,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x4E47:
             caps->family = CHIP_FAMILY_R300;
             caps->num_pipes = 2;
-            caps->has_tcl = TRUE;
-            caps->has_us = FALSE;
             break;
 
         case 0x4150:
@@ -69,8 +68,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x4E56:
             caps->family = CHIP_FAMILY_RV350;
             caps->num_pipes = 1;
-            caps->has_tcl = TRUE;
-            caps->has_us = FALSE;
             break;
 
         case 0x4148:
@@ -82,15 +79,11 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x4E4B:
             caps->family = CHIP_FAMILY_R350;
             caps->num_pipes = 2;
-            caps->has_tcl = TRUE;
-            caps->has_us = FALSE;
             break;
 
         case 0x4E4A:
             caps->family = CHIP_FAMILY_R360;
             caps->num_pipes = 2;
-            caps->has_tcl = TRUE;
-            caps->has_us = FALSE;
             break;
 
         case 0x5460:
@@ -103,8 +96,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x5B65:
             caps->family = CHIP_FAMILY_RV370;
             caps->num_pipes = 1;
-            caps->has_tcl = TRUE;
-            caps->has_us = FALSE;
             break;
 
         case 0x3150:
@@ -114,8 +105,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x3E54:
             caps->family = CHIP_FAMILY_RV380;
             caps->num_pipes = 1;
-            caps->has_tcl = TRUE;
-            caps->has_us = FALSE;
             break;
 
         case 0x4A48:
@@ -130,8 +119,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x4A54:
             caps->family = CHIP_FAMILY_R420;
             caps->num_pipes = 4;
-            caps->has_tcl = TRUE;
-            caps->has_us = FALSE;
             break;
 
         case 0x5548:
@@ -145,8 +132,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x5D57:
             caps->family = CHIP_FAMILY_R423;
             caps->num_pipes = 4;
-            caps->has_tcl = TRUE;
-            caps->has_us = FALSE;
             break;
 
         case 0x554C:
@@ -158,8 +143,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x5D4A:
             caps->family = CHIP_FAMILY_R430;
             caps->num_pipes = 4;
-            caps->has_tcl = TRUE;
-            caps->has_us = FALSE;
             break;
 
         case 0x5D4C:
@@ -170,8 +153,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x5D52:
             caps->family = CHIP_FAMILY_R480;
             caps->num_pipes = 4;
-            caps->has_tcl = TRUE;
-            caps->has_us = FALSE;
             break;
 
         case 0x4B49:
@@ -180,8 +161,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x4B4C:
             caps->family = CHIP_FAMILY_R481;
             caps->num_pipes = 4;
-            caps->has_tcl = TRUE;
-            caps->has_us = FALSE;
             break;
 
         case 0x5E4C:
@@ -198,8 +177,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x5E4D:
             caps->family = CHIP_FAMILY_RV410;
             caps->num_pipes = 1;
-            caps->has_tcl = TRUE;
-            caps->has_us = FALSE;
             break;
 
         case 0x5954:
@@ -207,7 +184,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
             caps->family = CHIP_FAMILY_RS480;
             caps->num_pipes = 1; /* CHECK ME */
             caps->has_tcl = FALSE;
-            caps->has_us = FALSE;
             break;
 
         case 0x5974:
@@ -215,7 +191,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
             caps->family = CHIP_FAMILY_RS482;
             caps->num_pipes = 1; /* CHECK ME */
             caps->has_tcl = FALSE;
-            caps->has_us = FALSE;
             break;
 
         case 0x5A41:
@@ -223,7 +198,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
             caps->family = CHIP_FAMILY_RS400;
             caps->num_pipes = 1; /* CHECK ME */
             caps->has_tcl = FALSE;
-            caps->has_us = FALSE;
             break;
 
         case 0x5A61:
@@ -231,7 +205,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
             caps->family = CHIP_FAMILY_RC410;
             caps->num_pipes = 1; /* CHECK ME */
             caps->has_tcl = FALSE;
-            caps->has_us = FALSE;
             break;
 
         case 0x791E:
@@ -239,7 +212,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
             caps->family = CHIP_FAMILY_RS690;
             caps->num_pipes = 1; /* CHECK ME */
             caps->has_tcl = FALSE;
-            caps->has_us = FALSE; /* CHECK ME */
             break;
 
         case 0x796C:
@@ -249,7 +221,6 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
             caps->family = CHIP_FAMILY_RS740;
             caps->num_pipes = 1; /* CHECK ME */
             caps->has_tcl = FALSE;
-            caps->has_us = FALSE; /* CHECK ME */
             break;
 
         case 0x7100:
@@ -268,8 +239,7 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x710F:
             caps->family = CHIP_FAMILY_R520;
             caps->num_pipes = 4;
-            caps->has_tcl = TRUE;
-            caps->has_us = TRUE;
+            caps->is_r500 = TRUE;
             break;
 
         case 0x7140:
@@ -312,8 +282,7 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x7211:
             caps->family = CHIP_FAMILY_RV515;
             caps->num_pipes = 1;
-            caps->has_tcl = TRUE;
-            caps->has_us = TRUE;
+            caps->is_r500 = TRUE;
             break;
 
         case 0x71C0:
@@ -334,8 +303,7 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x71DE:
             caps->family = CHIP_FAMILY_RV530;
             caps->num_pipes = 1;
-            caps->has_tcl = TRUE;
-            caps->has_us = TRUE;
+            caps->is_r500 = TRUE;
             break;
 
         case 0x7240:
@@ -355,15 +323,13 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x7284:
             caps->family = CHIP_FAMILY_R580;
             caps->num_pipes = 4;
-            caps->has_tcl = TRUE;
-            caps->has_us = TRUE;
+            caps->is_r500 = TRUE;
             break;
 
         case 0x7280:
             caps->family = CHIP_FAMILY_RV570;
             caps->num_pipes = 4;
-            caps->has_tcl = TRUE;
-            caps->has_us = TRUE;
+            caps->is_r500 = TRUE;
             break;
 
         case 0x7281:
@@ -379,13 +345,11 @@ void r300_parse_chipset(uint32_t pci_id, struct r300_capabilities* caps)
         case 0x7297:
             caps->family = CHIP_FAMILY_RV560;
             caps->num_pipes = 4;
-            caps->has_tcl = TRUE;
-            caps->has_us = TRUE;
+            caps->is_r500 = TRUE;
             break;
 
         default:
             /* XXX not an r300?! */
-            assert(0);
             break;
     }
 }
index 98963db17e3b2c99387a8ce21d0e70dae761aafa..c2d7ad3414c3ce3a26b26cbc8cd0a70cd88a6ed7 100644 (file)
@@ -36,11 +36,14 @@ struct r300_capabilities {
     int num_pipes;
     /* Whether or not TCL is physically present */
     boolean has_tcl;
-    /* Whether or not Universal Shaders (US) are used for fragment shaders */
-    boolean has_us;
+    /* Whether or not this is an RV515 or newer; R500s have many features:
+     * - Extra bit on texture sizes
+     * - Blend color is split across two registers
+     * - Universal Shader (US) block used for fragment shaders */
+    boolean is_r500;
 };
 
-/* Enumeration for legibility and also telling which card we're running on. */
+/* Enumerations for legibility and telling which card we're running on. */
 enum {
     CHIP_FAMILY_R300 = 0,
     CHIP_FAMILY_R350,
index 42096a92351535387251dbd8346435ea5fc390a4..bf6fd3224eb5edc7bbd0007017b7b325ef9f2248 100644 (file)
@@ -48,7 +48,7 @@ static void r300_emit_dirty_state(struct r300_context* r300)
 
     if (r300->dirty_state & R300_NEW_BLEND_COLOR) {
         struct r300_blend_color_state* blend_color = r300->blend_color_state;
-        if (FALSE /*XXX*/) {
+        if (r300screen->caps->is_r500) {
             /* XXX next two are contiguous regs */
             OUT_CS_REG(R500_RB3D_CONSTANT_COLOR_AR,
                        blend_color->blend_color_red_alpha);
@@ -69,7 +69,7 @@ static void r300_emit_dirty_state(struct r300_context* r300)
         OUT_CS_REG(R300_ZB_ZSTENCILCNTL, dsa->z_stencil_control);
         OUT_CS_REG(R300_ZB_STENCILREFMASK, dsa->stencil_ref_mask);
         OUT_CS_REG(R300_ZB_ZTOP, dsa->z_buffer_top);
-        if (FALSE /*XXX*/) {
+        if (r300screen->caps->is_r500) {
             OUT_CS_REG(R500_ZB_STENCILREFMASK_BF, dsa->stencil_ref_bf);
         }
     }
index c75ff9414b3e83743e1f49d64ae2b644a12315f7..7bba567e83eff8c4e76f695094d8d63f9ae43995 100644 (file)
@@ -27,8 +27,9 @@ static const char* r300_get_vendor(struct pipe_screen* pscreen) {
 }
 
 static const char* r300_get_name(struct pipe_screen* pscreen) {
-    /* XXX lazy */
-    return "unknown";
+    struct r300_screen* r300screen = r300_screen(pscreen);
+
+    return chip_families[r300screen->caps->family];
 }
 
 static int r300_get_param(struct pipe_screen* pscreen, int param) {