[PATCH xf86-video-ati] Swap pixmap privates in radeon_dri2_exchange_buffers
Alex Deucher
alexdeucher at gmail.com
Tue Jul 10 17:14:59 UTC 2018
On Tue, Jul 10, 2018 at 11:24 AM, Michel Dänzer <michel at daenzer.net> wrote:
> From: Michel Dänzer <michel.daenzer at amd.com>
>
> Instead of only the BOs.
>
> This matches what amdgpu does, and fixes issues with DRI2 page flipping.
>
> Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> src/radeon_dri2.c | 42 +++++++++++++++++++++++-------------------
> 1 file changed, 23 insertions(+), 19 deletions(-)
>
> diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
> index ab3db6c5e..70ad1d92a 100644
> --- a/src/radeon_dri2.c
> +++ b/src/radeon_dri2.c
> @@ -720,9 +720,8 @@ radeon_dri2_exchange_buffers(DrawablePtr draw, DRI2BufferPtr front, DRI2BufferPt
> {
> struct dri2_buffer_priv *front_priv = front->driverPrivate;
> struct dri2_buffer_priv *back_priv = back->driverPrivate;
> - struct radeon_buffer *front_buffer, *back_buffer;
> - ScreenPtr screen;
> - RADEONInfoPtr info;
> + ScreenPtr screen = draw->pScreen;
> + RADEONInfoPtr info = RADEONPTR(xf86ScreenToScrn(screen));
> RegionRec region;
> int tmp;
>
> @@ -737,23 +736,28 @@ radeon_dri2_exchange_buffers(DrawablePtr draw, DRI2BufferPtr front, DRI2BufferPt
> front->name = back->name;
> back->name = tmp;
>
> - /* Swap pixmap bos */
> - front_buffer = radeon_get_pixmap_bo(front_priv->pixmap);
> - back_buffer = radeon_get_pixmap_bo(back_priv->pixmap);
> - radeon_set_pixmap_bo(front_priv->pixmap, back_buffer);
> - radeon_set_pixmap_bo(back_priv->pixmap, front_buffer);
> -
> - /* Do we need to update the Screen? */
> - screen = draw->pScreen;
> - info = RADEONPTR(xf86ScreenToScrn(screen));
> - if (front_buffer == info->front_buffer) {
> - radeon_buffer_ref(back_buffer);
> - radeon_buffer_unref(&info->front_buffer);
> - info->front_buffer = back_buffer;
> - radeon_set_pixmap_bo(screen->GetScreenPixmap(screen), back_buffer);
> - }
> + /* Swap pixmap privates */
> +#ifdef USE_GLAMOR
> + if (info->use_glamor) {
> + struct radeon_pixmap *front_pix, *back_pix;
> +
> + front_pix = radeon_get_pixmap_private(front_priv->pixmap);
> + back_pix = radeon_get_pixmap_private(back_priv->pixmap);
> + radeon_set_pixmap_private(front_priv->pixmap, back_pix);
> + radeon_set_pixmap_private(back_priv->pixmap, front_pix);
>
> - radeon_glamor_exchange_buffers(front_priv->pixmap, back_priv->pixmap);
> + radeon_glamor_exchange_buffers(front_priv->pixmap, back_priv->pixmap);
> + } else
> +#endif
> + {
> + struct radeon_exa_pixmap_priv driver_priv = *(struct radeon_exa_pixmap_priv*)
> + exaGetPixmapDriverPrivate(front_priv->pixmap);
> +
> + *(struct radeon_exa_pixmap_priv*)exaGetPixmapDriverPrivate(front_priv->pixmap) =
> + *(struct radeon_exa_pixmap_priv*)exaGetPixmapDriverPrivate(back_priv->pixmap);
> + *(struct radeon_exa_pixmap_priv*)exaGetPixmapDriverPrivate(back_priv->pixmap) =
> + driver_priv;
> + }
>
> DamageRegionProcessPending(&front_priv->pixmap->drawable);
> }
> --
> 2.18.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
More information about the amd-gfx
mailing list