gfxstream: Move the handle replay buffer into BoxedHandleManager

... since `BoxedHandleManager` should, well, manager the handles.

This simplifies `VkDecoderGlobalState` a little bit and should also
allow us to remove a bunch of functions that no longer need to
depend on `VkDecoderGlobalState`.

Test: cvd create --gpu_mode=gfxstream_guest_angle_host_swiftshader
Test: cvd snapshot_take --force \
                        --auto_suspend \
                        --snapshot_path=/tmp/snapshot1
Test: cvd reset -y
Test: cvd create --snapshot_path=/tmp/snapshot1

Reviewed-by: Aaron Ruby <aruby@qnx.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33740>
This commit is contained in:
Jason Macnak 2025-02-21 14:51:00 -08:00 committed by Marge Bot
parent 4ddd8bd96e
commit 039e64264a
2 changed files with 10 additions and 17 deletions

View file

@ -831,9 +831,6 @@ size_t VkDecoder::Impl::decode(void* buf, size_t len, IOStream* ioStream,
self.cgen.stmt("unsigned char *ptr = (unsigned char *)buf")
self.cgen.stmt("const unsigned char* const end = (const unsigned char*)buf + len")
self.cgen.beginIf("m_forSnapshotLoad")
self.cgen.stmt("ptr += m_state->setCreatedHandlesForSnapshotLoad(ptr)");
self.cgen.endIf()
self.cgen.line("while (end - ptr >= 8)")
self.cgen.beginBlock() # while loop
@ -982,10 +979,6 @@ size_t VkDecoder::Impl::decode(void* buf, size_t len, IOStream* ioStream,
self.cgen.stmt("vkStream->clearPool()")
self.cgen.endBlock() # while loop
self.cgen.beginIf("m_forSnapshotLoad")
self.cgen.stmt("m_state->clearCreatedHandlesForSnapshotLoad()");
self.cgen.endIf()
self.cgen.stmt("m_pool.freeAll()")
self.cgen.stmt("return ptr - (unsigned char*)buf;")
self.cgen.endBlock() # function body

View file

@ -33,8 +33,8 @@ class VkDecoderSnapshot {
void clear();
void saveDecoderReplayBuffer(android::base::Stream* stream);
static void loadDecoderReplayBuffer(android::base::Stream* stream, std::vector<uint8_t>* outBuffer);
void saveReplayBuffers(android::base::Stream* stream);
static void loadReplayBuffers(android::base::Stream* stream, std::vector<uint64_t>* outHandleBuffer, std::vector<uint8_t>* outDecoderBuffer);
VkSnapshotApiCallInfo* createApiCallInfo();
void destroyApiCallInfoIfUnused(VkSnapshotApiCallInfo* info);
@ -68,13 +68,13 @@ class VkDecoderSnapshot::Impl {
mReconstruction.clear();
}
void saveDecoderReplayBuffer(android::base::Stream* stream) {
void saveReplayBuffers(android::base::Stream* stream) {
std::lock_guard<std::mutex> lock(mReconstructionMutex);
mReconstruction.saveDecoderReplayBuffer(stream);
mReconstruction.saveReplayBuffers(stream);
}
static void loadDecoderReplayBuffer(android::base::Stream* stream, std::vector<uint8_t>* outBuffer) {
VkReconstruction::loadDecoderReplayBuffer(stream, outBuffer);
static void loadReplayBuffers(android::base::Stream* stream, std::vector<uint64_t>* outHandleBuffer, std::vector<uint8_t>* outDecoderBuffer) {
VkReconstruction::loadReplayBuffers(stream, outHandleBuffer, outDecoderBuffer);
}
VkSnapshotApiCallInfo* createApiCallInfo() {
@ -101,13 +101,13 @@ void VkDecoderSnapshot::clear() {
mImpl->clear();
}
void VkDecoderSnapshot::saveDecoderReplayBuffer(android::base::Stream* stream) {
mImpl->saveDecoderReplayBuffer(stream);
void VkDecoderSnapshot::saveReplayBuffers(android::base::Stream* stream) {
mImpl->saveReplayBuffers(stream);
}
/*static*/
void VkDecoderSnapshot::loadDecoderReplayBuffer(android::base::Stream* stream, std::vector<uint8_t>* outBuffer) {
VkDecoderSnapshot::Impl::loadDecoderReplayBuffer(stream, outBuffer);
void VkDecoderSnapshot::loadReplayBuffers(android::base::Stream* stream, std::vector<uint64_t>* outHandleBuffer, std::vector<uint8_t>* outDecoderBuffer) {
VkDecoderSnapshot::Impl::loadReplayBuffers(stream, outHandleBuffer, outDecoderBuffer);
}
VkSnapshotApiCallInfo* VkDecoderSnapshot::createApiCallInfo() {