[PATCH 27/54] DGA: Remove excessive module-induced indirection

Daniel Stone daniel at fooishbar.org
Mon Jul 9 18:03:11 PDT 2012


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        |    5 -----
 hw/xfree86/common/xf86DGA.c        |   23 +++++++----------------
 hw/xfree86/common/xf86Extensions.c |    2 +-
 3 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/hw/xfree86/common/dgaproc.h b/hw/xfree86/common/dgaproc.h
index 2c2fae0..e824d30 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 0329d54..5a6fd60 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))
@@ -1034,8 +1036,7 @@ DGAProcessKeyboardEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr keybd)
      */
     if (pScreenPriv->client) {
         dgaEvent de;
-
-        de.u.u.type = *XDGAEventBase + GetCoreType(ev.type);
+        de.u.u.type = DGAEventBase + GetCoreType(ev.type);
         de.u.u.detail = event->detail;
         de.u.event.time = event->time;
         de.u.event.dx = event->dx;
@@ -1088,7 +1089,7 @@ DGAProcessPointerEvent(ScreenPtr pScreen, DGAEvent * event, DeviceIntPtr mouse)
 
         coreEquiv = GetCoreType(ev.type);
 
-        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;
@@ -1180,8 +1181,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 +1211,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)
@@ -2170,12 +2167,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 7a84988..5ee6be8 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.10.4



More information about the xorg-devel mailing list