Mesa (staging/20.0): freedreno: Fix calculation of the const buffer cmdstream size.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 28 19:51:57 UTC 2020


Module: Mesa
Branch: staging/20.0
Commit: 8191b916955ae1ab72f013b1505ee701e08beb99
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8191b916955ae1ab72f013b1505ee701e08beb99

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Apr 17 10:45:17 2020 -0700

freedreno: Fix calculation of the const buffer cmdstream size.

The HW packet requires padding the number of pointers you emit, and we
would assertion fail about running out of buffer space if the number of
UBOs to be uploaded was odd.

Fixes: b4df115d3f3c ("freedreno/a6xx: pre-calculate userconst stateobj size")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4621>
(cherry picked from commit 69c8dfd49f565283f599b3be9af3f1327ea78803)

---

 .pick_status.json                                | 2 +-
 src/gallium/drivers/freedreno/a6xx/fd6_program.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index bb929589dde..eb657f4a04d 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -535,7 +535,7 @@
         "description": "freedreno: Fix calculation of the const buffer cmdstream size.",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "b4df115d3f3c7e5a1f6105c3737d0fe9a80dfcf2"
     },
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_program.c b/src/gallium/drivers/freedreno/a6xx/fd6_program.c
index 96bed761579..4411357ffa2 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_program.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_program.c
@@ -1030,7 +1030,7 @@ fd6_shader_state_create(struct pipe_context *pctx, const struct pipe_shader_stat
 
 	/* also account for UBO addresses: */
 	packets += 1;
-	size += 2 * shader->const_state.num_ubos;
+	size += 2 * align(shader->const_state.num_ubos, 2);
 
 	unsigned sizedwords = (4 * packets) + size;
 	shader->ubo_state.cmdstream_size = sizedwords * 4;



More information about the mesa-commit mailing list