Skip to content

Commit 596bcc2

Browse files
Romain GuyAndroid (Google) Code Review
authored andcommitted
Merge "Optimize tiling management Bug #7186819" into jb-mr1-dev
2 parents 0aac9b7 + 57b5268 commit 596bcc2

File tree

4 files changed

+7
-15
lines changed

4 files changed

+7
-15
lines changed

libs/hwui/Caches.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ void Caches::resetScissor() {
429429

430430
void Caches::startTiling(GLuint x, GLuint y, GLuint width, GLuint height, bool opaque) {
431431
if (extensions.hasTiledRendering()) {
432-
glStartTilingQCOM(x, y, width, height, GL_COLOR_BUFFER_BIT0_QCOM);
432+
glStartTilingQCOM(x, y, width, height, opaque ? GL_NONE : GL_COLOR_BUFFER_BIT0_QCOM);
433433
}
434434
}
435435

libs/hwui/OpenGLRenderer.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ int OpenGLRenderer::prepareDirty(float left, float top, float right, float botto
175175
mSaveCount = 1;
176176

177177
mSnapshot->setClip(left, top, right, bottom);
178-
mDirtyClip = mOpaqueFrame = opaque;
178+
mDirtyClip = opaque;
179179

180180
// If we know that we are going to redraw the entire framebuffer,
181181
// perform a discard to let the driver know we don't need to preserve
@@ -189,7 +189,7 @@ int OpenGLRenderer::prepareDirty(float left, float top, float right, float botto
189189
syncState();
190190

191191
mTilingSnapshot = mSnapshot;
192-
startTiling();
192+
startTiling(mTilingSnapshot, true);
193193

194194
if (!opaque) {
195195
mCaches.enableScissor();
@@ -213,16 +213,9 @@ void OpenGLRenderer::syncState() {
213213
}
214214
}
215215

216-
void OpenGLRenderer::startTiling() {
217-
startTiling(mTilingSnapshot);
218-
}
219-
220-
void OpenGLRenderer::startTiling(const sp<Snapshot>& s) {
221-
bool opaque = mOpaqueFrame;
216+
void OpenGLRenderer::startTiling(const sp<Snapshot>& s, bool opaque) {
222217
Rect* clip = mTilingSnapshot->clipRect;
223-
224218
if (s->flags & Snapshot::kFlagIsFboLayer) {
225-
opaque = !s->layer->isBlend();
226219
clip = s->clipRect;
227220
}
228221

libs/hwui/OpenGLRenderer.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,7 @@ class OpenGLRenderer {
351351
* This method needs to be invoked every time getTargetFbo() is
352352
* bound again.
353353
*/
354-
void startTiling();
355-
void startTiling(const sp<Snapshot>& snapshot);
354+
void startTiling(const sp<Snapshot>& snapshot, bool opaque = false);
356355

357356
/**
358357
* Tells the GPU that we are done drawing the frame or that we

tests/HwAccelerationTest/src/com/android/test/hwui/MultiLayersActivity.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ protected void onCreate(Bundle savedInstanceState) {
4545

4646
row1.addView(new LayerView(this, 0xffff0000), new LinearLayout.LayoutParams(
4747
0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f));
48-
row1.addView(new LayerView(this, 0xff00ff00), new LinearLayout.LayoutParams(
48+
row1.addView(new LayerView(this, 0x0f00ff00), new LinearLayout.LayoutParams(
4949
0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f));
5050

51-
row2.addView(new LayerView(this, 0xff0000ff), new LinearLayout.LayoutParams(
51+
row2.addView(new LayerView(this, 0x0f0000ff), new LinearLayout.LayoutParams(
5252
0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f));
5353
row2.addView(new LayerView(this, 0xffffff00), new LinearLayout.LayoutParams(
5454
0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f));

0 commit comments

Comments
 (0)