Add buffer transport benchmark

1/ This benchmark supports both Binder-based BufferQueue and PDX-based
   BufferHub.
2/ On the producer side, it uses the same ANativeWindow API to gain
   buffer and post buffer for both backends.
3/ It supports multiple concurrent producer threads to minic buffers
   comming from different applications.
4/ For Binder backend, we use a dedicated process to run a Binder
   service, which acquires and releases buffers via BufferItemConsumer.
5/ For BufferHub backend, we use a SchedFIFO thread to epoll on multiple
   BufferHub ConsumerQueue(s).
6/ Four operations are traced via "ATRACE_TAG_ALWAYS" tag:
   GainBuffer, PostBuffer, AcquireBuffer, ReleaseBuffer. We use
   ATRACE_TAG_ALWAYS tag so that user can disable all other trace
   tags (i.e. gfx, video) to only trace events from this benchmark
   without being impacted by the systrace overhead. But note that the
   systrace is only enabled if specifying "--trace" in the commandline.

Bug: 66921451
Test: buffer_transport_benchmark
Change-Id: I8d1b70364e504c48658624caf4d0508a9508e3b0
diff --git a/libs/vr/libbufferhubqueue/tests/Android.bp b/libs/vr/libbufferhubqueue/tests/Android.bp
index 8bd1ef1..c4ffb41 100644
--- a/libs/vr/libbufferhubqueue/tests/Android.bp
+++ b/libs/vr/libbufferhubqueue/tests/Android.bp
@@ -12,6 +12,7 @@
     "libhardware",
     "libui",
     "libutils",
+    "libnativewindow",
 ]
 
 static_libraries = [
@@ -20,6 +21,7 @@
     "libchrome",
     "libdvrcommon",
     "libpdx_default_transport",
+    "libperformance",
 ]
 
 cc_test {
@@ -51,3 +53,17 @@
     name: "buffer_hub_queue_producer-test",
     tags: ["optional"],
 }
+
+cc_test {
+    srcs: ["buffer_transport_benchmark.cpp"],
+    static_libs: static_libraries,
+    shared_libs: shared_libraries,
+    header_libs: header_libraries,
+    cflags: [
+        "-DLOG_TAG=\"buffer_transport_benchmark\"",
+        "-DTRACE=0",
+        "-O2",
+    ],
+    name: "buffer_transport_benchmark",
+    tags: ["optional"],
+}