From bd3520436800aa80e9c0e7a93895aa7fc6a36962 Mon Sep 17 00:00:00 2001 From: Jeykumar Sankaran Date: Fri, 20 Jan 2012 12:48:01 -0800 Subject: [PATCH] Revert "Bypass: Turn off only after FB content is displayed." This reverts commit f2dbabe786a12e7e9ae15328550b5ba581c5492e. This change is not needed any more because we are caching the MDP pipe contents when closing the channel. So no need to wait for postFB finish. Change-Id: Ia6f01c33953762cb7a97e0b2b795d9afeb60d2d9 (cherry picked from commit 441f1824593bb12a97508b426b597a16b35091e6) --- libgralloc/Android.mk | 4 +-- libgralloc/framebuffer.cpp | 47 +----------------------------------- libgralloc/gralloc_priv.h | 5 ---- libhwcomposer/hwcomposer.cpp | 16 ------------ 4 files changed, 3 insertions(+), 69 deletions(-) diff --git a/libgralloc/Android.mk b/libgralloc/Android.mk index a8cc183..d727017 100644 --- a/libgralloc/Android.mk +++ b/libgralloc/Android.mk @@ -45,8 +45,8 @@ ifeq ($(TARGET_QCOM_HDMI_OUT),true) LOCAL_SHARED_LIBRARIES += liboverlay endif -ifeq ($(TARGET_HAVE_BYPASS),true) - LOCAL_CFLAGS += -DCOMPOSITION_BYPASS +ifeq ($(TARGET_USES_SF_BYPASS),true) + LOCAL_CFLAGS += -DSF_BYPASS endif ifeq ($(TARGET_GRALLOC_USES_ASHMEM),true) diff --git a/libgralloc/framebuffer.cpp b/libgralloc/framebuffer.cpp index c2ec390..6f8594f 100644 --- a/libgralloc/framebuffer.cpp +++ b/libgralloc/framebuffer.cpp @@ -148,7 +148,7 @@ static void *disp_loop(void *ptr) pthread_mutex_lock(&(m->qlock)); // wait (sleep) while display queue is empty; - while (m->disp.isEmpty()) { + if (m->disp.isEmpty()) { pthread_cond_wait(&(m->qpost),&(m->qlock)); } @@ -176,13 +176,6 @@ static void *disp_loop(void *ptr) LOGE("ERROR FBIOPUT_VSCREENINFO failed; frame not displayed"); } -#if defined COMPOSITION_BYPASS - //Signal so that we can close channels if we need to - pthread_mutex_lock(&m->bufferPostLock); - m->bufferPostDone = true; - pthread_cond_signal(&m->bufferPostCond); - pthread_mutex_unlock(&m->bufferPostLock); -#endif CALC_FPS(); if (cur_buf == -1) { @@ -433,34 +426,6 @@ static int fb_orientationChanged(struct framebuffer_device_t* dev, int orientati } #endif -//Wait until framebuffer content is displayed. -//This is called in the context of threadLoop. -//Display loop wakes this up after display. -static int fb_waitForBufferPost(struct framebuffer_device_t* dev) -{ -#if defined COMPOSITION_BYPASS - private_module_t* m = reinterpret_cast( - dev->common.module); - pthread_mutex_lock(&m->bufferPostLock); - while(m->bufferPostDone == false) { - pthread_cond_wait(&(m->bufferPostCond), &(m->bufferPostLock)); - } - pthread_mutex_unlock(&m->bufferPostLock); -#endif - return 0; -} - -static int fb_resetBufferPostStatus(struct framebuffer_device_t* dev) -{ -#if defined COMPOSITION_BYPASS - private_module_t* m = reinterpret_cast( - dev->common.module); - pthread_mutex_lock(&m->bufferPostLock); - m->bufferPostDone = false; - pthread_mutex_unlock(&m->bufferPostLock); -#endif - return 0; -} static int fb_post(struct framebuffer_device_t* dev, buffer_handle_t buffer) { if (private_handle_t::validate(buffer) < 0) @@ -841,11 +806,6 @@ int mapFrameBufferLocked(struct private_module_t* module) pthread_t hdmiUIThread; pthread_create(&hdmiUIThread, NULL, &hdmi_ui_loop, (void *) module); #endif -#if defined COMPOSITION_BYPASS - pthread_mutex_init(&(module->bufferPostLock), NULL); - pthread_cond_init(&(module->bufferPostCond), NULL); - module->bufferPostDone = false; -#endif return 0; } @@ -909,11 +869,6 @@ int fb_device_open(hw_module_t const* module, const char* name, dev->device.setActionSafeHeightRatio = fb_setActionSafeHeightRatio; #endif -#if defined COMPOSITION_BYPASS - dev->device.waitForBufferPost = fb_waitForBufferPost; - dev->device.resetBufferPostStatus = fb_resetBufferPostStatus; -#endif - private_module_t* m = (private_module_t*)module; status = mapFrameBuffer(m); if (status >= 0) { diff --git a/libgralloc/gralloc_priv.h b/libgralloc/gralloc_priv.h index e33d721..0b3fe76 100644 --- a/libgralloc/gralloc_priv.h +++ b/libgralloc/gralloc_priv.h @@ -284,11 +284,6 @@ struct private_module_t { pthread_mutex_t overlayLock; pthread_cond_t overlayPost; #endif -#ifdef COMPOSITION_BYPASS - pthread_mutex_t bufferPostLock; - pthread_cond_t bufferPostCond; - bool bufferPostDone; -#endif }; /*****************************************************************************/ diff --git a/libhwcomposer/hwcomposer.cpp b/libhwcomposer/hwcomposer.cpp index 88a2881..86b4dfc 100644 --- a/libhwcomposer/hwcomposer.cpp +++ b/libhwcomposer/hwcomposer.cpp @@ -1223,9 +1223,6 @@ static int hwc_set(hwc_composer_device_t *dev, private_hwc_module_t* hwcModule = reinterpret_cast( dev->common.module); - - framebuffer_device_t *fbDev = hwcModule->fbDevice; - if (!list || !hwcModule) { LOGE("hwc_set invalid list or module"); #ifdef COMPOSITION_BYPASS @@ -1259,19 +1256,12 @@ static int hwc_set(hwc_composer_device_t *dev, storeLockedBypassHandle(list, ctx); // We have stored the handles, unset the current lock states in the context. unsetBypassBufferLockState(ctx); - - //Setup for waiting until 1 FB post is done before closing bypass mode. - if (ctx->bypassState == BYPASS_OFF_PENDING) { - fbDev->resetBufferPostStatus(fbDev); - } #endif - // Do not call eglSwapBuffers if we the skip composition flag is set on the list. if (!(list->flags & HWC_SKIP_COMPOSITION)) { EGLBoolean sucess = eglSwapBuffers((EGLDisplay)dpy, (EGLSurface)sur); if (!sucess) { ret = HWC_EGL_ERROR; - LOGE("eglSwapBuffers() failed in %s", __FUNCTION__); } } else { @@ -1279,12 +1269,6 @@ static int hwc_set(hwc_composer_device_t *dev, } #ifdef COMPOSITION_BYPASS if(ctx->bypassState == BYPASS_OFF_PENDING) { - //Close channels only after fb content is displayed. - //We have already reset status before eglSwapBuffers. - if (!(list->flags & HWC_SKIP_COMPOSITION)) { - fbDev->waitForBufferPost(fbDev); - } - closeBypass(ctx); ctx->bypassState = BYPASS_OFF; }