[PATCH 4/8] Make the DGA and XF86VidMode extensions builtin

Tomas Carnecky tom at dbservice.com
Mon Aug 23 15:06:22 PDT 2010


Besides the ExtensionModule definition there are a few supporting files
in hw/xfree86/dixmods/extmod. Fortunately they do not require any special
treatment other than adjusting CFLAGS and include paths in Xext/Makefile.am.
However, one must take care to only build these extensions into
libXextbuiltin.la and leave them out of libXext.la. These extensions
require special support in the DDX which at this point is only provided by
Xorg.

The DGA extension again used a setupProc to initialize a pointer. The setup
proc can be removed because the DDX has direct access to the data the
setup proc was initializing (DGAEventBase).

Signed-off-by: Tomas Carnecky <tom at dbservice.com>
---
 Xext/Makefile.am                                 |   31 +++++++++++++++++----
 {hw/xfree86/dixmods/extmod => Xext}/dgaproc.h    |    1 -
 {hw/xfree86/dixmods/extmod => Xext}/xf86dga2.c   |    8 +-----
 {hw/xfree86/dixmods/extmod => Xext}/xf86dgaext.h |    0
 {hw/xfree86/dixmods/extmod => Xext}/xf86vmode.c  |    0
 hw/xfree86/common/xf86DGA.c                      |   14 ++++-----
 hw/xfree86/dixmods/extmod/Makefile.am            |   13 +--------
 hw/xfree86/dixmods/extmod/modinit.c              |   18 ------------
 mi/miinitext.c                                   |    7 +++++
 9 files changed, 40 insertions(+), 52 deletions(-)
 rename {hw/xfree86/dixmods/extmod => Xext}/dgaproc.h (98%)
 rename {hw/xfree86/dixmods/extmod => Xext}/xf86dga2.c (99%)
 rename {hw/xfree86/dixmods/extmod => Xext}/xf86dgaext.h (100%)
 rename {hw/xfree86/dixmods/extmod => Xext}/xf86vmode.c (100%)

diff --git a/Xext/Makefile.am b/Xext/Makefile.am
index 8f0a35f..a9dd43c 100644
--- a/Xext/Makefile.am
+++ b/Xext/Makefile.am
@@ -10,12 +10,12 @@ else
 noinst_LTLIBRARIES = libXext.la
 endif
 
-INCLUDES = -I$(top_srcdir)/hw/xfree86/dixmods/extmod
+INCLUDES = -I$(top_srcdir)/hw/xfree86/dixmods/extmod @XORG_INCS@
 
-AM_CFLAGS = $(DIX_CFLAGS)
+AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
 
 if XORG
-sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h
+sdk_HEADERS = xvdix.h xvmcext.h geext.h geint.h shmint.h dgaproc.h
 endif
 
 # Sources always included in libXextbuiltin.la & libXext.la
@@ -111,13 +111,31 @@ if DPMSExtension
 BUILTIN_SRCS += $(DPMS_SRCS)
 endif
 
+######
+# Sources *only* included in libXextbuiltin.la. These are extensions requiring
+# special support in the DDX, which at this point is only provided by Xorg
+XEXT_XORG_SRCS =
+
+# DGA extension
+DGA_SRCS = xf86dga2.c dgaproc.h xf86dgaext.h
+if DGA
+XEXT_XORG_SRCS += $(DGA_SRCS)
+endif
+
+# XF86VidMode extension
+XF86VMODE_SRCS = xf86vmode.c
+if XF86VIDMODE
+XEXT_XORG_SRCS += $(XF86VMODE_SRCS)
+endif
+
+
 # Now take all of the above, mix well, bake for 10 minutes and get libXext*.la
 
 libXext_la_SOURCES =		$(BUILTIN_SRCS) $(MODULE_SRCS)
 libXext_la_LIBADD =		$(MODULE_LIBS)
 
 if XORG
