@@ -234,7 +234,7 @@ x11_screen_probe_dri2(struct x11_screen *xscr, int *major, int *minor)
/* get the driver name and the device name */
if (!xscr->dri_driver) {
if (!DRI2Connect(xscr->dpy, RootWindow(xscr->dpy, xscr->number),
- &xscr->dri_driver, &xscr->dri_device))
+ &xscr->dri_driver, &xscr->dri_device, NULL))
xscr->dri_driver = xscr->dri_device = NULL;
}
if (major)
@@ -264,7 +264,8 @@ DRI2QueryVersion(Display * dpy, int *major, int *minor)
}
Bool
-DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName)
+DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName,
+ unsigned char *deviceRequiresAuth)
{
XExtDisplayInfo *info = DRI2FindDisplay(dpy);
xDRI2ConnectReply rep;
@@ -327,6 +328,9 @@ DRI2Connect(Display * dpy, XID window, char **driverName, char **deviceName)
}
_XReadPad(dpy, *deviceName, rep.deviceNameLength);
(*deviceName)[rep.deviceNameLength] = '\0';
+
+ if (deviceRequiresAuth)
+ *deviceRequiresAuth = rep.deviceRequiresAuth;
UnlockDisplay(dpy);
SyncHandle();
@@ -53,7 +53,8 @@ DRI2QueryVersion(Display * display, int *major, int *minor);
extern Bool
DRI2Connect(Display * display, XID window,
- char **driverName, char **deviceName);
+ char **driverName, char **deviceName,
+ unsigned char *deviceRequiresAuth);
extern Bool
DRI2Authenticate(Display * display, XID window, drm_magic_t magic);
@@ -1119,6 +1119,7 @@ dri2CreateScreen(int screen, struct glx_display * priv)
__GLXDRIscreen *psp;
struct glx_config *configs = NULL, *visuals = NULL;
char *driverName, *deviceName, *tmp;
+ unsigned char deviceRequiresAuth;
drm_magic_t magic;
int i;
@@ -1134,7 +1135,7 @@ dri2CreateScreen(int screen, struct glx_display * priv)
}
if (!DRI2Connect(priv->dpy, RootWindow(priv->dpy, screen),
- &driverName, &deviceName)) {
+ &driverName, &deviceName, &deviceRequiresAuth)) {
glx_screen_cleanup(&psc->base);
free(psc);
InfoMessageF("screen %d does not appear to be DRI2 capable\n", screen);
@@ -1179,16 +1180,17 @@ dri2CreateScreen(int screen, struct glx_display * priv)
goto handle_error;
}
- if (drmGetMagic(psc->fd, &magic)) {
- ErrorMessageF("failed to get magic\n");
- goto handle_error;
- }
+ if (deviceRequiresAuth) {
+ if (drmGetMagic(psc->fd, &magic)) {
+ ErrorMessageF("failed to get magic\n");
+ goto handle_error;
+ }
- if (!DRI2Authenticate(priv->dpy, RootWindow(priv->dpy, screen), magic)) {
- ErrorMessageF("failed to authenticate magic %d\n", magic);
- goto handle_error;
+ if (!DRI2Authenticate(priv->dpy, RootWindow(priv->dpy, screen), magic)) {
+ ErrorMessageF("failed to authenticate magic %d\n", magic);
+ goto handle_error;
+ }
}
-
/* If the server does not support the protocol for
* DRI2GetBuffersWithFormat, don't supply that interface to the driver.
@@ -133,7 +133,8 @@ driGetDriverName(Display * dpy, int scrNum, char **driverName)
}
else if (DRI2QueryExtension(dpy, &event, &error)) { /* DRI2 */
char *dev;
- Bool ret = DRI2Connect(dpy, RootWindow(dpy, scrNum), driverName, &dev);
+ Bool ret = DRI2Connect(dpy, RootWindow(dpy, scrNum), driverName, &dev,
+ NULL);
if (ret)
free(dev);