Disable initializing GL decoders when running with ANGLE
... as the guest will never send GL commands to the host.
Bug: b/233939967
Test: cvd start --gpu_mode=gfxstream
Test: cvd start --gpu_mode=gfxstream --enable_gpu_angle=true
Change-Id: I6c184fddad3549cdc8b167c85be94481b9a84295
diff --git a/stream-servers/FrameBuffer.cpp b/stream-servers/FrameBuffer.cpp
index 95cdd8e..66223ae 100644
--- a/stream-servers/FrameBuffer.cpp
+++ b/stream-servers/FrameBuffer.cpp
@@ -1781,7 +1781,7 @@
return ret;
}
-void FrameBuffer::drainRenderThreadResources() {
+void FrameBuffer::drainGlRenderThreadResources() {
// If we're already exiting then snapshot should not contain
// this thread information at all.
if (isShuttingDown()) {
@@ -1791,15 +1791,15 @@
// Release references to the current thread's context/surfaces if any
bindContext(0, 0, 0);
- drainRenderThreadWindowSurfaces();
- drainRenderThreadContexts();
+ drainGlRenderThreadWindowSurfaces();
+ drainGlRenderThreadContexts();
if (!s_egl.eglReleaseThread()) {
ERR("Error: RenderThread @%p failed to eglReleaseThread()", this);
}
}
-void FrameBuffer::drainRenderThreadContexts() {
+void FrameBuffer::drainGlRenderThreadContexts() {
if (isShuttingDown()) {
return;
}
@@ -1822,7 +1822,7 @@
tinfo->m_contextSet.clear();
}
-void FrameBuffer::drainRenderThreadWindowSurfaces() {
+void FrameBuffer::drainGlRenderThreadWindowSurfaces() {
if (isShuttingDown()) {
return;
}
diff --git a/stream-servers/FrameBuffer.h b/stream-servers/FrameBuffer.h
index ffeb1a9..fc7dbef 100644
--- a/stream-servers/FrameBuffer.h
+++ b/stream-servers/FrameBuffer.h
@@ -254,17 +254,17 @@
// Call this function when a render thread terminates to destroy all
// resources it created. Necessary to avoid leaking host resources
// when a guest application crashes, for example.
- void drainRenderThreadResources();
+ void drainGlRenderThreadResources();
// Call this function when a render thread terminates to destroy all
// the remaining contexts it created. Necessary to avoid leaking host
// contexts when a guest application crashes, for example.
- void drainRenderThreadContexts();
+ void drainGlRenderThreadContexts();
// Call this function when a render thread terminates to destroy all
// remaining window surface it created. Necessary to avoid leaking
// host buffers when a guest application crashes, for example.
- void drainRenderThreadWindowSurfaces();
+ void drainGlRenderThreadWindowSurfaces();
// Destroy a given RenderContext instance. |p_context| is its handle
// value as returned by createRenderContext().
diff --git a/stream-servers/RenderThread.cpp b/stream-servers/RenderThread.cpp
index f3eb05a..6fe4391 100644
--- a/stream-servers/RenderThread.cpp
+++ b/stream-servers/RenderThread.cpp
@@ -34,6 +34,7 @@
#include "base/StreamSerializing.h"
#include "base/System.h"
#include "base/Tracing.h"
+#include "host-common/feature_control.h"
#include "host-common/logging.h"
#include "vulkan/VkCommonOperations.h"
@@ -268,7 +269,9 @@
//
// initialize decoders
//
- tInfo.initGl();
+ if (!feature_is_enabled(kFeature_GuestUsesAngle)) {
+ tInfo.initGl();
+ }
initRenderControlContext(&tInfo.m_rcDec);
@@ -523,7 +526,9 @@
fclose(dumpFP);
}
- FrameBuffer::getFB()->drainRenderThreadResources();
+ if (tInfo.m_glInfo) {
+ FrameBuffer::getFB()->drainGlRenderThreadResources();
+ }
setFinished();