[PATCH v2 2/3] xfree86: dri2: add AuthMagic hook for driver side support
Tiago Vignatti
tiago.vignatti at nokia.com
Sat Feb 6 04:24:04 PST 2010
if the driver doesn't provide an AuthMagic function or the info struct version
is too low it relies on the old method, using libdrm. You might want to
implement AuthMagic on driver side instead.
Attention: ABI break.
Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
changes from v1:
- didn't bump DRI2INFOREC_VERSION, given there was no release since version 4
of it (pointed by Aaron)
- used a simplified scheme to decides for AuthMagic function (pointed by
Kristian).
hw/xfree86/dri2/dri2.c | 7 ++++++-
hw/xfree86/dri2/dri2.h | 3 +++
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c
index cd69ca0..cc09789 100644
--- a/hw/xfree86/dri2/dri2.c
+++ b/hw/xfree86/dri2/dri2.c
@@ -82,6 +82,7 @@ typedef struct _DRI2Screen {
DRI2ScheduleSwapProcPtr ScheduleSwap;
DRI2GetMSCProcPtr GetMSC;
DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
+ DRI2AuthMagicProcPtr AuthMagic;
HandleExposuresProcPtr HandleExposures;
} DRI2ScreenRec;
@@ -801,7 +802,7 @@ DRI2Authenticate(ScreenPtr pScreen, drm_magic_t magic)
{
DRI2ScreenPtr ds = DRI2GetScreen(pScreen);
- if (ds == NULL || drmAuthMagic(ds->fd, magic))
+ if (ds == NULL || (*ds->AuthMagic)(ds->fd, magic))
return FALSE;
return TRUE;
@@ -841,8 +842,12 @@ DRI2ScreenInit(ScreenPtr pScreen, DRI2InfoPtr info)
ds->ScheduleSwap = info->ScheduleSwap;
ds->ScheduleWaitMSC = info->ScheduleWaitMSC;
ds->GetMSC = info->GetMSC;
+ ds->AuthMagic = info->AuthMagic;
}
+ if (!ds->AuthMagic)
+ ds->AuthMagic = drmAuthMagic;
+
if (info->version == 3 || info->numDrivers == 0) {
/* Driver too old: use the old-style driverName field */
ds->numDrivers = 1;
diff --git a/hw/xfree86/dri2/dri2.h b/hw/xfree86/dri2/dri2.h
index 1c8626b..f770760 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
*
@@ -170,6 +172,7 @@ typedef struct {
DRI2ScheduleSwapProcPtr ScheduleSwap;
DRI2GetMSCProcPtr GetMSC;
DRI2ScheduleWaitMSCProcPtr ScheduleWaitMSC;
+ DRI2AuthMagicProcPtr AuthMagic;
/* number of drivers in the driverNames array */
unsigned int numDrivers;
--
1.6.0.4
More information about the xorg-devel
mailing list