hwc: Empty first read to avoid stale data at boot

When an fd is opened for the first time, poll always succeeds
without a notify from the driver. This gives us invalid data from
the driver, which actually has the right value only when it calls
sysfs_notify. Do a first read for the vsync fds to avoid this.

Change-Id: I47e7bb0a3f91ccb90b1cf36fe5e7d75de1085b62
diff --git a/libhwcomposer/hwc_vsync.cpp b/libhwcomposer/hwc_vsync.cpp
index 7189a01..595b7f2 100644
--- a/libhwcomposer/hwc_vsync.cpp
+++ b/libhwcomposer/hwc_vsync.cpp
@@ -104,6 +104,8 @@
                 break;
             }
         }
+        // Read once from the fds to clear the first notify
+        pread(fb_fd[dpy], vdata , MAX_DATA, 0);
 
         pfd[dpy].fd = fb_fd[dpy];
         if (pfd[dpy].fd >= 0)
@@ -120,7 +122,7 @@
                         if (UNLIKELY(len < 0)) {
                             // If the read was just interrupted - it is not a
                             // fatal error. Just continue in this case
-                            ALOGE ("%s:Unable to read vsync for dpy=%d :%s",
+                            ALOGE ("%s: Unable to read vsync for dpy=%d : %s",
                                     __FUNCTION__, dpy, strerror(errno));
                             continue;
                         }