From db6cf334392e7723c06aea119664946f79d90ce3 Mon Sep 17 00:00:00 2001 From: Yahan Zhou Date: Wed, 7 Aug 2024 14:43:49 -0700 Subject: [PATCH] [Vulkan Snapshot] tryLock when an API might create extra handles We acquire the lock when createExtraHandlecsForNextApi is called. But depending on config, vkCreateDescriptorPool may or may not call createExtraHandlesForNextApi, which results in inconsistency of the lock state when calling snapshot()->vkCreateDescriptorPool. We add a tryLock so that it always acquires the lock before modifying mReconstruction. Reviewed-by: Aaron Ruby Acked-by: Yonggang Luo Acked-by: Adam Jackson Part-of: --- src/gfxstream/codegen/scripts/cereal/decodersnapshot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gfxstream/codegen/scripts/cereal/decodersnapshot.py b/src/gfxstream/codegen/scripts/cereal/decodersnapshot.py index 2a5ef477959..44953996206 100644 --- a/src/gfxstream/codegen/scripts/cereal/decodersnapshot.py +++ b/src/gfxstream/codegen/scripts/cereal/decodersnapshot.py @@ -300,7 +300,9 @@ def emit_impl(typeInfo, api, cgen): if p.pointerIndirectionLevels > 0: cgen.stmt("if (!%s) return" % access) isCreateExtraHandleApi = api.name in apiCrreateExtraHandles - if not isCreateExtraHandleApi: + if isCreateExtraHandleApi: + cgen.stmt("mLock.tryLock()"); + else: cgen.stmt("android::base::AutoLock lock(mLock)") cgen.line("// %s create" % p.paramName) if p.isCreatedBy(api):