pan/indirect_draw: Don't upload garbage UBO
authorAlyssa Rosenzweig <alyssa@collabora.com>
Mon, 13 Dec 2021 20:18:56 +0000 (15:18 -0500)
committerMarge Bot <emma+marge@anholt.net>
Mon, 20 Dec 2021 18:21:40 +0000 (18:21 +0000)
There should never be a CPU pointer in GPU memory, let's say that...

Fixes: 2e6d94c198e ("panfrost: Add helpers to support indirect draws")
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14154>

src/panfrost/lib/pan_indirect_draw.c

index f2b73fb..06c7183 100644 (file)
@@ -1171,15 +1171,15 @@ get_ubos(struct pan_pool *pool,
          const struct indirect_draw_inputs *inputs)
 {
         struct panfrost_ptr inputs_buf =
-                pan_pool_alloc_aligned(pool, sizeof(inputs), 16);
+                pan_pool_alloc_aligned(pool, sizeof(*inputs), 16);
 
-        memcpy(inputs_buf.cpu, &inputs, sizeof(inputs));
+        memcpy(inputs_buf.cpu, inputs, sizeof(*inputs));
 
         struct panfrost_ptr ubos_buf =
                 pan_pool_alloc_desc(pool, UNIFORM_BUFFER);
 
         pan_pack(ubos_buf.cpu, UNIFORM_BUFFER, cfg) {
-                cfg.entries = DIV_ROUND_UP(sizeof(inputs), 16);
+                cfg.entries = DIV_ROUND_UP(sizeof(*inputs), 16);
                 cfg.pointer = inputs_buf.gpu;
         }