diff options
author | Corbin Simpson <MostAwesomeDude@gmail.com> | 2009-05-11 09:04:15 -0700 |
---|---|---|
committer | Corbin Simpson <MostAwesomeDude@gmail.com> | 2009-05-11 09:05:33 -0700 |
commit | 2e22bd8460ebbb2dd85417d8e5e670fa651d0da9 (patch) | |
tree | 8a1898d0bd5863b090450c2217c4be2f8a6b75d9 | |
parent | 7c3d7353d7b46f5ce2b411f08f9e4c158f1610e0 (diff) |
radeon-gallium: Support new info ioctls in addition to classic getparams.
This makes non-hybrid kernels like newttm from drm-next-radeon work
while avoiding breakage with Fedora/Ubuntu/etc.
-rw-r--r-- | src/gallium/winsys/drm/radeon/core/radeon_r300.c | 42 | ||||
-rw-r--r-- | src/gallium/winsys/drm/radeon/core/radeon_r300.h | 11 |
2 files changed, 41 insertions, 12 deletions
diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.c b/src/gallium/winsys/drm/radeon/core/radeon_r300.c index be70ead68d..56b0d00842 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c @@ -152,44 +152,62 @@ static void radeon_r300_flush_cs(struct r300_winsys* winsys) /* Helper function to do the ioctls needed for setup and init. */ static void do_ioctls(struct r300_winsys* winsys, int fd) { - struct drm_radeon_gem_info info = {0}; + struct drm_radeon_gem_info gem_info = {0}; drm_radeon_getparam_t gp = {0}; + struct drm_radeon_info info = {0}; int target = 0; int retval; + info.value = ⌖ gp.value = ⌖ /* First, get the number of pixel pipes */ - gp.param = RADEON_PARAM_NUM_GB_PIPES; - retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp)); + info.request = RADEON_INFO_NUM_GB_PIPES; + retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); if (retval) { - fprintf(stderr, "%s: Failed to get GB pipe count, error number %d\n", + fprintf(stderr, "%s: New ioctl for GB pipe count failed " + "(error number %d), trying classic ioctl...\n", __FUNCTION__, retval); - exit(1); + gp.param = RADEON_PARAM_NUM_GB_PIPES; + retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, + sizeof(gp)); + if (retval) { + fprintf(stderr, "%s: Failed to get GB pipe count, " + "error number %d\n", __FUNCTION__, retval); + exit(1); + } } winsys->gb_pipes = target; /* Then, get PCI ID */ - gp.param = RADEON_PARAM_DEVICE_ID; - retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, sizeof(gp)); + info.request = RADEON_INFO_DEVICE_ID; + retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info)); if (retval) { - fprintf(stderr, "%s: Failed to get PCI ID, error number %d\n", + fprintf(stderr, "%s: New ioctl for PCI ID failed " + "(error number %d), trying classic ioctl...\n", __FUNCTION__, retval); - exit(1); + gp.param = RADEON_PARAM_DEVICE_ID; + retval = drmCommandWriteRead(fd, DRM_RADEON_GETPARAM, &gp, + sizeof(gp)); + if (retval) { + fprintf(stderr, "%s: Failed to get PCI ID, " + "error number %d\n", __FUNCTION__, retval); + exit(1); + } } winsys->pci_id = target; /* Finally, retrieve MM info */ retval = drmCommandWriteRead(fd, DRM_RADEON_GEM_INFO, - &info, sizeof(info)); + &gem_info, sizeof(gem_info)); if (retval) { fprintf(stderr, "%s: Failed to get MM info, error number %d\n", __FUNCTION__, retval); exit(1); } - winsys->gart_size = info.gart_size; + winsys->gart_size = gem_info.gart_size; /* XXX */ - winsys->vram_size = info.vram_visible; + winsys->vram_size = gem_info.vram_visible; } struct r300_winsys* diff --git a/src/gallium/winsys/drm/radeon/core/radeon_r300.h b/src/gallium/winsys/drm/radeon/core/radeon_r300.h index 5c373cd084..98586746cd 100644 --- a/src/gallium/winsys/drm/radeon/core/radeon_r300.h +++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.h @@ -31,5 +31,16 @@ #include "radeon_buffer.h" +/* protect us from bonghits */ +#ifndef RADEON_INFO_NUM_GB_PIPES +#define RADEON_INFO_NUM_GB_PIPES 0 +#endif +#ifndef RADEON_INFO_DEVICE_ID +#define RADEON_INFO_DEVICE_ID 0 +#endif +#ifndef DRM_RADEON_INFO +#define DRM_RADEON_INFO 0x1 +#endif + struct r300_winsys* radeon_create_r300_winsys(int fd, struct radeon_winsys* old_winsys); |