[PATCH 21/42] DGA: Remove excessive module-induced indirection

Daniel Stone daniel at fooishbar.org
Fri Dec 2 03:27:29 PST 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>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 hw/xfree86/common/dgaproc.h        |    1 -
 hw/xfree86/common/xf86DGA.c        |   20 ++++++--------------
 hw/xfree86/common/xf86DGA.h        |    2 --
 hw/xfree86/common/xf86Extensions.c |    2 +-
 4 files changed, 7 insertions(+), 18 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 997b419..4aa9423 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -95,7 +95,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))
@@ -1064,7 +1066,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;
@@ -1120,7 +1122,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;
@@ -1217,7 +1219,7 @@ DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device)
     DGAScreenPtr    pScreenPriv;
 
     /* no DGA */
-    if (!DGAScreenKeyRegistered || XDGAEventBase == 0)
+    if (!DGAScreenKeyRegistered || noXFree86DGAExtension)
 	return;
     pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
 
@@ -1249,10 +1251,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)
@@ -2212,12 +2210,6 @@ ProcXDGADispatch (ClientPtr client)
 }
 
 void
-XFree86DGARegister(void)
-{
-  XDGAEventBase = &DGAEventBase;
-}
-
-void
 XFree86DGAExtensionInit(void)
 {
     ExtensionEntry* extEntry;
diff --git a/hw/xfree86/common/xf86DGA.h b/hw/xfree86/common/xf86DGA.h
index 211b1e7..4423261 100644
--- a/hw/xfree86/common/xf86DGA.h
+++ b/hw/xfree86/common/xf86DGA.h
@@ -33,7 +33,5 @@
 
 extern void XFree86DGAExtensionInit(void);
 extern Bool noXFree86DGAExtension;
-extern void XFree86DGARegister(void);
-
 
 #endif /* XF86DGA_H */
diff --git a/hw/xfree86/common/xf86Extensions.c b/hw/xfree86/common/xf86Extensions.c
index b60d5be..23aa441 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
-- 
1.7.7.3



More information about the xorg-devel mailing list