diff mbox

[xf86-video-ati] dri2: Enable BufferAge support

Message ID 1421665245-5994-6-git-send-email-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Jan. 19, 2015, 11 a.m. UTC
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 <chris@chris-wilson.co.uk>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Michel Dänzer <michel.daenzer@amd.com>
---
 src/radeon_dri2.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Alex Deucher Jan. 20, 2015, 4:47 p.m. UTC | #1
On Mon, Jan 19, 2015 at 6:00 AM, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> 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 <chris@chris-wilson.co.uk>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: Jerome Glisse <jglisse@redhat.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Michel Dänzer <michel.daenzer@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@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
>
> _______________________________________________
> xorg-devel@lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
diff mbox

Patch

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;
 }