Mesa (master): lima: set uniforms_address lower bits properly

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Sep 28 17:51:28 UTC 2019


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

Author: Vasily Khoruzhick <anarsoul at gmail.com>
Date:   Sat Sep 28 09:57:55 2019 -0700

lima: set uniforms_address lower bits properly

Looks like blob uses following values for uniforms buffer:

0 for 8 bytes
1 for 16 bytes
2 for 24 bytes
2 for 32 bytes
3 for 40 bytes
3 for 48 bytes
3 for 56 bytes
3 for 64 bytes
4 for 72 bytes

It all looks like log2(size / 8) rounded up, so let's do the same.

Fixes: 931fc2a7b3f9("lima: do not set the PP uniforms address lowest bits")
Reviewed-by: Icenowy Zheng <icenowy at aosc.io>
Signed-off-by: Vasily Khoruzhick <anarsoul at gmail.com>

---

 src/gallium/drivers/lima/lima_draw.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/gallium/drivers/lima/lima_draw.c b/src/gallium/drivers/lima/lima_draw.c
index 0449eaba7cd..bd6b62a3bb6 100644
--- a/src/gallium/drivers/lima/lima_draw.c
+++ b/src/gallium/drivers/lima/lima_draw.c
@@ -1086,6 +1086,14 @@ lima_pack_render_state(struct lima_context *ctx, const struct pipe_draw_info *in
    if (ctx->const_buffer[PIPE_SHADER_FRAGMENT].buffer) {
       render->uniforms_address =
          lima_ctx_buff_va(ctx, lima_ctx_buff_pp_uniform_array, LIMA_CTX_BUFF_SUBMIT_PP);
+      uint32_t size = ctx->buffer_state[lima_ctx_buff_pp_uniform].size;
+      uint32_t bits = 0;
+      if (size >= 8) {
+         bits = util_last_bit(size >> 3) - 1;
+         bits += size & u_bit_consecutive(0, bits + 3) ? 1 : 0;
+      }
+      render->uniforms_address |= bits > 0xf ? 0xf : bits;
+
       render->aux0 |= 0x80;
       render->aux1 |= 0x10000;
    }




More information about the mesa-commit mailing list