summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/RenderThread.cpp
diff options
context:
space:
mode:
authorHuihong Luo <huisinro@google.com>2021-01-15 14:27:06 -0800
committerJorim Jaggi <jjaggi@google.com>2021-02-16 17:38:12 +0100
commit5fdf7b8d26f3cd1a2f2fb8a441d40d33270d3b77 (patch)
tree42fb177d3a385875f96f560e5abc6ab35d034d7c /libs/hwui/renderthread/RenderThread.cpp
parentd8385e060c12acc21010956f4fbe57daa526a41a (diff)
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
Diffstat (limited to 'libs/hwui/renderthread/RenderThread.cpp')
-rw-r--r--libs/hwui/renderthread/RenderThread.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/libs/hwui/renderthread/RenderThread.cpp b/libs/hwui/renderthread/RenderThread.cpp
index 7750a31b817f..26101867c43f 100644
--- a/libs/hwui/renderthread/RenderThread.cpp
+++ b/libs/hwui/renderthread/RenderThread.cpp
@@ -33,6 +33,7 @@
#include <GrContextOptions.h>
#include <gl/GrGLInterface.h>
+#include <dlfcn.h>
#include <sys/resource.h>
#include <utils/Condition.h>
#include <utils/Log.h>
@@ -49,6 +50,17 @@ static bool gHasRenderThreadInstance = false;
static JVMAttachHook gOnStartHook = nullptr;
+ASurfaceControlFunctions::ASurfaceControlFunctions() {
+ void* handle_ = dlopen("libandroid.so", RTLD_NOW | RTLD_NODELETE);
+ acquireFunc = (ASC_acquire) dlsym(handle_, "ASurfaceControl_acquire");
+ LOG_ALWAYS_FATAL_IF(acquireFunc == nullptr,
+ "Failed to find required symbol ASurfaceControl_acquire!");
+
+ releaseFunc = (ASC_release) dlsym(handle_, "ASurfaceControl_release");
+ LOG_ALWAYS_FATAL_IF(releaseFunc == nullptr,
+ "Failed to find required symbol ASurfaceControl_release!");
+}
+
void RenderThread::frameCallback(int64_t frameTimeNanos, void* data) {
RenderThread* rt = reinterpret_cast<RenderThread*>(data);
int64_t vsyncId = AChoreographer_getVsyncId(rt->mChoreographer);