use SurfaceTexture new scaling mode in SF
SF now obeys SurfaceTexture's scaling mode instead
of inferring it from the buffer's size
Change-Id: I4d50e9851abedd7e64bfcfc8af9eefb9fb668529
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index f3b6c4d..c29aeca 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -56,14 +56,14 @@
mTextureName(-1U),
mQueuedFrames(0),
mCurrentTransform(0),
+ mCurrentScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
mCurrentOpacity(true),
mFormat(PIXEL_FORMAT_NONE),
mGLExtensions(GLExtensions::getInstance()),
mOpaqueLayer(true),
mNeedsDithering(false),
mSecure(false),
- mProtectedByApp(false),
- mFixedSize(false)
+ mProtectedByApp(false)
{
mCurrentCrop.makeInvalid();
glGenTextures(1, &mTextureName);
@@ -400,14 +400,7 @@
}
bool Layer::isFixedSize() const {
- Mutex::Autolock _l(mLock);
- return mFixedSize;
-}
-
-void Layer::setFixedSize(bool fixedSize)
-{
- Mutex::Autolock _l(mLock);
- mFixedSize = fixedSize;
+ return mCurrentScalingMode != NATIVE_WINDOW_SCALING_MODE_FREEZE;
}
bool Layer::isCropped() const {
@@ -437,9 +430,14 @@
const Rect crop(mSurfaceTexture->getCurrentCrop());
const uint32_t transform(mSurfaceTexture->getCurrentTransform());
- if ((crop != mCurrentCrop) || (transform != mCurrentTransform)) {
+ const uint32_t scalingMode(mSurfaceTexture->getCurrentScalingMode());
+ if ((crop != mCurrentCrop) ||
+ (transform != mCurrentTransform) ||
+ (scalingMode != mCurrentScalingMode))
+ {
mCurrentCrop = crop;
mCurrentTransform = transform;
+ mCurrentScalingMode = scalingMode;
mFlinger->invalidateHwcGeometry();
}
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index e3fc13d..ddfc666 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -59,7 +59,6 @@
status_t setBuffers(uint32_t w, uint32_t h,
PixelFormat format, uint32_t flags=0);
- // Set this Layer's buffers size
bool isFixedSize() const;
// LayerBase interface
@@ -88,7 +87,6 @@
void onFrameQueued();
virtual sp<ISurface> createSurface();
uint32_t getEffectiveUsage(uint32_t usage) const;
- void setFixedSize(bool fixedSize);
bool isCropped() const;
static bool getOpacityForFormat(uint32_t format);
@@ -106,6 +104,7 @@
GLfloat mTextureMatrix[16];
Rect mCurrentCrop;
uint32_t mCurrentTransform;
+ uint32_t mCurrentScalingMode;
bool mCurrentOpacity;
// constants
@@ -124,7 +123,6 @@
// binder thread, transaction thread
mutable Mutex mLock;
- bool mFixedSize;
};
// ---------------------------------------------------------------------------
diff --git a/services/surfaceflinger/SurfaceTextureLayer.cpp b/services/surfaceflinger/SurfaceTextureLayer.cpp
index 60fa965..a586d59 100644
--- a/services/surfaceflinger/SurfaceTextureLayer.cpp
+++ b/services/surfaceflinger/SurfaceTextureLayer.cpp
@@ -64,9 +64,6 @@
//LOGD("%s, w=%u, h=%u, format=%u, usage=%08x, effectiveUsage=%08x",
// __PRETTY_FUNCTION__, w, h, format, usage, effectiveUsage);
res = SurfaceTexture::dequeueBuffer(buf, w, h, format, effectiveUsage);
- if (res == NO_ERROR) {
- layer->setFixedSize(w && h);
- }
}
return res;
}