summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-09-19 23:14:45 -0700
committerMathias Agopian <mathias@google.com>2012-09-20 17:13:58 -0700
commiteba8c688f633f3f3f1b75c2bc64faf799dd2b5f2 (patch)
treed23f60dda45baabf8080df7dbd5ec418d69a1991
parentf33e4b6f13bc3ee2d2a4e1abd1ada171c70d3492 (diff)
downloadframeworks_native-eba8c688f633f3f3f1b75c2bc64faf799dd2b5f2.zip
frameworks_native-eba8c688f633f3f3f1b75c2bc64faf799dd2b5f2.tar.gz
frameworks_native-eba8c688f633f3f3f1b75c2bc64faf799dd2b5f2.tar.bz2
calculate wether we filter on a per-display basis
Change-Id: I79d80b432b20b3d02428da19add464ac1e2b9378
-rw-r--r--services/surfaceflinger/DisplayDevice.cpp4
-rw-r--r--services/surfaceflinger/DisplayDevice.h2
-rw-r--r--services/surfaceflinger/Layer.cpp2
-rw-r--r--services/surfaceflinger/LayerBase.cpp4
-rw-r--r--services/surfaceflinger/LayerBase.h2
5 files changed, 12 insertions, 2 deletions
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index 62cc92a..330e09d 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -397,6 +397,10 @@ void DisplayDevice::updateGeometryTransform() {
// Apply the logical translation, scale to physical size, apply the
// physical translation and finally rotate to the physical orientation.
mGlobalTransform = R * TP * S * TL;
+
+ const uint8_t type = mGlobalTransform.getType();
+ mNeedsFiltering = (!mGlobalTransform.preserveRects() ||
+ (type >= Transform::SCALE));
}
}
diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h
index c9d21e4..d83625a 100644
--- a/services/surfaceflinger/DisplayDevice.h
+++ b/services/surfaceflinger/DisplayDevice.h
@@ -101,6 +101,7 @@ public:
const Transform& getTransform() const { return mGlobalTransform; }
const Rect& getViewport() const { return mViewport; }
const Rect& getFrame() const { return mFrame; }
+ bool needsFiltering() const { return mNeedsFiltering; }
uint32_t getLayerStack() const { return mLayerStack; }
int32_t getDisplayType() const { return mType; }
@@ -195,6 +196,7 @@ private:
Rect mViewport;
Rect mFrame;
Transform mGlobalTransform;
+ bool mNeedsFiltering;
};
}; // namespace android
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 3d79baf..41c4963 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -344,7 +344,7 @@ void Layer::onDraw(const sp<const DisplayDevice>& hw, const Region& clip) const
if (!isProtected()) {
// TODO: we could be more subtle with isFixedSize()
- const bool useFiltering = getFiltering() || needsFiltering() || isFixedSize();
+ const bool useFiltering = getFiltering() || needsFiltering(hw) || isFixedSize();
// Query the texture matrix given our current filtering mode.
float textureMatrix[16];
diff --git a/services/surfaceflinger/LayerBase.cpp b/services/surfaceflinger/LayerBase.cpp
index 99cb8f3..5ae0ee0 100644
--- a/services/surfaceflinger/LayerBase.cpp
+++ b/services/surfaceflinger/LayerBase.cpp
@@ -87,6 +87,10 @@ void LayerBase::initStates(uint32_t w, uint32_t h, uint32_t flags)
mDrawingState = mCurrentState;
}
+bool LayerBase::needsFiltering(const sp<const DisplayDevice>& hw) const {
+ return mNeedsFiltering || hw->needsFiltering();
+}
+
void LayerBase::commitTransaction() {
mDrawingState = mCurrentState;
}
diff --git a/services/surfaceflinger/LayerBase.h b/services/surfaceflinger/LayerBase.h
index 9994994..0df41ca 100644
--- a/services/surfaceflinger/LayerBase.h
+++ b/services/surfaceflinger/LayerBase.h
@@ -197,7 +197,7 @@ public:
/**
* needsLinearFiltering - true if this surface's state requires filtering
*/
- virtual bool needsFiltering() const { return mNeedsFiltering; }
+ virtual bool needsFiltering(const sp<const DisplayDevice>& hw) const;
/**
* isSecure - true if this surface is secure, that is if it prevents