summaryrefslogtreecommitdiff
path: root/libs/hwui/renderstate/RenderState.cpp
diff options
context:
space:
mode:
authorArun <arun.demeure@imgtec.com>2017-01-23 12:47:57 +0000
committerChris Craik <ccraik@google.com>2017-08-18 16:52:55 -0700
commit530a2b44d9a4b40d028c912ade858da73081ed85 (patch)
treed8c1d01a645dfc763954ea1b9addb6e2c96eb985 /libs/hwui/renderstate/RenderState.cpp
parent94fa7ee97272b0a4a8104a20eb201fb9891cd102 (diff)
Disable hwui blending for first draw to main FBO
bug:34809371 In some applications, the first draw is not opaque - either because the application is misbehaved, or because hwui is not able to reliably tell whether the layer is opaque or translucent. This is undefined behaviour in OpenGL ES and has a significant performance and bandwidth impact on some tiler GPUs as it requires loading the previous frame's color data. This change disables blending in that case and also for effectively opaque blend modes (SRC=GL_ONE, DST=GL_ZERO). It increases performance by ~10% for Leanback CTS on some low-end GPUs (gradient layer that hwui incorrectly believes to be translucent). Test: manual - visual inspection on fugu (nexus player) Change-Id: I2cbf1c76678acae1a36923e72fd18ed55cd89dc2
Diffstat (limited to 'libs/hwui/renderstate/RenderState.cpp')
-rw-r--r--libs/hwui/renderstate/RenderState.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/libs/hwui/renderstate/RenderState.cpp b/libs/hwui/renderstate/RenderState.cpp
index ededffb0f4bb..5fc5cb275741 100644
--- a/libs/hwui/renderstate/RenderState.cpp
+++ b/libs/hwui/renderstate/RenderState.cpp
@@ -262,7 +262,8 @@ void RenderState::postDecStrong(VirtualLightRefBase* object) {
// Render
///////////////////////////////////////////////////////////////////////////////
-void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix) {
+void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix,
+ bool overrideDisableBlending) {
const Glop::Mesh& mesh = glop.mesh;
const Glop::Mesh::Vertices& vertices = mesh.vertices;
const Glop::Mesh::Indices& indices = mesh.indices;
@@ -417,7 +418,11 @@ void RenderState::render(const Glop& glop, const Matrix4& orthoMatrix) {
// ------------------------------------
// ---------- GL state setup ----------
// ------------------------------------
- blend().setFactors(glop.blend.src, glop.blend.dst);
+ if (CC_UNLIKELY(overrideDisableBlending)) {
+ blend().setFactors(GL_ZERO, GL_ZERO);
+ } else {
+ blend().setFactors(glop.blend.src, glop.blend.dst);
+ }
GL_CHECKPOINT(MODERATE);