r300: Add some useful debugging information; remove a couple compile warnings.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 24 Jan 2009 11:34:17 +0000 (03:34 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Mon, 2 Feb 2009 07:30:28 +0000 (23:30 -0800)
Deck chairs on the Titanic.

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

index f1502ff76c50611ed491cedf573d54db142d8c27..c4104a65cb1badfa2c411e7cfca6852f6d4bbba8 100644 (file)
@@ -73,33 +73,6 @@ enum {
     CHIP_FAMILY_RV570
 };
 
-static const char* chip_families[] = {
-    "R300",
-    "R350",
-    "R360",
-    "RV350",
-    "RV370",
-    "RV380",
-    "R420",
-    "R423",
-    "R430",
-    "R480",
-    "R481",
-    "RV410",
-    "RS400",
-    "RC410",
-    "RS480",
-    "RS482",
-    "RS690",
-    "RS740",
-    "RV515",
-    "R520",
-    "RV530",
-    "R580",
-    "RV560",
-    "RV570"
-};
-
 void r300_parse_chipset(struct r300_capabilities* caps);
 
 #endif /* R300_CHIPSET_H */
index 67cb5ee7d192b98cf82c42b1d23e2d01e81e0c88..2dcb92d9af2587f3c16e2e4156dd1f02ede0f0ab 100644 (file)
@@ -67,6 +67,8 @@ static uint32_t pack_float_32(float f)
 
 #define BEGIN_CS(size) do { \
     CHECK_CS(size); \
+    debug_printf("r300: BEGIN_CS in %s (%s:%d)", __FUNCTION__, __FILE__, \
+        __LINE__); \
     cs_winsys->begin_cs(cs, (size), __FILE__, __FUNCTION__, __LINE__); \
 } while (0)
 
@@ -91,10 +93,16 @@ static uint32_t pack_float_32(float f)
     cs_winsys->write_cs_reloc(cs, bo, rd, wd, flags); \
 } while (0)
 
-#define END_CS \
-    cs_winsys->end_cs(cs, __FILE__, __FUNCTION__, __LINE__)
+#define END_CS do { \
+    debug_printf("r300: END_CS in %s (%s:%d)", __FUNCTION__, __FILE__, \
+        __LINE__); \
+    cs_winsys->end_cs(cs, __FILE__, __FUNCTION__, __LINE__); \
+} while (0)
 
-#define FLUSH_CS \
-    cs_winsys->flush_cs(cs)
+#define FLUSH_CS do { \
+    debug_printf("r300: FLUSH_CS in %s (%s:%d)", __FUNCTION__, __FILE__, \
+        __LINE__); \
+    cs_winsys->flush_cs(cs); \
+} while (0)
 
 #endif /* R300_CS_H */
index bd5aa4f4664581dca422fbde67d98eebaaa17022..dc1e41749f87593d78ee8ace4bb3ca26ce7302ef 100644 (file)
 
 #include "r300_screen.h"
 
+/* Return the identifier behind whom the brave coders responsible for this
+ * amalgamation of code, sweat, and duct tape, routinely obscure their names.
+ *
+ * ...I should have just put "Corbin Simpson", but I'm not that cool.
+ *
+ * (Or egotistical. Yet.) */
 static const char* r300_get_vendor(struct pipe_screen* pscreen)
 {
     return "X.Org R300 Project";
 }
 
+static const char* chip_families[] = {
+    "R300",
+    "R350",
+    "R360",
+    "RV350",
+    "RV370",
+    "RV380",
+    "R420",
+    "R423",
+    "R430",
+    "R480",
+    "R481",
+    "RV410",
+    "RS400",
+    "RC410",
+    "RS480",
+    "RS482",
+    "RS690",
+    "RS740",
+    "RV515",
+    "R520",
+    "RV530",
+    "R580",
+    "RV560",
+    "RV570"
+};
+
 static const char* r300_get_name(struct pipe_screen* pscreen)
 {
     struct r300_screen* r300screen = r300_screen(pscreen);
@@ -74,18 +107,39 @@ static int r300_get_param(struct pipe_screen* pscreen, int param)
             /* IN THEORY */
             return 0;
         case PIPE_CAP_MAX_TEXTURE_2D_LEVELS:
-            /* 12 == 2048x2048 */
-            return 12;
+            if (r300screen->caps->is_r500) {
+                /* 13 == 4096x4096 */
+                return 13;
+            } else {
+                /* 12 == 2048x2048 */
+                return 12;
+            }
         case PIPE_CAP_MAX_TEXTURE_3D_LEVELS:
-            /* XXX educated guess */
-            return 8;
+            /* So, technically, the limit is the same as above, but some math
+             * shows why this is silly. Assuming RGBA, 4cpp, we can see that
+             * 4096*4096*4096 = 64.0 GiB exactly, so it's not exactly
+             * practical. However, if at some point a game really wants this,
+             * then we can remove this limit. */
+            if (r300screen->caps->is_r500) {
+                /* 9 == 256x256x256 */
+                return 9;
+            } else {
+                /* 8 == 128*128*128 */
+                return 8;
+            }
         case PIPE_CAP_MAX_TEXTURE_CUBE_LEVELS:
-            /* XXX educated guess */
-            return 11;
+            if (r300screen->caps->is_r500) {
+                /* 13 == 4096x4096 */
+                return 13;
+            } else {
+                /* 12 == 2048x2048 */
+                return 12;
+            }
         case PIPE_CAP_MAX_RENDER_TARGETS:
             /* XXX 4 eventually */
             return 1;
         default:
+            debug_printf("r300: Implementation error: Bad param %d", param);
             return 0;
     }
 }
@@ -108,7 +162,7 @@ static float r300_get_paramf(struct pipe_screen* pscreen, int param)
         case PIPE_CAP_MAX_TEXTURE_LOD_BIAS:
             return 16.0f;
         default:
-            /* XXX implementation error? */
+            debug_printf("r300: Implementation error: Bad paramf %d", param);
             return 0.0f;
     }
 }
@@ -121,6 +175,8 @@ static boolean check_tex_2d_format(enum pipe_format format)
         case PIPE_FORMAT_I8_UNORM:
             return TRUE;
         default:
+            debug_printf("r300: Warning: Got unknown format: %d, in %s",
+                format, __FUNCTION__);
             break;
     }
 
@@ -138,6 +194,8 @@ static boolean r300_is_format_supported(struct pipe_screen* pscreen,
         case PIPE_TEXTURE_2D:
             return check_tex_2d_format(format);
         default:
+            debug_printf("r300: Warning: Got unknown format target: %d",
+                format);
             break;
     }