sdm: Add support to GL based WB.

-- Mark all layers to GPU.
-- Program FBT to GPU for CSC.

CRs-Fixed: 2547250
Change-Id: I707fc25ef590f158b4576c91c710706198d06f01
diff --git a/gpu_tonemapper/EGLImageBuffer.cpp b/gpu_tonemapper/EGLImageBuffer.cpp
index eeb0273..92817ef 100644
--- a/gpu_tonemapper/EGLImageBuffer.cpp
+++ b/gpu_tonemapper/EGLImageBuffer.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017, 2019 The Linux Foundation. All rights reserved.
  * Not a Contribution.
  *
  * Copyright 2015 The Android Open Source Project
@@ -97,11 +97,11 @@
 }
 
 //-----------------------------------------------------------------------------
-unsigned int EGLImageBuffer::getTexture()
+unsigned int EGLImageBuffer::getTexture(int target)
 //-----------------------------------------------------------------------------
 {
   if (textureID == 0) {
-    bindAsTexture();
+    bindAsTexture(target);
   }
 
   return textureID;
@@ -119,22 +119,21 @@
 }
 
 //-----------------------------------------------------------------------------
-void EGLImageBuffer::bindAsTexture()
+void EGLImageBuffer::bindAsTexture(int target)
 //-----------------------------------------------------------------------------
 {
   if (textureID == 0) {
     GL(glGenTextures(1, &textureID));
-    int target = 0x8D65;
     GL(glBindTexture(target, textureID));
     GL(glTexParameteri(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
     GL(glTexParameteri(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
     GL(glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
     GL(glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
 
-    GL(glEGLImageTargetTexture2DOES(0x8D65, eglImageID));
+    GL(glEGLImageTargetTexture2DOES(target, eglImageID));
   }
 
-  GL(glBindTexture(0x8D65, textureID));
+  GL(glBindTexture(target, textureID));
 }
 
 //-----------------------------------------------------------------------------
diff --git a/gpu_tonemapper/EGLImageBuffer.h b/gpu_tonemapper/EGLImageBuffer.h
index 23af573..1433fdd 100644
--- a/gpu_tonemapper/EGLImageBuffer.h
+++ b/gpu_tonemapper/EGLImageBuffer.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016, 2019 The Linux Foundation. All rights reserved.
  * Not a Contribution.
  *
  * Copyright 2015 The Android Open Source Project
@@ -38,13 +38,13 @@
   int getWidth();
   int getHeight();
   EGLImageBuffer(android::sp<android::GraphicBuffer>);
-  unsigned int getTexture();
+  unsigned int getTexture(int target);
   unsigned int getFramebuffer();
-  void bindAsTexture();
+  void bindAsTexture(int target);
   void bindAsFramebuffer();
   ~EGLImageBuffer();
   static EGLImageBuffer *from(const private_handle_t *src);
   static void clear();
 };
 
-#endif  //__EGLIMAGE_BUFFER_H__
\ No newline at end of file
+#endif  //__EGLIMAGE_BUFFER_H_
diff --git a/gpu_tonemapper/Tonemapper.cpp b/gpu_tonemapper/Tonemapper.cpp
index 2605c7f..aa86a3c 100644
--- a/gpu_tonemapper/Tonemapper.cpp
+++ b/gpu_tonemapper/Tonemapper.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
  * Not a Contribution.
  *
  * Copyright 2015 The Android Open Source Project
@@ -143,7 +143,7 @@
   }
   // set source
   if (src_buffer) {
-    engine_setExternalInputBuffer(0, src_buffer->getTexture());
+    engine_setExternalInputBuffer(0, src_buffer->getTexture(0x8D65 /* target texture */));
   }
   // set 3d lut
   engine_set3DInputBuffer(1, tonemapTexture);