-libXextbuiltin_la_SOURCES =	$(BUILTIN_SRCS)
+libXextbuiltin_la_SOURCES =	$(XEXT_XORG_SRCS) $(BUILTIN_SRCS)
 
 libXextmodule_la_SOURCES =	$(MODULE_SRCS)
 libXextmodule_la_LIBADD =	$(MODULE_LIBS)
@@ -135,5 +153,6 @@ EXTRA_DIST = \
 	$(XINERAMA_SRCS) \
 	$(BIGFONT_SRCS) \
 	$(DPMS_SRCS) \
-        $(GE_SRCS)
-
+        $(GE_SRCS) \
+	$(DGA_SRCS) \
+	$(XF86VMODE_SRCS)
diff --git a/hw/xfree86/dixmods/extmod/dgaproc.h b/Xext/dgaproc.h
similarity index 98%
rename from hw/xfree86/dixmods/extmod/dgaproc.h
rename to Xext/dgaproc.h
index 6745a6e..734860a 100644
--- a/hw/xfree86/dixmods/extmod/dgaproc.h
+++ b/Xext/dgaproc.h
@@ -136,7 +136,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/dixmods/extmod/xf86dga2.c b/Xext/xf86dga2.c
similarity index 99%
rename from hw/xfree86/dixmods/extmod/xf86dga2.c
rename to Xext/xf86dga2.c
index cd0ed57..ccee7e2 100644
--- a/hw/xfree86/dixmods/extmod/xf86dga2.c
+++ b/Xext/xf86dga2.c
@@ -59,7 +59,7 @@ static void DGAClientStateChange (CallbackListPtr*, pointer, pointer);
 
 unsigned char DGAReqCode = 0;
 int DGAErrorBase;
-int DGAEventBase;
+int DGAEventBase = -1;
 
 static DevPrivateKeyRec DGAScreenPrivateKeyRec;
 #define DGAScreenPrivateKey (&DGAScreenPrivateKeyRec)
@@ -1057,9 +1057,3 @@ ProcXDGADispatch (ClientPtr client)
 	return BadRequest;
     }
 }
-
-void
-XFree86DGARegister(void)
-{
-  XDGAEventBase = &DGAEventBase;
-}
diff --git a/hw/xfree86/dixmods/extmod/xf86dgaext.h b/Xext/xf86dgaext.h
similarity index 100%
rename from hw/xfree86/dixmods/extmod/xf86dgaext.h
rename to Xext/xf86dgaext.h
diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/Xext/xf86vmode.c
similarity index 100%
rename from hw/xfree86/dixmods/extmod/xf86vmode.c
rename to Xext/xf86vmode.c
diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c
index 82fb52a..af9772c 100644
--- a/hw/xfree86/common/xf86DGA.c
+++ b/hw/xfree86/common/xf86DGA.c
@@ -68,8 +68,6 @@ DGACopyModeInfo(
    XDGAModePtr xmode
 );
 
-int *XDGAEventBase = NULL;
-
 #define DGA_GET_SCREEN_PRIV(pScreen) ((DGAScreenPtr) \
     dixLookupPrivate(&(pScreen)->devPrivates, &DGAScreenKeyRec))
 
