[PATCH] xfree: dri2: add AuthMagic hook for driver side support

Tiago Vignatti tiago.vignatti at nokia.com
Fri Jan 22 09:04:26 PST 2010


With this new hook drmAuthMagic becomes useless and should be deprecated.
You might want to implement AuthMagic on driver side instead.

Attention: ABI being break.

Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
 hw/xfree86/dri2/dri2.c |   13 +++++++++++--
 hw/xfree86/dri2/dri2.h |    5 ++++-
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 3db826e..9505401 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -81,6 +81,7 @@ typedef struct _DRI2Screen {
     DRI2ScheduleSwapProcPtr	 ScheduleSwap;
     DRI2GetMSCProcPtr		 GetMSC;
     DRI2ScheduleWaitMSCProcPtr	 ScheduleWaitMSC;
+    DRI2AuthMagicProcPtr	 AuthMagic;
 
     HandleExposuresProcPtr       HandleExposures;
 } DRI2ScreenRec;
@@ -790,8 +791,15 @@ DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic)
 {
     DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
 
-    if (ds == NULL || drmAuthMagic(ds->fd, magic))
-	return FALSE;
+    if (ds == NULL)
+    return FALSE;
+
+    if (ds->AuthMagic) {
+        if ((*ds->AuthMagic)(ds->fd, magic))
+            return FALSE;
+    }
+    else if (drmAuthMagic(ds->fd, magic))
+        return FALSE;
 
     return TRUE;
 }
@@ -821,6 +829,7 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
     ds->CreateBuffer   = info->CreateBuffer;
     ds->DestroyBuffer  = info->DestroyBuffer;
     ds->CopyRegion     = info->CopyRegion;
+    ds->AuthMagic      = info->AuthMagic;
 
     if (info->version >= 4) {
 	ds->ScheduleSwap = info->ScheduleSwap;
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index dd59297..0bec2c8 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -63,6 +63,8 @@ typedef void		(*DRI2CopyRegionProcPtr)(DrawablePtr pDraw,
 						 DRI2BufferPtr pSrcBuffer);
 typedef void		(*DRI2WaitProcPtr)(WindowPtr pWin,
 					   unsigned int sequence);
+typedef int			(*DRI2AuthMagicProcPtr)(int fd, uint32_t magic);
+
 /**
  * Schedule a buffer swap
  *
@@ -152,7 +154,7 @@ typedef int		(*DRI2ScheduleWaitMSCProcPtr)(ClientPtr client,
 /**
  * Version of the DRI2InfoRec structure defined in this header
  */
-#define DRI2INFOREC_VERSION 4
+#define DRI2INFOREC_VERSION 5
 
 typedef struct {
     unsigned int version;	/**< Version of this struct */
@@ -167,6 +169,7 @@ typedef struct {
     DRI2ScheduleSwapProcPtr	ScheduleSwap;
     DRI2GetMSCProcPtr		GetMSC;
     DRI2ScheduleWaitMSCProcPtr	ScheduleWaitMSC;
+    DRI2AuthMagicProcPtr		AuthMagic;
 }  DRI2InfoRec, *DRI2InfoPtr;
 
 extern _X_EXPORT int DRI2EventBase;
-- 
1.6.0.4



More information about the xorg-devel mailing list