diff options
author | Philip Langdale <philipl@fido2.homeip.net> | 2008-07-21 15:23:50 -0700 |
---|---|---|
committer | Philip Langdale <philipl@fido2.homeip.net> | 2008-07-21 15:23:50 -0700 |
commit | ad8f17dec71632d0e606af1bea9432ece0bc97db (patch) | |
tree | 8ce62aa2f9d9826ffbbfae263adc372eba101e6d | |
parent | 71f1ca515cd1b3d92397682f4fcea120c392b26e (diff) |
Video Overlay: Handle clipping correctly with AutoPaint colorkey.
We recently added XV_AUTOPAINT_COLORKEY attribute to the X video driver
to enable applications like Real player that rely on this attribute to
display video frames in Linux guest.
When this attribute is SET, we paint the colorkey on 1st frame and from
there on only when the video is moved.
This introduced a bug 305202 with clipping.
Consider a case when the video is playing, obscure the player window
with another window, without moving the player window, move the other
window away. The part of the window that was obscured didn't display
the video.
With this patch instead of relying on the target rectangle, we use
the clipBoxes supplied in every frame.
-rw-r--r-- | src/vmwarevideo.c | 54 |
1 files changed, 10 insertions, 44 deletions
diff --git a/src/vmwarevideo.c b/src/vmwarevideo.c index b4b1183..59c25fe 100644 --- a/src/vmwarevideo.c +++ b/src/vmwarevideo.c @@ -165,7 +165,7 @@ struct VMWAREVideoRec { uint32 colorKey; Bool isAutoPaintColorkey; uint32 flags; - BoxRec position; + RegionRec clipBoxes; VMWAREVideoFmtData *fmt_priv; }; @@ -226,8 +226,6 @@ static void vmwareVideoFlush(VMWAREPtr pVMWARE, uint32 streamId); static void vmwareVideoSetOneReg(VMWAREPtr pVMWARE, uint32 streamId, uint32 regId, uint32 value); static void vmwareVideoEndStream(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid); -static Bool vmwareVideoMoved(VMWAREVideoPtr pVid, short drw_x, - short drw_y, short drw_w, short drw_h); /* * Offscreen memory manager functions @@ -660,10 +658,7 @@ static int vmwareVideoInitStream(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid, } pVid->currBuf = 0; - pVid->position.x1 = drw_x; - pVid->position.y1 = drw_y; - pVid->position.x2 = drw_w; - pVid->position.y2 = drw_h; + REGION_COPY(pScrn->pScreen, &pVid->clipBoxes, clipBoxes); if (pVid->isAutoPaintColorkey) { xf86XVFillKeyHelper(pScrn->pScreen, pVid->colorKey, clipBoxes); @@ -828,21 +823,18 @@ static int vmwareVideoPlay(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid, vmwareWriteWordToFIFO(pVMWARE, fifoItem[i]); } - if (pVid->isAutoPaintColorkey && - vmwareVideoMoved(pVid, drw_x, drw_y, drw_w, drw_h)) { - xf86XVFillKeyHelper(pScrn->pScreen, pVid->colorKey, clipBoxes); + /* + * Update the clipList and paint the colorkey, if required. + */ + if (!REGION_EQUAL(pScrn->pScreen, &pVid->clipBoxes, clipBoxes)) { + REGION_COPY(pScrn->pScreen, &pVid->clipBoxes, clipBoxes); + if (pVid->isAutoPaintColorkey) { + xf86XVFillKeyHelper(pScrn->pScreen, pVid->colorKey, clipBoxes); + } } vmwareVideoFlush(pVMWARE, pVid->streamId); - /* - * Update the position of the video frame. - */ - pVid->position.x1 = drw_x; - pVid->position.y1 = drw_y; - pVid->position.x2 = drw_w; - pVid->position.y2 = drw_h; - pVid->currBuf = ++pVid->currBuf & (VMWARE_VID_NUM_BUFFERS - 1); return Success; @@ -1005,32 +997,6 @@ static void vmwareVideoEndStream(ScrnInfoPtr pScrn, VMWAREVideoPtr pVid) /* *----------------------------------------------------------------------------- * - * vmwareVideoMoved -- - * - * Detects whether the video frame has changed its position. - * - * Results: - * TRUE if the position has changed, FALSE otherwise. - * - * Side effects: - * None. - * - *----------------------------------------------------------------------------- - */ - -static Bool vmwareVideoMoved(VMWAREVideoPtr pVid, short drw_x, - short drw_y, short drw_w, short drw_h) -{ - return !(pVid->position.x1 == drw_x && - pVid->position.y1 == drw_y && - pVid->position.x2 == drw_w && - pVid->position.y2 == drw_h); -} - - -/* - *----------------------------------------------------------------------------- - * * vmwareXvPutImage -- * * Main video playback function. It copies the passed data which is in |