From a33a96a3533bef4dd6276d980632cfa5a2069813 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Fri, 6 Oct 2017 15:10:25 +0100 Subject: [PATCH xf86-video-intel] sna: Skip the exact match if we can't change tiling If we can't change tiling on the cached bo and we expect an exact match (for e.g. scanout) then skip over the unwanted bo. Reported-by: Adric Blake References: https://bugs.freedesktop.org/show_bug.cgi?id=103025#c5 Signed-off-by: Chris Wilson --- src/sna/kgem.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/sna/kgem.c b/src/sna/kgem.c index b8338237..122dda71 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -5536,9 +5536,16 @@ struct kgem_bo *kgem_create_2d(struct kgem *kgem, if (num_pages(bo) < size) continue; - if (!kgem_set_tiling(kgem, bo, tiling, pitch) && - !exact) + if (!kgem_set_tiling(kgem, bo, tiling, pitch)) { + if (exact) { + DBG(("tiled and pitch not exact: tiling=%d, (want %d), pitch=%d, need %d\n", + bo->tiling, tiling, + bo->pitch, pitch)); + continue; + } + set_gpu_tiling(kgem, bo, tiling, pitch); + } } kgem_bo_remove_from_active(kgem, bo); @@ -5712,9 +5719,16 @@ search_active: if (num_pages(bo) < size) continue; - if (!kgem_set_tiling(kgem, bo, tiling, pitch) && - !exact) + if (!kgem_set_tiling(kgem, bo, tiling, pitch)) { + if (exact) { + DBG(("tiled and pitch not exact: tiling=%d, (want %d), pitch=%d, need %d\n", + bo->tiling, tiling, + bo->pitch, pitch)); + continue; + } + set_gpu_tiling(kgem, bo, tiling, pitch); + } } assert(bo->tiling == tiling); assert(bo->pitch >= pitch); -- 2.14.2