xserver: Branch 'master' - 16 commits

Keith Packard keithp at kemper.freedesktop.org
Thu Dec 2 08:40:48 PST 2010


 hw/xfree86/common/xf86str.h    |    4 
 hw/xfree86/common/xf86xv.c     |  258 ++++++++++++++++++++++++-----------------
 hw/xfree86/common/xf86xv.h     |   10 +
 hw/xfree86/common/xf86xvpriv.h |    2 
 hw/xfree86/modes/xf86Crtc.c    |    8 +
 5 files changed, 175 insertions(+), 107 deletions(-)

New commits:
commit 3824417335ec00a87b51f8d05e592099b8507680
Merge: dab064f... f4f41c8...
Author: Keith Packard <keithp at keithp.com>
Date:   Thu Dec 2 08:39:33 2010 -0800

    Merge remote branch 'vsyrjala/xv_reput'

commit f4f41c812d2ba5edba7e0e0dbaab4bbf0af834b3
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 17:34:56 2010 +0300

    xfree86/xv: Provide a ModeSet hook
    
    Reput all ports when the display mode or panning has been changed by
    RandR code. This makes the overlays appear in the correct position
    on the screen.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index d323006..016db1f 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -104,6 +104,7 @@ static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
 static Bool xf86XVEnterVT(int, int);
 static void xf86XVLeaveVT(int, int);
 static void xf86XVAdjustFrame(int index, int x, int y, int flags);
+static void xf86XVModeSet(ScrnInfoPtr pScrn);
 
 /* misc */
 
