vicodec: a couple fixes towards spec compliancy
v2 cover vicodec: a couple fixes towards spec compliancy
Given the stateful codec specification is still a moving target, it doesn't make any sense to try to comply fully with it.
On the other side, we can still comply with some basic userspace expectations, with just a couple small changes.
This series implements proper resolution changes propagation, and fixes the CMD_STOP so it actually works.
The intention of this series is to be able to test this driver using already existing userspace, gstreamer in particular. With this changes, it's possible to construct variations of this pipeline:
gst-launch-1.0 videotestsrc ! v4l2fwhtenc ! v4l2fwhtdec ! fakevideosink
Also, as discussed in v1 feedback [1,2], I'm including pixel format helpers, as RFC for now. Hans, Tomasz: is this what you had in mind?
[1] https://www.spinics.net/lists/linux-media/msg141912.html
[2] https://www.spinics.net/lists/linux-media/msg142099.html
v2:
* Add more info to commit logs
* Propagate changes on both encoders and decoders
* Add pixel format helpers
Ezequiel Garcia (4):
media: Introduce helpers to fill pixel format structs
vicodec: Use pixel format helpers
vicodec: Propagate changes to the CAPTURE queue
vicodec: Implement spec-compliant stop command
.../media/platform/vicodec/codec-v4l2-fwht.c | 42 ++-- .../media/platform/vicodec/codec-v4l2-fwht.h | 3 - drivers/media/platform/vicodec/vicodec-core.c | 197 +++++++++--------- drivers/media/v4l2-core/Makefile | 2 +- drivers/media/v4l2-core/v4l2-common.c | 66 ++++++ drivers/media/v4l2-core/v4l2-fourcc.c | 93 +++++++++ include/media/v4l2-common.h | 5 + include/media/v4l2-fourcc.h | 53 +++++ 8 files changed, 332 insertions(+), 129 deletions(-) create mode 100644 drivers/media/v4l2-core/v4l2-fourcc.c create mode 100644 include/media/v4l2-fourcc.h
Signature · 1 line
2.19.1
RFC v2 1/4 media: Introduce helpers to fill pixel format structs
Add two new API helpers, v4l2_fill_pixfmt and v4l2_fill_pixfmt_mp, to be used by drivers to calculate plane sizes and bytes per lines.
Note that driver-specific paddig and alignment are not yet taken into account.
--- drivers/media/v4l2-core/Makefile | 2 +- drivers/media/v4l2-core/v4l2-common.c | 66 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-fourcc.c | 93 +++++++++++++++++++++++++++ include/media/v4l2-common.h | 5 ++ include/media/v4l2-fourcc.h | 53 +++++++++++++++ 5 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 drivers/media/v4l2-core/v4l2-fourcc.c create mode 100644 include/media/v4l2-fourcc.h
drivers/media/v4l2-core/Makefile +1 -1
@@ -7,7 +7,7 @@ tuner-objs := tuner-core.o videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o \ v4l2-event.o v4l2-ctrls.o v4l2-subdev.o v4l2-clk.o \ - v4l2-async.o + v4l2-async.o v4l2-fourcc.o ifeq ($(CONFIG_COMPAT),y) videodev-objs += v4l2-compat-ioctl32.o endif
drivers/media/v4l2-core/v4l2-common.c +66 -0
75 lines not on this page · raw message
drivers/media/v4l2-core/v4l2-fourcc.c new file +93 -0
93 lines not on this page · raw message
include/media/v4l2-common.h +5 -0
@@ -396,4 +396,9 @@ int v4l2_g_parm_cap(struct video_device *vdev,int v4l2_s_parm_cap (struct video_device *vdev,struct v4l2_subdev *sd,struct v4l2_streamparm *a); +void v4l2_fill_pixfmt (struct v4l2_pix_format *pixfmt,int pixelformat, +int width,int height); +void v4l2_fill_pixfmt_mp (struct v4l2_pix_format_mplane *pixfmt,int pixelformat, +int width,int height); +#endif /* V4L2_COMMON_H_ */
include/media/v4l2-fourcc.h new file +53 -0
53 lines not on this page · raw message
Signature · 1 line
2.19.1
Re: [RFC v2 1/4] media: Introduce helpers to fill pixel format structs
Quoted 43 lines · Ezequiel Garcia
Add two new API helpers,
v4l2_fill_pixfmtandv4l2_fill_pixfmt_mp, to be used by drivers to calculate plane sizes and bytes per lines.Note that driver-specific paddig and alignment are not yet taken into account.
Signed-off-by Ezequiel Garcia <[email protected]>--- drivers/media/v4l2-core/Makefile | 2 +- drivers/media/v4l2-core/v4l2-common.c | 66 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-fourcc.c | 93 +++++++++++++++++++++++++++ include/media/v4l2-common.h | 5 ++ include/media/v4l2-fourcc.h | 53 +++++++++++++++ 5 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 drivers/media/v4l2-core/v4l2-fourcc.c create mode 100644 include/media/v4l2-fourcc.hdrivers/media/v4l2-core/Makefile +1
-1@@ -7,7 +7,7 @@ tuner-objs := tuner-core.o videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o \ v4l2-event.o v4l2-ctrls.o v4l2-subdev.o v4l2-clk.o \ - v4l2-async.o + v4l2-async.o v4l2-fourcc.o ifeq ($(CONFIG_COMPAT),y) videodev-objs += v4l2-compat-ioctl32.o endifdrivers/media/v4l2-core/v4l2-common.c +1
-0@@ -61,6 +61,7 @@#include <media/v4l2-common.h> #include <media/v4l2-device.h> #include <media/v4l2-ctrls.h> +#include <media/v4l2-fourcc.h> #include <linux/videodev2.h>
drivers/media/v4l2-core/v4l2-common.c int v4l2_s_parm_cap(struct video_device *vdev, · line 460
Quoted 5 lines
drivers/media/v4l2-core/v4l2-common.c +2
-0@@ -455,3 +456,68 @@ int v4l2_s_parm_cap(struct video_device *vdev,return ret; }EXPORT_SYMBOL_GPL (v4l2_s_parm_cap); + +void v4l2_fill_pixfmt_mp (struct v4l2_pix_format_mplane *pixfmt,int pixelformat,int width,int height)
My first impression is that this code expects width/height to be aligned to the sub-sampling. Hence, I don't think it works for odd width/height. It would be nice to document the constraint, specially that this will lead to under-allocation due to the lack of round up.
Quoted 235 lines
drivers/media/v4l2-core/v4l2-common.c +63
-0+{ +const struct v4l2_format_info *info; +struct v4l2_plane_pix_format *plane; +int i; + + info =v4l2_format_info (pixelformat); +if (!info) +return ; + + pixfmt->width = width; + pixfmt->height = height; + pixfmt->pixelformat = pixelformat; + +if (info->has_contiguous_planes) { + pixfmt->num_planes =1 ; + plane = &pixfmt->plane_fmt[0 ]; + plane->bytesperline = info->is_compressed ? +0 : width * info->cpp[0 ]; + plane->sizeimage = info->header_size; +for (i =0 ; i < info->num_planes; i++) { +unsigned int hsub = (i ==0 ) ?1 : info->hsub; +unsigned int vsub = (i ==0 ) ?1 : info->vsub; + + plane->sizeimage += width * height * info->cpp[i] / (hsub * vsub); + } + }else { + pixfmt->num_planes = info->num_planes; +for (i =0 ; i < info->num_planes; i++) { +unsigned int hsub = (i ==0 ) ?1 : info->hsub; +unsigned int vsub = (i ==0 ) ?1 : info->vsub; + + plane = &pixfmt->plane_fmt[i]; + plane->bytesperline = width * info->cpp[i] / hsub; + plane->sizeimage = width * height * info->cpp[i] / (hsub * vsub); + } + } +} +EXPORT_SYMBOL_GPL (v4l2_fill_pixfmt_mp); + +void v4l2_fill_pixfmt (struct v4l2_pix_format *pixfmt,int pixelformat,int width,int height) +{ +const struct v4l2_format_info *info; +char name[32 ]; +int i; + + pixfmt->width = width; + pixfmt->height = height; + pixfmt->pixelformat = pixelformat; + + info =v4l2_format_info (pixelformat); +if (!info) +return ; + pixfmt->bytesperline = info->is_compressed ?0 : width * info->cpp[0 ]; + + pixfmt->sizeimage = info->header_size; +for (i =0 ; i < info->num_planes; i++) { +unsigned int hsub = (i ==0 ) ?1 : info->hsub; +unsigned int vsub = (i ==0 ) ?1 : info->vsub; + + pixfmt->sizeimage += width * height * info->cpp[i] / (hsub * vsub); + } +} +EXPORT_SYMBOL_GPL (v4l2_fill_pixfmt);drivers/media/v4l2-core/v4l2-fourcc.c new file +93
-0@@ -0,0 +1,93 @@ +/* +* Copyright (c) 2018 Collabora, Ltd. +* +* Based on drm-fourcc: +* Copyright (c) 2016 Laurent Pinchart <[email protected]> +* +* Permission to use, copy, modify, distribute, and sell this software and its +* documentation for any purpose is hereby granted without fee, provided that +* the above copyright notice appear in all copies and that both that copyright +* notice and this permission notice appear in supporting documentation, and +* that the name of the copyright holders not be used in advertising or +* publicity pertaining to distribution of the software without specific, +* written prior permission. The copyright holders make no representations +* about the suitability of this software for any purpose. It is provided "as +* is" without express or implied warranty. +* +* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +* OF THIS SOFTWARE. +*/ + +#include <linux/ctype.h> +#include <linux/videodev2.h> +#include <media/v4l2-fourcc.h> +#include "../platform/vicodec/codec-fwht.h" + +#if 0 +static char printable_char (int c) +{ +return isascii (c) &&isprint (c) ? c :'?' ; +} + +static const char *v4l2_get_format_name (uint32_t format,char *buf,size_t len) +{ +snprintf (buf, len, +"%c%c%c%c %s-endian (0x%08x)" , +printable_char (format &0xff ), +printable_char ((format >>8 ) &0xff ), +printable_char ((format >>16 ) &0xff ), +printable_char ((format >>24 ) &0x7f ), + format &BIT (31 ) ?"big" :"little" , + format); + +return buf; +} +#endif + +const struct v4l2_format_info *v4l2_format_info (u32 format) +{ +static const struct v4l2_format_info formats[] = { +/* RGB formats */ + { .format =V4L2_PIX_FMT_BGR24 , .num_planes =1 , .cpp = {3 ,0 ,0 }, .hsub =1 , .vsub =1 }, + { .format =V4L2_PIX_FMT_RGB24 , .num_planes =1 , .cpp = {3 ,0 ,0 }, .hsub =1 , .vsub =1 }, + { .format =V4L2_PIX_FMT_BGR32 , .num_planes =1 , .cpp = {4 ,0 ,0 }, .hsub =1 , .vsub =1 }, + { .format =V4L2_PIX_FMT_XBGR32 , .num_planes =1 , .cpp = {4 ,0 ,0 }, .hsub =1 , .vsub =1 }, + { .format =V4L2_PIX_FMT_RGB32 , .num_planes =1 , .cpp = {4 ,0 ,0 }, .hsub =1 , .vsub =1 }, + { .format =V4L2_PIX_FMT_XRGB32 , .num_planes =1 , .cpp = {4 ,0 ,0 }, .hsub =1 , .vsub =1 }, + +/* YUV formats */ + { .format =V4L2_PIX_FMT_YUV420 , .num_planes =3 , .cpp = {1 ,1 ,1 }, .hsub =2 , .vsub =2 }, + { .format =V4L2_PIX_FMT_YVU420 , .num_planes =3 , .cpp = {1 ,1 ,1 }, .hsub =2 , .vsub =2 }, + { .format =V4L2_PIX_FMT_YUV422P , .num_planes =3 , .cpp = {1 ,1 ,1 }, .hsub =2 , .vsub =1 }, + { .format =V4L2_PIX_FMT_NV12 , .num_planes =2 , .cpp = {1 ,2 ,0 }, .hsub =2 , .vsub =2 }, + { .format =V4L2_PIX_FMT_NV21 , .num_planes =2 , .cpp = {1 ,2 ,0 }, .hsub =2 , .vsub =2 }, + { .format =V4L2_PIX_FMT_NV16 , .num_planes =2 , .cpp = {1 ,2 ,0 }, .hsub =2 , .vsub =1 }, + { .format =V4L2_PIX_FMT_NV61 , .num_planes =2 , .cpp = {1 ,2 ,0 }, .hsub =2 , .vsub =1 }, + { .format =V4L2_PIX_FMT_NV24 , .num_planes =2 , .cpp = {1 ,2 ,0 }, .hsub =1 , .vsub =1 }, + { .format =V4L2_PIX_FMT_NV42 , .num_planes =2 , .cpp = {1 ,2 ,0 }, .hsub =1 , .vsub =1 }, + { .format =V4L2_PIX_FMT_YUYV , .num_planes =1 , .cpp = {2 ,0 ,0 }, .hsub =2 , .vsub =1 }, + { .format =V4L2_PIX_FMT_YVYU , .num_planes =1 , .cpp = {2 ,0 ,0 }, .hsub =2 , .vsub =1 }, + { .format =V4L2_PIX_FMT_UYVY , .num_planes =1 , .cpp = {2 ,0 ,0 }, .hsub =2 , .vsub =1 }, + { .format =V4L2_PIX_FMT_VYUY , .num_planes =1 , .cpp = {2 ,0 ,0 }, .hsub =2 , .vsub =1 }, + +/* Compressed formats */ + { .format =V4L2_PIX_FMT_FWHT , .num_planes =1 , .cpp = {3 ,0 ,0 }, .header_size =sizeof (struct fwht_cframe_hdr ), .is_compressed = true }, + }; + +unsigned int i; + +for (i =0 ; i <ARRAY_SIZE (formats); ++i) { +if (formats[i].format == format) +return &formats[i]; + } + +pr_warn ("Unsupported V4L 4CC format (%08x)\n" , format); +return NULL ; +} +EXPORT_SYMBOL (v4l2_format_info); +include/media/v4l2-common.h +5
-0@@ -396,4 +396,9 @@ int v4l2_g_parm_cap(struct video_device *vdev,int v4l2_s_parm_cap (struct video_device *vdev,struct v4l2_subdev *sd,struct v4l2_streamparm *a); +void v4l2_fill_pixfmt (struct v4l2_pix_format *pixfmt,int pixelformat, +int width,int height); +void v4l2_fill_pixfmt_mp (struct v4l2_pix_format_mplane *pixfmt,int pixelformat, +int width,int height); +#endif /* V4L2_COMMON_H_ */ include/media/v4l2-fourcc.h new file +53
-0@@ -0,0 +1,53 @@ +/* +* Copyright (c) 2018 Collabora, Ltd. +* +* Based on drm-fourcc: +* Copyright (c) 2016 Laurent Pinchart <[email protected]> +* +* Permission to use, copy, modify, distribute, and sell this software and its +* documentation for any purpose is hereby granted without fee, provided that +* the above copyright notice appear in all copies and that both that copyright +* notice and this permission notice appear in supporting documentation, and +* that the name of the copyright holders not be used in advertising or +* publicity pertaining to distribution of the software without specific, +* written prior permission. The copyright holders make no representations +* about the suitability of this software for any purpose. It is provided "as +* is" without express or implied warranty. +* +* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +* OF THIS SOFTWARE. +*/ +#ifndef __V4L2_FOURCC_H__ +#define __V4L2_FOURCC_H__ + +#include <linux/types.h> + +/** +* struct v4l2_format_info - information about a V4L2 format +* @format: 4CC format identifier (V4L2_PIX_FMT_*) +* @header_size: Size of header, optional and used by compressed formats +* @num_planes: Number of planes (1 to 3) +* @cpp: Number of bytes per pixel (per plane) +* @hsub: Horizontal chroma subsampling factor +* @vsub: Vertical chroma subsampling factor +* @is_compressed: Is it a compressed format? +*/ +struct v4l2_format_info { +u32 format; +u32 header_size; +u8 num_planes; +u8 cpp[3 ]; +u8 hsub; +u8 vsub; +bool is_compressed; +bool has_contiguous_planes; +}; + +const struct v4l2_format_info *v4l2_format_info (u32 format); + +#endif
Re: [RFC v2 1/4] media: Introduce helpers to fill pixel format structs
In reply to Ezequiel GarciaQuoted 8 lines · Ezequiel Garcia
Add two new API helpers,
v4l2_fill_pixfmtandv4l2_fill_pixfmt_mp, to be used by drivers to calculate plane sizes and bytes per lines.Note that driver-specific paddig and alignment are not yet taken into account.
Signed-off-by Ezequiel Garcia <[email protected]>---
Heads-up: I plan to submit a new version of this patch, as part of the VPU JPEG patchset.
Thanks,
Ezequiel
Quoted 276 lines
drivers/media/v4l2-core/Makefile | 2 +- drivers/media/v4l2-core/v4l2-common.c | 66 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-fourcc.c | 93 +++++++++++++++++++++++++++ include/media/v4l2-common.h | 5 ++ include/media/v4l2-fourcc.h | 53 +++++++++++++++ 5 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 drivers/media/v4l2-core/v4l2-fourcc.c create mode 100644 include/media/v4l2-fourcc.hdrivers/media/v4l2-core/Makefile +1
-1@@ -7,7 +7,7 @@ tuner-objs := tuner-core.o videodev-objs := v4l2-dev.o v4l2-ioctl.o v4l2-device.o v4l2-fh.o \ v4l2-event.o v4l2-ctrls.o v4l2-subdev.o v4l2-clk.o \ - v4l2-async.o + v4l2-async.o v4l2-fourcc.o ifeq ($(CONFIG_COMPAT),y) videodev-objs += v4l2-compat-ioctl32.o endifdrivers/media/v4l2-core/v4l2-common.c +66
-0@@ -61,6 +61,7 @@#include <media/v4l2-common.h> #include <media/v4l2-device.h> #include <media/v4l2-ctrls.h> +#include <media/v4l2-fourcc.h> #include <linux/videodev2.h> @@ -455,3 +456,68 @@ int v4l2_s_parm_cap(struct video_device *vdev,return ret; }EXPORT_SYMBOL_GPL (v4l2_s_parm_cap); + +void v4l2_fill_pixfmt_mp (struct v4l2_pix_format_mplane *pixfmt,int pixelformat,int width,int height) +{ +const struct v4l2_format_info *info; +struct v4l2_plane_pix_format *plane; +int i; + + info =v4l2_format_info (pixelformat); +if (!info) +return ; + + pixfmt->width = width; + pixfmt->height = height; + pixfmt->pixelformat = pixelformat; + +if (info->has_contiguous_planes) { + pixfmt->num_planes =1 ; + plane = &pixfmt->plane_fmt[0 ]; + plane->bytesperline = info->is_compressed ? +0 : width * info->cpp[0 ]; + plane->sizeimage = info->header_size; +for (i =0 ; i < info->num_planes; i++) { +unsigned int hsub = (i ==0 ) ?1 : info->hsub; +unsigned int vsub = (i ==0 ) ?1 : info->vsub; + + plane->sizeimage += width * height * info->cpp[i] / (hsub * vsub); + } + }else { + pixfmt->num_planes = info->num_planes; +for (i =0 ; i < info->num_planes; i++) { +unsigned int hsub = (i ==0 ) ?1 : info->hsub; +unsigned int vsub = (i ==0 ) ?1 : info->vsub; + + plane = &pixfmt->plane_fmt[i]; + plane->bytesperline = width * info->cpp[i] / hsub; + plane->sizeimage = width * height * info->cpp[i] / (hsub * vsub); + } + } +} +EXPORT_SYMBOL_GPL (v4l2_fill_pixfmt_mp); + +void v4l2_fill_pixfmt (struct v4l2_pix_format *pixfmt,int pixelformat,int width,int height) +{ +const struct v4l2_format_info *info; +char name[32 ]; +int i; + + pixfmt->width = width; + pixfmt->height = height; + pixfmt->pixelformat = pixelformat; + + info =v4l2_format_info (pixelformat); +if (!info) +return ; + pixfmt->bytesperline = info->is_compressed ?0 : width * info->cpp[0 ]; + + pixfmt->sizeimage = info->header_size; +for (i =0 ; i < info->num_planes; i++) { +unsigned int hsub = (i ==0 ) ?1 : info->hsub; +unsigned int vsub = (i ==0 ) ?1 : info->vsub; + + pixfmt->sizeimage += width * height * info->cpp[i] / (hsub * vsub); + } +} +EXPORT_SYMBOL_GPL (v4l2_fill_pixfmt);drivers/media/v4l2-core/v4l2-fourcc.c new file +79
-0@@ -0,0 +1,93 @@ +/* +* Copyright (c) 2018 Collabora, Ltd. +* +* Based on drm-fourcc: +* Copyright (c) 2016 Laurent Pinchart <[email protected]> +* +* Permission to use, copy, modify, distribute, and sell this software and its +* documentation for any purpose is hereby granted without fee, provided that +* the above copyright notice appear in all copies and that both that copyright +* notice and this permission notice appear in supporting documentation, and +* that the name of the copyright holders not be used in advertising or +* publicity pertaining to distribution of the software without specific, +* written prior permission. The copyright holders make no representations +* about the suitability of this software for any purpose. It is provided "as +* is" without express or implied warranty. +* +* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +* OF THIS SOFTWARE. +*/ + +#include <linux/ctype.h> +#include <linux/videodev2.h> +#include <media/v4l2-fourcc.h> +#include "../platform/vicodec/codec-fwht.h" + +#if 0 +static char printable_char (int c) +{ +return isascii (c) &&isprint (c) ? c :'?' ; +} + +static const char *v4l2_get_format_name (uint32_t format,char *buf,size_t len) +{ +snprintf (buf, len, +"%c%c%c%c %s-endian (0x%08x)" , +printable_char (format &0xff ), +printable_char ((format >>8 ) &0xff ), +printable_char ((format >>16 ) &0xff ), +printable_char ((format >>24 ) &0x7f ), + format &BIT (31 ) ?"big" :"little" , + format); + +return buf; +} +#endif + +const struct v4l2_format_info *v4l2_format_info (u32 format) +{ +static const struct v4l2_format_info formats[] = { +/* RGB formats */ + { .format =V4L2_PIX_FMT_BGR24 , .num_planes =1 , .cpp = {3 ,0 ,0 }, .hsub =1 , .vsub =1 }, + { .format =V4L2_PIX_FMT_RGB24 , .num_planes =1 , .cpp = {3 ,0 ,0 }, .hsub =1 , .vsub =1 }, + { .format =V4L2_PIX_FMT_BGR32 , .num_planes =1 , .cpp = {4 ,0 ,0 }, .hsub =1 , .vsub =1 }, + { .format =V4L2_PIX_FMT_XBGR32 , .num_planes =1 , .cpp = {4 ,0 ,0 }, .hsub =1 , .vsub =1 }, + { .format =V4L2_PIX_FMT_RGB32 , .num_planes =1 , .cpp = {4 ,0 ,0 }, .hsub =1 , .vsub =1 }, + { .format =V4L2_PIX_FMT_XRGB32 , .num_planes =1 , .cpp = {4 ,0 ,0 }, .hsub =1 , .vsub =1 }, + +/* YUV formats */ + { .format =V4L2_PIX_FMT_YUV420 , .num_planes =3 , .cpp = {1 ,1 ,1 }, .hsub =2 , .vsub =2 }, + { .format =V4L2_PIX_FMT_YVU420 , .num_planes =3 , .cpp = {1 ,1 ,1 }, .hsub =2 , .vsub =2 }, + { .format =V4L2_PIX_FMT_YUV422P , .num_planes =3 , .cpp = {1 ,1 ,1 }, .hsub =2 , .vsub =1 }, + { .format =V4L2_PIX_FMT_NV12 , .num_planes =2 , .cpp = {1 ,2 ,0 }, .hsub =2 , .vsub =2 }, + { .format =V4L2_PIX_FMT_NV21 , .num_planes =2 , .cpp = {1 ,2 ,0 }, .hsub =2 , .vsub =2 }, + { .format =V4L2_PIX_FMT_NV16 , .num_planes =2 , .cpp = {1 ,2 ,0 }, .hsub =2 , .vsub =1 }, + { .format =V4L2_PIX_FMT_NV61 , .num_planes =2 , .cpp = {1 ,2 ,0 }, .hsub =2 , .vsub =1 }, + { .format =V4L2_PIX_FMT_NV24 , .num_planes =2 , .cpp = {1 ,2 ,0 }, .hsub =1 , .vsub =1 }, + { .format =V4L2_PIX_FMT_NV42 , .num_planes =2 , .cpp = {1 ,2 ,0 }, .hsub =1 , .vsub =1 }, + { .format =V4L2_PIX_FMT_YUYV , .num_planes =1 , .cpp = {2 ,0 ,0 }, .hsub =2 , .vsub =1 }, + { .format =V4L2_PIX_FMT_YVYU , .num_planes =1 , .cpp = {2 ,0 ,0 }, .hsub =2 , .vsub =1 }, + { .format =V4L2_PIX_FMT_UYVY , .num_planes =1 , .cpp = {2 ,0 ,0 }, .hsub =2 , .vsub =1 }, + { .format =V4L2_PIX_FMT_VYUY , .num_planes =1 , .cpp = {2 ,0 ,0 }, .hsub =2 , .vsub =1 }, + +/* Compressed formats */ + { .format =V4L2_PIX_FMT_FWHT , .num_planes =1 , .cpp = {3 ,0 ,0 }, .header_size =sizeof (struct fwht_cframe_hdr ),.is_compressed = true },
drivers/media/v4l2-core/v4l2-fourcc.c new file +14
-0+ }; + +unsigned int i; + +for (i =0 ; i <ARRAY_SIZE (formats); ++i) { +if (formats[i].format == format) +return &formats[i]; + } + +pr_warn ("Unsupported V4L 4CC format (%08x)\n" , format); +return NULL ; +} +EXPORT_SYMBOL (v4l2_format_info); +include/media/v4l2-common.h +5
-0@@ -396,4 +396,9 @@ int v4l2_g_parm_cap(struct video_device *vdev,int v4l2_s_parm_cap (struct video_device *vdev,struct v4l2_subdev *sd,struct v4l2_streamparm *a); +void v4l2_fill_pixfmt (struct v4l2_pix_format *pixfmt,int pixelformat, +int width,int height); +void v4l2_fill_pixfmt_mp (struct v4l2_pix_format_mplane *pixfmt,int pixelformat, +int width,int height); +#endif /* V4L2_COMMON_H_ */ include/media/v4l2-fourcc.h new file +53
-0@@ -0,0 +1,53 @@ +/* +* Copyright (c) 2018 Collabora, Ltd. +* +* Based on drm-fourcc: +* Copyright (c) 2016 Laurent Pinchart <[email protected]> +* +* Permission to use, copy, modify, distribute, and sell this software and its +* documentation for any purpose is hereby granted without fee, provided that +* the above copyright notice appear in all copies and that both that copyright +* notice and this permission notice appear in supporting documentation, and +* that the name of the copyright holders not be used in advertising or +* publicity pertaining to distribution of the software without specific, +* written prior permission. The copyright holders make no representations +* about the suitability of this software for any purpose. It is provided "as +* is" without express or implied warranty. +* +* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR +* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +* OF THIS SOFTWARE. +*/ +#ifndef __V4L2_FOURCC_H__ +#define __V4L2_FOURCC_H__ + +#include <linux/types.h> + +/** +* struct v4l2_format_info - information about a V4L2 format +* @format: 4CC format identifier (V4L2_PIX_FMT_*) +* @header_size: Size of header, optional and used by compressed formats +* @num_planes: Number of planes (1 to 3) +* @cpp: Number of bytes per pixel (per plane) +* @hsub: Horizontal chroma subsampling factor +* @vsub: Vertical chroma subsampling factor +* @is_compressed: Is it a compressed format? +*/ +struct v4l2_format_info { +u32 format; +u32 header_size; +u8 num_planes; +u8 cpp[3 ]; +u8 hsub; +u8 vsub; +bool is_compressed; +bool has_contiguous_planes; +}; + +const struct v4l2_format_info *v4l2_format_info (u32 format); + +#endif
PATCH v2 2/4 vicodec: Use pixel format helpers
In reply to Ezequiel GarciaNow that we've introduced the pixel format helpers, use them in vicodec driver, and get rid of driver specific pixel format specifiers.
--- .../media/platform/vicodec/codec-v4l2-fwht.c | 42 ++++---- .../media/platform/vicodec/codec-v4l2-fwht.h | 3 - drivers/media/platform/vicodec/vicodec-core.c | 95 ++++++------------- 3 files changed, 48 insertions(+), 92 deletions(-)
drivers/media/platform/vicodec/codec-v4l2-fwht.c +21 -21
@@ -11,27 +11,27 @@#include "codec-v4l2-fwht.h" static const struct v4l2_fwht_pixfmt_info v4l2_fwht_pixfmts[] = { - {V4L2_PIX_FMT_YUV420 ,1 ,3 ,2 ,1 ,1 ,2 ,2 }, - {V4L2_PIX_FMT_YVU420 ,1 ,3 ,2 ,1 ,1 ,2 ,2 }, - {V4L2_PIX_FMT_YUV422P ,1 ,2 ,1 ,1 ,1 ,2 ,1 }, - {V4L2_PIX_FMT_NV12 ,1 ,3 ,2 ,1 ,2 ,2 ,2 }, - {V4L2_PIX_FMT_NV21 ,1 ,3 ,2 ,1 ,2 ,2 ,2 }, - {V4L2_PIX_FMT_NV16 ,1 ,2 ,1 ,1 ,2 ,2 ,1 }, - {V4L2_PIX_FMT_NV61 ,1 ,2 ,1 ,1 ,2 ,2 ,1 }, - {V4L2_PIX_FMT_NV24 ,1 ,3 ,1 ,1 ,2 ,1 ,1 }, - {V4L2_PIX_FMT_NV42 ,1 ,3 ,1 ,1 ,2 ,1 ,1 }, - {V4L2_PIX_FMT_YUYV ,2 ,2 ,1 ,2 ,4 ,2 ,1 }, - {V4L2_PIX_FMT_YVYU ,2 ,2 ,1 ,2 ,4 ,2 ,1 }, - {V4L2_PIX_FMT_UYVY ,2 ,2 ,1 ,2 ,4 ,2 ,1 }, - {V4L2_PIX_FMT_VYUY ,2 ,2 ,1 ,2 ,4 ,2 ,1 }, - {V4L2_PIX_FMT_BGR24 ,3 ,3 ,1 ,3 ,3 ,1 ,1 }, - {V4L2_PIX_FMT_RGB24 ,3 ,3 ,1 ,3 ,3 ,1 ,1 }, - {V4L2_PIX_FMT_HSV24 ,3 ,3 ,1 ,3 ,3 ,1 ,1 }, - {V4L2_PIX_FMT_BGR32 ,4 ,4 ,1 ,4 ,4 ,1 ,1 }, - {V4L2_PIX_FMT_XBGR32 ,4 ,4 ,1 ,4 ,4 ,1 ,1 }, - {V4L2_PIX_FMT_RGB32 ,4 ,4 ,1 ,4 ,4 ,1 ,1 }, - {V4L2_PIX_FMT_XRGB32 ,4 ,4 ,1 ,4 ,4 ,1 ,1 }, - {V4L2_PIX_FMT_HSV32 ,4 ,4 ,1 ,4 ,4 ,1 ,1 }, + {V4L2_PIX_FMT_YUV420 ,1 ,1 ,2 ,2 }, + {V4L2_PIX_FMT_YVU420 ,1 ,1 ,2 ,2 }, + {V4L2_PIX_FMT_YUV422P ,1 ,1 ,2 ,1 }, + {V4L2_PIX_FMT_NV12 ,1 ,2 ,2 ,2 }, + {V4L2_PIX_FMT_NV21 ,1 ,2 ,2 ,2 }, + {V4L2_PIX_FMT_NV16 ,1 ,2 ,2 ,1 }, + {V4L2_PIX_FMT_NV61 ,1 ,2 ,2 ,1 }, + {V4L2_PIX_FMT_NV24 ,1 ,2 ,1 ,1 }, + {V4L2_PIX_FMT_NV42 ,1 ,2 ,1 ,1 }, + {V4L2_PIX_FMT_YUYV ,2 ,4 ,2 ,1 }, + {V4L2_PIX_FMT_YVYU ,2 ,4 ,2 ,1 }, + {V4L2_PIX_FMT_UYVY ,2 ,4 ,2 ,1 }, + {V4L2_PIX_FMT_VYUY ,2 ,4 ,2 ,1 }, + {V4L2_PIX_FMT_BGR24 ,3 ,3 ,1 ,1 }, + {V4L2_PIX_FMT_RGB24 ,3 ,3 ,1 ,1 }, + {V4L2_PIX_FMT_HSV24 ,3 ,3 ,1 ,1 }, + {V4L2_PIX_FMT_BGR32 ,4 ,4 ,1 ,1 }, + {V4L2_PIX_FMT_XBGR32 ,4 ,4 ,1 ,1 }, + {V4L2_PIX_FMT_RGB32 ,4 ,4 ,1 ,1 }, + {V4L2_PIX_FMT_XRGB32 ,4 ,4 ,1 ,1 }, + {V4L2_PIX_FMT_HSV32 ,4 ,4 ,1 ,1 }, };const struct v4l2_fwht_pixfmt_info *v4l2_fwht_find_pixfmt (u32 pixelformat)
drivers/media/platform/vicodec/codec-v4l2-fwht.h +0 -3
@@ -10,9 +10,6 @@struct v4l2_fwht_pixfmt_info {u32 id; -unsigned int bytesperline_mult; -unsigned int sizeimage_mult; -unsigned int sizeimage_div;unsigned int luma_step;unsigned int chroma_step;/* Chroma plane subsampling */
drivers/media/platform/vicodec/vicodec-core.c +27 -68
153 lines not on this page · raw message
Signature · 1 line
2.19.1
PATCH v2 3/4 vicodec: Propagate changes to the CAPTURE queue
In reply to Ezequiel GarciaFor stateful codecs, width and height values set
on the OUTPUT queue, must be propagated to the CAPTURE queue.
This is not enough to fully comply with the specification, which would require to properly support stream resolution changes detection and notification.
However, it's a relatively small change, which fixes behavior required by some applications such as gstreamer.
With this change, it's possible to run a simple T(T⁻¹) pipeline:
gst-launch-1.0 videotestsrc ! v4l2fwhtenc ! v4l2fwhtdec ! fakevideosink
--- drivers/media/platform/vicodec/vicodec-core.c | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)
drivers/media/platform/vicodec/vicodec-core.c +22 -0
@@ -636,6 +636,17 @@ static int vidioc_s_fmt(struct vicodec_ctx *ctx, struct v4l2_format *f) q_data->width = pix->width; q_data->height = pix->height; q_data->sizeimage = pix->sizeimage; + +/* Propagate changes to CAPTURE queue */ +if (V4L2_TYPE_IS_OUTPUT (f->type)) { +struct v4l2_pix_format dst_pix; + +v4l2_fill_pixfmt (&dst_pix, ctx->q_data[V4L2_M2M_DST ].info->id, + pix->width, pix->height); + ctx->q_data[V4L2_M2M_DST ].width = pix->width; + ctx->q_data[V4L2_M2M_DST ].height = pix->height; + ctx->q_data[V4L2_M2M_DST ].sizeimage = dst_pix.sizeimage; + }break ;case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE :case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE :
@@ -656,6 +667,17 @@ static int vidioc_s_fmt(struct vicodec_ctx *ctx, struct v4l2_format *f) q_data->width = pix_mp->width; q_data->height = pix_mp->height; q_data->sizeimage = pix_mp->plane_fmt[0 ].sizeimage; + +/* Propagate changes to CAPTURE queue */ +if (V4L2_TYPE_IS_OUTPUT (f->type)) { +struct v4l2_pix_format_mplane dst_pix; + +v4l2_fill_pixfmt_mp (&dst_pix, ctx->q_data[V4L2_M2M_DST ].info->id, + pix_mp->width, pix_mp->height); + ctx->q_data[V4L2_M2M_DST ].width = pix_mp->width; + ctx->q_data[V4L2_M2M_DST ].height = pix_mp->height; + ctx->q_data[V4L2_M2M_DST ].sizeimage = dst_pix.plane_fmt[0 ].sizeimage; + }break ;default :return -EINVAL ;
Signature · 1 line
2.19.1
PATCH v2 4/4 vicodec: Implement spec-compliant stop command
In reply to Ezequiel GarciaCurrently on a V4L2_ENC_CMD_STOP command, the driver sets V4L2_BUF_FLAG_LAST to the destination buffer, but only if there's no source buffer.
This alone has no effects, because .device_run never gets to run (there is no source buffer), therefore destination buffer is never dequeued.
Fix this by setting up a statically-allocated, dummy buffer to be used as flush buffer, used to signal a encoding (or decoding) stop.
This works by queueing the flush buffer to the OUTPUT queue, so the driver will send an V4L2_EVENT_EOS event, and mark the CAPTURE buffer with V4L2_BUF_FLAG_LAST.
Once the buffer is marked as V4L2_BUF_FLAG_LAST, the kernel returns -EPIPE on a VIDIOC_DQBUF. Applications can use this error to detect the stop condition.
With this change, it's possible to run a pipeline to completion:
gst-launch-1.0 videotestsrc num-buffers=10 ! v4l2fwhtenc ! v4l2fwhtdec ! fakevideosink
--- drivers/media/platform/vicodec/vicodec-core.c | 80 ++++++++++--------- 1 file changed, 44 insertions(+), 36 deletions(-)
drivers/media/platform/vicodec/vicodec-core.c +44 -36
@@ -102,7 +102,7 @@ struct vicodec_ctx {struct v4l2_ctrl_handler hdl;struct vb2_v4l2_buffer *last_src_buf; -struct vb2_v4l2_buffer *last_dst_buf; +struct vb2_v4l2_buffer flush_buf;/* Source and destination queue data */ struct vicodec_q_data q_data[2 ];
@@ -209,6 +209,7 @@ static void device_run(void *priv)struct vicodec_dev *dev = ctx->dev;struct vb2_v4l2_buffer *src_buf, *dst_buf;struct vicodec_q_data *q_out; +bool flushing;u32 state; src_buf =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx);
@@ -216,26 +217,36 @@ static void device_run(void *priv) q_out =get_q_data (ctx,V4L2_BUF_TYPE_VIDEO_OUTPUT ); state =VB2_BUF_STATE_DONE ; -if (device_process (ctx, src_buf, dst_buf)) + + flushing = (src_buf == &ctx->flush_buf); +if (!flushing &&device_process (ctx, src_buf, dst_buf)) state =VB2_BUF_STATE_ERROR ; - ctx->last_dst_buf = dst_buf;spin_lock (ctx->lock); -if (!ctx->comp_has_next_frame && src_buf == ctx->last_src_buf) { +if (!flushing) { +if (!ctx->comp_has_next_frame && src_buf == ctx->last_src_buf) { + dst_buf->flags |=V4L2_BUF_FLAG_LAST ; +v4l2_event_queue_fh (&ctx->fh, &eos_event); + } + +if (ctx->is_enc) { + src_buf->sequence = q_out->sequence++; + src_buf =v4l2_m2m_src_buf_remove (ctx->fh.m2m_ctx); +v4l2_m2m_buf_done (src_buf, state); + }else if (vb2_get_plane_payload (&src_buf->vb2_buf,0 ) + == ctx->cur_buf_offset) { + src_buf->sequence = q_out->sequence++; + src_buf =v4l2_m2m_src_buf_remove (ctx->fh.m2m_ctx); +v4l2_m2m_buf_done (src_buf, state); + ctx->cur_buf_offset =0 ; + ctx->comp_has_next_frame = false; + } + }else { + src_buf =v4l2_m2m_src_buf_remove (ctx->fh.m2m_ctx); +vb2_set_plane_payload (&dst_buf->vb2_buf,0 ,0 ); dst_buf->flags |=V4L2_BUF_FLAG_LAST ;v4l2_event_queue_fh (&ctx->fh, &eos_event); } -if (ctx->is_enc) { - src_buf->sequence = q_out->sequence++; - src_buf =v4l2_m2m_src_buf_remove (ctx->fh.m2m_ctx); -v4l2_m2m_buf_done (src_buf, state); - }else if (vb2_get_plane_payload (&src_buf->vb2_buf,0 ) == ctx->cur_buf_offset) { - src_buf->sequence = q_out->sequence++; - src_buf =v4l2_m2m_src_buf_remove (ctx->fh.m2m_ctx); -v4l2_m2m_buf_done (src_buf, state); - ctx->cur_buf_offset =0 ; - ctx->comp_has_next_frame = false; - }v4l2_m2m_buf_done (dst_buf, state); ctx->comp_size =0 ; ctx->comp_magic_cnt =0 ;
@@ -282,6 +293,8 @@ static int job_ready(void *priv) src_buf =v4l2_m2m_next_src_buf (ctx->fh.m2m_ctx);if (!src_buf)return 0 ; +if (src_buf == &ctx->flush_buf) +return 1 ; p_out =vb2_plane_vaddr (&src_buf->vb2_buf,0 ); sz =vb2_get_plane_payload (&src_buf->vb2_buf,0 ); p = p_out + ctx->cur_buf_offset;
@@ -740,21 +753,6 @@ static int vidioc_s_fmt_vid_out(struct file *file, void *priv,return ret; } -static void vicodec_mark_last_buf (struct vicodec_ctx *ctx) -{ -static const struct v4l2_event eos_event = { - .type =V4L2_EVENT_EOS - }; - -spin_lock (ctx->lock); - ctx->last_src_buf =v4l2_m2m_last_src_buf (ctx->fh.m2m_ctx); -if (!ctx->last_src_buf && ctx->last_dst_buf) { - ctx->last_dst_buf->flags |=V4L2_BUF_FLAG_LAST ; -v4l2_event_queue_fh (&ctx->fh, &eos_event); - } -spin_unlock (ctx->lock); -} -static int vicodec_try_encoder_cmd (struct file *file,void *fh,struct v4l2_encoder_cmd *ec) {
@@ -776,8 +774,8 @@ static int vicodec_encoder_cmd(struct file *file, void *fh, ret =vicodec_try_encoder_cmd (file, fh, ec);if (ret <0 )return ret; - -vicodec_mark_last_buf (ctx); +v4l2_m2m_buf_queue (ctx->fh.m2m_ctx, &ctx->flush_buf); +v4l2_m2m_try_schedule (ctx->fh.m2m_ctx);return 0 ; }
@@ -805,8 +803,8 @@ static int vicodec_decoder_cmd(struct file *file, void *fh, ret =vicodec_try_decoder_cmd (file, fh, dc);if (ret <0 )return ret; - -vicodec_mark_last_buf (ctx); +v4l2_m2m_buf_queue (ctx->fh.m2m_ctx, &ctx->flush_buf); +v4l2_m2m_try_schedule (ctx->fh.m2m_ctx);return 0 ; }
@@ -961,7 +959,7 @@ static void vicodec_return_bufs(struct vb2_queue *q, u32 state) vbuf =v4l2_m2m_src_buf_remove (ctx->fh.m2m_ctx); else vbuf =v4l2_m2m_dst_buf_remove (ctx->fh.m2m_ctx); -if (vbuf ==NULL ) +if (!vbuf || vbuf == &ctx->flush_buf)return ;spin_lock (ctx->lock);v4l2_m2m_buf_done (vbuf, state);
@@ -1001,7 +999,6 @@ static int vicodec_start_streaming(struct vb2_queue *q, state->ref_frame.cb = state->ref_frame.luma + size; state->ref_frame.cr = state->ref_frame.cb + size / chroma_div; ctx->last_src_buf =NULL ; - ctx->last_dst_buf =NULL ; state->gop_cnt =0 ; ctx->cur_buf_offset =0 ; ctx->comp_size =0 ;
@@ -1129,6 +1126,7 @@ static int vicodec_open(struct file *file)struct vicodec_ctx *ctx =NULL ;struct v4l2_ctrl_handler *hdl;struct v4l2_pix_format pixfmt; +struct vb2_queue *vq;int rc =0 ;if (mutex_lock_interruptible (vfd->lock))
@@ -1200,6 +1198,16 @@ static int vicodec_open(struct file *file)v4l2_fh_add (&ctx->fh); +/* Setup a dummy flush buffer, used to signal +* encoding/decoding stop operation. When this buffer +* is queued to the OUTPUT queue, the driver will send +* V4L2_EVENT_EOS and send the last buffer to userspace. +*/ + vq =v4l2_m2m_get_vq (ctx->fh.m2m_ctx, multiplanar ? +V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE : +V4L2_BUF_TYPE_VIDEO_OUTPUT ); + ctx->flush_buf.vb2_buf.vb2_queue = vq; + open_unlock:mutex_unlock (vfd->lock);return rc;
Signature · 1 line
2.19.1
Hi Ezequiel,
Quoted 22 lines · Ezequiel Garcia
Given the stateful codec specification is still a moving target, it doesn't make any sense to try to comply fully with it.
On the other side, we can still comply with some basic userspace expectations, with just a couple small changes.
This series implements proper resolution changes propagation, and fixes the
CMD_STOPso it actually works.The intention of this series is to be able to test this driver using already existing userspace, gstreamer in particular. With this changes, it's possible to construct variations of this pipeline:
gst-launch-1.0 videotestsrc ! v4l2fwhtenc ! v4l2fwhtdec ! fakevideosink
Also, as discussed in v1 feedback [1,2], I'm including pixel format helpers, as RFC for now. Hans, Tomasz: is this what you had in mind?
[1] https://www.spinics.net/lists/linux-media/msg141912.html
[2] https://www.spinics.net/lists/linux-media/msg142099.html
Quoted 7 lines
v2:
* Add more info to commit logs
* Propagate changes on both encoders and decoders
* Add pixel format helpersEzequiel Garcia (4):
media: Introduce helpers to fill pixel format structs
This one has been applied (or probably a later version) already.
Quoted 1 line
vicodec: Use pixel format helpers
This doesn't apply anymore, but it would be useful to have.
If you can rebase it, then that would be nice.
Quoted 2 lines
vicodec: Propagate changes to the CAPTURE queue
vicodec: Implement spec-compliant stop command
This two are obsolete as far as I know. The vicodec driver should handle this correctly now. If you think otherwise, please let me know.
Regards,
Hans
Quoted 13 lines
.../media/platform/vicodec/codec-v4l2-fwht.c | 42 ++-- .../media/platform/vicodec/codec-v4l2-fwht.h | 3 - drivers/media/platform/vicodec/vicodec-core.c | 197 +++++++++--------- drivers/media/v4l2-core/Makefile | 2 +- drivers/media/v4l2-core/v4l2-common.c | 66 ++++++ drivers/media/v4l2-core/v4l2-fourcc.c | 93 +++++++++ include/media/v4l2-common.h | 5 + include/media/v4l2-fourcc.h | 53 +++++ 8 files changed, 332 insertions(+), 129 deletions(-) create mode 100644 drivers/media/v4l2-core/v4l2-fourcc.c create mode 100644 include/media/v4l2-fourcc.h
Quoted 33 lines · Hans Verkuil
Hi Ezequiel,
Quoted 22 lines · Ezequiel Garcia
Given the stateful codec specification is still a moving target, it doesn't make any sense to try to comply fully with it.
On the other side, we can still comply with some basic userspace expectations, with just a couple small changes.
This series implements proper resolution changes propagation, and fixes the
CMD_STOPso it actually works.The intention of this series is to be able to test this driver using already existing userspace, gstreamer in particular. With this changes, it's possible to construct variations of this pipeline:
gst-launch-1.0 videotestsrc ! v4l2fwhtenc ! v4l2fwhtdec ! fakevideosink
Also, as discussed in v1 feedback [1,2], I'm including pixel format helpers, as RFC for now. Hans, Tomasz: is this what you had in mind?
[1] https://www.spinics.net/lists/linux-media/msg141912.html
[2] https://www.spinics.net/lists/linux-media/msg142099.htmlQuoted 7 lines
v2:
* Add more info to commit logs
* Propagate changes on both encoders and decoders
* Add pixel format helpersEzequiel Garcia (4):
media: Introduce helpers to fill pixel format structs
Quoted 8 lines
This one has been applied (or probably a later version) already.
Quoted 1 line
vicodec: Use pixel format helpers
This doesn't apply anymore, but it would be useful to have.
If you can rebase it, then that would be nice.
Sure.
Quoted 6 lines
Quoted 2 lines
vicodec: Propagate changes to the CAPTURE queue
vicodec: Implement spec-compliant stop commandThis two are obsolete as far as I know. The vicodec driver should handle this correctly now. If you think otherwise, please let me know.
Sure, let me re-test it.
Thanks,