diff options
| -rw-r--r-- | libs/gui/BufferQueue.cpp | 6 | ||||
| -rw-r--r-- | opengl/libs/Android.mk | 11 | ||||
| -rw-r--r-- | opengl/libs/EGL/Loader.cpp | 29 | ||||
| -rw-r--r-- | opengl/libs/EGL/eglApi.cpp | 21 | ||||
| -rw-r--r-- | opengl/libs/EGL/egl_display.cpp | 15 | ||||
| -rw-r--r-- | services/surfaceflinger/DisplayDevice.cpp | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp | 17 | ||||
| -rw-r--r-- | services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/Layer.cpp | 4 | ||||
| -rw-r--r-- | services/surfaceflinger/RenderEngine/GLES11RenderEngine.cpp | 9 | ||||
| -rw-r--r-- | services/surfaceflinger/RenderEngine/GLES11RenderEngine.h | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp | 17 | ||||
| -rw-r--r-- | services/surfaceflinger/RenderEngine/GLES20RenderEngine.h | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/RenderEngine/RenderEngine.cpp | 3 | ||||
| -rw-r--r-- | services/surfaceflinger/RenderEngine/RenderEngine.h | 2 | ||||
| -rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 3 |
16 files changed, 55 insertions, 90 deletions
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp index 65007fa24a..57a41f25c4 100644 --- a/libs/gui/BufferQueue.cpp +++ b/libs/gui/BufferQueue.cpp @@ -637,7 +637,8 @@ void BufferQueue::cancelBuffer(int buf, const sp<Fence>& fence) { status_t BufferQueue::connect(int api, bool producerControlledByApp, QueueBufferOutput* output) { ATRACE_CALL(); - ST_LOGV("connect: api=%d", api); + ST_LOGV("connect: api=%d producerControlledByApp=%s", api, + producerControlledByApp ? "true" : "false"); Mutex::Autolock lock(mMutex); if (mAbandoned) { @@ -1001,7 +1002,8 @@ status_t BufferQueue::releaseBuffer( status_t BufferQueue::consumerConnect(const sp<IConsumerListener>& consumerListener, bool controlledByApp) { - ST_LOGV("consumerConnect"); + ST_LOGV("consumerConnect controlledByApp=%s", + controlledByApp ? "true" : "false"); Mutex::Autolock lock(mMutex); if (mAbandoned) { diff --git a/opengl/libs/Android.mk b/opengl/libs/Android.mk index b4756dd430..528b983dd9 100644 --- a/opengl/libs/Android.mk +++ b/opengl/libs/Android.mk @@ -48,16 +48,9 @@ LOCAL_CFLAGS += -DEGL_TRACE=1 ifeq ($(BOARD_ALLOW_EGL_HIBERNATION),true) LOCAL_CFLAGS += -DBOARD_ALLOW_EGL_HIBERNATION endif - -ifeq ($(TARGET_BOARD_PLATFORM),msm7k) - LOCAL_CFLAGS += -DADRENO130=1 -endif - -ifeq ($(TARGET_BOARD_PLATFORM), s5pc110) - # see Loader.cpp for details - LOCAL_CFLAGS += -DSYSTEMUI_PBSIZE_HACK=1 +ifeq ($(TARGET_BOARD_PLATFORM), omap4) + LOCAL_CFLAGS += -DWORKAROUND_BUG_10194508=1 endif - ifneq ($(MAX_EGL_CACHE_ENTRY_SIZE),) LOCAL_CFLAGS += -DMAX_EGL_CACHE_ENTRY_SIZE=$(MAX_EGL_CACHE_ENTRY_SIZE) endif diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp index beaa560fbf..02914a06ea 100644 --- a/opengl/libs/EGL/Loader.cpp +++ b/opengl/libs/EGL/Loader.cpp @@ -374,35 +374,6 @@ void *Loader::load_driver(const char* kind, ALOGE_IF(!getProcAddress, "can't find eglGetProcAddress() in %s", driver_absolute_path); -#ifdef SYSTEMUI_PBSIZE_HACK -#warning "SYSTEMUI_PBSIZE_HACK enabled" - /* - * TODO: replace SYSTEMUI_PBSIZE_HACK by something less hackish - * - * Here we adjust the PB size from its default value to 512KB which - * is the minimum acceptable for the systemui process. - * We do this on low-end devices only because it allows us to enable - * h/w acceleration in the systemui process while keeping the - * memory usage down. - * - * Obviously, this is the wrong place and wrong way to make this - * adjustment, but at the time of this writing this was the safest - * solution. - */ - const char *cmdline = getProcessCmdline(); - if (strstr(cmdline, "systemui")) { - void *imgegl = dlopen("/vendor/lib/libIMGegl.so", RTLD_LAZY); - if (imgegl) { - unsigned int *PVRDefaultPBS = - (unsigned int *)dlsym(imgegl, "PVRDefaultPBS"); - if (PVRDefaultPBS) { - ALOGD("setting default PBS to 512KB, was %d KB", *PVRDefaultPBS / 1024); - *PVRDefaultPBS = 512*1024; - } - } - } -#endif - egl_t* egl = &cnx->egl; __eglMustCastToProperFunctionPointerType* curr = (__eglMustCastToProperFunctionPointerType*)egl; diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp index 7410c12e25..9d792fbe7e 100644 --- a/opengl/libs/EGL/eglApi.cpp +++ b/opengl/libs/EGL/eglApi.cpp @@ -413,7 +413,25 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config, // of our native format. So if sRGB gamma is requested, we have to // modify the EGLconfig's format before setting the native window's // format. - +#if WORKAROUND_BUG_10194508 +#warning "WORKAROUND_10194508 enabled" + EGLint format; + if (!cnx->egl.eglGetConfigAttrib(iDpy, config, EGL_NATIVE_VISUAL_ID, + &format)) { + ALOGE("eglGetConfigAttrib(EGL_NATIVE_VISUAL_ID) failed: %#x", + eglGetError()); + format = 0; + } + if (attrib_list) { + for (const EGLint* attr = attrib_list; *attr != EGL_NONE; + attr += 2) { + if (*attr == EGL_GL_COLORSPACE_KHR && + dp->haveExtension("EGL_KHR_gl_colorspace")) { + format = modifyFormatColorspace(format, *(attr+1)); + } + } + } +#else // by default, just pick RGBA_8888 EGLint format = HAL_PIXEL_FORMAT_RGBA_8888; @@ -444,6 +462,7 @@ EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config, } } } +#endif if (format != 0) { int err = native_window_set_buffers_format(window, format); if (err != 0) { diff --git a/opengl/libs/EGL/egl_display.cpp b/opengl/libs/EGL/egl_display.cpp index 038052198d..26240f1bcd 100644 --- a/opengl/libs/EGL/egl_display.cpp +++ b/opengl/libs/EGL/egl_display.cpp @@ -150,21 +150,6 @@ EGLBoolean egl_display_t::initialize(EGLint *major, EGLint *minor) { cnx->major = -1; cnx->minor = -1; if (cnx->dso) { - -#if defined(ADRENO130) -#warning "Adreno-130 eglInitialize() workaround" - /* - * The ADRENO 130 driver returns a different EGLDisplay each time - * eglGetDisplay() is called, but also makes the EGLDisplay invalid - * after eglTerminate() has been called, so that eglInitialize() - * cannot be called again. Therefore, we need to make sure to call - * eglGetDisplay() before calling eglInitialize(); - */ - if (i == IMPL_HARDWARE) { - disp[i].dpy = cnx->egl.eglGetDisplay(EGL_DEFAULT_DISPLAY); - } -#endif - EGLDisplay idpy = disp.dpy; if (cnx->egl.eglInitialize(idpy, &cnx->major, &cnx->minor)) { //ALOGD("initialized dpy=%p, ver=%d.%d, cnx=%p", diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp index 9708ee3309..61a9361579 100644 --- a/services/surfaceflinger/DisplayDevice.cpp +++ b/services/surfaceflinger/DisplayDevice.cpp @@ -271,9 +271,9 @@ EGLBoolean DisplayDevice::makeCurrent(EGLDisplay dpy, EGLContext ctx) const { if (result == EGL_TRUE) { if (mType >= DisplayDevice::DISPLAY_VIRTUAL) eglSwapInterval(dpy, 0); - setViewportAndProjection(); } } + setViewportAndProjection(); return result; } diff --git a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp index 01ca38ae30..43d27bb24b 100644 --- a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp +++ b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp @@ -175,9 +175,12 @@ void VirtualDisplaySurface::onFrameCommitted() { sp<Fence> outFence = mHwc.getLastRetireFence(mDisplayId); VDS_LOGV("onFrameCommitted: queue sink sslot=%d", sslot); status_t result = mSource[SOURCE_SINK]->queueBuffer(sslot, - QueueBufferInput(systemTime(), false, + QueueBufferInput( + systemTime(), false /* isAutoTimestamp */, Rect(mSinkBufferWidth, mSinkBufferHeight), - NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, false, outFence), + NATIVE_WINDOW_SCALING_MODE_FREEZE, 0 /* transform */, + true /* async*/, + outFence), &qbo); if (result == NO_ERROR) { updateQueueBufferOutput(qbo); @@ -205,7 +208,10 @@ status_t VirtualDisplaySurface::setBufferCount(int bufferCount) { } status_t VirtualDisplaySurface::dequeueBuffer(Source source, - uint32_t format, int* sslot, sp<Fence>* fence, bool async) { + uint32_t format, int* sslot, sp<Fence>* fence) { + // Don't let a slow consumer block us + bool async = (source == SOURCE_SINK); + status_t result = mSource[source]->dequeueBuffer(sslot, fence, async, mSinkBufferWidth, mSinkBufferHeight, format, mProducerUsage); if (result < 0) @@ -244,6 +250,7 @@ status_t VirtualDisplaySurface::dequeueBuffer(int* pslot, sp<Fence>* fence, bool "Unexpected dequeueBuffer() in %s state", dbgStateStr()); mDbgState = DBG_STATE_GLES; + VDS_LOGW_IF(!async, "EGL called dequeueBuffer with !async despite eglSwapInterval(0)"); VDS_LOGV("dequeueBuffer %dx%d fmt=%d usage=%#x", w, h, format, usage); status_t result = NO_ERROR; @@ -275,7 +282,7 @@ status_t VirtualDisplaySurface::dequeueBuffer(int* pslot, sp<Fence>* fence, bool *fence = mOutputFence; } else { int sslot; - result = dequeueBuffer(source, format, &sslot, fence, async); + result = dequeueBuffer(source, format, &sslot, fence); if (result >= 0) { *pslot = mapSource2ProducerSlot(source, sslot); } @@ -391,7 +398,7 @@ status_t VirtualDisplaySurface::refreshOutputBuffer() { } int sslot; - status_t result = dequeueBuffer(SOURCE_SINK, 0, &sslot, &mOutputFence, false); + status_t result = dequeueBuffer(SOURCE_SINK, 0, &sslot, &mOutputFence); if (result < 0) return result; mOutputProducerSlot = mapSource2ProducerSlot(SOURCE_SINK, sslot); diff --git a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h index 4ab80e4f64..536007ec69 100644 --- a/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h +++ b/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h @@ -110,7 +110,7 @@ private: // static Source fbSourceForCompositionType(CompositionType type); status_t dequeueBuffer(Source source, uint32_t format, - int* sslot, sp<Fence>* fence, bool async); + int* sslot, sp<Fence>* fence); void updateQueueBufferOutput(const QueueBufferOutput& qbo); void resetPerFrameState(); status_t refreshOutputBuffer(); diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index f867e86bc8..56bddd61ee 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -506,8 +506,10 @@ void Layer::onDraw(const sp<const DisplayDevice>& hw, const Region& clip) const void Layer::clearWithOpenGL(const sp<const DisplayDevice>& hw, const Region& clip, float red, float green, float blue, float alpha) const { + RenderEngine& engine(mFlinger->getRenderEngine()); computeGeometry(hw, mMesh); - mFlinger->getRenderEngine().fillWithColor(mMesh, red, green, blue, alpha); + engine.setupFillWithColor(red, green, blue, alpha); + engine.drawMesh(mMesh); } void Layer::clearWithOpenGL( diff --git a/services/surfaceflinger/RenderEngine/GLES11RenderEngine.cpp b/services/surfaceflinger/RenderEngine/GLES11RenderEngine.cpp index baa57e6b7a..d0ae253508 100644 --- a/services/surfaceflinger/RenderEngine/GLES11RenderEngine.cpp +++ b/services/surfaceflinger/RenderEngine/GLES11RenderEngine.cpp @@ -209,18 +209,11 @@ void GLES11RenderEngine::unbindFramebuffer(uint32_t texName, uint32_t fbName) { glDeleteTextures(1, &texName); } -void GLES11RenderEngine::fillWithColor(const Mesh& mesh, float r, float g, float b, float a) { +void GLES11RenderEngine::setupFillWithColor(float r, float g, float b, float a) { glColor4f(r, g, b, a); glDisable(GL_TEXTURE_EXTERNAL_OES); glDisable(GL_TEXTURE_2D); glDisable(GL_BLEND); - - glVertexPointer(mesh.getVertexSize(), - GL_FLOAT, - mesh.getByteStride(), - mesh.getPositions()); - - glDrawArrays(mesh.getPrimitive(), 0, mesh.getVertexCount()); } void GLES11RenderEngine::drawMesh(const Mesh& mesh) { diff --git a/services/surfaceflinger/RenderEngine/GLES11RenderEngine.h b/services/surfaceflinger/RenderEngine/GLES11RenderEngine.h index 90fc82f135..1de0443af1 100644 --- a/services/surfaceflinger/RenderEngine/GLES11RenderEngine.h +++ b/services/surfaceflinger/RenderEngine/GLES11RenderEngine.h @@ -54,10 +54,10 @@ protected: virtual void setupDimLayerBlending(int alpha); virtual void setupLayerTexturing(const Texture& texture); virtual void setupLayerBlackedOut(); + virtual void setupFillWithColor(float r, float g, float b, float a) ; virtual void disableTexturing(); virtual void disableBlending(); - virtual void fillWithColor(const Mesh& mesh, float r, float g, float b, float a) ; virtual void drawMesh(const Mesh& mesh); virtual size_t getMaxTextureSize() const; diff --git a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp index 0979647c7f..9754758caf 100644 --- a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp +++ b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp @@ -170,20 +170,13 @@ void GLES20RenderEngine::unbindFramebuffer(uint32_t texName, uint32_t fbName) { glDeleteTextures(1, &texName); } -void GLES20RenderEngine::fillWithColor(const Mesh& mesh, float r, float g, float b, float a) { +void GLES20RenderEngine::setupFillWithColor(float r, float g, float b, float a) { + mState.setPlaneAlpha(1.0f); + mState.setPremultipliedAlpha(true); + mState.setOpaque(false); mState.setColor(r, g, b, a); - disableTexturing(); + mState.disableTexture(); glDisable(GL_BLEND); - - ProgramCache::getInstance().useProgram(mState); - - glVertexAttribPointer(Program::position, - mesh.getVertexSize(), - GL_FLOAT, GL_FALSE, - mesh.getByteStride(), - mesh.getPositions()); - - glDrawArrays(mesh.getPrimitive(), 0, mesh.getVertexCount()); } void GLES20RenderEngine::drawMesh(const Mesh& mesh) { diff --git a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h index 3ff6d9f8ae..eb8f31afbb 100644 --- a/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h +++ b/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h @@ -58,10 +58,10 @@ protected: virtual void setupDimLayerBlending(int alpha); virtual void setupLayerTexturing(const Texture& texture); virtual void setupLayerBlackedOut(); + virtual void setupFillWithColor(float r, float g, float b, float a); virtual void disableTexturing(); virtual void disableBlending(); - virtual void fillWithColor(const Mesh& mesh, float r, float g, float b, float a); virtual void drawMesh(const Mesh& mesh); virtual size_t getMaxTextureSize() const; diff --git a/services/surfaceflinger/RenderEngine/RenderEngine.cpp b/services/surfaceflinger/RenderEngine/RenderEngine.cpp index 063be2ed32..2abda82dc9 100644 --- a/services/surfaceflinger/RenderEngine/RenderEngine.cpp +++ b/services/surfaceflinger/RenderEngine/RenderEngine.cpp @@ -164,7 +164,8 @@ void RenderEngine::fillRegionWithColor(const Region& region, uint32_t height, position[i*6 + 5].x = r->right; position[i*6 + 5].y = height - r->top; } - fillWithColor(mesh, red, green, blue, alpha); + setupFillWithColor(red, green, blue, alpha); + drawMesh(mesh); } void RenderEngine::clearWithColor(float red, float green, float blue, float alpha) { diff --git a/services/surfaceflinger/RenderEngine/RenderEngine.h b/services/surfaceflinger/RenderEngine/RenderEngine.h index 82765c7a95..bc88b69c96 100644 --- a/services/surfaceflinger/RenderEngine/RenderEngine.h +++ b/services/surfaceflinger/RenderEngine/RenderEngine.h @@ -87,12 +87,12 @@ public: virtual void setupDimLayerBlending(int alpha) = 0; virtual void setupLayerTexturing(const Texture& texture) = 0; virtual void setupLayerBlackedOut() = 0; + virtual void setupFillWithColor(float r, float g, float b, float a) = 0; virtual void disableTexturing() = 0; virtual void disableBlending() = 0; // drawing - virtual void fillWithColor(const Mesh& mesh, float r, float g, float b, float a) = 0; virtual void drawMesh(const Mesh& mesh) = 0; // queries diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 9fd3f25fe2..0323cb73a1 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -2726,6 +2726,7 @@ void SurfaceFlinger::renderScreenImplLocked( // compositionComplete is needed for older driver hw->compositionComplete(); + hw->setViewportAndProjection(); } @@ -2805,8 +2806,6 @@ status_t SurfaceFlinger::captureScreenImplLocked( native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL); } - hw->setViewportAndProjection(); - return result; } |