summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2013-07-30 14:05:02 -0700
committerEino-Ville Talvala <etalvala@google.com>2013-07-30 21:38:34 +0000
commitf7c6087bcc6a85cc82fd8dd83566550f880600ec (patch)
tree41fb8bb9fb195cc55beb2be4ba71efa26c6cc10e /libs
parentaaff4ef717c08f6aed7ccd96e1d65222ceb4fd17 (diff)
downloadframeworks_native-f7c6087bcc6a85cc82fd8dd83566550f880600ec.zip
frameworks_native-f7c6087bcc6a85cc82fd8dd83566550f880600ec.tar.gz
frameworks_native-f7c6087bcc6a85cc82fd8dd83566550f880600ec.tar.bz2
BufferQueue: Support query of consumer usage bits
Bug: 9592202 Change-Id: I61a17758200e61adaca695b426db3df0f6637d4c
Diffstat (limited to 'libs')
-rw-r--r--libs/gui/BufferQueue.cpp3
-rw-r--r--libs/gui/tests/Surface_test.cpp18
2 files changed, 21 insertions, 0 deletions
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index 45488ff..f09d558 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -217,6 +217,9 @@ int BufferQueue::query(int what, int* outValue)
case NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND:
value = (mQueue.size() >= 2);
break;
+ case NATIVE_WINDOW_CONSUMER_USAGE_BITS:
+ value = mConsumerUsageBits;
+ break;
default:
return BAD_VALUE;
}
diff --git a/libs/gui/tests/Surface_test.cpp b/libs/gui/tests/Surface_test.cpp
index 953f6f9..bcdbedb 100644
--- a/libs/gui/tests/Surface_test.cpp
+++ b/libs/gui/tests/Surface_test.cpp
@@ -20,6 +20,7 @@
#include <gui/ISurfaceComposer.h>
#include <gui/Surface.h>
#include <gui/SurfaceComposerClient.h>
+#include <gui/BufferItemConsumer.h>
#include <utils/String8.h>
#include <private/gui/ComposerService.h>
@@ -132,4 +133,21 @@ TEST_F(SurfaceTest, ConcreteTypeIsSurface) {
EXPECT_EQ(NATIVE_WINDOW_SURFACE, result);
}
+TEST_F(SurfaceTest, QueryConsumerUsage) {
+ const int TEST_USAGE_FLAGS =
+ GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_HW_RENDER;
+ sp<BufferQueue> bq = new BufferQueue();
+ sp<BufferItemConsumer> c = new BufferItemConsumer(bq,
+ TEST_USAGE_FLAGS);
+ sp<Surface> s = new Surface(c->getProducerInterface());
+
+ sp<ANativeWindow> anw(s);
+
+ int flags = -1;
+ int err = anw->query(anw.get(), NATIVE_WINDOW_CONSUMER_USAGE_BITS, &flags);
+
+ ASSERT_EQ(NO_ERROR, err);
+ ASSERT_EQ(TEST_USAGE_FLAGS, flags);
+}
+
}