summaryrefslogtreecommitdiff
path: root/host-common
diff options
context:
space:
mode:
authorGurchetan Singh <gurchetansingh@chromium.org>2022-03-17 14:55:52 -0700
committerGurchetan Singh <gurchetansingh@google.com>2022-03-17 17:40:53 -0700
commit34ec41a6b60abdf42bdd298fdefe15f66dfc2c32 (patch)
tree983058a4fc92290722dcc7501a4675b444208133 /host-common
parentda84145011df1f2eb3bedee0fb8d52f1a0c13c7c (diff)
downloadvulkan-cereal-34ec41a6b60abdf42bdd298fdefe15f66dfc2c32.tar.gz
vulkan-cereal: plumb virtgpu ctx_id to process pipe
The virtio-gpu context ID is an unique identifier allocated by the guest kernel, via idr_alloc(..). These IDs can be reused, but virtio-gpu gurantees that re-use will only happens after a particular context has been destroyed. Many operations related to resource sharing between guest processes, and between gfxstream and virtgpu are done in reference to this context id. gfxstream has a clear analogue to this already --> m_puid, which is set via connecting to the "pipe:GLProcessPipe" service in the guest. The immediate goal is is make m_puid == ctx_id, so the guest kernel can reference each host render thread via the ctx_id. BUG=202552093 TEST=run Cuttlefish Change-Id: Iadc0c288be6a869261658db87c5c569389f73f5b
Diffstat (limited to 'host-common')
-rw-r--r--host-common/opengl/GLProcessPipe.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/host-common/opengl/GLProcessPipe.cpp b/host-common/opengl/GLProcessPipe.cpp
index 7ff32983..d2da1a22 100644
--- a/host-common/opengl/GLProcessPipe.cpp
+++ b/host-common/opengl/GLProcessPipe.cpp
@@ -89,7 +89,12 @@ public:
m_uniqueId = loadStream->getBe64();
m_hasData = (loadStream->getByte() != 0);
} else {
- m_uniqueId = ++s_headId;
+ if (flags & ANDROID_PIPE_VIRTIO_GPU_BIT) {
+ m_uniqueId = (uint64_t)(uintptr_t)hwPipe;
+ s_headId = m_uniqueId;
+ } else {
+ m_uniqueId = ++s_headId;
+ }
}
AutoLock lock(sRegistry.lock);
sRegistry.ids.insert(m_uniqueId);