[PATCH 17/37] DGA: Remove excessive module-induced indirection

Daniel Stone daniel at fooishbar.org
Tue Jun 28 12:27:33 PDT 2011


From: Tomas Carnecky <tom at dbservice.com>

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.

Signed-off-by: Tomas Carnecky <tom at dbservice.com>
Reviewed-by: Daniel Stone <daniel at fooishbar.org>
---
 hw/xfree86/common/dgaproc.h        |    1 -
 hw/xfree86/common/xf86DGA.c        |   20 ++++++--------------
 hw/xfree86/common/xf86Extensions.c |    2 +-
 3 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/hw/xfree86/common/dgaproc.h b/hw/xfree86/common/dgaproc.h
index a13a517..111d46b 100644
--- a/hw/xfree86/common/dgaproc.h
+++ b/hw/xfree86/common/dgaproc.h
@@ -135,7 +135,6 @@ extern _X_EXPORT int DGACreateColormap(int Index, ClientPtr client, int id, int
 extern _X_EXPORT unsigned char DGAReqCode;
 extern _X_EXPORT int DGAErrorBase;
 extern _X_EXPORT int DGAEventBase;
-extern _X_EXPORT int *XDGAEventBase;
 
 
 
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 0e3f53d..c42854b 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -96,7 +96,9 @@ DGACopyModeInfo(
    XDGAModePtr xmode
 );
 
-int *XDGAEventBase = NULL;
+unsigned char DGAReqCode = 0;
+int DGAErrorBase;
+int DGAEventBase;
 
 #define DGA_GET_SCREEN_PRIV(pScreen) ((DGAScreenPtr) \
     dixLookupPrivate(&(pScreen)->devPrivates, &DGAScreenKeyRec))
@@ -1065,7 +1067,7 @@ DGAProcessKeyboardEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr keybd)
     if (pScreenPriv->client)
     {
         dgaEvent de;
-        de.u.u.type = *XDGAEventBase + GetCoreType((InternalEvent*)&ev);
+        de.u.u.type = DGAEventBase + GetCoreType((InternalEvent*)&ev);
         de.u.u.detail = event->detail;
         de.u.event.time = event->time;
         de.u.event.dx = event->dx;
@@ -1121,7 +1123,7 @@ DGAProcessPointerEvent (ScreenPtr pScreen, DGAEvent *event, DeviceIntPtr mouse)
 
         coreEquiv = GetCoreType((InternalEvent*)&ev);
 
-        de.u.u.type = *XDGAEventBase + coreEquiv;
+        de.u.u.type = DGAEventBase + coreEquiv;
         de.u.u.detail = event->detail;
         de.u.event.time = event->time;
         de.u.event.dx = event->dx;
@@ -1218,7 +1220,7 @@ DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device)
     DGAScreenPtr    pScreenPriv;
 
     /* no DGA */
-    if (!DGAScreenKeyRegistered || XDGAEventBase == 0)
+    if (!DGAScreenKeyRegistered || noDGAExtension)
 	return;
     pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
 
@@ -1250,10 +1252,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)
 #define DGAScreenPrivateKeyRegistered (DGAScreenPrivateKeyRec.initialized)
@@ -2213,12 +2211,6 @@ ProcXDGADispatch (ClientPtr client)
 }
 
 void
-XFree86DGARegister(void)
-{
-  XDGAEventBase = &DGAEventBase;
-}
-
-void
 XFree86DGAExtensionInit(void)
 {
     ExtensionEntry* extEntry;
diff --git a/hw/xfree86/common/xf86Extensions.c b/hw/xfree86/common/xf86Extensions.c
index 12a8542..35dd841 100644
--- a/hw/xfree86/common/xf86Extensions.c
+++ b/hw/xfree86/common/xf86Extensions.c
@@ -44,7 +44,7 @@ static ExtensionModule extensionModules[] = {
 	XFree86DGAExtensionInit,
 	XF86DGANAME,
 	&noXFree86DGAExtension,
-	XFree86DGARegister,
+	NULL,
 	NULL
     },
 #endif
-- 
1.7.5.4



More information about the xorg-devel mailing list