Avoid closing invalid FD in Surface and GraphicBufferMapper
GraphicBufferMapper::lockAsync{,YCbCr} close the fence FD even when the FD is invalid. Change-Id: Ia2b4dae3b2c06426e34f623f19ba92435f486ab7
This commit is contained in:
parent
de5c15b8bd
commit
dcfe91e1f3
@ -131,8 +131,10 @@ status_t GraphicBufferMapper::lockAsync(buffer_handle_t handle,
|
|||||||
bounds.left, bounds.top, bounds.width(), bounds.height(),
|
bounds.left, bounds.top, bounds.width(), bounds.height(),
|
||||||
vaddr, fenceFd);
|
vaddr, fenceFd);
|
||||||
} else {
|
} else {
|
||||||
sync_wait(fenceFd, -1);
|
if (fenceFd >= 0) {
|
||||||
close(fenceFd);
|
sync_wait(fenceFd, -1);
|
||||||
|
close(fenceFd);
|
||||||
|
}
|
||||||
err = mAllocMod->lock(mAllocMod, handle, static_cast<int>(usage),
|
err = mAllocMod->lock(mAllocMod, handle, static_cast<int>(usage),
|
||||||
bounds.left, bounds.top, bounds.width(), bounds.height(),
|
bounds.left, bounds.top, bounds.width(), bounds.height(),
|
||||||
vaddr);
|
vaddr);
|
||||||
@ -154,8 +156,10 @@ status_t GraphicBufferMapper::lockAsyncYCbCr(buffer_handle_t handle,
|
|||||||
static_cast<int>(usage), bounds.left, bounds.top,
|
static_cast<int>(usage), bounds.left, bounds.top,
|
||||||
bounds.width(), bounds.height(), ycbcr, fenceFd);
|
bounds.width(), bounds.height(), ycbcr, fenceFd);
|
||||||
} else if (mAllocMod->lock_ycbcr != NULL) {
|
} else if (mAllocMod->lock_ycbcr != NULL) {
|
||||||
sync_wait(fenceFd, -1);
|
if (fenceFd >= 0) {
|
||||||
close(fenceFd);
|
sync_wait(fenceFd, -1);
|
||||||
|
close(fenceFd);
|
||||||
|
}
|
||||||
err = mAllocMod->lock_ycbcr(mAllocMod, handle, static_cast<int>(usage),
|
err = mAllocMod->lock_ycbcr(mAllocMod, handle, static_cast<int>(usage),
|
||||||
bounds.left, bounds.top, bounds.width(), bounds.height(),
|
bounds.left, bounds.top, bounds.width(), bounds.height(),
|
||||||
ycbcr);
|
ycbcr);
|
||||||
|
Loading…
Reference in New Issue
Block a user