hwc: Fix swap interval zero

Avoid populating acquireFenceFds and calling
rotator sync ioctl when swapinterval is zero.

Change-Id: I456784627eb0685dd2c9e67c405ba471dee3321e
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 7cf390e..997af75 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -1463,7 +1463,7 @@
             rotData.acq_fen_fd_cnt = 1; //1 ioctl call per rot session
         }
         int ret = 0;
-        if(not ctx->mLayerRotMap[dpy]->isRotCached(i))
+        if(LIKELY(!swapzero) and (not ctx->mLayerRotMap[dpy]->isRotCached(i)))
             ret = ioctl(rotFd, MSMFB_BUFFER_SYNC, &rotData);
 
         if(ret < 0) {
@@ -1485,43 +1485,45 @@
     //Accumulate acquireFenceFds for MDP Overlays
     if(list->outbufAcquireFenceFd >= 0) {
         //Writeback output buffer
-        acquireFd[count++] = list->outbufAcquireFenceFd;
+        if(LIKELY(!swapzero) )
+            acquireFd[count++] = list->outbufAcquireFenceFd;
     }
 
     for(uint32_t i = 0; i < list->numHwLayers; i++) {
         if(((isAbcInUse(ctx)== true ) ||
           (list->hwLayers[i].compositionType == HWC_OVERLAY)) &&
                         list->hwLayers[i].acquireFenceFd >= 0) {
-            if(UNLIKELY(swapzero))
-                acquireFd[count++] = -1;
-            // if ABC is enabled for more than one layer.
-            // renderBufIndexforABC will work as FB.Hence
-            // set the acquireFD from fd - which is coming from copybit
-            else if(fd >= 0 && (isAbcInUse(ctx) == true)) {
-                if(ctx->listStats[dpy].renderBufIndexforABC ==(int32_t)i)
-                   acquireFd[count++] = fd;
-                else
-                   continue;
-            } else
-                acquireFd[count++] = list->hwLayers[i].acquireFenceFd;
+            if(LIKELY(!swapzero) ) {
+                // if ABC is enabled for more than one layer.
+                // renderBufIndexforABC will work as FB.Hence
+                // set the acquireFD from fd - which is coming from copybit
+                if(fd >= 0 && (isAbcInUse(ctx) == true)) {
+                    if(ctx->listStats[dpy].renderBufIndexforABC ==(int32_t)i)
+                        acquireFd[count++] = fd;
+                    else
+                        continue;
+                } else
+                    acquireFd[count++] = list->hwLayers[i].acquireFenceFd;
+            }
         }
         if(list->hwLayers[i].compositionType == HWC_FRAMEBUFFER_TARGET) {
-            if(UNLIKELY(swapzero))
-                acquireFd[count++] = -1;
-            else if(fd >= 0) {
-                //set the acquireFD from fd - which is coming from c2d
-                acquireFd[count++] = fd;
-                // Buffer sync IOCTL should be async when using c2d fence is
-                // used
-                data.flags &= ~MDP_BUF_SYNC_FLAG_WAIT;
-            } else if(list->hwLayers[i].acquireFenceFd >= 0)
-                acquireFd[count++] = list->hwLayers[i].acquireFenceFd;
+            if(LIKELY(!swapzero) ) {
+                if(fd >= 0) {
+                    //set the acquireFD from fd - which is coming from c2d
+                    acquireFd[count++] = fd;
+                    // Buffer sync IOCTL should be async when using c2d fence is
+                    // used
+                    data.flags &= ~MDP_BUF_SYNC_FLAG_WAIT;
+                } else if(list->hwLayers[i].acquireFenceFd >= 0)
+                    acquireFd[count++] = list->hwLayers[i].acquireFenceFd;
+            }
         }
     }
 
     if ((fd >= 0) && !dpy && ctx->mPtorInfo.isActive()) {
         // Acquire c2d fence of Overlap render buffer
-        acquireFd[count++] = fd;
+        if(LIKELY(!swapzero) )
+            acquireFd[count++] = fd;
     }
 
     data.acq_fen_fd_cnt = count;