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>
This commit is contained in:
Tiago Vignatti 2010-01-22 17:58:17 +02:00
parent 643cb6e87c
commit cdcb575664
2 changed files with 18 additions and 3 deletions

View File

@ -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;

View File

@ -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;