r300g: print driver info if RADEON_DEBUG=info
authorMarek Olšák <maraeo@gmail.com>
Thu, 27 Jan 2011 22:14:17 +0000 (23:14 +0100)
committerMarek Olšák <maraeo@gmail.com>
Thu, 27 Jan 2011 22:17:41 +0000 (23:17 +0100)
src/gallium/drivers/r300/r300_context.c
src/gallium/drivers/r300/r300_debug.c
src/gallium/drivers/r300/r300_screen.h
src/gallium/drivers/r300/r300_winsys.h
src/gallium/winsys/radeon/drm/radeon_drm_common.c
src/gallium/winsys/radeon/drm/radeon_r300.c
src/gallium/winsys/radeon/drm/radeon_winsys.h

index 552df2b..c8966ee 100644 (file)
@@ -522,9 +522,34 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
                                                            &dsa);
     }
 
+    /* Print driver info. */
+#ifdef NDEBUG
+    if (DBG_ON(r300, DBG_INFO)) {
+#else
+    {
+#endif
+        fprintf(stderr,
+                "r300: DRM version: %d.%d.%d, Name: %s, ID: 0x%04x, GB: %d, Z: %d\n"
+                "r300: GART size: %d MB, VRAM size: %d MB\n"
+                "r300: AA compression: %s, Z compression: %s, HiZ: %s\n",
+                rws->get_value(rws, R300_VID_DRM_MAJOR),
+                rws->get_value(rws, R300_VID_DRM_MINOR),
+                rws->get_value(rws, R300_VID_DRM_PATCHLEVEL),
+                screen->get_name(screen),
+                rws->get_value(rws, R300_VID_PCI_ID),
+                rws->get_value(rws, R300_VID_GB_PIPES),
+                rws->get_value(rws, R300_VID_Z_PIPES),
+                rws->get_value(rws, R300_VID_GART_SIZE) >> 20,
+                rws->get_value(rws, R300_VID_VRAM_SIZE) >> 20,
+                rws->get_value(rws, R300_CAN_AACOMPRESS) ? "YES" : "NO",
+                rws->get_value(rws, R300_CAN_HYPERZ) ? "YES" : "NO",
+                rws->get_value(rws, R300_CAN_HYPERZ) &&
+                r300->screen->caps.hiz_ram ? "YES" : "NO");
+    }
+
     return &r300->context;
 
- fail:
+fail:
     r300_destroy_context(&r300->context);
     return NULL;
 }
index d6aa90b..c6b4804 100644 (file)
@@ -27,6 +27,7 @@
 #include <stdio.h>
 
 static const struct debug_named_value debug_options[] = {
+    { "info", DBG_INFO, "Print hardware info"},
     { "fp", DBG_FP, "Log fragment program compilation" },
     { "vp", DBG_VP, "Log vertex program compilation" },
     { "pstat", DBG_P_STAT, "Log vertex/fragment program stats" },
index 752f53b..973b792 100644 (file)
@@ -94,6 +94,7 @@ r300_winsys_screen(struct pipe_screen *screen) {
 #define DBG_HYPERZ      (1 << 12)
 #define DBG_SCISSOR     (1 << 13)
 #define DBG_UPLOAD      (1 << 14)
+#define DBG_INFO        (1 << 15)
 /* Features. */
 #define DBG_ANISOHQ     (1 << 16)
 #define DBG_NO_TILING   (1 << 17)
index 05b5728..2e8ccdd 100644 (file)
@@ -50,10 +50,18 @@ enum r300_value_id {
     R300_VID_PCI_ID,
     R300_VID_GB_PIPES,
     R300_VID_Z_PIPES,
+    R300_VID_GART_SIZE,
+    R300_VID_VRAM_SIZE,
+    R300_VID_DRM_MAJOR,
+    R300_VID_DRM_MINOR,
+    R300_VID_DRM_PATCHLEVEL,
+
+    /* These should probably go away: */
     R300_VID_DRM_2_1_0,  /* Square tiling. */
-    R300_VID_DRM_2_3_0, /* R500 VAP regs, MSPOS regs, fixed tex3D size checking */
-    R300_VID_DRM_2_6_0, /* Hyper-Z, GB_Z_PEQ_CONFIG on rv350->r4xx, R500 FG_ALPHA_VALUE */
-    R300_VID_DRM_2_8_0, /* R500 US_FORMAT regs, R500 ARGB2101010 colorbuffer */
+    R300_VID_DRM_2_3_0,  /* R500 VAP regs, MSPOS regs, fixed tex3D size checking */
+    R300_VID_DRM_2_6_0,  /* Hyper-Z, GB_Z_PEQ_CONFIG on rv350->r4xx, R500 FG_ALPHA_VALUE */
+    R300_VID_DRM_2_8_0,  /* R500 US_FORMAT regs, R500 ARGB2101010 colorbuffer, CMask */
+
     R300_CAN_HYPERZ,     /* ZMask + HiZ */
     R300_CAN_AACOMPRESS, /* CMask */
 };
index ba548c4..2ecf1bb 100644 (file)
@@ -106,19 +106,9 @@ static void do_ioctls(struct radeon_drm_winsys *winsys)
         exit(1);
     }
 
-    winsys->drm_2_1_0 = version->version_major > 2 ||
-                        version->version_minor >= 1;
-
-    winsys->drm_2_3_0 = version->version_major > 2 ||
-                        version->version_minor >= 3;
-
-    winsys->drm_2_6_0 = version->version_major > 2 ||
-                        (version->version_major == 2 &&
-                         version->version_minor >= 6);
-
-    winsys->drm_2_8_0 = version->version_major > 2 ||
-                        (version->version_major == 2 &&
-                         version->version_minor >= 8);
+    winsys->drm_major = version->version_major;
+    winsys->drm_minor = version->version_minor;
+    winsys->drm_patchlevel = version->version_patchlevel;
 
     info.request = RADEON_INFO_DEVICE_ID;
     retval = drmCommandWriteRead(winsys->fd, DRM_RADEON_INFO, &info, sizeof(info));
@@ -167,17 +157,6 @@ static void do_ioctls(struct radeon_drm_winsys *winsys)
     winsys->gart_size = gem_info.gart_size;
     winsys->vram_size = gem_info.vram_size;
 
-    debug_printf("radeon: Successfully grabbed chipset info from kernel!\n"
-                 "radeon: DRM version: %d.%d.%d ID: 0x%04x GB: %d Z: %d\n"
-                 "radeon: GART size: %d MB VRAM size: %d MB\n"
-                 "radeon: HyperZ: %s\n",
-                 version->version_major, version->version_minor,
-                 version->version_patchlevel, winsys->pci_id,
-                 winsys->gb_pipes, winsys->z_pipes,
-                 winsys->gart_size / 1024 / 1024,
-                 winsys->vram_size / 1024 / 1024,
-                 winsys->hyperz ? "YES" : "NO");
-
     drmFreeVersion(version);
 }
 
