Merge "Fix HDR layer info listener to use the right area" into sc-dev
diff --git a/libs/binder/TEST_MAPPING b/libs/binder/TEST_MAPPING
index b58d919..1010a2d 100644
--- a/libs/binder/TEST_MAPPING
+++ b/libs/binder/TEST_MAPPING
@@ -52,6 +52,9 @@
"name": "CtsOsTestCases",
"options": [
{
+ "exclude-annotation": "android.platform.test.annotations.LargeTest"
+ },
+ {
"exclude-filter": "android.os.cts.BuildTest#testSdkInt"
},
{
diff --git a/libs/gui/BLASTBufferQueue.cpp b/libs/gui/BLASTBufferQueue.cpp
index ac8feaa..7d57d8b 100644
--- a/libs/gui/BLASTBufferQueue.cpp
+++ b/libs/gui/BLASTBufferQueue.cpp
@@ -171,6 +171,8 @@
.apply();
mNumAcquired = 0;
mNumFrameAvailable = 0;
+ BQA_LOGV("BLASTBufferQueue created width=%d height=%d format=%d mTransformHint=%d", width,
+ height, format, mTransformHint);
}
BLASTBufferQueue::~BLASTBufferQueue() {
@@ -190,7 +192,6 @@
void BLASTBufferQueue::update(const sp<SurfaceControl>& surface, uint32_t width, uint32_t height,
int32_t format) {
std::unique_lock _lock{mMutex};
- BQA_LOGV("update width=%d height=%d format=%d", width, height, format);
if (mFormat != format) {
mFormat = format;
mBufferItemConsumer->setDefaultBufferFormat(convertBufferFormat(format));
@@ -212,6 +213,8 @@
mTransformHint = mSurfaceControl->getTransformHint();
mBufferItemConsumer->setTransformHint(mTransformHint);
}
+ BQA_LOGV("update width=%d height=%d format=%d mTransformHint=%d", width, height, format,
+ mTransformHint);
ui::Size newSize(width, height);
if (mRequestedSize != newSize) {
@@ -267,6 +270,7 @@
mTransformHint = stat.transformHint;
mBufferItemConsumer->setTransformHint(mTransformHint);
+ BQA_LOGV("updated mTransformHint=%d", mTransformHint);
// Update frametime stamps if the frame was latched and presented, indicated by a
// valid latch time.
if (stat.latchTime > 0) {
@@ -339,6 +343,7 @@
mTransformHint = transformHint;
mSurfaceControl->setTransformHint(transformHint);
mBufferItemConsumer->setTransformHint(mTransformHint);
+ BQA_LOGV("updated mTransformHint=%d", mTransformHint);
}
// Calculate how many buffers we need to hold before we release them back
@@ -422,7 +427,7 @@
}
if (rejectBuffer(bufferItem)) {
- BQA_LOGE("rejecting buffer:active_size=%dx%d, requested_size=%dx%d"
+ BQA_LOGE("rejecting buffer:active_size=%dx%d, requested_size=%dx%d "
"buffer{size=%dx%d transform=%d}",
mSize.width, mSize.height, mRequestedSize.width, mRequestedSize.height,
buffer->getWidth(), buffer->getHeight(), bufferItem.mTransform);
@@ -515,11 +520,11 @@
BQA_LOGV("processNextBufferLocked size=%dx%d mFrameNumber=%" PRIu64
" applyTransaction=%s mTimestamp=%" PRId64 "%s mPendingTransactions.size=%d"
- " graphicBufferId=%" PRIu64 "%s",
+ " graphicBufferId=%" PRIu64 "%s transform=%d",
mSize.width, mSize.height, bufferItem.mFrameNumber, toString(applyTransaction),
bufferItem.mTimestamp, bufferItem.mIsAutoTimestamp ? "(auto)" : "",
static_cast<uint32_t>(mPendingTransactions.size()), bufferItem.mGraphicBuffer->getId(),
- bufferItem.mAutoRefresh ? " mAutoRefresh" : "");
+ bufferItem.mAutoRefresh ? " mAutoRefresh" : "", bufferItem.mTransform);
}
Rect BLASTBufferQueue::computeCrop(const BufferItem& item) {
@@ -646,14 +651,6 @@
status_t setFrameTimelineInfo(const FrameTimelineInfo& frameTimelineInfo) override {
return mBbq->setFrameTimelineInfo(frameTimelineInfo);
}
- protected:
- uint32_t getTransformHint() const override {
- if (mStickyTransform == 0 && !transformToDisplayInverse()) {
- return mBbq->getLastTransformHint();
- } else {
- return 0;
- }
- }
};
// TODO: Can we coalesce this with frame updates? Need to confirm
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index e65c721..2d99fc1 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -562,6 +562,10 @@
return (what & layer_state_t::eBufferChanged) || (what & layer_state_t::eCachedBufferChanged);
}
+bool layer_state_t::hasValidBuffer() const {
+ return buffer || cachedBuffer.isValid();
+}
+
status_t layer_state_t::matrix22_t::write(Parcel& output) const {
SAFE_PARCEL(output.writeFloat, dsdx);
SAFE_PARCEL(output.writeFloat, dtdx);
diff --git a/libs/gui/include/gui/LayerState.h b/libs/gui/include/gui/LayerState.h
index 8ac1e5d..465e34c 100644
--- a/libs/gui/include/gui/LayerState.h
+++ b/libs/gui/include/gui/LayerState.h
@@ -126,6 +126,7 @@
status_t write(Parcel& output) const;
status_t read(const Parcel& input);
bool hasBufferChanges() const;
+ bool hasValidBuffer() const;
struct matrix22_t {
float dsdx{0};
diff --git a/libs/gui/tests/BLASTBufferQueue_test.cpp b/libs/gui/tests/BLASTBufferQueue_test.cpp
index 6ff67aa..9082d27 100644
--- a/libs/gui/tests/BLASTBufferQueue_test.cpp
+++ b/libs/gui/tests/BLASTBufferQueue_test.cpp
@@ -71,6 +71,10 @@
return mBlastBufferQueueAdapter->mSurfaceControl;
}
+ sp<Surface> getSurface() {
+ return mBlastBufferQueueAdapter->getSurface(false /* includeSurfaceControlHandle */);
+ }
+
void waitForCallbacks() {
std::unique_lock lock{mBlastBufferQueueAdapter->mMutex};
// Wait until all but one of the submitted buffers have been released.
@@ -758,6 +762,48 @@
{0, 0, (int32_t)mDisplayWidth, (int32_t)mDisplayHeight / 2}));
}
+TEST_F(BLASTBufferQueueTest, TransformHint) {
+ // Transform hint is provided to BBQ via the surface control passed by WM
+ mSurfaceControl->setTransformHint(ui::Transform::ROT_90);
+
+ BLASTBufferQueueHelper adapter(mSurfaceControl, mDisplayWidth, mDisplayHeight);
+ sp<IGraphicBufferProducer> igbProducer = adapter.getIGraphicBufferProducer();
+ ASSERT_NE(nullptr, igbProducer.get());
+ ASSERT_EQ(NO_ERROR, igbProducer->setMaxDequeuedBufferCount(2));
+ sp<Surface> surface = adapter.getSurface();
+
+ // Before connecting to the surface, we do not get a valid transform hint
+ int transformHint;
+ surface->query(NATIVE_WINDOW_TRANSFORM_HINT, &transformHint);
+ ASSERT_EQ(ui::Transform::ROT_0, transformHint);
+
+ ASSERT_EQ(NO_ERROR,
+ surface->connect(NATIVE_WINDOW_API_CPU, new TestProducerListener(igbProducer)));
+
+ // After connecting to the surface, we should get the correct hint.
+ surface->query(NATIVE_WINDOW_TRANSFORM_HINT, &transformHint);
+ ASSERT_EQ(ui::Transform::ROT_90, transformHint);
+
+ ANativeWindow_Buffer buffer;
+ surface->lock(&buffer, nullptr /* inOutDirtyBounds */);
+
+ // Transform hint is updated via callbacks or surface control updates
+ mSurfaceControl->setTransformHint(ui::Transform::ROT_0);
+ adapter.update(mSurfaceControl, mDisplayWidth, mDisplayHeight);
+
+ // The hint does not change and matches the value used when dequeueing the buffer.
+ surface->query(NATIVE_WINDOW_TRANSFORM_HINT, &transformHint);
+ ASSERT_EQ(ui::Transform::ROT_90, transformHint);
+
+ surface->unlockAndPost();
+
+ // After queuing the buffer, we get the updated transform hint
+ surface->query(NATIVE_WINDOW_TRANSFORM_HINT, &transformHint);
+ ASSERT_EQ(ui::Transform::ROT_0, transformHint);
+
+ adapter.waitForCallbacks();
+}
+
class BLASTBufferQueueTransformTest : public BLASTBufferQueueTest {
public:
void test(uint32_t tr) {
diff --git a/libs/sensorprivacy/aidl/android/hardware/ISensorPrivacyManager.aidl b/libs/sensorprivacy/aidl/android/hardware/ISensorPrivacyManager.aidl
index f91f5b9..9564cba 100644
--- a/libs/sensorprivacy/aidl/android/hardware/ISensorPrivacyManager.aidl
+++ b/libs/sensorprivacy/aidl/android/hardware/ISensorPrivacyManager.aidl
@@ -36,7 +36,7 @@
void setSensorPrivacy(boolean enable);
- void setIndividualSensorPrivacy(int userId, int sensor, boolean enable);
+ void setIndividualSensorPrivacy(int userId, int source, int sensor, boolean enable);
- void setIndividualSensorPrivacyForProfileGroup(int userId, int sensor, boolean enable);
+ void setIndividualSensorPrivacyForProfileGroup(int userId, int source, int sensor, boolean enable);
}
diff --git a/libs/ui/include/ui/Transform.h b/libs/ui/include/ui/Transform.h
index a197b3b..33fbe05 100644
--- a/libs/ui/include/ui/Transform.h
+++ b/libs/ui/include/ui/Transform.h
@@ -112,6 +112,7 @@
void dump(const char* name, const char* prefix = "") const;
static constexpr RotationFlags toRotationFlags(Rotation);
+ static constexpr Rotation toRotation(RotationFlags);
private:
struct mat33 {
@@ -151,5 +152,20 @@
}
}
+inline constexpr Rotation Transform::toRotation(Transform::RotationFlags rotationFlags) {
+ switch (rotationFlags) {
+ case ROT_0:
+ return ROTATION_0;
+ case ROT_90:
+ return ROTATION_90;
+ case ROT_180:
+ return ROTATION_180;
+ case ROT_270:
+ return ROTATION_270;
+ default:
+ return ROTATION_0;
+ }
+}
+
} // namespace ui
} // namespace android
diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp
index 645e883..032ff9a 100644
--- a/services/surfaceflinger/BufferStateLayer.cpp
+++ b/services/surfaceflinger/BufferStateLayer.cpp
@@ -590,6 +590,7 @@
}
bool BufferStateLayer::setTransparentRegionHint(const Region& transparent) {
+ mDrawingState.sequence++;
mDrawingState.transparentRegionHint = transparent;
mDrawingState.modified = true;
setTransactionFlags(eTransactionNeeded);
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/CachedSet.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/CachedSet.h
index 2bf931c..2e7a377 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/CachedSet.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/planner/CachedSet.h
@@ -65,7 +65,9 @@
size_t getLayerCount() const { return mLayers.size(); }
const Layer& getFirstLayer() const { return mLayers[0]; }
const Rect& getBounds() const { return mBounds; }
- Rect getTextureBounds() const { return mOutputSpace.content; }
+ Rect getTextureBounds() const {
+ return mTexture ? mTexture->get()->getBuffer()->getBounds() : Rect::INVALID_RECT;
+ }
const Region& getVisibleRegion() const { return mVisibleRegion; }
size_t getAge() const { return mAge; }
std::shared_ptr<renderengine::ExternalTexture> getBuffer() const {
diff --git a/services/surfaceflinger/CompositionEngine/tests/planner/CachedSetTest.cpp b/services/surfaceflinger/CompositionEngine/tests/planner/CachedSetTest.cpp
index 7f0e186..b05a594 100644
--- a/services/surfaceflinger/CompositionEngine/tests/planner/CachedSetTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/planner/CachedSetTest.cpp
@@ -355,7 +355,7 @@
expectReadyBuffer(cachedSet);
EXPECT_EQ(mOutputState.framebufferSpace, cachedSet.getOutputSpace());
- EXPECT_EQ(mOutputState.framebufferSpace.content, cachedSet.getTextureBounds());
+ EXPECT_EQ(Rect(kOutputSize.width, kOutputSize.height), cachedSet.getTextureBounds());
// Now check that appending a new cached set properly cleans up RenderEngine resources.
CachedSet::Layer& layer3 = *mTestLayers[2]->cachedSetLayer.get();
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 0631845..2650fa0 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -6862,7 +6862,7 @@
void SurfaceFlinger::TransactionState::traverseStatesWithBuffers(
std::function<void(const layer_state_t&)> visitor) {
for (const auto& state : states) {
- if (state.state.hasBufferChanges() && (state.state.surface)) {
+ if (state.state.hasBufferChanges() && state.state.hasValidBuffer() && state.state.surface) {
visitor(state.state);
}
}