[PATCH 3/4] xf86/xv: Use PostValidateTree to do reput
Pauli
ext-pauli.nieminen at nokia.com
Fri Jan 14 05:44:23 PST 2011
From: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
ReputImage in Clipnotify happens before background painting. With
automatic color key painting background would be painted on top of
colorkey.
To avoid useless color key painting Reput image should be done after
expose handling. PostValidateTree hook is called after expose handling
which makes it the best option.
Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
---
hw/xfree86/common/xf86xv.c | 72 +++++++++++++--------------------------
hw/xfree86/common/xf86xvpriv.h | 3 +-
2 files changed, 26 insertions(+), 49 deletions(-)
diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
index 87cccc9..95eb2e5 100644
--- a/hw/xfree86/common/xf86xv.c
+++ b/hw/xfree86/common/xf86xv.c
@@ -96,7 +96,7 @@ static int xf86XVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr,
/* ScreenRec fields */
static Bool xf86XVDestroyWindow(WindowPtr pWin);
-static void xf86XVWindowExposures(WindowPtr pWin, RegionPtr r1, RegionPtr r2);
+static void xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind);
static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy);
/* ScrnInfoRec functions */
@@ -281,7 +281,7 @@ xf86XVScreenInit(
pScrn = xf86Screens[pScreen->myNum];
ScreenPriv->DestroyWindow = pScreen->DestroyWindow;
- ScreenPriv->WindowExposures = pScreen->WindowExposures;
+ ScreenPriv->PostValidateTree = pScreen->PostValidateTree;
ScreenPriv->ClipNotify = pScreen->ClipNotify;
ScreenPriv->EnterVT = pScrn->EnterVT;
ScreenPriv->LeaveVT = pScrn->LeaveVT;
@@ -289,7 +289,7 @@ xf86XVScreenInit(
ScreenPriv->ModeSet = pScrn->ModeSet;
pScreen->DestroyWindow = xf86XVDestroyWindow;
- pScreen->WindowExposures = xf86XVWindowExposures;
+ pScreen->PostValidateTree = xf86XVPostValidateTree;
pScreen->ClipNotify = xf86XVClipNotify;
pScrn->EnterVT = xf86XVEnterVT;
pScrn->LeaveVT = xf86XVLeaveVT;
@@ -1067,7 +1067,7 @@ xf86XVReputOrStopPort(XvPortRecPrivatePtr pPriv,
}
static void
-xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn)
+xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn, Bool onlyChanged)
{
ScreenPtr pScreen = pScrn->pScreen;
XvScreenPtr pxvs = GET_XV_SCREEN(pScreen);
@@ -1085,6 +1085,9 @@ xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn)
if (pPriv->isOn == XV_OFF || !pWin)
continue;
+ if (onlyChanged && !pPriv->clipChanged)
+ continue;
+
visible = pWin->visibility == VisibilityUnobscured ||
pWin->visibility == VisibilityPartiallyObscured;
@@ -1096,6 +1099,8 @@ xf86XVReputOrStopAllPorts(ScrnInfoPtr pScrn)
visible = FALSE;
xf86XVReputOrStopPort(pPriv, pWin, visible);
+
+ pPriv->clipChanged = FALSE;
}
}
}
@@ -1134,43 +1139,23 @@ xf86XVDestroyWindow(WindowPtr pWin)
return ret;
}
-
static void
-xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
+xf86XVPostValidateTree(WindowPtr pWin, WindowPtr pLayerWin, VTKind kind)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
- XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
- XvPortRecPrivatePtr pPriv;
- Bool AreasExposed;
-
- AreasExposed = (WinPriv && reg1 && RegionNotEmpty(reg1));
-
- pScreen->WindowExposures = ScreenPriv->WindowExposures;
- (*pScreen->WindowExposures)(pWin, reg1, reg2);
- pScreen->WindowExposures = xf86XVWindowExposures;
-
- /* filter out XClearWindow/Area */
- if (!pWin->valdata) return;
-
- while(WinPriv) {
- Bool visible = TRUE;
-
- pPriv = WinPriv->PortRec;
+ ScreenPtr pScreen = pLayerWin->drawable.pScreen;
+ XF86XVScreenPtr ScreenPriv = GET_XF86XV_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- /*
- * Stop and remove still/images if areas were exposed and
- * ReputImage isn't supported.
- */
- if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
- visible = !AreasExposed;
+ xf86XVReputOrStopAllPorts(pScrn, TRUE);
- WinPriv = WinPriv->next;
- xf86XVReputOrStopPort(pPriv, pWin, visible);
- }
+ if (ScreenPriv->PostValidateTree) {
+ pScreen->PostValidateTree = ScreenPriv->PostValidateTree;
+ (*pScreen->PostValidateTree)(pWin, pLayerWin, kind);
+ ScreenPriv->PostValidateTree = pScreen->PostValidateTree;
+ pScreen->PostValidateTree = xf86XVPostValidateTree;
+ }
}
-
static void
xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
{
@@ -1180,9 +1165,6 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
XvPortRecPrivatePtr pPriv;
while(WinPriv) {
- Bool visible = pWin->visibility == VisibilityUnobscured ||
- pWin->visibility == VisibilityPartiallyObscured;
-
pPriv = WinPriv->PortRec;
if(pPriv->pCompositeClip && pPriv->FreeCompositeClip)
@@ -1194,15 +1176,9 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy)
(*pPriv->AdaptorRec->ClipNotify)(pPriv->pScrn, pPriv->DevPriv.ptr,
pWin, dx, dy);
- /*
- * Stop and remove still/images if
- * ReputImage isn't supported.
- */
- if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
- visible = FALSE;
+ pPriv->clipChanged = TRUE;
WinPriv = WinPriv->next;
- xf86XVReputOrStopPort(pPriv, pWin, visible);
}
if(ScreenPriv->ClipNotify) {
@@ -1228,7 +1204,7 @@ xf86XVCloseScreen(int i, ScreenPtr pScreen)
if(!ScreenPriv) return TRUE;
pScreen->DestroyWindow = ScreenPriv->DestroyWindow;
- pScreen->WindowExposures = ScreenPriv->WindowExposures;
+ pScreen->PostValidateTree = ScreenPriv->PostValidateTree;
pScreen->ClipNotify = ScreenPriv->ClipNotify;
pScrn->EnterVT = ScreenPriv->EnterVT;
@@ -1335,7 +1311,7 @@ xf86XVAdjustFrame(int index, int x, int y, int flags)
pScrn->AdjustFrame = xf86XVAdjustFrame;
}
- xf86XVReputOrStopAllPorts(pScrn);
+ xf86XVReputOrStopAllPorts(pScrn, FALSE);
}
static void
@@ -1356,7 +1332,7 @@ xf86XVModeSet(ScrnInfoPtr pScrn)
pScrn->ModeSet = xf86XVModeSet;
}
- xf86XVReputOrStopAllPorts(pScrn);
+ xf86XVReputOrStopAllPorts(pScrn, FALSE);
}
/**** XvAdaptorRec fields ****/
diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
index c667926..99c0c79 100644
--- a/hw/xfree86/common/xf86xvpriv.h
+++ b/hw/xfree86/common/xf86xvpriv.h
@@ -39,7 +39,7 @@ extern _X_EXPORT DevPrivateKey XF86XvScreenKey;
typedef struct {
DestroyWindowProcPtr DestroyWindow;
ClipNotifyProcPtr ClipNotify;
- WindowExposuresProcPtr WindowExposures;
+ PostValidateTreeProcPtr PostValidateTree;
void (*AdjustFrame)(int, int, int, int);
Bool (*EnterVT)(int, int);
void (*LeaveVT)(int, int);
@@ -73,6 +73,7 @@ typedef struct {
XvAdaptorRecPrivatePtr AdaptorRec;
XvStatus isOn;
Bool moved;
+ Bool clipChanged;
int vid_x, vid_y, vid_w, vid_h;
int drw_x, drw_y, drw_w, drw_h;
DevUnion DevPriv;
--
1.7.0.4
More information about the xorg-devel
mailing list