summaryrefslogtreecommitdiff
path: root/libs/gui/BufferSlot.cpp
diff options
context:
space:
mode:
author Pablo Ceballos <pceballos@google.com> 2015-10-07 15:05:45 -0700
committer Pablo Ceballos <pceballos@google.com> 2015-11-03 12:03:51 -0800
commitccdfd60d79a8b7f1ed6401d0f2e8e29166a10584 (patch)
tree337134c63442b7f737caf43ff44487b0916f9047 /libs/gui/BufferSlot.cpp
parentc899c322ab49639c1e1b012bb5a8b7d52f8497f4 (diff)
BQ: Add support for single buffer mode
- Adds a single buffer mode to BufferQueue. In this mode designate the first dequeued buffer as the shared buffer. All calls to dequeue() and acquire() will then return the shared buffer, allowing the producer and consumer to share it. - Modify the buffer slot state tracking. Add a new SHARED state for the shared buffer in single buffer mode. Also track how many times a buffer has been dequeued/queued/acquired as it's possible for a shared buffer to be both dequeued and acquired at the same time, or dequeued/acquired multiple times. This tracking is needed to know when to drop the buffer out of the SHARED state after single buffer mode has been disabled. - Add plumbing for enabling/disabling single buffer mode from Surface. Bug 24940410 Change-Id: I3fc550c74bacb5523c049a227111356257386853
Diffstat (limited to 'libs/gui/BufferSlot.cpp')
-rw-r--r--libs/gui/BufferSlot.cpp31
1 files changed, 23 insertions, 8 deletions
diff --git a/libs/gui/BufferSlot.cpp b/libs/gui/BufferSlot.cpp
index 01595de448..b1cdc5d5f3 100644
--- a/libs/gui/BufferSlot.cpp
+++ b/libs/gui/BufferSlot.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright 2014 The Android Open Source Project
+ * Copyright 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,14 +18,29 @@
namespace android {
-const char* BufferSlot::bufferStateName(BufferState state) {
- switch (state) {
- case BufferSlot::DEQUEUED: return "DEQUEUED";
- case BufferSlot::QUEUED: return "QUEUED";
- case BufferSlot::FREE: return "FREE";
- case BufferSlot::ACQUIRED: return "ACQUIRED";
+
+const char* BufferState::string() const {
+
+ if (isShared()) {
+ return "SHARED";
+ }
+
+ if (isFree()) {
+ return "FREE";
+ }
+
+ if (isAcquired()) {
+ return "ACQUIRED";
+ }
+
+ if (isDequeued()) {
+ return "DEQUEUED";
+ }
+
+ if (isQueued()) {
+ return "QUEUED";
}
- return "Unknown";
+ return "UNKNOWN";
}
} // namespace android