summaryrefslogtreecommitdiff
path: root/src/radeon_dri2.c
diff options
context:
space:
mode:
authorMichel Dänzer <michel.daenzer@amd.com>2018-07-10 17:23:24 +0200
committerMichel Dänzer <michel@daenzer.net>2018-07-10 17:23:24 +0200
commit413622bcccc9d36a9c87679f379dc84b21a3c655 (patch)
treea5ee08949f325a788e718e43e773cc913ba196d1 /src/radeon_dri2.c
parent3c4c0213c11d623cba7adbc28dde652694f2f758 (diff)
Swap pixmap privates in radeon_dri2_exchange_buffers
Instead of only the BOs. This matches what amdgpu does, and fixes issues with DRI2 page flipping. Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'src/radeon_dri2.c')
-rw-r--r--src/radeon_dri2.c42
1 files changed, 23 insertions, 19 deletions
diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index ab3db6c5..70ad1d92 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);
}