From 781953d62dc17d761e39540f0480e5ca7451cdbe Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Fri, 25 Jun 2010 18:02:21 -0700 Subject: Revert "Revert "fix [2793164] Spam 2x/second with TOT master in SurfaceFlinger"" This reverts commit 330dd304a471d260a73e342a240921c03c825f99. --- libs/surfaceflinger/TextureManager.cpp | 38 +++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'libs/surfaceflinger/TextureManager.cpp') diff --git a/libs/surfaceflinger/TextureManager.cpp b/libs/surfaceflinger/TextureManager.cpp index d9bdc6acec34..e4dd42fd5f3e 100644 --- a/libs/surfaceflinger/TextureManager.cpp +++ b/libs/surfaceflinger/TextureManager.cpp @@ -30,14 +30,15 @@ #include "clz.h" #include "DisplayHardware/DisplayHardware.h" +#include "GLExtensions.h" #include "TextureManager.h" namespace android { // --------------------------------------------------------------------------- -TextureManager::TextureManager(uint32_t flags) - : mFlags(flags) +TextureManager::TextureManager() + : mGLExtensions(GLExtensions::getInstance()) { } @@ -85,9 +86,11 @@ status_t TextureManager::initTexture(Image* pImage, int32_t format) GLenum target = GL_TEXTURE_2D; #if defined(GL_OES_texture_external) - if (format && isSupportedYuvFormat(format)) { - target = GL_TEXTURE_EXTERNAL_OES; - pImage->target = Texture::TEXTURE_EXTERNAL; + if (GLExtensions::getInstance().haveTextureExternal()) { + if (format && isSupportedYuvFormat(format)) { + target = GL_TEXTURE_EXTERNAL_OES; + pImage->target = Texture::TEXTURE_EXTERNAL; + } } #endif @@ -208,7 +211,7 @@ status_t TextureManager::loadTexture(Texture* texture, /* * round to POT if needed */ - if (!(mFlags & DisplayHardware::NPOT_EXTENSION)) { + if (!mGLExtensions.haveNpot()) { texture->NPOTAdjust = true; } @@ -294,14 +297,19 @@ status_t TextureManager::loadTexture(Texture* texture, void TextureManager::activateTexture(const Texture& texture, bool filter) { const GLenum target = getTextureTarget(&texture); - - glBindTexture(target, texture.name); - glEnable(target); - + if (target == Texture::TEXTURE_2D) { + glBindTexture(GL_TEXTURE_2D, texture.name); + glEnable(GL_TEXTURE_2D); #if defined(GL_OES_texture_external) - if (texture.target == Texture::TEXTURE_2D) { - glDisable(GL_TEXTURE_EXTERNAL_OES); - } else { + 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); glDisable(GL_TEXTURE_2D); } #endif @@ -319,7 +327,9 @@ void TextureManager::deactivateTextures() { glDisable(GL_TEXTURE_2D); #if defined(GL_OES_texture_external) - glDisable(GL_TEXTURE_EXTERNAL_OES); + if (GLExtensions::getInstance().haveTextureExternal()) { + glDisable(GL_TEXTURE_EXTERNAL_OES); + } #endif } -- cgit v1.2.3-59-g8ed1b From 8fa4c811e6d0da82282f9db1a32706399ee538bc Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Mon, 28 Jun 2010 19:54:17 -0700 Subject: fix[2798925] Gingerbread TOT not booting Fixed a typo where checking against the wrong constant caused GL_TEXTURE_EXTERNAL_OES to be used with a regular texture, which some GL driver will choke on. Change-Id: I93dfc4c8fa674433bbb678eee31954e9a8d0cb4b --- libs/surfaceflinger/TextureManager.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'libs/surfaceflinger/TextureManager.cpp') diff --git a/libs/surfaceflinger/TextureManager.cpp b/libs/surfaceflinger/TextureManager.cpp index e4dd42fd5f3e..fa192563cb4b 100644 --- a/libs/surfaceflinger/TextureManager.cpp +++ b/libs/surfaceflinger/TextureManager.cpp @@ -297,22 +297,19 @@ status_t TextureManager::loadTexture(Texture* texture, void TextureManager::activateTexture(const Texture& texture, bool filter) { const GLenum target = getTextureTarget(&texture); - if (target == Texture::TEXTURE_2D) { + if (target == GL_TEXTURE_2D) { glBindTexture(GL_TEXTURE_2D, texture.name); glEnable(GL_TEXTURE_2D); #if defined(GL_OES_texture_external) if (GLExtensions::getInstance().haveTextureExternal()) { glDisable(GL_TEXTURE_EXTERNAL_OES); } -#endif - } -#if defined(GL_OES_texture_external) - else { + } else { glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture.name); glEnable(GL_TEXTURE_EXTERNAL_OES); glDisable(GL_TEXTURE_2D); - } #endif + } if (filter) { glTexParameterx(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR); -- cgit v1.2.3-59-g8ed1b