From 706056782a6ea32bdd84e2727a8d4061f5e87003 Mon Sep 17 00:00:00 2001 From: Benjamin Chan Date: Thu, 15 Jun 2017 18:18:54 -0400 Subject: [PATCH] msm: sde: Remove output fence object after user request completed The fence object is allocated in the driver during the buffer queuing time. When user requested the output buffer fence fd, driver should not hold on to the fence object anymore because there is only a single reference to the fence. When user destroy the fence by closing the fd, the reference is cleared. Driver only needs to destroy the fence object if the user does not request it. CRs-Fixed: 2059181 Change-Id: Ic83d93fd3c7f404774007065df02b402adbf80af Signed-off-by: Benjamin Chan --- drivers/media/platform/msm/sde/rotator/sde_rotator_dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/msm/sde/rotator/sde_rotator_dev.c b/drivers/media/platform/msm/sde/rotator/sde_rotator_dev.c index cfee4efb6f16..404d7ab9126f 100644 --- a/drivers/media/platform/msm/sde/rotator/sde_rotator_dev.c +++ b/drivers/media/platform/msm/sde/rotator/sde_rotator_dev.c @@ -480,7 +480,7 @@ static void sde_rotator_stop_streaming(struct vb2_queue *q) struct sde_rotator_vbinfo *vbinfo = &ctx->vbinfo_cap[i]; - if (vbinfo->fence && vbinfo->fd < 0) { + if (vbinfo->fence) { /* fence is not used */ SDEDEV_DBG(rot_dev->dev, "put fence s:%d t:%d i:%d\n", @@ -1459,7 +1459,7 @@ static int sde_rotator_dqbuf(struct file *file, && (buf->index < ctx->nbuf_cap)) { int idx = buf->index; - if (ctx->vbinfo_cap[idx].fence && ctx->vbinfo_cap[idx].fd < 0) { + if (ctx->vbinfo_cap[idx].fence) { /* fence is not used */ SDEDEV_DBG(ctx->rot_dev->dev, "put fence s:%d i:%d\n", ctx->session_id, idx); @@ -1856,6 +1856,7 @@ static long sde_rotator_private_ioctl(struct file *file, void *fh, ctx->session_id); return vbinfo->fd; } + vbinfo->fence = NULL; } fence->fd = vbinfo->fd;