summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Lentine <mlentine@google.com>2015-05-18 21:29:39 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-18 21:29:39 +0000
commit699a32bcdfaf0390a269a275b979d46ca815654a (patch)
tree45400462ffcc7b25e6862d1d22d0723bf2de606d
parentbfb1f1cc832840b7232c25a91d49eb39aa79687f (diff)
parent847f11e215e86b107ab50c1359fc7bc3cd7a3a11 (diff)
downloadframeworks_native-699a32bcdfaf0390a269a275b979d46ca815654a.zip
frameworks_native-699a32bcdfaf0390a269a275b979d46ca815654a.tar.gz
frameworks_native-699a32bcdfaf0390a269a275b979d46ca815654a.tar.bz2
Merge "Refactor ConsumerBase and it's derived classes." into mnc-dev
-rw-r--r--include/gui/BufferItemConsumer.h15
-rw-r--r--include/gui/ConsumerBase.h9
-rw-r--r--include/gui/CpuConsumer.h17
-rw-r--r--libs/gui/BufferItemConsumer.cpp16
-rw-r--r--libs/gui/ConsumerBase.cpp16
-rw-r--r--libs/gui/CpuConsumer.cpp19
6 files changed, 25 insertions, 67 deletions
diff --git a/include/gui/BufferItemConsumer.h b/include/gui/BufferItemConsumer.h
index 930fabf..56c7a3f 100644
--- a/include/gui/BufferItemConsumer.h
+++ b/include/gui/BufferItemConsumer.h
@@ -86,21 +86,6 @@ class BufferItemConsumer: public ConsumerBase
status_t releaseBuffer(const BufferItem &item,
const sp<Fence>& releaseFence = Fence::NO_FENCE);
- // setDefaultBufferSize is used to set the size of buffers returned by
- // requestBuffers when a with and height of zero is requested.
- status_t setDefaultBufferSize(uint32_t w, uint32_t h);
-
- // setDefaultBufferFormat allows the BufferQueue to create
- // GraphicBuffers of a defaultFormat if no format is specified
- // in dequeueBuffer
- status_t setDefaultBufferFormat(PixelFormat defaultFormat);
-
- // setDefaultBufferDataSpace allows the BufferQueue to create
- // GraphicBuffers of a defaultDataSpace if no data space is specified
- // in queueBuffer.
- // The initial default is HAL_DATASPACE_UNKNOWN
- status_t setDefaultBufferDataSpace(android_dataspace defaultDataSpace);
-
};
} // namespace android
diff --git a/include/gui/ConsumerBase.h b/include/gui/ConsumerBase.h
index 46c603d..9307a26 100644
--- a/include/gui/ConsumerBase.h
+++ b/include/gui/ConsumerBase.h
@@ -76,6 +76,15 @@ public:
// See IGraphicBufferConsumer::detachBuffer
status_t detachBuffer(int slot);
+ // See IGraphicBufferConsumer::setDefaultBufferSize
+ status_t setDefaultBufferSize(uint32_t width, uint32_t height);
+
+ // See IGraphicBufferConsumer::setDefaultBufferFormat
+ status_t setDefaultBufferFormat(PixelFormat defaultFormat);
+
+ // See IGraphicBufferConsumer::setDefaultBufferDataSpace
+ status_t setDefaultBufferDataSpace(android_dataspace defaultDataSpace);
+
private:
ConsumerBase(const ConsumerBase&);
void operator=(const ConsumerBase&);
diff --git a/include/gui/CpuConsumer.h b/include/gui/CpuConsumer.h
index c99ab29..3b07a31 100644
--- a/include/gui/CpuConsumer.h
+++ b/include/gui/CpuConsumer.h
@@ -80,23 +80,6 @@ class CpuConsumer : public ConsumerBase
// log messages.
void setName(const String8& name);
- // setDefaultBufferSize is used to set the size of buffers returned by
- // requestBuffers when a width and height of zero is requested.
- // A call to setDefaultBufferSize() may trigger requestBuffers() to
- // be called from the client. Default size is 1x1.
- status_t setDefaultBufferSize(uint32_t width, uint32_t height);
-
- // setDefaultBufferFormat allows CpuConsumer's BufferQueue to create buffers
- // of a defaultFormat if no format is specified by producer.
- // The initial default is PIXEL_FORMAT_RGBA_8888.
- status_t setDefaultBufferFormat(PixelFormat defaultFormat);
-
- // setDefaultBufferDataSpace allows the BufferQueue to create
- // GraphicBuffers of a defaultDataSpace if no data space is specified
- // in queueBuffer.
- // The initial default is HAL_DATASPACE_UNKNOWN
- status_t setDefaultBufferDataSpace(android_dataspace defaultDataSpace);
-
// Gets the next graphics buffer from the producer and locks it for CPU use,
// filling out the passed-in locked buffer structure with the native pointer
// and metadata. Returns BAD_VALUE if no new buffer is available, and
diff --git a/libs/gui/BufferItemConsumer.cpp b/libs/gui/BufferItemConsumer.cpp
index 194121f..578b8d9 100644
--- a/libs/gui/BufferItemConsumer.cpp
+++ b/libs/gui/BufferItemConsumer.cpp
@@ -100,20 +100,4 @@ status_t BufferItemConsumer::releaseBuffer(const BufferItem &item,
return err;
}
-status_t BufferItemConsumer::setDefaultBufferSize(uint32_t w, uint32_t h) {
- Mutex::Autolock _l(mMutex);
- return mConsumer->setDefaultBufferSize(w, h);
-}
-
-status_t BufferItemConsumer::setDefaultBufferFormat(PixelFormat defaultFormat) {
- Mutex::Autolock _l(mMutex);
- return mConsumer->setDefaultBufferFormat(defaultFormat);
-}
-
-status_t BufferItemConsumer::setDefaultBufferDataSpace(
- android_dataspace defaultDataSpace) {
- Mutex::Autolock _l(mMutex);
- return mConsumer->setDefaultBufferDataSpace(defaultDataSpace);
-}
-
} // namespace android
diff --git a/libs/gui/ConsumerBase.cpp b/libs/gui/ConsumerBase.cpp
index 0e42daf..04ab06b 100644
--- a/libs/gui/ConsumerBase.cpp
+++ b/libs/gui/ConsumerBase.cpp
@@ -198,6 +198,22 @@ status_t ConsumerBase::detachBuffer(int slot) {
return result;
}
+status_t ConsumerBase::setDefaultBufferSize(uint32_t width, uint32_t height) {
+ Mutex::Autolock _l(mMutex);
+ return mConsumer->setDefaultBufferSize(width, height);
+}
+
+status_t ConsumerBase::setDefaultBufferFormat(PixelFormat defaultFormat) {
+ Mutex::Autolock _l(mMutex);
+ return mConsumer->setDefaultBufferFormat(defaultFormat);
+}
+
+status_t ConsumerBase::setDefaultBufferDataSpace(
+ android_dataspace defaultDataSpace) {
+ Mutex::Autolock _l(mMutex);
+ return mConsumer->setDefaultBufferDataSpace(defaultDataSpace);
+}
+
void ConsumerBase::dump(String8& result) const {
dump(result, "");
}
diff --git a/libs/gui/CpuConsumer.cpp b/libs/gui/CpuConsumer.cpp
index eb39469..e29b740 100644
--- a/libs/gui/CpuConsumer.cpp
+++ b/libs/gui/CpuConsumer.cpp
@@ -56,25 +56,6 @@ void CpuConsumer::setName(const String8& name) {
mConsumer->setConsumerName(name);
}
-status_t CpuConsumer::setDefaultBufferSize(uint32_t width, uint32_t height)
-{
- Mutex::Autolock _l(mMutex);
- return mConsumer->setDefaultBufferSize(width, height);
-}
-
-status_t CpuConsumer::setDefaultBufferFormat(PixelFormat defaultFormat)
-{
- Mutex::Autolock _l(mMutex);
- return mConsumer->setDefaultBufferFormat(defaultFormat);
-}
-
-status_t CpuConsumer::setDefaultBufferDataSpace(
- android_dataspace defaultDataSpace)
-{
- Mutex::Autolock _l(mMutex);
- return mConsumer->setDefaultBufferDataSpace(defaultDataSpace);
-}
-
static bool isPossiblyYUV(PixelFormat format) {
switch (static_cast<int>(format)) {
case HAL_PIXEL_FORMAT_RGBA_8888: