Mesa (master): freedreno: Fix calculation of the const buffer cmdstream size.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Apr 27 22:27:13 UTC 2020


Module: Mesa
Branch: master
Commit: 69c8dfd49f565283f599b3be9af3f1327ea78803
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=69c8dfd49f565283f599b3be9af3f1327ea78803

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>

---

 src/gallium/drivers/freedreno/a6xx/fd6_program.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_program.c b/src/gallium/drivers/freedreno/a6xx/fd6_program.c
index 6e19deee03e..fa98aae546f 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