Add SurfaceControl to hwui
add a method, setSurfaceControl, for java layer to pass surface control to the render thread
Bug: 173671170
Test: call setSurfaceControl method in ViewRootImpl.java
Change-Id: I886a79c377938f19cf38b9058f2bec64e1439000
diff --git a/libs/hwui/renderthread/RenderProxy.cpp b/libs/hwui/renderthread/RenderProxy.cpp
index 0ade8dd..e14842f 100644
--- a/libs/hwui/renderthread/RenderProxy.cpp
+++ b/libs/hwui/renderthread/RenderProxy.cpp
@@ -84,6 +84,19 @@
});
}
+void RenderProxy::setSurfaceControl(ASurfaceControl* surfaceControl) {
+ auto funcs = mRenderThread.getASurfaceControlFunctions();
+ if (surfaceControl) {
+ funcs.acquireFunc(surfaceControl);
+ }
+ mRenderThread.queue().post([this, control = surfaceControl, funcs]() mutable {
+ mContext->setSurfaceControl(control);
+ if (control) {
+ funcs.releaseFunc(control);
+ }
+ });
+}
+
void RenderProxy::allocateBuffers() {
mRenderThread.queue().post([=]() { mContext->allocateBuffers(); });
}