Revert "fix [2793164] Spam 2x/second with TOT master in SurfaceFlinger"

This reverts commit 081bc5c47d8a980e6eafa70ddafcd89981586391.
diff --git a/libs/surfaceflinger/TextureManager.cpp b/libs/surfaceflinger/TextureManager.cpp
index e4dd42f..d9bdc6a 100644
--- a/libs/surfaceflinger/TextureManager.cpp
+++ b/libs/surfaceflinger/TextureManager.cpp
@@ -30,15 +30,14 @@
 
 #include "clz.h"
 #include "DisplayHardware/DisplayHardware.h"
-#include "GLExtensions.h"
 #include "TextureManager.h"
 
 namespace android {
 
 // ---------------------------------------------------------------------------
 
-TextureManager::TextureManager()
-    : mGLExtensions(GLExtensions::getInstance())
+TextureManager::TextureManager(uint32_t flags)
+    : mFlags(flags)
 {
 }
 
@@ -86,11 +85,9 @@
 
     GLenum target = GL_TEXTURE_2D;
 #if defined(GL_OES_texture_external)
-    if (GLExtensions::getInstance().haveTextureExternal()) {
-        if (format && isSupportedYuvFormat(format)) {
-            target = GL_TEXTURE_EXTERNAL_OES;
-            pImage->target = Texture::TEXTURE_EXTERNAL;
-        }
+    if (format && isSupportedYuvFormat(format)) {
+        target = GL_TEXTURE_EXTERNAL_OES;
+        pImage->target = Texture::TEXTURE_EXTERNAL;
     }
 #endif
 
@@ -211,7 +208,7 @@
     /*
      * round to POT if needed
      */
-    if (!mGLExtensions.haveNpot()) {
+    if (!(mFlags & DisplayHardware::NPOT_EXTENSION)) {
         texture->NPOTAdjust = true;
     }
 
@@ -297,19 +294,14 @@
 void TextureManager::activateTexture(const Texture& texture, bool filter)
 {
     const GLenum target = getTextureTarget(&texture);
-    if (target == Texture::TEXTURE_2D) {
-        glBindTexture(GL_TEXTURE_2D, texture.name);
-        glEnable(GL_TEXTURE_2D);
+
+    glBindTexture(target, texture.name);
+    glEnable(target);
+
 #if defined(GL_OES_texture_external)
-        if (GLExtensions::getInstance().haveTextureExternal()) {
-            glDisable(GL_TEXTURE_EXTERNAL_OES);
-        }
-#endif
-    }
-#if defined(GL_OES_texture_external)
-    else {
-        glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture.name);
-        glEnable(GL_TEXTURE_EXTERNAL_OES);
+    if (texture.target == Texture::TEXTURE_2D) {
+        glDisable(GL_TEXTURE_EXTERNAL_OES);
+    } else {
         glDisable(GL_TEXTURE_2D);
     }
 #endif
@@ -327,9 +319,7 @@
 {
     glDisable(GL_TEXTURE_2D);
 #if defined(GL_OES_texture_external)
-    if (GLExtensions::getInstance().haveTextureExternal()) {
-        glDisable(GL_TEXTURE_EXTERNAL_OES);
-    }
+    glDisable(GL_TEXTURE_EXTERNAL_OES);
 #endif
 }