@@ -287,6 +288,7 @@ xf86XVScreenInit(
   ScreenPriv->EnterVT = pScrn->EnterVT;
   ScreenPriv->LeaveVT = pScrn->LeaveVT;
   ScreenPriv->AdjustFrame = pScrn->AdjustFrame;
+  ScreenPriv->ModeSet = pScrn->ModeSet;
 
   pScreen->DestroyWindow = xf86XVDestroyWindow;
   pScreen->WindowExposures = xf86XVWindowExposures;
@@ -295,6 +297,7 @@ xf86XVScreenInit(
   pScrn->LeaveVT = xf86XVLeaveVT;
   if(pScrn->AdjustFrame)
      pScrn->AdjustFrame = xf86XVAdjustFrame;
+  pScrn->ModeSet = xf86XVModeSet;
 
   if(!xf86XVInitAdaptors(pScreen, adaptors, num))
 	return FALSE;
@@ -1241,6 +1244,7 @@ xf86XVCloseScreen(int i, ScreenPtr pScreen)
   pScrn->EnterVT = ScreenPriv->EnterVT;
   pScrn->LeaveVT = ScreenPriv->LeaveVT;
   pScrn->AdjustFrame = ScreenPriv->AdjustFrame;
+  pScrn->ModeSet = ScreenPriv->ModeSet;
 
   for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) {
        xf86XVFreeAdaptor(pa);
@@ -1344,6 +1348,26 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
   xf86XVReputOrStopAllPorts(pScrn);
 }
 
+static void
+xf86XVModeSet(ScrnInfoPtr pScrn)
+{
+    ScreenPtr pScreen = pScrn->pScreen;
+    XF86XVScreenPtr ScreenPriv;
+
+    /* Can be called before pScrn->pScreen is set */
+    if (!pScreen)
+	return;
+
+    ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+
+    if (ScreenPriv->ModeSet) {
+	pScrn->ModeSet = ScreenPriv->ModeSet;
+	(*pScrn->ModeSet)(pScrn);
+	pScrn->ModeSet = xf86XVModeSet;
+    }
+
+    xf86XVReputOrStopAllPorts(pScrn);
+}
 
 /**** XvAdaptorRec fields ****/
 
diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
index 3191c4c..88e7a0e 100644
--- a/hw/xfree86/common/xf86xvpriv.h
+++ b/hw/xfree86/common/xf86xvpriv.h
@@ -44,6 +44,7 @@ typedef struct {
    Bool                         (*EnterVT)(int, int);
    void                         (*LeaveVT)(int, int);
    GCPtr			videoGC;
+   xf86ModeSetProc		*ModeSet;
 } XF86XVScreenRec, *XF86XVScreenPtr;
 
 typedef struct {
commit 640c8716e0400e35afd7e91efc826fc447ea6745
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Thu Oct 28 18:13:02 2010 +0300

    xfree86/modes: Provide a ModeSet hook in ScrnInfo
    
    Add a new hook ModeSet that will be called after display mode is
    changed, or after the display has been panned.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index ce6b07f..a65237a 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -498,7 +498,7 @@ typedef struct _confdrirec {
 /* These values should be adjusted when new fields are added to ScrnInfoRec */
 #define NUM_RESERVED_INTS		16
 #define NUM_RESERVED_POINTERS		14
-#define NUM_RESERVED_FUNCS		11
+#define NUM_RESERVED_FUNCS		10
 
 typedef pointer (*funcPointer)(void);
 
@@ -652,6 +652,7 @@ typedef Bool xf86PMEventProc              (int, pmEvent, Bool);
 typedef void xf86DPMSSetProc		  (ScrnInfoPtr, int, int);
 typedef void xf86LoadPaletteProc   (ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
 typedef void xf86SetOverscanProc          (ScrnInfoPtr, int);
+typedef void xf86ModeSetProc              (ScrnInfoPtr);
 
 
 /*
@@ -802,6 +803,7 @@ typedef struct _ScrnInfoRec {
     xf86LoadPaletteProc			*LoadPalette;
     xf86SetOverscanProc			*SetOverscan;
     xorgDriverFuncProc			*DriverFunc;
+    xf86ModeSetProc			*ModeSet;
 
     /*
      * This can be used when the minor ABI version is incremented.
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c
index 7fc2a60..74d91ed 100644
--- a/hw/xfree86/modes/xf86Crtc.c
+++ b/hw/xfree86/modes/xf86Crtc.c
@@ -371,6 +371,8 @@ done:
 	crtc->active = TRUE;
 	if (scrn->pScreen)
 	    xf86CrtcSetScreenSubpixelOrder (scrn->pScreen);
+	if (scrn->ModeSet)
+	    scrn->ModeSet(scrn);
     } else {
 	crtc->x = saved_x;
 	crtc->y = saved_y;
@@ -407,12 +409,16 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
 void
 xf86CrtcSetOrigin (xf86CrtcPtr crtc, int x, int y)
 {
+    ScrnInfoPtr scrn = crtc->scrn;
+
     crtc->x = x;
     crtc->y = y;
     if (crtc->funcs->set_origin) {
 	if (!xf86CrtcRotate (crtc))
 	    return;
 	crtc->funcs->set_origin (crtc, x, y);
+	if (scrn->ModeSet)
+	    scrn->ModeSet(scrn);
     }
     else
 	xf86CrtcSetMode (crtc, &crtc->mode, crtc->rotation, x, y);
@@ -2894,6 +2900,8 @@ xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
     }
     if (pScrn->pScreen)
 	xf86_crtc_notify(pScrn->pScreen);
+    if (pScrn->ModeSet)
+	pScrn->ModeSet(pScrn);
 }
 
 #ifdef RANDR_12_INTERFACE
commit a942534ca3908418c407115c6393263c2fe05931
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Tue Nov 2 16:05:13 2010 +0200

    xfree86/xv: Pass all coordinate arguments to ReputImage
    
    Pass all of the src/dst coordinates to ReputImage so that drivers
    don't necessarily have to do double bookkeeping.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 66cf685..d323006 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -939,7 +939,10 @@ xf86XVReputImage(XvPortRecPrivatePtr portPriv)
   }
 
   ret = (*portPriv->AdaptorRec->ReputImage)(portPriv->pScrn,
+			portPriv->vid_x, portPriv->vid_y,
 			WinBox.x1, WinBox.y1,
+			portPriv->vid_w, portPriv->vid_h,
+			portPriv->drw_w, portPriv->drw_h,
 			&ClipRegion, portPriv->DevPriv.ptr,
 			portPriv->pDraw);
 
@@ -1493,6 +1496,8 @@ xf86XVPutStill(
 
      xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv);
      portPriv->isOn = XV_ON;
+     portPriv->vid_x = vid_x;  portPriv->vid_y = vid_y;
+     portPriv->vid_w = vid_w;  portPriv->vid_h = vid_h;
      portPriv->drw_x = drw_x;  portPriv->drw_y = drw_y;
      portPriv->drw_w = drw_w;  portPriv->drw_h = drw_h;
      portPriv->type = 0;  /* no mask means it's transient and should
@@ -1796,6 +1801,8 @@ xf86XVPutImage(
 	(portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) {
 
      portPriv->isOn = XV_ON;
+     portPriv->vid_x = src_x;  portPriv->vid_y = src_y;
+     portPriv->vid_w = src_w;  portPriv->vid_h = src_h;
      portPriv->drw_x = drw_x;  portPriv->drw_y = drw_y;
      portPriv->drw_w = drw_w;  portPriv->drw_h = drw_h;
      portPriv->type = 0;  /* no mask means it's transient and should
diff --git a/hw/xfree86/common/xf86xv.h b/hw/xfree86/common/xf86xv.h
index 973b1d0..47061fe 100644
--- a/hw/xfree86/common/xf86xv.h
+++ b/hw/xfree86/common/xf86xv.h
@@ -111,7 +111,9 @@ typedef int (* PutImageFuncPtr)( ScrnInfoPtr pScrn,
 	short src_w, short src_h, short drw_w, short drw_h,
 	int image, unsigned char* buf, short width, short height, Bool Sync,
 	RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
-typedef int (* ReputImageFuncPtr)( ScrnInfoPtr pScrn, short drw_x, short drw_y,
+typedef int (* ReputImageFuncPtr)( ScrnInfoPtr pScrn,
+	short src_x, short src_y, short drw_x, short drw_y,
+	short src_w, short src_h, short drw_w, short drw_h,
 	RegionPtr clipBoxes, pointer data, DrawablePtr pDraw );
 typedef int (*QueryImageAttributesFuncPtr)(ScrnInfoPtr pScrn, 
 	int image, unsigned short *width, unsigned short *height, 
commit 0fef4e94480f2bf1157ce5f92fcb0c7dd1585371
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Tue Nov 2 16:23:02 2010 +0200

    xfree86/xv: Document VIDEO_CLIP_TO_VIEWPORT incompatibility with reput
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.h b/hw/xfree86/common/xf86xv.h
index 1b43fcb..973b1d0 100644
--- a/hw/xfree86/common/xf86xv.h
+++ b/hw/xfree86/common/xf86xv.h
@@ -36,6 +36,10 @@
 #define VIDEO_INVERT_CLIPLIST			0x00000002
 #define VIDEO_OVERLAID_IMAGES			0x00000004
 #define VIDEO_OVERLAID_STILLS			0x00000008
+/*
+ * Usage of VIDEO_CLIP_TO_VIEWPORT is not recommended.
+ * It can make reput behaviour inconsistent.
+ */
 #define VIDEO_CLIP_TO_VIEWPORT			0x00000010
 
 typedef struct {
commit 5f8ec1ade8b485f48de8c72011409219afad9dd7
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Tue Nov 2 16:04:36 2010 +0200

    xfree86/xv: Add some helpful comments about ReputImage
    
    Document the fact that ReputImage is used for stills as well as images.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index f1cdfe6..66cf685 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -556,7 +556,7 @@ xf86XVInitAdaptors(
       adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize;
       adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes;
       adaptorPriv->PutImage = adaptorPtr->PutImage;
-      adaptorPriv->ReputImage = adaptorPtr->ReputImage;
+      adaptorPriv->ReputImage = adaptorPtr->ReputImage; /* image/still */
 
       pa->devPriv.ptr = (pointer)adaptorPriv;
 
@@ -873,6 +873,7 @@ CLIP_VIDEO_BAILOUT:
   return ret;
 }
 
+/* Reput image/still */
 static int
 xf86XVReputImage(XvPortRecPrivatePtr portPriv)
 {
diff --git a/hw/xfree86/common/xf86xv.h b/hw/xfree86/common/xf86xv.h
index c3db6cc..1b43fcb 100644
--- a/hw/xfree86/common/xf86xv.h
+++ b/hw/xfree86/common/xf86xv.h
@@ -165,7 +165,7 @@ typedef struct {
   GetPortAttributeFuncPtr GetPortAttribute;
   QueryBestSizeFuncPtr QueryBestSize;
   PutImageFuncPtr PutImage;
-  ReputImageFuncPtr ReputImage;
+  ReputImageFuncPtr ReputImage; /* image/still */
   QueryImageAttributesFuncPtr QueryImageAttributes;
   ClipNotifyFuncPtr ClipNotify;
 } XF86VideoAdaptorRec, *XF86VideoAdaptorPtr;
commit b4ebde23d25bef1b891902d75b2db3aad92685b7
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Mon Nov 1 20:27:25 2010 +0200

    xfree86/xv: Fix ReputImage clipping
    
    PutImage/PutStill respect the GC clip, however ReputImage does not.
    PutImage/PutStill are supposed to be oneshot operations so ReputImage
    should never expand the area covered by the clip, instead it should
    only shrink if the window clip shrinks. So commandeer clientClip
    into use by ReputImage and initially make it a copy of the original
    GC composite clip. Whenever ReputImage needs reclipping update
    clientClip with the newly calculated composite clip.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 8ccdf06..f1cdfe6 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -703,6 +703,27 @@ xf86XVCopyClip(
     portPriv->subWindowMode = pGC->subWindowMode;
 }
 
+static void
+xf86XVCopyCompositeClip(XvPortRecPrivatePtr portPriv,
+			GCPtr pGC,
+			DrawablePtr pDraw)
+{
+    if (!portPriv->clientClip)
+	portPriv->clientClip = RegionCreate(NullBox, 1);
+    /* Keep the original GC composite clip around for ReputImage */
+    RegionCopy(portPriv->clientClip, pGC->pCompositeClip);
+    RegionTranslate(portPriv->clientClip,
+		    -pDraw->x, -pDraw->y);
+
+    /* get rid of the old clip list */
+    if (portPriv->pCompositeClip && portPriv->FreeCompositeClip)
+	RegionDestroy(portPriv->pCompositeClip);
+
+    portPriv->pCompositeClip = pGC->pCompositeClip;
+    portPriv->FreeCompositeClip = FALSE;
+    portPriv->subWindowMode = pGC->subWindowMode;
+}
+
 static int
 xf86XVRegetVideo(XvPortRecPrivatePtr portPriv)
 {
@@ -863,6 +884,11 @@ xf86XVReputImage(XvPortRecPrivatePtr portPriv)
 
   xf86XVUpdateCompositeClip(portPriv);
 
+  /* the clip can get smaller over time */
+  RegionCopy(portPriv->clientClip, portPriv->pCompositeClip);
+  RegionTranslate(portPriv->clientClip,
+		  -portPriv->pDraw->x, -portPriv->pDraw->y);
+
   /* translate the video region to the screen */
   WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x;
   WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y;
@@ -1411,6 +1437,8 @@ xf86XVPutStill(
   WinBox.x2 = WinBox.x1 + drw_w;
   WinBox.y2 = WinBox.y1 + drw_h;
 
+  xf86XVCopyCompositeClip(portPriv, pGC, pDraw);
+
   RegionInit(&WinRegion, &WinBox, 1);
   RegionNull(&ClipRegion);
   RegionIntersect(&ClipRegion, &WinRegion, pGC->pCompositeClip);
@@ -1479,6 +1507,10 @@ PUT_STILL_BAILOUT:
 	portPriv->isOn = XV_PENDING;
   }
 
+  /* This clip was copied and only good for one shot */
+  if(!portPriv->FreeCompositeClip)
+     portPriv->pCompositeClip = NULL;
+
   RegionUninit(&WinRegion);
   RegionUninit(&ClipRegion);
 
@@ -1700,6 +1732,8 @@ xf86XVPutImage(
 
   if(!portPriv->pScrn->vtSema) return Success; /* Success ? */
 
+  xf86XVCopyCompositeClip(portPriv, pGC, pDraw);
+
   WinBox.x1 = pDraw->x + drw_x;
   WinBox.y1 = pDraw->y + drw_y;
   WinBox.x2 = WinBox.x1 + drw_w;
@@ -1776,6 +1810,10 @@ PUT_IMAGE_BAILOUT:
 	portPriv->isOn = XV_PENDING;
   }
 
+  /* This clip was copied and only good for one shot */
+  if(!portPriv->FreeCompositeClip)
+     portPriv->pCompositeClip = NULL;
+
   RegionUninit(&WinRegion);
   RegionUninit(&ClipRegion);
 
commit 7294236bdb29b4fa7a7bc27aff9c786c5a33c544
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Mon Nov 1 20:02:40 2010 +0200

    xfree86/xv: Remove clipOrg from XvPortRecPrivate
    
    clipOrg never changes except when clientClip changes, so instead of
    keeping copies of both originals translate clientClip by clipOrg
    immediately and just keep the translated clientClip.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index e4c5082..8ccdf06 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -661,8 +661,7 @@ xf86XVUpdateCompositeClip(XvPortRecPrivatePtr portPriv)
    pCompositeClip = RegionCreate(NullBox, 1);
    RegionCopy(pCompositeClip, portPriv->clientClip);
    RegionTranslate(pCompositeClip,
-			portPriv->pDraw->x + portPriv->clipOrg.x,
-			portPriv->pDraw->y + portPriv->clipOrg.y);
+		   portPriv->pDraw->x, portPriv->pDraw->y);
    RegionIntersect(pCompositeClip, pregWin, pCompositeClip);
 
    portPriv->pCompositeClip = pCompositeClip;
@@ -687,6 +686,8 @@ xf86XVCopyClip(
 	    portPriv->clientClip = RegionCreate(NullBox, 1);
 	/* Note: this is in window coordinates */
 	RegionCopy(portPriv->clientClip, pGC->clientClip);
+	RegionTranslate(portPriv->clientClip,
+			pGC->clipOrg.x, pGC->clipOrg.y);
     } else if(portPriv->clientClip) { /* free the old clientClip */
 	RegionDestroy(portPriv->clientClip);
 	portPriv->clientClip = NULL;
@@ -697,7 +698,6 @@ xf86XVCopyClip(
 	RegionDestroy(portPriv->pCompositeClip);
     }
 
-    portPriv->clipOrg = pGC->clipOrg;
     portPriv->pCompositeClip = pGC->pCompositeClip;
     portPriv->FreeCompositeClip = FALSE;
     portPriv->subWindowMode = pGC->subWindowMode;
diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
index 7623d29..3191c4c 100644
--- a/hw/xfree86/common/xf86xvpriv.h
+++ b/hw/xfree86/common/xf86xvpriv.h
@@ -67,7 +67,6 @@ typedef struct {
    DrawablePtr pDraw;
    unsigned char type;
    unsigned int subWindowMode;
-   DDXPointRec clipOrg;
    RegionPtr clientClip;
    RegionPtr pCompositeClip;
    Bool FreeCompositeClip;
commit 47d8bd0a999693f47fd244dc876ef7f8fcd52854
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 17:31:14 2010 +0300

    xfree86/xv: Factor out the meat of xf86XVAdjustFrame for later reuse
    
    No functional change.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index f70a2ef..e4c5082 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1035,6 +1035,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
@@ -1269,11 +1303,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;
@@ -1281,33 +1311,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);
 }
 
 
commit 3d4d0237a3981820a9b7290f69c7172a48659a10
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 17:14:34 2010 +0300

    xfree86/xv: Change the behaviour of AdjustFrame to reput everything
    
    Also reput PutVideo/GetVideo ports in AdjustFrame. This makes the
    overlay track the screen panning instead of staying stationary in the
    wrong place.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 59232a8..f70a2ef 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1286,24 +1286,26 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
       XvPortRecPrivatePtr pPriv;
 
       for(i = pa->nPorts; i > 0; i--, pPort++) {
+	Bool visible;
+
 	pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
 
-	if(!pPriv->type && (pPriv->isOn != XV_OFF)) { /* overlaid still/image */
-	  pWin = (WindowPtr)pPriv->pDraw;
+	pWin = (WindowPtr)pPriv->pDraw;
 
-	  if ((pPriv->AdaptorRec->ReputImage) &&
-	     ((pWin->visibility == VisibilityUnobscured) ||
-	      (pWin->visibility == VisibilityPartiallyObscured)))
-	  {
-	      xf86XVReputImage(pPriv);
-	  } else if (pPriv->isOn == XV_ON) {
-	     (*pPriv->AdaptorRec->StopVideo)(
-				 pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
-	     xf86XVRemovePortFromWindow(pWin, pPriv);
-	     pPriv->isOn = XV_PENDING;
-	     continue;
-	  }
-	}
+	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);
      }
   }
 }
commit d794be81218934ad4580211c7a0a27cb71eb5d60
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 18:07:32 2010 +0300

    xfree86/xv: No need to free composite clip in AdjustFrame
    
    Nothing should change in AdjustFrame that would need the composite clip
    to be recomputed.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index cbbff40..59232a8 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1289,12 +1289,6 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
 	pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr;
 
 	if(!pPriv->type && (pPriv->isOn != XV_OFF)) { /* overlaid still/image */
-
-	  if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
-	     RegionDestroy(pPriv->pCompositeClip);
-
-	  pPriv->pCompositeClip = NULL;
-
 	  pWin = (WindowPtr)pPriv->pDraw;
 
 	  if ((pPriv->AdaptorRec->ReputImage) &&
commit 6051c7e940767b7120ad9c7e9188aee6a6f62b94
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 17:05:02 2010 +0300

    xfree86/xv: Change the behaviour of ClipNotify to reput instead of stop
    
    When ClipNotify gets called for a visible window, reput instead of
    stopping the port. This eliminates nasty overlay flickering that
    happens during clip changes.
    
    If the window is invisible or if ReputImage isn't supported stop
    and remove the port from the window as was done before.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 4ed1177..cbbff40 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1116,10 +1116,11 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
   XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
   XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
   XvPortRecPrivatePtr pPriv;
-  Bool visible = (pWin->visibility == VisibilityUnobscured) ||
-		 (pWin->visibility == VisibilityPartiallyObscured);
 
   while(WinPriv) {
+     Bool visible = pWin->visibility == VisibilityUnobscured ||
+		    pWin->visibility == VisibilityPartiallyObscured;
+
      pPriv = WinPriv->PortRec;
 
      if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
@@ -1131,24 +1132,15 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
         (*pPriv->AdaptorRec->ClipNotify)(pPriv->pScrn, pPriv->DevPriv.ptr,
                                          pWin, dx, dy);
 
-     /* Stop everything except images, but stop them too if the
-	window isn't visible.  But we only remove the images. */
-
-     if(pPriv->type || !visible) {
-	if(pPriv->isOn == XV_ON) {
-	    (*pPriv->AdaptorRec->StopVideo)(
-			pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
-	    pPriv->isOn = XV_PENDING;
-	}
-
-	if(!pPriv->type) {  /* overlaid still/image */
-	    WinPriv = WinPriv->next;
-	    xf86XVRemovePortFromWindow(pWin, pPriv);
-	    continue;
-	}
-     }
+     /*
+      * Stop and remove still/images if
+      * ReputImage isn't supported.
+      */
+     if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
+	visible = FALSE;
 
      WinPriv = WinPriv->next;
+     xf86XVReputOrStopPort(pPriv, pWin, visible);
   }
 
   if(ScreenPriv->ClipNotify) {
commit 27707ac5bdf6831630944f02f2128951a529faab
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 17:00:24 2010 +0300

    xfree86/xv: Allow xf86XVReputOrStopPort() to stop PutVideo/GetVideo ports
    
    Modify xf86XVReputOrStopPort() to allow stopping of all types of ports.
    Will be useful later.
    
    No functional change.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 581e8a7..4ed1177 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1007,8 +1007,20 @@ xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
 static void
 xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv,
 		      WindowPtr pWin,
-		      Bool AreasExposed)
+		      Bool visible)
 {
+    if (!visible) {
+	if (pPriv->isOn == XV_ON) {
+	    (*pPriv->AdaptorRec->StopVideo)(pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
+	    pPriv->isOn = XV_PENDING;
+	}
+
+	if (!pPriv->type) /* overlaid still/image*/
+	    xf86XVRemovePortFromWindow(pWin, pPriv);
+
+	return;
+    }
+
     switch (pPriv->type) {
     case XvInputMask:
 	xf86XVReputVideo(pPriv);
@@ -1019,14 +1031,6 @@ xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv,
     default:  /* overlaid still/image*/
 	if (pPriv->AdaptorRec->ReputImage)
 	    xf86XVReputImage(pPriv);
-	else if (AreasExposed) {
-	    if (pPriv->isOn == XV_ON) {
-		(*pPriv->AdaptorRec->StopVideo)(pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
-		pPriv->isOn = XV_PENDING;
-	    }
-
-	    xf86XVRemovePortFromWindow(pWin, pPriv);
-	}
 	break;
     }
 }
@@ -1088,10 +1092,19 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
   if (!pWin->valdata) return;
 
   while(WinPriv) {
+     Bool visible = TRUE;
+
      pPriv = WinPriv->PortRec;
 
+     /*
+      * Stop and remove still/images if areas were exposed and
+      * ReputImage isn't supported.
+      */
+     if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
+	visible = !AreasExposed;
+
      WinPriv = WinPriv->next;
-     xf86XVReputOrStopPort(pPriv, pWin, AreasExposed);
+     xf86XVReputOrStopPort(pPriv, pWin, visible);
   }
 }
 
commit 38987aae199982f17eae664f3a28ff5941d3ee73
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 16:51:24 2010 +0300

    xfree86/xv: Factor out the meat of xf86XVWindowExposures for later reuse
    
    No fucntional change.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index f9b3d93..581e8a7 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1004,6 +1004,33 @@ xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
      portPriv->pDraw = NULL;
 }
 
+static void
+xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv,
+		      WindowPtr pWin,
+		      Bool AreasExposed)
+{
+    switch (pPriv->type) {
+    case XvInputMask:
+	xf86XVReputVideo(pPriv);
+	break;
+    case XvOutputMask:
+	xf86XVRegetVideo(pPriv);
+	break;
+    default:  /* overlaid still/image*/
+	if (pPriv->AdaptorRec->ReputImage)
+	    xf86XVReputImage(pPriv);
+	else if (AreasExposed) {
+	    if (pPriv->isOn == XV_ON) {
+		(*pPriv->AdaptorRec->StopVideo)(pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
+		pPriv->isOn = XV_PENDING;
+	    }
+
+	    xf86XVRemovePortFromWindow(pWin, pPriv);
+	}
+	break;
+    }
+}
+
 /****  ScreenRec fields ****/
 
 static Bool
@@ -1063,32 +1090,8 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
   while(WinPriv) {
      pPriv = WinPriv->PortRec;
 
-     /* Reput anyone with a reput function */
-
-     switch(pPriv->type) {
-     case XvInputMask:
-	xf86XVReputVideo(pPriv);
-	break;
-     case XvOutputMask:
-	xf86XVRegetVideo(pPriv);
-	break;
-     default:  /* overlaid still/image*/
-	if (pPriv->AdaptorRec->ReputImage)
-	   xf86XVReputImage(pPriv);
-	else if(AreasExposed) {
-	    if (pPriv->isOn == XV_ON) {
-		(*pPriv->AdaptorRec->StopVideo)(
-		    pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
-		pPriv->isOn = XV_PENDING;
-	    }
-
-	    WinPriv = WinPriv->next;
-	    xf86XVRemovePortFromWindow(pWin, pPriv);
-	    continue;
-	}
-	break;
-     }
      WinPriv = WinPriv->next;
+     xf86XVReputOrStopPort(pPriv, pWin, AreasExposed);
   }
 }
 
commit 0178173f0579c4b9dd0cf60b9cd3e5d264f86ae4
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 16:39:13 2010 +0300

    xfree86/xv: Eliminate two open coded copies of xf86XVRemovePortFromWindow
    
    No functional change.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 532f0b2..f9b3d93 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1048,7 +1048,6 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
   ScreenPtr pScreen = pWin->drawable.pScreen;
   XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
   XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
-  XF86XVWindowPtr pPrev;
   XvPortRecPrivatePtr pPriv;
   Bool AreasExposed;
 
@@ -1061,8 +1060,6 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
   /* filter out XClearWindow/Area */
   if (!pWin->valdata) return;
 
-  pPrev = NULL;
-
   while(WinPriv) {
      pPriv = WinPriv->PortRec;
 
@@ -1079,28 +1076,18 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
 	if (pPriv->AdaptorRec->ReputImage)
 	   xf86XVReputImage(pPriv);
 	else if(AreasExposed) {
-	    XF86XVWindowPtr tmp;
-
 	    if (pPriv->isOn == XV_ON) {
 		(*pPriv->AdaptorRec->StopVideo)(
 		    pPriv->pScrn, pPriv->DevPriv.ptr, FALSE);
 		pPriv->isOn = XV_PENDING;
 	    }
-	    pPriv->pDraw = NULL;
 
-	    if(!pPrev)
-		dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
-			      WinPriv->next);
-	    else
-	       pPrev->next = WinPriv->next;
-	    tmp = WinPriv;
 	    WinPriv = WinPriv->next;
-	    free(tmp);
+	    xf86XVRemovePortFromWindow(pWin, pPriv);
 	    continue;
 	}
 	break;
      }
-     pPrev = WinPriv;
      WinPriv = WinPriv->next;
   }
 }
@@ -1112,7 +1099,6 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
   ScreenPtr pScreen = pWin->drawable.pScreen;
   XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
   XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
-  XF86XVWindowPtr tmp, pPrev = NULL;
   XvPortRecPrivatePtr pPriv;
   Bool visible = (pWin->visibility == VisibilityUnobscured) ||
 		 (pWin->visibility == VisibilityPartiallyObscured);
@@ -1140,21 +1126,12 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
 	}
 
 	if(!pPriv->type) {  /* overlaid still/image */
-	    pPriv->pDraw = NULL;
-
-	    if(!pPrev)
-		dixSetPrivate(&pWin->devPrivates, XF86XVWindowKey,
-			      WinPriv->next);
-	    else
-	       pPrev->next = WinPriv->next;
-	    tmp = WinPriv;
 	    WinPriv = WinPriv->next;
-	    free(tmp);
+	    xf86XVRemovePortFromWindow(pWin, pPriv);
 	    continue;
 	}
      }
 
-     pPrev = WinPriv;
      WinPriv = WinPriv->next;
   }
 
commit b02858b5af47d524001ec571737cc92f6a6f06d3
Author: Ville Syrjälä <ville.syrjala at nokia.com>
Date:   Fri Oct 29 16:54:42 2010 +0300

    xfree86/xv: Remove useless NULL check from ClipNotify
    
    WinPriv->PortRec should never be NULL as WinPriv itself would be removed
    from the list when the port is removed from the window.
    
    Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
    Reviewed-by: Luc Verhaegen <luc.verhaegen at basyskom.de>

diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 4676130..532f0b2 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -1120,8 +1120,6 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
   while(WinPriv) {
      pPriv = WinPriv->PortRec;
 
-     if(!pPriv) goto next;
- 
      if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
 	RegionDestroy(pPriv->pCompositeClip);
 
@@ -1156,7 +1154,6 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
 	}
      }
 
-next:
      pPrev = WinPriv;
      WinPriv = WinPriv->next;
   }


More information about the xorg-commit mailing list