diff mbox

dri2: add support for render nodes

Message ID 1355710158-18049-1-git-send-email-martin.peres@free.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Martin Peres Dec. 17, 2012, 2:09 a.m. UTC
From: Martin Peres <martin.peres@labri.fr>

Signed-off-by: Martin Peres <martin.peres@labri.fr>
---
 glx/glxdri2.c             |  3 ++-
 hw/xfree86/dri2/dri2.c    | 11 ++++++++++-
 hw/xfree86/dri2/dri2.h    |  8 ++++++--
 hw/xfree86/dri2/dri2ext.c |  8 ++++++--
 4 files changed, 24 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/glx/glxdri2.c b/glx/glxdri2.c
index bce1bfa..ead24bc 100644
--- a/glx/glxdri2.c
+++ b/glx/glxdri2.c
@@ -929,6 +929,7 @@  __glXDRIscreenProbe(ScreenPtr pScreen)
     __GLXDRIscreen *screen;
     size_t buffer_size;
     ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
+    unsigned char devReqAuth;
 
     screen = calloc(1, sizeof *screen);
     if (screen == NULL)
@@ -936,7 +937,7 @@  __glXDRIscreenProbe(ScreenPtr pScreen)
 
     if (!xf86LoaderCheckSymbol("DRI2Connect") ||
         !DRI2Connect(serverClient, pScreen, DRI2DriverDRI,
-                     &screen->fd, &driverName, &deviceName)) {
+                     &screen->fd, &driverName, &deviceName, &devReqAuth)) {
         LogMessage(X_INFO,
                    "AIGLX: Screen %d is not DRI2 capable\n", pScreen->myNum);
         return NULL;
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 40963c3..6238caa 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -115,6 +115,7 @@  typedef struct _DRI2Screen {
     int fd;
     unsigned int lastSequence;
     int prime_id;
+    unsigned int device_requires_auth;
 
     DRI2CreateBufferProcPtr CreateBuffer;
     DRI2DestroyBufferProcPtr DestroyBuffer;
@@ -1317,7 +1318,8 @@  DRI2HasSwapControl(ScreenPtr pScreen)
 Bool
 DRI2Connect(ClientPtr client, ScreenPtr pScreen,
             unsigned int driverType, int *fd,
-            const char **driverName, const char **deviceName)
+            const char **driverName, const char **deviceName,
+	    unsigned char *deviceRequiresAuth)
 {
     DRI2ScreenPtr ds;
     uint32_t prime_id = DRI2DriverPrimeId(driverType);
@@ -1503,6 +1505,13 @@  DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
         ds->DestroyBuffer2 = info->DestroyBuffer2;
         ds->CopyRegion2 = info->CopyRegion2;
     }
+    
+    if (info->version >= 10) {
+        ds->device_requires_auth = info->device_requires_auth;
+        xf86DrvMsg(pScreen->myNum, X_INFO,
+                   "[DRI2] The device %s authentication\n",
+		   info->device_requires_auth?"requires":"doesn't require");
+    }
 
     /*
      * if the driver doesn't provide an AuthMagic function or the info struct
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index 1e7afdd..f855565 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -205,7 +205,7 @@  typedef int (*DRI2GetParamProcPtr) (ClientPtr client,
 /**
  * Version of the DRI2InfoRec structure defined in this header
  */
-#define DRI2INFOREC_VERSION 9
+#define DRI2INFOREC_VERSION 10
 
 typedef struct {
     unsigned int version;       /**< Version of this struct */
@@ -252,6 +252,9 @@  typedef struct {
     DRI2CreateBuffer2ProcPtr CreateBuffer2;
     DRI2DestroyBuffer2ProcPtr DestroyBuffer2;
     DRI2CopyRegion2ProcPtr CopyRegion2;
+    
+     /* added in version 10 */
+     unsigned char device_requires_auth;
 } DRI2InfoRec, *DRI2InfoPtr;
 
 extern _X_EXPORT Bool DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info);
@@ -264,7 +267,8 @@  extern _X_EXPORT Bool DRI2Connect(ClientPtr client, ScreenPtr pScreen,
                                   unsigned int driverType,
                                   int *fd,
                                   const char **driverName,
-                                  const char **deviceName);
+                                  const char **deviceName,
+				  unsigned char *deviceRequiresAuth);
 
 extern _X_EXPORT Bool DRI2Authenticate(ClientPtr client, ScreenPtr pScreen, uint32_t magic);
 
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index e1decec..1a78916 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -107,12 +107,14 @@  ProcDRI2Connect(ClientPtr client)
         .sequenceNumber = client->sequence,
         .length = 0,
         .driverNameLength = 0,
-        .deviceNameLength = 0
+        .deviceNameLength = 0,
+        .deviceRequiresAuth = 1
     };
     DrawablePtr pDraw;
     int fd, status;
     const char *driverName;
     const char *deviceName;
+    unsigned char deviceRequiresAuth;
 
     REQUEST_SIZE_MATCH(xDRI2ConnectReq);
     if (!validDrawable(client, stuff->window, DixGetAttrAccess,
@@ -120,11 +122,13 @@  ProcDRI2Connect(ClientPtr client)
         return status;
 
     if (!DRI2Connect(client, pDraw->pScreen,
-                     stuff->driverType, &fd, &driverName, &deviceName))
+                     stuff->driverType, &fd, &driverName, &deviceName, 
+		     &deviceRequiresAuth))
         goto fail;
 
     rep.driverNameLength = strlen(driverName);
     rep.deviceNameLength = strlen(deviceName);
+    rep.deviceRequiresAuth = deviceRequiresAuth;
     rep.length = (rep.driverNameLength + 3) / 4 +
         (rep.deviceNameLength + 3) / 4;