[PATCH v2 08/15] xfree86/xv: Factor out the meat of xf86XVAdjustFrame for later reuse

ville.syrjala at nokia.com ville.syrjala at nokia.com
Tue Nov 2 11:05:54 PDT 2010


From: Ville Syrjälä <ville.syrjala at nokia.com>

No functional change.

Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
---
 hw/xfree86/common/xf86xv.c |   66 +++++++++++++++++++++++--------------------
 1 files changed, 35 insertions(+), 31 deletions(-)

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 8d3e85e..9b46549 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1038,6 +1038,40 @@ xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv,
     }
 }
 
+static void
+xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn)
+{
+    ScreenPtr pScreen = pScrn->pScreen;
+    XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
+    XvAdaptorPtr pa;
+    int c, i;
+
+    for (c = pxvs->nAdaptors, pa = pxvs->pAdaptors; c > 0; c--, pa++) {
+	XvPortPtr pPort = pa->pPorts;
+
+	for (i = pa->nPorts; i > 0; i--, pPort++) {
+	    XvPortRecPrivatePtr pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
+	    WindowPtr pWin = (WindowPtr)pPriv->pDraw;
+	    Bool visible;
+
+	    if (pPriv->isOn == XV_OFF || !pWin)
+		continue;
+
+	    visible = pWin->visibility == VisibilityUnobscured ||
+		      pWin->visibility == VisibilityPartiallyObscured;
+
+	    /*
+	     * Stop and remove still/images if
+	     * ReputImage isn't supported.
+	     */
+	    if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
+		visible = FALSE;
+
+	    xf86XVReputOrStopPort(pPriv, pWin, visible);
+	}
+    }
+}
+
 /****  ScreenRec fields ****/
 
 static Bool
@@ -1264,11 +1298,7 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
 {
   ScrnInfoPtr pScrn = xf86Screens[index];
   ScreenPtr pScreen = pScrn->pScreen;
-  XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
   XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
-  WindowPtr pWin;
-  XvAdaptorPtr pa;
-  int c, i;
 
   if(ScreenPriv->AdjustFrame) {
 	pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
@@ -1276,33 +1306,7 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
 	pScrn->AdjustFrame = xf86XVAdjustFrame;
   }
 
-  for(c = pxvs->nAdaptors, pa = pxvs->pAdaptors; c > 0; c--, pa++) {
-      XvPortPtr pPort = pa->pPorts;
-      XvPortRecPrivatePtr pPriv;
-
-      for(i = pa->nPorts; i > 0; i--, pPort++) {
-	Bool visible;
-
-	pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
-
-	pWin = (WindowPtr)pPriv->pDraw;
-
-	if (pPriv->isOn == XV_OFF || !pWin)
-	    continue;
-
-	visible = pWin->visibility == VisibilityUnobscured ||
-		  pWin->visibility == VisibilityPartiallyObscured;
-
-	/*
-	 * Stop and remove still/images if
-	 * ReputImage isn't supported.
-	 */
-	if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
-	    visible = FALSE;
-
-	xf86XVReputOrStopPort(pPriv, pWin, visible);
-     }
-  }
+  xf86XVReputOrStopAllPorts(pScrn);
 }
 
 
-- 
1.7.2.2



More information about the xorg-devel mailing list