glx: Make glXGetScreenDriver() work for DRI2

This commit is contained in:
Adam Jackson 2009-04-14 17:56:29 -04:00
parent 71793e0f79
commit a3c3c1f143
1 changed files with 35 additions and 21 deletions

View File

@ -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>
@ -77,10 +78,12 @@ static Bool driGetDriverName(Display *dpy, int scrNum, char **driverName)
{
int directCapable;
Bool b;
int event, error;
int driverMajor, driverMinor, driverPatch;
*driverName = NULL;
if (XF86DRIQueryExtension(dpy, &event, &error)) { /* DRI1 */
if (!XF86DRIQueryDirectRenderingCapable(dpy, scrNum, &directCapable)) {
ErrorMessageF("XF86DRIQueryDirectRenderingCapable failed\n");
return False;
@ -101,6 +104,17 @@ static Bool driGetDriverName(Display *dpy, int scrNum, char **driverName)
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);
if (ret)
Xfree(dev);
return ret;
}
return False;
}
/*