summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2016-08-03 15:28:43 -0700
committerSteve Kondik <steve@cyngn.com>2016-08-03 15:28:43 -0700
commit542b068e322f90e7e6689daddddc493363d0b549 (patch)
treeffe47f1d1e8238f8a11d1c2b2a5fe2ae4396ea42
parentda998f4845d4a4a783620bdd81d1c2feb9d404d3 (diff)
downloadframeworks_native-542b068e322f90e7e6689daddddc493363d0b549.zip
frameworks_native-542b068e322f90e7e6689daddddc493363d0b549.tar.gz
frameworks_native-542b068e322f90e7e6689daddddc493363d0b549.tar.bz2
surfaceflinger: Fix uninitialized variable
* And don't try to reinit the lib after a failure. Change-Id: Ic055a48670ed8cf01e27b16c5d4ddf214db53d20
-rw-r--r--services/surfaceflinger/LayerBlur.cpp9
-rw-r--r--services/surfaceflinger/LayerBlur.h1
2 files changed, 9 insertions, 1 deletions
diff --git a/services/surfaceflinger/LayerBlur.cpp b/services/surfaceflinger/LayerBlur.cpp
index a49ff39..93f548f 100644
--- a/services/surfaceflinger/LayerBlur.cpp
+++ b/services/surfaceflinger/LayerBlur.cpp
@@ -404,6 +404,7 @@ void LayerBlur::ensureFbo(FBO& fbo, int width, int height, int textureName) {
// ---------------------------------------------------------------------------
void* LayerBlur::BlurImpl::sLibHandle = NULL;
+bool LayerBlur::BlurImpl::sUnsupported = false;
LayerBlur::BlurImpl::initBlurTokenFn LayerBlur::BlurImpl::initBlurToken = NULL;
LayerBlur::BlurImpl::releaseBlurTokenFn LayerBlur::BlurImpl::releaseBlurToken = NULL;
@@ -421,8 +422,13 @@ status_t LayerBlur::BlurImpl::initBlurImpl() {
if (sLibHandle != NULL) {
return OK;
}
+ if (sUnsupported) {
+ return NO_INIT;
+ }
+
sLibHandle = dlopen("libuiblur.so", RTLD_NOW);
if (sLibHandle == NULL) {
+ sUnsupported = true;
return NO_INIT;
}
@@ -444,13 +450,14 @@ status_t LayerBlur::BlurImpl::initBlurImpl() {
if (!initBlurToken || !releaseBlurToken || !doBlur) {
ALOGE("dlsym failed for blur impl!: %s", dlerror());
closeBlurImpl();
+ sUnsupported = true;
return NO_INIT;
}
return OK;
}
-LayerBlur::BlurImpl::BlurImpl() {
+LayerBlur::BlurImpl::BlurImpl() : mToken(NULL) {
Mutex::Autolock _l(sLock);
if (initBlurImpl() == OK) {
mToken = initBlurToken();
diff --git a/services/surfaceflinger/LayerBlur.h b/services/surfaceflinger/LayerBlur.h
index 63138c4..bd37ad3 100644
--- a/services/surfaceflinger/LayerBlur.h
+++ b/services/surfaceflinger/LayerBlur.h
@@ -68,6 +68,7 @@ private:
static status_t initBlurImpl();
static void closeBlurImpl();
static void* sLibHandle;
+ static bool sUnsupported;
typedef void* (*initBlurTokenFn)();
typedef void* (*releaseBlurTokenFn)(void*);