diff options
author | Adam Jackson <ajax@redhat.com> | 2009-04-14 17:56:29 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2009-04-14 17:56:29 -0400 |
commit | a3c3c1f1437de0186d70de9017a6a8e404ecf482 (patch) | |
tree | ba37eb27a6eeb02229547598f19f680f6d473f1c /src/glx/x11 | |
parent | 71793e0f7907421d5bee619ae524e5178c6f3f32 (diff) |
glx: Make glXGetScreenDriver() work for DRI2
Diffstat (limited to 'src/glx/x11')
-rw-r--r-- | src/glx/x11/dri_glx.c | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/src/glx/x11/dri_glx.c b/src/glx/x11/dri_glx.c index 3089aa1728..87d62ad846 100644 --- a/src/glx/x11/dri_glx.c +++ b/src/glx/x11/dri_glx.c @@ -40,6 +40,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "glxclient.h" #include "glcontextmodes.h" #include "xf86dri.h" +#include "dri2.h" #include "sarea.h" #include <dlfcn.h> #include <sys/types.h> @@ -75,32 +76,45 @@ struct __GLXDRIcontextPrivateRec { */ static Bool driGetDriverName(Display *dpy, int scrNum, char **driverName) { - int directCapable; - Bool b; - int driverMajor, driverMinor, driverPatch; + int directCapable; + Bool b; + int event, error; + int driverMajor, driverMinor, driverPatch; - *driverName = NULL; + *driverName = NULL; - if (!XF86DRIQueryDirectRenderingCapable(dpy, scrNum, &directCapable)) { - ErrorMessageF("XF86DRIQueryDirectRenderingCapable failed\n"); - return False; - } - if (!directCapable) { - ErrorMessageF("XF86DRIQueryDirectRenderingCapable returned false\n"); - return False; - } + if (XF86DRIQueryExtension(dpy, &event, &error)) { /* DRI1 */ + if (!XF86DRIQueryDirectRenderingCapable(dpy, scrNum, &directCapable)) { + ErrorMessageF("XF86DRIQueryDirectRenderingCapable failed\n"); + return False; + } + if (!directCapable) { + ErrorMessageF("XF86DRIQueryDirectRenderingCapable returned false\n"); + return False; + } - b = XF86DRIGetClientDriverName(dpy, scrNum, &driverMajor, &driverMinor, - &driverPatch, driverName); - if (!b) { - ErrorMessageF("Cannot determine driver name for screen %d\n", scrNum); - return False; - } + b = XF86DRIGetClientDriverName(dpy, scrNum, &driverMajor, &driverMinor, + &driverPatch, driverName); + if (!b) { + ErrorMessageF("Cannot determine driver name for screen %d\n", scrNum); + return False; + } + + InfoMessageF("XF86DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n", + driverMajor, driverMinor, driverPatch, *driverName, scrNum); + + return True; + } else if (DRI2QueryExtension(dpy, &event, &error)) { /* DRI2 */ + char *dev; + Bool ret = DRI2Connect(dpy, RootWindow(dpy, scrNum), driverName, &dev); - InfoMessageF("XF86DRIGetClientDriverName: %d.%d.%d %s (screen %d)\n", - driverMajor, driverMinor, driverPatch, *driverName, scrNum); + if (ret) + Xfree(dev); + + return ret; + } - return True; + return False; } /* |