sna: Validate framebuffer tiling before creation

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 a10781b70f [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>
This commit is contained in:
Egbert Eich 2014-09-24 08:18:32 +02:00 committed by Chris Wilson
parent b9dddc051d
commit dbe6d105a6
1 changed files with 5 additions and 1 deletions

View File

@ -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);