[PATCH 14/37] Xv: Remove excessive module-induced indirection

Daniel Stone daniel at fooishbar.org
Tue Jun 28 12:27:30 PDT 2011


From: Tomas Carnecky <tom at dbservice.com>

Xv used to call XvScreenInit and co. through function pointers, as
XvScreenInit may have been sitting on the other side of a module
boundary from xf86XvScreenInit.  Why this was so is a mystery, but make
it not so any more.

Signed-off-by: Tomas Carnecky <tom at dbservice.com>
Reviewed-by: Daniel Stone <daniel at fooishbar.org>
---
 Xext/xvdix.h                        |    7 -------
 Xext/xvmain.c                       |   15 ---------------
 hw/kdrive/src/kxv.c                 |    8 ++++----
 hw/xfree86/common/xf86xv.c          |    9 ++++-----
 hw/xfree86/common/xf86xvmc.c        |    4 ++--
 hw/xfree86/common/xf86xvmc.h        |    3 ---
 hw/xfree86/dixmods/extmod/modinit.h |    1 -
 mi/miinitext.c                      |    2 +-
 8 files changed, 11 insertions(+), 38 deletions(-)

diff --git a/Xext/xvdix.h b/Xext/xvdix.h
index fc35935..f171d39 100644
--- a/Xext/xvdix.h
+++ b/Xext/xvdix.h
@@ -70,12 +70,6 @@ extern _X_EXPORT RESTYPE XvRTVideoNotify;
 extern _X_EXPORT RESTYPE XvRTVideoNotifyList;
 extern _X_EXPORT RESTYPE XvRTPortNotify;
 
-extern DevPrivateKey (*XvGetScreenKeyProc)(void);
-extern unsigned long (*XvGetRTPortProc)(void);
-extern int (*XvScreenInitProc)(ScreenPtr);
-typedef struct _XvMCAdaptor *XvMCAdaptorPtr;
-extern int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr);
-
 typedef struct {
   int numerator;
   int denominator;
@@ -273,7 +267,6 @@ extern _X_EXPORT int XvdiPreemptVideo(ClientPtr, XvPortPtr, DrawablePtr);
 extern _X_EXPORT int XvdiMatchPort(XvPortPtr, DrawablePtr);
 extern _X_EXPORT int XvdiGrabPort(ClientPtr, XvPortPtr, Time, int *);
 extern _X_EXPORT int XvdiUngrabPort( ClientPtr, XvPortPtr, Time);
-extern void XvRegister(void);
 #endif /* XorgLoader */
 
 #endif /* XVDIX_H */
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index c86f911..d21a56c 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -199,21 +199,6 @@ XvExtensionInit(void)
     }
 }
 
