hwcomposer: Close MDP pipe on invalid gralloc handle

Unused bypass pipes need to be closed after unlocking their
buffer handles.This change makes sure the pipes are closed even
if client releases the buffers(invalid buffer handle) before
this function gets called.

CRs-Fixed: 344765
(cherry picked from commit d8761a761f7d2eddcec12841f4d9afd4261ee79e)

Change-Id: I449d0dce4ec458e19446fcc26316a3794a15f909
This commit is contained in:
Jeykumar Sankaran 2012-03-02 15:20:09 -08:00 committed by Andrew Sutherland
parent 067c2f31a8
commit 8d39eda441

View File

@ -520,16 +520,14 @@ void closeExtraPipes(hwc_context_t* ctx) {
if (ctx->previousBypassHandle[i]) {
private_handle_t *hnd = (private_handle_t*) ctx->previousBypassHandle[i];
if (private_handle_t::validate(ctx->previousBypassHandle[i])) {
continue;
}
if (GENLOCK_FAILURE == genlock_unlock_buffer(ctx->previousBypassHandle[i])) {
LOGE("%s: genlock_unlock_buffer failed", __FUNCTION__);
} else {
ctx->previousBypassHandle[i] = NULL;
ctx->bypassBufferLockState[i] = BYPASS_BUFFER_UNLOCKED;
hnd->flags &= ~private_handle_t::PRIV_FLAGS_HWC_LOCK;
if (!private_handle_t::validate(ctx->previousBypassHandle[i])) {
if (GENLOCK_FAILURE == genlock_unlock_buffer(ctx->previousBypassHandle[i])) {
LOGE("%s: genlock_unlock_buffer failed", __FUNCTION__);
} else {
ctx->previousBypassHandle[i] = NULL;
ctx->bypassBufferLockState[i] = BYPASS_BUFFER_UNLOCKED;
hnd->flags &= ~private_handle_t::PRIV_FLAGS_HWC_LOCK;
}
}
}
ctx->mOvUI[i]->closeChannel();