Skip to contentSkip to conversation

media: meson: vdec: fix OUTPUT buffer size configuration

PATCH In review Maxime Jourdan 2 participants 2 messages Jan 27, 2020 – Feb 6, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: meson: vdec: fix OUTPUT buffer size configuration

There's a bug currently where we always override the OUTPUT buffer size in try_fmt to the default value (1M), preventing userspace from setting a higher or lower size.

Now, only update the size in try_fmt if userspace passed 0.

---

Note: this patch depends on Neil's series:
media: meson: vdec: Add compliant H264 support
https://patchwork.kernel.org/cover/11336953/

 drivers/staging/media/meson/vdec/vdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/media/meson/vdec/vdec.c +2 -1
index 1be67b122546..2f30945ce916 100644
@@ -519,7 +519,8 @@ vdec_try_fmt_common(struct amvdec_session *sess, u32 size,
 	output_size = get_output_size(pixmp->width, pixmp->height);
 
 	if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
-		pfmt[0].sizeimage = sess->src_buffer_size;
+		if (!pfmt[0].sizeimage)
+			pfmt[0].sizeimage = sess->src_buffer_size;
 		pfmt[0].bytesperline = 0;
 		pixmp->num_planes = 1;
 	} else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
Signature · 1 line
2.25.0
#1 lore raw
Quoted 22 lines · Maxime Jourdan

There's a bug currently where we always override the OUTPUT buffer size in try_fmt to the default value (1M), preventing userspace from setting a higher or lower size.

Now, only update the size in try_fmt if userspace passed 0.

---

Note: this patch depends on Neil's series:
media: meson: vdec: Add compliant H264 support
https://patchwork.kernel.org/cover/11336953/

 drivers/staging/media/meson/vdec/vdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/media/meson/vdec/vdec.c +0 -0
index 1be67b122546..2f30945ce916 100644

drivers/staging/media/meson/vdec/vdec.c vdec_try_fmt_common(struct amvdec_session *sess, u32 size, · line 526

Quoted 9 lines
drivers/staging/media/meson/vdec/vdec.c +2 -1
@@ -519,7 +519,8 @@ vdec_try_fmt_common(struct amvdec_session *sess, u32 size,
 	output_size = get_output_size(pixmp->width, pixmp->height);
 
 	if (f->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
-		pfmt[0].sizeimage = sess->src_buffer_size;
+		if (!pfmt[0].sizeimage)
+			pfmt[0].sizeimage = sess->src_buffer_size;
 		pfmt[0].bytesperline = 0;
 		pixmp->num_planes = 1;
 	} else if (f->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {

Will squash into v5 of "media: meson: vdec: Add compliant H264 support"

Thanks,
Neil