hwcomposer : Use sysfs to read vysnc information
* Read sysfs entries to get vsync timestamp from kernel.
* External display continues to use uevents for hotplug events
* A new thread, vsyncThread is created to read and send vsync
timestamps to HAL.
* Disable H/W VSYNC for MDP 5.x targets until kernel changes are
complete.
* Synchronization is needed to make sure read() is not called
by hwcVsyncThread when VSYNC is disabled.
Change-Id: Iab0a94a3cfce9142b8867859f2a7d9bcaecb0996
Acked-by: Neti Ravi Kumar <ravineti@codeaurora.org>
diff --git a/libhwcomposer/hwc_utils.h b/libhwcomposer/hwc_utils.h
index 07318bd..0bde003 100644
--- a/libhwcomposer/hwc_utils.h
+++ b/libhwcomposer/hwc_utils.h
@@ -131,9 +131,11 @@
// Initialize uevent thread
void init_uevent_thread(hwc_context_t* ctx);
+// Initialize vsync thread
+void init_vsync_thread(hwc_context_t* ctx);
inline void getLayerResolution(const hwc_layer_1_t* layer,
- int& width, int& height)
+ int& width, int& height)
{
hwc_rect_t displayFrame = layer->displayFrame;
width = displayFrame.right - displayFrame.left;
@@ -151,6 +153,12 @@
}; //qhwc namespace
+struct vsync_state {
+ pthread_mutex_t lock;
+ pthread_cond_t cond;
+ bool enable;
+};
+
// -----------------------------------------------------------------------------
// HWC context
// This structure contains overall state
@@ -186,6 +194,9 @@
//Lock to prevent set from being called while blanking
mutable Locker mBlankLock;
+ //Vsync
+ struct vsync_state vstate;
+
};
#endif //HWC_UTILS_H