Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b161f4f5 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: vidc: Compare ion_handles rather than fds"

parents 20b98d3c 4e29e656
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -241,8 +241,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;
@@ -252,16 +251,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");
@@ -272,7 +273,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;
@@ -492,9 +493,8 @@ int map_and_register_buf(struct msm_vidc_inst *inst, struct v4l2_buffer *b)
			goto exit;
		}

		same_fd_handle = i ? get_same_fd_buffer(
				&inst->registeredbufs,
				b->m.planes[i].reserved[0]) : NULL;
		same_fd_handle = get_same_fd_buffer(
				inst, b->m.planes[i].reserved[0]);

		populate_buf_info(binfo, b, i);
		if (same_fd_handle) {