summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2015-02-19 16:10:43 -0800
committerDan Stoza <stoza@google.com>2015-04-07 11:11:43 -0700
commit1c2001efcf56d7f65242249fa4e5833f03a68e37 (patch)
tree79227b4adfac5c3aa4d7ef31bcfce17acc42acf0 /include
parent2d4cf62a2cdfbfbbca5757eb7dd1498d118bf7c9 (diff)
downloadframeworks_native-1c2001efcf56d7f65242249fa4e5833f03a68e37.zip
frameworks_native-1c2001efcf56d7f65242249fa4e5833f03a68e37.tar.gz
frameworks_native-1c2001efcf56d7f65242249fa4e5833f03a68e37.tar.bz2
Cherry-pick dataSpace and BufferItem changes
Add dataSpace to buffer queues; remove old format enums. (cherry picked from commit 82c6bcc9705eabcaf5b9e45bc81867b0e2d61a02) libgui: Prepare for IGBC::BufferItem removal (cherry picked from commit cf3834db104e0b052056e3a06d46e3f222f0d372) SurfaceFlinger: Stop using IGBC::BufferItem (cherry picked from commit 11611f9be590480d7ea27bf0153558573ddcded2) Change-Id: Ic2e4770b916d2d1477e5ce98c4b49a0072ea03ff (cherry picked from commit 6c450101753d0219b151e79007bcded1bfbb058b)
Diffstat (limited to 'include')
-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
-rw-r--r--include/ui/PixelFormat.h2
11 files changed, 84 insertions, 17 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;
diff --git a/include/ui/PixelFormat.h b/include/ui/PixelFormat.h
index e7e8ffc..f26fecb 100644
--- a/include/ui/PixelFormat.h
+++ b/include/ui/PixelFormat.h
@@ -60,8 +60,6 @@ enum {
PIXEL_FORMAT_BGRA_8888 = HAL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA
PIXEL_FORMAT_RGBA_5551 = 6, // 16-bit ARGB
PIXEL_FORMAT_RGBA_4444 = 7, // 16-bit ARGB
- PIXEL_FORMAT_sRGB_A_8888 = HAL_PIXEL_FORMAT_sRGB_A_8888, // 4x8-bit sRGB + A
- PIXEL_FORMAT_sRGB_X_8888 = HAL_PIXEL_FORMAT_sRGB_X_8888, // 4x8-bit sRGB, no A
};
typedef int32_t PixelFormat;