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>
This commit is contained in:
parent
e8a0e0808d
commit
34e86b910f
1 changed files with 11 additions and 11 deletions
|
@ -242,8 +242,7 @@ err_invalid_input:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct msm_smem *get_same_fd_buffer(struct msm_vidc_list *buf_list,
|
static struct msm_smem *get_same_fd_buffer(struct msm_vidc_inst *inst, int fd)
|
||||||
int fd)
|
|
||||||
{
|
{
|
||||||
struct buffer_info *temp;
|
struct buffer_info *temp;
|
||||||
struct msm_smem *same_fd_handle = NULL;
|
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)
|
if (!fd)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (!buf_list || fd < 0) {
|
if (!inst || fd < 0) {
|
||||||
dprintk(VIDC_ERR, "Invalid input\n");
|
dprintk(VIDC_ERR, "%s: Invalid input\n", __func__);
|
||||||
goto err_invalid_input;
|
goto err_invalid_input;
|
||||||
}
|
}
|
||||||
|
|
||||||
mutex_lock(&buf_list->lock);
|
mutex_lock(&inst->registeredbufs.lock);
|
||||||
list_for_each_entry(temp, &buf_list->list, list) {
|
list_for_each_entry(temp, &inst->registeredbufs.list, list) {
|
||||||
for (i = 0; i < min(temp->num_planes, VIDEO_MAX_PLANES); i++) {
|
for (i = 0; i < min(temp->num_planes, VIDEO_MAX_PLANES); i++) {
|
||||||
if (temp->fd[i] == fd &&
|
bool ion_hndl_matches = temp->handle[i] ?
|
||||||
temp->handle[i] && temp->mapped[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]++;
|
temp->same_fd_ref[i]++;
|
||||||
dprintk(VIDC_INFO,
|
dprintk(VIDC_INFO,
|
||||||
"Found same fd buffer\n");
|
"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)
|
if (same_fd_handle)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mutex_unlock(&buf_list->lock);
|
mutex_unlock(&inst->registeredbufs.lock);
|
||||||
|
|
||||||
err_invalid_input:
|
err_invalid_input:
|
||||||
return same_fd_handle;
|
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(
|
same_fd_handle = get_same_fd_buffer(
|
||||||
&inst->registeredbufs,
|
inst, b->m.planes[i].reserved[0]);
|
||||||
b->m.planes[i].reserved[0]);
|
|
||||||
|
|
||||||
populate_buf_info(binfo, b, i);
|
populate_buf_info(binfo, b, i);
|
||||||
if (same_fd_handle) {
|
if (same_fd_handle) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue