Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH 1/1] yavta: Set plane size for mplane buffers in qbuf
@ 2014-12-15 15:27 Sakari Ailus
  2014-12-15 16:31 ` Laurent Pinchart
  0 siblings, 1 reply; 3+ messages in thread
From: Sakari Ailus @ 2014-12-15 15:27 UTC (permalink / raw)
  To: linux-media; +Cc: laurent.pinchart

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

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 yavta.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/yavta.c b/yavta.c
index 7f9e814..77e5a41 100644
--- a/yavta.c
+++ b/yavta.c
@@ -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];
 		}
-- 
2.1.0.231.g7484e3b


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] yavta: Set plane size for mplane buffers in qbuf
  2014-12-15 15:27 [PATCH 1/1] yavta: Set plane size for mplane buffers in qbuf Sakari Ailus
@ 2014-12-15 16:31 ` Laurent Pinchart
  2014-12-15 20:02   ` Sakari Ailus
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2014-12-15 16:31 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media

Hi Sakari,

Thank you for the patch.

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.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> ---
>  yavta.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/yavta.c b/yavta.c
> index 7f9e814..77e5a41 100644
> --- a/yavta.c
> +++ b/yavta.c
> @@ -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];

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 ?

> +			}
>  		} 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.

>  		}

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] yavta: Set plane size for mplane buffers in qbuf
  2014-12-15 16:31 ` Laurent Pinchart
@ 2014-12-15 20:02   ` Sakari Ailus
  0 siblings, 0 replies; 3+ messages in thread
From: Sakari Ailus @ 2014-12-15 20:02 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Sakari Ailus, linux-media

Hi Laurent,

On Mon, Dec 15, 2014 at 06:31:01PM +0200, Laurent Pinchart wrote:
> Hi Sakari,
> 
> Thank you for the patch.
> 
> 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.
> > 
> > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > ---
> >  yavta.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/yavta.c b/yavta.c
> > index 7f9e814..77e5a41 100644
> > --- a/yavta.c
> > +++ b/yavta.c
> > @@ -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];
> 
> 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.

> > +			}
> >  		} 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.

-- 
Cheers,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-15 20:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-15 15:27 [PATCH 1/1] yavta: Set plane size for mplane buffers in qbuf Sakari Ailus
2014-12-15 16:31 ` Laurent Pinchart
2014-12-15 20:02   ` Sakari Ailus

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox