OSDN Git Service

libui: flush hwbinder commands in Allocator::allocate
authorChia-I Wu <olv@google.com>
Tue, 16 May 2017 21:30:34 +0000 (14:30 -0700)
committerChia-I Wu <olv@google.com>
Tue, 16 May 2017 21:32:59 +0000 (14:32 -0700)
Bug: 36279079
Test: monkey test on fugu
Change-Id: I81f72d63d3ede64f279b26208bb5df7646050e73

libs/ui/Android.bp
libs/ui/Gralloc2.cpp

index 5ccf178..406968d 100644 (file)
@@ -72,6 +72,7 @@ cc_library_shared {
         "libhardware",
         "libhidlbase",
         "libhidltransport",
+        "libhwbinder",
         "libsync",
         "libutils",
         "liblog",
index f8d9401..87dbaf4 100644 (file)
@@ -16,6 +16,7 @@
 
 #define LOG_TAG "Gralloc2"
 
+#include <hwbinder/IPCThreadState.h>
 #include <ui/Gralloc2.h>
 
 #include <log/log.h>
@@ -241,6 +242,9 @@ Error Allocator::allocate(BufferDescriptor descriptor, uint32_t count,
                 *outStride = tmpStride;
             });
 
+    // make sure the kernel driver sees BC_FREE_BUFFER and closes the fds now
+    hardware::IPCThreadState::self()->flushCommands();
+
     return (ret.isOk()) ? error : kTransactionError;
 }