Mesa (master): radeong: Change ioctl order, document it.

Corbin Simpson csimpson at kemper.freedesktop.org
Wed Dec 2 21:11:13 UTC 2009


Module: Mesa
Branch: master
Commit: dad193d516422a9e330e58148822735b0decb8da
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=dad193d516422a9e330e58148822735b0decb8da

Author: Corbin Simpson <MostAwesomeDude at gmail.com>
Date:   Wed Dec  2 11:34:00 2009 -0800

radeong: Change ioctl order, document it.

---

 src/gallium/winsys/drm/radeon/core/radeon_r300.c |   34 ++++++++++++++--------
 1 files changed, 22 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 7ea5d1f..d3e468a 100644
--- a/src/gallium/winsys/drm/radeon/core/radeon_r300.c
+++ b/src/gallium/winsys/drm/radeon/core/radeon_r300.c
@@ -154,37 +154,47 @@ static void do_ioctls(struct r300_winsys* winsys, int fd)
 
     info.value = (unsigned long)⌖
 
-    /* First, get the number of pixel pipes */
-    info.request = RADEON_INFO_NUM_GB_PIPES;
+    /* We do things in a specific order here.
+     *
+     * First, 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.
+     *
+     * The GB and Z pipe requests should always succeed, but they might not
+     * return sensical values for all chipsets, but that's alright because
+     * the pipe drivers already know that.
+     *
+     * The GEM info is actually bogus on the kernel side, as well as our side
+     * (see radeon_gem_info_ioctl in radeon_gem.c) but that's alright because
+     * we don't actually use the info for anything yet.
+     * XXX update the above when we can safely use vram_size instead of vram_visible */
+    info.request = RADEON_INFO_DEVICE_ID;
     retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
     if (retval) {
-        fprintf(stderr, "%s: Failed to get GB pipe count, "
+        fprintf(stderr, "%s: Failed to get PCI ID, "
                 "error number %d\n", __FUNCTION__, retval);
         exit(1);
     }
-    winsys->gb_pipes = target;
+    winsys->pci_id = target;
 
-    /* get Z pipes */
-    info.request = RADEON_INFO_NUM_Z_PIPES;
+    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", __FUNCTION__, retval);
         exit(1);
     }
-    winsys->z_pipes = target;
+    winsys->gb_pipes = target;
 
-    /* Then, get PCI ID */
-    info.request = RADEON_INFO_DEVICE_ID;
+    info.request = RADEON_INFO_NUM_Z_PIPES;
     retval = drmCommandWriteRead(fd, DRM_RADEON_INFO, &info, sizeof(info));
     if (retval) {
-        fprintf(stderr, "%s: Failed to get PCI ID, "
+        fprintf(stderr, "%s: Failed to get Z pipe count, "
                 "error number %d\n", __FUNCTION__, retval);
         exit(1);
     }
-    winsys->pci_id = target;
+    winsys->z_pipes = target;
 
-    /* Finally, retrieve MM info */
     retval = drmCommandWriteRead(fd, DRM_RADEON_GEM_INFO,
             &gem_info, sizeof(gem_info));
     if (retval) {




More information about the mesa-commit mailing list