diff mbox

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

Message ID 1421665245-5994-7-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 enable BufferAge support, we just have to be not using the
DRI2Buffer->flags field for any purpose (i.e. it is always expected to
be 0, as it is now) and to be sure to swap the flags field whenever we
exchange buffers. As nouveau does not exactly support TripleBuffer, we
don't have to worry about setting the copying the flags field when
injecting the third buffer.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
---
 src/nouveau_dri2.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Mario Kleiner May 9, 2015, 4:41 a.m. UTC | #1
On 01/19/2015 12:00 PM, Chris Wilson wrote:
> For enable BufferAge support, we just have to be not using the
> DRI2Buffer->flags field for any purpose (i.e. it is always expected to
> be 0, as it is now) and to be sure to swap the flags field whenever we
> exchange buffers. As nouveau does not exactly support TripleBuffer, we
> don't have to worry about setting the copying the flags field when
> injecting the third buffer.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Maarten Lankhorst <maarten.lankhorst@ubuntu.com>
> Cc: Mario Kleiner <mario.kleiner.de@gmail.com>
> ---
>   src/nouveau_dri2.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c
> index e3445b2..428ef92 100644
> --- a/src/nouveau_dri2.c
> +++ b/src/nouveau_dri2.c
> @@ -711,6 +711,7 @@ nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int frame,
>   		}
>
>   		SWAP(s->dst->name, s->src->name);
> +		SWAP(s->dst->flags, s->src->flags);
>   		SWAP(nouveau_pixmap(dst_pix)->bo, nouveau_pixmap(src_pix)->bo);
>
>   		DamageRegionProcessPending(draw);
> @@ -1003,6 +1004,12 @@ nouveau_dri2_init(ScreenPtr pScreen)
>   	dri2.DestroyBuffer2 = nouveau_dri2_destroy_buffer2;
>   	dri2.CopyRegion2 = nouveau_dri2_copy_region2;
>   #endif
> +
> +#if DRI2INFOREC_VERSION >= 10
> +	dri2.version = 10;
> +	dri2.bufferAge = 1;
> +#endif
> +
>   	return DRI2ScreenInit(pScreen, &dri2);
>   }
>
>

Seems ok to me.

Reviewed-by: Mario Kleiner <mario.kleiner.de@gmail.com>

-mario
diff mbox

Patch

diff --git a/src/nouveau_dri2.c b/src/nouveau_dri2.c
index e3445b2..428ef92 100644
--- a/src/nouveau_dri2.c
+++ b/src/nouveau_dri2.c
@@ -711,6 +711,7 @@  nouveau_dri2_finish_swap(DrawablePtr draw, unsigned int frame,
 		}
 
 		SWAP(s->dst->name, s->src->name);
+		SWAP(s->dst->flags, s->src->flags);
 		SWAP(nouveau_pixmap(dst_pix)->bo, nouveau_pixmap(src_pix)->bo);
 
 		DamageRegionProcessPending(draw);
@@ -1003,6 +1004,12 @@  nouveau_dri2_init(ScreenPtr pScreen)
 	dri2.DestroyBuffer2 = nouveau_dri2_destroy_buffer2;
 	dri2.CopyRegion2 = nouveau_dri2_copy_region2;
 #endif
+
+#if DRI2INFOREC_VERSION >= 10
+	dri2.version = 10;
+	dri2.bufferAge = 1;
+#endif
+
 	return DRI2ScreenInit(pScreen, &dri2);
 }