xf86-video-intel: src/sna/sna_dri2.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 24 13:23:54 UTC 2019


 src/sna/sna_dri2.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 6f4972d5c368c30e971a23c1dc370d3e43761282
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jul 24 14:10:24 2019 +0100

    sna/dri2: Relinquish back-buffer cache on change of scanout status
    
    If we change scanout status (i.e. whether or not this flip chain may be
    presented directly on the CRTC), throwaway the previous back buffer
    cache as those buffers may not be suitable for presentation.
    
    Reported-by: Jiri Slaby <jirislaby at gmail.com>
    References: https://bugs.freedesktop.org/show_bug.cgi?id=111197
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_dri2.c b/src/sna/sna_dri2.c
index 0cbc7599..6426a386 100644
--- a/src/sna/sna_dri2.c
+++ b/src/sna/sna_dri2.c
@@ -198,6 +198,7 @@ struct dri2_window {
 	int64_t msc_delta;
 	struct list cache;
 	uint32_t cache_size;
+	bool cache_scanout;
 };
 
 static struct dri2_window *dri2_window(WindowPtr win)
@@ -229,8 +230,9 @@ sna_dri2_get_back(struct sna *sna,
 	struct kgem_bo *bo;
 	struct dri_bo *c;
 	uint32_t name;
-	int flags;
+	bool scanout;
 	bool reuse;
+	int flags;
 
 	DBG(("%s: draw size=%dx%d, back buffer handle=%d size=%dx%d, is-scanout? %d, active?=%d, pitch=%d, front pitch=%d\n",
 	     __FUNCTION__, draw->width, draw->height,
@@ -241,8 +243,9 @@ sna_dri2_get_back(struct sna *sna,
 	     back->pitch, front_pitch(draw)));
 	assert(priv);
 
+	scanout = use_scanout(sna, draw, priv);
 	size = draw->height << 16 | draw->width;
-	if (size != priv->cache_size) {
+	if (size != priv->cache_size || scanout != priv->cache_scanout) {
 		while (!list_is_empty(&priv->cache)) {
 			c = list_first_entry(&priv->cache, struct dri_bo, link);
 			list_del(&c->link);
@@ -254,11 +257,12 @@ sna_dri2_get_back(struct sna *sna,
 			free(c);
 		}
 		priv->cache_size = size;
+		priv->cache_scanout = scanout;
 	}
 
 	reuse = size == get_private(back)->size;
 	if (reuse)
-		reuse = get_private(back)->bo->scanout == use_scanout(sna, draw, priv);
+		reuse = get_private(back)->bo->scanout >= scanout;
 	DBG(("%s: reuse backbuffer? %d\n", __FUNCTION__, reuse));
 	if (reuse) {
 		bo = get_private(back)->bo;


More information about the xorg-commit mailing list