index 91746ba..aebe6a6 100644 (file)
@@ -145,14 +145,24 @@ static uint32_t radeon_get_value(struct r300_winsys_screen *rws,
        return ws->gb_pipes;
     case R300_VID_Z_PIPES:
        return ws->z_pipes;
+    case R300_VID_GART_SIZE:
+        return ws->gart_size;
+    case R300_VID_VRAM_SIZE:
+        return ws->vram_size;
+    case R300_VID_DRM_MAJOR:
+        return ws->drm_major;
+    case R300_VID_DRM_MINOR:
+        return ws->drm_minor;
+    case R300_VID_DRM_PATCHLEVEL:
+        return ws->drm_patchlevel;
     case R300_VID_DRM_2_1_0:
-        return ws->drm_2_1_0;
+        return ws->drm_major*100 + ws->drm_minor >= 201;
     case R300_VID_DRM_2_3_0:
-        return ws->drm_2_3_0;
+        return ws->drm_major*100 + ws->drm_minor >= 203;
     case R300_VID_DRM_2_6_0:
-        return ws->drm_2_6_0;
+        return ws->drm_major*100 + ws->drm_minor >= 206;
     case R300_VID_DRM_2_8_0:
-        return ws->drm_2_8_0;
+        return ws->drm_major*100 + ws->drm_minor >= 208;
     case R300_CAN_HYPERZ:
         return ws->hyperz;
     case R300_CAN_AACOMPRESS:
index 59e12ff..743c4fb 100644 (file)
@@ -46,13 +46,10 @@ struct radeon_drm_winsys {
     uint32_t z_pipes;       /* Z pipe count (rv530 only) */
     uint32_t gart_size;     /* GART size. */
     uint32_t vram_size;     /* VRAM size. */
-    boolean drm_2_1_0;      /* Square tiling support. */
-    /* DRM 2.3.0 (R500 VAP regs, MSPOS regs, fixed tex3D size checking) */
-    boolean drm_2_3_0;
-    /* DRM 2.6.0 (Hyper-Z, GB_Z_PEQ_CONFIG allowed on rv350->r4xx, FG_ALPHA_VALUE) */
-    boolean drm_2_6_0;
-    /* DRM 2.8.0 (US_FORMAT regs, ARGB2101010 colorbuffer) */
-    boolean drm_2_8_0;
+
+    unsigned drm_major;
+    unsigned drm_minor;
+    unsigned drm_patchlevel;
 
     /* Hyper-Z user */
     boolean hyperz;