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

Pauli Nieminen ext-pauli.nieminen at nokia.com
Tue Jan 18 10:20:48 PST 2011


On 18/01/11 19:51 +0200, Ville Syrjälä wrote:
> On Tue, Jan 18, 2011 at 03:37:17PM +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. Exposed areas can be
> > stored in portPriv.
> > 
> > As a side effect we can avoid useless color key fills if window only
> > moves in screen.
> > 
> > Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
> > ---
> >  hw/xfree86/common/xf86xv.c     |   51 ++++++++++++++++++++++++++++++++++++----
> >  hw/xfree86/common/xf86xv.h     |    7 ++++-
> >  hw/xfree86/common/xf86xvpriv.h |    1 +
> >  3 files changed, 52 insertions(+), 7 deletions(-)
> > 
> > diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c
> > index 6dcd497..95099c2 100644
> > --- a/hw/xfree86/common/xf86xv.c
> > +++ b/hw/xfree86/common/xf86xv.c
> > @@ -590,6 +590,7 @@ xf86XVInitAdaptors(
> >  	  portPriv->pScrn = pScrn;
> >  	  portPriv->AdaptorRec = adaptorPriv;
> >  	  portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr;
> > +	  RegionNull(&portPriv->exposedAreas);
> >  
> >  	  pp++;
> >  	  numPort++;
> > @@ -1007,6 +1008,8 @@ xf86XVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
> >     }
> >  
> >     portPriv->pDraw = (DrawablePtr)pWin;
> > +   /* Make sure hat auto color key is going to be filled */
> > +   RegionCopy(&portPriv->exposedAreas, &pWin->clipList);
> >  
> >     return Success;
> >  }
> > @@ -1033,6 +1036,7 @@ xf86XVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv)
> >  	winPriv = winPriv->next;
> >       }
> >       portPriv->pDraw = NULL;
> > +     RegionEmpty(&portPriv->exposedAreas);
> >  }
> >  
> >  static void
> > @@ -1120,6 +1124,7 @@ xf86XVDestroyWindow(WindowPtr pWin)
> >       }
> >  
> >       pPriv->pDraw = NULL;
> > +     RegionEmpty(&pPriv->exposedAreas);
> >       tmp = WinPriv;
> >       WinPriv = WinPriv->next;
> >       free(tmp);
> > @@ -1165,6 +1170,13 @@ xf86XVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2)
> >       if (!pPriv->type && !pPriv->AdaptorRec->ReputImage)
> >  	visible = !AreasExposed;
> >  
> > +     if (visible) {
> > +        RegionRec tmp;
> 
> RegionNull(&tmp) is needed...
>

Right.

That call went to wrong patch.

> > +        RegionCopy(&tmp, reg1);
> 
> ..otherwise this may do bad things.
> 
> > +        RegionTranslate(&tmp, pWin->drawable.x, pWin->drawable.y);
> > +        RegionUnion(&pPriv->exposedAreas, &pPriv->exposedAreas, &tmp);
> > +     }
> > +
> >       WinPriv = WinPriv->next;
> >       xf86XVReputOrStopPort(pPriv, pWin, visible);
> >    }
> > @@ -1859,13 +1871,42 @@ xf86XVQueryImageAttributes(
> >  			format->id, width, height, pitches, offsets);
> >  }
> >  
> > +Bool
> > +xf86XVGetPortFillArea (DrawablePtr pDraw, pointer data, RegionPtr clipboxes, RegionPtr fillboxes)
> > +{
> > +    WindowPtr pWin = (WindowPtr)pDraw;
> > +    XF86XVWindowPtr WinPriv = GET_XF86XV_WINDOW(pWin);
> > +    XvPortRecPrivatePtr portPriv = NULL;
> > +
> > +    while (WinPriv) {
> > +	XvPortRecPrivatePtr pPriv = WinPriv->PortRec;
> > +
> > +	if (data == pPriv->DevPriv.ptr) {
> > +	    portPriv = pPriv;
> > +	    break;
> > +	}
> > +
> > +	WinPriv = WinPriv->next;
> > +    }
> > +
> > +    if (!portPriv)
> > +	return FALSE;
> > +
> > +    RegionIntersect(fillboxes, clipboxes, &portPriv->exposedAreas);
> > +    RegionEmpty(&portPriv->exposedAreas);
> > +    if (RegionNotEmpty(fillboxes))
> > +        return TRUE;
> > +
> > +    return FALSE;
> 
> return RegionNotEmpty(fillboxes);
> 
> > +}
> > +
> >  void
> > -xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
> > +xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr fillboxes)
> >  {
> >     ScreenPtr pScreen = pDraw->pScreen;
> >     ChangeGCVal pval[2];
> > -   BoxPtr pbox = RegionRects(clipboxes);
> > -   int i, nbox = RegionNumRects(clipboxes);
> > +   BoxPtr pbox = RegionRects(fillboxes);
> > +   int i, nbox = RegionNumRects(fillboxes);
> >     xRectangle *rects;
> >     GCPtr gc;
> >  
> > @@ -1894,9 +1935,9 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
> >  }
> >  
> >  void
> > -xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes)
> > +xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr fillboxes)
> >  {
> > -    xf86XVFillKeyHelperDrawable (&pScreen->root->drawable, key, clipboxes);
> > +    xf86XVFillKeyHelperDrawable (&pScreen->root->drawable, key, fillboxes);
> >  }
> >  
> >  /* xf86XVClipVideoHelper -
> > diff --git a/hw/xfree86/common/xf86xv.h b/hw/xfree86/common/xf86xv.h
> > index 47061fe..3243ccc 100644
> > --- a/hw/xfree86/common/xf86xv.h
> > +++ b/hw/xfree86/common/xf86xv.h
> > @@ -239,10 +239,13 @@ extern _X_EXPORT XF86VideoAdaptorPtr xf86XVAllocateVideoAdaptorRec(ScrnInfoPtr p
> >  extern _X_EXPORT void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr);
> >  
> >  extern _X_EXPORT void
> > -xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes);
> > +xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr fillboxes);
> >  
> >  extern _X_EXPORT void
> > -xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes);
> > +xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr fillboxes);
> > +
> > +extern _X_EXPORT Bool
> > +xf86XVGetPortFillArea (DrawablePtr pDraw, pointer data, RegionPtr clipboxes, RegionPtr fillboxes);
> >  
> >  extern _X_EXPORT Bool
> >  xf86XVClipVideoHelper(
> > diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h
> > index 4572218..563b55a 100644
> > --- a/hw/xfree86/common/xf86xvpriv.h
> > +++ b/hw/xfree86/common/xf86xvpriv.h
> > @@ -72,6 +72,7 @@ typedef struct {
> >     Bool FreeCompositeClip;
> >     XvAdaptorRecPrivatePtr AdaptorRec;
> >     XvStatus isOn;
> > +   RegionRec exposedAreas;
> >     int vid_x, vid_y, vid_w, vid_h;
> >     int drw_x, drw_y, drw_w, drw_h;
> >     DevUnion DevPriv;
> > -- 
> > 1.7.0.4
> > 
> > _______________________________________________
> > xorg-devel at lists.x.org: X.Org development
> > Archives: http://lists.x.org/archives/xorg-devel
> > Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 
> -- 
> Ville Syrjälä


More information about the xorg-devel mailing list