diff --git a/libgralloc/framebuffer.cpp b/libgralloc/framebuffer.cpp index 2abe2ee..d776f28 100644 --- a/libgralloc/framebuffer.cpp +++ b/libgralloc/framebuffer.cpp @@ -100,7 +100,7 @@ static int fb_setSwapInterval(struct framebuffer_device_t* dev, int interval) { char pval[PROPERTY_VALUE_MAX]; - property_get("debug.gr.swapinterval", pval, "-1"); + property_get("debug.egl.swapinterval", pval, "-1"); int property_interval = atoi(pval); if (property_interval >= 0) interval = property_interval; diff --git a/libhwcomposer/hwcomposer.cpp b/libhwcomposer/hwcomposer.cpp old mode 100644 new mode 100755 index 952c9de..020cf76 --- a/libhwcomposer/hwcomposer.cpp +++ b/libhwcomposer/hwcomposer.cpp @@ -95,6 +95,7 @@ struct hwc_context_t { #endif int previousLayerCount; eHWCOverlayStatus hwcOverlayStatus; + int swapInterval; }; static int hwc_device_open(const struct hw_module_t* module, const char* name, @@ -406,13 +407,18 @@ inline static bool isBypassDoable(hwc_composer_device_t *dev, const int yuvCount return false; } + char value[PROPERTY_VALUE_MAX]; + if (property_get("debug.egl.swapinterval", value, "1") > 0) { + ctx->swapInterval = atoi(value); + } //Bypass is not efficient if rotation or asynchronous mode is needed. for(int i = 0; i < list->numHwLayers; ++i) { if(list->hwLayers[i].transform) { return false; } if(list->hwLayers[i].flags & HWC_LAYER_ASYNCHRONOUS) { - return false; + if (ctx->swapInterval > 0) + return false; } } @@ -1443,22 +1449,25 @@ static int drawLayerUsingBypass(hwc_context_t *ctx, hwc_layer_t *layer, int laye ctx->bypassBufferLockState[index] = BYPASS_BUFFER_UNLOCKED; - if (GENLOCK_FAILURE == genlock_lock_buffer(hnd, GENLOCK_READ_LOCK, - GENLOCK_MAX_TIMEOUT)) { - LOGE("%s: genlock_lock_buffer(READ) failed", __FUNCTION__); - return -1; + if (ctx->swapInterval > 0) { + if (GENLOCK_FAILURE == genlock_lock_buffer(hnd, GENLOCK_READ_LOCK, + GENLOCK_MAX_TIMEOUT)) { + LOGE("%s: genlock_lock_buffer(READ) failed", __FUNCTION__); + return -1; + } + ctx->bypassBufferLockState[index] = BYPASS_BUFFER_LOCKED; } - ctx->bypassBufferLockState[index] = BYPASS_BUFFER_LOCKED; - LOGE_IF(BYPASS_DEBUG,"%s: Bypassing layer: %p using pipe: %d",__FUNCTION__, layer, index ); ret = ovUI->queueBuffer(hnd); if (ret) { // Unlock the locked buffer - if (GENLOCK_FAILURE == genlock_unlock_buffer(hnd)) { - LOGE("%s: genlock_unlock_buffer failed", __FUNCTION__); + if (ctx->swapInterval > 0) { + if (GENLOCK_FAILURE == genlock_unlock_buffer(hnd)) { + LOGE("%s: genlock_unlock_buffer failed", __FUNCTION__); + } } ctx->bypassBufferLockState[index] = BYPASS_BUFFER_UNLOCKED; return -1; @@ -1689,6 +1698,12 @@ static int hwc_device_open(const struct hw_module_t* module, const char* name, dev->previousOverlayHandle = NULL; dev->hwcOverlayStatus = HWC_OVERLAY_CLOSED; dev->previousLayerCount = -1; + char value[PROPERTY_VALUE_MAX]; + if (property_get("debug.egl.swapinterval", value, "1") > 0) { + dev->swapInterval = atoi(value); + } + + /* initialize the procs */ dev->device.common.tag = HARDWARE_DEVICE_TAG; dev->device.common.version = 0; diff --git a/liboverlay/overlayLibUI.cpp b/liboverlay/overlayLibUI.cpp index 89eb2f7..574240f 100755 --- a/liboverlay/overlayLibUI.cpp +++ b/liboverlay/overlayLibUI.cpp @@ -75,16 +75,6 @@ int getRGBBpp(int format) { return ret; } -bool turnOFFVSync() { - static int swapIntervalPropVal = -1; - if (swapIntervalPropVal == -1) { - char pval[PROPERTY_VALUE_MAX]; - property_get("debug.gr.swapinterval", pval, "1"); - swapIntervalPropVal = atoi(pval); - } - return (swapIntervalPropVal == 0); -} - }; namespace overlay { @@ -269,9 +259,6 @@ void OverlayUI::setDisplayParams(int fbNum, bool waitForVsync, bool isFg, int else flags &= ~MDP_OV_PIPE_SHARE; - if (turnOFFVSync()) - flags |= MDP_OV_PLAY_NOWAIT; - mOvInfo.flags = flags; mOvInfo.z_order = zorder;