summaryrefslogtreecommitdiff
authorTiago Vignatti <tiago.vignatti@nokia.com>2010-01-22 15:58:17 (GMT)
committer Tiago Vignatti <tiago.vignatti@nokia.com>2010-06-03 08:55:05 (GMT)
commitcdcb575664d3d60b662c542e782de83a047165c9 (patch) (side-by-side diff)
tree63c3d767398becb01cdc18875bb6d82ff610ca18
parent643cb6e87c10ab554c03ada81930001a8ebcc909 (diff)
downloadxserver-cdcb575664d3d60b662c542e782de83a047165c9.zip
xserver-cdcb575664d3d60b662c542e782de83a047165c9.tar.gz
DRI2: add AuthMagic hook for driver side support
With this new hook, drmAuthMagic becomes useless and should be deprecated. You might want to implement AuthMagic on driver side instead. Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com> Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--hw/xfree86/dri2/dri2.c13
-rw-r--r--hw/xfree86/dri2/dri2.h8
2 files changed, 18 insertions, 3 deletions
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index 29c917f..03255a2 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -94,6 +94,7 @@ typedef struct _DRI2Screen {
DRI2ScheduleSwapProcPtr ScheduleSwap;
DRI2GetMSCProcPtr GetMSC;
DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
+ DRI2AuthMagicProcPtr AuthMagic;
HandleExposuresProcPtr HandleExposures;
@@ -968,8 +969,8 @@ DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic)
{
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
- if (ds == NULL || drmAuthMagic(ds->fd, magic))
- return FALSE;
+ if (ds == NULL || (*ds->AuthMagic)(ds->fd, magic))
+ return FALSE;
return TRUE;
}
@@ -1040,6 +1041,14 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
cur_minor = 1;
}
+ if (info->version >= 5) {
+ ds->AuthMagic = info->AuthMagic;
+ }
+
+ if (!ds->AuthMagic)
+ ds->AuthMagic = drmAuthMagic;
+
+
/* Initialize minor if needed and set to minimum provied by DDX */
if (!dri2_minor || dri2_minor > cur_minor)
dri2_minor = cur_minor;
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index be44bdd..29b1d9b 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -66,6 +66,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
*
@@ -159,7 +161,7 @@ typedef void (*DRI2InvalidateProcPtr)(DrawablePtr pDraw,
/**
* 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 */
@@ -183,6 +185,10 @@ typedef struct {
/* array of driver names, indexed by DRI2Driver* driver types */
/* a name of NULL means that driver is not supported */
const char * const *driverNames;
+
+ /* added in version 5 */
+
+ DRI2AuthMagicProcPtr AuthMagic;
} DRI2InfoRec, *DRI2InfoPtr;
extern _X_EXPORT int DRI2EventBase;