summaryrefslogtreecommitdiffstats
path: root/include/gui
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2015-04-07 18:14:37 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-04-07 18:14:50 +0000
commit11da530a704fc9406d6779c5b985d3394c6a8474 (patch)
tree0ccc284b29a954b5af201192d0edd0af7fb129c8 /include/gui
parent7b5f82d8d726e4bcd21c19340c0743a728bc0253 (diff)
parent1c2001efcf56d7f65242249fa4e5833f03a68e37 (diff)
downloadframeworks_native-11da530a704fc9406d6779c5b985d3394c6a8474.zip
frameworks_native-11da530a704fc9406d6779c5b985d3394c6a8474.tar.gz
frameworks_native-11da530a704fc9406d6779c5b985d3394c6a8474.tar.bz2
Merge "Cherry-pick dataSpace and BufferItem changes" into lmp-mr1-dev-plus-aosp
Diffstat (limited to 'include/gui')
-rw-r--r--include/gui/BufferItem.h15
-rw-r--r--include/gui/BufferItemConsumer.h13
-rw-r--r--include/gui/BufferQueueConsumer.h9
-rw-r--r--include/gui/BufferQueueCore.h5
-rw-r--r--include/gui/ConsumerBase.h4
-rw-r--r--include/gui/CpuConsumer.h7
-rw-r--r--include/gui/GLConsumer.h5
-rw-r--r--include/gui/IGraphicBufferConsumer.h14
-rw-r--r--include/gui/IGraphicBufferProducer.h20
-rw-r--r--include/gui/Surface.h7
10 files changed, 84 insertions, 15 deletions
diff --git a/include/gui/BufferItem.h b/include/gui/BufferItem.h
index 01b6ff4..112c482 100644
--- a/include/gui/BufferItem.h
+++ b/include/gui/BufferItem.h
@@ -44,6 +44,7 @@ class BufferItem : public Flattenable<BufferItem> {
// The default value of mBuf, used to indicate this doesn't correspond to a slot.
enum { INVALID_BUFFER_SLOT = -1 };
BufferItem();
+ BufferItem(const IGraphicBufferConsumer::BufferItem& item);
~BufferItem();
operator IGraphicBufferConsumer::BufferItem() const;
@@ -78,11 +79,21 @@ class BufferItem : public Flattenable<BufferItem> {
// automatically when the buffer was queued.
bool mIsAutoTimestamp;
+ // mDataSpace is the current dataSpace value for this buffer slot. This gets
+ // set by queueBuffer each time this slot is queued. The meaning of the
+ // dataSpace is format-dependent.
+ android_dataspace mDataSpace;
+
// mFrameNumber is the number of the queued frame for this slot.
uint64_t mFrameNumber;
- // mSlot is the slot index of this buffer (default INVALID_BUFFER_SLOT).
- int mSlot;
+ union {
+ // mSlot is the slot index of this buffer (default INVALID_BUFFER_SLOT).
+ int mSlot;
+
+ // mBuf is the former name for mSlot
+ int mBuf;
+ };
// mIsDroppable whether this buffer was queued with the
// property that it can be replaced by a new buffer for the purpose of
diff --git a/include/gui/BufferItemConsumer.h b/include/gui/BufferItemConsumer.h
index 869b470..57e121e 100644
--- a/include/gui/BufferItemConsumer.h
+++ b/include/gui/BufferItemConsumer.h
@@ -76,8 +76,10 @@ class BufferItemConsumer: public ConsumerBase
//
// If waitForFence is true, and the acquired BufferItem has a valid fence object,
// acquireBuffer will wait on the fence with no timeout before returning.
- status_t acquireBuffer(BufferItem *item, nsecs_t presentWhen,
- bool waitForFence = true);
+ status_t acquireBuffer(BufferQueue::BufferItem *item, nsecs_t presentWhen,
+ bool waitForFence = true);
+ status_t acquireBuffer(android::BufferItem* item, nsecs_t presentWhen,
+ bool waitForFence = true);
// Returns an acquired buffer to the queue, allowing it to be reused. Since
// only a fixed number of buffers may be acquired at a time, old buffers
@@ -96,6 +98,13 @@ class BufferItemConsumer: public ConsumerBase
// 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/BufferQueueConsumer.h b/include/gui/BufferQueueConsumer.h
index 898c451..92127c1 100644
--- a/include/gui/BufferQueueConsumer.h
+++ b/include/gui/BufferQueueConsumer.h
@@ -48,6 +48,8 @@ public:
// is CLOCK_MONOTONIC.
virtual status_t acquireBuffer(BufferItem* outBuffer,
nsecs_t expectedPresent);
+ virtual status_t acquireBuffer(android::BufferItem* outBuffer,
+ nsecs_t expectedPresent);
// See IGraphicBufferConsumer::detachBuffer
virtual status_t detachBuffer(int slot);
@@ -128,6 +130,13 @@ public:
// in dequeueBuffer. The initial default is HAL_PIXEL_FORMAT_RGBA_8888.
virtual 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
+ virtual status_t setDefaultBufferDataSpace(
+ android_dataspace defaultDataSpace);
+
// setConsumerUsageBits will turn on additional usage bits for dequeueBuffer.
// These are merged with the bits passed to dequeueBuffer. The values are
// enumerated in gralloc.h, e.g. GRALLOC_USAGE_HW_RENDER; the default is 0.
diff --git a/include/gui/BufferQueueCore.h b/include/gui/BufferQueueCore.h
index b23cb08..797a108 100644
--- a/include/gui/BufferQueueCore.h
+++ b/include/gui/BufferQueueCore.h
@@ -209,6 +209,11 @@ private:
// in dequeueBuffer if a width and height of 0 are specified.
uint32_t mDefaultHeight;
+ // mDefaultBufferDataSpace holds the default dataSpace of queued buffers.
+ // It is used in queueBuffer if a dataspace of 0 (HAL_DATASPACE_UNKNOWN)
+ // is specified.
+ android_dataspace mDefaultBufferDataSpace;
+
// mDefaultMaxBufferCount is the default limit on the number of buffers that
// will be allocated at one time. This default limit is set by the consumer.
// The limit (as opposed to the default limit) may be overriden by the
diff --git a/include/gui/ConsumerBase.h b/include/gui/ConsumerBase.h
index f7ab5ac..46ad20e 100644
--- a/include/gui/ConsumerBase.h
+++ b/include/gui/ConsumerBase.h
@@ -153,8 +153,8 @@ protected:
// initialization that must take place the first time a buffer is assigned
// to a slot. If it is overridden the derived class's implementation must
// call ConsumerBase::acquireBufferLocked.
- virtual status_t acquireBufferLocked(IGraphicBufferConsumer::BufferItem *item,
- nsecs_t presentWhen);
+ virtual status_t acquireBufferLocked(BufferItem *item, nsecs_t presentWhen);
+ virtual status_t acquireBufferLocked(BufferQueue::BufferItem *item, nsecs_t presentWhen);
// releaseBufferLocked relinquishes control over a buffer, returning that
// control to the BufferQueue.
diff --git a/include/gui/CpuConsumer.h b/include/gui/CpuConsumer.h
index faf6852..c99ab29 100644
--- a/include/gui/CpuConsumer.h
+++ b/include/gui/CpuConsumer.h
@@ -53,6 +53,7 @@ class CpuConsumer : public ConsumerBase
uint32_t transform;
uint32_t scalingMode;
int64_t timestamp;
+ android_dataspace dataSpace;
uint64_t frameNumber;
// this is the same as format, except for formats that are compatible with
// a flexible format (e.g. HAL_PIXEL_FORMAT_YCbCr_420_888). In the latter
@@ -90,6 +91,12 @@ class CpuConsumer : public ConsumerBase
// 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/include/gui/GLConsumer.h b/include/gui/GLConsumer.h
index 053d1ed..167ef20 100644
--- a/include/gui/GLConsumer.h
+++ b/include/gui/GLConsumer.h
@@ -198,6 +198,7 @@ public:
// These functions call the corresponding BufferQueue implementation
// so the refactoring can proceed smoothly
status_t setDefaultBufferFormat(PixelFormat defaultFormat);
+ status_t setDefaultBufferDataSpace(android_dataspace defaultDataSpace);
status_t setConsumerUsageBits(uint32_t usage);
status_t setTransformHint(uint32_t hint);
@@ -240,8 +241,8 @@ protected:
// acquireBufferLocked overrides the ConsumerBase method to update the
// mEglSlots array in addition to the ConsumerBase behavior.
- virtual status_t acquireBufferLocked(BufferQueue::BufferItem *item,
- nsecs_t presentWhen);
+ virtual status_t acquireBufferLocked(BufferItem *item, nsecs_t presentWhen);
+ virtual status_t acquireBufferLocked(IGraphicBufferConsumer::BufferItem *item, nsecs_t presentWhen);
// releaseBufferLocked overrides the ConsumerBase method to update the
// mEglSlots array in addition to the ConsumerBase.
diff --git a/include/gui/IGraphicBufferConsumer.h b/include/gui/IGraphicBufferConsumer.h
index 9ac23c2..ae85bd5 100644
--- a/include/gui/IGraphicBufferConsumer.h
+++ b/include/gui/IGraphicBufferConsumer.h
@@ -34,6 +34,7 @@
namespace android {
// ----------------------------------------------------------------------------
+class BufferItem;
class Fence;
class GraphicBuffer;
class IConsumerListener;
@@ -86,6 +87,10 @@ public:
// automatically when the buffer was queued.
bool mIsAutoTimestamp;
+ // mDataSpace is the current dataSpace for this buffer slot. This gets
+ // set by queueBuffer each time this slot is queued.
+ android_dataspace mDataSpace;
+
// mFrameNumber is the number of the queued frame for this slot.
uint64_t mFrameNumber;
@@ -143,6 +148,7 @@ public:
// Return of a negative value means an error has occurred:
// * INVALID_OPERATION - too many buffers have been acquired
virtual status_t acquireBuffer(BufferItem* buffer, nsecs_t presentWhen) = 0;
+ virtual status_t acquireBuffer(android::BufferItem* buffer, nsecs_t presentWhen) = 0;
// detachBuffer attempts to remove all ownership of the buffer in the given
// slot from the buffer queue. If this call succeeds, the slot will be
@@ -287,6 +293,14 @@ public:
// Return of a value other than NO_ERROR means an unknown error has occurred.
virtual status_t setDefaultBufferFormat(PixelFormat defaultFormat) = 0;
+ // setDefaultBufferDataSpace is a request to the producer to provide buffers
+ // of the indicated dataSpace. The producer may ignore this request.
+ // The initial default is HAL_DATASPACE_UNKNOWN.
+ //
+ // Return of a value other than NO_ERROR means an unknown error has occurred.
+ virtual status_t setDefaultBufferDataSpace(
+ android_dataspace defaultDataSpace) = 0;
+
// setConsumerUsageBits will turn on additional usage bits for dequeueBuffer.
// These are merged with the bits passed to dequeueBuffer. The values are
// enumerated in gralloc.h, e.g. GRALLOC_USAGE_HW_RENDER; the default is 0.
diff --git a/include/gui/IGraphicBufferProducer.h b/include/gui/IGraphicBufferProducer.h
index 4d3cd9a..374245a 100644
--- a/include/gui/IGraphicBufferProducer.h
+++ b/include/gui/IGraphicBufferProducer.h
@@ -265,6 +265,7 @@ public:
inline QueueBufferInput(const Parcel& parcel);
// timestamp - a monotonically increasing value in nanoseconds
// isAutoTimestamp - if the timestamp was synthesized at queue time
+ // dataSpace - description of the contents, interpretation depends on format
// crop - a crop rectangle that's used as a hint to the consumer
// scalingMode - a set of flags from NATIVE_WINDOW_SCALING_* in <window.h>
// transform - a set of flags from NATIVE_WINDOW_TRANSFORM_* in <window.h>
@@ -274,17 +275,21 @@ public:
// sticky - the sticky transform set in Surface (only used by the LEGACY
// camera mode).
inline QueueBufferInput(int64_t timestamp, bool isAutoTimestamp,
- const Rect& crop, int scalingMode, uint32_t transform, bool async,
- const sp<Fence>& fence, uint32_t sticky = 0)
- : timestamp(timestamp), isAutoTimestamp(isAutoTimestamp), crop(crop),
- scalingMode(scalingMode), transform(transform), stickyTransform(sticky),
- async(async), fence(fence) { }
+ android_dataspace dataSpace, const Rect& crop, int scalingMode,
+ uint32_t transform, bool async, const sp<Fence>& fence,
+ uint32_t sticky = 0)
+ : timestamp(timestamp), isAutoTimestamp(isAutoTimestamp),
+ dataSpace(dataSpace), crop(crop), scalingMode(scalingMode),
+ transform(transform), stickyTransform(sticky),
+ async(async), fence(fence) { }
inline void deflate(int64_t* outTimestamp, bool* outIsAutoTimestamp,
- Rect* outCrop, int* outScalingMode, uint32_t* outTransform,
- bool* outAsync, sp<Fence>* outFence,
+ android_dataspace* outDataSpace,
+ Rect* outCrop, int* outScalingMode,
+ uint32_t* outTransform, bool* outAsync, sp<Fence>* outFence,
uint32_t* outStickyTransform = NULL) const {
*outTimestamp = timestamp;
*outIsAutoTimestamp = bool(isAutoTimestamp);
+ *outDataSpace = dataSpace;
*outCrop = crop;
*outScalingMode = scalingMode;
*outTransform = transform;
@@ -304,6 +309,7 @@ public:
private:
int64_t timestamp;
int isAutoTimestamp;
+ android_dataspace dataSpace;
Rect crop;
int scalingMode;
uint32_t transform;
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
index 863f22b..40e2fc1 100644
--- a/include/gui/Surface.h
+++ b/include/gui/Surface.h
@@ -146,6 +146,7 @@ private:
int dispatchLock(va_list args);
int dispatchUnlockAndPost(va_list args);
int dispatchSetSidebandStream(va_list args);
+ int dispatchSetBuffersDataSpace(va_list args);
protected:
virtual int dequeueBuffer(ANativeWindowBuffer** buffer, int* fenceFd);
@@ -168,6 +169,7 @@ protected:
virtual int setBuffersTransform(uint32_t transform);
virtual int setBuffersStickyTransform(uint32_t transform);
virtual int setBuffersTimestamp(int64_t timestamp);
+ virtual int setBuffersDataSpace(android_dataspace dataSpace);
virtual int setCrop(Rect const* rect);
virtual int setUsage(uint32_t reqUsage);
@@ -223,6 +225,11 @@ private:
// a timestamp is auto-generated when queueBuffer is called.
int64_t mTimestamp;
+ // mDataSpace is the buffer dataSpace that will be used for the next buffer
+ // queue operation. It defaults to HAL_DATASPACE_UNKNOWN, which
+ // means that the buffer contains some type of color data.
+ android_dataspace mDataSpace;
+
// mCrop is the crop rectangle that will be used for the next buffer
// that gets queued. It is set by calling setCrop.
Rect mCrop;