diff options
author | Lingyun Zhu <lingyun.zhu@intel.com> | 2014-01-15 14:50:29 +0800 |
---|---|---|
committer | buildslave <sys_buildbot@intel.com> | 2014-01-22 05:24:58 +0000 |
commit | 5102f08006e6da2f595458c9408f73cc8a198369 (patch) | |
tree | c48faebb55305228ad40aa813e2e3049b42b0727 /ips | |
parent | 8fba592b7da8f789f7765984a76f5e138fde3a6e (diff) | |
download | hwcomposer-5102f08006e6da2f595458c9408f73cc8a198369.tar.gz |
[GFX-HWC] Move "close acquire fence" from commit to commitEnd
BZ: 155916
After patch 143849, patch 151924 is bypassed, so that
VirtualDisplaySurface::commit() will not be called and the acquire fence
for it will not be closed and lead to fd leak.
This patch moves "close acquire fence" from
VirtualDisplaySurface::commit() to TngDisplayContext::commitEnd() for
VirtualDisplaySurface.
This patch depends on patch 156366.
Change-Id: Ic5b1b52b14f3497de662ea973098617671fd5afb
Signed-off-by: Lingyun Zhu <lingyun.zhu@intel.com>
Diffstat (limited to 'ips')
-rw-r--r-- | ips/tangier/TngDisplayContext.cpp | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/ips/tangier/TngDisplayContext.cpp b/ips/tangier/TngDisplayContext.cpp index 0f8db51..bcc776c 100644 --- a/ips/tangier/TngDisplayContext.cpp +++ b/ips/tangier/TngDisplayContext.cpp @@ -101,20 +101,17 @@ bool TngDisplayContext::commitContents(hwc_display_contents_1_t *display, HwcLay // check layer parameters if (!display->hwLayers[i].handle) { - close(display->hwLayers[i].acquireFenceFd); continue; } DisplayPlane* plane = layerList->getPlane(i); if (!plane) { - close(display->hwLayers[i].acquireFenceFd); continue; } ret = plane->flip(NULL); if (ret == false) { VTRACE("failed to flip plane %d", i); - close(display->hwLayers[i].acquireFenceFd); continue; } @@ -171,6 +168,41 @@ bool TngDisplayContext::commitEnd(size_t numDisplays, hwc_display_contents_1_t * } } + // close acquire fence + for (size_t i = 0; i < numDisplays; i++) { + // Wait and close HWC_OVERLAY typed layer's acquire fence + hwc_display_contents_1_t* display = displays[i]; + if (!display) { + continue; + } + + for (size_t j = 0; j < display->numHwLayers-1; j++) { + hwc_layer_1_t& layer = display->hwLayers[j]; + if (layer.compositionType == HWC_OVERLAY) { + if (layer.acquireFenceFd != -1) { + // sync_wait(layer.acquireFenceFd, 16ms); + close(layer.acquireFenceFd); + layer.acquireFenceFd = -1; + } + } + } + + // Wait and close framebuffer target layer's acquire fence + hwc_layer_1_t& fbt = display->hwLayers[display->numHwLayers-1]; + if (fbt.acquireFenceFd != -1) { + // sync_wait(fbt.acquireFencdFd, 16ms); + close(fbt.acquireFenceFd); + fbt.acquireFenceFd = -1; + } + + // Wait and close outbuf's acquire fence + if (display->outbufAcquireFenceFd != -1) { + // sync_wait(display->outbufAcquireFenceFd, 16ms); + close(display->outbufAcquireFenceFd); + display->outbufAcquireFenceFd = -1; + } + } + // update release fence for (size_t i = 0; i < numDisplays; i++) { if (!displays[i]) { |