Merge "Update stubs to use libnativehelper for java.nio.Buffer access" into qt-dev
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index 93b4191..e6eb327 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -829,8 +829,9 @@
mDefaultHeight = output.height;
mNextFrameNumber = output.nextFrameNumber;
- // Disable transform hint if sticky transform is set.
- if (mStickyTransform == 0) {
+ // Ignore transform hint if sticky transform is set or transform to display inverse flag is
+ // set.
+ if (mStickyTransform == 0 && !transformToDisplayInverse()) {
mTransformHint = output.transformHint;
}
@@ -1271,6 +1272,11 @@
return getConsumerUsage(usage);
}
+bool Surface::transformToDisplayInverse() {
+ return (mTransform & NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY) ==
+ NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY;
+}
+
int Surface::connect(int api) {
static sp<IProducerListener> listener = new DummyProducerListener();
return connect(api, listener);
@@ -1293,8 +1299,10 @@
mDefaultHeight = output.height;
mNextFrameNumber = output.nextFrameNumber;
- // Disable transform hint if sticky transform is set.
- if (mStickyTransform == 0) {
+ // Ignore transform hint if sticky transform is set or transform to display inverse flag is
+ // set. Transform hint should be ignored if the client is expected to always submit buffers
+ // in the same orientation.
+ if (mStickyTransform == 0 && !transformToDisplayInverse()) {
mTransformHint = output.transformHint;
}
@@ -1591,6 +1599,13 @@
ATRACE_CALL();
ALOGV("Surface::setBuffersTransform");
Mutex::Autolock lock(mMutex);
+ // Ensure NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY is sticky. If the client sets the flag, do not
+ // override it until the surface is disconnected. This is a temporary workaround for camera
+ // until they switch to using Buffer State Layers. Currently if client sets the buffer transform
+ // it may be overriden by the buffer producer when the producer sets the buffer transform.
+ if (transformToDisplayInverse()) {
+ transform |= NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY;
+ }
mTransform = transform;
return NO_ERROR;
}
diff --git a/libs/gui/include/gui/Surface.h b/libs/gui/include/gui/Surface.h
index 248e105..0c471bb 100644
--- a/libs/gui/include/gui/Surface.h
+++ b/libs/gui/include/gui/Surface.h
@@ -230,6 +230,7 @@
int dispatchGetWideColorSupport(va_list args);
int dispatchGetHdrSupport(va_list args);
int dispatchGetConsumerUsage64(va_list args);
+ bool transformToDisplayInverse();
protected:
virtual int dequeueBuffer(ANativeWindowBuffer** buffer, int* fenceFd);
diff --git a/libs/ui/Gralloc3.cpp b/libs/ui/Gralloc3.cpp
index 7f8e57c..eb43765 100644
--- a/libs/ui/Gralloc3.cpp
+++ b/libs/ui/Gralloc3.cpp
@@ -28,7 +28,7 @@
#pragma clang diagnostic pop
using android::hardware::graphics::allocator::V3_0::IAllocator;
-using android::hardware::graphics::common::V1_1::BufferUsage;
+using android::hardware::graphics::common::V1_2::BufferUsage;
using android::hardware::graphics::mapper::V3_0::BufferDescriptor;
using android::hardware::graphics::mapper::V3_0::Error;
using android::hardware::graphics::mapper::V3_0::IMapper;
@@ -44,11 +44,7 @@
static const uint64_t validUsageBits = []() -> uint64_t {
uint64_t bits = 0;
for (const auto bit :
- hardware::hidl_enum_range<hardware::graphics::common::V1_0::BufferUsage>()) {
- bits = bits | bit;
- }
- for (const auto bit :
- hardware::hidl_enum_range<hardware::graphics::common::V1_1::BufferUsage>()) {
+ hardware::hidl_enum_range<hardware::graphics::common::V1_2::BufferUsage>()) {
bits = bits | bit;
}
return bits;
@@ -71,7 +67,7 @@
outDescriptorInfo->width = width;
outDescriptorInfo->height = height;
outDescriptorInfo->layerCount = layerCount;
- outDescriptorInfo->format = static_cast<hardware::graphics::common::V1_1::PixelFormat>(format);
+ outDescriptorInfo->format = static_cast<hardware::graphics::common::V1_2::PixelFormat>(format);
outDescriptorInfo->usage = usage;
}
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 2bbac72..1527c34 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1230,10 +1230,8 @@
void Layer::updateTransformHint(const sp<const DisplayDevice>& display) const {
uint32_t orientation = 0;
- // Disable setting transform hint if the debug flag is set or if the
- // getTransformToDisplayInverse flag is set and the client wants to submit buffers
- // in one orientation.
- if (!mFlinger->mDebugDisableTransformHint && !getTransformToDisplayInverse()) {
+ // Disable setting transform hint if the debug flag is set.
+ if (!mFlinger->mDebugDisableTransformHint) {
// The transform hint is used to improve performance, but we can
// only have a single transform hint, it cannot
// apply to all displays.