Merge "SF: Moving Vsync modulator away from threads."
diff --git a/libs/binder/ndk/AIBinder.cpp b/libs/binder/ndk/AIBinder.cpp
index b7f5636..2219f8e 100644
--- a/libs/binder/ndk/AIBinder.cpp
+++ b/libs/binder/ndk/AIBinder.cpp
@@ -286,7 +286,10 @@
}
if (!binder->isRemote()) {
- LOG(WARNING) << "A binder object at " << binder << " is being transacted on, however, this object is in the same process as its proxy. Transacting with this binder is expensive compared to just calling the corresponding functionality in the same process.";
+ LOG(WARNING) << "A binder object at " << binder
+ << " is being transacted on, however, this object is in the same process as "
+ "its proxy. Transacting with this binder is expensive compared to just "
+ "calling the corresponding functionality in the same process.";
}
*in = new AParcel(binder);
diff --git a/services/surfaceflinger/RenderEngine/gl/GLES20RenderEngine.cpp b/services/surfaceflinger/RenderEngine/gl/GLES20RenderEngine.cpp
index 7121cc2..0f0ff62 100644
--- a/services/surfaceflinger/RenderEngine/gl/GLES20RenderEngine.cpp
+++ b/services/surfaceflinger/RenderEngine/gl/GLES20RenderEngine.cpp
@@ -539,25 +539,25 @@
glClear(GL_COLOR_BUFFER_BIT);
}
-void GLES20RenderEngine::fillRegionWithColor(const Region& region, uint32_t height, float red,
- float green, float blue, float alpha) {
+void GLES20RenderEngine::fillRegionWithColor(const Region& region, float red, float green,
+ float blue, float alpha) {
size_t c;
Rect const* r = region.getArray(&c);
Mesh mesh(Mesh::TRIANGLES, c * 6, 2);
Mesh::VertexArray<vec2> position(mesh.getPositionArray<vec2>());
for (size_t i = 0; i < c; i++, r++) {
position[i * 6 + 0].x = r->left;
- position[i * 6 + 0].y = height - r->top;
+ position[i * 6 + 0].y = r->top;
position[i * 6 + 1].x = r->left;
- position[i * 6 + 1].y = height - r->bottom;
+ position[i * 6 + 1].y = r->bottom;
position[i * 6 + 2].x = r->right;
- position[i * 6 + 2].y = height - r->bottom;
+ position[i * 6 + 2].y = r->bottom;
position[i * 6 + 3].x = r->left;
- position[i * 6 + 3].y = height - r->top;
+ position[i * 6 + 3].y = r->top;
position[i * 6 + 4].x = r->right;
- position[i * 6 + 4].y = height - r->bottom;
+ position[i * 6 + 4].y = r->bottom;
position[i * 6 + 5].x = r->right;
- position[i * 6 + 5].y = height - r->top;
+ position[i * 6 + 5].y = r->top;
}
setupFillWithColor(red, green, blue, alpha);
drawMesh(mesh);
diff --git a/services/surfaceflinger/RenderEngine/gl/GLES20RenderEngine.h b/services/surfaceflinger/RenderEngine/gl/GLES20RenderEngine.h
index 2502cb8..1abc5ba 100644
--- a/services/surfaceflinger/RenderEngine/gl/GLES20RenderEngine.h
+++ b/services/surfaceflinger/RenderEngine/gl/GLES20RenderEngine.h
@@ -62,8 +62,8 @@
bool finish() override;
bool waitFence(base::unique_fd fenceFd) override;
void clearWithColor(float red, float green, float blue, float alpha) override;
- void fillRegionWithColor(const Region& region, uint32_t height, float red, float green,
- float blue, float alpha) override;
+ void fillRegionWithColor(const Region& region, float red, float green, float blue,
+ float alpha) override;
void setScissor(uint32_t left, uint32_t bottom, uint32_t right, uint32_t top) override;
void disableScissor() override;
void genTextures(size_t count, uint32_t* names) override;
diff --git a/services/surfaceflinger/RenderEngine/include/renderengine/RenderEngine.h b/services/surfaceflinger/RenderEngine/include/renderengine/RenderEngine.h
index d0ca0d9..17d8782 100644
--- a/services/surfaceflinger/RenderEngine/include/renderengine/RenderEngine.h
+++ b/services/surfaceflinger/RenderEngine/include/renderengine/RenderEngine.h
@@ -93,7 +93,7 @@
virtual bool waitFence(base::unique_fd fenceFd) = 0;
virtual void clearWithColor(float red, float green, float blue, float alpha) = 0;
- virtual void fillRegionWithColor(const Region& region, uint32_t height, float red, float green,
+ virtual void fillRegionWithColor(const Region& region, float red, float green,
float blue, float alpha) = 0;
virtual void setScissor(uint32_t left, uint32_t bottom, uint32_t right, uint32_t top) = 0;
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 191651b..9537ccc 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1688,9 +1688,8 @@
doComposeSurfaces(display);
// and draw the dirty region
- const int32_t height = display->getHeight();
auto& engine(getRenderEngine());
- engine.fillRegionWithColor(dirtyRegion, height, 1, 0, 1, 1);
+ engine.fillRegionWithColor(dirtyRegion, 1, 0, 1, 1);
display->swapBuffers(getHwComposer());
}
@@ -3194,7 +3193,7 @@
// screen is already cleared here
if (!region.isEmpty()) {
// can happen with SurfaceView
- drawWormhole(display, region);
+ drawWormhole(region);
}
}
@@ -3231,9 +3230,10 @@
case HWC2::Composition::Sideband:
case HWC2::Composition::SolidColor: {
const Layer::State& state(compositionInfo.layer->mLayer->getDrawingState());
- const bool opaque = compositionInfo.layer->mLayer->isOpaque(state);
- if (compositionInfo.hwc.clearClientTarget && !firstLayer &&
- opaque && (state.color.a == 1.0f) && hasClientComposition) {
+ const bool opaque = compositionInfo.layer->mLayer->isOpaque(state) &&
+ compositionInfo.layer->mLayer->getAlpha() == 1.0f;
+ if (compositionInfo.hwc.clearClientTarget && !firstLayer && opaque &&
+ hasClientComposition) {
// never clear the very first layer since we're
// guaranteed the FB is already cleared
compositionInfo.layer->clear(getRenderEngine());
@@ -3262,11 +3262,9 @@
return true;
}
-void SurfaceFlinger::drawWormhole(const sp<const DisplayDevice>& display,
- const Region& region) const {
- const int32_t height = display->getHeight();
+void SurfaceFlinger::drawWormhole(const Region& region) const {
auto& engine(getRenderEngine());
- engine.fillRegionWithColor(region, height, 0, 0, 0, 0);
+ engine.fillRegionWithColor(region, 0, 0, 0, 0);
}
status_t SurfaceFlinger::addClientLayer(const sp<Client>& client,
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 72ede93..00ee2c4 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -710,7 +710,7 @@
void postFramebuffer(const sp<DisplayDevice>& display);
void postFrame();
- void drawWormhole(const sp<const DisplayDevice>& display, const Region& region) const;
+ void drawWormhole(const Region& region) const;
/* ------------------------------------------------------------------------
* Display management
diff --git a/services/surfaceflinger/tests/unittests/mock/RenderEngine/MockRenderEngine.h b/services/surfaceflinger/tests/unittests/mock/RenderEngine/MockRenderEngine.h
index 1c5135b..84d3c63 100644
--- a/services/surfaceflinger/tests/unittests/mock/RenderEngine/MockRenderEngine.h
+++ b/services/surfaceflinger/tests/unittests/mock/RenderEngine/MockRenderEngine.h
@@ -48,7 +48,7 @@
MOCK_METHOD1(waitFence, bool(base::unique_fd*));
bool waitFence(base::unique_fd fd) override { return waitFence(&fd); };
MOCK_METHOD4(clearWithColor, void(float, float, float, float));
- MOCK_METHOD6(fillRegionWithColor, void(const Region&, uint32_t, float, float, float, float));
+ MOCK_METHOD5(fillRegionWithColor, void(const Region&, float, float, float, float));
MOCK_METHOD4(setScissor, void(uint32_t, uint32_t, uint32_t, uint32_t));
MOCK_METHOD0(disableScissor, void());
MOCK_METHOD2(genTextures, void(size_t, uint32_t*));