Check for buffer changes explicitly instead of relying on acquire fence changes

Bug: 183997574
Test: atest ASurfaceControlTest
Change-Id: I4eabec13faa09b3d1f61d62e637b83baa720797d
diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp
index d653ae7..467dcda 100644
--- a/libs/gui/LayerState.cpp
+++ b/libs/gui/LayerState.cpp
@@ -563,6 +563,10 @@
     }
 }
 
+bool layer_state_t::hasBufferChanges() const {
+    return (what & layer_state_t::eBufferChanged) || (what & layer_state_t::eCachedBufferChanged);
+}
+
 status_t layer_state_t::matrix22_t::write(Parcel& output) const {
     SAFE_PARCEL(output.writeFloat, dsdx);
     SAFE_PARCEL(output.writeFloat, dtdx);