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

Michel Dänzer michel at daenzer.net
Thu May 5 03:28:20 PDT 2011


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.


-- 
Earthling Michel Dänzer           |                http://www.vmware.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the xorg-devel mailing list