diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2015-02-19 16:10:43 -0800 |
---|---|---|
committer | Dan Stoza <stoza@google.com> | 2015-03-19 13:56:00 -0700 |
commit | 82c6bcc9705eabcaf5b9e45bc81867b0e2d61a02 (patch) | |
tree | 5ae0c4334682e0f5ca86328ec0b69a00ca421355 /include/gui | |
parent | ad36432de81c4c88d726680b7c52e8357df98455 (diff) | |
download | frameworks_native-82c6bcc9705eabcaf5b9e45bc81867b0e2d61a02.zip frameworks_native-82c6bcc9705eabcaf5b9e45bc81867b0e2d61a02.tar.gz frameworks_native-82c6bcc9705eabcaf5b9e45bc81867b0e2d61a02.tar.bz2 |
DO NOT MERGE Add dataSpace to buffer queues; remove old format enums.
- Wire up new dataSpace parameter through buffer queue stack
- Update tests to include the parameter
- Switch eglApi to using dataSpace to indicate sRGB gamma/linear
difference
- Remove RAW_SENSOR in favor of RAW16
- Remove use of sRGB format enums
- Add default dataspace to buffer queue core
- Add query for default dataspace
Cherry pick of I070bd2e7c56506055c419004c29e2e3feac725df
Change-Id: I461952389c18051176c6b75e664f20ad369f5760
Diffstat (limited to 'include/gui')
-rw-r--r-- | include/gui/BufferItem.h | 5 | ||||
-rw-r--r-- | include/gui/BufferItemConsumer.h | 7 | ||||
-rw-r--r-- | include/gui/BufferQueueConsumer.h | 7 | ||||
-rw-r--r-- | include/gui/BufferQueueCore.h | 5 | ||||
-rw-r--r-- | include/gui/CpuConsumer.h | 7 | ||||
-rw-r--r-- | include/gui/GLConsumer.h | 1 | ||||
-rw-r--r-- | include/gui/IGraphicBufferConsumer.h | 12 | ||||
-rw-r--r-- | include/gui/IGraphicBufferProducer.h | 20 | ||||
-rw-r--r-- | include/gui/Surface.h | 7 |
9 files changed, 64 insertions, 7 deletions
diff --git a/include/gui/BufferItem.h b/include/gui/BufferItem.h index 01b6ff4..c7a8bc9 100644 --- a/include/gui/BufferItem.h +++ b/include/gui/BufferItem.h @@ -78,6 +78,11 @@ 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; diff --git a/include/gui/BufferItemConsumer.h b/include/gui/BufferItemConsumer.h index 869b470..45f329e 100644 --- a/include/gui/BufferItemConsumer.h +++ b/include/gui/BufferItemConsumer.h @@ -96,6 +96,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..9c91fc7 100644 --- a/include/gui/BufferQueueConsumer.h +++ b/include/gui/BufferQueueConsumer.h @@ -128,6 +128,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/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..bf9eb24 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); diff --git a/include/gui/IGraphicBufferConsumer.h b/include/gui/IGraphicBufferConsumer.h index 9ac23c2..53b4e75 100644 --- a/include/gui/IGraphicBufferConsumer.h +++ b/include/gui/IGraphicBufferConsumer.h @@ -86,6 +86,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; @@ -287,6 +291,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; |