diff --git a/Android.bp b/Android.bp index 28889b4..75375be 100644 --- a/Android.bp +++ b/Android.bp @@ -396,6 +396,7 @@ cc_library_shared { name: "libui_shim", shared_libs: [ "libui", + "libsync", "libutils", ], srcs: [ diff --git a/libui/GraphicBufferMapper.cpp b/libui/GraphicBufferMapper.cpp index a3ceffb..23b2c9c 100644 --- a/libui/GraphicBufferMapper.cpp +++ b/libui/GraphicBufferMapper.cpp @@ -5,6 +5,7 @@ */ #include +#include #include #include #include @@ -19,4 +20,16 @@ status_t _ZN7android19GraphicBufferMapper4lockEPK13native_handlejRKNS_4RectEPPvP auto* gpm = static_cast(thisptr); return gpm->lock(handle, usage, bounds, vaddr); } + +status_t _ZN7android19GraphicBufferMapper6unlockEPK13native_handle(void* thisptr, + buffer_handle_t handle) { + android::base::unique_fd outFence; + auto* gpm = static_cast(thisptr); + status_t status = gpm->unlock(handle, &outFence); + if (status == android::OK && outFence.get() >= 0) { + sync_wait(outFence.get(), -1); + outFence.reset(); + } + return status; +} }