Add sticky transform to surfaceflinger.
Bug: 15116722
- Adds a sticky transform field that can be set from a
SurfaceFlinger client Surface. This transform is
added to any transform applied to the Surface.
Change-Id: Idaa4311dfd027b2d2b8ea5e2c6cba2da5779d753
diff --git a/include/gui/BufferQueueProducer.h b/include/gui/BufferQueueProducer.h
index fe8a308..3fc5de2 100644
--- a/include/gui/BufferQueueProducer.h
+++ b/include/gui/BufferQueueProducer.h
@@ -195,6 +195,8 @@
// most updates).
String8 mConsumerName;
+ uint32_t mStickyTransform;
+
}; // class BufferQueueProducer
} // namespace android
diff --git a/include/gui/IGraphicBufferProducer.h b/include/gui/IGraphicBufferProducer.h
index 9b96b2b..4e9e810 100644
--- a/include/gui/IGraphicBufferProducer.h
+++ b/include/gui/IGraphicBufferProducer.h
@@ -273,15 +273,18 @@
// async - if the buffer is queued in asynchronous mode
// fence - a fence that the consumer must wait on before reading the buffer,
// set this to Fence::NO_FENCE if the buffer is ready immediately
+ // 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)
+ const sp<Fence>& fence, uint32_t sticky = 0)
: timestamp(timestamp), isAutoTimestamp(isAutoTimestamp), crop(crop),
- scalingMode(scalingMode), transform(transform), async(async),
- fence(fence) { }
+ 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) const {
+ bool* outAsync, sp<Fence>* outFence,
+ uint32_t* outStickyTransform = NULL) const {
*outTimestamp = timestamp;
*outIsAutoTimestamp = bool(isAutoTimestamp);
*outCrop = crop;
@@ -289,6 +292,9 @@
*outTransform = transform;
*outAsync = bool(async);
*outFence = fence;
+ if (outStickyTransform != NULL) {
+ *outStickyTransform = stickyTransform;
+ }
}
// Flattenable protocol
@@ -303,6 +309,7 @@
Rect crop;
int scalingMode;
uint32_t transform;
+ uint32_t stickyTransform;
int async;
sp<Fence> fence;
};
diff --git a/include/gui/Surface.h b/include/gui/Surface.h
index dcfe74f..35ab7f6 100644
--- a/include/gui/Surface.h
+++ b/include/gui/Surface.h
@@ -138,6 +138,7 @@
int dispatchSetBuffersFormat(va_list args);
int dispatchSetScalingMode(va_list args);
int dispatchSetBuffersTransform(va_list args);
+ int dispatchSetBuffersStickyTransform(va_list args);
int dispatchSetBuffersTimestamp(va_list args);
int dispatchSetCrop(va_list args);
int dispatchSetPostTransformCrop(va_list args);
@@ -163,6 +164,7 @@
virtual int setBuffersFormat(int format);
virtual int setScalingMode(int mode);
virtual int setBuffersTransform(int transform);
+ virtual int setBuffersStickyTransform(int transform);
virtual int setBuffersTimestamp(int64_t timestamp);
virtual int setCrop(Rect const* rect);
virtual int setUsage(uint32_t reqUsage);
@@ -231,6 +233,12 @@
// buffer that gets queued. It is set by calling setTransform.
uint32_t mTransform;
+ // mStickyTransform is a transform that is applied on top of mTransform
+ // in each buffer that is queued. This is typically used to force the
+ // compositor to apply a transform, and will prevent the transform hint
+ // from being set by the compositor.
+ uint32_t mStickyTransform;
+
// mDefaultWidth is default width of the buffers, regardless of the
// native_window_set_buffers_dimensions call.
uint32_t mDefaultWidth;