From 73d48e78e558ddd45ae4e245b15b60c8f2650f28 Mon Sep 17 00:00:00 2001
From: Bulbul Dabi <bdabi@codeaurora.org>
Date: Tue, 21 Jun 2016 22:58:20 +0530
Subject: [PATCH] msm: vidc: update the check to ignore extradata plane in 
 dqbuf

userptr may or may not be a null-value. Checking for this field
to qualify a plane as extradata has no merit. Ignore that check

Bug: 28747768
Change-Id: I08d85ef462f09003aaa17f6ebc5d27de7083796f
Signed-off-by: Praveen Chavan <pchavan@codeaurora.org>
Signed-off-by: Praneeth Paladugu <ppaladug@codeaurora.org>
---
 drivers/media/platform/msm/vidc/msm_vidc.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/msm/vidc/msm_vidc.c b/drivers/media/platform/msm/vidc/msm_vidc.c
index 6a4620a3e16f..ff1b2177f147 100644
--- a/drivers/media/platform/msm/vidc/msm_vidc.c
+++ b/drivers/media/platform/msm/vidc/msm_vidc.c
@@ -259,11 +259,11 @@ struct buffer_info *get_registered_buf(struct msm_vidc_inst *inst,
 	list_for_each_entry(temp, &inst->registeredbufs.list, list) {
 		for (i = 0; (i < temp->num_planes)
 			&& (i < VIDEO_MAX_PLANES); i++) {
-			bool ion_hndl_matches =
+			bool ion_hndl_matches = temp->handle[i] ?
 				msm_smem_compare_buffers(inst->mem_client, fd,
-				temp->handle[i]->smem_priv);
+				temp->handle[i]->smem_priv) : false;
 			if (temp &&
-				((fd == temp->fd[i]) ||
+				(ion_hndl_matches ||
 				(device_addr == temp->device_addr[i])) &&
 				(CONTAINS(temp->buff_off[i],
 				temp->size[i], buff_off)
@@ -271,7 +271,7 @@ struct buffer_info *get_registered_buf(struct msm_vidc_inst *inst,
 				size, temp->buff_off[i])
 				|| OVERLAPS(buff_off, size,
 				temp->buff_off[i],
-				temp->size[i])) && ion_hndl_matches) {
+				temp->size[i]))) {
 					dprintk(VIDC_DBG,
 						"This memory region is already mapped\n");
 					ret = temp;
@@ -1000,8 +1000,8 @@ int msm_vidc_dqbuf(void *instance, struct v4l2_buffer *b)
 		if (!inst->map_output_buffer)
 			continue;
 		if (EXTRADATA_IDX(b->length) &&
-			(i == EXTRADATA_IDX(b->length)) &&
-			!b->m.planes[i].m.userptr) {
+			i == EXTRADATA_IDX(b->length))
+		{
 			continue;
 		}
 		buffer_info = device_to_uvaddr(&inst->registeredbufs,
-- 
GitLab