* [PATCHv2 0/2] Add helper functions to print a fourcc @ 2019-09-16 10:04 Hans Verkuil 2019-09-16 10:04 ` [PATCHv2 1/2] v4l: Add macros for printing V4L fourcc values Hans Verkuil ` (2 more replies) 0 siblings, 3 replies; 15+ messages in thread From: Hans Verkuil @ 2019-09-16 10:04 UTC (permalink / raw) To: linux-media; +Cc: Dave Stevenson, Sakari Ailus It turns out that Sakari posted a newer patch in 2018. I used that for this v2: https://patchwork.linuxtv.org/patch/48372/ Mauro commented on that original patch that there was no need to have this available for userspace. I disagree: why wouldn't userspace want to report pixelformats? It happens in several places in v4l-utils, and there the pixelformats are printed in different ways as well. Providing a standard way of reporting a V4L2 fourcc is very useful. Regards, Hans Hans Verkuil (1): v4l2-ioctl.c: use new v4l2_fourcc_conv/args macros Sakari Ailus (1): v4l: Add macros for printing V4L fourcc values .../media/videodev2.h.rst.exceptions | 2 + drivers/media/v4l2-core/v4l2-ioctl.c | 58 ++++++------------- include/uapi/linux/videodev2.h | 27 +++++++++ 3 files changed, 47 insertions(+), 40 deletions(-) -- 2.20.1 ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCHv2 1/2] v4l: Add macros for printing V4L fourcc values 2019-09-16 10:04 [PATCHv2 0/2] Add helper functions to print a fourcc Hans Verkuil @ 2019-09-16 10:04 ` Hans Verkuil 2019-09-16 12:07 ` Sakari Ailus 2019-10-02 12:40 ` Ezequiel Garcia 2019-09-16 10:04 ` [PATCHv2 2/2] v4l2-ioctl.c: use new v4l2_fourcc_conv/args macros Hans Verkuil 2019-09-16 11:52 ` [PATCHv2 0/2] Add helper functions to print a fourcc Sakari Ailus 2 siblings, 2 replies; 15+ messages in thread From: Hans Verkuil @ 2019-09-16 10:04 UTC (permalink / raw) To: linux-media; +Cc: Dave Stevenson, Sakari Ailus, Sakari Ailus From: Sakari Ailus <sakari.ailus@linux.intel.com> Add two macros that facilitate printing V4L fourcc values with printf family of functions. v4l2_fourcc_conv provides the printf conversion specifier for printing formats and v4l2_fourcc_args provides the actual arguments for that conversion specifier. These macros are useful in both user and kernel code whenever you want to report a pixelformat, therefore put them into videodev2.h. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> [hverkuil-cisco@xs4all.nl: rename v4l2_fourcc_to_conv to v4l2_fourcc_args] [hverkuil-cisco@xs4all.nl: add () around ? : expression] [hverkuil-cisco@xs4all.nl: add comment about fourcc reuse] [hverkuil-cisco@xs4all.nl: update Documentation/media/videodev2.h.rst.exceptions] --- .../media/videodev2.h.rst.exceptions | 2 ++ include/uapi/linux/videodev2.h | 27 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/Documentation/media/videodev2.h.rst.exceptions b/Documentation/media/videodev2.h.rst.exceptions index adeb6b7a15cb..35eb513d82a6 100644 --- a/Documentation/media/videodev2.h.rst.exceptions +++ b/Documentation/media/videodev2.h.rst.exceptions @@ -508,6 +508,8 @@ ignore define VIDEO_MAX_FRAME ignore define VIDEO_MAX_PLANES ignore define v4l2_fourcc ignore define v4l2_fourcc_be +ignore define v4l2_fourcc_conv +ignore define v4l2_fourcc_args ignore define V4L2_FIELD_HAS_TOP ignore define V4L2_FIELD_HAS_BOTTOM ignore define V4L2_FIELD_HAS_BOTH diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 530638dffd93..aa8acbdc88c9 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -82,6 +82,33 @@ ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24)) #define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1U << 31)) +/** + * v4l2_fourcc_conv - Printf fourcc conversion specifiers for V4L2 formats + * + * Use as part of the format string. The values are obtained using + * @v4l2_fourcc_args macro. + * + * Example ("format" is the V4L2 pixelformat in __u32): + * + * printf("V4L2 format is: " v4l2_fourcc_conv "\n", v4l2_fourcc_args(format); + */ +#define v4l2_fourcc_conv "%c%c%c%c%s" + +/** + * v4l2_fourcc_args - Arguments for V4L2 fourcc format conversion + * + * @fourcc: V4L2 pixelformat, as in __u32 + * + * Yields to a comma-separated list of arguments for printf that matches with + * conversion specifiers provided by @v4l2_fourcc_conv. + * + * Note that v4l2_fourcc_args reuses fourcc, so this can't be an expression + * with side-effects. + */ +#define v4l2_fourcc_args(fourcc) \ + (fourcc) & 0x7f, ((fourcc) >> 8) & 0x7f, ((fourcc) >> 16) & 0x7f, \ + ((fourcc) >> 24) & 0x7f, ((fourcc) & (1 << 31) ? "-BE" : "") + /* * E N U M S */ -- 2.20.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCHv2 1/2] v4l: Add macros for printing V4L fourcc values 2019-09-16 10:04 ` [PATCHv2 1/2] v4l: Add macros for printing V4L fourcc values Hans Verkuil @ 2019-09-16 12:07 ` Sakari Ailus 2019-09-16 12:15 ` Hans Verkuil 2019-10-02 12:40 ` Ezequiel Garcia 1 sibling, 1 reply; 15+ messages in thread From: Sakari Ailus @ 2019-09-16 12:07 UTC (permalink / raw) To: Hans Verkuil; +Cc: linux-media, Dave Stevenson, Sakari Ailus On Mon, Sep 16, 2019 at 12:04:32PM +0200, Hans Verkuil wrote: > From: Sakari Ailus <sakari.ailus@linux.intel.com> > > Add two macros that facilitate printing V4L fourcc values with printf > family of functions. v4l2_fourcc_conv provides the printf conversion > specifier for printing formats and v4l2_fourcc_args provides the actual > arguments for that conversion specifier. > > These macros are useful in both user and kernel code whenever you want > to report a pixelformat, therefore put them into videodev2.h. > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> > [hverkuil-cisco@xs4all.nl: rename v4l2_fourcc_to_conv to v4l2_fourcc_args] > [hverkuil-cisco@xs4all.nl: add () around ? : expression] > [hverkuil-cisco@xs4all.nl: add comment about fourcc reuse] > [hverkuil-cisco@xs4all.nl: update Documentation/media/videodev2.h.rst.exceptions] Were you going to add your SoB when merging the patch to your tree? Or is it just missing here? Feel free to add: Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> -- Sakari Ailus ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 1/2] v4l: Add macros for printing V4L fourcc values 2019-09-16 12:07 ` Sakari Ailus @ 2019-09-16 12:15 ` Hans Verkuil 0 siblings, 0 replies; 15+ messages in thread From: Hans Verkuil @ 2019-09-16 12:15 UTC (permalink / raw) To: Sakari Ailus; +Cc: linux-media, Dave Stevenson, Sakari Ailus On 9/16/19 2:07 PM, Sakari Ailus wrote: > On Mon, Sep 16, 2019 at 12:04:32PM +0200, Hans Verkuil wrote: >> From: Sakari Ailus <sakari.ailus@linux.intel.com> >> >> Add two macros that facilitate printing V4L fourcc values with printf >> family of functions. v4l2_fourcc_conv provides the printf conversion >> specifier for printing formats and v4l2_fourcc_args provides the actual >> arguments for that conversion specifier. >> >> These macros are useful in both user and kernel code whenever you want >> to report a pixelformat, therefore put them into videodev2.h. >> >> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> >> [hverkuil-cisco@xs4all.nl: rename v4l2_fourcc_to_conv to v4l2_fourcc_args] >> [hverkuil-cisco@xs4all.nl: add () around ? : expression] >> [hverkuil-cisco@xs4all.nl: add comment about fourcc reuse] >> [hverkuil-cisco@xs4all.nl: update Documentation/media/videodev2.h.rst.exceptions] > > Were you going to add your SoB when merging the patch to your tree? Or is > it just missing here? My SoB will be added when I merge it. It's 90% your work, so I don't feel I have any authorship rights for this patch. > > Feel free to add: > > Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> > Regards, Hans ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 1/2] v4l: Add macros for printing V4L fourcc values 2019-09-16 10:04 ` [PATCHv2 1/2] v4l: Add macros for printing V4L fourcc values Hans Verkuil 2019-09-16 12:07 ` Sakari Ailus @ 2019-10-02 12:40 ` Ezequiel Garcia 1 sibling, 0 replies; 15+ messages in thread From: Ezequiel Garcia @ 2019-10-02 12:40 UTC (permalink / raw) To: Hans Verkuil, linux-media; +Cc: Dave Stevenson, Sakari Ailus, Sakari Ailus On Mon, 2019-09-16 at 12:04 +0200, Hans Verkuil wrote: > From: Sakari Ailus <sakari.ailus@linux.intel.com> > > Add two macros that facilitate printing V4L fourcc values with printf > family of functions. v4l2_fourcc_conv provides the printf conversion > specifier for printing formats and v4l2_fourcc_args provides the actual > arguments for that conversion specifier. > > These macros are useful in both user and kernel code whenever you want > to report a pixelformat, therefore put them into videodev2.h. > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> > [hverkuil-cisco@xs4all.nl: rename v4l2_fourcc_to_conv to v4l2_fourcc_args] > [hverkuil-cisco@xs4all.nl: add () around ? : expression] > [hverkuil-cisco@xs4all.nl: add comment about fourcc reuse] > [hverkuil-cisco@xs4all.nl: update Documentation/media/videodev2.h.rst.exceptions] > --- > .../media/videodev2.h.rst.exceptions | 2 ++ > include/uapi/linux/videodev2.h | 27 +++++++++++++++++++ > 2 files changed, 29 insertions(+) > > diff --git a/Documentation/media/videodev2.h.rst.exceptions b/Documentation/media/videodev2.h.rst.exceptions > index adeb6b7a15cb..35eb513d82a6 100644 > --- a/Documentation/media/videodev2.h.rst.exceptions > +++ b/Documentation/media/videodev2.h.rst.exceptions > @@ -508,6 +508,8 @@ ignore define VIDEO_MAX_FRAME > ignore define VIDEO_MAX_PLANES > ignore define v4l2_fourcc > ignore define v4l2_fourcc_be > +ignore define v4l2_fourcc_conv > +ignore define v4l2_fourcc_args > ignore define V4L2_FIELD_HAS_TOP > ignore define V4L2_FIELD_HAS_BOTTOM > ignore define V4L2_FIELD_HAS_BOTH > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > index 530638dffd93..aa8acbdc88c9 100644 > --- a/include/uapi/linux/videodev2.h > +++ b/include/uapi/linux/videodev2.h > @@ -82,6 +82,33 @@ > ((__u32)(a) | ((__u32)(b) << 8) | ((__u32)(c) << 16) | ((__u32)(d) << 24)) > #define v4l2_fourcc_be(a, b, c, d) (v4l2_fourcc(a, b, c, d) | (1U << 31)) > > +/** > + * v4l2_fourcc_conv - Printf fourcc conversion specifiers for V4L2 formats > + * > + * Use as part of the format string. The values are obtained using > + * @v4l2_fourcc_args macro. > + * > + * Example ("format" is the V4L2 pixelformat in __u32): > + * > + * printf("V4L2 format is: " v4l2_fourcc_conv "\n", v4l2_fourcc_args(format); > + */ > +#define v4l2_fourcc_conv "%c%c%c%c%s" > + > +/** > + * v4l2_fourcc_args - Arguments for V4L2 fourcc format conversion > + * > + * @fourcc: V4L2 pixelformat, as in __u32 > + * > + * Yields to a comma-separated list of arguments for printf that matches with > + * conversion specifiers provided by @v4l2_fourcc_conv. > + * > + * Note that v4l2_fourcc_args reuses fourcc, so this can't be an expression > + * with side-effects. > + */ > +#define v4l2_fourcc_args(fourcc) \ > + (fourcc) & 0x7f, ((fourcc) >> 8) & 0x7f, ((fourcc) >> 16) & 0x7f, \ > + ((fourcc) >> 24) & 0x7f, ((fourcc) & (1 << 31) ? "-BE" : "") > + > /* > * E N U M S > */ Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com> Thanks, Ezequiel ^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCHv2 2/2] v4l2-ioctl.c: use new v4l2_fourcc_conv/args macros 2019-09-16 10:04 [PATCHv2 0/2] Add helper functions to print a fourcc Hans Verkuil 2019-09-16 10:04 ` [PATCHv2 1/2] v4l: Add macros for printing V4L fourcc values Hans Verkuil @ 2019-09-16 10:04 ` Hans Verkuil 2019-10-02 12:45 ` Ezequiel Garcia 2019-09-16 11:52 ` [PATCHv2 0/2] Add helper functions to print a fourcc Sakari Ailus 2 siblings, 1 reply; 15+ messages in thread From: Hans Verkuil @ 2019-09-16 10:04 UTC (permalink / raw) To: linux-media; +Cc: Dave Stevenson, Sakari Ailus, Hans Verkuil, Sakari Ailus Use these new standard macros to log the fourcc value in a human readable format. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> --- drivers/media/v4l2-core/v4l2-ioctl.c | 58 +++++++++------------------- 1 file changed, 18 insertions(+), 40 deletions(-) diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c index 51b912743f0f..8a302691447e 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -264,12 +264,9 @@ static void v4l_print_fmtdesc(const void *arg, bool write_only) { const struct v4l2_fmtdesc *p = arg; - pr_cont("index=%u, type=%s, flags=0x%x, pixelformat=%c%c%c%c, description='%.*s'\n", + pr_cont("index=%u, type=%s, flags=0x%x, pixelformat=" v4l2_fourcc_conv ", description='%.*s'\n", p->index, prt_names(p->type, v4l2_type_names), - p->flags, (p->pixelformat & 0xff), - (p->pixelformat >> 8) & 0xff, - (p->pixelformat >> 16) & 0xff, - (p->pixelformat >> 24) & 0xff, + p->flags, v4l2_fourcc_args(p->pixelformat), (int)sizeof(p->description), p->description); } @@ -291,12 +288,9 @@ static void v4l_print_format(const void *arg, bool write_only) case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_OUTPUT: pix = &p->fmt.pix; - pr_cont(", width=%u, height=%u, pixelformat=%c%c%c%c, field=%s, bytesperline=%u, sizeimage=%u, colorspace=%d, flags=0x%x, ycbcr_enc=%u, quantization=%u, xfer_func=%u\n", + pr_cont(", width=%u, height=%u, pixelformat=" v4l2_fourcc_conv ", field=%s, bytesperline=%u, sizeimage=%u, colorspace=%d, flags=0x%x, ycbcr_enc=%u, quantization=%u, xfer_func=%u\n", pix->width, pix->height, - (pix->pixelformat & 0xff), - (pix->pixelformat >> 8) & 0xff, - (pix->pixelformat >> 16) & 0xff, - (pix->pixelformat >> 24) & 0xff, + v4l2_fourcc_args(pix->pixelformat), prt_names(pix->field, v4l2_field_names), pix->bytesperline, pix->sizeimage, pix->colorspace, pix->flags, pix->ycbcr_enc, @@ -305,12 +299,9 @@ static void v4l_print_format(const void *arg, bool write_only) case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: mp = &p->fmt.pix_mp; - pr_cont(", width=%u, height=%u, format=%c%c%c%c, field=%s, colorspace=%d, num_planes=%u, flags=0x%x, ycbcr_enc=%u, quantization=%u, xfer_func=%u\n", + pr_cont(", width=%u, height=%u, format=" v4l2_fourcc_conv ", field=%s, colorspace=%d, num_planes=%u, flags=0x%x, ycbcr_enc=%u, quantization=%u, xfer_func=%u\n", mp->width, mp->height, - (mp->pixelformat & 0xff), - (mp->pixelformat >> 8) & 0xff, - (mp->pixelformat >> 16) & 0xff, - (mp->pixelformat >> 24) & 0xff, + v4l2_fourcc_args(mp->pixelformat), prt_names(mp->field, v4l2_field_names), mp->colorspace, mp->num_planes, mp->flags, mp->ycbcr_enc, mp->quantization, mp->xfer_func); @@ -358,20 +349,14 @@ static void v4l_print_format(const void *arg, bool write_only) case V4L2_BUF_TYPE_SDR_CAPTURE: case V4L2_BUF_TYPE_SDR_OUTPUT: sdr = &p->fmt.sdr; - pr_cont(", pixelformat=%c%c%c%c\n", - (sdr->pixelformat >> 0) & 0xff, - (sdr->pixelformat >> 8) & 0xff, - (sdr->pixelformat >> 16) & 0xff, - (sdr->pixelformat >> 24) & 0xff); + pr_cont(", pixelformat=" v4l2_fourcc_conv "\n", + v4l2_fourcc_args(sdr->pixelformat)); break; case V4L2_BUF_TYPE_META_CAPTURE: case V4L2_BUF_TYPE_META_OUTPUT: meta = &p->fmt.meta; - pr_cont(", dataformat=%c%c%c%c, buffersize=%u\n", - (meta->dataformat >> 0) & 0xff, - (meta->dataformat >> 8) & 0xff, - (meta->dataformat >> 16) & 0xff, - (meta->dataformat >> 24) & 0xff, + pr_cont(", dataformat=" v4l2_fourcc_conv ", buffersize=%u\n", + v4l2_fourcc_args(meta->dataformat), meta->buffersize); break; } @@ -381,15 +366,12 @@ static void v4l_print_framebuffer(const void *arg, bool write_only) { const struct v4l2_framebuffer *p = arg; - pr_cont("capability=0x%x, flags=0x%x, base=0x%p, width=%u, height=%u, pixelformat=%c%c%c%c, bytesperline=%u, sizeimage=%u, colorspace=%d\n", - p->capability, p->flags, p->base, - p->fmt.width, p->fmt.height, - (p->fmt.pixelformat & 0xff), - (p->fmt.pixelformat >> 8) & 0xff, - (p->fmt.pixelformat >> 16) & 0xff, - (p->fmt.pixelformat >> 24) & 0xff, - p->fmt.bytesperline, p->fmt.sizeimage, - p->fmt.colorspace); + pr_cont("capability=0x%x, flags=0x%x, base=0x%p, width=%u, height=%u, pixelformat=" v4l2_fourcc_conv ", bytesperline=%u, sizeimage=%u, colorspace=%d\n", + p->capability, p->flags, p->base, + p->fmt.width, p->fmt.height, + v4l2_fourcc_args(p->fmt.pixelformat), + p->fmt.bytesperline, p->fmt.sizeimage, + p->fmt.colorspace); } static void v4l_print_buftype(const void *arg, bool write_only) @@ -1383,12 +1365,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) return; WARN(1, "Unknown pixelformat 0x%08x\n", fmt->pixelformat); flags = 0; - snprintf(fmt->description, sz, "%c%c%c%c%s", - (char)(fmt->pixelformat & 0x7f), - (char)((fmt->pixelformat >> 8) & 0x7f), - (char)((fmt->pixelformat >> 16) & 0x7f), - (char)((fmt->pixelformat >> 24) & 0x7f), - (fmt->pixelformat & (1UL << 31)) ? "-BE" : ""); + snprintf(fmt->description, sz, v4l2_fourcc_conv, + v4l2_fourcc_args(fmt->pixelformat)); break; } } -- 2.20.1 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCHv2 2/2] v4l2-ioctl.c: use new v4l2_fourcc_conv/args macros 2019-09-16 10:04 ` [PATCHv2 2/2] v4l2-ioctl.c: use new v4l2_fourcc_conv/args macros Hans Verkuil @ 2019-10-02 12:45 ` Ezequiel Garcia 0 siblings, 0 replies; 15+ messages in thread From: Ezequiel Garcia @ 2019-10-02 12:45 UTC (permalink / raw) To: Hans Verkuil, linux-media; +Cc: Dave Stevenson, Sakari Ailus, Sakari Ailus On Mon, 2019-09-16 at 12:04 +0200, Hans Verkuil wrote: > Use these new standard macros to log the fourcc value in a > human readable format. > > Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> > Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com> > --- > drivers/media/v4l2-core/v4l2-ioctl.c | 58 +++++++++------------------- > 1 file changed, 18 insertions(+), 40 deletions(-) > > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > index 51b912743f0f..8a302691447e 100644 > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > @@ -264,12 +264,9 @@ static void v4l_print_fmtdesc(const void *arg, bool write_only) > { > const struct v4l2_fmtdesc *p = arg; > > - pr_cont("index=%u, type=%s, flags=0x%x, pixelformat=%c%c%c%c, description='%.*s'\n", > + pr_cont("index=%u, type=%s, flags=0x%x, pixelformat=" v4l2_fourcc_conv ", description='%.*s'\n", > p->index, prt_names(p->type, v4l2_type_names), > - p->flags, (p->pixelformat & 0xff), > - (p->pixelformat >> 8) & 0xff, > - (p->pixelformat >> 16) & 0xff, > - (p->pixelformat >> 24) & 0xff, > + p->flags, v4l2_fourcc_args(p->pixelformat), > (int)sizeof(p->description), p->description); > } > > @@ -291,12 +288,9 @@ static void v4l_print_format(const void *arg, bool write_only) > case V4L2_BUF_TYPE_VIDEO_CAPTURE: > case V4L2_BUF_TYPE_VIDEO_OUTPUT: > pix = &p->fmt.pix; > - pr_cont(", width=%u, height=%u, pixelformat=%c%c%c%c, field=%s, bytesperline=%u, sizeimage=%u, colorspace=%d, flags=0x%x, > ycbcr_enc=%u, quantization=%u, xfer_func=%u\n", > + pr_cont(", width=%u, height=%u, pixelformat=" v4l2_fourcc_conv ", field=%s, bytesperline=%u, sizeimage=%u, colorspace=%d, flags=0x%x, > ycbcr_enc=%u, quantization=%u, xfer_func=%u\n", > pix->width, pix->height, > - (pix->pixelformat & 0xff), > - (pix->pixelformat >> 8) & 0xff, > - (pix->pixelformat >> 16) & 0xff, > - (pix->pixelformat >> 24) & 0xff, > + v4l2_fourcc_args(pix->pixelformat), > prt_names(pix->field, v4l2_field_names), > pix->bytesperline, pix->sizeimage, > pix->colorspace, pix->flags, pix->ycbcr_enc, > @@ -305,12 +299,9 @@ static void v4l_print_format(const void *arg, bool write_only) > case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE: > case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: > mp = &p->fmt.pix_mp; > - pr_cont(", width=%u, height=%u, format=%c%c%c%c, field=%s, colorspace=%d, num_planes=%u, flags=0x%x, ycbcr_enc=%u, quantization=%u, > xfer_func=%u\n", > + pr_cont(", width=%u, height=%u, format=" v4l2_fourcc_conv ", field=%s, colorspace=%d, num_planes=%u, flags=0x%x, ycbcr_enc=%u, > quantization=%u, xfer_func=%u\n", > mp->width, mp->height, > - (mp->pixelformat & 0xff), > - (mp->pixelformat >> 8) & 0xff, > - (mp->pixelformat >> 16) & 0xff, > - (mp->pixelformat >> 24) & 0xff, > + v4l2_fourcc_args(mp->pixelformat), > prt_names(mp->field, v4l2_field_names), > mp->colorspace, mp->num_planes, mp->flags, > mp->ycbcr_enc, mp->quantization, mp->xfer_func); > @@ -358,20 +349,14 @@ static void v4l_print_format(const void *arg, bool write_only) > case V4L2_BUF_TYPE_SDR_CAPTURE: > case V4L2_BUF_TYPE_SDR_OUTPUT: > sdr = &p->fmt.sdr; > - pr_cont(", pixelformat=%c%c%c%c\n", > - (sdr->pixelformat >> 0) & 0xff, > - (sdr->pixelformat >> 8) & 0xff, > - (sdr->pixelformat >> 16) & 0xff, > - (sdr->pixelformat >> 24) & 0xff); > + pr_cont(", pixelformat=" v4l2_fourcc_conv "\n", > + v4l2_fourcc_args(sdr->pixelformat)); > break; > case V4L2_BUF_TYPE_META_CAPTURE: > case V4L2_BUF_TYPE_META_OUTPUT: > meta = &p->fmt.meta; > - pr_cont(", dataformat=%c%c%c%c, buffersize=%u\n", > - (meta->dataformat >> 0) & 0xff, > - (meta->dataformat >> 8) & 0xff, > - (meta->dataformat >> 16) & 0xff, > - (meta->dataformat >> 24) & 0xff, > + pr_cont(", dataformat=" v4l2_fourcc_conv ", buffersize=%u\n", > + v4l2_fourcc_args(meta->dataformat), > meta->buffersize); > break; > } > @@ -381,15 +366,12 @@ static void v4l_print_framebuffer(const void *arg, bool write_only) > { > const struct v4l2_framebuffer *p = arg; > > - pr_cont("capability=0x%x, flags=0x%x, base=0x%p, width=%u, height=%u, pixelformat=%c%c%c%c, bytesperline=%u, sizeimage=%u, colorspace=%d\n", > - p->capability, p->flags, p->base, > - p->fmt.width, p->fmt.height, > - (p->fmt.pixelformat & 0xff), > - (p->fmt.pixelformat >> 8) & 0xff, > - (p->fmt.pixelformat >> 16) & 0xff, > - (p->fmt.pixelformat >> 24) & 0xff, > - p->fmt.bytesperline, p->fmt.sizeimage, > - p->fmt.colorspace); > + pr_cont("capability=0x%x, flags=0x%x, base=0x%p, width=%u, height=%u, pixelformat=" v4l2_fourcc_conv ", bytesperline=%u, sizeimage=%u, > colorspace=%d\n", > + p->capability, p->flags, p->base, > + p->fmt.width, p->fmt.height, > + v4l2_fourcc_args(p->fmt.pixelformat), > + p->fmt.bytesperline, p->fmt.sizeimage, > + p->fmt.colorspace); > } > > static void v4l_print_buftype(const void *arg, bool write_only) > @@ -1383,12 +1365,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > return; > WARN(1, "Unknown pixelformat 0x%08x\n", fmt->pixelformat); > flags = 0; > - snprintf(fmt->description, sz, "%c%c%c%c%s", > - (char)(fmt->pixelformat & 0x7f), > - (char)((fmt->pixelformat >> 8) & 0x7f), > - (char)((fmt->pixelformat >> 16) & 0x7f), > - (char)((fmt->pixelformat >> 24) & 0x7f), > - (fmt->pixelformat & (1UL << 31)) ? "-BE" : ""); > + snprintf(fmt->description, sz, v4l2_fourcc_conv, > + v4l2_fourcc_args(fmt->pixelformat)); > break; > } > } Nice cleanup! I think these are the only media drivers that would have to be converted, in case anyone wants to tackle this. drivers/media/common/saa7146/saa7146_video.c: vv->ov_fmt->pixelformat, v4l2_field_names[vv->ov.win.field]); drivers/media/platform/atmel/atmel-isc-base.c: (char *)&pixfmt->pixelformat, (char *)&sd_fmt->fourcc); drivers/media/platform/sti/delta/delta-debug.c: (char *)&f->pixelformat, f->width, f->height, drivers/media/platform/vsp1/vsp1_drm.c: cfg->pixelformat, cfg->pitch, &cfg->mem[0], &cfg->mem[1], Reviewed-by: Ezequiel Garcia <ezequiel@collabora.com> Thanks, Ezequiel ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 0/2] Add helper functions to print a fourcc 2019-09-16 10:04 [PATCHv2 0/2] Add helper functions to print a fourcc Hans Verkuil 2019-09-16 10:04 ` [PATCHv2 1/2] v4l: Add macros for printing V4L fourcc values Hans Verkuil 2019-09-16 10:04 ` [PATCHv2 2/2] v4l2-ioctl.c: use new v4l2_fourcc_conv/args macros Hans Verkuil @ 2019-09-16 11:52 ` Sakari Ailus 2019-09-16 12:00 ` Hans Verkuil 2 siblings, 1 reply; 15+ messages in thread From: Sakari Ailus @ 2019-09-16 11:52 UTC (permalink / raw) To: Hans Verkuil; +Cc: linux-media, Dave Stevenson On Mon, Sep 16, 2019 at 12:04:31PM +0200, Hans Verkuil wrote: > It turns out that Sakari posted a newer patch in 2018. I used that > for this v2: https://patchwork.linuxtv.org/patch/48372/ > > Mauro commented on that original patch that there was no need to > have this available for userspace. > > I disagree: why wouldn't userspace want to report pixelformats? > > It happens in several places in v4l-utils, and there the pixelformats are > printed in different ways as well. Providing a standard way of reporting > a V4L2 fourcc is very useful. Thanks, Hans! Can you take these to your tree (perhaps pending some sort of agreement with Mauro)? -- Regards, Sakari Ailus ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 0/2] Add helper functions to print a fourcc 2019-09-16 11:52 ` [PATCHv2 0/2] Add helper functions to print a fourcc Sakari Ailus @ 2019-09-16 12:00 ` Hans Verkuil 2020-01-29 11:52 ` Dave Stevenson 0 siblings, 1 reply; 15+ messages in thread From: Hans Verkuil @ 2019-09-16 12:00 UTC (permalink / raw) To: Sakari Ailus; +Cc: linux-media, Dave Stevenson On 9/16/19 1:52 PM, Sakari Ailus wrote: > On Mon, Sep 16, 2019 at 12:04:31PM +0200, Hans Verkuil wrote: >> It turns out that Sakari posted a newer patch in 2018. I used that >> for this v2: https://patchwork.linuxtv.org/patch/48372/ >> >> Mauro commented on that original patch that there was no need to >> have this available for userspace. >> >> I disagree: why wouldn't userspace want to report pixelformats? >> >> It happens in several places in v4l-utils, and there the pixelformats are >> printed in different ways as well. Providing a standard way of reporting >> a V4L2 fourcc is very useful. > > Thanks, Hans! > > Can you take these to your tree (perhaps pending some sort of agreement > with Mauro)? > Certainly. Hans ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 0/2] Add helper functions to print a fourcc 2019-09-16 12:00 ` Hans Verkuil @ 2020-01-29 11:52 ` Dave Stevenson 2020-01-30 21:38 ` Kieran Bingham 2020-03-25 13:50 ` Dave Stevenson 0 siblings, 2 replies; 15+ messages in thread From: Dave Stevenson @ 2020-01-29 11:52 UTC (permalink / raw) To: Hans Verkuil; +Cc: Sakari Ailus, linux-media Hi Hans. On Mon, 16 Sep 2019 at 13:00, Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote: > > On 9/16/19 1:52 PM, Sakari Ailus wrote: > > On Mon, Sep 16, 2019 at 12:04:31PM +0200, Hans Verkuil wrote: > >> It turns out that Sakari posted a newer patch in 2018. I used that > >> for this v2: https://patchwork.linuxtv.org/patch/48372/ > >> > >> Mauro commented on that original patch that there was no need to > >> have this available for userspace. > >> > >> I disagree: why wouldn't userspace want to report pixelformats? > >> > >> It happens in several places in v4l-utils, and there the pixelformats are > >> printed in different ways as well. Providing a standard way of reporting > >> a V4L2 fourcc is very useful. > > > > Thanks, Hans! > > > > Can you take these to your tree (perhaps pending some sort of agreement > > with Mauro)? > > > > Certainly. > > Hans What happened to these? Patchwork is flagging them as rejected[1], but there's only been positive responses to them on the mailing list. Thanks. Dave [1] https://patchwork.linuxtv.org/patch/58781/ and https://patchwork.linuxtv.org/patch/58780/ ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 0/2] Add helper functions to print a fourcc 2020-01-29 11:52 ` Dave Stevenson @ 2020-01-30 21:38 ` Kieran Bingham 2020-03-25 13:50 ` Dave Stevenson 1 sibling, 0 replies; 15+ messages in thread From: Kieran Bingham @ 2020-01-30 21:38 UTC (permalink / raw) To: Dave Stevenson, Hans Verkuil; +Cc: Sakari Ailus, linux-media Hi Hans, On 29/01/2020 11:52, Dave Stevenson wrote: > Hi Hans. > > On Mon, 16 Sep 2019 at 13:00, Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote: >> >> On 9/16/19 1:52 PM, Sakari Ailus wrote: >>> On Mon, Sep 16, 2019 at 12:04:31PM +0200, Hans Verkuil wrote: >>>> It turns out that Sakari posted a newer patch in 2018. I used that >>>> for this v2: https://patchwork.linuxtv.org/patch/48372/ >>>> >>>> Mauro commented on that original patch that there was no need to >>>> have this available for userspace. >>>> >>>> I disagree: why wouldn't userspace want to report pixelformats? Indeed. I've just had to hand code this for libcamera. (Though, being C++, I don't think I could have used these macros anyway) >>>> It happens in several places in v4l-utils, and there the pixelformats are >>>> printed in different ways as well. Providing a standard way of reporting >>>> a V4L2 fourcc is very useful. >>> >>> Thanks, Hans! >>> >>> Can you take these to your tree (perhaps pending some sort of agreement >>> with Mauro)? >>> >> >> Certainly. >> >> Hans > > What happened to these? Patchwork is flagging them as rejected[1], but > there's only been positive responses to them on the mailing list. I'll add another +1 ... -- Kieran > > Thanks. > Dave > > [1] https://patchwork.linuxtv.org/patch/58781/ and > https://patchwork.linuxtv.org/patch/58780/ ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 0/2] Add helper functions to print a fourcc 2020-01-29 11:52 ` Dave Stevenson 2020-01-30 21:38 ` Kieran Bingham @ 2020-03-25 13:50 ` Dave Stevenson 2020-03-31 10:27 ` Sakari Ailus 1 sibling, 1 reply; 15+ messages in thread From: Dave Stevenson @ 2020-03-25 13:50 UTC (permalink / raw) To: Hans Verkuil; +Cc: Sakari Ailus, Linux Media Mailing List On Wed, 29 Jan 2020 at 11:52, Dave Stevenson <dave.stevenson@raspberrypi.com> wrote: > > Hi Hans. > > On Mon, 16 Sep 2019 at 13:00, Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote: > > > > On 9/16/19 1:52 PM, Sakari Ailus wrote: > > > On Mon, Sep 16, 2019 at 12:04:31PM +0200, Hans Verkuil wrote: > > >> It turns out that Sakari posted a newer patch in 2018. I used that > > >> for this v2: https://patchwork.linuxtv.org/patch/48372/ > > >> > > >> Mauro commented on that original patch that there was no need to > > >> have this available for userspace. > > >> > > >> I disagree: why wouldn't userspace want to report pixelformats? > > >> > > >> It happens in several places in v4l-utils, and there the pixelformats are > > >> printed in different ways as well. Providing a standard way of reporting > > >> a V4L2 fourcc is very useful. > > > > > > Thanks, Hans! > > > > > > Can you take these to your tree (perhaps pending some sort of agreement > > > with Mauro)? > > > > > > > Certainly. > > > > Hans > > What happened to these? Patchwork is flagging them as rejected[1], but > there's only been positive responses to them on the mailing list. Ping. Why were these patches rejected? Dave > Thanks. > Dave > > [1] https://patchwork.linuxtv.org/patch/58781/ and > https://patchwork.linuxtv.org/patch/58780/ ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 0/2] Add helper functions to print a fourcc 2020-03-25 13:50 ` Dave Stevenson @ 2020-03-31 10:27 ` Sakari Ailus 2020-03-31 14:05 ` Dave Stevenson 0 siblings, 1 reply; 15+ messages in thread From: Sakari Ailus @ 2020-03-31 10:27 UTC (permalink / raw) To: Dave Stevenson; +Cc: Hans Verkuil, Linux Media Mailing List Hi Dave, On Wed, Mar 25, 2020 at 01:50:44PM +0000, Dave Stevenson wrote: > On Wed, 29 Jan 2020 at 11:52, Dave Stevenson > <dave.stevenson@raspberrypi.com> wrote: > > > > Hi Hans. > > > > On Mon, 16 Sep 2019 at 13:00, Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote: > > > > > > On 9/16/19 1:52 PM, Sakari Ailus wrote: > > > > On Mon, Sep 16, 2019 at 12:04:31PM +0200, Hans Verkuil wrote: > > > >> It turns out that Sakari posted a newer patch in 2018. I used that > > > >> for this v2: https://patchwork.linuxtv.org/patch/48372/ > > > >> > > > >> Mauro commented on that original patch that there was no need to > > > >> have this available for userspace. > > > >> > > > >> I disagree: why wouldn't userspace want to report pixelformats? > > > >> > > > >> It happens in several places in v4l-utils, and there the pixelformats are > > > >> printed in different ways as well. Providing a standard way of reporting > > > >> a V4L2 fourcc is very useful. > > > > > > > > Thanks, Hans! > > > > > > > > Can you take these to your tree (perhaps pending some sort of agreement > > > > with Mauro)? > > > > > > > > > > Certainly. > > > > > > Hans > > > > What happened to these? Patchwork is flagging them as rejected[1], but > > there's only been positive responses to them on the mailing list. > > Ping. Why were these patches rejected? This was discussed on media-maint channel. The log is here: <URL:https://linuxtv.org/irc/irclogger_log/media-maint?date=2020-02-06,Thu&raw=on> -- Sakari Ailus ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 0/2] Add helper functions to print a fourcc 2020-03-31 10:27 ` Sakari Ailus @ 2020-03-31 14:05 ` Dave Stevenson 2020-03-31 14:29 ` Sakari Ailus 0 siblings, 1 reply; 15+ messages in thread From: Dave Stevenson @ 2020-03-31 14:05 UTC (permalink / raw) To: Sakari Ailus; +Cc: Hans Verkuil, Linux Media Mailing List Hi Sakari On Tue, 31 Mar 2020 at 11:28, Sakari Ailus <sakari.ailus@iki.fi> wrote: > > Hi Dave, > > On Wed, Mar 25, 2020 at 01:50:44PM +0000, Dave Stevenson wrote: > > On Wed, 29 Jan 2020 at 11:52, Dave Stevenson > > <dave.stevenson@raspberrypi.com> wrote: > > > > > > Hi Hans. > > > > > > On Mon, 16 Sep 2019 at 13:00, Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote: > > > > > > > > On 9/16/19 1:52 PM, Sakari Ailus wrote: > > > > > On Mon, Sep 16, 2019 at 12:04:31PM +0200, Hans Verkuil wrote: > > > > >> It turns out that Sakari posted a newer patch in 2018. I used that > > > > >> for this v2: https://patchwork.linuxtv.org/patch/48372/ > > > > >> > > > > >> Mauro commented on that original patch that there was no need to > > > > >> have this available for userspace. > > > > >> > > > > >> I disagree: why wouldn't userspace want to report pixelformats? > > > > >> > > > > >> It happens in several places in v4l-utils, and there the pixelformats are > > > > >> printed in different ways as well. Providing a standard way of reporting > > > > >> a V4L2 fourcc is very useful. > > > > > > > > > > Thanks, Hans! > > > > > > > > > > Can you take these to your tree (perhaps pending some sort of agreement > > > > > with Mauro)? > > > > > > > > > > > > > Certainly. > > > > > > > > Hans > > > > > > What happened to these? Patchwork is flagging them as rejected[1], but > > > there's only been positive responses to them on the mailing list. > > > > Ping. Why were these patches rejected? > > This was discussed on media-maint channel. The log is here: > > <URL:https://linuxtv.org/irc/irclogger_log/media-maint?date=2020-02-06,Thu&raw=on> Thanks, it's useful to know what's going on. The patchwork information was pretty opaque. The log includes [12:41] <sailus> If you insist, I can write a patch, and put your Suggested-by: tag there. :^) [12:41] <mchehab> yeah, please do so [12:42] <mchehab> the best is to also c/c drm ML Has that happened and I've missed it, or is it still on the pending queue? Dave ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 0/2] Add helper functions to print a fourcc 2020-03-31 14:05 ` Dave Stevenson @ 2020-03-31 14:29 ` Sakari Ailus 0 siblings, 0 replies; 15+ messages in thread From: Sakari Ailus @ 2020-03-31 14:29 UTC (permalink / raw) To: Dave Stevenson; +Cc: Hans Verkuil, Linux Media Mailing List On Tue, Mar 31, 2020 at 03:05:59PM +0100, Dave Stevenson wrote: > Hi Sakari > > On Tue, 31 Mar 2020 at 11:28, Sakari Ailus <sakari.ailus@iki.fi> wrote: > > > > Hi Dave, > > > > On Wed, Mar 25, 2020 at 01:50:44PM +0000, Dave Stevenson wrote: > > > On Wed, 29 Jan 2020 at 11:52, Dave Stevenson > > > <dave.stevenson@raspberrypi.com> wrote: > > > > > > > > Hi Hans. > > > > > > > > On Mon, 16 Sep 2019 at 13:00, Hans Verkuil <hverkuil-cisco@xs4all.nl> wrote: > > > > > > > > > > On 9/16/19 1:52 PM, Sakari Ailus wrote: > > > > > > On Mon, Sep 16, 2019 at 12:04:31PM +0200, Hans Verkuil wrote: > > > > > >> It turns out that Sakari posted a newer patch in 2018. I used that > > > > > >> for this v2: https://patchwork.linuxtv.org/patch/48372/ > > > > > >> > > > > > >> Mauro commented on that original patch that there was no need to > > > > > >> have this available for userspace. > > > > > >> > > > > > >> I disagree: why wouldn't userspace want to report pixelformats? > > > > > >> > > > > > >> It happens in several places in v4l-utils, and there the pixelformats are > > > > > >> printed in different ways as well. Providing a standard way of reporting > > > > > >> a V4L2 fourcc is very useful. > > > > > > > > > > > > Thanks, Hans! > > > > > > > > > > > > Can you take these to your tree (perhaps pending some sort of agreement > > > > > > with Mauro)? > > > > > > > > > > > > > > > > Certainly. > > > > > > > > > > Hans > > > > > > > > What happened to these? Patchwork is flagging them as rejected[1], but > > > > there's only been positive responses to them on the mailing list. > > > > > > Ping. Why were these patches rejected? > > > > This was discussed on media-maint channel. The log is here: > > > > <URL:https://linuxtv.org/irc/irclogger_log/media-maint?date=2020-02-06,Thu&raw=on> > > Thanks, it's useful to know what's going on. The patchwork information > was pretty opaque. > > The log includes > [12:41] <sailus> If you insist, I can write a patch, and put your > Suggested-by: tag there. :^) > [12:41] <mchehab> yeah, please do so > [12:42] <mchehab> the best is to also c/c drm ML > Has that happened and I've missed it, or is it still on the pending queue? Looking at the log reminded me to write it. :-) I'll test it first and then send it --- I'll cc you as well. -- Regards, Sakari Ailus ^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2020-03-31 14:29 UTC | newest] Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-09-16 10:04 [PATCHv2 0/2] Add helper functions to print a fourcc Hans Verkuil 2019-09-16 10:04 ` [PATCHv2 1/2] v4l: Add macros for printing V4L fourcc values Hans Verkuil 2019-09-16 12:07 ` Sakari Ailus 2019-09-16 12:15 ` Hans Verkuil 2019-10-02 12:40 ` Ezequiel Garcia 2019-09-16 10:04 ` [PATCHv2 2/2] v4l2-ioctl.c: use new v4l2_fourcc_conv/args macros Hans Verkuil 2019-10-02 12:45 ` Ezequiel Garcia 2019-09-16 11:52 ` [PATCHv2 0/2] Add helper functions to print a fourcc Sakari Ailus 2019-09-16 12:00 ` Hans Verkuil 2020-01-29 11:52 ` Dave Stevenson 2020-01-30 21:38 ` Kieran Bingham 2020-03-25 13:50 ` Dave Stevenson 2020-03-31 10:27 ` Sakari Ailus 2020-03-31 14:05 ` Dave Stevenson 2020-03-31 14:29 ` Sakari Ailus
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).