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 552df2b4769c79ad80846938e71751d58681b512..c8966ee59a5447d4f6cd211afdce79c559dd9d6b 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 d6aa90bd0530d38190806acff463694732e174fa..c6b4804cd8d6a3a99001075923b8e45b179171c3 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 752f53b7579842a43faeca29c43848e4c2843176..973b7926fd1f7f14d58931c1d283e1b7326a4f50 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 05b572822548095de018c7bd320c919d29e887dc..2e8ccdde544cded8e8c296b0ce2ee171cb726eac 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 ba548c4db5be37c1fc9d1925c4dc27354dc35a73..2ecf1bb014c0445e33e83ef584ebbf9332b6664c 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 91746bae8a9d9022c945360c371b5617d1a40dc0..aebe6a6079140f5251659c19a83a7393e6dd63e2 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 59e12ff6e6de89f2c11f541b9b47f592bb8e3a88..743c4fbc4a9b7100792fb29ee531afec4aaab12a 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;