Skip to contentSkip to conversation

venus: vdec: fix decoded data size

PATCH Superseded Vikash Garodia 2 participants 4 messages Oct 3, 2018 – Oct 8, 2018

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 venus: vdec: fix decoded data size

Exisiting code returns the max of the decoded size and buffer size. It turns out that buffer size is always greater due to hardware alignment requirement. As a result, payload size given to client is incorrect. This change ensures that the bytesused is assigned to actual payload size, when available.

---
 drivers/media/platform/qcom/venus/vdec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/qcom/venus/vdec.c +1 -2
index 991e158..189ec97 100644
@@ -888,8 +888,7 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,
 		unsigned int opb_sz = venus_helper_get_opb_size(inst);
 
 		vb = &vbuf->vb2_buf;
-		vb->planes[0].bytesused =
-			max_t(unsigned int, opb_sz, bytesused);
+		vb2_set_plane_payload(vb, 0, bytesused ? : opb_sz);
 		vb->planes[0].data_offset = data_offset;
 		vb->timestamp = timestamp_us * NSEC_PER_USEC;
 		vbuf->sequence = inst->sequence_cap++;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Acked-by on v1 1/1
#1 lore raw

Hi Vikash,

Quoted 17 lines · Vikash Garodia

Exisiting code returns the max of the decoded size and buffer size. It turns out that buffer size is always greater due to hardware alignment requirement. As a result, payload size given to client is incorrect. This change ensures that the bytesused is assigned to actual payload size, when available.

---
 drivers/media/platform/qcom/venus/vdec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/qcom/venus/vdec.c +0 -0
index 991e158..189ec97 100644

drivers/media/platform/qcom/venus/vdec.c static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type, · line 894

Quoted 9 lines
drivers/media/platform/qcom/venus/vdec.c +1 -2
@@ -888,8 +888,7 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,
 		unsigned int opb_sz = venus_helper_get_opb_size(inst);
 
 		vb = &vbuf->vb2_buf;
-		vb->planes[0].bytesused =
-			max_t(unsigned int, opb_sz, bytesused);
+		vb2_set_plane_payload(vb, 0, bytesused ? : opb_sz);
 		vb->planes[0].data_offset = data_offset;
 		vb->timestamp = timestamp_us * NSEC_PER_USEC;
 		vbuf->sequence = inst->sequence_cap++;
Signature · 2 lines
regards,
Stan
#2 lore raw
In reply to Vikash Garodia

Hi Vikash,

please, increment the version of the patch next time. This one must be v2.

Quoted 1 line · Vikash Garodia

Exisiting code returns the max of the decoded size and buffer size.

s/Exisiting/Existing

Quoted 25 lines

It turns out that buffer size is always greater due to hardware alignment requirement. As a result, payload size given to client is incorrect. This change ensures that the bytesused is assigned to actual payload size, when available.

---
 drivers/media/platform/qcom/venus/vdec.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/qcom/venus/vdec.c +1 -2
index 991e158..189ec97 100644
@@ -888,8 +888,7 @@ static void vdec_buf_done(struct venus_inst *inst, unsigned int buf_type,
 		unsigned int opb_sz = venus_helper_get_opb_size(inst);
 
 		vb = &vbuf->vb2_buf;
-		vb->planes[0].bytesused =
-			max_t(unsigned int, opb_sz, bytesused);
+		vb2_set_plane_payload(vb, 0, bytesused ? : opb_sz);
 		vb->planes[0].data_offset = data_offset;
 		vb->timestamp = timestamp_us * NSEC_PER_USEC;
 		vbuf->sequence = inst->sequence_cap++;
Signature · 2 lines
regards,
Stan
#3 lore raw

Hi Stanimir,

Quoted 9 lines · Stanimir Varbanov

Hi Vikash,

please, increment the version of the patch next time. This one must be v2.

Quoted 1 line · Vikash Garodia

Exisiting code returns the max of the decoded size and buffer size.

s/Exisiting/Existing

Posted v2 with above comments.

Thanks,
Vikash