merge in jb-mr1.1-release history after reset to jb-mr1.1-dev
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index 590946a..607e0bd 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -314,10 +314,12 @@
                      * the consumer may still have pending reads of the
                      * buffers in flight.
                      */
-                    bool isOlder = mSlots[i].mFrameNumber <
-                            mSlots[found].mFrameNumber;
-                    if (found < 0 || isOlder) {
-                        found = i;
+                    if (found >= 0) {
+                        bool isOlder = mSlots[i].mFrameNumber <
+                                mSlots[found].mFrameNumber;
+                        if (isOlder) {
+                            found = i;
+                        }
                     }
                 }
             }
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
index 2eb74b7..29b778d 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
+++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
@@ -804,7 +804,7 @@
         getLayer()->acquireFenceFd = fenceFd;
     }
     virtual void setPerFrameDefaultState() {
-        //getLayer()->compositionType = HWC_FRAMEBUFFER;
+        getLayer()->compositionType = HWC_FRAMEBUFFER;
     }
     virtual void setDefaultState() {
         getLayer()->compositionType = HWC_FRAMEBUFFER;