[PATCH 3/8] Make the DPMS, ScreenSaver and Res extensions builtin

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


The change is trivial: simply move the ExtensionModule definitions from
hw/xfree/dixmods/extmod/modinit.c to mi/miinitext.c. Then also make sure
the required sources for those extensions are built into libXextbuiltin.la
instead of libXextmodule.la.

Signed-off-by: Tomas Carnecky <tom at dbservice.com>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 Xext/Makefile.am                      |    8 +++---
 hw/kdrive/src/kxv.c                   |    2 +-
 hw/xfree86/common/xf86xv.c            |   10 +++----
 hw/xfree86/common/xf86xvmc.c          |    7 ++---
 hw/xfree86/dixmods/extmod/Makefile.am |    7 +----
 hw/xfree86/dixmods/extmod/modinit.c   |   43 ---------------------------------
 hw/xfree86/dixmods/extmod/xvmod.c     |   23 -----------------
 hw/xfree86/dixmods/extmod/xvmodproc.h |   13 ----------
 mi/miinitext.c                        |   17 +++++++++++-
 9 files changed, 28 insertions(+), 102 deletions(-)
 delete mode 100644 hw/xfree86/dixmods/extmod/xvmod.c
 delete mode 100644 hw/xfree86/dixmods/extmod/xvmodproc.h

diff --git a/Xext/Makefile.am b/Xext/Makefile.am
index e444fd0..8f0a35f 100644
--- a/Xext/Makefile.am
+++ b/Xext/Makefile.am
@@ -45,19 +45,19 @@ endif
 # XVideo extension
 XV_SRCS = xvmain.c xvdisp.c xvmc.c xvdix.h xvmcext.h xvdisp.h
 if XV
-MODULE_SRCS  += $(XV_SRCS)
+BUILTIN_SRCS += $(XV_SRCS)
 endif
 
 # XResource extension: lets clients get data about per-client resource usage
 RES_SRCS = xres.c
 if RES
-MODULE_SRCS  += $(RES_SRCS)
+BUILTIN_SRCS += $(RES_SRCS)
 endif
 
 # MIT ScreenSaver extension
 SCREENSAVER_SRCS = saver.c
 if SCREENSAVER
-MODULE_SRCS  += $(SCREENSAVER_SRCS)
+BUILTIN_SRCS += $(SCREENSAVER_SRCS)
 endif
 
 # Xinerama extension: making multiple video devices act as one virtual screen
@@ -108,7 +108,7 @@ endif
 # DPMS extension
 DPMS_SRCS = dpms.c dpmsproc.h
 if DPMSExtension
