Avoid unnecessary texture bind
In SurfaceFlingerConsumer, check to see if native fence sync is
enabled. If so, defer the texture binding step to Layer::onDraw.
Change-Id: I7d4034a31c0143207eea2509dfa13ef3820f9b8c
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 1c5403f..a1d46d9 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -327,17 +327,11 @@
return;
}
- // Bind the current buffer to the GL texture.
+ // Bind the current buffer to the GL texture, and wait for it to be
+ // ready for us to draw into.
status_t err = mSurfaceFlingerConsumer->bindTextureImage();
if (err != NO_ERROR) {
- ALOGW("Layer::onDraw: bindTextureImage failed");
- // keep going
- }
-
- // Wait for the buffer to be ready for us to draw into.
- err = mSurfaceFlingerConsumer->doGLFenceWait();
- if (err != OK) {
- ALOGE("onDraw: failed waiting for fence: %d", err);
+ ALOGW("onDraw: bindTextureImage failed (err=%d)", err);
// Go ahead and draw the buffer anyway; no matter what we do the screen
// is probably going to have something visibly wrong.
}