From 7d9947458d7089799c4b112399b65edf9845f57e Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 14 Jan 2021 19:12:32 +0100 Subject: [PATCH] nouveau/nv50: fix linear buffer alignment for scan-out/cursors The hardware can only scan-out linear buffers with a pitch aligned to 256. It can only use packed buffers for cursors. Signed-off-by: Simon Ser Reviewed-by: Ilia Mirkin Cc: mesa-stable Part-of: (cherry picked from commit a4c11385b7107c89558f3d0e23234bfcb52664a6) --- .pick_status.json | 2 +- src/gallium/drivers/nouveau/nv50/nv50_miptree.c | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 62e050f7bb1..0379e151253 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1939,7 +1939,7 @@ "description": "nouveau/nv50: fix linear buffer alignment for scan-out/cursors", "nominated": true, "nomination_type": 0, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": null }, diff --git a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c index 400ce6c9326..9578fc3d1c7 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c @@ -342,6 +342,7 @@ nv50_miptree_create(struct pipe_screen *pscreen, int ret; union nouveau_bo_config bo_config; uint32_t bo_flags; + unsigned pitch_align; if (!mt) return NULL; @@ -370,10 +371,17 @@ nv50_miptree_create(struct pipe_screen *pscreen, } else if (bo_config.nv50.memtype != 0) { nv50_miptree_init_layout_tiled(mt); - } else - if (!nv50_miptree_init_layout_linear(mt, 64)) { - FREE(mt); - return NULL; + } else { + if (pt->usage & PIPE_BIND_CURSOR) + pitch_align = 1; + else if (pt->usage & PIPE_BIND_SCANOUT) + pitch_align = 256; + else + pitch_align = 64; + if (!nv50_miptree_init_layout_linear(mt, pitch_align)) { + FREE(mt); + return NULL; + } } bo_config.nv50.tile_mode = mt->level[0].tile_mode;