Revert "Revert "[magma] Add magma decoder""
This reverts commit 13616f7472ed3796178efe50432a0a2cafcab939.
Test: m gfxstream_magma_server
cmake -B build -GNinja && ninja -C build -j $(nproc) gfxstream_backend
Original commit message:
This change adds initial Magma transport support to gfxstream. It
includes scaffolding for an Intel DRM host implementation.
Bug: b/272307395
Test: m libgfxstream_backend
Change-Id: I137f4d8dbd2fdf483bf719e3b6dd5dcda1ca789f
diff --git a/stream-servers/RenderThread.cpp b/stream-servers/RenderThread.cpp
index 76033fd..dd8dc62 100644
--- a/stream-servers/RenderThread.cpp
+++ b/stream-servers/RenderThread.cpp
@@ -302,6 +302,8 @@
tInfo.m_vkInfo.emplace();
}
+ tInfo.m_magmaInfo.emplace();
+
// This is the only place where we try loading from snapshot.
// But the context bind / restoration will be delayed after receiving
// the first GL command.
@@ -537,6 +539,20 @@
}
}
+ //
+ // try to process some of the command buffer using the Magma
+ // decoder
+ //
+ if (tInfo.m_magmaInfo && tInfo.m_magmaInfo->m_magmaDec)
+ {
+ last = tInfo.m_magmaInfo->m_magmaDec->decode(readBuf.buf(), readBuf.validData(),
+ ioStream, &checksumCalc);
+ if (last > 0) {
+ readBuf.consume(last);
+ progress = true;
+ }
+ }
+
if (mRunInLimitedMode) {
sThreadRunLimiter.unlock();
}