Ensure EmuglPipe RenderThread-s have a virtio gpu context id
... and avoid setting invalid PUIDs in rcSetPuid() to avoid lots of
"Failed to find process owned resources fpr puid" errors.
After aosp/2752873, the host GlProcessPipe stopped initializing a unique
id for the process pipe. However, it continued to communicate the value
of the `m_uniqueId` back to the guest. The guest still uses PUID for
rcSetPuid commands in the guest EGL/GL implementations. This would
result in garbage PUIDs being used by RenderThreads for
getProcessResources() calls. Further, if a guest process used both
EGL/GL and Vulkan, getProcessResources() would return nullptr and then
the host would crash when the VkDecoder tried to read the seqnoPtr in
the process resources.
Bug: b/312560224
Test: cvd start --gpu_mode=gfxstream
Change-Id: Ie3697a7588a8d2180ccc9e7f02f38ed6d9f1bd12
diff --git a/host/RenderThread.cpp b/host/RenderThread.cpp
index b43df41..74cee30 100644
--- a/host/RenderThread.cpp
+++ b/host/RenderThread.cpp
@@ -78,10 +78,12 @@
static android::base::Lock sThreadRunLimiter;
RenderThread::RenderThread(RenderChannelImpl* channel,
- android::base::Stream* loadStream)
+ android::base::Stream* loadStream,
+ uint32_t virtioGpuContextId)
: android::base::Thread(android::base::ThreadFlags::MaskSignals, 2 * 1024 * 1024),
mChannel(channel),
- mRunInLimitedMode(android::base::getCpuCoreCount() < kMinThreadsToRunUnlimited)
+ mRunInLimitedMode(android::base::getCpuCoreCount() < kMinThreadsToRunUnlimited),
+ mContextId(virtioGpuContextId)
{
if (loadStream) {
const bool success = loadStream->getByte();