diff --git a/src/gfxstream/codegen/scripts/cereal/decoder.py b/src/gfxstream/codegen/scripts/cereal/decoder.py index ac7ec3e5b7b..1b04bdfcd5b 100644 --- a/src/gfxstream/codegen/scripts/cereal/decoder.py +++ b/src/gfxstream/codegen/scripts/cereal/decoder.py @@ -62,12 +62,15 @@ public: Impl() : m_logCalls(android::base::getEnvironmentVariable("ANDROID_EMU_VK_LOG_CALLS") == "1"), m_vk(vkDispatch()), m_state(VkDecoderGlobalState::get()), + m_vkStream(nullptr, m_state->getFeatures()), + m_vkMemReadingStream(nullptr, m_state->getFeatures()), m_boxedHandleUnwrapMapping(m_state), m_boxedHandleCreateMapping(m_state), m_boxedHandleDestroyMapping(m_state), m_boxedHandleUnwrapAndDeleteMapping(m_state), m_boxedHandleUnwrapAndDeletePreserveBoxedMapping(m_state), - m_prevSeqno(std::nullopt) {} + m_prevSeqno(std::nullopt), + m_queueSubmitWithCommandsEnabled(m_state->getFeatures().VulkanQueueSubmitWithCommands.enabled) {} %s* stream() { return &m_vkStream; } VulkanMemReadingStream* readStream() { return &m_vkMemReadingStream; } @@ -83,8 +86,8 @@ private: bool m_forSnapshotLoad = false; VulkanDispatch* m_vk; VkDecoderGlobalState* m_state; - %s m_vkStream { nullptr }; - VulkanMemReadingStream m_vkMemReadingStream { nullptr }; + %s m_vkStream; + VulkanMemReadingStream m_vkMemReadingStream; BoxedHandleUnwrapMapping m_boxedHandleUnwrapMapping; BoxedHandleCreateMapping m_boxedHandleCreateMapping; BoxedHandleDestroyMapping m_boxedHandleDestroyMapping; @@ -92,6 +95,7 @@ private: android::base::BumpPool m_pool; BoxedHandleUnwrapAndDeletePreserveBoxedMapping m_boxedHandleUnwrapAndDeletePreserveBoxedMapping; std::optional m_prevSeqno; + bool m_queueSubmitWithCommandsEnabled = false; }; VkDecoder::VkDecoder() : @@ -441,7 +445,7 @@ def emit_pool_free(cgen): cgen.stmt("%s->clearPool()" % READ_STREAM) def emit_seqno_incr(api, cgen): - cgen.stmt("if (queueSubmitWithCommandsEnabled) seqnoPtr->fetch_add(1, std::memory_order_seq_cst)") + cgen.stmt("if (m_queueSubmitWithCommandsEnabled) seqnoPtr->fetch_add(1, std::memory_order_seq_cst)") def emit_snapshot(typeInfo, api, cgen): @@ -802,7 +806,6 @@ size_t VkDecoder::Impl::decode(void* buf, size_t len, IOStream* ioStream, self.cgen.stmt("auto* healthMonitor = context.healthMonitor") self.cgen.stmt("auto& metricsLogger = *context.metricsLogger") self.cgen.stmt("if (len < 8) return 0") - self.cgen.stmt("bool queueSubmitWithCommandsEnabled = feature_is_enabled(kFeature_VulkanQueueSubmitWithCommands)") self.cgen.stmt("unsigned char *ptr = (unsigned char *)buf") self.cgen.stmt("const unsigned char* const end = (const unsigned char*)buf + len") @@ -850,7 +853,7 @@ size_t VkDecoder::Impl::decode(void* buf, size_t len, IOStream* ioStream, std::atomic* seqnoPtr = processResources ? processResources->getSequenceNumberPtr() : nullptr; - if (queueSubmitWithCommandsEnabled && ((opcode >= OP_vkFirst && opcode < OP_vkLast) || (opcode >= OP_vkFirst_old && opcode < OP_vkLast_old))) { + if (m_queueSubmitWithCommandsEnabled && ((opcode >= OP_vkFirst && opcode < OP_vkLast) || (opcode >= OP_vkFirst_old && opcode < OP_vkLast_old))) { uint32_t seqno; memcpy(&seqno, *readStreamPtrPtr, sizeof(uint32_t)); *readStreamPtrPtr += sizeof(uint32_t); if (healthMonitor) executionData->insert({{"seqno", std::to_string(seqno)}});