hwc: sync-point implementation.

Add sync pt implementation.
Add genlock and sync pt under conditional compilation flags.

Change-Id: I32fb7f6051ccc706662152e90ac15b6b6743f897
Signed-off-by: Iliyan Malchev <malchev@google.com>
diff --git a/libhwcomposer/hwc_qbuf.h b/libhwcomposer/hwc_qbuf.h
index 0e639cf..90f7143 100644
--- a/libhwcomposer/hwc_qbuf.h
+++ b/libhwcomposer/hwc_qbuf.h
@@ -16,7 +16,10 @@
  */
 
 #include <gralloc_priv.h>
+
+#ifndef USE_FENCE_SYNC
 #include <genlock.h>
+#endif
 
 // -----------------------------------------------------------------------------
 // QueuedBufferStore
@@ -56,12 +59,15 @@
 
 //Store and lock current drawing round buffers
 inline void QueuedBufferStore::lockAndAdd(private_handle_t *hnd) {
+#ifndef USE_FENCE_SYNC
     if(lockBuffer(hnd))
         current[curCount++] = hnd;
+#endif
 }
 
 //Unlock all previous drawing round buffers
 inline void QueuedBufferStore::unlockAllPrevious() {
+#ifndef USE_FENCE_SYNC
     //Unlock
     for(int i = 0; i < prevCount; i++) {
         unlockBuffer(previous[i]);
@@ -71,46 +77,58 @@
     mvCurrToPrev();
     //Clear current
     clearCurrent();
+#endif
 }
 
 inline void QueuedBufferStore::unlockAll() {
+#ifndef USE_FENCE_SYNC
     //Unlocks prev and moves current to prev
     unlockAllPrevious();
     //Unlocks the newly populated prev if any.
     unlockAllPrevious();
+#endif
 }
 
 //Clear currentbuf store
 inline void QueuedBufferStore::clearCurrent() {
+#ifndef USE_FENCE_SYNC
     for(int i = 0; i < MAX_QUEUED_BUFS; i++)
         current[i] = NULL;
     curCount = 0;
+#endif
 }
 
 //Clear previousbuf store
 inline void QueuedBufferStore::clearPrevious() {
+#ifndef USE_FENCE_SYNC
     for(int i = 0; i < MAX_QUEUED_BUFS; i++)
         previous[i] = NULL;
     prevCount = 0;
+#endif
 }
 
 //Copy from current to previous
 inline void QueuedBufferStore::mvCurrToPrev() {
+#ifndef USE_FENCE_SYNC
     for(int i = 0; i < curCount; i++)
         previous[i] = current[i];
     prevCount = curCount;
+#endif
 }
 
 inline bool QueuedBufferStore::lockBuffer(private_handle_t *hnd) {
+#ifndef USE_FENCE_SYNC
     if (GENLOCK_FAILURE == genlock_lock_buffer(hnd, GENLOCK_READ_LOCK,
                                                GENLOCK_MAX_TIMEOUT)) {
         ALOGE("%s: genlock_lock_buffer(READ) failed", __func__);
         return false;
     }
+#endif
     return true;
 }
 
 inline void QueuedBufferStore::unlockBuffer(private_handle_t *hnd) {
+#ifndef USE_FENCE_SYNC
     //Check if buffer is still around
     if(private_handle_t::validate(hnd) != 0) {
         ALOGE("%s Invalid Handle", __func__);
@@ -121,6 +139,7 @@
         ALOGE("%s: genlock_unlock_buffer failed", __func__);
         return;
     }
+#endif
 }
 // -----------------------------------------------------------------------------
 };//namespace