From 524d9b064709c08537e3573d9e698b3d9c6f6eb6 Mon Sep 17 00:00:00 2001 From: Jason Macnak Date: Fri, 2 May 2025 14:50:37 +0000 Subject: [PATCH] gfxstream: Update codegen after many aemu -> gfxstream changes Reviewed-by: Marcin Radomski Part-of: --- .../codegen/scripts/cereal/decoder.py | 10 ++++---- .../codegen/scripts/cereal/decodersnapshot.py | 7 +++--- .../codegen/scripts/cereal/subdecode.py | 2 +- .../codegen/scripts/cerealgenerator.py | 24 +++++++++---------- 4 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/gfxstream/codegen/scripts/cereal/decoder.py b/src/gfxstream/codegen/scripts/cereal/decoder.py index eae1e58599f..c7f16cbc7f1 100644 --- a/src/gfxstream/codegen/scripts/cereal/decoder.py +++ b/src/gfxstream/codegen/scripts/cereal/decoder.py @@ -70,12 +70,12 @@ decoder_impl_preamble =""" namespace gfxstream { namespace vk { -using android::base::MetricEventBadPacketLength; -using android::base::MetricEventDuplicateSequenceNum; +using gfxstream::base::MetricEventBadPacketLength; +using gfxstream::base::MetricEventDuplicateSequenceNum; class VkDecoder::Impl { public: - Impl() : m_logCalls(android::base::getEnvironmentVariable("ANDROID_EMU_VK_LOG_CALLS") == "1"), + Impl() : m_logCalls(gfxstream::base::getEnvironmentVariable("ANDROID_EMU_VK_LOG_CALLS") == "1"), m_vk(vkDispatch()), m_state(VkDecoderGlobalState::get()), m_vkStream(nullptr, m_state->getFeatures()), @@ -104,7 +104,7 @@ private: VulkanMemReadingStream m_vkMemReadingStream; BoxedHandleCreateMapping m_boxedHandleCreateMapping; BoxedHandleUnwrapMapping m_boxedHandleUnwrapMapping; - android::base::BumpPool m_pool; + gfxstream::base::BumpPool m_pool; std::optional m_prevSeqno; bool m_queueSubmitWithCommandsEnabled = false; const bool m_snapshotsEnabled = false; @@ -489,7 +489,7 @@ def emit_seqno_incr(api, cgen): def emit_snapshot(typeInfo, api, cgen): additionalParams = [ \ - makeVulkanTypeSimple(False, "android::base::BumpPool", 1, "&m_pool"), + makeVulkanTypeSimple(False, "gfxstream::base::BumpPool", 1, "&m_pool"), makeVulkanTypeSimple(True, "VkSnapshotApiCallInfo", 1, SNAPSHOT_API_CALL_INFO_VARNAME), makeVulkanTypeSimple(True, "uint8_t", 1, "packet"), makeVulkanTypeSimple(False, "size_t", 0, "packetLen"), diff --git a/src/gfxstream/codegen/scripts/cereal/decodersnapshot.py b/src/gfxstream/codegen/scripts/cereal/decodersnapshot.py index b9316d4bcb6..fea29686cd5 100644 --- a/src/gfxstream/codegen/scripts/cereal/decodersnapshot.py +++ b/src/gfxstream/codegen/scripts/cereal/decodersnapshot.py @@ -16,12 +16,11 @@ from dataclasses import dataclass decoder_snapshot_decl_preamble = """ -namespace android { +namespace gfxstream { namespace base { class BumpPool; -class Stream; } // namespace base { -} // namespace android { +} // namespace gfxstream { namespace gfxstream { namespace vk { @@ -494,7 +493,7 @@ class VulkanDecoderSnapshot(VulkanWrapperGenerator): api = self.typeInfo.apis[name] additionalParams = [ \ - makeVulkanTypeSimple(False, "android::base::BumpPool", 1, "pool"), + makeVulkanTypeSimple(False, "gfxstream::base::BumpPool", 1, "pool"), makeVulkanTypeSimple(False, "VkSnapshotApiCallInfo", 1, "apiCallInfo"), makeVulkanTypeSimple(True, "uint8_t", 1, "apiCallPacket"), makeVulkanTypeSimple(False, "size_t", 0, "apiCallPacketSize"), diff --git a/src/gfxstream/codegen/scripts/cereal/subdecode.py b/src/gfxstream/codegen/scripts/cereal/subdecode.py index 7f56900cb46..fdc5668bbed 100644 --- a/src/gfxstream/codegen/scripts/cereal/subdecode.py +++ b/src/gfxstream/codegen/scripts/cereal/subdecode.py @@ -344,7 +344,7 @@ class VulkanSubDecoder(VulkanWrapperGenerator): self.cgen.stmt("auto& metricsLogger = *context.metricsLogger") self.cgen.stmt("uint32_t count = 0") self.cgen.stmt("unsigned char *buf = (unsigned char *)pSubDecodeData") - self.cgen.stmt("android::base::BumpPool* pool = readStream->pool()") + self.cgen.stmt("gfxstream::base::BumpPool* pool = readStream->pool()") self.cgen.stmt("unsigned char *ptr = (unsigned char *)pSubDecodeData") self.cgen.stmt( "const unsigned char* const end = (const unsigned char*)buf + subDecodeDataSize") diff --git a/src/gfxstream/codegen/scripts/cerealgenerator.py b/src/gfxstream/codegen/scripts/cerealgenerator.py index 8b7db1797eb..0a91761c2a7 100644 --- a/src/gfxstream/codegen/scripts/cerealgenerator.py +++ b/src/gfxstream/codegen/scripts/cerealgenerator.py @@ -281,7 +281,6 @@ class CerealGenerator(OutputGenerator): self.featureSupported = False self.supportedModules = None - self.baseLibDirPrefix = "aemu/base" self.utilsHeaderDirPrefix = "utils" # The cereal variant should be an environmental variable of one of @@ -395,15 +394,15 @@ class IOStream; #include "goldfish_vk_private_defs.h" #include "%s.h" -#include "{self.baseLibDirPrefix}/files/StreamSerializing.h" +#include "aemu/base/files/StreamSerializing.h" """ % VULKAN_STREAM_TYPE poolInclude = f""" {self.hostCommonExtraVulkanHeaders} #include "goldfish_vk_private_defs.h" -#include "{self.baseLibDirPrefix}/BumpPool.h" -using android::base::Allocator; -using android::base::BumpPool; +#include "gfxstream/BumpPool.h" +using gfxstream::base::Allocator; +using gfxstream::base::BumpPool; """ transformIncludeGuest = """ #include "goldfish_vk_private_defs.h" @@ -495,7 +494,8 @@ using DlSymFunc = void* (void*, const char*); #include "VkSnapshotApiCall.h" #include "{self.utilsHeaderDirPrefix}/GfxApiLogger.h" -#include "{self.baseLibDirPrefix}/HealthMonitor.h" +#include "aemu/base/files/Stream.h" +#include "gfxstream/HealthMonitor.h" #include "goldfish_vk_private_defs.h" """ decoderSnapshotImplIncludes = f""" @@ -505,7 +505,7 @@ using DlSymFunc = void* (void*, const char*); #include "VulkanHandleMapping.h" #include "VkDecoderGlobalState.h" #include "VkReconstruction.h" -#include "{self.baseLibDirPrefix}/ThreadAnnotations.h" +#include "gfxstream/ThreadAnnotations.h" """ decoderHeaderIncludes = f""" @@ -514,11 +514,11 @@ using DlSymFunc = void* (void*, const char*); #include -namespace android {{ +namespace gfxstream {{ namespace base {{ class BumpPool; -}} // namespace android }} // namespace base +}} // namespace gfxstream """ @@ -528,9 +528,9 @@ class BumpPool; #include "goldfish_vk_private_defs.h" #include "common/goldfish_vk_transform.h" -#include "{self.baseLibDirPrefix}/BumpPool.h" -#include "{self.baseLibDirPrefix}/system/System.h" -#include "{self.baseLibDirPrefix}/Metrics.h" +#include "gfxstream/BumpPool.h" +#include "gfxstream/system/System.h" +#include "gfxstream/Metrics.h" #include "FrameBuffer.h" #include "gfxstream/host/Tracing.h" #include "gfxstream/host/iostream.h"