From 83b8687264d26905948d143a42001a1bf3d31b2a Mon Sep 17 00:00:00 2001 From: Emma Anholt Date: Mon, 5 Dec 2022 14:52:07 -0800 Subject: [PATCH] turnip: Initialize *memory on 0-sized alloc early exit. Otherwise, making a CS using the memory will use the uninitialized .map value (when checking the size of the CS in in begin's tu_cs_is_empty() check), causing valgrind noise in dEQP-VK.binding_model.descriptorset_random.sets4.dynindexed.ubolimitlow.sbolimitlow.sampledimghigh.lowimgsingletex.iublimitlow.nouab.vert.noia.0 (thanks to vi_info->vertexBindingDescriptionCount==0). Part-of: --- src/freedreno/vulkan/tu_cs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/freedreno/vulkan/tu_cs.c b/src/freedreno/vulkan/tu_cs.c index 0bfb8e3..e38ba96 100644 --- a/src/freedreno/vulkan/tu_cs.c +++ b/src/freedreno/vulkan/tu_cs.c @@ -290,8 +290,14 @@ tu_cs_alloc(struct tu_cs *cs, assert(cs->mode == TU_CS_MODE_SUB_STREAM); assert(size && size <= 1024); - if (!count) + if (!count) { + /* If you allocated no memory, you'd better not use the iova for anything + * (but it's left aligned for sanity). + */ + memory->map = NULL; + memory->iova = 0xdead0000; return VK_SUCCESS; + } /* TODO: smarter way to deal with alignment? */ -- 2.7.4