diff options
| -rw-r--r-- | libs/gui/SurfaceTextureClient.cpp | 7 | ||||
| -rw-r--r-- | libs/gui/tests/SurfaceTexture_test.cpp | 6 | ||||
| -rw-r--r-- | opengl/libs/EGL/Loader.cpp | 43 | ||||
| -rw-r--r-- | services/surfaceflinger/DisplayHardware/HWComposer.cpp | 17 | ||||
| -rw-r--r-- | services/surfaceflinger/DisplayHardware/HWComposer.h | 3 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 6 |
6 files changed, 76 insertions, 6 deletions
diff --git a/libs/gui/SurfaceTextureClient.cpp b/libs/gui/SurfaceTextureClient.cpp index 710ef94b88..0bee0f17c0 100644 --- a/libs/gui/SurfaceTextureClient.cpp +++ b/libs/gui/SurfaceTextureClient.cpp @@ -219,9 +219,12 @@ int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) { if (i < 0) { return i; } - mSurfaceTexture->queueBuffer(i, timestamp, + status_t err = mSurfaceTexture->queueBuffer(i, timestamp, &mDefaultWidth, &mDefaultHeight, &mTransformHint); - return OK; + if (err != OK) { + LOGE("queueBuffer: error queuing buffer to SurfaceTexture, %d", err); + } + return err; } int SurfaceTextureClient::query(int what, int* value) const { diff --git a/libs/gui/tests/SurfaceTexture_test.cpp b/libs/gui/tests/SurfaceTexture_test.cpp index 44babcf873..b8bc454782 100644 --- a/libs/gui/tests/SurfaceTexture_test.cpp +++ b/libs/gui/tests/SurfaceTexture_test.cpp @@ -974,8 +974,6 @@ TEST_F(SurfaceTextureGLTest, TexturingFromGLFilledRGBABufferPow2) { eglSwapBuffers(mEglDisplay, stcEglSurface); - eglDestroySurface(mEglDisplay, stcEglSurface); - // Do the consumer side of things EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)); @@ -985,6 +983,10 @@ TEST_F(SurfaceTextureGLTest, TexturingFromGLFilledRGBABufferPow2) { mST->updateTexImage(); + // We must wait until updateTexImage has been called to destroy the + // EGLSurface because we're in synchronous mode. + eglDestroySurface(mEglDisplay, stcEglSurface); + glClearColor(0.2, 0.2, 0.2, 0.2); glClear(GL_COLOR_BUFFER_BIT); diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp index e94e50e247..325193c7f4 100644 --- a/opengl/libs/EGL/Loader.cpp +++ b/opengl/libs/EGL/Loader.cpp @@ -23,6 +23,7 @@ #include <limits.h> #include <cutils/log.h> +#include <cutils/properties.h> #include <EGL/egl.h> @@ -45,6 +46,39 @@ namespace android { ANDROID_SINGLETON_STATIC_INSTANCE( Loader ) +/* This function is called to check whether we run inside the emulator, + * and if this is the case whether GLES GPU emulation is supported. + * + * Returned values are: + * -1 -> not running inside the emulator + * 0 -> running inside the emulator, but GPU emulation not supported + * 1 -> running inside the emulator, GPU emulation is supported + * through the "emulation" config. + */ +static int +checkGlesEmulationStatus(void) +{ + /* We're going to check for the following kernel parameters: + * + * qemu=1 -> tells us that we run inside the emulator + * android.qemu.gles=<number> -> tells us the GLES GPU emulation status + * + * Note that we will return <number> if we find it. This let us support + * more additionnal emulation modes in the future. + */ + char prop[PROPERTY_VALUE_MAX]; + int result = -1; + + /* First, check for qemu=1 */ + property_get("ro.kernel.qemu",prop,"0"); + if (atoi(prop) != 1) + return -1; + + /* We are in the emulator, get GPU status value */ + property_get("ro.kernel.qemu.gles",prop,"0"); + return atoi(prop); +} + // ---------------------------------------------------------------------------- Loader::driver_t::driver_t(void* gles) @@ -94,6 +128,15 @@ Loader::Loader() { char line[256]; char tag[256]; + + /* Special case for GLES emulation */ + if (checkGlesEmulationStatus() == 0) { + LOGD("Emulator without GPU support detected. Fallback to software renderer."); + gConfig.add( entry_t(0, 0, "android") ); + return; + } + + /* Otherwise, use egl.cfg */ FILE* cfg = fopen("/system/lib/egl/egl.cfg", "r"); if (cfg == NULL) { // default config diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp index 7d1bdf0021..0ff1cce81d 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp @@ -108,8 +108,21 @@ status_t HWComposer::commit() const { } status_t HWComposer::release() const { - int err = mHwc->set(mHwc, NULL, NULL, NULL); - return (status_t)err; + if (mHwc) { + int err = mHwc->set(mHwc, NULL, NULL, NULL); + return (status_t)err; + } + return NO_ERROR; +} + +status_t HWComposer::disable() { + if (mHwc) { + free(mList); + mList = NULL; + int err = mHwc->prepare(mHwc, NULL); + return (status_t)err; + } + return NO_ERROR; } size_t HWComposer::getNumLayers() const { diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.h b/services/surfaceflinger/DisplayHardware/HWComposer.h index 983898a423..77c1a4b2ab 100644 --- a/services/surfaceflinger/DisplayHardware/HWComposer.h +++ b/services/surfaceflinger/DisplayHardware/HWComposer.h @@ -50,6 +50,9 @@ public: // Asks the HAL what it can do status_t prepare() const; + // disable hwc until next createWorkList + status_t disable(); + // commits the list status_t commit() const; diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index b4c5decae1..4a3a8ea6c2 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2113,6 +2113,12 @@ status_t SurfaceFlinger::turnElectronBeamOffImplLocked(int32_t mode) // we're already off return NO_ERROR; } + + // turn off hwc while we're doing the animation + hw.getHwComposer().disable(); + // and make sure to turn it back on (if needed) next time we compose + invalidateHwcGeometry(); + if (mode & ISurfaceComposer::eElectronBeamAnimationOff) { electronBeamOffAnimationImplLocked(); } |