Skip to contentSkip to conversation

yavta: Set plane size for mplane buffers in qbuf

PATCH In review Sakari Ailus 3 participants 3 messages Dec 15, 2014 Media (V4L/DVB)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 yavta: Set plane size for mplane buffers in qbuf

The plane size was left zero for mplane buffers when queueing a buffer. Fix this.

---
 yavta.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
yavta.c +6 -2
index 7f9e814..77e5a41 100644
@@ -979,8 +979,12 @@ static int video_queue_buffer(struct device *dev, int index, enum buffer_fill_mo
 
 	if (dev->memtype == V4L2_MEMORY_USERPTR) {
 		if (video_is_mplane(dev)) {
-			for (i = 0; i < dev->num_planes; i++)
-				buf.m.planes[i].m.userptr = (unsigned long)dev->buffers[index].mem[i];
+			for (i = 0; i < dev->num_planes; i++) {
+				buf.m.planes[i].m.userptr = (unsigned long)
+					dev->buffers[index].mem[i];
+				buf.m.planes[i].length =
+					dev->buffers[index].size[i];
+			}
 		} else {
 			buf.m.userptr = (unsigned long)dev->buffers[index].mem[0];
 		}
Signature · 1 line
2.1.0.231.g7484e3b
#1 lore raw

Hi Sakari,

Thank you for the patch.

Quoted 20 lines · On Monday 15 December 2014 17:27:44 Sakari Ailus wrote:

The plane size was left zero for mplane buffers when queueing a buffer. Fix this.

---
 yavta.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
yavta.c +0 -0
index 7f9e814..77e5a41 100644
@@ -979,8 +979,12 @@ static int video_queue_buffer(struct device *dev, int

index, enum buffer_fill_mo

yavta.c +0 -2
 	if (dev->memtype == V4L2_MEMORY_USERPTR) {
 		if (video_is_mplane(dev)) {
-			for (i = 0; i < dev->num_planes; i++)
-				buf.m.planes[i].m.userptr = (unsigned long)dev->

buffers[index].mem[i];

yavta.c static int video_queue_buffer(struct device *dev, int index, enum buffer_fill_mo · line 986

Quoted 5 lines
yavta.c +5 -0
+			for (i = 0; i < dev->num_planes; i++) {
+				buf.m.planes[i].m.userptr = (unsigned long)
+					dev->buffers[index].mem[i];
+				buf.m.planes[i].length =
+					dev->buffers[index].size[i];

According to the V4L2 API, this field is set by the driver. That's not in line with the videobuf2 implementation, which requires the length field to be set for USERPTR and DMABUF. Would you like to submit a documentation patch ?

yavta.c static int video_queue_buffer(struct device *dev, int index, enum buffer_fill_mo · line 989

Quoted 3 lines
yavta.c +1 -0
+			}
 		} else {
 			buf.m.userptr = (unsigned long)dev->buffers[index].mem[0];

For consistency, what would you think about moving the buf.length assignment from the else statement right before this hunk to here ? If you're fine with that there's no need to resubmit, I'll apply the modification locally.

Quoted 1 line

}

Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw

Hi Laurent,

Quoted 20 lines · Laurent Pinchart

Hi Sakari,

Thank you for the patch.

Quoted 15 lines · On Monday 15 December 2014 17:27:44 Sakari Ailus wrote:

The plane size was left zero for mplane buffers when queueing a buffer. Fix this.

---
 yavta.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
yavta.c +0 -0
index 7f9e814..77e5a41 100644
@@ -979,8 +979,12 @@ static int video_queue_buffer(struct device *dev, int

index, enum buffer_fill_mo

Quoted 14 lines

yavta.c static int video_queue_buffer(struct device *dev, int index, enum buffer_fill_mo · line 986

Quoted 10 lines
yavta.c +0 -2
 	if (dev->memtype == V4L2_MEMORY_USERPTR) {
 		if (video_is_mplane(dev)) {
-			for (i = 0; i < dev->num_planes; i++)
-				buf.m.planes[i].m.userptr = (unsigned long)dev->

buffers[index].mem[i];

yavta.c +5 -0
+			for (i = 0; i < dev->num_planes; i++) {
+				buf.m.planes[i].m.userptr = (unsigned long)
+					dev->buffers[index].mem[i];
+				buf.m.planes[i].length =
+					dev->buffers[index].size[i];

According to the V4L2 API, this field is set by the driver. That's not in line with the videobuf2 implementation, which requires the length field to be set for USERPTR and DMABUF. Would you like to submit a documentation patch ?

Certainly. I actually missed that this is what the documentation states.

Quoted 7 lines

yavta.c static int video_queue_buffer(struct device *dev, int index, enum buffer_fill_mo · line 989

Quoted 3 lines
yavta.c +1 -0
+			}
 		} else {
 			buf.m.userptr = (unsigned long)dev->buffers[index].mem[0];

For consistency, what would you think about moving the buf.length assignment from the else statement right before this hunk to here ? If you're fine with that there's no need to resubmit, I'll apply the modification locally.

Feel free to add that.

Signature · 4 lines
Cheers,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]