surfaceflinger: add BufferLayerConsumer

Copied from GLConsumer.{cpp,h}.  Run sed and clang-format on them.
Minor fixes (incorrect header path, already defined macros) to make
them compile.

Make SurfaceFlingerConsumer inherit from BufferLayerConsumer.

Test: boots
Change-Id: I44ef6b15e77fb84b60ab788457a8ed0a1c784a95
diff --git a/services/surfaceflinger/SurfaceFlingerConsumer.h b/services/surfaceflinger/SurfaceFlingerConsumer.h
index 7397f2d..cd13938 100644
--- a/services/surfaceflinger/SurfaceFlingerConsumer.h
+++ b/services/surfaceflinger/SurfaceFlingerConsumer.h
@@ -17,10 +17,10 @@
 #ifndef ANDROID_SURFACEFLINGERCONSUMER_H
 #define ANDROID_SURFACEFLINGERCONSUMER_H
 
+#include "BufferLayerConsumer.h"
 #include "DispSync.h"
 
 #include <ui/Region.h>
-#include <gui/GLConsumer.h>
 
 namespace android {
 // ----------------------------------------------------------------------------
@@ -28,9 +28,9 @@
 class Layer;
 
 /*
- * This is a thin wrapper around GLConsumer.
+ * This is a thin wrapper around BufferLayerConsumer.
  */
-class SurfaceFlingerConsumer : public GLConsumer {
+class SurfaceFlingerConsumer : public BufferLayerConsumer {
 public:
     static const status_t BUFFER_REJECTED = UNKNOWN_ERROR + 8;
 
@@ -40,7 +40,7 @@
 
     SurfaceFlingerConsumer(const sp<IGraphicBufferConsumer>& consumer,
             uint32_t tex, Layer* layer)
-        : GLConsumer(consumer, tex, GLConsumer::TEXTURE_EXTERNAL, false, false),
+        : BufferLayerConsumer(consumer, tex, BufferLayerConsumer::TEXTURE_EXTERNAL, false, false),
           mTransformToDisplayInverse(false), mSurfaceDamage(), mLayer(layer)
     {}
 
@@ -57,14 +57,14 @@
             uint64_t maxFrameNumber = 0) override;
 
     // This version of updateTexImage() takes a functor that may be used to
-    // reject the newly acquired buffer.  Unlike the GLConsumer version,
+    // reject the newly acquired buffer.  Unlike the BufferLayerConsumer version,
     // this does not guarantee that the buffer has been bound to the GL
     // texture.
     status_t updateTexImage(BufferRejecter* rejecter, const DispSync& dispSync,
             bool* autoRefresh, bool* queuedBuffer,
             uint64_t maxFrameNumber);
 
-    // See GLConsumer::bindTextureImageLocked().
+    // See BufferLayerConsumer::bindTextureImageLocked().
     status_t bindTextureImage();
 
     bool getTransformToDisplayInverse() const;
@@ -93,7 +93,7 @@
     wp<ContentsChangedListener> mContentsChangedListener;
 
     // Indicates this buffer must be transformed by the inverse transform of the screen
-    // it is displayed onto. This is applied after GLConsumer::mCurrentTransform.
+    // it is displayed onto. This is applied after BufferLayerConsumer::mCurrentTransform.
     // This must be set/read from SurfaceFlinger's main thread.
     bool mTransformToDisplayInverse;