From 1681d95989271f3a9ac0dbb93d10e4a29f2b4444 Mon Sep 17 00:00:00 2001 From: Ruben Brunk Date: Fri, 27 Jun 2014 15:51:55 -0700 Subject: 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 --- services/surfaceflinger/Layer.cpp | 27 ++++++++++++++++++++------- services/surfaceflinger/Layer.h | 3 +++ 2 files changed, 23 insertions(+), 7 deletions(-) (limited to 'services/surfaceflinger') diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 63bc257f52..4861e34026 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -624,6 +624,17 @@ void Layer::drawWithOpenGL(const sp& hw, engine.disableBlending(); } +uint32_t Layer::getProducerStickyTransform() const { + int producerStickyTransform = 0; + int ret = mProducer->query(NATIVE_WINDOW_STICKY_TRANSFORM, &producerStickyTransform); + if (ret != OK) { + ALOGW("%s: Error %s (%d) while querying window sticky transform.", __FUNCTION__, + strerror(-ret), ret); + return 0; + } + return static_cast(producerStickyTransform); +} + void Layer::setFiltering(bool filtering) { mFiltering = filtering; } @@ -992,10 +1003,12 @@ Region Layer::latchBuffer(bool& recomputeVisibleRegions) Layer::State& front; Layer::State& current; bool& recomputeVisibleRegions; + bool stickyTransformSet; Reject(Layer::State& front, Layer::State& current, - bool& recomputeVisibleRegions) + bool& recomputeVisibleRegions, bool stickySet) : front(front), current(current), - recomputeVisibleRegions(recomputeVisibleRegions) { + recomputeVisibleRegions(recomputeVisibleRegions), + stickyTransformSet(stickySet) { } virtual bool reject(const sp& buf, @@ -1058,12 +1071,12 @@ Region Layer::latchBuffer(bool& recomputeVisibleRegions) front.requested.crop.getHeight()); } - if (!isFixedSize) { + if (!isFixedSize && !stickyTransformSet) { if (front.active.w != bufWidth || front.active.h != bufHeight) { // reject this buffer - //ALOGD("rejecting buffer: bufWidth=%d, bufHeight=%d, front.active.{w=%d, h=%d}", - // bufWidth, bufHeight, front.active.w, front.active.h); + ALOGE("rejecting buffer: bufWidth=%d, bufHeight=%d, front.active.{w=%d, h=%d}", + bufWidth, bufHeight, front.active.w, front.active.h); return true; } } @@ -1092,8 +1105,8 @@ Region Layer::latchBuffer(bool& recomputeVisibleRegions) } }; - - Reject r(mDrawingState, getCurrentState(), recomputeVisibleRegions); + Reject r(mDrawingState, getCurrentState(), recomputeVisibleRegions, + getProducerStickyTransform() != 0); status_t updateResult = mSurfaceFlingerConsumer->updateTexImage(&r, mFlinger->mPrimaryDispSync); diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index ee9f8a088c..2d8084df5e 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -339,6 +339,9 @@ private: void drawWithOpenGL(const sp& hw, const Region& clip, bool useIdentityTransform) const; + // Temporary - Used only for LEGACY camera mode. + uint32_t getProducerStickyTransform() const; + // ----------------------------------------------------------------------- -- cgit v1.2.3-59-g8ed1b