[GL] Gralloc Refcount Pipe

RefCount Pipe is a different approach to simplify the Color Buffer
management on host. In guest, the handle returned by gralloc
allocator can be passed around between processes through Binder.
Android system ensures that the handle on both calling and receiving
end willl be properly closed. Thus, when gralloc allocates buffer for
the first time, we establish a Refcount pipe between guest and host,
and assign its fd to the handle. when cloned handle is closed, the
duplicated fd will also be closed. Guest kernel will decide when to
really close the fd and to trigger the pipe's closing on host.
On the host side, we only need to destroy the color buffer immediately
and not execute any reference counting code path.

This approach will not only simplify the logic between guest and host
but also reduce memory leaks.

BUG: 116349069

Signed-off-by: Weilun Du <wdu@google.com>
Change-Id: Iab9fe76f5947b914b11fcdccdb61018957e20e50
4 files changed
tree: c838531d14eada016fb9e44a48b518ad2ff90843
  1. .vscode/
  2. host/
  3. shared/
  4. system/
  5. tests/
  6. Android.mk
  7. common.mk
  8. README