hwc: Check for correct screen state before enabling vsync

Sometimes vsync would not be disabled before the display is
blanked.
This was due to the vsync disable ioctl being kicked off in a
thread different from the event control which surfaceflinger
called. So, while the calls from surfaceflinger are in order, the
order of execution wasn't always the same. Hence, making sure
ioctls are called in the same context to ensure order.

Also
- Make blanking/unblanking logs show the operation as a string.
- Add a debug property to dump vsync timestamps (needs framework
reboot)
- Remove a log which showed delay in reading vsync. This log was
unreliable when vsync is disabled and we're still reading from
the sysfs node.

Change-Id: Ibec04e9ffebd0ac6e1d32b7031e3668abd9390ff
CRs-fixed: 443113
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 187c43a..de62b05 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -140,6 +140,7 @@
 bool isSecureModePolicy(int mdpVersion);
 bool isExternalActive(hwc_context_t* ctx);
 bool needsScaling(hwc_layer_1_t const* layer);
+int hwc_vsync_control(hwc_context_t* ctx, int dpy, int enable);
 
 //Helper function to dump logs
 void dumpsys_log(android::String8& buf, const char* fmt, ...);
@@ -227,6 +228,7 @@
     pthread_mutex_t lock;
     pthread_cond_t  cond;
     bool enable;
+    bool fakevsync;
 };
 
 // -----------------------------------------------------------------------------