From 60f53e3012be795eee741ecd4be858552c5e86c8 Mon Sep 17 00:00:00 2001 From: Tomas Carnecky Date: Tue, 10 Jul 2012 02:03:11 +0100 Subject: [PATCH] DGA: Remove excessive module-induced indirection The DGA event base used to have to be passed through a function pointer, as the code was cleaved in two with half in a module, and half in the core server. Now that's not the case, just access DGAEventBase directly. v2: Deal with Alan's event initialization cleanups Signed-off-by: Tomas Carnecky Reviewed-by: Daniel Stone Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer Signed-off-by: Keith Packard --- hw/xfree86/common/dgaproc.h | 5 ----- hw/xfree86/common/xf86DGA.c | 22 +++++++--------------- hw/xfree86/common/xf86Extensions.c | 2 +- 3 files changed, 8 insertions(+), 21 deletions(-) diff --git a/hw/xfree86/common/dgaproc.h b/hw/xfree86/common/dgaproc.h index 2c2fae097..e824d3094 100644 --- a/hw/xfree86/common/dgaproc.h +++ b/hw/xfree86/common/dgaproc.h @@ -107,9 +107,4 @@ extern _X_EXPORT Bool DGAChangePixmapMode(int Index, int *x, int *y, int mode); extern _X_EXPORT int DGACreateColormap(int Index, ClientPtr client, int id, int mode, int alloc); -extern _X_EXPORT unsigned char DGAReqCode; -extern _X_EXPORT int DGAErrorBase; -extern _X_EXPORT int DGAEventBase; -extern _X_EXPORT int *XDGAEventBase; - #endif /* __DGAPROC_H */ diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index 00b90226b..a441dee99 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -93,7 +93,9 @@ static void DGAHandleEvent(int screen_num, InternalEvent *event, static void DGACopyModeInfo(DGAModePtr mode, XDGAModePtr xmode); -int *XDGAEventBase = NULL; +static unsigned char DGAReqCode = 0; +static int DGAErrorBase; +static int DGAEventBase; #define DGA_GET_SCREEN_PRIV(pScreen) ((DGAScreenPtr) \ dixLookupPrivate(&(pScreen)->devPrivates, &DGAScreenKeyRec)) @@ -1042,7 +1044,7 @@ DGAProcessKeyboardEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr keybd) .u.event.screen = pScreen->myNum, .u.event.state = ev.corestate }; - de.u.u.type = *XDGAEventBase + GetCoreType(ev.type); + de.u.u.type = DGAEventBase + GetCoreType(ev.type); de.u.u.detail = event->detail; /* If the DGA client has selected input, then deliver based on the usual filter */ @@ -1093,7 +1095,7 @@ DGAProcessPointerEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr mouse) .u.event.screen = pScreen->myNum, .u.event.state = ev.corestate }; - de.u.u.type = *XDGAEventBase + coreEquiv; + de.u.u.type = DGAEventBase + coreEquiv; de.u.u.detail = event->detail; /* If the DGA client has selected input, then deliver based on the usual filter */ @@ -1180,8 +1182,8 @@ DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device) DGAScreenPtr pScreenPriv; /* no DGA */ - if (!DGAScreenKeyRegistered || XDGAEventBase == 0) - return; + if (!DGAScreenKeyRegistered || noXFree86DGAExtension) + return; pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); /* DGA not initialized on this screen */ @@ -1210,10 +1212,6 @@ static void XDGAResetProc(ExtensionEntry * extEntry); static void DGAClientStateChange(CallbackListPtr *, pointer, pointer); -unsigned char DGAReqCode = 0; -int DGAErrorBase; -int DGAEventBase; - static DevPrivateKeyRec DGAScreenPrivateKeyRec; #define DGAScreenPrivateKey (&DGAScreenPrivateKeyRec) @@ -2169,12 +2167,6 @@ ProcXDGADispatch(ClientPtr client) } } -void -XFree86DGARegister(void) -{ - XDGAEventBase = &DGAEventBase; -} - void XFree86DGAExtensionInit(void) { diff --git a/hw/xfree86/common/xf86Extensions.c b/hw/xfree86/common/xf86Extensions.c index 7a84988d7..5ee6be88f 100644 --- a/hw/xfree86/common/xf86Extensions.c +++ b/hw/xfree86/common/xf86Extensions.c @@ -54,7 +54,7 @@ static ExtensionModule extensionModules[] = { XFree86DGAExtensionInit, XF86DGANAME, &noXFree86DGAExtension, - XFree86DGARegister, + NULL, NULL }, #endif