rcar-vin: Add mbus_code filtering for format enumeration
Subsystems (2)
RFC 1/1 rcar-vin: Add mbus_code filtering for format enumeration
Add support to filter which pixel formats are supported by a mbus_code provided from user-space.
--- drivers/media/platform/rcar-vin/rcar-v4l2.c | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+)
---
Hi Laurent,
I intend to squash this patch with the rcar-vin patch in the V4L2_CAP_IO_MC series. As I hope we can merged that series soon so I wanted to get early feedback if possible on my take on ENUM_FMT.
// Niklas
drivers/media/platform/rcar-vin/rcar-v4l2.c +23 -0
@@ -343,6 +343,29 @@ static int rvin_enum_fmt_vid_cap(struct file *file, void *priv,unsigned int i;int matched; +/* +* If mbus_code is set only enumerate supported pixel formats for that +* bus code. Converting from YCbCr to RGB and RGB to YCbCr is possible +* with VIN, so all supported YCbCr and RBB media bus codes can produce +* all of the related pixel formats. If mbus_code is not set enumerate +* all possible pixelformats. +* +* TODO: Once raw capture formats are added to the driver this needs +* to be extended so raw media bus codes only result in a raw pixel +* formats. +*/ +switch (f->mbus_code) { +case 0 : +case MEDIA_BUS_FMT_YUYV8_1X16 : +case MEDIA_BUS_FMT_UYVY8_1X16 : +case MEDIA_BUS_FMT_UYVY8_2X8 : +case MEDIA_BUS_FMT_UYVY10_2X10 : +case MEDIA_BUS_FMT_RGB888_1X24 : +break ; +default : +return -EINVAL ; + } + matched =-1 ;for (i =0 ; i <ARRAY_SIZE (rvin_formats); i++) {if (rvin_format_from_pixel (vin, rvin_formats[i].fourcc))
Signature · 1 line
2.26.0
Hi Niklas,
Thank you for the patch.
Quoted 21 lines · Niklas Söderlund
Add support to filter which pixel formats are supported by a
mbus_codeprovided from user-space.Signed-off-by Niklas Söderlund <[email protected]>--- drivers/media/platform/rcar-vin/rcar-v4l2.c | 23 +++++++++++++++++++++ 1 file changed, 23 insertions(+)---
Hi Laurent,I intend to squash this patch with the rcar-vin patch in the
V4L2_CAP_IO_MCseries. As I hope we can merged that series soon so I wanted to get early feedback if possible on my take onENUM_FMT.// Niklas
drivers/media/platform/rcar-vin/rcar-v4l2.c +0
-0
drivers/media/platform/rcar-vin/rcar-v4l2.c static int rvin_enum_fmt_vid_cap(struct file *file, void *priv, · line 349
Quoted 7 lines
drivers/media/platform/rcar-vin/rcar-v4l2.c +4
-0@@ -343,6 +343,29 @@ static int rvin_enum_fmt_vid_cap(struct file *file, void *priv,unsigned int i;int matched; +/* +* If mbus_code is set only enumerate supported pixel formats for that +* bus code. Converting from YCbCr to RGB and RGB to YCbCr is possible +* with VIN, so all supported YCbCr and RBB media bus codes can produce
s/RBB/RGB/
drivers/media/platform/rcar-vin/rcar-v4l2.c static int rvin_enum_fmt_vid_cap(struct file *file, void *priv, · line 354
Quoted 5 lines
drivers/media/platform/rcar-vin/rcar-v4l2.c +5
-0+* all of the related pixel formats. If mbus_code is not set enumerate +* all possible pixelformats. +* +* TODO: Once raw capture formats are added to the driver this needs +* to be extended so raw media bus codes only result in a raw pixel
s/a raw/raw/
drivers/media/platform/rcar-vin/rcar-v4l2.c static int rvin_enum_fmt_vid_cap(struct file *file, void *priv, · line 363
Quoted 9 lines
drivers/media/platform/rcar-vin/rcar-v4l2.c +9
-0+* formats. +*/ +switch (f->mbus_code) { +case 0 : +case MEDIA_BUS_FMT_YUYV8_1X16 : +case MEDIA_BUS_FMT_UYVY8_1X16 : +case MEDIA_BUS_FMT_UYVY8_2X8 : +case MEDIA_BUS_FMT_UYVY10_2X10 : +case MEDIA_BUS_FMT_RGB888_1X24 :
There are a few locations where you enumerate the supported media bus formats (rvin_parallel_subdevice_attach(), rvin_mc_validate_format() and rcar_csi2_formats[]), it could be nice to centralize this, at least for the first two. Maybe a rvin_mbus_code_supported() function ? This isn't mandatory and could be addressed later, and may actually get in the way when we'll support additional media bus codes.
Quoted 8 lines
drivers/media/platform/rcar-vin/rcar-v4l2.c +5
-0+break ; +default : +return -EINVAL ; + } + matched =-1 ;for (i =0 ; i <ARRAY_SIZE (rvin_formats); i++) {if (rvin_format_from_pixel (vin, rvin_formats[i].fourcc))
Signature · 3 lines
Regards, Laurent Pinchart