@@ -250,7 +248,7 @@ DGACloseScreen(int i, ScreenPtr pScreen)
 {
    DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
 
-   if (XDGAEventBase) {
+   if (DGAEventBase >= 0) {
        mieqSetHandler(ET_DGAEvent, NULL);
     }
 
@@ -1010,9 +1008,9 @@ Bool
 DGAIsDgaEvent (xEvent *e)
 {
     int	    coreEquiv;
-    if (!DGAScreenKeyRegistered || XDGAEventBase == 0)
+    if (!DGAScreenKeyRegistered || DGAEventBase == -1)
 	return FALSE;
-    coreEquiv = e->u.u.type - *XDGAEventBase;
+    coreEquiv = e->u.u.type - DGAEventBase;
     if (KeyPress <= coreEquiv && coreEquiv <= MotionNotify)
 	return TRUE;
     return FALSE;
@@ -1055,7 +1053,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 = 0;
@@ -1111,7 +1109,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 = 0;
@@ -1204,7 +1202,7 @@ DGAHandleEvent(int screen_num, InternalEvent *ev, DeviceIntPtr device)
     DGAScreenPtr    pScreenPriv;
 
     /* no DGA */
-    if (!DGAScreenKeyRegistered || XDGAEventBase == 0)
+    if (!DGAScreenKeyRegistered || DGAEventBase == -1)
 	return;
     pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
 
diff --git a/hw/xfree86/dixmods/extmod/Makefile.am b/hw/xfree86/dixmods/extmod/Makefile.am
index 73e3b70..21abc07 100644
--- a/hw/xfree86/dixmods/extmod/Makefile.am
+++ b/hw/xfree86/dixmods/extmod/Makefile.am
@@ -1,16 +1,7 @@
-sdk_HEADERS = dgaproc.h
 
 extsmoduledir = $(moduledir)/extensions
 extsmodule_LTLIBRARIES = libextmod.la
 
-if DGA
-DGA_SRCS = xf86dga2.c dgaproc.h xf86dgaext.h
-endif
-
-if XF86VIDMODE
-XF86VMODE_SRCS = xf86vmode.c
-endif
-
 AM_CFLAGS = @DIX_CFLAGS@ @XORG_CFLAGS@
 INCLUDES = @XORG_INCS@ \
            -I$(top_srcdir)/dbe \
@@ -19,7 +10,5 @@ INCLUDES = @XORG_INCS@ \
 
 libextmod_la_LDFLAGS = -avoid-version
 libextmod_la_SOURCES = modinit.c \
-                       modinit.h \
-                       $(DGA_SRCS) \
-                       $(XF86VMODE_SRCS)
+                       modinit.h
 libextmod_la_LIBADD = $(top_builddir)/Xext/libXextmodule.la
diff --git a/hw/xfree86/dixmods/extmod/modinit.c b/hw/xfree86/dixmods/extmod/modinit.c
index 61e6fa2..bba13bd 100644
--- a/hw/xfree86/dixmods/extmod/modinit.c
+++ b/hw/xfree86/dixmods/extmod/modinit.c
@@ -47,24 +47,6 @@ static ExtensionModule extensionModules[] = {
 	NULL
     },
 #endif
-#ifdef XF86VIDMODE
-    {
-	XFree86VidModeExtensionInit,
-	XF86VIDMODENAME,
-	&noXFree86VidModeExtension,
-	NULL,
-	NULL
-    },
-#endif
-#ifdef XFreeXDGA
-    {
-	XFree86DGAExtensionInit,
-	XF86DGANAME,
-	&noXFree86DGAExtension,
-	XFree86DGARegister,
-	NULL
-    },
-#endif
     {				/* DON'T delete this entry ! */
 	NULL,
 	NULL,
diff --git a/mi/miinitext.c b/mi/miinitext.c
index 4b55312..336f582 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -523,6 +523,13 @@ static ExtensionModule staticExtensions[] = {
     { XvExtensionInit, "XVideo", &noXvExtension, NULL, NULL },
     { XvMCExtensionInit, "XVideo-MotionCompensation", &noXvExtension, NULL, NULL },
 #endif
+#ifdef XF86VIDMODE
+    { XFree86VidModeExtensionInit, "XFree86-VidModeExtension", &noXFree86VidModeExtension, NULL, NULL },
+#endif
+#ifdef XFreeXDGA
+    { XFree86DGAExtensionInit, XF86DGANAME, &noXFree86DGAExtension, NULL, NULL },
+#endif
+
     { NULL, NULL, NULL, NULL, NULL }
 };
     
-- 
1.7.2.1.g43c6fa



More information about the xorg-devel mailing list