[libcamera-devel,v2,2/8] test: v4l2_videodevice: buffer_cache: Use DRM pixel format

Message ID 20200317035239.2697679-3-niklas.soderlund@ragnatech.se
State Superseded
Headers show
Series
  • libcamera: PixelFormat: Turn into a class
Related show

Commit Message

Niklas Söderlund March 17, 2020, 3:52 a.m. UTC
The pixel format used in the stream configuration is from V4L2 but
should be from DRM, fix it.

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
---
 test/v4l2_videodevice/buffer_cache.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Laurent Pinchart March 17, 2020, 9:08 a.m. UTC | #1
Hi Niklas,

Thank you for the patch.

On Tue, Mar 17, 2020 at 04:52:33AM +0100, Niklas Söderlund wrote:
> The pixel format used in the stream configuration is from V4L2 but
> should be from DRM, fix it.
> 
> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> ---
>  test/v4l2_videodevice/buffer_cache.cpp | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/test/v4l2_videodevice/buffer_cache.cpp b/test/v4l2_videodevice/buffer_cache.cpp
> index 0a8cb0d28ca9b204..c951bc9650dc4e0e 100644
> --- a/test/v4l2_videodevice/buffer_cache.cpp
> +++ b/test/v4l2_videodevice/buffer_cache.cpp
> @@ -11,6 +11,8 @@
>  
>  #include <libcamera/stream.h>
>  
> +#include <linux/drm_fourcc.h>
> +

To avoid including this header manually everywhere a PixelFormat is
used, should we include it in pixelformats.h ?

Apart from that,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  #include "buffer_source.h"
>  
>  #include "test.h"
> @@ -142,7 +144,7 @@ public:
>  		const unsigned int numBuffers = 8;
>  
>  		StreamConfiguration cfg;
> -		cfg.pixelFormat = V4L2_PIX_FMT_YUYV;
> +		cfg.pixelFormat = DRM_FORMAT_YUYV;
>  		cfg.size = Size(600, 800);
>  		cfg.bufferCount = numBuffers;
>
Niklas Söderlund March 17, 2020, 10:16 a.m. UTC | #2
Hi Laurent,

Thanks for your feedback.

On 2020-03-17 11:08:10 +0200, Laurent Pinchart wrote:
> Hi Niklas,
> 
> Thank you for the patch.
> 
> On Tue, Mar 17, 2020 at 04:52:33AM +0100, Niklas Söderlund wrote:
> > The pixel format used in the stream configuration is from V4L2 but
> > should be from DRM, fix it.
> > 
> > Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
> > ---
> >  test/v4l2_videodevice/buffer_cache.cpp | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/test/v4l2_videodevice/buffer_cache.cpp b/test/v4l2_videodevice/buffer_cache.cpp
> > index 0a8cb0d28ca9b204..c951bc9650dc4e0e 100644
> > --- a/test/v4l2_videodevice/buffer_cache.cpp
> > +++ b/test/v4l2_videodevice/buffer_cache.cpp
> > @@ -11,6 +11,8 @@
> >  
> >  #include <libcamera/stream.h>
> >  
> > +#include <linux/drm_fourcc.h>
> > +
> 
> To avoid including this header manually everywhere a PixelFormat is
> used, should we include it in pixelformats.h ?

I like it, I will add a patch for this.

> 
> Apart from that,
> 
> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> >  #include "buffer_source.h"
> >  
> >  #include "test.h"
> > @@ -142,7 +144,7 @@ public:
> >  		const unsigned int numBuffers = 8;
> >  
> >  		StreamConfiguration cfg;
> > -		cfg.pixelFormat = V4L2_PIX_FMT_YUYV;
> > +		cfg.pixelFormat = DRM_FORMAT_YUYV;
> >  		cfg.size = Size(600, 800);
> >  		cfg.bufferCount = numBuffers;
> >  
> 
> -- 
> Regards,
> 
> Laurent Pinchart

Patch

diff --git a/test/v4l2_videodevice/buffer_cache.cpp b/test/v4l2_videodevice/buffer_cache.cpp
index 0a8cb0d28ca9b204..c951bc9650dc4e0e 100644
--- a/test/v4l2_videodevice/buffer_cache.cpp
+++ b/test/v4l2_videodevice/buffer_cache.cpp
@@ -11,6 +11,8 @@ 
 
 #include <libcamera/stream.h>
 
+#include <linux/drm_fourcc.h>
+
 #include "buffer_source.h"
 
 #include "test.h"
@@ -142,7 +144,7 @@  public:
 		const unsigned int numBuffers = 8;
 
 		StreamConfiguration cfg;
-		cfg.pixelFormat = V4L2_PIX_FMT_YUYV;
+		cfg.pixelFormat = DRM_FORMAT_YUYV;
 		cfg.size = Size(600, 800);
 		cfg.bufferCount = numBuffers;