File U_sna-Validate-framebuffer-tiling-before-creation.patch of Package xf86-video-intel

From: Egbert Eich <eich@suse.de>
Date: Wed Sep 24 08:18:32 2014 +0200
Subject: [PATCH]sna: Validate framebuffer tiling before creation
Patch-mainline: to be upstreamed
Git-commit: dbe6d105a60ff28419b549d439bbb29f50b28f08
Git-repo: git://anongit.freedesktop.org/git/xorg/driver/xf86-video-intel
References: bnc#898169
Signed-off-by: Egbert Eich <eich@suse.com>

In sna_pixmap_alloc_gpu() a different than the default tiling may be picked
by a usage hint. Before passing the tiling to kgem_create_2d() fix it up
by calling kgem_choose_tiling(). This avoids kgem_surface_size() not being able
to find a surface size for the tiling value.

Fixes regression from

commit a10781b70f222f3997928fa979f6292617f79316 [2.99.913]
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Tue Jul 1 15:11:07 2014 +0100

    sna: Enforce LinearFramebuffer option

Signed-off-by: Egbert Eich <eich@freedesktop.org>
---
 src/sna/sna_accel.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index ab43831..37e1e7c 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -1617,7 +1617,11 @@ static bool sna_pixmap_alloc_gpu(struct sna *sna,
 	/* Use tiling by default, but disable per user request */
 	if (pixmap->usage_hint == SNA_CREATE_FB && (sna->flags & SNA_LINEAR_FB) == 0) {
 		flags |= CREATE_SCANOUT;
-		tiling = -I915_TILING_X;
+		tiling = kgem_choose_tiling(&sna->kgem,
+					    -I915_TILING_X,
+					    pixmap->drawable.width,
+					    pixmap->drawable.height,
+					    pixmap->drawable.bitsPerPixel);
 	} else
 		tiling = sna_pixmap_default_tiling(sna, pixmap);
 
openSUSE Build Service is sponsored by