[PATCH 24/54] Xv: Remove excessive module-induced indirection

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


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>
Acked-by: Peter Hutterer <peter.hutterer at who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 Xext/xvdix.h                 |    4 ----
 Xext/xvmain.c                |   12 ------------
 Xext/xvmc.c                  |    6 ------
 hw/kdrive/src/kxv.c          |    8 ++++----
 hw/xfree86/common/xf86xv.c   |    9 ++++-----
 hw/xfree86/common/xf86xvmc.c |    4 ++--
 hw/xfree86/common/xf86xvmc.h |    3 ---
 include/extinit.h            |    2 --
 mi/miinitext.c               |    4 ++--
 9 files changed, 12 insertions(+), 40 deletions(-)

diff --git a/Xext/xvdix.h b/Xext/xvdix.h
index fc8eb0f..9c6160c 100644
--- a/Xext/xvdix.h
+++ b/Xext/xvdix.h
@@ -70,10 +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 {
     int numerator;
     int denominator;
diff --git a/Xext/xvmain.c b/Xext/xvmain.c
index bf0cd5c..d54da1e 100644
--- a/Xext/xvmain.c
+++ b/Xext/xvmain.c
@@ -194,18 +194,6 @@ XvExtensionInit(void)
     }
 }
 
-DevPrivateKey (*XvGetScreenKeyProc)(void) = NULL;
-unsigned long (*XvGetRTPortProc)(void) = NULL;
-int (*XvScreenInitProc)(ScreenPtr) = NULL;
-
-void
-XvRegister(void)
-{
-    XvScreenInitProc = XvScreenInit;
-    XvGetScreenKeyProc = XvGetScreenKey;
-    XvGetRTPortProc = XvGetRTPort;
-}
-
 static Bool
 CreateResourceTypes(void)
 {
diff --git a/Xext/xvmc.c b/Xext/xvmc.c
index d022817..c28e58d 100644
--- a/Xext/xvmc.c
+++ b/Xext/xvmc.c
@@ -752,12 +752,6 @@ XvMCScreenInit(ScreenPtr pScreen, int num, XvMCAdaptorPtr pAdapt)
     return Success;
 }
 
-void
-XvMCRegister(void)
-{
-    XvMCScreenInitProc = XvMCScreenInit;
-}
-
 XvImagePtr
 XvMCFindXvImage(XvPortPtr pPort, CARD32 id)
 {
diff --git a/hw/kdrive/src/kxv.c b/hw/kdrive/src/kxv.c
index b7afb2e..cf65636 100644
--- a/hw/kdrive/src/kxv.c
+++ b/hw/kdrive/src/kxv.c
@@ -182,17 +182,17 @@ KdXVScreenInit(ScreenPtr pScreen, KdVideoAdaptorPtr * adaptors, int num)
     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))
+    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 0e50f37..92d0f6d 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -234,19 +234,18 @@ xf86XVScreenInit(ScreenPtr pScreen, XF86VideoAdaptorPtr * adaptors, int num)
     XF86XVScreenPtr ScreenPriv;
     XvScreenPtr pxvs;
 
-    if (num <= 0 ||
-        !XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc)
+    if (num <= 0 || noXvExtension)
         return FALSE;
 
-    if (Success != (*XvScreenInitProc) (pScreen))
+    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 dc6b395..78a32bf 100644
--- a/hw/xfree86/common/xf86xvmc.c
+++ b/hw/xfree86/common/xf86xvmc.c
@@ -152,7 +152,7 @@ xf86XvMCScreenInit(ScreenPtr pScreen,
                                                       XF86XvScreenKey);
     int i, j;
 
-    if (!XvMCScreenInitProc)
+    if (noXvExtension)
         return FALSE;
 
     if (!(pAdapt = malloc(sizeof(XvMCAdaptorRec) * num_adaptors)))
@@ -201,7 +201,7 @@ xf86XvMCScreenInit(ScreenPtr pScreen,
         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 ff32379..2478fe3 100644
--- a/hw/xfree86/common/xf86xvmc.h
+++ b/hw/xfree86/common/xf86xvmc.h
@@ -138,7 +138,4 @@ extern _X_EXPORT Bool xf86XvMCScreenInit(ScreenPtr pScreen,
 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/include/extinit.h b/include/extinit.h
index a8c2539..ea41eba 100644
--- a/include/extinit.h
+++ b/include/extinit.h
@@ -181,8 +181,6 @@ extern void PseudoramiXExtensionInit(void);
 extern Bool noXvExtension;
 extern void XvExtensionInit(void);
 extern void XvMCExtensionInit(void);
-extern void XvRegister(void);
-extern void XvMCRegister(void);
 #endif
 
 #endif
diff --git a/mi/miinitext.c b/mi/miinitext.c
index 01ea7ad..c2c6836 100644
--- a/mi/miinitext.c
+++ b/mi/miinitext.c
@@ -413,8 +413,8 @@ static ExtensionModule staticExtensions[] = {
     {ResExtensionInit, XRES_NAME, &noResExtension, NULL},
 #endif
 #ifdef XV
-    {XvExtensionInit, XvName, &noXvExtension, XvRegister},
-    {XvMCExtensionInit, XvMCName, &noXvExtension, XvMCRegister},
+    {XvExtensionInit, XvName, &noXvExtension, NULL},
+    {XvMCExtensionInit, XvMCName, &noXvExtension, NULL},
 #endif
 };
 
-- 
1.7.10.4



More information about the xorg-devel mailing list