[PATCH xf86-video-ati 1/2] dri2: Update front buffer pixmap and name before exchanging buffers

Ville Syrjälä syrjala at sci.fi
Mon May 30 14:30:48 PDT 2011


On Thu, May 05, 2011 at 05:30:23PM +0300, Ville Syrjälä wrote:
> On Thu, May 05, 2011 at 12:28:20PM +0200, Michel Dänzer wrote:
> > On Mit, 2011-05-04 at 23:51 +0300, Ville Syrjala wrote: 
> > > Buffer exchange assumes that the front buffer pixmap and name
> > > information is accurate. That may not be the case eg. if the window
> > > has been (un)redirected since the buffer was created.
> > > 
> > > Signed-off-by: Ville Syrjala <syrjala at sci.fi>
> > > ---
> > >  src/radeon_dri2.c |   45 ++++++++++++++++++++++++++++++++++++++++-----
> > >  1 files changed, 40 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
> > > index e618cc5..5d1a382 100644
> > > --- a/src/radeon_dri2.c
> > > +++ b/src/radeon_dri2.c
> > > @@ -626,12 +626,42 @@ radeon_dri2_schedule_flip(ScrnInfoPtr scrn, ClientPtr client,
> > >  }
> > >  
> > >  static Bool
> > > -can_exchange(ScrnInfoPtr pScrn,
> > > +update_front(DrawablePtr draw, DRI2BufferPtr front)
> > > +{
> > > +    int r;
> > > +    PixmapPtr pixmap;
> > > +    struct dri2_buffer_priv *priv = front->driverPrivate;
> > > +    struct radeon_exa_pixmap_priv *driver_priv;
> > > +
> > > +    if (draw->type == DRAWABLE_PIXMAP)
> > > +	pixmap = (PixmapPtr)draw;
> > > +    else
> > > +	pixmap = (*draw->pScreen->GetWindowPixmap)((WindowPtr)draw);
> > > +
> > > +    pixmap->refcnt++;
> > > +
> > > +    exaMoveInPixmap(pixmap);
> > > +    driver_priv = exaGetPixmapDriverPrivate(pixmap);
> > > +    r = radeon_gem_get_kernel_name(driver_priv->bo, &front->name);
> > > +    if (r) {
> > > +	(*draw->pScreen->DestroyPixmap)(pixmap);
> > > +	return FALSE;
> > > +    }
> > > +    (*draw->pScreen->DestroyPixmap)(priv->pixmap);
> > > +    front->pitch = pixmap->devKind;
> > > +    front->cpp = pixmap->drawable.bitsPerPixel / 8;
> > > +    priv->pixmap = pixmap;
> > > +
> > > +    return TRUE;
> > > +}
> > 
> > Maybe at least some of this could be short-circuited if it's still the
> > same pixmap.
> 
> Yeah, I had the same thought. There's one catch though; Even if it's the
> same pixmap, the bo may have been exchanged, and so the buffer name may
> need to be updated anyway.

Haven't had time to look at this at all. If no one else wants to take
this on I'd suggest merging these patches ASAP to make page flipping +
compiz fullscreen unredirect feature actually work.

-- 
Ville Syrjälä
syrjala at sci.fi
http://www.sci.fi/~syrjala/


More information about the xorg-devel mailing list