[PATCH] dri2: add support for render nodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Martin Peres <martin.peres@xxxxxxxx>

Signed-off-by: Martin Peres <martin.peres@xxxxxxxx>
---
 src/gallium/state_trackers/egl/x11/x11_screen.c |  2 +-
 src/glx/dri2.c                                  |  6 +++++-
 src/glx/dri2.h                                  |  3 ++-
 src/glx/dri2_glx.c                              | 20 +++++++++++---------
 src/glx/dri_glx.c                               |  3 ++-
 5 files changed, 21 insertions(+), 13 deletions(-)

diff --git a/src/gallium/state_trackers/egl/x11/x11_screen.c b/src/gallium/state_trackers/egl/x11/x11_screen.c
index effac0e..f648e91 100644
--- a/src/gallium/state_trackers/egl/x11/x11_screen.c
+++ b/src/gallium/state_trackers/egl/x11/x11_screen.c
@@ -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)
diff --git a/src/glx/dri2.c b/src/glx/dri2.c
index bcd1f9c..1c2c91f 100644
--- a/src/glx/dri2.c
+++ b/src/glx/dri2.c
@@ -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();
diff --git a/src/glx/dri2.h b/src/glx/dri2.h
index a6fe66e..798cba1 100644
--- a/src/glx/dri2.h
+++ b/src/glx/dri2.h
@@ -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);
diff --git a/src/glx/dri2_glx.c b/src/glx/dri2_glx.c
index 1b3cf2b..e6354ef 100644
--- a/src/glx/dri2_glx.c
+++ b/src/glx/dri2_glx.c
@@ -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.
diff --git a/src/glx/dri_glx.c b/src/glx/dri_glx.c
index ba8fda2..2a03c57 100644
--- a/src/glx/dri_glx.c
+++ b/src/glx/dri_glx.c
@@ -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);
-- 
1.8.0.1

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux