hwc: Open sysfs node when thread is initialized.

Earlier, the sysfs node was created in the driver for the
first time in dsi_video_on. This has now been moved to probe
so this node can be opened to the start of the thread.

Bug: 7305728
Change-Id: I01230e4fdc2bddd160ce0d84e153f1f8c179b8df
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/libhwcomposer/hwc_vsync.cpp b/libhwcomposer/hwc_vsync.cpp
index 28ac86d..d461a8b 100644
--- a/libhwcomposer/hwc_vsync.cpp
+++ b/libhwcomposer/hwc_vsync.cpp
@@ -63,6 +63,13 @@
     /* Currently read vsync timestamp from drivers
        e.g. VSYNC=41800875994
     */
+    fd_timestamp = open(vsync_timestamp_fb0, O_RDONLY);
+    if (fd_timestamp < 0) {
+        ALOGE ("FATAL:%s:not able to open file:%s, %s",  __FUNCTION__,
+               (fb1_vsync) ? vsync_timestamp_fb1 : vsync_timestamp_fb0,
+               strerror(errno));
+        return NULL;
+    }
 
     do {
         pthread_mutex_lock(&ctx->vstate.lock);
@@ -92,16 +99,6 @@
             enabled = true;
         }
 
-        if(fd_timestamp < 0) {
-            fd_timestamp = open(vsync_timestamp_fb0, O_RDONLY);
-            if (fd_timestamp < 0) {
-                ALOGE ("FATAL:%s:not able to open file:%s, %s",  __FUNCTION__,
-                       (fb1_vsync) ? vsync_timestamp_fb1 : vsync_timestamp_fb0,
-                       strerror(errno));
-                return NULL;
-            }
-        }
-
        for(int i = 0; i < MAX_RETRY_COUNT; i++) {
            len = pread(fd_timestamp, vdata, MAX_DATA, 0);
            if(len < 0 && (errno == EAGAIN || errno == EINTR)) {