[PATCH 3/6] Make the XVideo(-MotionCompensation) extensions builtin

Tomas Carnecky tom at dbservice.com
Sun Aug 1 12:28:20 PDT 2010


Move the ExtensionModule definitions from extmod to mi and modify the Xext
makefile to build all Xv related sources into libXextbuiltin.la.

One small difference to the previous patch is the fact that Xv used the
ExtensionModule setupProc to initialize four function pointers. If these
pointers were not NULL, it meant that the extension is enabled and the DDX
performed the XVideo initialization. Instead of checking the pointers, use
the global variable noXvExtension.

Signed-off-by: Tomas Carnecky <tom at dbservice.com>
---
 Xext/Makefile.am                      |    2 +-
 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   |   16 ----------------
 hw/xfree86/dixmods/extmod/xvmod.c     |   23 -----------------------
 hw/xfree86/dixmods/extmod/xvmodproc.h |   13 -------------
 mi/miinitext.c                        |    4 ++++
 9 files changed, 14 insertions(+), 70 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 32dc461..b9ade54 100644
--- a/Xext/Makefile.am
+++ b/Xext/Makefile.am
@@ -45,7 +45,7 @@ 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
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 34c34eb..61e6fa2 100644
--- a/hw/xfree86/dixmods/extmod/modinit.c
+++ b/hw/xfree86/dixmods/extmod/modinit.c
@@ -65,22 +65,6 @@ static ExtensionModule extensionModules[] = {
 	NULL
     },
 #endif
-#ifdef XV
-    {
-	XvExtensionInit,
-	XvName,
-	&noXvExtension,
-	XvRegister,
-	NULL
-    },
-    {
-        XvMCExtensionInit,
-        XvMCName,
-        &noXvExtension,
-        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 65178cb..4d36a6f 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -520,6 +520,10 @@ static ExtensionModule staticExtensions[] = {
 #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