Merge "msm: sde: Cache capture fence descriptor"
This commit is contained in:
commit
1b28f2e8fb
1 changed files with 28 additions and 7 deletions
|
@ -1785,6 +1785,7 @@ static long sde_rotator_private_ioctl(struct file *file, void *fh,
|
|||
struct msm_sde_rotator_fence *fence = arg;
|
||||
struct msm_sde_rotator_comp_ratio *comp_ratio = arg;
|
||||
struct sde_rotator_vbinfo *vbinfo;
|
||||
int ret;
|
||||
|
||||
switch (cmd) {
|
||||
case VIDIOC_S_SDE_ROTATOR_FENCE:
|
||||
|
@ -1843,19 +1844,39 @@ static long sde_rotator_private_ioctl(struct file *file, void *fh,
|
|||
|
||||
vbinfo = &ctx->vbinfo_cap[fence->index];
|
||||
|
||||
if (vbinfo->fence == NULL) {
|
||||
vbinfo->fd = -1;
|
||||
} else {
|
||||
vbinfo->fd =
|
||||
sde_rotator_get_sync_fence_fd(vbinfo->fence);
|
||||
if (vbinfo->fd < 0) {
|
||||
if (!vbinfo)
|
||||
return -EINVAL;
|
||||
|
||||
if (vbinfo->fence) {
|
||||
ret = sde_rotator_get_sync_fence_fd(vbinfo->fence);
|
||||
if (ret < 0) {
|
||||
SDEDEV_ERR(rot_dev->dev,
|
||||
"fail get fence fd s:%d\n",
|
||||
ctx->session_id);
|
||||
return vbinfo->fd;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Loose any reference to sync fence once we pass
|
||||
* it to user. Driver does not clean up user
|
||||
* unclosed fence descriptors.
|
||||
*/
|
||||
vbinfo->fence = NULL;
|
||||
|
||||
/*
|
||||
* Cache fence descriptor in case user calls this
|
||||
* ioctl multiple times. Cached value would be stale
|
||||
* if user duplicated and closed old descriptor.
|
||||
*/
|
||||
vbinfo->fd = ret;
|
||||
} else if (!sde_rotator_get_fd_sync_fence(vbinfo->fd)) {
|
||||
/*
|
||||
* User has closed cached fence descriptor.
|
||||
* Invalidate descriptor cache.
|
||||
*/
|
||||
vbinfo->fd = -1;
|
||||
}
|
||||
|
||||
fence->fd = vbinfo->fd;
|
||||
|
||||
SDEDEV_DBG(rot_dev->dev,
|
||||
|
|
Loading…
Add table
Reference in a new issue