-DevPrivateKey (*XvGetScreenKeyProc)(void) = NULL;
-unsigned long (*XvGetRTPortProc)(void) = NULL;
-int (*XvScreenInitProc)(ScreenPtr) = NULL;
-int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr) = NULL;
-extern int XvMCScreenInit(ScreenPtr, int, XvMCAdaptorPtr);
-
-void
-XvRegister(void)
-{
-    XvScreenInitProc = XvScreenInit;
-    XvGetScreenKeyProc = XvGetScreenKey;
-    XvGetRTPortProc = XvGetRTPort;
-    XvMCScreenInitProc = XvMCScreenInit;
-}
-
 static Bool
 CreateResourceTypes(void)
 
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index 5162ea1..32ded06 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -191,16 +191,16 @@ KdXVScreenInit(
   if (KdXVGeneration != serverGeneration)
       KdXVGeneration = serverGeneration;
 
-  if(!XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
+  if(noXvExtension)
 	return FALSE;
 
   if (!dixRegisterPrivateKey(&KdXVWindowKeyRec, PRIVATE_WINDOW, 0))
       return FALSE;
 
-  if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
+  if(Success != XvScreenInit(pScreen)) return FALSE;
 
-  KdXvScreenKey = (*XvGetScreenKeyProc)();
-  PortResource = (*XvGetRTPortProc)();
+  KdXvScreenKey = XvGetScreenKey();
+  PortResource = XvGetRTPort();
 
   pxvs = GET_XV_SCREEN(pScreen);
 
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 50b6be5..eaf4fb3 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -245,18 +245,17 @@ xf86XVScreenInit(
   XF86XVScreenPtr ScreenPriv;
   XvScreenPtr pxvs;
 
-  if(num <= 0 ||
-     !XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
+  if(num <= 0 || noXvExtension)
 	return FALSE;
 
-  if(Success != (*XvScreenInitProc)(pScreen)) return FALSE;
+  if(Success != XvScreenInit(pScreen)) return FALSE;
 
   if (!dixRegisterPrivateKey(&XF86XVWindowKeyRec, PRIVATE_WINDOW, 0))
       return FALSE;
 
-  XF86XvScreenKey = (*XvGetScreenKeyProc)();
+  XF86XvScreenKey = XvGetScreenKey();
 
-  PortResource = (*XvGetRTPortProc)();
+  PortResource = XvGetRTPort();
 
   pxvs = GET_XV_SCREEN(pScreen);
 
diff --git a/hw/xfree86/common/xf86xvmc.c b/hw/xfree86/common/xf86xvmc.c
index da64d1e..e97f8a3 100644
--- a/hw/xfree86/common/xf86xvmc.c
+++ b/hw/xfree86/common/xf86xvmc.c
@@ -162,7 +162,7 @@ Bool xf86XvMCScreenInit(
 						    XF86XvScreenKey);
    int i, j;
 
-   if(!XvMCScreenInitProc) return FALSE;
+   if(noXvExtension) return FALSE;
 
    if(!(pAdapt = malloc(sizeof(XvMCAdaptorRec) * num_adaptors)))
 	return FALSE;
@@ -210,7 +210,7 @@ Bool xf86XvMCScreenInit(
 	adaptors++;
    }
 
-   if(Success != (*XvMCScreenInitProc)(pScreen, num_adaptors, pAdapt))
+   if(Success != XvMCScreenInit(pScreen, num_adaptors, pAdapt))
 	return FALSE;
 
    return TRUE;
diff --git a/hw/xfree86/common/xf86xvmc.h b/hw/xfree86/common/xf86xvmc.h
index 902b4f8..e6c4de4 100644
--- a/hw/xfree86/common/xf86xvmc.h
+++ b/hw/xfree86/common/xf86xvmc.h
@@ -160,7 +160,4 @@ extern _X_EXPORT Bool xf86XvMCScreenInit(
 extern _X_EXPORT XF86MCAdaptorPtr xf86XvMCCreateAdaptorRec (void);
 extern _X_EXPORT void xf86XvMCDestroyAdaptorRec(XF86MCAdaptorPtr adaptor);
 
-typedef int (*XvMCScreenInitProcPtr)(ScreenPtr, int, XvMCAdaptorPtr);
-extern _X_EXPORT XvMCScreenInitProcPtr XvMCScreenInitProc;
-
 #endif /* _XF86XVMC_H */
diff --git a/hw/xfree86/dixmods/extmod/modinit.h b/hw/xfree86/dixmods/extmod/modinit.h
index 22e6ce1..b115861 100644
--- a/hw/xfree86/dixmods/extmod/modinit.h
+++ b/hw/xfree86/dixmods/extmod/modinit.h
@@ -42,7 +42,6 @@ extern void DPMSExtensionInit(void);
 #ifdef XV
 extern void XvExtensionInit(void);
 extern void XvMCExtensionInit(void);
-extern void XvRegister(void);
 #include <X11/extensions/Xv.h>
 #include <X11/extensions/XvMC.h>
 #endif
diff --git a/mi/miinitext.c b/mi/miinitext.c
index eb42303..9fb5ec8 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -539,7 +539,7 @@ static ExtensionModule staticExtensions[] = {
     { ResExtensionInit, XRES_NAME, &noResExtension, NULL },
 #endif
 #ifdef XV
-    { XvExtensionInit, XvName, &noXvExtension, XvRegister },
+    { XvExtensionInit, XvName, &noXvExtension, NULL },
     { XvMCExtensionInit, XvMCName, &noXvExtension, NULL },
 #endif
     { NULL, NULL, NULL, NULL, NULL }
-- 
1.7.5.4



More information about the xorg-devel mailing list