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
This commit is contained in:
parent
7734ebfe47
commit
933389f758
|
@ -545,7 +545,7 @@ status_t SurfaceTexture::disconnect(int api) {
|
|||
}
|
||||
|
||||
status_t SurfaceTexture::setScalingMode(int mode) {
|
||||
LOGV("SurfaceTexture::setScalingMode");
|
||||
LOGV("SurfaceTexture::setScalingMode(%d)", mode);
|
||||
|
||||
switch (mode) {
|
||||
case NATIVE_WINDOW_SCALING_MODE_FREEZE:
|
||||
|
|
|
@ -466,7 +466,7 @@ int SurfaceTextureClient::setBuffersFormat(int format)
|
|||
|
||||
int SurfaceTextureClient::setScalingMode(int mode)
|
||||
{
|
||||
LOGV("SurfaceTextureClient::setScalingMode");
|
||||
LOGV("SurfaceTextureClient::setScalingMode(%d)", mode);
|
||||
Mutex::Autolock lock(mMutex);
|
||||
// mode is validated on the server
|
||||
status_t err = mSurfaceTexture->setScalingMode(mode);
|
||||
|
|
|
@ -56,14 +56,14 @@ Layer::Layer(SurfaceFlinger* flinger,
|
|||
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 @@ uint32_t Layer::doTransaction(uint32_t flags)
|
|||
}
|
||||
|
||||
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 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
|
|||
|
||||
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();
|
||||
}
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ public:
|
|||
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 @@ private:
|
|||
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 @@ private:
|
|||
GLfloat mTextureMatrix[16];
|
||||
Rect mCurrentCrop;
|
||||
uint32_t mCurrentTransform;
|
||||
uint32_t mCurrentScalingMode;
|
||||
bool mCurrentOpacity;
|
||||
|
||||
// constants
|
||||
|
@ -124,7 +123,6 @@ private:
|
|||
|
||||
// binder thread, transaction thread
|
||||
mutable Mutex mLock;
|
||||
bool mFixedSize;
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
@ -64,9 +64,6 @@ status_t SurfaceTextureLayer::dequeueBuffer(int *buf,
|
|||
//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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue