Mesa (master): nouveau/nvc0: fix linear buffer alignment for scan-out/cursors
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sun Feb 7 18:18:00 UTC 2021
Module: Mesa
Branch: master
Commit: 6650c53e64198d1b2a283778e620be8458765dae
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6650c53e64198d1b2a283778e620be8458765dae
Author: Simon Ser <contact at emersion.fr>
Date: Thu Jan 14 19:02:41 2021 +0100
nouveau/nvc0: 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 <contact at emersion.fr>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
Closes: https://gitlab.freedesktop.org/drm/nouveau/-/issues/36
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8500>
---
src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
index a095515e48d..c8e94d6ad7b 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
@@ -377,6 +377,7 @@ nvc0_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;
@@ -421,10 +422,19 @@ nvc0_miptree_create(struct pipe_screen *pscreen,
} else
if (likely(bo_config.nvc0.memtype)) {
nvc0_miptree_init_layout_tiled(mt);
- } else
- if (!nv50_miptree_init_layout_linear(mt, 128)) {
- FREE(mt);
- return NULL;
+ } else {
+ /* When modifiers are supplied, usage is zero. TODO: detect the
+ * modifiers+cursor case. */
+ if (pt->usage & PIPE_BIND_CURSOR)
+ pitch_align = 1;
+ else if ((pt->usage & PIPE_BIND_SCANOUT) || count > 0)
+ pitch_align = 256;
+ else
+ pitch_align = 128;
+ if (!nv50_miptree_init_layout_linear(mt, pitch_align)) {
+ FREE(mt);
+ return NULL;
+ }
}
bo_config.nvc0.tile_mode = mt->level[0].tile_mode;
More information about the mesa-commit
mailing list