[PATCH v3 4/6] xf86/xv: Fill color key on expose

Ville Syrjälä ville.syrjala at nokia.com
Mon Jan 24 03:32:27 PST 2011


On Thu, Jan 20, 2011 at 12:46:44AM +0200, ext Pauli wrote:
> From: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
> 
> If window gets exposed but clipboxes doesn't change drivers would avoid
> color key fill. This makes XResizeWindo&co to lose colorkey if
> background is painted.
> 
> To help drivers to avoid filling colorkey for each put server can
> provide helper function if there is exposed areas. Server can subtract
> exposed areas from filled region.
> 
> As a side effect we can avoid useless color key fills if window only
> moves in screen without background fills.
> 
> v3:
> * Change tracking to filled area to account for client initiated clip
>   changes
> * Make overlaid XvPutImage behavior like textured XvPutImage or PutImage
> * Make region dynamically allocated only when required.

Since this thing needs driver side changes anyway, I think we should aim
for simplicity in the driver side. So perhaps something like this:

void
xf86XVFillKeyHelperPort (DrawablePtr pDraw, pointer data, CARD32 key,
                         RegionPtr clipboxes, Bool fillEverything)
{
    XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW((WindowPtr)pDraw);
    XvPortRecPrivatePtr pPriv;
    RegionRec reg;
    RegionPtr fillboxes;

    while (WinPriv) {
	pPriv = WinPriv->PortRec;
	if (pPriv->DevPriv.ptr == data)
	    break;
	WinPriv = WinPriv->next;
    }
    if (!WinPriv)
	return;

    if (!pPriv->ckeyFilled)
	pPriv->ckeyFilled = RegionCreate(NULL, 0);

    if (!fillEverything) {
	RegionNull(&reg);
	RegionSubtract(&reg, clipboxes, pPriv->ckeyFilled);
	fillboxes = &reg;
    } else
	fillboxes = clipboxes;

    if (RegionNotEmpty(fillboxes))
	xf86XVFillKeyHelperDrawable (pDraw, key, fillboxes);

    RegionCopy(pPriv->ckeyFilled, clipboxes);

    if (fillboxes == &reg)
	RegionUninit(&reg);
}

-- 
Ville Syrjälä


More information about the xorg-devel mailing list