summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-09-27 18:45:42 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-09-27 18:45:42 -0700
commita852ff3a4b637e8101c2f54e110467586fe604cf (patch)
tree0c940ea5314930c6fdbe15bfc1f4cc17c61d1b78 /libs
parent93aa70c6dfec91909404c9ade9b4a94574814092 (diff)
parent6ed9e43879039ce0cbead08d304edbce79a88ced (diff)
downloadframeworks_base-a852ff3a4b637e8101c2f54e110467586fe604cf.zip
frameworks_base-a852ff3a4b637e8101c2f54e110467586fe604cf.tar.gz
frameworks_base-a852ff3a4b637e8101c2f54e110467586fe604cf.tar.bz2
Merge changes I9873540e,I4f6c38e3 into jb-mr1-dev
* changes: Skia's ColorMatrix vector is in the 0..255 range not 0..1 Bug #7248980 Don't use the QCOM_tiled_rendering extension with functors Bug #7247880
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/Caches.cpp18
-rw-r--r--libs/hwui/Caches.h6
-rw-r--r--libs/hwui/DisplayListRenderer.cpp10
-rw-r--r--libs/hwui/DisplayListRenderer.h7
-rw-r--r--libs/hwui/OpenGLRenderer.cpp21
-rw-r--r--libs/hwui/OpenGLRenderer.h3
-rw-r--r--libs/hwui/SkiaColorFilter.cpp6
7 files changed, 63 insertions, 8 deletions
diff --git a/libs/hwui/Caches.cpp b/libs/hwui/Caches.cpp
index 2883f37..e443294 100644
--- a/libs/hwui/Caches.cpp
+++ b/libs/hwui/Caches.cpp
@@ -87,6 +87,8 @@ void Caches::init() {
lastDstMode = GL_ZERO;
currentProgram = NULL;
+ mFunctorsCount = 0;
+
mInitialized = true;
}
@@ -458,6 +460,22 @@ void Caches::endTiling() {
}
}
+bool Caches::hasRegisteredFunctors() {
+ return mFunctorsCount > 0;
+}
+
+void Caches::registerFunctors(uint32_t functorCount) {
+ mFunctorsCount += functorCount;
+}
+
+void Caches::unregisterFunctors(uint32_t functorCount) {
+ if (functorCount > mFunctorsCount) {
+ mFunctorsCount = 0;
+ } else {
+ mFunctorsCount -= functorCount;
+ }
+}
+
///////////////////////////////////////////////////////////////////////////////
// Regions
///////////////////////////////////////////////////////////////////////////////
diff --git a/libs/hwui/Caches.h b/libs/hwui/Caches.h
index 4c292b6..ad1ff6f 100644
--- a/libs/hwui/Caches.h
+++ b/libs/hwui/Caches.h
@@ -226,6 +226,10 @@ public:
void dumpMemoryUsage();
void dumpMemoryUsage(String8& log);
+ bool hasRegisteredFunctors();
+ void registerFunctors(uint32_t functorCount);
+ void unregisterFunctors(uint32_t functorCount);
+
bool blend;
GLenum lastSrcMode;
GLenum lastDstMode;
@@ -316,6 +320,8 @@ private:
DebugLevel mDebugLevel;
bool mInitialized;
+
+ uint32_t mFunctorsCount;
}; // class Caches
}; // namespace uirenderer
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index cc72df6..6aff8d4 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -157,6 +157,7 @@ void DisplayList::clearResources() {
mAnimationMatrix = NULL;
Caches& caches = Caches::getInstance();
+ caches.unregisterFunctors(mFunctorCount);
caches.resourceCache.lock();
for (size_t i = 0; i < mBitmapResources.size(); i++) {
@@ -218,6 +219,7 @@ void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorde
init();
if (writer.size() == 0) {
+ mFunctorCount = 0;
return;
}
@@ -232,7 +234,10 @@ void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorde
writer.flatten(buffer);
mReader.setMemory(buffer, mSize);
+ mFunctorCount = recorder.getFunctorCount();
+
Caches& caches = Caches::getInstance();
+ caches.registerFunctors(mFunctorCount);
caches.resourceCache.lock();
const Vector<SkBitmap*>& bitmapResources = recorder.getBitmapResources();
@@ -1340,7 +1345,8 @@ status_t DisplayList::replay(OpenGLRenderer& renderer, Rect& dirty, int32_t flag
DisplayListRenderer::DisplayListRenderer():
mCaches(Caches::getInstance()), mWriter(MIN_WRITER_SIZE),
- mTranslateX(0.0f), mTranslateY(0.0f), mHasTranslate(false), mHasDrawOps(false) {
+ mTranslateX(0.0f), mTranslateY(0.0f), mHasTranslate(false),
+ mHasDrawOps(false), mFunctorCount(0) {
}
DisplayListRenderer::~DisplayListRenderer() {
@@ -1397,6 +1403,7 @@ void DisplayListRenderer::reset() {
mLayers.clear();
mHasDrawOps = false;
+ mFunctorCount = 0;
}
///////////////////////////////////////////////////////////////////////////////
@@ -1453,6 +1460,7 @@ status_t DisplayListRenderer::callDrawGLFunction(Functor *functor, Rect& dirty)
// Ignore dirty during recording, it matters only when we replay
addOp(DisplayList::DrawGLFunction);
addInt((int) functor);
+ mFunctorCount++;
return DrawGlInfo::kStatusDone; // No invalidate needed at record-time
}
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index a0b1630..39061f4 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -503,6 +503,7 @@ private:
size_t mSize;
bool mIsRenderable;
+ uint32_t mFunctorCount;
String8 mName;
@@ -661,6 +662,10 @@ public:
return mMatrices;
}
+ uint32_t getFunctorCount() const {
+ return mFunctorCount;
+ }
+
private:
void insertRestoreToCount() {
if (mRestoreSaveCount >= 0) {
@@ -887,6 +892,8 @@ private:
bool mHasTranslate;
bool mHasDrawOps;
+ uint32_t mFunctorCount;
+
friend class DisplayList;
}; // class DisplayListRenderer
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index b0328f5..684d5e1 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -193,6 +193,11 @@ int OpenGLRenderer::prepareDirty(float left, float top, float right, float botto
syncState();
+ // Functors break the tiling extension in pretty spectacular ways
+ // This ensures we don't use tiling when a functor is going to be
+ // invoked during the frame
+ mSuppressTiling = mCaches.hasRegisteredFunctors();
+
mTilingSnapshot = mSnapshot;
startTiling(mTilingSnapshot, true);
@@ -221,17 +226,19 @@ void OpenGLRenderer::syncState() {
}
void OpenGLRenderer::startTiling(const sp<Snapshot>& s, bool opaque) {
- Rect* clip = mTilingSnapshot->clipRect;
- if (s->flags & Snapshot::kFlagIsFboLayer) {
- clip = s->clipRect;
- }
+ if (!mSuppressTiling) {
+ Rect* clip = mTilingSnapshot->clipRect;
+ if (s->flags & Snapshot::kFlagIsFboLayer) {
+ clip = s->clipRect;
+ }
- mCaches.startTiling(clip->left, s->height - clip->bottom,
- clip->right - clip->left, clip->bottom - clip->top, opaque);
+ mCaches.startTiling(clip->left, s->height - clip->bottom,
+ clip->right - clip->left, clip->bottom - clip->top, opaque);
+ }
}
void OpenGLRenderer::endTiling() {
- mCaches.endTiling();
+ if (!mSuppressTiling) mCaches.endTiling();
}
void OpenGLRenderer::finish() {
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index bc9b693..a40d69a 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -817,6 +817,9 @@ private:
// Properties.h
bool mScissorOptimizationDisabled;
+ // No-ops start/endTiling when set
+ bool mSuppressTiling;
+
friend class DisplayListRenderer;
}; // class OpenGLRenderer
diff --git a/libs/hwui/SkiaColorFilter.cpp b/libs/hwui/SkiaColorFilter.cpp
index f754388..df918be 100644
--- a/libs/hwui/SkiaColorFilter.cpp
+++ b/libs/hwui/SkiaColorFilter.cpp
@@ -36,6 +36,12 @@ SkiaColorFilter::~SkiaColorFilter() {
SkiaColorMatrixFilter::SkiaColorMatrixFilter(SkColorFilter* skFilter, float* matrix, float* vector):
SkiaColorFilter(skFilter, kColorMatrix, true), mMatrix(matrix), mVector(vector) {
+ // Skia uses the range [0..255] for the addition vector, but we need
+ // the [0..1] range to apply the vector in GLSL
+ for (int i = 0; i < 4; i++) {
+ mVector[i] /= 255.0f;
+ }
+
// TODO: We should be smarter about this
mBlend = true;
}