diff options
| author | Praveen Chavan <pchavan@codeaurora.org> | 2016-08-23 13:14:22 -0700 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-08-29 01:28:06 -0700 |
| commit | 34e86b910fbbd78e97ba799c4c8422fc30bf33c2 (patch) | |
| tree | 580c8070a089aba5a297ee4e70199e8740648411 | |
| parent | e8a0e0808d1862467d32aaee8982b5b6500ba89c (diff) | |
msm: vidc: Compare ion_handles rather than fds
fd(s) cannot uniquely identify buffers queued by cross-process
clients. Use ion handles to compare and match already-mapped-
buffers irrespective of data or extradata planes.
CRs-Fixed: 1060416
Change-Id: I591f18aa225cc6690bf423f2ae5bc7dafd4dad78
Signed-off-by: Praveen Chavan <pchavan@codeaurora.org>
| -rw-r--r-- | drivers/media/platform/msm/vidc/msm_vidc.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/media/platform/msm/vidc/msm_vidc.c b/drivers/media/platform/msm/vidc/msm_vidc.c index 84ce75c28bf8..437ad43e23e9 100644 --- a/drivers/media/platform/msm/vidc/msm_vidc.c +++ b/drivers/media/platform/msm/vidc/msm_vidc.c @@ -242,8 +242,7 @@ err_invalid_input: return ret; } -static struct msm_smem *get_same_fd_buffer(struct msm_vidc_list *buf_list, - int fd) +static struct msm_smem *get_same_fd_buffer(struct msm_vidc_inst *inst, int fd) { struct buffer_info *temp; struct msm_smem *same_fd_handle = NULL; @@ -253,16 +252,18 @@ static struct msm_smem *get_same_fd_buffer(struct msm_vidc_list *buf_list, if (!fd) return NULL; - if (!buf_list || fd < 0) { - dprintk(VIDC_ERR, "Invalid input\n"); + if (!inst || fd < 0) { + dprintk(VIDC_ERR, "%s: Invalid input\n", __func__); goto err_invalid_input; } - mutex_lock(&buf_list->lock); - list_for_each_entry(temp, &buf_list->list, list) { + mutex_lock(&inst->registeredbufs.lock); + list_for_each_entry(temp, &inst->registeredbufs.list, list) { for (i = 0; i < min(temp->num_planes, VIDEO_MAX_PLANES); i++) { - if (temp->fd[i] == fd && - temp->handle[i] && temp->mapped[i]) { + bool ion_hndl_matches = temp->handle[i] ? + msm_smem_compare_buffers(inst->mem_client, fd, + temp->handle[i]->smem_priv) : false; + if (ion_hndl_matches && temp->mapped[i]) { temp->same_fd_ref[i]++; dprintk(VIDC_INFO, "Found same fd buffer\n"); @@ -273,7 +274,7 @@ static struct msm_smem *get_same_fd_buffer(struct msm_vidc_list *buf_list, if (same_fd_handle) break; } - mutex_unlock(&buf_list->lock); + mutex_unlock(&inst->registeredbufs.lock); err_invalid_input: return same_fd_handle; @@ -487,8 +488,7 @@ int map_and_register_buf(struct msm_vidc_inst *inst, struct v4l2_buffer *b) } same_fd_handle = get_same_fd_buffer( - &inst->registeredbufs, - b->m.planes[i].reserved[0]); + inst, b->m.planes[i].reserved[0]); populate_buf_info(binfo, b, i); if (same_fd_handle) { |
