summaryrefslogtreecommitdiffstats
path: root/src/gallium/winsys
diff options
context:
space:
mode:
authorCorbin Simpson <[email protected]>2010-01-18 00:35:11 -0800
committerCorbin Simpson <[email protected]>2010-01-18 01:13:33 -0800
commit58a7d8db98e5ffd0699d4cb59663d7621bc20594 (patch)
treeff622c58e79310843735b735d7e22440290e33df /src/gallium/winsys
parent11a2bbc3e96a5d72cc1473362c771ddebe0f9b8d (diff)
radeong: Check DRM version, and report stats.
Diffstat (limited to 'src/gallium/winsys')
-rw-r--r--src/gallium/winsys/drm/radeon/core/radeon_drm.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_drm.c b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
index 017d1bea1a9..572c5df458e 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_drm.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_drm.c
@@ -40,12 +40,16 @@ static void do_ioctls(int fd, struct radeon_winsys* winsys)
struct drm_radeon_info info = {0};
int target = 0;
int retval;
+ drmVersionPtr version;
info.value = (unsigned long)&target;
/* We do things in a specific order here.
*
- * First, the PCI ID. This is essential and should return usable numbers
+ * DRM version first. We need to be sure we're running on a KMS chipset.
+ * This is also for some features.
+ *
+ * Then, the PCI ID. This is essential and should return usable numbers
* for all Radeons. If this fails, we probably got handed an FD for some
* non-Radeon card.
*
@@ -57,6 +61,16 @@ static void do_ioctls(int fd, struct radeon_winsys* winsys)
* (see radeon_gem_info_ioctl in radeon_gem.c) but that's alright because
* we don't actually use the info for anything yet. */
+ version = drmGetVersion(fd);
+ if (version->version_major != 2) {
+ fprintf(stderr, "%s: DRM version is %d.%d.%d but this driver is "
+ "only compatible with 2.x.x\n", __FUNCTION__,
+ version->version_major, version->version_minor,
+ version->version_patchlevel);
+ drmFreeVersion(version);
+ exit(1);
+ }
+
info.request = RADEON_INFO_DEVICE_ID;
retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
if (retval) {
@@ -93,6 +107,17 @@ static void do_ioctls(int fd, struct radeon_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",
+ 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);
+
+ drmFreeVersion(version);
}
/* Guess at whether this chipset should use r300g.