Display: Fix swap interval 0

- debug.gr.swapinterval is now deprecated. It has been replaced by
  debug.egl.swapinterval.
- Do not disable MDP bypass if we have ASYNCHRONOUS layers present
  and debug.egl.swapinterval=0.
- Do not lock overlay buffers if debug.egl.swapinterval=0

Conflicts:

	liboverlay/overlayLibUI.cpp

Change-Id: I004a437397570ad62b589bb68db2b9815917f551
This commit is contained in:
Sudhir Sharma 2012-03-27 12:57:58 -07:00 committed by Andrew Sutherland
parent c92339fb57
commit a7dbdc7072
3 changed files with 25 additions and 23 deletions

View File

@ -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;

33
libhwcomposer/hwcomposer.cpp Normal file → Executable file
View File

@ -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;

View File

@ -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;