summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Vignatti <tiago.vignatti@nokia.com>2010-01-22 17:58:17 +0200
committerTiago Vignatti <tiago.vignatti@nokia.com>2010-06-03 11:55:05 +0300
commitcdcb575664d3d60b662c542e782de83a047165c9 (patch)
tree63c3d767398becb01cdc18875bb6d82ff610ca18
parent643cb6e87c10ab554c03ada81930001a8ebcc909 (diff)
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>
-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 29c917f21..03255a25d 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -94,6 +94,7 @@ typedef struct _DRI2Screen {
94 DRI2ScheduleSwapProcPtr ScheduleSwap; 94 DRI2ScheduleSwapProcPtr ScheduleSwap;
95 DRI2GetMSCProcPtr GetMSC; 95 DRI2GetMSCProcPtr GetMSC;
96 DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC; 96 DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
97 DRI2AuthMagicProcPtr AuthMagic;
97 98
98 HandleExposuresProcPtr HandleExposures; 99 HandleExposuresProcPtr HandleExposures;
99 100
@@ -968,8 +969,8 @@ DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic)
968{ 969{
969 DRI2ScreenPtr ds = DRI2GetScreen(pScreen); 970 DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
970 971
971 if (ds == NULL || drmAuthMagic(ds->fd, magic)) 972 if (ds == NULL || (*ds->AuthMagic)(ds->fd, magic))
972 return FALSE; 973 return FALSE;
973 974
974 return TRUE; 975 return TRUE;
975} 976}
@@ -1040,6 +1041,14 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
1040 cur_minor = 1; 1041 cur_minor = 1;
1041 } 1042 }
1042 1043
1044 if (info->version >= 5) {
1045 ds->AuthMagic = info->AuthMagic;
1046 }
1047
1048 if (!ds->AuthMagic)
1049 ds->AuthMagic = drmAuthMagic;
1050
1051
1043 /* Initialize minor if needed and set to minimum provied by DDX */ 1052 /* Initialize minor if needed and set to minimum provied by DDX */
1044 if (!dri2_minor || dri2_minor > cur_minor) 1053 if (!dri2_minor || dri2_minor > cur_minor)
1045 dri2_minor = cur_minor; 1054 dri2_minor = cur_minor;
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index be44bdd75..29b1d9b2e 100644
--- a/hw/xfree86/dri2/dri2.h
+++ b/hw/xfree86/dri2/dri2.h
@@ -66,6 +66,8 @@ typedef void (*DRI2CopyRegionProcPtr)(DrawablePtr pDraw,
66 DRI2BufferPtr pSrcBuffer); 66 DRI2BufferPtr pSrcBuffer);
67typedef void (*DRI2WaitProcPtr)(WindowPtr pWin, 67typedef void (*DRI2WaitProcPtr)(WindowPtr pWin,
68 unsigned int sequence); 68 unsigned int sequence);
69typedef int (*DRI2AuthMagicProcPtr)(int fd, uint32_t magic);
70
69/** 71/**
70 * Schedule a buffer swap 72 * Schedule a buffer swap
71 * 73 *
@@ -159,7 +161,7 @@ typedef void (*DRI2InvalidateProcPtr)(DrawablePtr pDraw,
159/** 161/**
160 * Version of the DRI2InfoRec structure defined in this header 162 * Version of the DRI2InfoRec structure defined in this header
161 */ 163 */
162#define DRI2INFOREC_VERSION 4 164#define DRI2INFOREC_VERSION 5
163 165
164typedef struct { 166typedef struct {
165 unsigned int version; /**< Version of this struct */ 167 unsigned int version; /**< Version of this struct */
@@ -183,6 +185,10 @@ typedef struct {
183 /* array of driver names, indexed by DRI2Driver* driver types */ 185 /* array of driver names, indexed by DRI2Driver* driver types */
184 /* a name of NULL means that driver is not supported */ 186 /* a name of NULL means that driver is not supported */
185 const char * const *driverNames; 187 const char * const *driverNames;
188
189 /* added in version 5 */
190
191 DRI2AuthMagicProcPtr AuthMagic;
186} DRI2InfoRec, *DRI2InfoPtr; 192} DRI2InfoRec, *DRI2InfoPtr;
187 193
188extern _X_EXPORT int DRI2EventBase; 194extern _X_EXPORT int DRI2EventBase;