hwc: Check vsync state before sending it up
The vsync enable ioctl is called in a separate thread in a
recent change
Hence it was now possible that vsync could be disabled but
SurfaceFlinger still received a vsync. With this check we make
sure that doesn't happen.
Change-Id: I459c0b98ab9ce972d86a361c5ecdfe0c1a2d0e74
diff --git a/libhwcomposer/hwc_vsync.cpp b/libhwcomposer/hwc_vsync.cpp
index 559cd7d..b42043f 100644
--- a/libhwcomposer/hwc_vsync.cpp
+++ b/libhwcomposer/hwc_vsync.cpp
@@ -136,9 +136,11 @@
cur_timestamp = systemTime();
}
// send timestamp to HAL
- ALOGD_IF (logvsync, "%s: timestamp %llu sent to HWC for %s",
- __FUNCTION__, cur_timestamp, "fb0");
- ctx->proc->vsync(ctx->proc, dpy, cur_timestamp);
+ if(ctx->vstate.enable) {
+ ALOGD_IF (logvsync, "%s: timestamp %llu sent to HWC for %s",
+ __FUNCTION__, cur_timestamp, "fb0");
+ ctx->proc->vsync(ctx->proc, dpy, cur_timestamp);
+ }
} while (true);
if(fd_timestamp >= 0)