For BufferAge support, we just have to guarrantee that we were not using
the DRI2Buffer->flags field for anything else (i.e. it is always 0) and
then to make sure that we exchange the flags field after buffer
exchanges. radeon does not support TripleBuffering so we do not have to
worry about perserving the flags when injecting the third buffer.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Cc: Dave Airlie <airl...@redhat.com>
Cc: Jerome Glisse <jgli...@redhat.com>
Cc: Alex Deucher <alexander.deuc...@amd.com>
Cc: Michel Dänzer <michel.daen...@amd.com>
---
 src/radeon_dri2.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/radeon_dri2.c b/src/radeon_dri2.c
index 0fbe96c..091cd06 100644
--- a/src/radeon_dri2.c
+++ b/src/radeon_dri2.c
@@ -764,6 +764,11 @@ radeon_dri2_exchange_buffers(DrawablePtr draw, 
DRI2BufferPtr front, DRI2BufferPt
     front->name = back->name;
     back->name = tmp;
 
+    /* Swap flags so BufferAge works */
+    tmp = front->flags;
+    front->flags = back->flags;
+    back->flags = tmp;
+
     /* Swap pixmap bos */
     front_bo = radeon_get_pixmap_bo(front_priv->pixmap);
     back_bo = radeon_get_pixmap_bo(back_priv->pixmap);
@@ -1647,6 +1652,11 @@ radeon_dri2_screen_init(ScreenPtr pScreen)
     dri2_info.CopyRegion2 = radeon_dri2_copy_region2;
 #endif
 
+#if DRI2INFOREC_VERSION >= 10
+    dri2_info.version = 10;
+    dri2_info.bufferAge = 1;
+#endif
+
     info->dri2.enabled = DRI2ScreenInit(pScreen, &dri2_info);
     return info->dri2.enabled;
 }
-- 
2.1.4

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to