-MODULE_SRCS += $(DPMS_SRCS)
+BUILTIN_SRCS += $(DPMS_SRCS)
 endif
 
 # Now take all of the above, mix well, bake for 10 minutes and get libXext*.la
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index c07829a..a1ff21f 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -195,7 +195,7 @@ KdXVScreenInit(
   if (KdXVGeneration != serverGeneration)
       KdXVGeneration = serverGeneration;
 
-  if(!XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
+  if (noXvExtension)
 	return FALSE;
 
   if (!dixRegisterPrivateKey(&KdXVWindowKeyRec, PRIVATE_WINDOW, 0))
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index c1d3199..9eaeaa5 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -52,7 +52,6 @@
 #include <X11/extensions/Xv.h>
 #include <X11/extensions/Xvproto.h>
 #include "xvdix.h"
-#include "xvmodproc.h"
 
 #include "xf86xvpriv.h"
 
@@ -117,9 +116,9 @@ DevPrivateKey XF86XvScreenKey;
 
 static unsigned long PortResource = 0;
 
-DevPrivateKey (*XvGetScreenKeyProc)(void) = NULL;
-unsigned long (*XvGetRTPortProc)(void) = NULL;
-int (*XvScreenInitProc)(ScreenPtr) = NULL;
+DevPrivateKey (*XvGetScreenKeyProc)(void) = XvGetScreenKey;
+unsigned long (*XvGetRTPortProc)(void) = XvGetRTPort;
+int (*XvScreenInitProc)(ScreenPtr) = XvScreenInit;
 
 #define GET_XV_SCREEN(pScreen) \
     ((XvScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XF86XvScreenKey))
@@ -246,8 +245,7 @@ xf86XVScreenInit(
   XF86XVScreenPtr ScreenPriv;
   XvScreenPtr pxvs;
 
-  if(num <= 0 ||
-     !XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
+  if (num <= 0 || noXvExtension)
 	return FALSE;
 
   if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
diff --git a/hw/xfree86/common/xf86xvmc.c b/hw/xfree86/common/xf86xvmc.c
index e6464a5..8f918e9 100644
--- a/hw/xfree86/common/xf86xvmc.c
+++ b/hw/xfree86/common/xf86xvmc.c
@@ -40,12 +40,10 @@
 #include "resource.h"
 #include "dixstruct.h"
 
-#include "xvmodproc.h"
-
 #include "xf86xvpriv.h"
 #include "xf86xvmc.h"
 
-XvMCScreenInitProcPtr XvMCScreenInitProc = NULL;
+XvMCScreenInitProcPtr XvMCScreenInitProc = XvMCScreenInit;
 
 
 typedef struct {
@@ -167,7 +165,8 @@ Bool xf86XvMCScreenInit(
 						    XF86XvScreenKey);
    int i, j;
 
-   if(!XvMCScreenInitProc) return FALSE;
+   if (noXvExtension)
+       return FALSE;
 
    if(!(pAdapt = malloc(sizeof(XvMCAdaptorRec) * num_adaptors)))
 	return FALSE;
diff --git a/hw/xfree86/dixmods/extmod/Makefile.am b/hw/xfree86/dixmods/extmod/Makefile.am
index d93e63a..73e3b70 100644
--- a/hw/xfree86/dixmods/extmod/Makefile.am
+++ b/hw/xfree86/dixmods/extmod/Makefile.am
@@ -7,10 +7,6 @@ if DGA
 DGA_SRCS = xf86dga2.c dgaproc.h xf86dgaext.h
 endif
 
-if XV
-XV_SRCS = xvmod.c xvmodproc.h
-endif
-
 if XF86VIDMODE
 XF86VMODE_SRCS = xf86vmode.c
 endif
@@ -25,6 +21,5 @@ libextmod_la_LDFLAGS = -avoid-version
 libextmod_la_SOURCES = modinit.c \
                        modinit.h \
                        $(DGA_SRCS) \
-                       $(XF86VMODE_SRCS) \
-                       $(XV_SRCS)
+                       $(XF86VMODE_SRCS)
 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 f4e922c..61e6fa2 100644
--- a/hw/xfree86/dixmods/extmod/modinit.c
+++ b/hw/xfree86/dixmods/extmod/modinit.c
@@ -47,15 +47,6 @@ static ExtensionModule extensionModules[] = {
 	NULL
     },
 #endif
-#ifdef SCREENSAVER
-    {
-	ScreenSaverExtensionInit,
-	ScreenSaverName,
-	&noScreenSaverExtension,
-	NULL,
-	NULL
-    },
-#endif
 #ifdef XF86VIDMODE
     {
 	XFree86VidModeExtensionInit,
@@ -74,40 +65,6 @@ static ExtensionModule extensionModules[] = {
 	NULL
     },
 #endif
-#ifdef DPMSExtension
-    {
-	DPMSExtensionInit,
-	DPMSExtensionName,
-	&noDPMSExtension,
-	NULL,
-	NULL
-    },
-#endif
-#ifdef XV
-    {
-	XvExtensionInit,
-	XvName,
-	&noXvExtension,
-	XvRegister,
-	NULL
-    },
-    {
-        XvMCExtensionInit,
-        XvMCName,
-        &noXvExtension,
-        NULL,
-        NULL
-    },
-#endif
-#ifdef RES
-    {
-        ResExtensionInit,
-        XRES_NAME, 
-        &noResExtension,
-        NULL,
-        NULL
-    },
-#endif
     {				/* DON'T delete this entry ! */
 	NULL,
 	NULL,
diff --git a/hw/xfree86/dixmods/extmod/xvmod.c b/hw/xfree86/dixmods/extmod/xvmod.c
deleted file mode 100644
index 9551046..0000000
--- a/hw/xfree86/dixmods/extmod/xvmod.c
+++ /dev/null
@@ -1,23 +0,0 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "misc.h"
-#include "scrnintstr.h"
-#include "gc.h"
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvproto.h>
-#include "xvdix.h"
-#include "xvmodproc.h"
-
-void
-XvRegister(void)
-{
-    XvScreenInitProc = XvScreenInit;
-    XvGetScreenKeyProc = XvGetScreenKey;
-    XvGetRTPortProc = XvGetRTPort;
-    XvMCScreenInitProc = XvMCScreenInit;
-}
-
diff --git a/hw/xfree86/dixmods/extmod/xvmodproc.h b/hw/xfree86/dixmods/extmod/xvmodproc.h
deleted file mode 100644
index b39c915..0000000
--- a/hw/xfree86/dixmods/extmod/xvmodproc.h
+++ /dev/null
@@ -1,13 +0,0 @@
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "xvmcext.h"
-
-extern DevPrivateKey (*XvGetScreenKeyProc)(void);
-extern unsigned long (*XvGetRTPortProc)(void);
-extern int (*XvScreenInitProc)(ScreenPtr);
-extern int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr);
-
-extern void XvRegister(void);
diff --git a/mi/miinitext.c b/mi/miinitext.c
index 3155bda..4b55312 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -505,10 +505,23 @@ static ExtensionModule staticExtensions[] = {
     { RRExtensionInit, "RANDR", &noRRExtension, NULL, NULL },
 #endif
 #ifdef COMPOSITE
-    { CompositeExtensionInit, "COMPOSITE", &noCompositeExtension, NULL },
+    { CompositeExtensionInit, "COMPOSITE", &noCompositeExtension, NULL, NULL },
 #endif
 #ifdef DAMAGE
-    { DamageExtensionInit, "DAMAGE", &noDamageExtension, NULL },
+    { DamageExtensionInit, "DAMAGE", &noDamageExtension, NULL, NULL },
+#endif
+#ifdef DPMSExtension
+    { DPMSExtensionInit, "DPMS", &noDPMSExtension, NULL, NULL },
+#endif
+#ifdef SCREENSAVER
+    { ScreenSaverExtensionInit, "MIT-SCREEN-SAVER", &noScreenSaverExtension, NULL, NULL },
+#endif
+#ifdef RES
+    { ResExtensionInit, XRES_NAME, &noResExtension, NULL, NULL },
+#endif
+#ifdef XV
+    { XvExtensionInit, "XVideo", &noXvExtension, NULL, NULL },
+    { XvMCExtensionInit, "XVideo-MotionCompensation", &noXvExtension, NULL, NULL },
 #endif
     { NULL, NULL, NULL, NULL, NULL }
 };
-- 
1.7.2.1.g43c6fa



More information about the xorg-devel mailing list