From 3f9fcc4c84c6493988ab7dc4e82bf836be56714e Mon Sep 17 00:00:00 2001 From: Christian Hewitt Date: Mon, 1 Feb 2021 21:59:51 +0100 Subject: media: rc: add keymap for minix-neo remote Add a keymap and bindings for the simple IR (NEC) remote used with Minix 'NEO' branded Android STB devices. Signed-off-by: Christian Hewitt Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- include/media/rc-map.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/media') diff --git a/include/media/rc-map.h b/include/media/rc-map.h index 999b750bc6b8..a6fca9cc761f 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -273,6 +273,7 @@ struct rc_map *rc_map_get(const char *name); #define RC_MAP_MEDION_X10 "rc-medion-x10" #define RC_MAP_MEDION_X10_DIGITAINER "rc-medion-x10-digitainer" #define RC_MAP_MEDION_X10_OR2X "rc-medion-x10-or2x" +#define RC_MAP_MINIX_NEO "rc-minix-neo" #define RC_MAP_MSI_DIGIVOX_II "rc-msi-digivox-ii" #define RC_MAP_MSI_DIGIVOX_III "rc-msi-digivox-iii" #define RC_MAP_MSI_TVANYWHERE "rc-msi-tvanywhere" -- cgit v1.2.3-59-g8ed1b From 34d5fc1e0da1698783efd227c6cc46f0f4124148 Mon Sep 17 00:00:00 2001 From: Bastien Nocera Date: Tue, 26 Jan 2021 18:40:33 +0100 Subject: media: rc: add keymap for Xbox 360 Universal Media remote Captured using a raw IR receiver. Manual linked in the remote definition itself. Signed-off-by: Bastien Nocera Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- Documentation/devicetree/bindings/media/rc.yaml | 1 + drivers/media/rc/keymaps/Makefile | 1 + drivers/media/rc/keymaps/rc-xbox-360.c | 83 +++++++++++++++++++++++++ include/media/rc-map.h | 1 + 4 files changed, 86 insertions(+) create mode 100644 drivers/media/rc/keymaps/rc-xbox-360.c (limited to 'include/media') diff --git a/Documentation/devicetree/bindings/media/rc.yaml b/Documentation/devicetree/bindings/media/rc.yaml index cbffdd6a470d..3bedc95b71ce 100644 --- a/Documentation/devicetree/bindings/media/rc.yaml +++ b/Documentation/devicetree/bindings/media/rc.yaml @@ -151,6 +151,7 @@ properties: - rc-winfast - rc-winfast-usbii-deluxe - rc-x96max + - rc-xbox-360 - rc-xbox-dvd - rc-zx-irdec diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile index b7f53f44c5c8..7434ecbb7ca0 100644 --- a/drivers/media/rc/keymaps/Makefile +++ b/drivers/media/rc/keymaps/Makefile @@ -128,6 +128,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-winfast.o \ rc-winfast-usbii-deluxe.o \ rc-su3000.o \ + rc-xbox-360.o \ rc-xbox-dvd.o \ rc-x96max.o \ rc-zx-irdec.o diff --git a/drivers/media/rc/keymaps/rc-xbox-360.c b/drivers/media/rc/keymaps/rc-xbox-360.c new file mode 100644 index 000000000000..231aa00514af --- /dev/null +++ b/drivers/media/rc/keymaps/rc-xbox-360.c @@ -0,0 +1,83 @@ +// SPDX-License-Identifier: GPL-2.0+ +// Keytable for Xbox 360 Universal Media remote +// Copyright (c) 2021 Bastien Nocera + +#include +#include + +/* + * Manual for remote available at: + * http://download.microsoft.com/download/b/c/e/bce76f3f-db51-4c98-b79d-b3d21e90ccc1/universalmediaremote_na_0609.pdf + */ +static struct rc_map_table xbox_360[] = { + {KEY_EJECTCD, 0x800f7428}, + {KEY_HOMEPAGE, 0x800f7464}, + {KEY_POWER, 0x800f740c}, + {KEY_STOP, 0x800f7419}, + {KEY_PAUSE, 0x800f7418}, + {KEY_REWIND, 0x800f7415}, + {KEY_FASTFORWARD, 0x800f7414}, + {KEY_PREVIOUS, 0x800f741b}, + {KEY_NEXT, 0x800f741a}, + {KEY_PLAY, 0x800f7416}, + {KEY_PROPS, 0x800f744f}, /* "Display" */ + {KEY_BACK, 0x800f7423}, + {KEY_MEDIA_TOP_MENU, 0x800f7424}, /* "DVD Menu" */ + {KEY_ROOT_MENU, 0x800f7451}, /* "Title" */ + {KEY_INFO, 0x800f740f}, + {KEY_UP, 0x800f741e}, + {KEY_LEFT, 0x800f7420}, + {KEY_RIGHT, 0x800f7421}, + {KEY_DOWN, 0x800f741f}, + {KEY_OK, 0x800f7422}, + {KEY_YELLOW, 0x800f7426}, + {KEY_BLUE, 0x800f7468}, + {KEY_GREEN, 0x800f7466}, + {KEY_RED, 0x800f7425}, + {KEY_VOLUMEUP, 0x800f7410}, + {KEY_VOLUMEDOWN, 0x800f7411}, + /* TV key doesn't light the IR LED */ + {KEY_MUTE, 0x800f740e}, + {KEY_CHANNELUP, 0x800f746c}, + {KEY_CHANNELDOWN, 0x800f746d}, + {KEY_LEFTMETA, 0x800f740d}, + {KEY_ENTER, 0x800f740b}, + {KEY_RECORD, 0x800f7417}, + {KEY_CLEAR, 0x800f740a}, + {KEY_NUMERIC_1, 0x800f7401}, + {KEY_NUMERIC_2, 0x800f7402}, + {KEY_NUMERIC_3, 0x800f7403}, + {KEY_NUMERIC_4, 0x800f7404}, + {KEY_NUMERIC_5, 0x800f7405}, + {KEY_NUMERIC_6, 0x800f7406}, + {KEY_NUMERIC_7, 0x800f7407}, + {KEY_NUMERIC_8, 0x800f7408}, + {KEY_NUMERIC_9, 0x800f7409}, + {KEY_NUMERIC_0, 0x800f7400}, + {KEY_102ND, 0x800f741d}, /* "100" */ + {KEY_CANCEL, 0x800f741c}, +}; + +static struct rc_map_list xbox_360_map = { + .map = { + .scan = xbox_360, + .size = ARRAY_SIZE(xbox_360), + .rc_proto = RC_PROTO_RC6_MCE, + .name = RC_MAP_XBOX_360, + } +}; + +static int __init init_rc_map(void) +{ + return rc_map_register(&xbox_360_map); +} + +static void __exit exit_rc_map(void) +{ + rc_map_unregister(&xbox_360_map); +} + +module_init(init_rc_map) +module_exit(exit_rc_map) + +MODULE_LICENSE("GPL"); diff --git a/include/media/rc-map.h b/include/media/rc-map.h index a6fca9cc761f..2617917e902f 100644 --- a/include/media/rc-map.h +++ b/include/media/rc-map.h @@ -332,6 +332,7 @@ struct rc_map *rc_map_get(const char *name); #define RC_MAP_WINFAST "rc-winfast" #define RC_MAP_WINFAST_USBII_DELUXE "rc-winfast-usbii-deluxe" #define RC_MAP_X96MAX "rc-x96max" +#define RC_MAP_XBOX_360 "rc-xbox-360" #define RC_MAP_XBOX_DVD "rc-xbox-dvd" #define RC_MAP_ZX_IRDEC "rc-zx-irdec" -- cgit v1.2.3-59-g8ed1b From 6b45fbfa53099259c8038e0626dec8f197d19857 Mon Sep 17 00:00:00 2001 From: Bhaskar Chowdhury Date: Fri, 5 Feb 2021 10:21:17 +0100 Subject: media: include: media: davinci: Fixed up few trivial spellings in the file isif.h Several spelling fixes throughout the file. Signed-off-by: Bhaskar Chowdhury Acked-by: Randy Dunlap Acked-by: Lad Prabhakar Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/davinci/isif.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include/media') diff --git a/include/media/davinci/isif.h b/include/media/davinci/isif.h index e66589c4022d..8369acd26e7e 100644 --- a/include/media/davinci/isif.h +++ b/include/media/davinci/isif.h @@ -177,7 +177,7 @@ struct isif_black_clamp { * 1 - clamp value calculated separately for all colors */ __u8 bc_mode_color; - /* Vrtical start position for bc subtraction */ + /* Vertical start position for bc subtraction */ __u16 vert_start_sub; /* Black clamp for horizontal direction */ struct isif_horz_bclamp horz; @@ -193,7 +193,7 @@ struct isif_color_space_conv { /* Enable color space conversion */ __u8 en; /* - * csc coeffient table. S8Q5, M00 at index 0, M01 at index 1, and + * csc coefficient table. S8Q5, M00 at index 0, M01 at index 1, and * so forth */ struct isif_float_8 coeff[ISIF_CSC_NUM_COEFF]; @@ -340,7 +340,7 @@ struct isif_data_formatter { }; struct isif_df_csc { - /* Color Space Conversion confguration, 0 - csc, 1 - df */ + /* Color Space Conversion configuration, 0 - csc, 1 - df */ __u8 df_or_csc; /* csc configuration valid if df_or_csc is 0 */ struct isif_color_space_conv csc; @@ -406,7 +406,7 @@ struct isif_config_params_raw { struct isif_linearize linearize; /* Data formatter or CSC */ struct isif_df_csc df_csc; - /* Defect Pixel Correction (DFC) confguration */ + /* Defect Pixel Correction (DFC) configuration */ struct isif_dfc dfc; /* Black/Digital Clamp configuration */ struct isif_black_clamp bclamp; -- cgit v1.2.3-59-g8ed1b From 6f097ddb8072323b688f8fbd6729e70fcc26ff5c Mon Sep 17 00:00:00 2001 From: Jonathan Neuschäfer Date: Fri, 1 Jan 2021 17:02:11 +0100 Subject: media: dvbdev: Switch to new kerneldoc syntax for named variable macro argument MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The syntax without dots is available since commit 43756e347f21 ("scripts/kernel-doc: Add support for named variable macro arguments"). The same HTML output is produced with and without this patch. Signed-off-by: Jonathan Neuschäfer Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/dvbdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/media') diff --git a/include/media/dvbdev.h b/include/media/dvbdev.h index b04a38be5183..2f6b0861322a 100644 --- a/include/media/dvbdev.h +++ b/include/media/dvbdev.h @@ -421,7 +421,7 @@ void dvb_module_release(struct i2c_client *client); * dvb_attach - attaches a DVB frontend into the DVB core. * * @FUNCTION: function on a frontend module to be called. - * @ARGS...: @FUNCTION arguments. + * @ARGS: @FUNCTION arguments. * * This ancillary function loads a frontend module in runtime and runs * the @FUNCTION function there, with @ARGS. -- cgit v1.2.3-59-g8ed1b From dbedd2f4901e8e86f78d30b7f586a1987d83a69e Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 15 Feb 2021 05:27:20 +0100 Subject: media: v4l2-mc: Add link flags to v4l2_create_fwnode_links_to_pad() Add a flags argument to the v4l2_create_fwnode_links_to_pad() function to specify the link flags. This allows drivers to create immutable links for instance. Signed-off-by: Laurent Pinchart Reviewed-by: Rui Miguel Silva Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-mc.c | 6 +++--- drivers/staging/media/imx/imx-media-csi.c | 2 +- drivers/staging/media/imx/imx6-mipi-csi2.c | 2 +- drivers/staging/media/imx/imx7-media-csi.c | 2 +- drivers/staging/media/imx/imx7-mipi-csis.c | 2 +- include/media/v4l2-mc.h | 8 +++++++- 6 files changed, 14 insertions(+), 8 deletions(-) (limited to 'include/media') diff --git a/drivers/media/v4l2-core/v4l2-mc.c b/drivers/media/v4l2-core/v4l2-mc.c index ba2f2b8dcc8c..cba3d8e0bc4a 100644 --- a/drivers/media/v4l2-core/v4l2-mc.c +++ b/drivers/media/v4l2-core/v4l2-mc.c @@ -310,7 +310,7 @@ int v4l_vb2q_enable_media_source(struct vb2_queue *q) EXPORT_SYMBOL_GPL(v4l_vb2q_enable_media_source); int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd, - struct media_pad *sink) + struct media_pad *sink, u32 flags) { struct fwnode_handle *endpoint; struct v4l2_subdev *sink_sd; @@ -367,7 +367,7 @@ int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd, sink_sd->entity.name, sink_idx); ret = media_create_pad_link(&src_sd->entity, src_idx, - &sink_sd->entity, sink_idx, 0); + &sink_sd->entity, sink_idx, flags); if (ret) { dev_err(sink_sd->dev, "link %s:%d -> %s:%d failed with %d\n", @@ -395,7 +395,7 @@ int v4l2_create_fwnode_links(struct v4l2_subdev *src_sd, if (!(pad->flags & MEDIA_PAD_FL_SINK)) continue; - ret = v4l2_create_fwnode_links_to_pad(src_sd, pad); + ret = v4l2_create_fwnode_links_to_pad(src_sd, pad, 0); if (ret) return ret; } diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index 8d02939aaa23..e3bfd635a89a 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -1894,7 +1894,7 @@ static int imx_csi_notify_bound(struct v4l2_async_notifier *notifier, if (sd->entity.function == MEDIA_ENT_F_VID_MUX) sd->grp_id = IMX_MEDIA_GRP_ID_CSI_MUX; - return v4l2_create_fwnode_links_to_pad(sd, sink); + return v4l2_create_fwnode_links_to_pad(sd, sink, 0); } static const struct v4l2_async_notifier_operations csi_notify_ops = { diff --git a/drivers/staging/media/imx/imx6-mipi-csi2.c b/drivers/staging/media/imx/imx6-mipi-csi2.c index 9020541edb89..fc2378ac04b7 100644 --- a/drivers/staging/media/imx/imx6-mipi-csi2.c +++ b/drivers/staging/media/imx/imx6-mipi-csi2.c @@ -621,7 +621,7 @@ static int csi2_notify_bound(struct v4l2_async_notifier *notifier, dev_dbg(csi2->dev, "Bound %s pad: %d\n", sd->name, pad); - return v4l2_create_fwnode_links_to_pad(sd, sink); + return v4l2_create_fwnode_links_to_pad(sd, sink, 0); } static void csi2_notify_unbind(struct v4l2_async_notifier *notifier, diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index 763235447422..69eac1cb4599 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -1128,7 +1128,7 @@ static int imx7_csi_notify_bound(struct v4l2_async_notifier *notifier, if (sd->entity.function == MEDIA_ENT_F_VID_MUX) sd->grp_id = IMX_MEDIA_GRP_ID_CSI_MUX; - return v4l2_create_fwnode_links_to_pad(sd, sink); + return v4l2_create_fwnode_links_to_pad(sd, sink, 0); } static const struct v4l2_async_notifier_operations imx7_csi_notify_ops = { diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c index a01a7364b4b9..8cf860544b0a 100644 --- a/drivers/staging/media/imx/imx7-mipi-csis.c +++ b/drivers/staging/media/imx/imx7-mipi-csis.c @@ -962,7 +962,7 @@ static int mipi_csis_notify_bound(struct v4l2_async_notifier *notifier, struct csi_state *state = mipi_notifier_to_csis_state(notifier); struct media_pad *sink = &state->mipi_sd.entity.pads[CSIS_PAD_SINK]; - return v4l2_create_fwnode_links_to_pad(sd, sink); + return v4l2_create_fwnode_links_to_pad(sd, sink, 0); } static const struct v4l2_async_notifier_operations mipi_csis_notify_ops = { diff --git a/include/media/v4l2-mc.h b/include/media/v4l2-mc.h index bdaa5f2f8ca2..c181685923d5 100644 --- a/include/media/v4l2-mc.h +++ b/include/media/v4l2-mc.h @@ -91,6 +91,7 @@ int v4l_vb2q_enable_media_source(struct vb2_queue *q); * * @src_sd: pointer to a source subdev * @sink: pointer to a subdev sink pad + * @flags: the link flags * * This function searches for fwnode endpoint connections from a source * subdevice to a single sink pad, and if suitable connections are found, @@ -98,6 +99,11 @@ int v4l_vb2q_enable_media_source(struct vb2_queue *q); * called by the sink subdevice, in its v4l2-async notifier subdev bound * callback, to create links from a bound source subdevice. * + * The @flags argument specifies the link flags. The caller shall ensure that + * the flags are valid regardless of the number of links that may be created. + * For instance, setting the MEDIA_LNK_FL_ENABLED flag will cause all created + * links to be enabled, which isn't valid if more than one link is created. + * * .. note:: * * Any sink subdevice that calls this function must implement the @@ -107,7 +113,7 @@ int v4l_vb2q_enable_media_source(struct vb2_queue *q); * Return 0 on success or a negative error code on failure. */ int v4l2_create_fwnode_links_to_pad(struct v4l2_subdev *src_sd, - struct media_pad *sink); + struct media_pad *sink, u32 flags); /** * v4l2_create_fwnode_links - Create fwnode-based links from a source -- cgit v1.2.3-59-g8ed1b From d04c114e806f93135e3584bb7016aefa414322fb Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Thu, 4 Mar 2021 15:07:48 +0100 Subject: media: uapi: vp8: Remove "header" from symbol names and macros It doesn't seem to add any clarity to have a "header" suffix in controls, struct names and flags. Since this just makes names too long without any benefit, just drop it. Signed-off-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../userspace-api/media/v4l/ext-ctrls-codec.rst | 80 +++++++++--------- .../userspace-api/media/v4l/pixfmt-compressed.rst | 2 +- drivers/media/v4l2-core/v4l2-ctrls.c | 36 ++++---- drivers/staging/media/hantro/hantro_drv.c | 2 +- drivers/staging/media/hantro/hantro_g1_vp8_dec.c | 48 +++++------ drivers/staging/media/hantro/hantro_hw.h | 2 +- drivers/staging/media/hantro/hantro_vp8.c | 10 +-- .../staging/media/hantro/rk3399_vpu_hw_vp8_dec.c | 48 +++++------ drivers/staging/media/sunxi/cedrus/cedrus.c | 2 +- drivers/staging/media/sunxi/cedrus/cedrus.h | 2 +- drivers/staging/media/sunxi/cedrus/cedrus_dec.c | 2 +- drivers/staging/media/sunxi/cedrus/cedrus_vp8.c | 98 +++++++++++----------- include/media/v4l2-ctrls.h | 4 +- include/media/vp8-ctrls.h | 48 +++++------ 14 files changed, 192 insertions(+), 192 deletions(-) (limited to 'include/media') diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index 9963c1c9a4d5..7c778f42f80e 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -1800,7 +1800,7 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - .. _v4l2-mpeg-vp8: -``V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER (struct)`` +``V4L2_CID_MPEG_VIDEO_VP8_FRAME (struct)`` Specifies the frame parameters for the associated VP8 parsed frame data. This includes the necessary parameters for configuring a stateless hardware decoding pipeline for VP8. @@ -1811,7 +1811,7 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - This compound control is not yet part of the public kernel API and it is expected to change. -.. c:type:: v4l2_ctrl_vp8_frame_header +.. c:type:: v4l2_ctrl_vp8_frame .. raw:: latex @@ -1821,22 +1821,22 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - .. cssclass:: longtable -.. flat-table:: struct v4l2_ctrl_vp8_frame_header +.. flat-table:: struct v4l2_ctrl_vp8_frame :header-rows: 0 :stub-columns: 0 :widths: 1 1 2 - * - struct :c:type:`v4l2_vp8_segment_header` - - ``segment_header`` + * - struct :c:type:`v4l2_vp8_segment` + - ``segment`` - Structure with segment-based adjustments metadata. - * - struct :c:type:`v4l2_vp8_loopfilter_header` - - ``loopfilter_header`` + * - struct :c:type:`v4l2_vp8_loopfilter` + - ``lf`` - Structure with loop filter level adjustments metadata. - * - struct :c:type:`v4l2_vp8_quantization_header` - - ``quant_header`` + * - struct :c:type:`v4l2_vp8_quantization` + - ``quant`` - Structure with VP8 dequantization indices metadata. - * - struct :c:type:`v4l2_vp8_entropy_header` - - ``entropy_header`` + * - struct :c:type:`v4l2_vp8_entropy` + - ``entropy`` - Structure with VP8 entropy coder probabilities metadata. * - struct :c:type:`v4l2_vp8_entropy_coder_state` - ``coder_state`` @@ -1905,15 +1905,15 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - :c:type:`v4l2_buffer` to a __u64. * - __u64 - ``flags`` - - See :ref:`Frame Header Flags ` + - See :ref:`Frame Flags ` .. raw:: latex \normalsize -.. _vp8_frame_header_flags: +.. _vp8_frame_flags: -``Frame Header Flags`` +``Frame Flags`` .. tabularcolumns:: |p{9.8cm}|p{0.8cm}|p{6.7cm}| @@ -1924,22 +1924,22 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - :stub-columns: 0 :widths: 1 1 2 - * - ``V4L2_VP8_FRAME_HEADER_FLAG_KEY_FRAME`` + * - ``V4L2_VP8_FRAME_FLAG_KEY_FRAME`` - 0x01 - Indicates if the frame is a key frame. - * - ``V4L2_VP8_FRAME_HEADER_FLAG_EXPERIMENTAL`` + * - ``V4L2_VP8_FRAME_FLAG_EXPERIMENTAL`` - 0x02 - Experimental bitstream. - * - ``V4L2_VP8_FRAME_HEADER_FLAG_SHOW_FRAME`` + * - ``V4L2_VP8_FRAME_FLAG_SHOW_FRAME`` - 0x04 - Show frame flag, indicates if the frame is for display. - * - ``V4L2_VP8_FRAME_HEADER_FLAG_MB_NO_SKIP_COEFF`` + * - ``V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF`` - 0x08 - Enable/disable skipping of macroblocks with no non-zero coefficients. - * - ``V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_GOLDEN`` + * - ``V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN`` - 0x10 - Sign of motion vectors when the golden frame is referenced. - * - ``V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_ALT`` + * - ``V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT`` - 0x20 - Sign of motion vectors when the alt frame is referenced. @@ -1967,13 +1967,13 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - - ``padding`` - Applications and drivers must set this to zero. -.. c:type:: v4l2_vp8_segment_header +.. c:type:: v4l2_vp8_segment .. cssclass:: longtable .. tabularcolumns:: |p{1.2cm}|p{4.0cm}|p{12.1cm}| -.. flat-table:: struct v4l2_vp8_segment_header +.. flat-table:: struct v4l2_vp8_segment :header-rows: 0 :stub-columns: 0 :widths: 1 1 2 @@ -1992,11 +1992,11 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - - Applications and drivers must set this to zero. * - __u32 - ``flags`` - - See :ref:`Segment Header Flags ` + - See :ref:`Segment Flags ` -.. _vp8_segment_header_flags: +.. _vp8_segment_flags: -``Segment Header Flags`` +``Segment Flags`` .. raw:: latex @@ -2009,16 +2009,16 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - :stub-columns: 0 :widths: 1 1 2 - * - ``V4L2_VP8_SEGMENT_HEADER_FLAG_ENABLED`` + * - ``V4L2_VP8_SEGMENT_FLAG_ENABLED`` - 0x01 - Enable/disable segment-based adjustments. - * - ``V4L2_VP8_SEGMENT_HEADER_FLAG_UPDATE_MAP`` + * - ``V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP`` - 0x02 - Indicates if the macroblock segmentation map is updated in this frame. - * - ``V4L2_VP8_SEGMENT_HEADER_FLAG_UPDATE_FEATURE_DATA`` + * - ``V4L2_VP8_SEGMENT_FLAG_UPDATE_FEATURE_DATA`` - 0x04 - Indicates if the segment feature data is updated in this frame. - * - ``V4L2_VP8_SEGMENT_HEADER_FLAG_DELTA_VALUE_MODE`` + * - ``V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE`` - 0x08 - If is set, the segment feature data mode is delta-value. If cleared, it's absolute-value. @@ -2027,13 +2027,13 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - \normalsize -.. c:type:: v4l2_vp8_loopfilter_header +.. c:type:: v4l2_vp8_loopfilter .. cssclass:: longtable .. tabularcolumns:: |p{1.5cm}|p{3.9cm}|p{11.9cm}| -.. flat-table:: struct v4l2_vp8_loopfilter_header +.. flat-table:: struct v4l2_vp8_loopfilter :header-rows: 0 :stub-columns: 0 :widths: 1 1 2 @@ -2055,11 +2055,11 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - - Applications and drivers must set this to zero. * - __u32 - ``flags`` - - See :ref:`Loopfilter Header Flags ` + - See :ref:`Loopfilter Flags ` -.. _vp8_loopfilter_header_flags: +.. _vp8_loopfilter_flags: -``Loopfilter Header Flags`` +``Loopfilter Flags`` .. tabularcolumns:: |p{7.0cm}|p{1.2cm}|p{9.1cm}| @@ -2068,10 +2068,10 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - :stub-columns: 0 :widths: 1 1 2 - * - ``V4L2_VP8_LF_HEADER_ADJ_ENABLE`` + * - ``V4L2_VP8_LF_ADJ_ENABLE`` - 0x01 - Enable/disable macroblock-level loop filter adjustment. - * - ``V4L2_VP8_LF_HEADER_DELTA_UPDATE`` + * - ``V4L2_VP8_LF_DELTA_UPDATE`` - 0x02 - Indicates if the delta values used in an adjustment are updated. * - ``V4L2_VP8_LF_FILTER_TYPE_SIMPLE`` @@ -2079,11 +2079,11 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - - If set, indicates the filter type is simple. If cleared, the filter type is normal. -.. c:type:: v4l2_vp8_quantization_header +.. c:type:: v4l2_vp8_quantization .. tabularcolumns:: |p{1.5cm}|p{3.5cm}|p{12.3cm}| -.. flat-table:: struct v4l2_vp8_quantization_header +.. flat-table:: struct v4l2_vp8_quantization :header-rows: 0 :stub-columns: 0 :widths: 1 1 2 @@ -2110,13 +2110,13 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - - ``padding`` - Applications and drivers must set this to zero. -.. c:type:: v4l2_vp8_entropy_header +.. c:type:: v4l2_vp8_entropy .. cssclass:: longtable .. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}| -.. flat-table:: struct v4l2_vp8_entropy_header +.. flat-table:: struct v4l2_vp8_entropy :header-rows: 0 :stub-columns: 0 :widths: 1 1 2 diff --git a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst index ba6c0c961204..7341c9b4516b 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst @@ -157,7 +157,7 @@ Compressed Formats This format is adapted for stateless video decoders that implement a VP8 pipeline (using the :ref:`mem2mem` and :ref:`media-request-api`). Metadata associated with the frame to decode is required to be passed - through the ``V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER`` control. + through the ``V4L2_CID_MPEG_VIDEO_VP8_FRAME`` control. See the :ref:`associated Codec Control IDs `. Exactly one output and one capture buffer must be provided for use with this pixel format. The output buffer must contain the appropriate number diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index ca50e21e2838..458051e684e6 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -974,7 +974,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MPEG_VIDEO_VP8_PROFILE: return "VP8 Profile"; case V4L2_CID_MPEG_VIDEO_VP9_PROFILE: return "VP9 Profile"; case V4L2_CID_MPEG_VIDEO_VP9_LEVEL: return "VP9 Level"; - case V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER: return "VP8 Frame Header"; + case V4L2_CID_MPEG_VIDEO_VP8_FRAME: return "VP8 Frame Parameters"; /* HEVC controls */ case V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP: return "HEVC I-Frame QP Value"; @@ -1476,8 +1476,8 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_STATELESS_H264_PRED_WEIGHTS: *type = V4L2_CTRL_TYPE_H264_PRED_WEIGHTS; break; - case V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER: - *type = V4L2_CTRL_TYPE_VP8_FRAME_HEADER; + case V4L2_CID_MPEG_VIDEO_VP8_FRAME: + *type = V4L2_CTRL_TYPE_VP8_FRAME; break; case V4L2_CID_MPEG_VIDEO_HEVC_SPS: *type = V4L2_CTRL_TYPE_HEVC_SPS; @@ -1648,7 +1648,7 @@ static void std_init_compound(const struct v4l2_ctrl *ctrl, u32 idx, union v4l2_ctrl_ptr ptr) { struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params; - struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header; + struct v4l2_ctrl_vp8_frame *p_vp8_frame; struct v4l2_ctrl_fwht_params *p_fwht_params; void *p = ptr.p + idx * ctrl->elem_size; @@ -1672,9 +1672,9 @@ static void std_init_compound(const struct v4l2_ctrl *ctrl, u32 idx, p_mpeg2_slice_params->picture.picture_coding_type = V4L2_MPEG2_PICTURE_CODING_TYPE_I; break; - case V4L2_CTRL_TYPE_VP8_FRAME_HEADER: - p_vp8_frame_header = p; - p_vp8_frame_header->num_dct_parts = 1; + case V4L2_CTRL_TYPE_VP8_FRAME: + p_vp8_frame = p; + p_vp8_frame->num_dct_parts = 1; break; case V4L2_CTRL_TYPE_FWHT_PARAMS: p_fwht_params = p; @@ -1829,7 +1829,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, union v4l2_ctrl_ptr ptr) { struct v4l2_ctrl_mpeg2_slice_params *p_mpeg2_slice_params; - struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header; + struct v4l2_ctrl_vp8_frame *p_vp8_frame; struct v4l2_ctrl_fwht_params *p_fwht_params; struct v4l2_ctrl_h264_sps *p_h264_sps; struct v4l2_ctrl_h264_pps *p_h264_pps; @@ -2052,10 +2052,10 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, zero_reserved(*p_h264_dec_params); break; - case V4L2_CTRL_TYPE_VP8_FRAME_HEADER: - p_vp8_frame_header = p; + case V4L2_CTRL_TYPE_VP8_FRAME: + p_vp8_frame = p; - switch (p_vp8_frame_header->num_dct_parts) { + switch (p_vp8_frame->num_dct_parts) { case 1: case 2: case 4: @@ -2064,11 +2064,11 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, default: return -EINVAL; } - zero_padding(p_vp8_frame_header->segment_header); - zero_padding(p_vp8_frame_header->lf_header); - zero_padding(p_vp8_frame_header->quant_header); - zero_padding(p_vp8_frame_header->entropy_header); - zero_padding(p_vp8_frame_header->coder_state); + zero_padding(p_vp8_frame->segment); + zero_padding(p_vp8_frame->lf); + zero_padding(p_vp8_frame->quant); + zero_padding(p_vp8_frame->entropy); + zero_padding(p_vp8_frame->coder_state); break; case V4L2_CTRL_TYPE_HEVC_SPS: @@ -2815,8 +2815,8 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, case V4L2_CTRL_TYPE_H264_PRED_WEIGHTS: elem_size = sizeof(struct v4l2_ctrl_h264_pred_weights); break; - case V4L2_CTRL_TYPE_VP8_FRAME_HEADER: - elem_size = sizeof(struct v4l2_ctrl_vp8_frame_header); + case V4L2_CTRL_TYPE_VP8_FRAME: + elem_size = sizeof(struct v4l2_ctrl_vp8_frame); break; case V4L2_CTRL_TYPE_HEVC_SPS: elem_size = sizeof(struct v4l2_ctrl_hevc_sps); diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index e5f200e64993..f1e7f0732e27 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -299,7 +299,7 @@ static const struct hantro_ctrl controls[] = { }, { .codec = HANTRO_VP8_DECODER, .cfg = { - .id = V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER, + .id = V4L2_CID_MPEG_VIDEO_VP8_FRAME, }, }, { .codec = HANTRO_H264_DECODER, diff --git a/drivers/staging/media/hantro/hantro_g1_vp8_dec.c b/drivers/staging/media/hantro/hantro_g1_vp8_dec.c index a5cdf150cd16..07acb4ea5dd0 100644 --- a/drivers/staging/media/hantro/hantro_g1_vp8_dec.c +++ b/drivers/staging/media/hantro/hantro_g1_vp8_dec.c @@ -133,17 +133,17 @@ static const struct hantro_reg vp8_dec_pred_bc_tap[8][4] = { * Set loop filters */ static void cfg_lf(struct hantro_ctx *ctx, - const struct v4l2_ctrl_vp8_frame_header *hdr) + const struct v4l2_ctrl_vp8_frame *hdr) { - const struct v4l2_vp8_segment_header *seg = &hdr->segment_header; - const struct v4l2_vp8_loopfilter_header *lf = &hdr->lf_header; + const struct v4l2_vp8_segment *seg = &hdr->segment; + const struct v4l2_vp8_loopfilter *lf = &hdr->lf; struct hantro_dev *vpu = ctx->dev; unsigned int i; u32 reg; - if (!(seg->flags & V4L2_VP8_SEGMENT_HEADER_FLAG_ENABLED)) { + if (!(seg->flags & V4L2_VP8_SEGMENT_FLAG_ENABLED)) { hantro_reg_write(vpu, &vp8_dec_lf_level[0], lf->level); - } else if (seg->flags & V4L2_VP8_SEGMENT_HEADER_FLAG_DELTA_VALUE_MODE) { + } else if (seg->flags & V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE) { for (i = 0; i < 4; i++) { u32 lf_level = clamp(lf->level + seg->lf_update[i], 0, 63); @@ -161,7 +161,7 @@ static void cfg_lf(struct hantro_ctx *ctx, reg |= G1_REG_REF_PIC_FILT_TYPE_E; vdpu_write_relaxed(vpu, reg, G1_REG_REF_PIC(0)); - if (lf->flags & V4L2_VP8_LF_HEADER_ADJ_ENABLE) { + if (lf->flags & V4L2_VP8_LF_ADJ_ENABLE) { for (i = 0; i < 4; i++) { hantro_reg_write(vpu, &vp8_dec_mb_adj[i], lf->mb_mode_delta[i]); @@ -175,16 +175,16 @@ static void cfg_lf(struct hantro_ctx *ctx, * Set quantization parameters */ static void cfg_qp(struct hantro_ctx *ctx, - const struct v4l2_ctrl_vp8_frame_header *hdr) + const struct v4l2_ctrl_vp8_frame *hdr) { - const struct v4l2_vp8_quantization_header *q = &hdr->quant_header; - const struct v4l2_vp8_segment_header *seg = &hdr->segment_header; + const struct v4l2_vp8_quantization *q = &hdr->quant; + const struct v4l2_vp8_segment *seg = &hdr->segment; struct hantro_dev *vpu = ctx->dev; unsigned int i; - if (!(seg->flags & V4L2_VP8_SEGMENT_HEADER_FLAG_ENABLED)) { + if (!(seg->flags & V4L2_VP8_SEGMENT_FLAG_ENABLED)) { hantro_reg_write(vpu, &vp8_dec_quant[0], q->y_ac_qi); - } else if (seg->flags & V4L2_VP8_SEGMENT_HEADER_FLAG_DELTA_VALUE_MODE) { + } else if (seg->flags & V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE) { for (i = 0; i < 4; i++) { u32 quant = clamp(q->y_ac_qi + seg->quant_update[i], 0, 127); @@ -230,7 +230,7 @@ static void cfg_qp(struct hantro_ctx *ctx, * 4. the addresses set to the VPU must be 64-bits aligned */ static void cfg_parts(struct hantro_ctx *ctx, - const struct v4l2_ctrl_vp8_frame_header *hdr) + const struct v4l2_ctrl_vp8_frame *hdr) { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *vb2_src; @@ -328,7 +328,7 @@ static void cfg_parts(struct hantro_ctx *ctx, * normal 6-tap filters */ static void cfg_tap(struct hantro_ctx *ctx, - const struct v4l2_ctrl_vp8_frame_header *hdr) + const struct v4l2_ctrl_vp8_frame *hdr) { struct hantro_dev *vpu = ctx->dev; struct hantro_reg reg; @@ -368,7 +368,7 @@ static void cfg_tap(struct hantro_ctx *ctx, } static void cfg_ref(struct hantro_ctx *ctx, - const struct v4l2_ctrl_vp8_frame_header *hdr) + const struct v4l2_ctrl_vp8_frame *hdr) { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *vb2_dst; @@ -385,7 +385,7 @@ static void cfg_ref(struct hantro_ctx *ctx, WARN_ON(!ref && hdr->golden_frame_ts); if (!ref) ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0); - if (hdr->flags & V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_GOLDEN) + if (hdr->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN) ref |= G1_REG_ADDR_REF_TOPC_E; vdpu_write_relaxed(vpu, ref, G1_REG_ADDR_REF(4)); @@ -393,15 +393,15 @@ static void cfg_ref(struct hantro_ctx *ctx, WARN_ON(!ref && hdr->alt_frame_ts); if (!ref) ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0); - if (hdr->flags & V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_ALT) + if (hdr->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT) ref |= G1_REG_ADDR_REF_TOPC_E; vdpu_write_relaxed(vpu, ref, G1_REG_ADDR_REF(5)); } static void cfg_buffers(struct hantro_ctx *ctx, - const struct v4l2_ctrl_vp8_frame_header *hdr) + const struct v4l2_ctrl_vp8_frame *hdr) { - const struct v4l2_vp8_segment_header *seg = &hdr->segment_header; + const struct v4l2_vp8_segment *seg = &hdr->segment; struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *vb2_dst; dma_addr_t dst_dma; @@ -415,9 +415,9 @@ static void cfg_buffers(struct hantro_ctx *ctx, /* Set segment map address */ reg = G1_REG_FWD_PIC1_SEGMENT_BASE(ctx->vp8_dec.segment_map.dma); - if (seg->flags & V4L2_VP8_SEGMENT_HEADER_FLAG_ENABLED) { + if (seg->flags & V4L2_VP8_SEGMENT_FLAG_ENABLED) { reg |= G1_REG_FWD_PIC1_SEGMENT_E; - if (seg->flags & V4L2_VP8_SEGMENT_HEADER_FLAG_UPDATE_MAP) + if (seg->flags & V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP) reg |= G1_REG_FWD_PIC1_SEGMENT_UPD_E; } vdpu_write_relaxed(vpu, reg, G1_REG_FWD_PIC(0)); @@ -428,7 +428,7 @@ static void cfg_buffers(struct hantro_ctx *ctx, void hantro_g1_vp8_dec_run(struct hantro_ctx *ctx) { - const struct v4l2_ctrl_vp8_frame_header *hdr; + const struct v4l2_ctrl_vp8_frame *hdr; struct hantro_dev *vpu = ctx->dev; size_t height = ctx->dst_fmt.height; size_t width = ctx->dst_fmt.width; @@ -437,7 +437,7 @@ void hantro_g1_vp8_dec_run(struct hantro_ctx *ctx) hantro_start_prepare_run(ctx); - hdr = hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER); + hdr = hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_VP8_FRAME); if (WARN_ON(!hdr)) return; @@ -462,9 +462,9 @@ void hantro_g1_vp8_dec_run(struct hantro_ctx *ctx) reg = G1_REG_DEC_CTRL0_DEC_MODE(10); if (!VP8_FRAME_IS_KEY_FRAME(hdr)) reg |= G1_REG_DEC_CTRL0_PIC_INTER_E; - if (!(hdr->flags & V4L2_VP8_FRAME_HEADER_FLAG_MB_NO_SKIP_COEFF)) + if (!(hdr->flags & V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF)) reg |= G1_REG_DEC_CTRL0_SKIP_MODE; - if (hdr->lf_header.level == 0) + if (hdr->lf.level == 0) reg |= G1_REG_DEC_CTRL0_FILTERING_DIS; vdpu_write_relaxed(vpu, reg, G1_REG_DEC_CTRL0); diff --git a/drivers/staging/media/hantro/hantro_hw.h b/drivers/staging/media/hantro/hantro_hw.h index 34c9e4649a25..ada482e514b8 100644 --- a/drivers/staging/media/hantro/hantro_hw.h +++ b/drivers/staging/media/hantro/hantro_hw.h @@ -216,6 +216,6 @@ void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx); int hantro_vp8_dec_init(struct hantro_ctx *ctx); void hantro_vp8_dec_exit(struct hantro_ctx *ctx); void hantro_vp8_prob_update(struct hantro_ctx *ctx, - const struct v4l2_ctrl_vp8_frame_header *hdr); + const struct v4l2_ctrl_vp8_frame *hdr); #endif /* HANTRO_HW_H_ */ diff --git a/drivers/staging/media/hantro/hantro_vp8.c b/drivers/staging/media/hantro/hantro_vp8.c index 91ec9a05645b..381bc1d3bfda 100644 --- a/drivers/staging/media/hantro/hantro_vp8.c +++ b/drivers/staging/media/hantro/hantro_vp8.c @@ -47,9 +47,9 @@ const u32 hantro_vp8_dec_mc_filter[8][6] = { }; void hantro_vp8_prob_update(struct hantro_ctx *ctx, - const struct v4l2_ctrl_vp8_frame_header *hdr) + const struct v4l2_ctrl_vp8_frame *hdr) { - const struct v4l2_vp8_entropy_header *entropy = &hdr->entropy_header; + const struct v4l2_vp8_entropy *entropy = &hdr->entropy; u32 i, j, k; u8 *dst; @@ -60,9 +60,9 @@ void hantro_vp8_prob_update(struct hantro_ctx *ctx, dst[1] = hdr->prob_intra; dst[2] = hdr->prob_last; dst[3] = hdr->prob_gf; - dst[4] = hdr->segment_header.segment_probs[0]; - dst[5] = hdr->segment_header.segment_probs[1]; - dst[6] = hdr->segment_header.segment_probs[2]; + dst[4] = hdr->segment.segment_probs[0]; + dst[5] = hdr->segment.segment_probs[1]; + dst[6] = hdr->segment.segment_probs[2]; dst[7] = 0; dst += 8; diff --git a/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c b/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c index a4a792f00b11..4dfd4dddbcac 100644 --- a/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c +++ b/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c @@ -274,17 +274,17 @@ static const struct hantro_reg vp8_dec_start_dec = { }; static void cfg_lf(struct hantro_ctx *ctx, - const struct v4l2_ctrl_vp8_frame_header *hdr) + const struct v4l2_ctrl_vp8_frame *hdr) { - const struct v4l2_vp8_segment_header *seg = &hdr->segment_header; - const struct v4l2_vp8_loopfilter_header *lf = &hdr->lf_header; + const struct v4l2_vp8_segment *seg = &hdr->segment; + const struct v4l2_vp8_loopfilter *lf = &hdr->lf; struct hantro_dev *vpu = ctx->dev; unsigned int i; u32 reg; - if (!(seg->flags & V4L2_VP8_SEGMENT_HEADER_FLAG_ENABLED)) { + if (!(seg->flags & V4L2_VP8_SEGMENT_FLAG_ENABLED)) { hantro_reg_write(vpu, &vp8_dec_lf_level[0], lf->level); - } else if (seg->flags & V4L2_VP8_SEGMENT_HEADER_FLAG_DELTA_VALUE_MODE) { + } else if (seg->flags & V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE) { for (i = 0; i < 4; i++) { u32 lf_level = clamp(lf->level + seg->lf_update[i], 0, 63); @@ -302,7 +302,7 @@ static void cfg_lf(struct hantro_ctx *ctx, reg |= VDPU_REG_REF_PIC_FILT_TYPE_E; vdpu_write_relaxed(vpu, reg, VDPU_REG_FILTER_MB_ADJ); - if (lf->flags & V4L2_VP8_LF_HEADER_ADJ_ENABLE) { + if (lf->flags & V4L2_VP8_LF_ADJ_ENABLE) { for (i = 0; i < 4; i++) { hantro_reg_write(vpu, &vp8_dec_mb_adj[i], lf->mb_mode_delta[i]); @@ -313,16 +313,16 @@ static void cfg_lf(struct hantro_ctx *ctx, } static void cfg_qp(struct hantro_ctx *ctx, - const struct v4l2_ctrl_vp8_frame_header *hdr) + const struct v4l2_ctrl_vp8_frame *hdr) { - const struct v4l2_vp8_quantization_header *q = &hdr->quant_header; - const struct v4l2_vp8_segment_header *seg = &hdr->segment_header; + const struct v4l2_vp8_quantization *q = &hdr->quant; + const struct v4l2_vp8_segment *seg = &hdr->segment; struct hantro_dev *vpu = ctx->dev; unsigned int i; - if (!(seg->flags & V4L2_VP8_SEGMENT_HEADER_FLAG_ENABLED)) { + if (!(seg->flags & V4L2_VP8_SEGMENT_FLAG_ENABLED)) { hantro_reg_write(vpu, &vp8_dec_quant[0], q->y_ac_qi); - } else if (seg->flags & V4L2_VP8_SEGMENT_HEADER_FLAG_DELTA_VALUE_MODE) { + } else if (seg->flags & V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE) { for (i = 0; i < 4; i++) { u32 quant = clamp(q->y_ac_qi + seg->quant_update[i], 0, 127); @@ -343,7 +343,7 @@ static void cfg_qp(struct hantro_ctx *ctx, } static void cfg_parts(struct hantro_ctx *ctx, - const struct v4l2_ctrl_vp8_frame_header *hdr) + const struct v4l2_ctrl_vp8_frame *hdr) { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *vb2_src; @@ -426,7 +426,7 @@ static void cfg_parts(struct hantro_ctx *ctx, * normal 6-tap filters */ static void cfg_tap(struct hantro_ctx *ctx, - const struct v4l2_ctrl_vp8_frame_header *hdr) + const struct v4l2_ctrl_vp8_frame *hdr) { struct hantro_dev *vpu = ctx->dev; int i, j; @@ -445,7 +445,7 @@ static void cfg_tap(struct hantro_ctx *ctx, } static void cfg_ref(struct hantro_ctx *ctx, - const struct v4l2_ctrl_vp8_frame_header *hdr) + const struct v4l2_ctrl_vp8_frame *hdr) { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *vb2_dst; @@ -462,7 +462,7 @@ static void cfg_ref(struct hantro_ctx *ctx, WARN_ON(!ref && hdr->golden_frame_ts); if (!ref) ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0); - if (hdr->flags & V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_GOLDEN) + if (hdr->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN) ref |= VDPU_REG_VP8_GREF_SIGN_BIAS; vdpu_write_relaxed(vpu, ref, VDPU_REG_VP8_ADDR_REF2_5(2)); @@ -470,15 +470,15 @@ static void cfg_ref(struct hantro_ctx *ctx, WARN_ON(!ref && hdr->alt_frame_ts); if (!ref) ref = vb2_dma_contig_plane_dma_addr(&vb2_dst->vb2_buf, 0); - if (hdr->flags & V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_ALT) + if (hdr->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT) ref |= VDPU_REG_VP8_AREF_SIGN_BIAS; vdpu_write_relaxed(vpu, ref, VDPU_REG_VP8_ADDR_REF2_5(3)); } static void cfg_buffers(struct hantro_ctx *ctx, - const struct v4l2_ctrl_vp8_frame_header *hdr) + const struct v4l2_ctrl_vp8_frame *hdr) { - const struct v4l2_vp8_segment_header *seg = &hdr->segment_header; + const struct v4l2_vp8_segment *seg = &hdr->segment; struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *vb2_dst; dma_addr_t dst_dma; @@ -492,9 +492,9 @@ static void cfg_buffers(struct hantro_ctx *ctx, /* Set segment map address */ reg = VDPU_REG_FWD_PIC1_SEGMENT_BASE(ctx->vp8_dec.segment_map.dma); - if (seg->flags & V4L2_VP8_SEGMENT_HEADER_FLAG_ENABLED) { + if (seg->flags & V4L2_VP8_SEGMENT_FLAG_ENABLED) { reg |= VDPU_REG_FWD_PIC1_SEGMENT_E; - if (seg->flags & V4L2_VP8_SEGMENT_HEADER_FLAG_UPDATE_MAP) + if (seg->flags & V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP) reg |= VDPU_REG_FWD_PIC1_SEGMENT_UPD_E; } vdpu_write_relaxed(vpu, reg, VDPU_REG_VP8_SEGMENT_VAL); @@ -506,7 +506,7 @@ static void cfg_buffers(struct hantro_ctx *ctx, void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx) { - const struct v4l2_ctrl_vp8_frame_header *hdr; + const struct v4l2_ctrl_vp8_frame *hdr; struct hantro_dev *vpu = ctx->dev; size_t height = ctx->dst_fmt.height; size_t width = ctx->dst_fmt.width; @@ -515,7 +515,7 @@ void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx) hantro_start_prepare_run(ctx); - hdr = hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER); + hdr = hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_VP8_FRAME); if (WARN_ON(!hdr)) return; @@ -555,9 +555,9 @@ void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx) reg = VDPU_REG_DEC_CTRL0_DEC_MODE(10); vdpu_write_relaxed(vpu, reg, VDPU_REG_DEC_FORMAT); - if (!(hdr->flags & V4L2_VP8_FRAME_HEADER_FLAG_MB_NO_SKIP_COEFF)) + if (!(hdr->flags & V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF)) hantro_reg_write(vpu, &vp8_dec_skip_mode, 1); - if (hdr->lf_header.level == 0) + if (hdr->lf.level == 0) hantro_reg_write(vpu, &vp8_dec_filter_disable, 1); /* Frame dimensions */ diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c index 7bd9291c8d5f..e233feb49c9c 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c @@ -147,7 +147,7 @@ static const struct cedrus_control cedrus_controls[] = { }, { .cfg = { - .id = V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER, + .id = V4L2_CID_MPEG_VIDEO_VP8_FRAME, }, .codec = CEDRUS_CODEC_VP8, }, diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.h b/drivers/staging/media/sunxi/cedrus/cedrus.h index 251a6a660351..15f147dad4cb 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus.h +++ b/drivers/staging/media/sunxi/cedrus/cedrus.h @@ -79,7 +79,7 @@ struct cedrus_h265_run { }; struct cedrus_vp8_run { - const struct v4l2_ctrl_vp8_frame_header *frame_params; + const struct v4l2_ctrl_vp8_frame *frame_params; }; struct cedrus_run { diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c index a9090daf626a..b0a0559cd0eb 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c @@ -72,7 +72,7 @@ void cedrus_device_run(void *priv) case V4L2_PIX_FMT_VP8_FRAME: run.vp8.frame_params = cedrus_find_control_data(ctx, - V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER); + V4L2_CID_MPEG_VIDEO_VP8_FRAME); break; default: diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_vp8.c b/drivers/staging/media/sunxi/cedrus/cedrus_vp8.c index ff613ebd1180..64149481584c 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_vp8.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_vp8.c @@ -522,7 +522,7 @@ static void cedrus_irq_clear(struct cedrus_dev *dev) } static void cedrus_read_header(struct cedrus_dev *dev, - const struct v4l2_ctrl_vp8_frame_header *slice) + const struct v4l2_ctrl_vp8_frame *slice) { int i, j; @@ -590,34 +590,34 @@ static void cedrus_read_header(struct cedrus_dev *dev, } } -static void cedrus_vp8_update_probs(const struct v4l2_ctrl_vp8_frame_header *slice, +static void cedrus_vp8_update_probs(const struct v4l2_ctrl_vp8_frame *slice, u8 *prob_table) { int i, j, k; - memcpy(&prob_table[0x1008], slice->entropy_header.y_mode_probs, - sizeof(slice->entropy_header.y_mode_probs)); - memcpy(&prob_table[0x1010], slice->entropy_header.uv_mode_probs, - sizeof(slice->entropy_header.uv_mode_probs)); + memcpy(&prob_table[0x1008], slice->entropy.y_mode_probs, + sizeof(slice->entropy.y_mode_probs)); + memcpy(&prob_table[0x1010], slice->entropy.uv_mode_probs, + sizeof(slice->entropy.uv_mode_probs)); - memcpy(&prob_table[0x1018], slice->segment_header.segment_probs, - sizeof(slice->segment_header.segment_probs)); + memcpy(&prob_table[0x1018], slice->segment.segment_probs, + sizeof(slice->segment.segment_probs)); prob_table[0x101c] = slice->prob_skip_false; prob_table[0x101d] = slice->prob_intra; prob_table[0x101e] = slice->prob_last; prob_table[0x101f] = slice->prob_gf; - memcpy(&prob_table[0x1020], slice->entropy_header.mv_probs[0], + memcpy(&prob_table[0x1020], slice->entropy.mv_probs[0], V4L2_VP8_MV_PROB_CNT); - memcpy(&prob_table[0x1040], slice->entropy_header.mv_probs[1], + memcpy(&prob_table[0x1040], slice->entropy.mv_probs[1], V4L2_VP8_MV_PROB_CNT); for (i = 0; i < 4; ++i) for (j = 0; j < 8; ++j) for (k = 0; k < 3; ++k) memcpy(&prob_table[i * 512 + j * 64 + k * 16], - slice->entropy_header.coeff_probs[i][j][k], 11); + slice->entropy.coeff_probs[i][j][k], 11); } static enum cedrus_irq_status @@ -653,7 +653,7 @@ static void cedrus_vp8_irq_disable(struct cedrus_ctx *ctx) static void cedrus_vp8_setup(struct cedrus_ctx *ctx, struct cedrus_run *run) { - const struct v4l2_ctrl_vp8_frame_header *slice = run->vp8.frame_params; + const struct v4l2_ctrl_vp8_frame *slice = run->vp8.frame_params; struct vb2_queue *cap_q = &ctx->fh.m2m_ctx->cap_q_ctx.q; struct vb2_buffer *src_buf = &run->src->vb2_buf; struct cedrus_dev *dev = ctx->dev; @@ -719,34 +719,34 @@ static void cedrus_vp8_setup(struct cedrus_ctx *ctx, reg |= VE_VP8_PPS_FULL_PIXEL; break; } - if (slice->segment_header.flags & V4L2_VP8_SEGMENT_HEADER_FLAG_UPDATE_MAP) + if (slice->segment.flags & V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP) reg |= VE_VP8_PPS_UPDATE_MB_SEGMENTATION_MAP; - if (!(slice->segment_header.flags & V4L2_VP8_SEGMENT_HEADER_FLAG_DELTA_VALUE_MODE)) + if (!(slice->segment.flags & V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE)) reg |= VE_VP8_PPS_MB_SEGMENT_ABS_DELTA; - if (slice->segment_header.flags & V4L2_VP8_SEGMENT_HEADER_FLAG_ENABLED) + if (slice->segment.flags & V4L2_VP8_SEGMENT_FLAG_ENABLED) reg |= VE_VP8_PPS_SEGMENTATION_ENABLE; if (ctx->codec.vp8.last_filter_type) reg |= VE_VP8_PPS_LAST_LOOP_FILTER_SIMPLE; - reg |= VE_VP8_PPS_SHARPNESS_LEVEL(slice->lf_header.sharpness_level); - if (slice->lf_header.flags & V4L2_VP8_LF_FILTER_TYPE_SIMPLE) + reg |= VE_VP8_PPS_SHARPNESS_LEVEL(slice->lf.sharpness_level); + if (slice->lf.flags & V4L2_VP8_LF_FILTER_TYPE_SIMPLE) reg |= VE_VP8_PPS_LOOP_FILTER_SIMPLE; - reg |= VE_VP8_PPS_LOOP_FILTER_LEVEL(slice->lf_header.level); - if (slice->lf_header.flags & V4L2_VP8_LF_HEADER_ADJ_ENABLE) + reg |= VE_VP8_PPS_LOOP_FILTER_LEVEL(slice->lf.level); + if (slice->lf.flags & V4L2_VP8_LF_ADJ_ENABLE) reg |= VE_VP8_PPS_MODE_REF_LF_DELTA_ENABLE; - if (slice->lf_header.flags & V4L2_VP8_LF_HEADER_DELTA_UPDATE) + if (slice->lf.flags & V4L2_VP8_LF_DELTA_UPDATE) reg |= VE_VP8_PPS_MODE_REF_LF_DELTA_UPDATE; reg |= VE_VP8_PPS_TOKEN_PARTITION(ilog2(slice->num_dct_parts)); - if (slice->flags & V4L2_VP8_FRAME_HEADER_FLAG_MB_NO_SKIP_COEFF) + if (slice->flags & V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF) reg |= VE_VP8_PPS_MB_NO_COEFF_SKIP; reg |= VE_VP8_PPS_RELOAD_ENTROPY_PROBS; - if (slice->flags & V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_GOLDEN) + if (slice->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN) reg |= VE_VP8_PPS_GOLDEN_SIGN_BIAS; - if (slice->flags & V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_ALT) + if (slice->flags & V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT) reg |= VE_VP8_PPS_ALTREF_SIGN_BIAS; if (ctx->codec.vp8.last_frame_p_type) reg |= VE_VP8_PPS_LAST_PIC_TYPE_P_FRAME; reg |= VE_VP8_PPS_LAST_SHARPNESS_LEVEL(ctx->codec.vp8.last_sharpness_level); - if (!(slice->flags & V4L2_VP8_FRAME_HEADER_FLAG_KEY_FRAME)) + if (!(slice->flags & V4L2_VP8_FRAME_FLAG_KEY_FRAME)) reg |= VE_VP8_PPS_PIC_TYPE_P_FRAME; cedrus_write(dev, VE_VP8_PPS, reg); @@ -758,12 +758,12 @@ static void cedrus_vp8_setup(struct cedrus_ctx *ctx, cedrus_write(dev, VE_H264_ERROR_CASE, 0); reg = 0; - reg |= VE_VP8_QP_INDEX_DELTA_UVAC(slice->quant_header.uv_ac_delta); - reg |= VE_VP8_QP_INDEX_DELTA_UVDC(slice->quant_header.uv_dc_delta); - reg |= VE_VP8_QP_INDEX_DELTA_Y2AC(slice->quant_header.y2_ac_delta); - reg |= VE_VP8_QP_INDEX_DELTA_Y2DC(slice->quant_header.y2_dc_delta); - reg |= VE_VP8_QP_INDEX_DELTA_Y1DC(slice->quant_header.y_dc_delta); - reg |= VE_VP8_QP_INDEX_DELTA_BASE_QINDEX(slice->quant_header.y_ac_qi); + reg |= VE_VP8_QP_INDEX_DELTA_UVAC(slice->quant.uv_ac_delta); + reg |= VE_VP8_QP_INDEX_DELTA_UVDC(slice->quant.uv_dc_delta); + reg |= VE_VP8_QP_INDEX_DELTA_Y2AC(slice->quant.y2_ac_delta); + reg |= VE_VP8_QP_INDEX_DELTA_Y2DC(slice->quant.y2_dc_delta); + reg |= VE_VP8_QP_INDEX_DELTA_Y1DC(slice->quant.y_dc_delta); + reg |= VE_VP8_QP_INDEX_DELTA_BASE_QINDEX(slice->quant.y_ac_qi); cedrus_write(dev, VE_VP8_QP_INDEX_DELTA, reg); reg = 0; @@ -777,31 +777,31 @@ static void cedrus_vp8_setup(struct cedrus_ctx *ctx, cedrus_write(dev, VE_VP8_PICSIZE, reg); reg = 0; - reg |= VE_VP8_SEGMENT3(slice->segment_header.quant_update[3]); - reg |= VE_VP8_SEGMENT2(slice->segment_header.quant_update[2]); - reg |= VE_VP8_SEGMENT1(slice->segment_header.quant_update[1]); - reg |= VE_VP8_SEGMENT0(slice->segment_header.quant_update[0]); + reg |= VE_VP8_SEGMENT3(slice->segment.quant_update[3]); + reg |= VE_VP8_SEGMENT2(slice->segment.quant_update[2]); + reg |= VE_VP8_SEGMENT1(slice->segment.quant_update[1]); + reg |= VE_VP8_SEGMENT0(slice->segment.quant_update[0]); cedrus_write(dev, VE_VP8_SEGMENT_FEAT_MB_LV0, reg); reg = 0; - reg |= VE_VP8_SEGMENT3(slice->segment_header.lf_update[3]); - reg |= VE_VP8_SEGMENT2(slice->segment_header.lf_update[2]); - reg |= VE_VP8_SEGMENT1(slice->segment_header.lf_update[1]); - reg |= VE_VP8_SEGMENT0(slice->segment_header.lf_update[0]); + reg |= VE_VP8_SEGMENT3(slice->segment.lf_update[3]); + reg |= VE_VP8_SEGMENT2(slice->segment.lf_update[2]); + reg |= VE_VP8_SEGMENT1(slice->segment.lf_update[1]); + reg |= VE_VP8_SEGMENT0(slice->segment.lf_update[0]); cedrus_write(dev, VE_VP8_SEGMENT_FEAT_MB_LV1, reg); reg = 0; - reg |= VE_VP8_LF_DELTA3(slice->lf_header.ref_frm_delta[3]); - reg |= VE_VP8_LF_DELTA2(slice->lf_header.ref_frm_delta[2]); - reg |= VE_VP8_LF_DELTA1(slice->lf_header.ref_frm_delta[1]); - reg |= VE_VP8_LF_DELTA0(slice->lf_header.ref_frm_delta[0]); + reg |= VE_VP8_LF_DELTA3(slice->lf.ref_frm_delta[3]); + reg |= VE_VP8_LF_DELTA2(slice->lf.ref_frm_delta[2]); + reg |= VE_VP8_LF_DELTA1(slice->lf.ref_frm_delta[1]); + reg |= VE_VP8_LF_DELTA0(slice->lf.ref_frm_delta[0]); cedrus_write(dev, VE_VP8_REF_LF_DELTA, reg); reg = 0; - reg |= VE_VP8_LF_DELTA3(slice->lf_header.mb_mode_delta[3]); - reg |= VE_VP8_LF_DELTA2(slice->lf_header.mb_mode_delta[2]); - reg |= VE_VP8_LF_DELTA1(slice->lf_header.mb_mode_delta[1]); - reg |= VE_VP8_LF_DELTA0(slice->lf_header.mb_mode_delta[0]); + reg |= VE_VP8_LF_DELTA3(slice->lf.mb_mode_delta[3]); + reg |= VE_VP8_LF_DELTA2(slice->lf.mb_mode_delta[2]); + reg |= VE_VP8_LF_DELTA1(slice->lf.mb_mode_delta[1]); + reg |= VE_VP8_LF_DELTA0(slice->lf.mb_mode_delta[0]); cedrus_write(dev, VE_VP8_MODE_LF_DELTA, reg); luma_addr = cedrus_dst_buf_addr(ctx, run->dst->vb2_buf.index, 0); @@ -846,13 +846,13 @@ static void cedrus_vp8_setup(struct cedrus_ctx *ctx, VE_H264_CTRL_DECODE_ERR_INT | VE_H264_CTRL_SLICE_DECODE_INT); - if (slice->lf_header.level) { + if (slice->lf.level) { ctx->codec.vp8.last_filter_type = - !!(slice->lf_header.flags & V4L2_VP8_LF_FILTER_TYPE_SIMPLE); + !!(slice->lf.flags & V4L2_VP8_LF_FILTER_TYPE_SIMPLE); ctx->codec.vp8.last_frame_p_type = !VP8_FRAME_IS_KEY_FRAME(slice); ctx->codec.vp8.last_sharpness_level = - slice->lf_header.sharpness_level; + slice->lf.sharpness_level; } } diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index 167ca8c8424f..aa06ff1695fe 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -50,7 +50,7 @@ struct video_device; * @p_h264_slice_params: Pointer to a struct v4l2_ctrl_h264_slice_params. * @p_h264_decode_params: Pointer to a struct v4l2_ctrl_h264_decode_params. * @p_h264_pred_weights: Pointer to a struct v4l2_ctrl_h264_pred_weights. - * @p_vp8_frame_header: Pointer to a VP8 frame header structure. + * @p_vp8_frame: Pointer to a VP8 frame params structure. * @p_hevc_sps: Pointer to an HEVC sequence parameter set structure. * @p_hevc_pps: Pointer to an HEVC picture parameter set structure. * @p_hevc_slice_params: Pointer to an HEVC slice parameters structure. @@ -74,7 +74,7 @@ union v4l2_ctrl_ptr { struct v4l2_ctrl_h264_slice_params *p_h264_slice_params; struct v4l2_ctrl_h264_decode_params *p_h264_decode_params; struct v4l2_ctrl_h264_pred_weights *p_h264_pred_weights; - struct v4l2_ctrl_vp8_frame_header *p_vp8_frame_header; + struct v4l2_ctrl_vp8_frame *p_vp8_frame; struct v4l2_ctrl_hevc_sps *p_hevc_sps; struct v4l2_ctrl_hevc_pps *p_hevc_pps; struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params; diff --git a/include/media/vp8-ctrls.h b/include/media/vp8-ctrls.h index 3969550df148..3f74012e23ff 100644 --- a/include/media/vp8-ctrls.h +++ b/include/media/vp8-ctrls.h @@ -15,15 +15,15 @@ #define V4L2_PIX_FMT_VP8_FRAME v4l2_fourcc('V', 'P', '8', 'F') -#define V4L2_CID_MPEG_VIDEO_VP8_FRAME_HEADER (V4L2_CID_CODEC_BASE + 2000) -#define V4L2_CTRL_TYPE_VP8_FRAME_HEADER 0x301 +#define V4L2_CID_MPEG_VIDEO_VP8_FRAME (V4L2_CID_CODEC_BASE + 2000) +#define V4L2_CTRL_TYPE_VP8_FRAME 0x301 -#define V4L2_VP8_SEGMENT_HEADER_FLAG_ENABLED 0x01 -#define V4L2_VP8_SEGMENT_HEADER_FLAG_UPDATE_MAP 0x02 -#define V4L2_VP8_SEGMENT_HEADER_FLAG_UPDATE_FEATURE_DATA 0x04 -#define V4L2_VP8_SEGMENT_HEADER_FLAG_DELTA_VALUE_MODE 0x08 +#define V4L2_VP8_SEGMENT_FLAG_ENABLED 0x01 +#define V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP 0x02 +#define V4L2_VP8_SEGMENT_FLAG_UPDATE_FEATURE_DATA 0x04 +#define V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE 0x08 -struct v4l2_vp8_segment_header { +struct v4l2_vp8_segment { __s8 quant_update[4]; __s8 lf_update[4]; __u8 segment_probs[3]; @@ -31,10 +31,10 @@ struct v4l2_vp8_segment_header { __u32 flags; }; -#define V4L2_VP8_LF_HEADER_ADJ_ENABLE 0x01 -#define V4L2_VP8_LF_HEADER_DELTA_UPDATE 0x02 +#define V4L2_VP8_LF_ADJ_ENABLE 0x01 +#define V4L2_VP8_LF_DELTA_UPDATE 0x02 #define V4L2_VP8_LF_FILTER_TYPE_SIMPLE 0x04 -struct v4l2_vp8_loopfilter_header { +struct v4l2_vp8_loopfilter { __s8 ref_frm_delta[4]; __s8 mb_mode_delta[4]; __u8 sharpness_level; @@ -43,7 +43,7 @@ struct v4l2_vp8_loopfilter_header { __u32 flags; }; -struct v4l2_vp8_quantization_header { +struct v4l2_vp8_quantization { __u8 y_ac_qi; __s8 y_dc_delta; __s8 y2_dc_delta; @@ -55,7 +55,7 @@ struct v4l2_vp8_quantization_header { #define V4L2_VP8_COEFF_PROB_CNT 11 #define V4L2_VP8_MV_PROB_CNT 19 -struct v4l2_vp8_entropy_header { +struct v4l2_vp8_entropy { __u8 coeff_probs[4][8][3][V4L2_VP8_COEFF_PROB_CNT]; __u8 y_mode_probs[4]; __u8 uv_mode_probs[3]; @@ -70,21 +70,21 @@ struct v4l2_vp8_entropy_coder_state { __u8 padding; }; -#define V4L2_VP8_FRAME_HEADER_FLAG_KEY_FRAME 0x01 -#define V4L2_VP8_FRAME_HEADER_FLAG_EXPERIMENTAL 0x02 -#define V4L2_VP8_FRAME_HEADER_FLAG_SHOW_FRAME 0x04 -#define V4L2_VP8_FRAME_HEADER_FLAG_MB_NO_SKIP_COEFF 0x08 -#define V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_GOLDEN 0x10 -#define V4L2_VP8_FRAME_HEADER_FLAG_SIGN_BIAS_ALT 0x20 +#define V4L2_VP8_FRAME_FLAG_KEY_FRAME 0x01 +#define V4L2_VP8_FRAME_FLAG_EXPERIMENTAL 0x02 +#define V4L2_VP8_FRAME_FLAG_SHOW_FRAME 0x04 +#define V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF 0x08 +#define V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN 0x10 +#define V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT 0x20 #define VP8_FRAME_IS_KEY_FRAME(hdr) \ - (!!((hdr)->flags & V4L2_VP8_FRAME_HEADER_FLAG_KEY_FRAME)) + (!!((hdr)->flags & V4L2_VP8_FRAME_FLAG_KEY_FRAME)) -struct v4l2_ctrl_vp8_frame_header { - struct v4l2_vp8_segment_header segment_header; - struct v4l2_vp8_loopfilter_header lf_header; - struct v4l2_vp8_quantization_header quant_header; - struct v4l2_vp8_entropy_header entropy_header; +struct v4l2_ctrl_vp8_frame { + struct v4l2_vp8_segment segment; + struct v4l2_vp8_loopfilter lf; + struct v4l2_vp8_quantization quant; + struct v4l2_vp8_entropy entropy; struct v4l2_vp8_entropy_coder_state coder_state; __u16 width; -- cgit v1.2.3-59-g8ed1b From 643a236e46d43ec8d7b4d9b35affa48b98c65df0 Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Thu, 4 Mar 2021 15:07:49 +0100 Subject: media: uapi: vp8: Rename v4l2_vp8_loopfilter to v4l2_vp8_loop_filter Rename to struct v4l2_vp8_loop_filter, which is closer to the VP8 syntax. This change is only cosmetics, but since this API is exposed to userspace, it's worth the trouble to get it consistent. Signed-off-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst | 12 ++++++------ drivers/staging/media/hantro/hantro_g1_vp8_dec.c | 2 +- drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c | 2 +- include/media/vp8-ctrls.h | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) (limited to 'include/media') diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index 7c778f42f80e..1fa9a54f63bf 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -1829,7 +1829,7 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - * - struct :c:type:`v4l2_vp8_segment` - ``segment`` - Structure with segment-based adjustments metadata. - * - struct :c:type:`v4l2_vp8_loopfilter` + * - struct :c:type:`v4l2_vp8_loop_filter` - ``lf`` - Structure with loop filter level adjustments metadata. * - struct :c:type:`v4l2_vp8_quantization` @@ -2027,13 +2027,13 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - \normalsize -.. c:type:: v4l2_vp8_loopfilter +.. c:type:: v4l2_vp8_loop_filter .. cssclass:: longtable .. tabularcolumns:: |p{1.5cm}|p{3.9cm}|p{11.9cm}| -.. flat-table:: struct v4l2_vp8_loopfilter +.. flat-table:: struct v4l2_vp8_loop_filter :header-rows: 0 :stub-columns: 0 :widths: 1 1 2 @@ -2055,11 +2055,11 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - - Applications and drivers must set this to zero. * - __u32 - ``flags`` - - See :ref:`Loopfilter Flags ` + - See :ref:`Loop Filter Flags ` -.. _vp8_loopfilter_flags: +.. _vp8_loop_filter_flags: -``Loopfilter Flags`` +``Loop Filter Flags`` .. tabularcolumns:: |p{7.0cm}|p{1.2cm}|p{9.1cm}| diff --git a/drivers/staging/media/hantro/hantro_g1_vp8_dec.c b/drivers/staging/media/hantro/hantro_g1_vp8_dec.c index 07acb4ea5dd0..cbe1d087f103 100644 --- a/drivers/staging/media/hantro/hantro_g1_vp8_dec.c +++ b/drivers/staging/media/hantro/hantro_g1_vp8_dec.c @@ -136,7 +136,7 @@ static void cfg_lf(struct hantro_ctx *ctx, const struct v4l2_ctrl_vp8_frame *hdr) { const struct v4l2_vp8_segment *seg = &hdr->segment; - const struct v4l2_vp8_loopfilter *lf = &hdr->lf; + const struct v4l2_vp8_loop_filter *lf = &hdr->lf; struct hantro_dev *vpu = ctx->dev; unsigned int i; u32 reg; diff --git a/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c b/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c index 4dfd4dddbcac..1a0d7fef4723 100644 --- a/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c +++ b/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c @@ -277,7 +277,7 @@ static void cfg_lf(struct hantro_ctx *ctx, const struct v4l2_ctrl_vp8_frame *hdr) { const struct v4l2_vp8_segment *seg = &hdr->segment; - const struct v4l2_vp8_loopfilter *lf = &hdr->lf; + const struct v4l2_vp8_loop_filter *lf = &hdr->lf; struct hantro_dev *vpu = ctx->dev; unsigned int i; u32 reg; diff --git a/include/media/vp8-ctrls.h b/include/media/vp8-ctrls.h index 3f74012e23ff..3afaf6ea4bc9 100644 --- a/include/media/vp8-ctrls.h +++ b/include/media/vp8-ctrls.h @@ -34,7 +34,7 @@ struct v4l2_vp8_segment { #define V4L2_VP8_LF_ADJ_ENABLE 0x01 #define V4L2_VP8_LF_DELTA_UPDATE 0x02 #define V4L2_VP8_LF_FILTER_TYPE_SIMPLE 0x04 -struct v4l2_vp8_loopfilter { +struct v4l2_vp8_loop_filter { __s8 ref_frm_delta[4]; __s8 mb_mode_delta[4]; __u8 sharpness_level; @@ -82,7 +82,7 @@ struct v4l2_vp8_entropy_coder_state { struct v4l2_ctrl_vp8_frame { struct v4l2_vp8_segment segment; - struct v4l2_vp8_loopfilter lf; + struct v4l2_vp8_loop_filter lf; struct v4l2_vp8_quantization quant; struct v4l2_vp8_entropy entropy; struct v4l2_vp8_entropy_coder_state coder_state; -- cgit v1.2.3-59-g8ed1b From dacd59454449cbce47539a1abed266c659e8ebab Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Thu, 4 Mar 2021 15:07:50 +0100 Subject: media: uapi: vp8: Add proper kernel-doc documentation In preparation for making the interface public, document all the structures. Signed-off-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/vp8-ctrls.h | 99 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 99 insertions(+) (limited to 'include/media') diff --git a/include/media/vp8-ctrls.h b/include/media/vp8-ctrls.h index 3afaf6ea4bc9..ab46d775788b 100644 --- a/include/media/vp8-ctrls.h +++ b/include/media/vp8-ctrls.h @@ -23,6 +23,20 @@ #define V4L2_VP8_SEGMENT_FLAG_UPDATE_FEATURE_DATA 0x04 #define V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE 0x08 +/** + * struct v4l2_vp8_segment - VP8 segment-based adjustments parameters + * + * @quant_update: update values for the segment quantizer. + * @lf_update: update values for the loop filter level. + * @segment_probs: branch probabilities of the segment_id decoding tree. + * @padding: padding field. Should be zeroed by applications. + * @flags: see V4L2_VP8_SEGMENT_FLAG_{}. + * + * This structure contains segment-based adjustments related parameters. + * See the 'update_segmentation()' part of the frame header syntax, + * and section '9.3. Segment-Based Adjustments' of the VP8 specification + * for more details. + */ struct v4l2_vp8_segment { __s8 quant_update[4]; __s8 lf_update[4]; @@ -34,6 +48,22 @@ struct v4l2_vp8_segment { #define V4L2_VP8_LF_ADJ_ENABLE 0x01 #define V4L2_VP8_LF_DELTA_UPDATE 0x02 #define V4L2_VP8_LF_FILTER_TYPE_SIMPLE 0x04 + +/** + * struct v4l2_vp8_loop_filter - VP8 loop filter parameters + * + * @ref_frm_delta: Reference frame signed delta values. + * @mb_mode_delta: MB prediction mode signed delta values. + * @sharpness_level: matches sharpness_level syntax element. + * @level: matches loop_filter_level syntax element. + * @padding: padding field. Should be zeroed by applications. + * @flags: see V4L2_VP8_LF_FLAG_{}. + * + * This structure contains loop filter related parameters. + * See the 'mb_lf_adjustments()' part of the frame header syntax, + * and section '9.4. Loop Filter Type and Levels' of the VP8 specification + * for more details. + */ struct v4l2_vp8_loop_filter { __s8 ref_frm_delta[4]; __s8 mb_mode_delta[4]; @@ -43,6 +73,22 @@ struct v4l2_vp8_loop_filter { __u32 flags; }; +/** + * struct v4l2_vp8_quantization - VP8 quantizattion indices + * + * @y_ac_qi: luma AC coefficient table index. + * @y_dc_delta: luma DC delta vaue. + * @y2_dc_delta: y2 block DC delta value. + * @y2_ac_delta: y2 block AC delta value. + * @uv_dc_delta: chroma DC delta value. + * @uv_ac_delta: chroma AC delta value. + * @padding: padding field. Should be zeroed by applications. + + * This structure contains the quantization indices present + * in 'quant_indices()' part of the frame header syntax. + * See section '9.6. Dequantization Indices' of the VP8 specification + * for more details. + */ struct v4l2_vp8_quantization { __u8 y_ac_qi; __s8 y_dc_delta; @@ -55,6 +101,21 @@ struct v4l2_vp8_quantization { #define V4L2_VP8_COEFF_PROB_CNT 11 #define V4L2_VP8_MV_PROB_CNT 19 + +/** + * struct v4l2_vp8_entropy - VP8 update probabilities + * + * @coeff_probs: coefficient probability update values. + * @y_mode_probs: luma intra-prediction probabilities. + * @uv_mode_probs: chroma intra-prediction probabilities. + * @mv_probs: mv decoding probability. + * @padding: padding field. Should be zeroed by applications. + * + * This structure contains the update probabilities present in + * 'token_prob_update()' and 'mv_prob_update()' part of the frame header. + * See section '17.2. Probability Updates' of the VP8 specification + * for more details. + */ struct v4l2_vp8_entropy { __u8 coeff_probs[4][8][3][V4L2_VP8_COEFF_PROB_CNT]; __u8 y_mode_probs[4]; @@ -63,6 +124,17 @@ struct v4l2_vp8_entropy { __u8 padding[3]; }; +/** + * struct v4l2_vp8_entropy_coder_state - VP8 boolean coder state + * + * @range: coder state value for "Range" + * @value: coder state value for "Value" + * @bit_count: number of bits left in range "Value". + * @padding: padding field. Should be zeroed by applications. + * + * This structure contains the state for the boolean coder, as + * explained in section '7. Boolean Entropy Decoder' of the VP8 specification. + */ struct v4l2_vp8_entropy_coder_state { __u8 range; __u8 value; @@ -80,6 +152,33 @@ struct v4l2_vp8_entropy_coder_state { #define VP8_FRAME_IS_KEY_FRAME(hdr) \ (!!((hdr)->flags & V4L2_VP8_FRAME_FLAG_KEY_FRAME)) +/** + * struct v4l2_vp8_frame - VP8 frame parameters + * + * @seg: segmentation parameters. See &v4l2_vp8_segment for more details + * @lf: loop filter parameters. See &v4l2_vp8_loop_filter for more details + * @quant: quantization parameters. See &v4l2_vp8_quantization for more details + * @probs: probabilities. See &v4l2_vp9_probabilities for more details + * @width: frame width. + * @height: frame height. + * @horizontal_scale: horizontal scaling factor. + * @vertical_scale: vertical scaling factor. + * @version: bitstream version. + * @prob_skip_false: frame header syntax element. + * @prob_intra: frame header syntax element. + * @prob_last: frame header syntax element. + * @prob_gf: frame header syntax element. + * @num_dct_parts: number of DCT coefficients partitions. + * @first_part_size: size of the first partition, i.e. the control partition. + * @first_part_header_bits: size in bits of the first partition header portion. + * @dct_part_sizes: DCT coefficients sizes. + * @last_frame_ts: "last" reference buffer timestamp. + * The timestamp refers to the timestamp field in struct v4l2_buffer. + * Use v4l2_timeval_to_ns() to convert the struct timeval to a __u64. + * @golden_frame_ts: "golden" reference buffer timestamp. + * @alt_frame_ts: "alt" reference buffer timestamp. + * @flags: see V4L2_VP8_FRAME_FLAG_{}. + */ struct v4l2_ctrl_vp8_frame { struct v4l2_vp8_segment segment; struct v4l2_vp8_loop_filter lf; -- cgit v1.2.3-59-g8ed1b From 1fb03333eb926e315f9850098b5a3361832f07cb Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Thu, 4 Mar 2021 15:07:51 +0100 Subject: media: uapi: Move parsed VP8 pixel format out of staging Since we are ready to stabilize the VP8 stateless API, move the parsed VP8 pixel format. Signed-off-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- Documentation/userspace-api/media/v4l/pixfmt-compressed.rst | 5 ----- include/media/vp8-ctrls.h | 2 -- include/uapi/linux/videodev2.h | 1 + 3 files changed, 1 insertion(+), 7 deletions(-) (limited to 'include/media') diff --git a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst index 7341c9b4516b..0232d0808519 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst @@ -164,11 +164,6 @@ Compressed Formats of macroblocks to decode a full corresponding frame to the matching capture buffer. - .. note:: - - This format is not yet part of the public kernel API and it - is expected to change. - * .. _V4L2-PIX-FMT-VP9: - ``V4L2_PIX_FMT_VP9`` diff --git a/include/media/vp8-ctrls.h b/include/media/vp8-ctrls.h index ab46d775788b..50c92c5ed0eb 100644 --- a/include/media/vp8-ctrls.h +++ b/include/media/vp8-ctrls.h @@ -13,8 +13,6 @@ #include -#define V4L2_PIX_FMT_VP8_FRAME v4l2_fourcc('V', 'P', '8', 'F') - #define V4L2_CID_MPEG_VIDEO_VP8_FRAME (V4L2_CID_CODEC_BASE + 2000) #define V4L2_CTRL_TYPE_VP8_FRAME 0x301 diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 79dbde3bcf8d..a1d903c6f9f0 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -694,6 +694,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */ #define V4L2_PIX_FMT_VC1_ANNEX_L v4l2_fourcc('V', 'C', '1', 'L') /* SMPTE 421M Annex L compliant stream */ #define V4L2_PIX_FMT_VP8 v4l2_fourcc('V', 'P', '8', '0') /* VP8 */ +#define V4L2_PIX_FMT_VP8_FRAME v4l2_fourcc('V', 'P', '8', 'F') /* VP8 parsed frame */ #define V4L2_PIX_FMT_VP9 v4l2_fourcc('V', 'P', '9', '0') /* VP9 */ #define V4L2_PIX_FMT_HEVC v4l2_fourcc('H', 'E', 'V', 'C') /* HEVC aka H.265 */ #define V4L2_PIX_FMT_FWHT v4l2_fourcc('F', 'W', 'H', 'T') /* Fast Walsh Hadamard Transform (vicodec) */ -- cgit v1.2.3-59-g8ed1b From e74b504a87c110071376438564a6f7a351a215bf Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Thu, 4 Mar 2021 15:07:52 +0100 Subject: media: uapi: Move the VP8 stateless control type out of staging Move the VP8 stateless control types out of staging, and re-number it to avoid any confusion. Signed-off-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/vp8-ctrls.h | 1 - include/uapi/linux/videodev2.h | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'include/media') diff --git a/include/media/vp8-ctrls.h b/include/media/vp8-ctrls.h index 50c92c5ed0eb..409a87f9e609 100644 --- a/include/media/vp8-ctrls.h +++ b/include/media/vp8-ctrls.h @@ -14,7 +14,6 @@ #include #define V4L2_CID_MPEG_VIDEO_VP8_FRAME (V4L2_CID_CODEC_BASE + 2000) -#define V4L2_CTRL_TYPE_VP8_FRAME 0x301 #define V4L2_VP8_SEGMENT_FLAG_ENABLED 0x01 #define V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP 0x02 diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index a1d903c6f9f0..611b75df7f17 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1793,6 +1793,8 @@ enum v4l2_ctrl_type { V4L2_CTRL_TYPE_H264_PRED_WEIGHTS = 0x0205, V4L2_CTRL_TYPE_FWHT_PARAMS = 0x0220, + + V4L2_CTRL_TYPE_VP8_FRAME = 0x0240, }; /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ -- cgit v1.2.3-59-g8ed1b From 0c86b4bdac7eb3a6c17aa5225a7bc708047bac6a Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Thu, 4 Mar 2021 15:07:54 +0100 Subject: media: vp8: Rename V4L2 VP8 specific macro to V4L2_VP8_ Before we move the VP8 controls to a stable public header, rename this macro so it's clearly V4L2-specific. Signed-off-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/hantro/hantro_g1_vp8_dec.c | 6 +++--- drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c | 6 +++--- drivers/staging/media/sunxi/cedrus/cedrus_vp8.c | 12 ++++++------ include/media/vp8-ctrls.h | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) (limited to 'include/media') diff --git a/drivers/staging/media/hantro/hantro_g1_vp8_dec.c b/drivers/staging/media/hantro/hantro_g1_vp8_dec.c index cbe1d087f103..7d6270e26297 100644 --- a/drivers/staging/media/hantro/hantro_g1_vp8_dec.c +++ b/drivers/staging/media/hantro/hantro_g1_vp8_dec.c @@ -234,7 +234,7 @@ static void cfg_parts(struct hantro_ctx *ctx, { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *vb2_src; - u32 first_part_offset = VP8_FRAME_IS_KEY_FRAME(hdr) ? 10 : 3; + u32 first_part_offset = V4L2_VP8_FRAME_IS_KEY_FRAME(hdr) ? 10 : 3; u32 mb_size, mb_offset_bytes, mb_offset_bits, mb_start_bits; u32 dct_size_part_size, dct_part_offset; struct hantro_reg reg; @@ -442,7 +442,7 @@ void hantro_g1_vp8_dec_run(struct hantro_ctx *ctx) return; /* Reset segment_map buffer in keyframe */ - if (VP8_FRAME_IS_KEY_FRAME(hdr) && ctx->vp8_dec.segment_map.cpu) + if (V4L2_VP8_FRAME_IS_KEY_FRAME(hdr) && ctx->vp8_dec.segment_map.cpu) memset(ctx->vp8_dec.segment_map.cpu, 0, ctx->vp8_dec.segment_map.size); @@ -460,7 +460,7 @@ void hantro_g1_vp8_dec_run(struct hantro_ctx *ctx) vdpu_write_relaxed(vpu, reg, G1_REG_CONFIG); reg = G1_REG_DEC_CTRL0_DEC_MODE(10); - if (!VP8_FRAME_IS_KEY_FRAME(hdr)) + if (!V4L2_VP8_FRAME_IS_KEY_FRAME(hdr)) reg |= G1_REG_DEC_CTRL0_PIC_INTER_E; if (!(hdr->flags & V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF)) reg |= G1_REG_DEC_CTRL0_SKIP_MODE; diff --git a/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c b/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c index 1a0d7fef4723..caa1435008d4 100644 --- a/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c +++ b/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c @@ -347,7 +347,7 @@ static void cfg_parts(struct hantro_ctx *ctx, { struct hantro_dev *vpu = ctx->dev; struct vb2_v4l2_buffer *vb2_src; - u32 first_part_offset = VP8_FRAME_IS_KEY_FRAME(hdr) ? 10 : 3; + u32 first_part_offset = V4L2_VP8_FRAME_IS_KEY_FRAME(hdr) ? 10 : 3; u32 mb_size, mb_offset_bytes, mb_offset_bits, mb_start_bits; u32 dct_size_part_size, dct_part_offset; dma_addr_t src_dma; @@ -520,7 +520,7 @@ void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx) return; /* Reset segment_map buffer in keyframe */ - if (VP8_FRAME_IS_KEY_FRAME(hdr) && ctx->vp8_dec.segment_map.cpu) + if (V4L2_VP8_FRAME_IS_KEY_FRAME(hdr) && ctx->vp8_dec.segment_map.cpu) memset(ctx->vp8_dec.segment_map.cpu, 0, ctx->vp8_dec.segment_map.size); @@ -537,7 +537,7 @@ void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx) reg = VDPU_REG_CONFIG_DEC_TIMEOUT_E | VDPU_REG_CONFIG_DEC_CLK_GATE_E; - if (!VP8_FRAME_IS_KEY_FRAME(hdr)) + if (!V4L2_VP8_FRAME_IS_KEY_FRAME(hdr)) reg |= VDPU_REG_DEC_CTRL0_PIC_INTER_E; vdpu_write_relaxed(vpu, reg, VDPU_REG_EN_FLAGS); diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_vp8.c b/drivers/staging/media/sunxi/cedrus/cedrus_vp8.c index 64149481584c..12b233d28db3 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_vp8.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_vp8.c @@ -526,7 +526,7 @@ static void cedrus_read_header(struct cedrus_dev *dev, { int i, j; - if (VP8_FRAME_IS_KEY_FRAME(slice)) { + if (V4L2_VP8_FRAME_IS_KEY_FRAME(slice)) { read_bits(dev, 1, VP8_PROB_HALF); read_bits(dev, 1, VP8_PROB_HALF); } @@ -550,12 +550,12 @@ static void cedrus_read_header(struct cedrus_dev *dev, for (i = 0; i < QUANT_DELTA_COUNT; i++) get_delta_q(dev); - if (!VP8_FRAME_IS_KEY_FRAME(slice)) + if (!V4L2_VP8_FRAME_IS_KEY_FRAME(slice)) process_ref_frame_info(dev); read_bits(dev, 1, VP8_PROB_HALF); - if (!VP8_FRAME_IS_KEY_FRAME(slice)) + if (!V4L2_VP8_FRAME_IS_KEY_FRAME(slice)) read_bits(dev, 1, VP8_PROB_HALF); cedrus_write(dev, VE_H264_TRIGGER_TYPE, VE_H264_TRIGGER_TYPE_VP8_UPDATE_COEF); @@ -565,7 +565,7 @@ static void cedrus_read_header(struct cedrus_dev *dev, if (read_bits(dev, 1, VP8_PROB_HALF)) read_bits(dev, 8, VP8_PROB_HALF); - if (!VP8_FRAME_IS_KEY_FRAME(slice)) { + if (!V4L2_VP8_FRAME_IS_KEY_FRAME(slice)) { read_bits(dev, 8, VP8_PROB_HALF); read_bits(dev, 8, VP8_PROB_HALF); read_bits(dev, 8, VP8_PROB_HALF); @@ -672,7 +672,7 @@ static void cedrus_vp8_setup(struct cedrus_ctx *ctx, reg = slice->first_part_size * 8; cedrus_write(dev, VE_VP8_FIRST_DATA_PART_LEN, reg); - header_size = VP8_FRAME_IS_KEY_FRAME(slice) ? 10 : 3; + header_size = V4L2_VP8_FRAME_IS_KEY_FRAME(slice) ? 10 : 3; reg = slice->first_part_size + header_size; cedrus_write(dev, VE_VP8_PART_SIZE_OFFSET, reg); @@ -850,7 +850,7 @@ static void cedrus_vp8_setup(struct cedrus_ctx *ctx, ctx->codec.vp8.last_filter_type = !!(slice->lf.flags & V4L2_VP8_LF_FILTER_TYPE_SIMPLE); ctx->codec.vp8.last_frame_p_type = - !VP8_FRAME_IS_KEY_FRAME(slice); + !V4L2_VP8_FRAME_IS_KEY_FRAME(slice); ctx->codec.vp8.last_sharpness_level = slice->lf.sharpness_level; } diff --git a/include/media/vp8-ctrls.h b/include/media/vp8-ctrls.h index 409a87f9e609..d19bf25e836d 100644 --- a/include/media/vp8-ctrls.h +++ b/include/media/vp8-ctrls.h @@ -146,7 +146,7 @@ struct v4l2_vp8_entropy_coder_state { #define V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN 0x10 #define V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT 0x20 -#define VP8_FRAME_IS_KEY_FRAME(hdr) \ +#define V4L2_VP8_FRAME_IS_KEY_FRAME(hdr) \ (!!((hdr)->flags & V4L2_VP8_FRAME_FLAG_KEY_FRAME)) /** -- cgit v1.2.3-59-g8ed1b From 363240ce1c08875815d28276f0a793bcaedb1ee9 Mon Sep 17 00:00:00 2001 From: Ezequiel Garcia Date: Thu, 4 Mar 2021 15:07:55 +0100 Subject: media: uapi: move VP8 stateless controls out of staging Until now, the VP8 V4L2 API was not exported as a public API, and only defined in a private media header (media/vp8-ctrls.h). The reason for this was a concern about the API not complete and ready to support VP8 decoding hardware accelerators. After reviewing the VP8 specification in detail, and now that the API is able to support Cedrus and Hantro G1, we can consider this ready. Signed-off-by: Ezequiel Garcia Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- .../media/v4l/ext-ctrls-codec-stateless.rst | 334 ++++++++++++++++++++ .../userspace-api/media/v4l/ext-ctrls-codec.rst | 339 --------------------- .../userspace-api/media/v4l/pixfmt-compressed.rst | 10 +- .../userspace-api/media/v4l/vidioc-g-ext-ctrls.rst | 4 + .../userspace-api/media/v4l/vidioc-queryctrl.rst | 6 + .../userspace-api/media/videodev2.h.rst.exceptions | 1 + drivers/media/v4l2-core/v4l2-ctrls.c | 4 +- drivers/staging/media/hantro/hantro_drv.c | 2 +- drivers/staging/media/hantro/hantro_g1_vp8_dec.c | 3 +- .../staging/media/hantro/rk3399_vpu_hw_vp8_dec.c | 3 +- drivers/staging/media/sunxi/cedrus/cedrus.c | 2 +- drivers/staging/media/sunxi/cedrus/cedrus_dec.c | 2 +- drivers/staging/media/sunxi/cedrus/cedrus_vp8.c | 3 +- include/media/v4l2-ctrls.h | 1 - include/media/vp8-ctrls.h | 210 ------------- include/uapi/linux/v4l2-controls.h | 195 ++++++++++++ include/uapi/linux/videodev2.h | 1 + 17 files changed, 555 insertions(+), 565 deletions(-) delete mode 100644 include/media/vp8-ctrls.h (limited to 'include/media') diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst index 90c0e1d57544..3fc04daa9ffb 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec-stateless.rst @@ -910,3 +910,337 @@ FWHT Flags .. raw:: latex \normalsize + +.. _v4l2-codec-stateless-vp8: + +``V4L2_CID_STATELESS_VP8_FRAME (struct)`` + Specifies the frame parameters for the associated VP8 parsed frame data. + This includes the necessary parameters for + configuring a stateless hardware decoding pipeline for VP8. + The bitstream parameters are defined according to :ref:`vp8`. + +.. c:type:: v4l2_ctrl_vp8_frame + +.. raw:: latex + + \small + +.. tabularcolumns:: |p{7.0cm}|p{4.6cm}|p{5.7cm}| + +.. cssclass:: longtable + +.. flat-table:: struct v4l2_ctrl_vp8_frame + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - struct :c:type:`v4l2_vp8_segment` + - ``segment`` + - Structure with segment-based adjustments metadata. + * - struct :c:type:`v4l2_vp8_loop_filter` + - ``lf`` + - Structure with loop filter level adjustments metadata. + * - struct :c:type:`v4l2_vp8_quantization` + - ``quant`` + - Structure with VP8 dequantization indices metadata. + * - struct :c:type:`v4l2_vp8_entropy` + - ``entropy`` + - Structure with VP8 entropy coder probabilities metadata. + * - struct :c:type:`v4l2_vp8_entropy_coder_state` + - ``coder_state`` + - Structure with VP8 entropy coder state. + * - __u16 + - ``width`` + - The width of the frame. Must be set for all frames. + * - __u16 + - ``height`` + - The height of the frame. Must be set for all frames. + * - __u8 + - ``horizontal_scale`` + - Horizontal scaling factor. + * - __u8 + - ``vertical_scaling factor`` + - Vertical scale. + * - __u8 + - ``version`` + - Bitstream version. + * - __u8 + - ``prob_skip_false`` + - Indicates the probability that the macroblock is not skipped. + * - __u8 + - ``prob_intra`` + - Indicates the probability that a macroblock is intra-predicted. + * - __u8 + - ``prob_last`` + - Indicates the probability that the last reference frame is used + for inter-prediction + * - __u8 + - ``prob_gf`` + - Indicates the probability that the golden reference frame is used + for inter-prediction + * - __u8 + - ``num_dct_parts`` + - Number of DCT coefficients partitions. Must be one of: 1, 2, 4, or 8. + * - __u32 + - ``first_part_size`` + - Size of the first partition, i.e. the control partition. + * - __u32 + - ``first_part_header_bits`` + - Size in bits of the first partition header portion. + * - __u32 + - ``dct_part_sizes[8]`` + - DCT coefficients sizes. + * - __u64 + - ``last_frame_ts`` + - Timestamp for the V4L2 capture buffer to use as last reference frame, used + with inter-coded frames. The timestamp refers to the ``timestamp`` field in + struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()` + function to convert the struct :c:type:`timeval` in struct + :c:type:`v4l2_buffer` to a __u64. + * - __u64 + - ``golden_frame_ts`` + - Timestamp for the V4L2 capture buffer to use as last reference frame, used + with inter-coded frames. The timestamp refers to the ``timestamp`` field in + struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()` + function to convert the struct :c:type:`timeval` in struct + :c:type:`v4l2_buffer` to a __u64. + * - __u64 + - ``alt_frame_ts`` + - Timestamp for the V4L2 capture buffer to use as alternate reference frame, used + with inter-coded frames. The timestamp refers to the ``timestamp`` field in + struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()` + function to convert the struct :c:type:`timeval` in struct + :c:type:`v4l2_buffer` to a __u64. + * - __u64 + - ``flags`` + - See :ref:`Frame Flags ` + +.. raw:: latex + + \normalsize + +.. _vp8_frame_flags: + +``Frame Flags`` + +.. tabularcolumns:: |p{9.8cm}|p{0.8cm}|p{6.7cm}| + +.. cssclass:: longtable + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - ``V4L2_VP8_FRAME_FLAG_KEY_FRAME`` + - 0x01 + - Indicates if the frame is a key frame. + * - ``V4L2_VP8_FRAME_FLAG_EXPERIMENTAL`` + - 0x02 + - Experimental bitstream. + * - ``V4L2_VP8_FRAME_FLAG_SHOW_FRAME`` + - 0x04 + - Show frame flag, indicates if the frame is for display. + * - ``V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF`` + - 0x08 + - Enable/disable skipping of macroblocks with no non-zero coefficients. + * - ``V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN`` + - 0x10 + - Sign of motion vectors when the golden frame is referenced. + * - ``V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT`` + - 0x20 + - Sign of motion vectors when the alt frame is referenced. + +.. c:type:: v4l2_vp8_entropy_coder_state + +.. cssclass:: longtable + +.. tabularcolumns:: |p{1.0cm}|p{2.0cm}|p{14.3cm}| + +.. flat-table:: struct v4l2_vp8_entropy_coder_state + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - __u8 + - ``range`` + - coder state value for "Range" + * - __u8 + - ``value`` + - coder state value for "Value"- + * - __u8 + - ``bit_count`` + - number of bits left. + * - __u8 + - ``padding`` + - Applications and drivers must set this to zero. + +.. c:type:: v4l2_vp8_segment + +.. cssclass:: longtable + +.. tabularcolumns:: |p{1.2cm}|p{4.0cm}|p{12.1cm}| + +.. flat-table:: struct v4l2_vp8_segment + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - __s8 + - ``quant_update[4]`` + - Signed quantizer value update. + * - __s8 + - ``lf_update[4]`` + - Signed loop filter level value update. + * - __u8 + - ``segment_probs[3]`` + - Segment probabilities. + * - __u8 + - ``padding`` + - Applications and drivers must set this to zero. + * - __u32 + - ``flags`` + - See :ref:`Segment Flags ` + +.. _vp8_segment_flags: + +``Segment Flags`` + +.. raw:: latex + + \small + +.. tabularcolumns:: |p{10cm}|p{1.0cm}|p{6.3cm}| + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - ``V4L2_VP8_SEGMENT_FLAG_ENABLED`` + - 0x01 + - Enable/disable segment-based adjustments. + * - ``V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP`` + - 0x02 + - Indicates if the macroblock segmentation map is updated in this frame. + * - ``V4L2_VP8_SEGMENT_FLAG_UPDATE_FEATURE_DATA`` + - 0x04 + - Indicates if the segment feature data is updated in this frame. + * - ``V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE`` + - 0x08 + - If is set, the segment feature data mode is delta-value. + If cleared, it's absolute-value. + +.. raw:: latex + + \normalsize + +.. c:type:: v4l2_vp8_loop_filter + +.. cssclass:: longtable + +.. tabularcolumns:: |p{1.5cm}|p{3.9cm}|p{11.9cm}| + +.. flat-table:: struct v4l2_vp8_loop_filter + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - __s8 + - ``ref_frm_delta[4]`` + - Reference adjustment (signed) delta value. + * - __s8 + - ``mb_mode_delta[4]`` + - Macroblock prediction mode adjustment (signed) delta value. + * - __u8 + - ``sharpness_level`` + - Sharpness level + * - __u8 + - ``level`` + - Filter level + * - __u16 + - ``padding`` + - Applications and drivers must set this to zero. + * - __u32 + - ``flags`` + - See :ref:`Loop Filter Flags ` + +.. _vp8_loop_filter_flags: + +``Loop Filter Flags`` + +.. tabularcolumns:: |p{7.0cm}|p{1.2cm}|p{9.1cm}| + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - ``V4L2_VP8_LF_ADJ_ENABLE`` + - 0x01 + - Enable/disable macroblock-level loop filter adjustment. + * - ``V4L2_VP8_LF_DELTA_UPDATE`` + - 0x02 + - Indicates if the delta values used in an adjustment are updated. + * - ``V4L2_VP8_LF_FILTER_TYPE_SIMPLE`` + - 0x04 + - If set, indicates the filter type is simple. + If cleared, the filter type is normal. + +.. c:type:: v4l2_vp8_quantization + +.. tabularcolumns:: |p{1.5cm}|p{3.5cm}|p{12.3cm}| + +.. flat-table:: struct v4l2_vp8_quantization + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - __u8 + - ``y_ac_qi`` + - Luma AC coefficient table index. + * - __s8 + - ``y_dc_delta`` + - Luma DC delta vaue. + * - __s8 + - ``y2_dc_delta`` + - Y2 block DC delta value. + * - __s8 + - ``y2_ac_delta`` + - Y2 block AC delta value. + * - __s8 + - ``uv_dc_delta`` + - Chroma DC delta value. + * - __s8 + - ``uv_ac_delta`` + - Chroma AC delta value. + * - __u16 + - ``padding`` + - Applications and drivers must set this to zero. + +.. c:type:: v4l2_vp8_entropy + +.. cssclass:: longtable + +.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}| + +.. flat-table:: struct v4l2_vp8_entropy + :header-rows: 0 + :stub-columns: 0 + :widths: 1 1 2 + + * - __u8 + - ``coeff_probs[4][8][3][11]`` + - Coefficient update probabilities. + * - __u8 + - ``y_mode_probs[4]`` + - Luma mode update probabilities. + * - __u8 + - ``uv_mode_probs[3]`` + - Chroma mode update probabilities. + * - __u8 + - ``mv_probs[2][19]`` + - MV decoding update probabilities. + * - __u8 + - ``padding[3]`` + - Applications and drivers must set this to zero. diff --git a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst index 1fa9a54f63bf..8a48ac30bc6a 100644 --- a/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst +++ b/Documentation/userspace-api/media/v4l/ext-ctrls-codec.rst @@ -1798,345 +1798,6 @@ enum v4l2_mpeg_video_h264_hierarchical_coding_type - Quantization parameter for a P frame for FWHT. Valid range: from 1 to 31. -.. _v4l2-mpeg-vp8: - -``V4L2_CID_MPEG_VIDEO_VP8_FRAME (struct)`` - Specifies the frame parameters for the associated VP8 parsed frame data. - This includes the necessary parameters for - configuring a stateless hardware decoding pipeline for VP8. - The bitstream parameters are defined according to :ref:`vp8`. - - .. note:: - - This compound control is not yet part of the public kernel API and - it is expected to change. - -.. c:type:: v4l2_ctrl_vp8_frame - -.. raw:: latex - - \small - -.. tabularcolumns:: |p{7.0cm}|p{4.6cm}|p{5.7cm}| - -.. cssclass:: longtable - -.. flat-table:: struct v4l2_ctrl_vp8_frame - :header-rows: 0 - :stub-columns: 0 - :widths: 1 1 2 - - * - struct :c:type:`v4l2_vp8_segment` - - ``segment`` - - Structure with segment-based adjustments metadata. - * - struct :c:type:`v4l2_vp8_loop_filter` - - ``lf`` - - Structure with loop filter level adjustments metadata. - * - struct :c:type:`v4l2_vp8_quantization` - - ``quant`` - - Structure with VP8 dequantization indices metadata. - * - struct :c:type:`v4l2_vp8_entropy` - - ``entropy`` - - Structure with VP8 entropy coder probabilities metadata. - * - struct :c:type:`v4l2_vp8_entropy_coder_state` - - ``coder_state`` - - Structure with VP8 entropy coder state. - * - __u16 - - ``width`` - - The width of the frame. Must be set for all frames. - * - __u16 - - ``height`` - - The height of the frame. Must be set for all frames. - * - __u8 - - ``horizontal_scale`` - - Horizontal scaling factor. - * - __u8 - - ``vertical_scaling factor`` - - Vertical scale. - * - __u8 - - ``version`` - - Bitstream version. - * - __u8 - - ``prob_skip_false`` - - Indicates the probability that the macroblock is not skipped. - * - __u8 - - ``prob_intra`` - - Indicates the probability that a macroblock is intra-predicted. - * - __u8 - - ``prob_last`` - - Indicates the probability that the last reference frame is used - for inter-prediction - * - __u8 - - ``prob_gf`` - - Indicates the probability that the golden reference frame is used - for inter-prediction - * - __u8 - - ``num_dct_parts`` - - Number of DCT coefficients partitions. Must be one of: 1, 2, 4, or 8. - * - __u32 - - ``first_part_size`` - - Size of the first partition, i.e. the control partition. - * - __u32 - - ``first_part_header_bits`` - - Size in bits of the first partition header portion. - * - __u32 - - ``dct_part_sizes[8]`` - - DCT coefficients sizes. - * - __u64 - - ``last_frame_ts`` - - Timestamp for the V4L2 capture buffer to use as last reference frame, used - with inter-coded frames. The timestamp refers to the ``timestamp`` field in - struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()` - function to convert the struct :c:type:`timeval` in struct - :c:type:`v4l2_buffer` to a __u64. - * - __u64 - - ``golden_frame_ts`` - - Timestamp for the V4L2 capture buffer to use as last reference frame, used - with inter-coded frames. The timestamp refers to the ``timestamp`` field in - struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()` - function to convert the struct :c:type:`timeval` in struct - :c:type:`v4l2_buffer` to a __u64. - * - __u64 - - ``alt_frame_ts`` - - Timestamp for the V4L2 capture buffer to use as alternate reference frame, used - with inter-coded frames. The timestamp refers to the ``timestamp`` field in - struct :c:type:`v4l2_buffer`. Use the :c:func:`v4l2_timeval_to_ns()` - function to convert the struct :c:type:`timeval` in struct - :c:type:`v4l2_buffer` to a __u64. - * - __u64 - - ``flags`` - - See :ref:`Frame Flags ` - -.. raw:: latex - - \normalsize - -.. _vp8_frame_flags: - -``Frame Flags`` - -.. tabularcolumns:: |p{9.8cm}|p{0.8cm}|p{6.7cm}| - -.. cssclass:: longtable - -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 - :widths: 1 1 2 - - * - ``V4L2_VP8_FRAME_FLAG_KEY_FRAME`` - - 0x01 - - Indicates if the frame is a key frame. - * - ``V4L2_VP8_FRAME_FLAG_EXPERIMENTAL`` - - 0x02 - - Experimental bitstream. - * - ``V4L2_VP8_FRAME_FLAG_SHOW_FRAME`` - - 0x04 - - Show frame flag, indicates if the frame is for display. - * - ``V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF`` - - 0x08 - - Enable/disable skipping of macroblocks with no non-zero coefficients. - * - ``V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN`` - - 0x10 - - Sign of motion vectors when the golden frame is referenced. - * - ``V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT`` - - 0x20 - - Sign of motion vectors when the alt frame is referenced. - -.. c:type:: v4l2_vp8_entropy_coder_state - -.. cssclass:: longtable - -.. tabularcolumns:: |p{1.0cm}|p{2.0cm}|p{14.3cm}| - -.. flat-table:: struct v4l2_vp8_entropy_coder_state - :header-rows: 0 - :stub-columns: 0 - :widths: 1 1 2 - - * - __u8 - - ``range`` - - - * - __u8 - - ``value`` - - - * - __u8 - - ``bit_count`` - - - * - __u8 - - ``padding`` - - Applications and drivers must set this to zero. - -.. c:type:: v4l2_vp8_segment - -.. cssclass:: longtable - -.. tabularcolumns:: |p{1.2cm}|p{4.0cm}|p{12.1cm}| - -.. flat-table:: struct v4l2_vp8_segment - :header-rows: 0 - :stub-columns: 0 - :widths: 1 1 2 - - * - __s8 - - ``quant_update[4]`` - - Signed quantizer value update. - * - __s8 - - ``lf_update[4]`` - - Signed loop filter level value update. - * - __u8 - - ``segment_probs[3]`` - - Segment probabilities. - * - __u8 - - ``padding`` - - Applications and drivers must set this to zero. - * - __u32 - - ``flags`` - - See :ref:`Segment Flags ` - -.. _vp8_segment_flags: - -``Segment Flags`` - -.. raw:: latex - - \small - -.. tabularcolumns:: |p{10cm}|p{1.0cm}|p{6.3cm}| - -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 - :widths: 1 1 2 - - * - ``V4L2_VP8_SEGMENT_FLAG_ENABLED`` - - 0x01 - - Enable/disable segment-based adjustments. - * - ``V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP`` - - 0x02 - - Indicates if the macroblock segmentation map is updated in this frame. - * - ``V4L2_VP8_SEGMENT_FLAG_UPDATE_FEATURE_DATA`` - - 0x04 - - Indicates if the segment feature data is updated in this frame. - * - ``V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE`` - - 0x08 - - If is set, the segment feature data mode is delta-value. - If cleared, it's absolute-value. - -.. raw:: latex - - \normalsize - -.. c:type:: v4l2_vp8_loop_filter - -.. cssclass:: longtable - -.. tabularcolumns:: |p{1.5cm}|p{3.9cm}|p{11.9cm}| - -.. flat-table:: struct v4l2_vp8_loop_filter - :header-rows: 0 - :stub-columns: 0 - :widths: 1 1 2 - - * - __s8 - - ``ref_frm_delta[4]`` - - Reference adjustment (signed) delta value. - * - __s8 - - ``mb_mode_delta[4]`` - - Macroblock prediction mode adjustment (signed) delta value. - * - __u8 - - ``sharpness_level`` - - Sharpness level - * - __u8 - - ``level`` - - Filter level - * - __u16 - - ``padding`` - - Applications and drivers must set this to zero. - * - __u32 - - ``flags`` - - See :ref:`Loop Filter Flags ` - -.. _vp8_loop_filter_flags: - -``Loop Filter Flags`` - -.. tabularcolumns:: |p{7.0cm}|p{1.2cm}|p{9.1cm}| - -.. flat-table:: - :header-rows: 0 - :stub-columns: 0 - :widths: 1 1 2 - - * - ``V4L2_VP8_LF_ADJ_ENABLE`` - - 0x01 - - Enable/disable macroblock-level loop filter adjustment. - * - ``V4L2_VP8_LF_DELTA_UPDATE`` - - 0x02 - - Indicates if the delta values used in an adjustment are updated. - * - ``V4L2_VP8_LF_FILTER_TYPE_SIMPLE`` - - 0x04 - - If set, indicates the filter type is simple. - If cleared, the filter type is normal. - -.. c:type:: v4l2_vp8_quantization - -.. tabularcolumns:: |p{1.5cm}|p{3.5cm}|p{12.3cm}| - -.. flat-table:: struct v4l2_vp8_quantization - :header-rows: 0 - :stub-columns: 0 - :widths: 1 1 2 - - * - __u8 - - ``y_ac_qi`` - - Luma AC coefficient table index. - * - __s8 - - ``y_dc_delta`` - - Luma DC delta vaue. - * - __s8 - - ``y2_dc_delta`` - - Y2 block DC delta value. - * - __s8 - - ``y2_ac_delta`` - - Y2 block AC delta value. - * - __s8 - - ``uv_dc_delta`` - - Chroma DC delta value. - * - __s8 - - ``uv_ac_delta`` - - Chroma AC delta value. - * - __u16 - - ``padding`` - - Applications and drivers must set this to zero. - -.. c:type:: v4l2_vp8_entropy - -.. cssclass:: longtable - -.. tabularcolumns:: |p{1.5cm}|p{5.8cm}|p{10.0cm}| - -.. flat-table:: struct v4l2_vp8_entropy - :header-rows: 0 - :stub-columns: 0 - :widths: 1 1 2 - - * - __u8 - - ``coeff_probs[4][8][3][11]`` - - Coefficient update probabilities. - * - __u8 - - ``y_mode_probs[4]`` - - Luma mode update probabilities. - * - __u8 - - ``uv_mode_probs[3]`` - - Chroma mode update probabilities. - * - __u8 - - ``mv_probs[2][19]`` - - MV decoding update probabilities. - * - __u8 - - ``padding[3]`` - - Applications and drivers must set this to zero. - .. raw:: latex \normalsize diff --git a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst index 0232d0808519..6dba70da822b 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-compressed.rst @@ -153,12 +153,12 @@ Compressed Formats - ``V4L2_PIX_FMT_VP8_FRAME`` - 'VP8F' - - VP8 parsed frame, as extracted from the container. - This format is adapted for stateless video decoders that implement a - VP8 pipeline (using the :ref:`mem2mem` and :ref:`media-request-api`). + - VP8 parsed frame, including the frame header, as extracted from the container. + This format is adapted for stateless video decoders that implement an + VP8 pipeline with the :ref:`stateless_decoder`. Metadata associated with the frame to decode is required to be passed - through the ``V4L2_CID_MPEG_VIDEO_VP8_FRAME`` control. - See the :ref:`associated Codec Control IDs `. + through the ``V4L2_CID_STATELESS_VP8_FRAME`` control. + See the :ref:`associated Codec Control IDs `. Exactly one output and one capture buffer must be provided for use with this pixel format. The output buffer must contain the appropriate number of macroblocks to decode a full corresponding frame to the matching diff --git a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst index 01773f01c4a7..e5c4e0a175a7 100644 --- a/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst +++ b/Documentation/userspace-api/media/v4l/vidioc-g-ext-ctrls.rst @@ -216,6 +216,10 @@ still cause this situation. - ``p_fwht_params`` - A pointer to a struct :c:type:`v4l2_ctrl_fwht_params`. Valid if this control is of type ``V4L2_CTRL_TYPE_FWHT_PARAMS``. + * - struct :c:type:`v4l2_ctrl_vp8_frame` * + - ``p_vp8_frame`` + - A pointer to a struct :c:type:`v4l2_ctrl_vp8_frame`. Valid if this control is + of type ``V4L2_CTRL_TYPE_VP8_FRAME``. * - void * - ``ptr`` - A pointer to a compound type which can be an N-dimensional array diff --git a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst index 9af43f913694..8a285daedc6a 100644 --- a/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst +++ b/Documentation/userspace-api/media/v4l/vidioc-queryctrl.rst @@ -489,6 +489,12 @@ See also the examples in :ref:`control`. - n/a - A struct :c:type:`v4l2_ctrl_hevc_slice_params`, containing HEVC slice parameters for stateless video decoders. + * - ``V4L2_CTRL_TYPE_VP8_FRAME`` + - n/a + - n/a + - n/a + - A struct :c:type:`v4l2_ctrl_vp8_frame`, containing VP8 + frame parameters for stateless video decoders. .. raw:: latex diff --git a/Documentation/userspace-api/media/videodev2.h.rst.exceptions b/Documentation/userspace-api/media/videodev2.h.rst.exceptions index 0ed170c6e720..afb1552b2d39 100644 --- a/Documentation/userspace-api/media/videodev2.h.rst.exceptions +++ b/Documentation/userspace-api/media/videodev2.h.rst.exceptions @@ -147,6 +147,7 @@ replace symbol V4L2_CTRL_TYPE_HEVC_PPS :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_TYPE_AREA :c:type:`v4l2_ctrl_type` replace symbol V4L2_CTRL_TYPE_FWHT_PARAMS :c:type:`v4l2_ctrl_type` +replace symbol V4L2_CTRL_TYPE_VP8_FRAME :c:type:`v4l2_ctrl_type` # V4L2 capability defines replace define V4L2_CAP_VIDEO_CAPTURE device-capabilities diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index b3fc293bb8f0..36a7983f7206 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -974,7 +974,6 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_MPEG_VIDEO_VP8_PROFILE: return "VP8 Profile"; case V4L2_CID_MPEG_VIDEO_VP9_PROFILE: return "VP9 Profile"; case V4L2_CID_MPEG_VIDEO_VP9_LEVEL: return "VP9 Level"; - case V4L2_CID_MPEG_VIDEO_VP8_FRAME: return "VP8 Frame Parameters"; /* HEVC controls */ case V4L2_CID_MPEG_VIDEO_HEVC_I_FRAME_QP: return "HEVC I-Frame QP Value"; @@ -1204,6 +1203,7 @@ const char *v4l2_ctrl_get_name(u32 id) case V4L2_CID_STATELESS_H264_SLICE_PARAMS: return "H264 Slice Parameters"; case V4L2_CID_STATELESS_H264_DECODE_PARAMS: return "H264 Decode Parameters"; case V4L2_CID_STATELESS_FWHT_PARAMS: return "FWHT Stateless Parameters"; + case V4L2_CID_STATELESS_VP8_FRAME: return "VP8 Frame Parameters"; default: return NULL; } @@ -1476,7 +1476,7 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, case V4L2_CID_STATELESS_H264_PRED_WEIGHTS: *type = V4L2_CTRL_TYPE_H264_PRED_WEIGHTS; break; - case V4L2_CID_MPEG_VIDEO_VP8_FRAME: + case V4L2_CID_STATELESS_VP8_FRAME: *type = V4L2_CTRL_TYPE_VP8_FRAME; break; case V4L2_CID_MPEG_VIDEO_HEVC_SPS: diff --git a/drivers/staging/media/hantro/hantro_drv.c b/drivers/staging/media/hantro/hantro_drv.c index f1e7f0732e27..595e82a82728 100644 --- a/drivers/staging/media/hantro/hantro_drv.c +++ b/drivers/staging/media/hantro/hantro_drv.c @@ -299,7 +299,7 @@ static const struct hantro_ctrl controls[] = { }, { .codec = HANTRO_VP8_DECODER, .cfg = { - .id = V4L2_CID_MPEG_VIDEO_VP8_FRAME, + .id = V4L2_CID_STATELESS_VP8_FRAME, }, }, { .codec = HANTRO_H264_DECODER, diff --git a/drivers/staging/media/hantro/hantro_g1_vp8_dec.c b/drivers/staging/media/hantro/hantro_g1_vp8_dec.c index 7d6270e26297..57002ba70176 100644 --- a/drivers/staging/media/hantro/hantro_g1_vp8_dec.c +++ b/drivers/staging/media/hantro/hantro_g1_vp8_dec.c @@ -10,7 +10,6 @@ */ #include -#include #include "hantro_hw.h" #include "hantro.h" @@ -437,7 +436,7 @@ void hantro_g1_vp8_dec_run(struct hantro_ctx *ctx) hantro_start_prepare_run(ctx); - hdr = hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_VP8_FRAME); + hdr = hantro_get_ctrl(ctx, V4L2_CID_STATELESS_VP8_FRAME); if (WARN_ON(!hdr)) return; diff --git a/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c b/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c index caa1435008d4..8661a3cc1e6b 100644 --- a/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c +++ b/drivers/staging/media/hantro/rk3399_vpu_hw_vp8_dec.c @@ -13,7 +13,6 @@ */ #include -#include #include "hantro_hw.h" #include "hantro.h" @@ -515,7 +514,7 @@ void rk3399_vpu_vp8_dec_run(struct hantro_ctx *ctx) hantro_start_prepare_run(ctx); - hdr = hantro_get_ctrl(ctx, V4L2_CID_MPEG_VIDEO_VP8_FRAME); + hdr = hantro_get_ctrl(ctx, V4L2_CID_STATELESS_VP8_FRAME); if (WARN_ON(!hdr)) return; diff --git a/drivers/staging/media/sunxi/cedrus/cedrus.c b/drivers/staging/media/sunxi/cedrus/cedrus.c index e233feb49c9c..92812d1a39d4 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus.c @@ -147,7 +147,7 @@ static const struct cedrus_control cedrus_controls[] = { }, { .cfg = { - .id = V4L2_CID_MPEG_VIDEO_VP8_FRAME, + .id = V4L2_CID_STATELESS_VP8_FRAME, }, .codec = CEDRUS_CODEC_VP8, }, diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c index b0a0559cd0eb..d696b3ec70c0 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_dec.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_dec.c @@ -72,7 +72,7 @@ void cedrus_device_run(void *priv) case V4L2_PIX_FMT_VP8_FRAME: run.vp8.frame_params = cedrus_find_control_data(ctx, - V4L2_CID_MPEG_VIDEO_VP8_FRAME); + V4L2_CID_STATELESS_VP8_FRAME); break; default: diff --git a/drivers/staging/media/sunxi/cedrus/cedrus_vp8.c b/drivers/staging/media/sunxi/cedrus/cedrus_vp8.c index 12b233d28db3..f4016684b32d 100644 --- a/drivers/staging/media/sunxi/cedrus/cedrus_vp8.c +++ b/drivers/staging/media/sunxi/cedrus/cedrus_vp8.c @@ -423,7 +423,8 @@ static const u8 prob_table_init[] = { * This table is a copy of k_mv_entropy_update_probs from the VP8 * specification. * - * FIXME: If any other driver uses it, move this table to media/vp8-ctrls.h + * FIXME: If any other driver uses it, we can consider moving + * this table so it can be shared. */ static const u8 k_mv_entropy_update_probs[2][V4L2_VP8_MV_PROB_CNT] = { { 237, 246, 253, 253, 254, 254, 254, 254, 254, diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index aa06ff1695fe..dea65c92e86b 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -18,7 +18,6 @@ * This will move to the public headers once this API is fully stable. */ #include -#include #include /* forward references */ diff --git a/include/media/vp8-ctrls.h b/include/media/vp8-ctrls.h deleted file mode 100644 index d19bf25e836d..000000000000 --- a/include/media/vp8-ctrls.h +++ /dev/null @@ -1,210 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * These are the VP8 state controls for use with stateless VP8 - * codec drivers. - * - * It turns out that these structs are not stable yet and will undergo - * more changes. So keep them private until they are stable and ready to - * become part of the official public API. - */ - -#ifndef _VP8_CTRLS_H_ -#define _VP8_CTRLS_H_ - -#include - -#define V4L2_CID_MPEG_VIDEO_VP8_FRAME (V4L2_CID_CODEC_BASE + 2000) - -#define V4L2_VP8_SEGMENT_FLAG_ENABLED 0x01 -#define V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP 0x02 -#define V4L2_VP8_SEGMENT_FLAG_UPDATE_FEATURE_DATA 0x04 -#define V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE 0x08 - -/** - * struct v4l2_vp8_segment - VP8 segment-based adjustments parameters - * - * @quant_update: update values for the segment quantizer. - * @lf_update: update values for the loop filter level. - * @segment_probs: branch probabilities of the segment_id decoding tree. - * @padding: padding field. Should be zeroed by applications. - * @flags: see V4L2_VP8_SEGMENT_FLAG_{}. - * - * This structure contains segment-based adjustments related parameters. - * See the 'update_segmentation()' part of the frame header syntax, - * and section '9.3. Segment-Based Adjustments' of the VP8 specification - * for more details. - */ -struct v4l2_vp8_segment { - __s8 quant_update[4]; - __s8 lf_update[4]; - __u8 segment_probs[3]; - __u8 padding; - __u32 flags; -}; - -#define V4L2_VP8_LF_ADJ_ENABLE 0x01 -#define V4L2_VP8_LF_DELTA_UPDATE 0x02 -#define V4L2_VP8_LF_FILTER_TYPE_SIMPLE 0x04 - -/** - * struct v4l2_vp8_loop_filter - VP8 loop filter parameters - * - * @ref_frm_delta: Reference frame signed delta values. - * @mb_mode_delta: MB prediction mode signed delta values. - * @sharpness_level: matches sharpness_level syntax element. - * @level: matches loop_filter_level syntax element. - * @padding: padding field. Should be zeroed by applications. - * @flags: see V4L2_VP8_LF_FLAG_{}. - * - * This structure contains loop filter related parameters. - * See the 'mb_lf_adjustments()' part of the frame header syntax, - * and section '9.4. Loop Filter Type and Levels' of the VP8 specification - * for more details. - */ -struct v4l2_vp8_loop_filter { - __s8 ref_frm_delta[4]; - __s8 mb_mode_delta[4]; - __u8 sharpness_level; - __u8 level; - __u16 padding; - __u32 flags; -}; - -/** - * struct v4l2_vp8_quantization - VP8 quantizattion indices - * - * @y_ac_qi: luma AC coefficient table index. - * @y_dc_delta: luma DC delta vaue. - * @y2_dc_delta: y2 block DC delta value. - * @y2_ac_delta: y2 block AC delta value. - * @uv_dc_delta: chroma DC delta value. - * @uv_ac_delta: chroma AC delta value. - * @padding: padding field. Should be zeroed by applications. - - * This structure contains the quantization indices present - * in 'quant_indices()' part of the frame header syntax. - * See section '9.6. Dequantization Indices' of the VP8 specification - * for more details. - */ -struct v4l2_vp8_quantization { - __u8 y_ac_qi; - __s8 y_dc_delta; - __s8 y2_dc_delta; - __s8 y2_ac_delta; - __s8 uv_dc_delta; - __s8 uv_ac_delta; - __u16 padding; -}; - -#define V4L2_VP8_COEFF_PROB_CNT 11 -#define V4L2_VP8_MV_PROB_CNT 19 - -/** - * struct v4l2_vp8_entropy - VP8 update probabilities - * - * @coeff_probs: coefficient probability update values. - * @y_mode_probs: luma intra-prediction probabilities. - * @uv_mode_probs: chroma intra-prediction probabilities. - * @mv_probs: mv decoding probability. - * @padding: padding field. Should be zeroed by applications. - * - * This structure contains the update probabilities present in - * 'token_prob_update()' and 'mv_prob_update()' part of the frame header. - * See section '17.2. Probability Updates' of the VP8 specification - * for more details. - */ -struct v4l2_vp8_entropy { - __u8 coeff_probs[4][8][3][V4L2_VP8_COEFF_PROB_CNT]; - __u8 y_mode_probs[4]; - __u8 uv_mode_probs[3]; - __u8 mv_probs[2][V4L2_VP8_MV_PROB_CNT]; - __u8 padding[3]; -}; - -/** - * struct v4l2_vp8_entropy_coder_state - VP8 boolean coder state - * - * @range: coder state value for "Range" - * @value: coder state value for "Value" - * @bit_count: number of bits left in range "Value". - * @padding: padding field. Should be zeroed by applications. - * - * This structure contains the state for the boolean coder, as - * explained in section '7. Boolean Entropy Decoder' of the VP8 specification. - */ -struct v4l2_vp8_entropy_coder_state { - __u8 range; - __u8 value; - __u8 bit_count; - __u8 padding; -}; - -#define V4L2_VP8_FRAME_FLAG_KEY_FRAME 0x01 -#define V4L2_VP8_FRAME_FLAG_EXPERIMENTAL 0x02 -#define V4L2_VP8_FRAME_FLAG_SHOW_FRAME 0x04 -#define V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF 0x08 -#define V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN 0x10 -#define V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT 0x20 - -#define V4L2_VP8_FRAME_IS_KEY_FRAME(hdr) \ - (!!((hdr)->flags & V4L2_VP8_FRAME_FLAG_KEY_FRAME)) - -/** - * struct v4l2_vp8_frame - VP8 frame parameters - * - * @seg: segmentation parameters. See &v4l2_vp8_segment for more details - * @lf: loop filter parameters. See &v4l2_vp8_loop_filter for more details - * @quant: quantization parameters. See &v4l2_vp8_quantization for more details - * @probs: probabilities. See &v4l2_vp9_probabilities for more details - * @width: frame width. - * @height: frame height. - * @horizontal_scale: horizontal scaling factor. - * @vertical_scale: vertical scaling factor. - * @version: bitstream version. - * @prob_skip_false: frame header syntax element. - * @prob_intra: frame header syntax element. - * @prob_last: frame header syntax element. - * @prob_gf: frame header syntax element. - * @num_dct_parts: number of DCT coefficients partitions. - * @first_part_size: size of the first partition, i.e. the control partition. - * @first_part_header_bits: size in bits of the first partition header portion. - * @dct_part_sizes: DCT coefficients sizes. - * @last_frame_ts: "last" reference buffer timestamp. - * The timestamp refers to the timestamp field in struct v4l2_buffer. - * Use v4l2_timeval_to_ns() to convert the struct timeval to a __u64. - * @golden_frame_ts: "golden" reference buffer timestamp. - * @alt_frame_ts: "alt" reference buffer timestamp. - * @flags: see V4L2_VP8_FRAME_FLAG_{}. - */ -struct v4l2_ctrl_vp8_frame { - struct v4l2_vp8_segment segment; - struct v4l2_vp8_loop_filter lf; - struct v4l2_vp8_quantization quant; - struct v4l2_vp8_entropy entropy; - struct v4l2_vp8_entropy_coder_state coder_state; - - __u16 width; - __u16 height; - - __u8 horizontal_scale; - __u8 vertical_scale; - - __u8 version; - __u8 prob_skip_false; - __u8 prob_intra; - __u8 prob_last; - __u8 prob_gf; - __u8 num_dct_parts; - - __u32 first_part_size; - __u32 first_part_header_bits; - __u32 dct_part_sizes[8]; - - __u64 last_frame_ts; - __u64 golden_frame_ts; - __u64 alt_frame_ts; - - __u64 flags; -}; - -#endif diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index 6f8c08507bf4..49c7761aae82 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -1661,6 +1661,201 @@ struct v4l2_ctrl_fwht_params { __u32 quantization; }; +/* Stateless VP8 control */ + +#define V4L2_VP8_SEGMENT_FLAG_ENABLED 0x01 +#define V4L2_VP8_SEGMENT_FLAG_UPDATE_MAP 0x02 +#define V4L2_VP8_SEGMENT_FLAG_UPDATE_FEATURE_DATA 0x04 +#define V4L2_VP8_SEGMENT_FLAG_DELTA_VALUE_MODE 0x08 + +/** + * struct v4l2_vp8_segment - VP8 segment-based adjustments parameters + * + * @quant_update: update values for the segment quantizer. + * @lf_update: update values for the loop filter level. + * @segment_probs: branch probabilities of the segment_id decoding tree. + * @padding: padding field. Should be zeroed by applications. + * @flags: see V4L2_VP8_SEGMENT_FLAG_{}. + * + * This structure contains segment-based adjustments related parameters. + * See the 'update_segmentation()' part of the frame header syntax, + * and section '9.3. Segment-Based Adjustments' of the VP8 specification + * for more details. + */ +struct v4l2_vp8_segment { + __s8 quant_update[4]; + __s8 lf_update[4]; + __u8 segment_probs[3]; + __u8 padding; + __u32 flags; +}; + +#define V4L2_VP8_LF_ADJ_ENABLE 0x01 +#define V4L2_VP8_LF_DELTA_UPDATE 0x02 +#define V4L2_VP8_LF_FILTER_TYPE_SIMPLE 0x04 + +/** + * struct v4l2_vp8_loop_filter - VP8 loop filter parameters + * + * @ref_frm_delta: Reference frame signed delta values. + * @mb_mode_delta: MB prediction mode signed delta values. + * @sharpness_level: matches sharpness_level syntax element. + * @level: matches loop_filter_level syntax element. + * @padding: padding field. Should be zeroed by applications. + * @flags: see V4L2_VP8_LF_FLAG_{}. + * + * This structure contains loop filter related parameters. + * See the 'mb_lf_adjustments()' part of the frame header syntax, + * and section '9.4. Loop Filter Type and Levels' of the VP8 specification + * for more details. + */ +struct v4l2_vp8_loop_filter { + __s8 ref_frm_delta[4]; + __s8 mb_mode_delta[4]; + __u8 sharpness_level; + __u8 level; + __u16 padding; + __u32 flags; +}; + +/** + * struct v4l2_vp8_quantization - VP8 quantizattion indices + * + * @y_ac_qi: luma AC coefficient table index. + * @y_dc_delta: luma DC delta vaue. + * @y2_dc_delta: y2 block DC delta value. + * @y2_ac_delta: y2 block AC delta value. + * @uv_dc_delta: chroma DC delta value. + * @uv_ac_delta: chroma AC delta value. + * @padding: padding field. Should be zeroed by applications. + + * This structure contains the quantization indices present + * in 'quant_indices()' part of the frame header syntax. + * See section '9.6. Dequantization Indices' of the VP8 specification + * for more details. + */ +struct v4l2_vp8_quantization { + __u8 y_ac_qi; + __s8 y_dc_delta; + __s8 y2_dc_delta; + __s8 y2_ac_delta; + __s8 uv_dc_delta; + __s8 uv_ac_delta; + __u16 padding; +}; + +#define V4L2_VP8_COEFF_PROB_CNT 11 +#define V4L2_VP8_MV_PROB_CNT 19 + +/** + * struct v4l2_vp8_entropy - VP8 update probabilities + * + * @coeff_probs: coefficient probability update values. + * @y_mode_probs: luma intra-prediction probabilities. + * @uv_mode_probs: chroma intra-prediction probabilities. + * @mv_probs: mv decoding probability. + * @padding: padding field. Should be zeroed by applications. + * + * This structure contains the update probabilities present in + * 'token_prob_update()' and 'mv_prob_update()' part of the frame header. + * See section '17.2. Probability Updates' of the VP8 specification + * for more details. + */ +struct v4l2_vp8_entropy { + __u8 coeff_probs[4][8][3][V4L2_VP8_COEFF_PROB_CNT]; + __u8 y_mode_probs[4]; + __u8 uv_mode_probs[3]; + __u8 mv_probs[2][V4L2_VP8_MV_PROB_CNT]; + __u8 padding[3]; +}; + +/** + * struct v4l2_vp8_entropy_coder_state - VP8 boolean coder state + * + * @range: coder state value for "Range" + * @value: coder state value for "Value" + * @bit_count: number of bits left in range "Value". + * @padding: padding field. Should be zeroed by applications. + * + * This structure contains the state for the boolean coder, as + * explained in section '7. Boolean Entropy Decoder' of the VP8 specification. + */ +struct v4l2_vp8_entropy_coder_state { + __u8 range; + __u8 value; + __u8 bit_count; + __u8 padding; +}; + +#define V4L2_VP8_FRAME_FLAG_KEY_FRAME 0x01 +#define V4L2_VP8_FRAME_FLAG_EXPERIMENTAL 0x02 +#define V4L2_VP8_FRAME_FLAG_SHOW_FRAME 0x04 +#define V4L2_VP8_FRAME_FLAG_MB_NO_SKIP_COEFF 0x08 +#define V4L2_VP8_FRAME_FLAG_SIGN_BIAS_GOLDEN 0x10 +#define V4L2_VP8_FRAME_FLAG_SIGN_BIAS_ALT 0x20 + +#define V4L2_VP8_FRAME_IS_KEY_FRAME(hdr) \ + (!!((hdr)->flags & V4L2_VP8_FRAME_FLAG_KEY_FRAME)) + +#define V4L2_CID_STATELESS_VP8_FRAME (V4L2_CID_CODEC_STATELESS_BASE + 200) +/** + * struct v4l2_vp8_frame - VP8 frame parameters + * + * @seg: segmentation parameters. See &v4l2_vp8_segment for more details + * @lf: loop filter parameters. See &v4l2_vp8_loop_filter for more details + * @quant: quantization parameters. See &v4l2_vp8_quantization for more details + * @probs: probabilities. See &v4l2_vp9_probabilities for more details + * @width: frame width. + * @height: frame height. + * @horizontal_scale: horizontal scaling factor. + * @vertical_scale: vertical scaling factor. + * @version: bitstream version. + * @prob_skip_false: frame header syntax element. + * @prob_intra: frame header syntax element. + * @prob_last: frame header syntax element. + * @prob_gf: frame header syntax element. + * @num_dct_parts: number of DCT coefficients partitions. + * @first_part_size: size of the first partition, i.e. the control partition. + * @first_part_header_bits: size in bits of the first partition header portion. + * @dct_part_sizes: DCT coefficients sizes. + * @last_frame_ts: "last" reference buffer timestamp. + * The timestamp refers to the timestamp field in struct v4l2_buffer. + * Use v4l2_timeval_to_ns() to convert the struct timeval to a __u64. + * @golden_frame_ts: "golden" reference buffer timestamp. + * @alt_frame_ts: "alt" reference buffer timestamp. + * @flags: see V4L2_VP8_FRAME_FLAG_{}. + */ +struct v4l2_ctrl_vp8_frame { + struct v4l2_vp8_segment segment; + struct v4l2_vp8_loop_filter lf; + struct v4l2_vp8_quantization quant; + struct v4l2_vp8_entropy entropy; + struct v4l2_vp8_entropy_coder_state coder_state; + + __u16 width; + __u16 height; + + __u8 horizontal_scale; + __u8 vertical_scale; + + __u8 version; + __u8 prob_skip_false; + __u8 prob_intra; + __u8 prob_last; + __u8 prob_gf; + __u8 num_dct_parts; + + __u32 first_part_size; + __u32 first_part_header_bits; + __u32 dct_part_sizes[8]; + + __u64 last_frame_ts; + __u64 golden_frame_ts; + __u64 alt_frame_ts; + + __u64 flags; +}; + /* MPEG-compression definitions kept for backwards compatibility */ #ifndef __KERNEL__ #define V4L2_CTRL_CLASS_MPEG V4L2_CTRL_CLASS_CODEC diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 611b75df7f17..ec2af5ddf7d7 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1738,6 +1738,7 @@ struct v4l2_ext_control { struct v4l2_ctrl_h264_slice_params __user *p_h264_slice_params; struct v4l2_ctrl_h264_decode_params __user *p_h264_decode_params; struct v4l2_ctrl_fwht_params __user *p_fwht_params; + struct v4l2_ctrl_vp8_frame __user *p_vp8_frame; void __user *ptr; }; } __attribute__ ((packed)); -- cgit v1.2.3-59-g8ed1b From f12b81e47f48940a6ec82ff308a7d97cd2307442 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 9 Mar 2021 12:48:20 +0100 Subject: media: core headers: fix kernel-doc warnings This patch fixes the following kernel-doc warnings: include/uapi/linux/videodev2.h:996: warning: Function parameter or member 'm' not described in 'v4l2_plane' include/uapi/linux/videodev2.h:996: warning: Function parameter or member 'reserved' not described in 'v4l2_plane' include/uapi/linux/videodev2.h:1057: warning: Function parameter or member 'm' not described in 'v4l2_buffer' include/uapi/linux/videodev2.h:1057: warning: Function parameter or member 'reserved2' not described in 'v4l2_buffer' include/uapi/linux/videodev2.h:1057: warning: Function parameter or member 'reserved' not described in 'v4l2_buffer' include/uapi/linux/videodev2.h:1068: warning: Function parameter or member 'tv' not described in 'v4l2_timeval_to_ns' include/uapi/linux/videodev2.h:1068: warning: Excess function parameter 'ts' description in 'v4l2_timeval_to_ns' include/uapi/linux/videodev2.h:1138: warning: Function parameter or member 'reserved' not described in 'v4l2_exportbuffer' include/uapi/linux/videodev2.h:2237: warning: Function parameter or member 'reserved' not described in 'v4l2_plane_pix_format' include/uapi/linux/videodev2.h:2270: warning: Function parameter or member 'hsv_enc' not described in 'v4l2_pix_format_mplane' include/uapi/linux/videodev2.h:2270: warning: Function parameter or member 'reserved' not described in 'v4l2_pix_format_mplane' include/uapi/linux/videodev2.h:2281: warning: Function parameter or member 'reserved' not described in 'v4l2_sdr_format' include/uapi/linux/videodev2.h:2315: warning: Function parameter or member 'fmt' not described in 'v4l2_format' include/uapi/linux/v4l2-subdev.h:53: warning: Function parameter or member 'reserved' not described in 'v4l2_subdev_format' include/uapi/linux/v4l2-subdev.h:66: warning: Function parameter or member 'reserved' not described in 'v4l2_subdev_crop' include/uapi/linux/v4l2-subdev.h:89: warning: Function parameter or member 'reserved' not described in 'v4l2_subdev_mbus_code_enum' include/uapi/linux/v4l2-subdev.h:108: warning: Function parameter or member 'min_width' not described in 'v4l2_subdev_frame_size_enum' include/uapi/linux/v4l2-subdev.h:108: warning: Function parameter or member 'max_width' not described in 'v4l2_subdev_frame_size_enum' include/uapi/linux/v4l2-subdev.h:108: warning: Function parameter or member 'min_height' not described in 'v4l2_subdev_frame_size_enum' include/uapi/linux/v4l2-subdev.h:108: warning: Function parameter or member 'max_height' not described in 'v4l2_subdev_frame_size_enum' include/uapi/linux/v4l2-subdev.h:108: warning: Function parameter or member 'reserved' not described in 'v4l2_subdev_frame_size_enum' include/uapi/linux/v4l2-subdev.h:119: warning: Function parameter or member 'reserved' not described in 'v4l2_subdev_frame_interval' include/uapi/linux/v4l2-subdev.h:140: warning: Function parameter or member 'reserved' not described in 'v4l2_subdev_frame_interval_enum' include/uapi/linux/cec.h:406: warning: Function parameter or member 'raw' not described in 'cec_connector_info' include/uapi/linux/cec.h:470: warning: Function parameter or member 'flags' not described in 'cec_event' include/media/v4l2-h264.h:82: warning: Function parameter or member 'reflist' not described in 'v4l2_h264_build_p_ref_list' include/media/v4l2-h264.h:82: warning: expecting prototype for v4l2_h264_build_b_ref_lists(). Prototype was for v4l2_h264_build_p_ref_list() instead include/media/cec.h:50: warning: Function parameter or member 'lock' not described in 'cec_devnode' include/media/v4l2-jpeg.h:122: warning: Function parameter or member 'num_dht' not described in 'v4l2_jpeg_header' include/media/v4l2-jpeg.h:122: warning: Function parameter or member 'num_dqt' not described in 'v4l2_jpeg_header' Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/cec.h | 2 +- include/media/v4l2-h264.h | 6 +++--- include/media/v4l2-jpeg.h | 2 ++ include/uapi/linux/cec.h | 3 ++- include/uapi/linux/v4l2-subdev.h | 12 +++++++++++- include/uapi/linux/videodev2.h | 15 ++++++++++++++- 6 files changed, 33 insertions(+), 7 deletions(-) (limited to 'include/media') diff --git a/include/media/cec.h b/include/media/cec.h index cd35ae6b7560..208c9613c07e 100644 --- a/include/media/cec.h +++ b/include/media/cec.h @@ -28,8 +28,8 @@ * @minor: device node minor number * @registered: the device was correctly registered * @unregistered: the device was unregistered - * @fhs_lock: lock to control access to the filehandle list * @fhs: the list of open filehandles (cec_fh) + * @lock: lock to control access to this structure * * This structure represents a cec-related device node. * diff --git a/include/media/v4l2-h264.h b/include/media/v4l2-h264.h index d2314f4d4490..4b1c71c935e0 100644 --- a/include/media/v4l2-h264.h +++ b/include/media/v4l2-h264.h @@ -66,11 +66,11 @@ v4l2_h264_build_b_ref_lists(const struct v4l2_h264_reflist_builder *builder, u8 *b0_reflist, u8 *b1_reflist); /** - * v4l2_h264_build_b_ref_lists() - Build the P reference list + * v4l2_h264_build_p_ref_list() - Build the P reference list * * @builder: reference list builder context - * @p_reflist: 16-bytes array used to store the P reference list. Each entry - * is an index in the DPB + * @reflist: 16-bytes array used to store the P reference list. Each entry + * is an index in the DPB * * This functions builds the P reference lists. This procedure is describe in * section '8.2.4 Decoding process for reference picture lists construction' diff --git a/include/media/v4l2-jpeg.h b/include/media/v4l2-jpeg.h index ddba2a56c321..3a3344a97678 100644 --- a/include/media/v4l2-jpeg.h +++ b/include/media/v4l2-jpeg.h @@ -91,7 +91,9 @@ struct v4l2_jpeg_scan_header { * struct v4l2_jpeg_header - parsed JPEG header * @sof: pointer to frame header and size * @sos: pointer to scan header and size + * @num_dht: number of entries in @dht * @dht: pointers to huffman tables and sizes + * @num_dqt: number of entries in @dqt * @dqt: pointers to quantization tables and sizes * @frame: parsed frame header * @scan: pointer to parsed scan header, optional diff --git a/include/uapi/linux/cec.h b/include/uapi/linux/cec.h index 7d1a06c52469..dc8879d179fd 100644 --- a/include/uapi/linux/cec.h +++ b/include/uapi/linux/cec.h @@ -396,6 +396,7 @@ struct cec_drm_connector_info { * associated with the CEC adapter. * @type: connector type (if any) * @drm: drm connector info + * @raw: array to pad the union */ struct cec_connector_info { __u32 type; @@ -453,7 +454,7 @@ struct cec_event_lost_msgs { * struct cec_event - CEC event structure * @ts: the timestamp of when the event was sent. * @event: the event. - * array. + * @flags: event flags. * @state_change: the event payload for CEC_EVENT_STATE_CHANGE. * @lost_msgs: the event payload for CEC_EVENT_LOST_MSGS. * @raw: array to pad the union. diff --git a/include/uapi/linux/v4l2-subdev.h b/include/uapi/linux/v4l2-subdev.h index a38454d9e0f5..658106f5b5dc 100644 --- a/include/uapi/linux/v4l2-subdev.h +++ b/include/uapi/linux/v4l2-subdev.h @@ -44,6 +44,7 @@ enum v4l2_subdev_format_whence { * @which: format type (from enum v4l2_subdev_format_whence) * @pad: pad number, as reported by the media API * @format: media bus format (format code and frame size) + * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_format { __u32 which; @@ -57,6 +58,7 @@ struct v4l2_subdev_format { * @which: format type (from enum v4l2_subdev_format_whence) * @pad: pad number, as reported by the media API * @rect: pad crop rectangle boundaries + * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_crop { __u32 which; @@ -78,6 +80,7 @@ struct v4l2_subdev_crop { * @code: format code (MEDIA_BUS_FMT_ definitions) * @which: format type (from enum v4l2_subdev_format_whence) * @flags: flags set by the driver, (V4L2_SUBDEV_MBUS_CODE_*) + * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_mbus_code_enum { __u32 pad; @@ -90,10 +93,15 @@ struct v4l2_subdev_mbus_code_enum { /** * struct v4l2_subdev_frame_size_enum - Media bus format enumeration - * @pad: pad number, as reported by the media API * @index: format index during enumeration + * @pad: pad number, as reported by the media API * @code: format code (MEDIA_BUS_FMT_ definitions) + * @min_width: minimum frame width, in pixels + * @max_width: maximum frame width, in pixels + * @min_height: minimum frame height, in pixels + * @max_height: maximum frame height, in pixels * @which: format type (from enum v4l2_subdev_format_whence) + * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_frame_size_enum { __u32 index; @@ -111,6 +119,7 @@ struct v4l2_subdev_frame_size_enum { * struct v4l2_subdev_frame_interval - Pad-level frame rate * @pad: pad number, as reported by the media API * @interval: frame interval in seconds + * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_frame_interval { __u32 pad; @@ -127,6 +136,7 @@ struct v4l2_subdev_frame_interval { * @height: frame height in pixels * @interval: frame interval in seconds * @which: format type (from enum v4l2_subdev_format_whence) + * @reserved: drivers and applications must zero this array */ struct v4l2_subdev_frame_interval_enum { __u32 index; diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index ec2af5ddf7d7..dc5dd89327d8 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -976,8 +976,10 @@ struct v4l2_requestbuffers { * pointing to this plane * @fd: when memory is V4L2_MEMORY_DMABUF, a userspace file * descriptor associated with this plane + * @m: union of @mem_offset, @userptr and @fd * @data_offset: offset in the plane to the start of data; usually 0, * unless there is a header in front of the data + * @reserved: drivers and applications must zero this array * * Multi-planar buffers consist of one or more planes, e.g. an YCbCr buffer * with two planes can have one plane for Y, and another for interleaved CbCr @@ -1019,10 +1021,14 @@ struct v4l2_plane { * a userspace file descriptor associated with this buffer * @planes: for multiplanar buffers; userspace pointer to the array of plane * info structs for this buffer + * @m: union of @offset, @userptr, @planes and @fd * @length: size in bytes of the buffer (NOT its payload) for single-plane * buffers (when type != *_MPLANE); number of elements in the * planes array for multi-plane buffers + * @reserved2: drivers and applications must zero this field * @request_fd: fd of the request that this buffer should use + * @reserved: for backwards compatibility with applications that do not know + * about @request_fd * * Contains data exchanged by application and driver using one of the Streaming * I/O methods. @@ -1060,7 +1066,7 @@ struct v4l2_buffer { #ifndef __KERNEL__ /** * v4l2_timeval_to_ns - Convert timeval to nanoseconds - * @ts: pointer to the timeval variable to be converted + * @tv: pointer to the timeval variable to be converted * * Returns the scalar nanosecond representation of the timeval * parameter. @@ -1121,6 +1127,7 @@ static inline __u64 v4l2_timeval_to_ns(const struct timeval *tv) * @flags: flags for newly created file, currently only O_CLOEXEC is * supported, refer to manual of open syscall for more details * @fd: file descriptor associated with DMABUF (set by driver) + * @reserved: drivers and applications must zero this array * * Contains data used for exporting a video buffer as DMABUF file descriptor. * The buffer is identified by a 'cookie' returned by VIDIOC_QUERYBUF @@ -2233,6 +2240,7 @@ struct v4l2_mpeg_vbi_fmt_ivtv { * this plane will be used * @bytesperline: distance in bytes between the leftmost pixels in two * adjacent lines + * @reserved: drivers and applications must zero this array */ struct v4l2_plane_pix_format { __u32 sizeimage; @@ -2251,8 +2259,10 @@ struct v4l2_plane_pix_format { * @num_planes: number of planes for this format * @flags: format flags (V4L2_PIX_FMT_FLAG_*) * @ycbcr_enc: enum v4l2_ycbcr_encoding, Y'CbCr encoding + * @hsv_enc: enum v4l2_hsv_encoding, HSV encoding * @quantization: enum v4l2_quantization, colorspace quantization * @xfer_func: enum v4l2_xfer_func, colorspace transfer function + * @reserved: drivers and applications must zero this array */ struct v4l2_pix_format_mplane { __u32 width; @@ -2277,6 +2287,7 @@ struct v4l2_pix_format_mplane { * struct v4l2_sdr_format - SDR format definition * @pixelformat: little endian four character code (fourcc) * @buffersize: maximum size in bytes required for data + * @reserved: drivers and applications must zero this array */ struct v4l2_sdr_format { __u32 pixelformat; @@ -2303,6 +2314,8 @@ struct v4l2_meta_format { * @vbi: raw VBI capture or output parameters * @sliced: sliced VBI capture or output parameters * @raw_data: placeholder for future extensions and custom formats + * @fmt: union of @pix, @pix_mp, @win, @vbi, @sliced, @sdr, @meta + * and @raw_data */ struct v4l2_format { __u32 type; -- cgit v1.2.3-59-g8ed1b From a68a90b2ecd392a98a351e927a55ba037d0f51bb Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 9 Mar 2021 13:17:10 +0100 Subject: media: media/i2c: fix kerneldoc issues for media i2c headers This fixes these kernel-doc warnings: include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_CVBS_VI1A' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_CVBS_VI1B' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_CVBS_VI1C' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_CVBS_VI2A' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_CVBS_VI2B' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_CVBS_VI2C' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_CVBS_VI3A' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_CVBS_VI3B' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_CVBS_VI3C' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_CVBS_VI4A' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_SVIDEO_VI2A_VI1A' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_SVIDEO_VI2B_VI1B' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_SVIDEO_VI2C_VI1C' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_SVIDEO_VI2A_VI3A' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_SVIDEO_VI2B_VI3B' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_SVIDEO_VI2C_VI3C' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_SVIDEO_VI4A_VI1A' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_SVIDEO_VI4A_VI1B' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_SVIDEO_VI4A_VI1C' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_SVIDEO_VI4A_VI3A' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_SVIDEO_VI4A_VI3B' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_SVIDEO_VI4A_VI3C' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:70: warning: Enum value 'INPUT_INVALID' not described in enum 'tvp514x_input' include/media/i2c/tvp514x.h:82: warning: Enum value 'OUTPUT_10BIT_422_EMBEDDED_SYNC' not described in enum 'tvp514x_output' include/media/i2c/tvp514x.h:82: warning: Enum value 'OUTPUT_20BIT_422_SEPERATE_SYNC' not described in enum 'tvp514x_output' include/media/i2c/tvp514x.h:82: warning: Enum value 'OUTPUT_10BIT_422_SEPERATE_SYNC' not described in enum 'tvp514x_output' include/media/i2c/tvp514x.h:82: warning: Enum value 'OUTPUT_INVALID' not described in enum 'tvp514x_output' include/media/i2c/adv7343.h:38: warning: cannot understand function prototype: 'struct adv7343_power_mode ' include/media/i2c/s5k4ecgx.h:31: warning: expecting prototype for struct ss5k4ecgx_platform_data. Prototype was for struct s5k4ecgx_platform_data instead include/media/i2c/mt9t112.h:21: warning: cannot understand function prototype: 'struct mt9t112_platform_data ' include/media/i2c/noon010pc30.h:13: warning: Cannot understand * @clk_rate: the clock frequency in Hz include/media/i2c/s5k6aa.h:45: warning: Function parameter or member 'bus_type' not described in 's5k6aa_platform_data' include/media/i2c/tw9910.h:19: warning: cannot understand function prototype: 'enum tw9910_mpout_pin ' include/media/i2c/tw9910.h:36: warning: cannot understand function prototype: 'struct tw9910_video_info ' include/media/i2c/ov772x.h:53: warning: cannot understand function prototype: 'struct ov772x_camera_info ' include/media/i2c/s5c73m3.h:53: warning: Function parameter or member 'bus_type' not described in 's5c73m3_platform_data' drivers/media/i2c/ccs/ccs-quirk.h:50: warning: Function parameter or member 'post_streamoff' not described in 'ccs_quirk' drivers/media/i2c/ccs/ccs-quirk.h:50: warning: Function parameter or member 'flags' not described in 'ccs_quirk' drivers/media/i2c/ccs/ccs-data.h:144: warning: expecting prototype for struct ccs_pdaf_pix_loc_block_desc. Prototype was for struct ccs_pdaf_pix_loc_pixel_desc instead drivers/media/i2c/tvp514x_regs.h:272: warning: Function parameter or member 'token' not described in 'tvp514x_reg' drivers/media/i2c/tvp514x_regs.h:272: warning: Function parameter or member 'reg' not described in 'tvp514x_reg' drivers/media/i2c/tvp514x_regs.h:272: warning: Function parameter or member 'val' not described in 'tvp514x_reg' drivers/media/i2c/m5mols/m5mols.h:69: warning: Function parameter or member 'brightness' not described in 'm5mols_exif' drivers/media/i2c/m5mols/m5mols.h:147: error: Cannot parse struct or union! drivers/media/i2c/adv748x/adv748x.h:65: warning: Enum value 'ADV748X_PORT_AIN0' not described in enum 'adv748x_ports' drivers/media/i2c/adv748x/adv748x.h:65: warning: Enum value 'ADV748X_PORT_AIN1' not described in enum 'adv748x_ports' drivers/media/i2c/adv748x/adv748x.h:65: warning: Enum value 'ADV748X_PORT_AIN2' not described in enum 'adv748x_ports' drivers/media/i2c/adv748x/adv748x.h:65: warning: Enum value 'ADV748X_PORT_AIN3' not described in enum 'adv748x_ports' drivers/media/i2c/adv748x/adv748x.h:65: warning: Enum value 'ADV748X_PORT_AIN4' not described in enum 'adv748x_ports' drivers/media/i2c/adv748x/adv748x.h:65: warning: Enum value 'ADV748X_PORT_AIN5' not described in enum 'adv748x_ports' drivers/media/i2c/adv748x/adv748x.h:65: warning: Enum value 'ADV748X_PORT_AIN6' not described in enum 'adv748x_ports' drivers/media/i2c/adv748x/adv748x.h:65: warning: Enum value 'ADV748X_PORT_AIN7' not described in enum 'adv748x_ports' drivers/media/i2c/adv748x/adv748x.h:65: warning: Enum value 'ADV748X_PORT_HDMI' not described in enum 'adv748x_ports' drivers/media/i2c/adv748x/adv748x.h:65: warning: Enum value 'ADV748X_PORT_TTL' not described in enum 'adv748x_ports' drivers/media/i2c/adv748x/adv748x.h:65: warning: Enum value 'ADV748X_PORT_TXA' not described in enum 'adv748x_ports' drivers/media/i2c/adv748x/adv748x.h:65: warning: Enum value 'ADV748X_PORT_TXB' not described in enum 'adv748x_ports' drivers/media/i2c/adv748x/adv748x.h:65: warning: Enum value 'ADV748X_PORT_MAX' not described in enum 'adv748x_ports' drivers/media/i2c/adv748x/adv748x.h:199: warning: Function parameter or member 'i2c_clients' not described in 'adv748x_state' drivers/media/i2c/adv748x/adv748x.h:199: warning: Function parameter or member 'regmap' not described in 'adv748x_state' Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/adv748x/adv748x.h | 10 +++++----- drivers/media/i2c/m5mols/m5mols.h | 4 +++- drivers/media/i2c/tvp514x_regs.h | 6 +++--- include/media/i2c/adv7343.h | 2 +- include/media/i2c/mt9t112.h | 2 +- include/media/i2c/noon010pc30.h | 1 + include/media/i2c/ov772x.h | 2 +- include/media/i2c/s5c73m3.h | 1 + include/media/i2c/s5k4ecgx.h | 6 +++--- include/media/i2c/s5k6aa.h | 1 + include/media/i2c/tvp514x.h | 11 ++--------- include/media/i2c/tw9910.h | 8 +++----- 12 files changed, 25 insertions(+), 29 deletions(-) (limited to 'include/media') diff --git a/drivers/media/i2c/adv748x/adv748x.h b/drivers/media/i2c/adv748x/adv748x.h index 56256c1e8b0d..31bac06d46b5 100644 --- a/drivers/media/i2c/adv748x/adv748x.h +++ b/drivers/media/i2c/adv748x/adv748x.h @@ -42,8 +42,8 @@ enum adv748x_page { ADV748X_PAGE_EOR, /* End Mark */ }; -/** - * enum adv748x_ports - Device tree port number definitions +/* + * Device tree port number definitions * * The ADV748X ports define the mapping between subdevices * and the device tree specification @@ -173,9 +173,9 @@ struct adv748x_afe { * * @endpoints: parsed device node endpoints for each port * - * @i2c_addresses I2C Page addresses - * @i2c_clients I2C clients for the page accesses - * @regmap regmap configuration pages. + * @i2c_addresses: I2C Page addresses + * @i2c_clients: I2C clients for the page accesses + * @regmap: regmap configuration pages. * * @hdmi: state of HDMI receiver context * @afe: state of AFE receiver context diff --git a/drivers/media/i2c/m5mols/m5mols.h b/drivers/media/i2c/m5mols/m5mols.h index 4023906d273d..60c102fa7df5 100644 --- a/drivers/media/i2c/m5mols/m5mols.h +++ b/drivers/media/i2c/m5mols/m5mols.h @@ -50,6 +50,7 @@ struct m5mols_resolution { * @exposure_time: exposure time register value * @shutter_speed: speed of the shutter register value * @aperture: aperture register value + * @brightness: brightness register value * @exposure_bias: it calls also EV bias * @iso_speed: ISO register value * @flash: status register value of the flash @@ -126,6 +127,8 @@ struct m5mols_scenemode { u8 wdr; }; +#define VERSION_STRING_SIZE 22 + /** * struct m5mols_version - firmware version information * @customer: customer information @@ -144,7 +147,6 @@ struct m5mols_scenemode { * about manufacturer and the vendor of the sensor's packaging. The least * significant 2 bytes of the string indicate packaging manufacturer. */ -#define VERSION_STRING_SIZE 22 struct m5mols_version { u8 customer; u8 project; diff --git a/drivers/media/i2c/tvp514x_regs.h b/drivers/media/i2c/tvp514x_regs.h index cc236c968f67..b452725d5cfb 100644 --- a/drivers/media/i2c/tvp514x_regs.h +++ b/drivers/media/i2c/tvp514x_regs.h @@ -261,9 +261,9 @@ #define TOK_SKIP (3) /* token to skip a register */ /** * struct tvp514x_reg - Structure for TVP5146/47 register initialization values - * @token - Token: TOK_WRITE, TOK_TERM etc.. - * @reg - Register offset - * @val - Register Value for TOK_WRITE or delay in ms for TOK_DELAY + * @token: Token: TOK_WRITE, TOK_TERM etc.. + * @reg: Register offset + * @val: Register Value for TOK_WRITE or delay in ms for TOK_DELAY */ struct tvp514x_reg { u8 token; diff --git a/include/media/i2c/adv7343.h b/include/media/i2c/adv7343.h index e4142b1ef8cd..b8937035c5d3 100644 --- a/include/media/i2c/adv7343.h +++ b/include/media/i2c/adv7343.h @@ -21,7 +21,7 @@ #define ADV7343_SVIDEO_ID (2) /** - * adv7343_power_mode - power mode configuration. + * struct adv7343_power_mode - power mode configuration. * @sleep_mode: on enable the current consumption is reduced to micro ampere * level. All DACs and the internal PLL circuit are disabled. * Registers can be read from and written in sleep mode. diff --git a/include/media/i2c/mt9t112.h b/include/media/i2c/mt9t112.h index cc80d5cc2104..e678b6ae8e2f 100644 --- a/include/media/i2c/mt9t112.h +++ b/include/media/i2c/mt9t112.h @@ -14,7 +14,7 @@ struct mt9t112_pll_divider { }; /** - * mt9t112_platform_data - mt9t112 driver interface + * struct mt9t112_platform_data - mt9t112 driver interface * @flags: Sensor media bus configuration. * @divider: Sensor PLL configuration */ diff --git a/include/media/i2c/noon010pc30.h b/include/media/i2c/noon010pc30.h index a035d2d9a564..d1b2e06a1de0 100644 --- a/include/media/i2c/noon010pc30.h +++ b/include/media/i2c/noon010pc30.h @@ -10,6 +10,7 @@ #define NOON010PC30_H /** + * struct noon010pc30_platform_data - platform data * @clk_rate: the clock frequency in Hz * @gpio_nreset: GPIO driving nRESET pin * @gpio_nstby: GPIO driving nSTBY pin diff --git a/include/media/i2c/ov772x.h b/include/media/i2c/ov772x.h index a1702d420087..26f363ea4001 100644 --- a/include/media/i2c/ov772x.h +++ b/include/media/i2c/ov772x.h @@ -46,7 +46,7 @@ struct ov772x_edge_ctrl { } /** - * ov772x_camera_info - ov772x driver interface structure + * struct ov772x_camera_info - ov772x driver interface structure * @flags: Sensor configuration flags * @edgectrl: Sensor edge control */ diff --git a/include/media/i2c/s5c73m3.h b/include/media/i2c/s5c73m3.h index ccb9e5448762..a51f1025ba1c 100644 --- a/include/media/i2c/s5c73m3.h +++ b/include/media/i2c/s5c73m3.h @@ -35,6 +35,7 @@ struct s5c73m3_gpio { * @mclk_frequency: sensor's master clock frequency in Hz * @gpio_reset: GPIO driving RESET pin * @gpio_stby: GPIO driving STBY pin + * @bus_type: bus type * @nlanes: maximum number of MIPI-CSI lanes used * @horiz_flip: default horizontal image flip value, non zero to enable * @vert_flip: default vertical image flip value, non zero to enable diff --git a/include/media/i2c/s5k4ecgx.h b/include/media/i2c/s5k4ecgx.h index fccb7be8ed8f..92202eb35249 100644 --- a/include/media/i2c/s5k4ecgx.h +++ b/include/media/i2c/s5k4ecgx.h @@ -11,7 +11,7 @@ /** * struct s5k4ecgx_gpio - data structure describing a GPIO - * @gpio : GPIO number + * @gpio: GPIO number * @level: indicates active state of the @gpio */ struct s5k4ecgx_gpio { @@ -20,9 +20,9 @@ struct s5k4ecgx_gpio { }; /** - * struct ss5k4ecgx_platform_data- s5k4ecgx driver platform data + * struct s5k4ecgx_platform_data - s5k4ecgx driver platform data * @gpio_reset: GPIO driving RESET pin - * @gpio_stby : GPIO driving STBY pin + * @gpio_stby: GPIO driving STBY pin */ struct s5k4ecgx_platform_data { diff --git a/include/media/i2c/s5k6aa.h b/include/media/i2c/s5k6aa.h index fd78e85e8b78..eb3444d8b731 100644 --- a/include/media/i2c/s5k6aa.h +++ b/include/media/i2c/s5k6aa.h @@ -28,6 +28,7 @@ struct s5k6aa_gpio { * @mclk_frequency: sensor's master clock frequency in Hz * @gpio_reset: GPIO driving RESET pin * @gpio_stby: GPIO driving STBY pin + * @bus_type: bus type * @nlanes: maximum number of MIPI-CSI lanes used * @horiz_flip: default horizontal image flip value, non zero to enable * @vert_flip: default vertical image flip value, non zero to enable diff --git a/include/media/i2c/tvp514x.h b/include/media/i2c/tvp514x.h index 0c1bb04bdbcb..837efff0a6a0 100644 --- a/include/media/i2c/tvp514x.h +++ b/include/media/i2c/tvp514x.h @@ -29,10 +29,7 @@ #define PAL_NUM_ACTIVE_PIXELS (720) #define PAL_NUM_ACTIVE_LINES (576) -/** - * enum tvp514x_input - enum for different decoder input pin - * configuration. - */ +/* enum for different decoder input pin configuration */ enum tvp514x_input { /* * CVBS input selection @@ -69,11 +66,7 @@ enum tvp514x_input { INPUT_INVALID }; -/** - * enum tvp514x_output - enum for output format - * supported. - * - */ +/* enum for output format supported. */ enum tvp514x_output { OUTPUT_10BIT_422_EMBEDDED_SYNC = 0, OUTPUT_20BIT_422_SEPERATE_SYNC, diff --git a/include/media/i2c/tw9910.h b/include/media/i2c/tw9910.h index 92d31bd1afe6..77da94f909e3 100644 --- a/include/media/i2c/tw9910.h +++ b/include/media/i2c/tw9910.h @@ -13,9 +13,7 @@ #ifndef __TW9910_H__ #define __TW9910_H__ -/** - * tw9910_mpout_pin - MPOUT (multi-purpose output) pin functions - */ +/* MPOUT (multi-purpose output) pin functions */ enum tw9910_mpout_pin { TW9910_MPO_VLOSS, TW9910_MPO_HLOCK, @@ -28,10 +26,10 @@ enum tw9910_mpout_pin { }; /** - * tw9910_video_info - tw9910 driver interface structure + * struct tw9910_video_info - tw9910 driver interface structure * @buswidth: Parallel data bus width (8 or 16). * @mpout: Selected function of MPOUT (multi-purpose output) pin. - * See &enum tw9910_mpout_pin + * See enum tw9910_mpout_pin */ struct tw9910_video_info { unsigned long buswidth; -- cgit v1.2.3-59-g8ed1b From c214e6dd5c9b4073151759502de374c2748cad64 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 9 Mar 2021 13:22:37 +0100 Subject: media: vpbe_osd.h/uvcvideo.h includes: fix trivial kernel-doc warnings Fix these kernel-doc warnings: include/media/davinci/vpbe_osd.h:77: warning: Enum value 'PIXFMT_YCBCRI' not described in enum 'osd_pix_format' include/media/davinci/vpbe_osd.h:77: warning: Enum value 'PIXFMT_YCRCBI' not described in enum 'osd_pix_format' include/media/davinci/vpbe_osd.h:77: warning: Excess enum value 'PIXFMT_YCrCbI' description in 'osd_pix_format' include/media/davinci/vpbe_osd.h:77: warning: Excess enum value 'PIXFMT_YCbCrI' description in 'osd_pix_format' include/media/davinci/vpbe_osd.h:232: warning: expecting prototype for enum davinci_cursor_v_width. Prototype was for enum osd_cursor_v_width instead include/uapi/linux/uvcvideo.h:98: warning: Function parameter or member 'ns' not described in 'uvc_meta_buf' include/uapi/linux/uvcvideo.h:98: warning: Function parameter or member 'sof' not described in 'uvc_meta_buf' include/uapi/linux/uvcvideo.h:98: warning: Function parameter or member 'length' not described in 'uvc_meta_buf' include/uapi/linux/uvcvideo.h:98: warning: Function parameter or member 'flags' not described in 'uvc_meta_buf' include/uapi/linux/uvcvideo.h:98: warning: Function parameter or member 'buf' not described in 'uvc_meta_buf' Signed-off-by: Hans Verkuil Reviewed-by: Laurent Pinchart Signed-off-by: Mauro Carvalho Chehab --- include/media/davinci/vpbe_osd.h | 6 +++--- include/uapi/linux/uvcvideo.h | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'include/media') diff --git a/include/media/davinci/vpbe_osd.h b/include/media/davinci/vpbe_osd.h index e1b1c76aa50f..a4fc4f2a56fb 100644 --- a/include/media/davinci/vpbe_osd.h +++ b/include/media/davinci/vpbe_osd.h @@ -54,9 +54,9 @@ enum osd_win_layer { * @PIXFMT_4BPP: 4-bits-per-pixel bitmap * @PIXFMT_8BPP: 8-bits-per-pixel bitmap * @PIXFMT_RGB565: 16-bits-per-pixel RGB565 - * @PIXFMT_YCbCrI: YUV 4:2:2 + * @PIXFMT_YCBCRI: YUV 4:2:2 * @PIXFMT_RGB888: 24-bits-per-pixel RGB888 - * @PIXFMT_YCrCbI: YUV 4:2:2 with chroma swap + * @PIXFMT_YCRCBI: YUV 4:2:2 with chroma swap * @PIXFMT_NV12: YUV 4:2:0 planar * @PIXFMT_OSD_ATTR: OSD Attribute Window pixel format (4bpp) * @@ -210,7 +210,7 @@ enum osd_cursor_h_width { }; /** - * enum davinci_cursor_v_width + * enum osd_cursor_v_width * @V_WIDTH_1: vertical line width is 1 line * @V_WIDTH_2: vertical line width is 2 lines * @V_WIDTH_4: vertical line width is 4 lines diff --git a/include/uapi/linux/uvcvideo.h b/include/uapi/linux/uvcvideo.h index f80f05b3c423..8288137387c0 100644 --- a/include/uapi/linux/uvcvideo.h +++ b/include/uapi/linux/uvcvideo.h @@ -76,11 +76,11 @@ struct uvc_xu_control_query { /** * struct uvc_meta_buf - metadata buffer building block - * @ns - system timestamp of the payload in nanoseconds - * @sof - USB Frame Number - * @length - length of the payload header - * @flags - payload header flags - * @buf - optional device-specific header data + * @ns: system timestamp of the payload in nanoseconds + * @sof: USB Frame Number + * @length: length of the payload header + * @flags: payload header flags + * @buf: optional device-specific header data * * UVC metadata nodes fill buffers with possibly multiple instances of this * struct. The first two fields are added by the driver, they can be used for -- cgit v1.2.3-59-g8ed1b From b8035f7988a82cbbabf1009b9f3234ff2431f8a4 Mon Sep 17 00:00:00 2001 From: Mirela Rabulea Date: Thu, 11 Mar 2021 01:28:49 +0100 Subject: media: Add parsing for APP14 data segment in jpeg helpers According to Rec. ITU-T T.872 (06/2012) 6.5.3 APP14 segment is for color encoding, it contains a transform flag, which may have values of 0, 1 and 2 and are interpreted as follows: 0 - CMYK for images that are encoded with four components - RGB for images that are encoded with three components 1 - An image encoded with three components using YCbCr colour encoding. 2 - An image encoded with four components using YCCK colour encoding. This is used in imx-jpeg decoder, to distinguish between YUV444 and RGB24. Signed-off-by: Mirela Rabulea Reviewed-by: Philipp Zabel Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-jpeg.c | 42 ++++++++++++++++++++++++++++++++++++- include/media/v4l2-jpeg.h | 20 ++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) (limited to 'include/media') diff --git a/drivers/media/v4l2-core/v4l2-jpeg.c b/drivers/media/v4l2-core/v4l2-jpeg.c index 9071b6cc6d0e..ede40f2a5456 100644 --- a/drivers/media/v4l2-core/v4l2-jpeg.c +++ b/drivers/media/v4l2-core/v4l2-jpeg.c @@ -45,6 +45,7 @@ MODULE_LICENSE("GPL"); #define DHP 0xffde /* hierarchical progression */ #define EXP 0xffdf /* expand reference */ #define APP0 0xffe0 /* application data */ +#define APP14 0xffee /* application data for colour encoding */ #define APP15 0xffef #define JPG0 0xfff0 /* extensions */ #define JPG13 0xfffd @@ -444,6 +445,39 @@ static int jpeg_skip_segment(struct jpeg_stream *stream) return jpeg_skip(stream, len - 2); } +/* Rec. ITU-T T.872 (06/2012) 6.5.3 */ +static int jpeg_parse_app14_data(struct jpeg_stream *stream, + enum v4l2_jpeg_app14_tf *tf) +{ + int ret; + int lp; + int skip; + + lp = jpeg_get_word_be(stream); + if (lp < 0) + return lp; + + /* Check for "Adobe\0" in Ap1..6 */ + if (stream->curr + 6 > stream->end || + strncmp(stream->curr, "Adobe\0", 6)) + return -EINVAL; + + /* get to Ap12 */ + ret = jpeg_skip(stream, 11); + if (ret < 0) + return ret; + + ret = jpeg_get_byte(stream); + if (ret < 0) + return ret; + + *tf = ret; + + /* skip the rest of the segment, this ensures at least it is complete */ + skip = lp - 2 - 11; + return jpeg_skip(stream, skip); +} + /** * v4l2_jpeg_parse_header - locate marker segments and optionally parse headers * @buf: address of the JPEG buffer, should start with a SOI marker @@ -476,6 +510,9 @@ int v4l2_jpeg_parse_header(void *buf, size_t len, struct v4l2_jpeg_header *out) if (marker != SOI) return -EINVAL; + /* init value to signal if this marker is not present */ + out->app14_tf = V4L2_JPEG_APP14_TF_UNKNOWN; + /* loop through marker segments */ while ((marker = jpeg_next_marker(&stream)) >= 0) { switch (marker) { @@ -519,7 +556,10 @@ int v4l2_jpeg_parse_header(void *buf, size_t len, struct v4l2_jpeg_header *out) ret = jpeg_parse_restart_interval(&stream, &out->restart_interval); break; - + case APP14: + ret = jpeg_parse_app14_data(&stream, + &out->app14_tf); + break; case SOS: ret = jpeg_reference_segment(&stream, &out->sos); if (ret < 0) diff --git a/include/media/v4l2-jpeg.h b/include/media/v4l2-jpeg.h index 3a3344a97678..2dba843ce3bd 100644 --- a/include/media/v4l2-jpeg.h +++ b/include/media/v4l2-jpeg.h @@ -87,6 +87,24 @@ struct v4l2_jpeg_scan_header { /* Ss, Se, Ah, and Al are not used by any driver */ }; +/** + * enum v4l2_jpeg_app14_tf - APP14 transform flag + * According to Rec. ITU-T T.872 (06/2012) 6.5.3 + * APP14 segment is for color encoding, it contains a transform flag, + * which may have values of 0, 1 and 2 and are interpreted as follows: + * @V4L2_JPEG_APP14_TF_CMYK_RGB: CMYK for images encoded with four components + * RGB for images encoded with three components + * @V4L2_JPEG_APP14_TF_YCBCR: an image encoded with three components using YCbCr + * @V4L2_JPEG_APP14_TF_YCCK: an image encoded with four components using YCCK + * @V4L2_JPEG_APP14_TF_UNKNOWN: indicate app14 is not present + */ +enum v4l2_jpeg_app14_tf { + V4L2_JPEG_APP14_TF_CMYK_RGB = 0, + V4L2_JPEG_APP14_TF_YCBCR = 1, + V4L2_JPEG_APP14_TF_YCCK = 2, + V4L2_JPEG_APP14_TF_UNKNOWN = -1, +}; + /** * struct v4l2_jpeg_header - parsed JPEG header * @sof: pointer to frame header and size @@ -102,6 +120,7 @@ struct v4l2_jpeg_scan_header { * order, optional * @restart_interval: number of MCU per restart interval, Ri * @ecs_offset: buffer offset in bytes to the entropy coded segment + * @app14_tf: transform flag from app14 data * * When this structure is passed to v4l2_jpeg_parse_header, the optional scan, * quantization_tables, and huffman_tables pointers must be initialized to NULL @@ -121,6 +140,7 @@ struct v4l2_jpeg_header { struct v4l2_jpeg_reference *huffman_tables; u16 restart_interval; size_t ecs_offset; + enum v4l2_jpeg_app14_tf app14_tf; }; int v4l2_jpeg_parse_header(void *buf, size_t len, struct v4l2_jpeg_header *out); -- cgit v1.2.3-59-g8ed1b From 2f65fcee30863ac85203f3dafd5a816e55aa245c Mon Sep 17 00:00:00 2001 From: Ricardo Ribalda Date: Wed, 10 Mar 2021 11:46:39 +0100 Subject: media: videobuf2: Explicitly state max size of planes The plane size needs to be PAGE_ALIGNED, so it is not possible to have sizes bigger than MAX_INT - PAGE_SIZE. We already check for overflows when that happen: if (size < vb->planes[plane].length) goto free; But it is good to explicitly state our max allowed value, in order to align with the driver expectations. Signed-off-by: Ricardo Ribalda Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/videobuf2-core.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/media') diff --git a/include/media/videobuf2-core.h b/include/media/videobuf2-core.h index 799ba61b5b6f..12955cb460d2 100644 --- a/include/media/videobuf2-core.h +++ b/include/media/videobuf2-core.h @@ -154,9 +154,11 @@ struct vb2_mem_ops { * @dbuf: dma_buf - shared buffer object. * @dbuf_mapped: flag to show whether dbuf is mapped or not * @bytesused: number of bytes occupied by data in the plane (payload). - * @length: size of this plane (NOT the payload) in bytes. + * @length: size of this plane (NOT the payload) in bytes. The maximum + * valid size is MAX_UINT - PAGE_SIZE. * @min_length: minimum required size of this plane (NOT the payload) in bytes. - * @length is always greater or equal to @min_length. + * @length is always greater or equal to @min_length, and like + * @length, it is limited to MAX_UINT - PAGE_SIZE. * @m: Union with memtype-specific data. * @m.offset: when memory in the associated struct vb2_buffer is * %VB2_MEMORY_MMAP, equals the offset from the start of -- cgit v1.2.3-59-g8ed1b From 45cdd2a08a9ea977b4dad56494c4bd7e5b417843 Mon Sep 17 00:00:00 2001 From: Bhaskar Chowdhury Date: Wed, 24 Mar 2021 14:21:00 +0100 Subject: media: entity: A typo fix s/cariers/carriers/ Signed-off-by: Bhaskar Chowdhury Acked-by: Randy Dunlap Reviewed-by: Laurent Pinchart Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- include/media/media-entity.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/media') diff --git a/include/media/media-entity.h b/include/media/media-entity.h index cbdfcb79d0d0..a90e2bf6baf7 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -155,7 +155,7 @@ struct media_link { * uniquely identified by the pad number. * @PAD_SIGNAL_ANALOG: * The pad contains an analog signal. It can be Radio Frequency, - * Intermediate Frequency, a baseband signal or sub-cariers. + * Intermediate Frequency, a baseband signal or sub-carriers. * Tuner inputs, IF-PLL demodulators, composite and s-video signals * should use it. * @PAD_SIGNAL_DV: -- cgit v1.2.3-59-g8ed1b From 4ebddb7c17c4549f04741c7faf8e4ced62391d20 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Fri, 12 Mar 2021 10:05:44 +0100 Subject: media: entity: Add lockdep check to media graph walk It was always assumed that walking the media graph would require holding the media_device graph_mutex but this was not documented nor checked for. Add a lockdep check to graph walk init and iter, and document the need for acquiring the graph_mutex. Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/mc/mc-entity.c | 1 + include/media/media-entity.h | 5 +++++ 2 files changed, 6 insertions(+) (limited to 'include/media') diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c index 12b45e669bcc..678b99771cfa 100644 --- a/drivers/media/mc/mc-entity.c +++ b/drivers/media/mc/mc-entity.c @@ -340,6 +340,7 @@ static void media_graph_walk_iter(struct media_graph *graph) stack_push(graph, next); dev_dbg(entity->graph_obj.mdev->dev, "walk: pushing '%s' on stack\n", next->name); + lockdep_assert_held(&entity->graph_obj.mdev->graph_mutex); } struct media_entity *media_graph_walk_next(struct media_graph *graph) diff --git a/include/media/media-entity.h b/include/media/media-entity.h index a90e2bf6baf7..09737b47881f 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -885,6 +885,11 @@ int media_entity_get_fwnode_pad(struct media_entity *entity, * * @graph: Media graph structure that will be used to walk the graph * @mdev: Pointer to the &media_device that contains the object + * + * The caller is required to hold the media_device graph_mutex during the graph + * walk until the graph state is released. + * + * Returns zero on success or a negative error code otherwise. */ __must_check int media_graph_walk_init( struct media_graph *graph, struct media_device *mdev); -- cgit v1.2.3-59-g8ed1b From 9e7fabbcb01a7e97c236d273e2017c1a35007a42 Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Fri, 5 Mar 2021 16:59:22 +0100 Subject: media: v4l: fwnode: Rename and make static V4L2 async notifier helper Rename v4l2_async_notifier_parse_fwnode_sensor_common() as v4l2_async_notifier_parse_fwnode_sensor() and make the function static, as it's not used by a driver and maybe never will. Signed-off-by: Sakari Ailus Reviewed-by: Ezequiel Garcia Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-fwnode.c | 27 ++++++++++++++++++++++----- include/media/v4l2-async.h | 2 +- include/media/v4l2-fwnode.h | 21 --------------------- 3 files changed, 23 insertions(+), 27 deletions(-) (limited to 'include/media') diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index 2283ff3b8e1d..9c1b38919491 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -1259,8 +1259,27 @@ v4l2_fwnode_reference_parse_int_props(struct device *dev, return !fwnode || PTR_ERR(fwnode) == -ENOENT ? 0 : PTR_ERR(fwnode); } -int v4l2_async_notifier_parse_fwnode_sensor_common(struct device *dev, - struct v4l2_async_notifier *notifier) +/** + * v4l2_async_notifier_parse_fwnode_sensor - parse common references on + * sensors for async sub-devices + * @dev: the device node the properties of which are parsed for references + * @notifier: the async notifier where the async subdevs will be added + * + * Parse common sensor properties for remote devices related to the + * sensor and set up async sub-devices for them. + * + * Any notifier populated using this function must be released with a call to + * v4l2_async_notifier_release() after it has been unregistered and the async + * sub-devices are no longer in use, even in the case the function returned an + * error. + * + * Return: 0 on success + * -ENOMEM if memory allocation failed + * -EINVAL if property parsing failed + */ +static int +v4l2_async_notifier_parse_fwnode_sensor(struct device *dev, + struct v4l2_async_notifier *notifier) { static const char * const led_props[] = { "led" }; static const struct v4l2_fwnode_int_props props[] = { @@ -1288,7 +1307,6 @@ int v4l2_async_notifier_parse_fwnode_sensor_common(struct device *dev, return 0; } -EXPORT_SYMBOL_GPL(v4l2_async_notifier_parse_fwnode_sensor_common); int v4l2_async_register_subdev_sensor_common(struct v4l2_subdev *sd) { @@ -1304,8 +1322,7 @@ int v4l2_async_register_subdev_sensor_common(struct v4l2_subdev *sd) v4l2_async_notifier_init(notifier); - ret = v4l2_async_notifier_parse_fwnode_sensor_common(sd->dev, - notifier); + ret = v4l2_async_notifier_parse_fwnode_sensor(sd->dev, notifier); if (ret < 0) goto out_cleanup; diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h index f572e1279182..0e1886783f62 100644 --- a/include/media/v4l2-async.h +++ b/include/media/v4l2-async.h @@ -295,7 +295,7 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd); * * This function is just like v4l2_async_register_subdev() with the exception * that calling it will also parse firmware interfaces for remote references - * using v4l2_async_notifier_parse_fwnode_sensor_common() and registers the + * using v4l2_async_notifier_parse_fwnode_sensor() and registers the * async sub-devices. The sub-device is similarly unregistered by calling * v4l2_async_unregister_subdev(). * diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h index 80d21ad8d603..7ab033b819eb 100644 --- a/include/media/v4l2-fwnode.h +++ b/include/media/v4l2-fwnode.h @@ -510,27 +510,6 @@ v4l2_async_notifier_parse_fwnode_endpoints(struct device *dev, size_t asd_struct_size, parse_endpoint_func parse_endpoint); -/** - * v4l2_async_notifier_parse_fwnode_sensor_common - parse common references on - * sensors for async sub-devices - * @dev: the device node the properties of which are parsed for references - * @notifier: the async notifier where the async subdevs will be added - * - * Parse common sensor properties for remote devices related to the - * sensor and set up async sub-devices for them. - * - * Any notifier populated using this function must be released with a call to - * v4l2_async_notifier_release() after it has been unregistered and the async - * sub-devices are no longer in use, even in the case the function returned an - * error. - * - * Return: 0 on success - * -ENOMEM if memory allocation failed - * -EINVAL if property parsing failed - */ -int v4l2_async_notifier_parse_fwnode_sensor_common(struct device *dev, - struct v4l2_async_notifier *notifier); - /* Helper macros to access the connector links. */ /** v4l2_connector_last_link - Helper macro to get the first -- cgit v1.2.3-59-g8ed1b From 15786f7b564eff32d8dae73d40d77dc4e3c7298f Mon Sep 17 00:00:00 2001 From: Sakari Ailus Date: Fri, 5 Mar 2021 17:42:34 +0100 Subject: media: v4l: fwnode: Rename v4l2_async_register_subdev_sensor_common Rename v4l2_async_register_subdev_sensor_common as v4l2_async_register_subdev_sensor. This is a part of the effort to make the long names present in V4L2 fwnode and async frameworks shorter. Signed-off-by: Sakari Ailus Reviewed-by: Ezequiel Garcia Signed-off-by: Mauro Carvalho Chehab --- Documentation/driver-api/media/v4l2-subdev.rst | 2 +- drivers/media/i2c/ccs/ccs-core.c | 2 +- drivers/media/i2c/et8ek8/et8ek8_driver.c | 2 +- drivers/media/i2c/hi556.c | 2 +- drivers/media/i2c/imx214.c | 2 +- drivers/media/i2c/imx219.c | 2 +- drivers/media/i2c/imx258.c | 2 +- drivers/media/i2c/imx319.c | 2 +- drivers/media/i2c/imx334.c | 2 +- drivers/media/i2c/imx355.c | 2 +- drivers/media/i2c/ov13858.c | 2 +- drivers/media/i2c/ov2740.c | 2 +- drivers/media/i2c/ov5640.c | 2 +- drivers/media/i2c/ov5648.c | 2 +- drivers/media/i2c/ov5670.c | 2 +- drivers/media/i2c/ov5675.c | 2 +- drivers/media/i2c/ov5695.c | 2 +- drivers/media/i2c/ov8856.c | 2 +- drivers/media/i2c/ov8865.c | 2 +- drivers/media/i2c/ov9734.c | 2 +- drivers/media/v4l2-core/v4l2-fwnode.c | 4 ++-- include/media/v4l2-async.h | 10 +++++----- 22 files changed, 27 insertions(+), 27 deletions(-) (limited to 'include/media') diff --git a/Documentation/driver-api/media/v4l2-subdev.rst b/Documentation/driver-api/media/v4l2-subdev.rst index e1f05cd38897..7736da077fb8 100644 --- a/Documentation/driver-api/media/v4l2-subdev.rst +++ b/Documentation/driver-api/media/v4l2-subdev.rst @@ -208,7 +208,7 @@ the needs of the driver. :c:func:`v4l2_async_notifier_add_i2c_subdev` are for bridge and ISP drivers for registering their async sub-devices with the notifier. -:c:func:`v4l2_async_register_subdev_sensor_common` is a helper function for +:c:func:`v4l2_async_register_subdev_sensor` is a helper function for sensor drivers registering their own async sub-device, but it also registers a notifier and further registers async sub-devices for lens and flash devices found in firmware. The notifier for the sub-device is unregistered with the diff --git a/drivers/media/i2c/ccs/ccs-core.c b/drivers/media/i2c/ccs/ccs-core.c index 4505594996bd..9dc3f45da3dc 100644 --- a/drivers/media/i2c/ccs/ccs-core.c +++ b/drivers/media/i2c/ccs/ccs-core.c @@ -3572,7 +3572,7 @@ static int ccs_probe(struct i2c_client *client) pm_runtime_get_noresume(&client->dev); pm_runtime_enable(&client->dev); - rval = v4l2_async_register_subdev_sensor_common(&sensor->src->sd); + rval = v4l2_async_register_subdev_sensor(&sensor->src->sd); if (rval < 0) goto out_disable_runtime_pm; diff --git a/drivers/media/i2c/et8ek8/et8ek8_driver.c b/drivers/media/i2c/et8ek8/et8ek8_driver.c index 122af761c8e3..bb3eac5e005e 100644 --- a/drivers/media/i2c/et8ek8/et8ek8_driver.c +++ b/drivers/media/i2c/et8ek8/et8ek8_driver.c @@ -1443,7 +1443,7 @@ static int et8ek8_probe(struct i2c_client *client) goto err_mutex; } - ret = v4l2_async_register_subdev_sensor_common(&sensor->subdev); + ret = v4l2_async_register_subdev_sensor(&sensor->subdev); if (ret < 0) goto err_entity; diff --git a/drivers/media/i2c/hi556.c b/drivers/media/i2c/hi556.c index c74736845d7a..6f05c1138e3b 100644 --- a/drivers/media/i2c/hi556.c +++ b/drivers/media/i2c/hi556.c @@ -1145,7 +1145,7 @@ static int hi556_probe(struct i2c_client *client) goto probe_error_v4l2_ctrl_handler_free; } - ret = v4l2_async_register_subdev_sensor_common(&hi556->sd); + ret = v4l2_async_register_subdev_sensor(&hi556->sd); if (ret < 0) { dev_err(&client->dev, "failed to register V4L2 subdev: %d", ret); diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c index cee1a4817af9..e8b281e432e8 100644 --- a/drivers/media/i2c/imx214.c +++ b/drivers/media/i2c/imx214.c @@ -1061,7 +1061,7 @@ static int imx214_probe(struct i2c_client *client) imx214_entity_init_cfg(&imx214->sd, NULL); - ret = v4l2_async_register_subdev_sensor_common(&imx214->sd); + ret = v4l2_async_register_subdev_sensor(&imx214->sd); if (ret < 0) { dev_err(dev, "could not register v4l2 device\n"); goto free_entity; diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index 6e3382b85a90..909e1d418f33 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -1528,7 +1528,7 @@ static int imx219_probe(struct i2c_client *client) goto error_handler_free; } - ret = v4l2_async_register_subdev_sensor_common(&imx219->sd); + ret = v4l2_async_register_subdev_sensor(&imx219->sd); if (ret < 0) { dev_err(dev, "failed to register sensor sub-device: %d\n", ret); goto error_media_entity; diff --git a/drivers/media/i2c/imx258.c b/drivers/media/i2c/imx258.c index 61d74b794582..61b2d87a9761 100644 --- a/drivers/media/i2c/imx258.c +++ b/drivers/media/i2c/imx258.c @@ -1289,7 +1289,7 @@ static int imx258_probe(struct i2c_client *client) if (ret) goto error_handler_free; - ret = v4l2_async_register_subdev_sensor_common(&imx258->sd); + ret = v4l2_async_register_subdev_sensor(&imx258->sd); if (ret < 0) goto error_media_entity; diff --git a/drivers/media/i2c/imx319.c b/drivers/media/i2c/imx319.c index 8473c0bbb35d..38540323a156 100644 --- a/drivers/media/i2c/imx319.c +++ b/drivers/media/i2c/imx319.c @@ -2486,7 +2486,7 @@ static int imx319_probe(struct i2c_client *client) goto error_handler_free; } - ret = v4l2_async_register_subdev_sensor_common(&imx319->sd); + ret = v4l2_async_register_subdev_sensor(&imx319->sd); if (ret < 0) goto error_media_entity; diff --git a/drivers/media/i2c/imx334.c b/drivers/media/i2c/imx334.c index ad530f0d338a..047aa7658d21 100644 --- a/drivers/media/i2c/imx334.c +++ b/drivers/media/i2c/imx334.c @@ -1057,7 +1057,7 @@ static int imx334_probe(struct i2c_client *client) goto error_handler_free; } - ret = v4l2_async_register_subdev_sensor_common(&imx334->sd); + ret = v4l2_async_register_subdev_sensor(&imx334->sd); if (ret < 0) { dev_err(imx334->dev, "failed to register async subdev: %d", ret); diff --git a/drivers/media/i2c/imx355.c b/drivers/media/i2c/imx355.c index 700f7467fb31..ccedcd4c520a 100644 --- a/drivers/media/i2c/imx355.c +++ b/drivers/media/i2c/imx355.c @@ -1786,7 +1786,7 @@ static int imx355_probe(struct i2c_client *client) goto error_handler_free; } - ret = v4l2_async_register_subdev_sensor_common(&imx355->sd); + ret = v4l2_async_register_subdev_sensor(&imx355->sd); if (ret < 0) goto error_media_entity; diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c index 2f3be7a80cef..4a2885ff0cbe 100644 --- a/drivers/media/i2c/ov13858.c +++ b/drivers/media/i2c/ov13858.c @@ -1738,7 +1738,7 @@ static int ov13858_probe(struct i2c_client *client, goto error_handler_free; } - ret = v4l2_async_register_subdev_sensor_common(&ov13858->sd); + ret = v4l2_async_register_subdev_sensor(&ov13858->sd); if (ret < 0) goto error_media_entity; diff --git a/drivers/media/i2c/ov2740.c b/drivers/media/i2c/ov2740.c index b41a90c2aed5..0f3f17f3c426 100644 --- a/drivers/media/i2c/ov2740.c +++ b/drivers/media/i2c/ov2740.c @@ -1154,7 +1154,7 @@ static int ov2740_probe(struct i2c_client *client) goto probe_error_v4l2_ctrl_handler_free; } - ret = v4l2_async_register_subdev_sensor_common(&ov2740->sd); + ret = v4l2_async_register_subdev_sensor(&ov2740->sd); if (ret < 0) { dev_err(&client->dev, "failed to register V4L2 subdev: %d", ret); diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c index 14f3afa7721a..5b9cc71df473 100644 --- a/drivers/media/i2c/ov5640.c +++ b/drivers/media/i2c/ov5640.c @@ -3162,7 +3162,7 @@ static int ov5640_probe(struct i2c_client *client) if (ret) goto entity_cleanup; - ret = v4l2_async_register_subdev_sensor_common(&sensor->sd); + ret = v4l2_async_register_subdev_sensor(&sensor->sd); if (ret) goto free_ctrls; diff --git a/drivers/media/i2c/ov5648.c b/drivers/media/i2c/ov5648.c index dfe38ab8224d..3ecb4a3e8773 100644 --- a/drivers/media/i2c/ov5648.c +++ b/drivers/media/i2c/ov5648.c @@ -2559,7 +2559,7 @@ static int ov5648_probe(struct i2c_client *client) /* V4L2 subdev register */ - ret = v4l2_async_register_subdev_sensor_common(subdev); + ret = v4l2_async_register_subdev_sensor(subdev); if (ret) goto error_pm; diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c index 866c8c2e8f59..dee7df8dd100 100644 --- a/drivers/media/i2c/ov5670.c +++ b/drivers/media/i2c/ov5670.c @@ -2503,7 +2503,7 @@ static int ov5670_probe(struct i2c_client *client) } /* Async register for subdev */ - ret = v4l2_async_register_subdev_sensor_common(&ov5670->sd); + ret = v4l2_async_register_subdev_sensor(&ov5670->sd); if (ret < 0) { err_msg = "v4l2_async_register_subdev() error"; goto error_entity_cleanup; diff --git a/drivers/media/i2c/ov5675.c b/drivers/media/i2c/ov5675.c index ae00d717e599..dea32859459a 100644 --- a/drivers/media/i2c/ov5675.c +++ b/drivers/media/i2c/ov5675.c @@ -1193,7 +1193,7 @@ static int ov5675_probe(struct i2c_client *client) goto probe_error_v4l2_ctrl_handler_free; } - ret = v4l2_async_register_subdev_sensor_common(&ov5675->sd); + ret = v4l2_async_register_subdev_sensor(&ov5675->sd); if (ret < 0) { dev_err(&client->dev, "failed to register V4L2 subdev: %d", ret); diff --git a/drivers/media/i2c/ov5695.c b/drivers/media/i2c/ov5695.c index bbccb6f9582f..09bee57a241d 100644 --- a/drivers/media/i2c/ov5695.c +++ b/drivers/media/i2c/ov5695.c @@ -1336,7 +1336,7 @@ static int ov5695_probe(struct i2c_client *client, goto err_power_off; #endif - ret = v4l2_async_register_subdev_sensor_common(sd); + ret = v4l2_async_register_subdev_sensor(sd); if (ret) { dev_err(dev, "v4l2 async register subdev failed\n"); goto err_clean_entity; diff --git a/drivers/media/i2c/ov8856.c b/drivers/media/i2c/ov8856.c index b337f729d5e3..e3af3ea277af 100644 --- a/drivers/media/i2c/ov8856.c +++ b/drivers/media/i2c/ov8856.c @@ -1795,7 +1795,7 @@ static int ov8856_probe(struct i2c_client *client) goto probe_error_v4l2_ctrl_handler_free; } - ret = v4l2_async_register_subdev_sensor_common(&ov8856->sd); + ret = v4l2_async_register_subdev_sensor(&ov8856->sd); if (ret < 0) { dev_err(&client->dev, "failed to register V4L2 subdev: %d", ret); diff --git a/drivers/media/i2c/ov8865.c b/drivers/media/i2c/ov8865.c index 2db052ff9d21..9ecf180635ee 100644 --- a/drivers/media/i2c/ov8865.c +++ b/drivers/media/i2c/ov8865.c @@ -2904,7 +2904,7 @@ static int ov8865_probe(struct i2c_client *client) /* V4L2 subdev register */ - ret = v4l2_async_register_subdev_sensor_common(subdev); + ret = v4l2_async_register_subdev_sensor(subdev); if (ret) goto error_pm; diff --git a/drivers/media/i2c/ov9734.c b/drivers/media/i2c/ov9734.c index e212465489e8..b7309a551cae 100644 --- a/drivers/media/i2c/ov9734.c +++ b/drivers/media/i2c/ov9734.c @@ -964,7 +964,7 @@ static int ov9734_probe(struct i2c_client *client) goto probe_error_v4l2_ctrl_handler_free; } - ret = v4l2_async_register_subdev_sensor_common(&ov9734->sd); + ret = v4l2_async_register_subdev_sensor(&ov9734->sd); if (ret < 0) { dev_err(&client->dev, "failed to register V4L2 subdev: %d", ret); diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index 9c1b38919491..843259c304bb 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -1308,7 +1308,7 @@ v4l2_async_notifier_parse_fwnode_sensor(struct device *dev, return 0; } -int v4l2_async_register_subdev_sensor_common(struct v4l2_subdev *sd) +int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd) { struct v4l2_async_notifier *notifier; int ret; @@ -1347,7 +1347,7 @@ out_cleanup: return ret; } -EXPORT_SYMBOL_GPL(v4l2_async_register_subdev_sensor_common); +EXPORT_SYMBOL_GPL(v4l2_async_register_subdev_sensor); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Sakari Ailus "); diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h index 0e1886783f62..5b275a845c20 100644 --- a/include/media/v4l2-async.h +++ b/include/media/v4l2-async.h @@ -286,10 +286,10 @@ void v4l2_async_notifier_cleanup(struct v4l2_async_notifier *notifier); int v4l2_async_register_subdev(struct v4l2_subdev *sd); /** - * v4l2_async_register_subdev_sensor_common - registers a sensor sub-device to - * the asynchronous sub-device - * framework and parse set up common - * sensor related devices + * v4l2_async_register_subdev_sensor - registers a sensor sub-device to the + * asynchronous sub-device framework and + * parse set up common sensor related + * devices * * @sd: pointer to struct &v4l2_subdev * @@ -305,7 +305,7 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd); * to register it. */ int __must_check -v4l2_async_register_subdev_sensor_common(struct v4l2_subdev *sd); +v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd); /** * v4l2_async_unregister_subdev - unregisters a sub-device to the asynchronous -- cgit v1.2.3-59-g8ed1b From 1ad0de78e7944eef171340d9fa00f0a59458991c Mon Sep 17 00:00:00 2001 From: Stanimir Varbanov Date: Tue, 19 Jan 2021 16:06:42 +0100 Subject: media: v4l: Add HDR10 static metadata controls Introduce Content light level and Mastering display colour volume Colorimetry compound controls with relevant payload structures and validation. Signed-off-by: Stanimir Varbanov Reviewed-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-ctrls.c | 68 ++++++++++++++++++++++++++++++++++++ include/media/v4l2-ctrls.h | 4 +++ include/uapi/linux/v4l2-controls.h | 31 ++++++++++++++++ include/uapi/linux/videodev2.h | 3 ++ 4 files changed, 106 insertions(+) (limited to 'include/media') diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index 89780c5a78e1..e7fcbaeec0ae 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -1219,6 +1219,8 @@ const char *v4l2_ctrl_get_name(u32 id) /* Colorimetry controls */ /* Keep the order of the 'case's the same as in v4l2-controls.h! */ case V4L2_CID_COLORIMETRY_CLASS: return "Colorimetry Controls"; + case V4L2_CID_COLORIMETRY_HDR10_CLL_INFO: return "HDR10 Content Light Info"; + case V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY: return "HDR10 Mastering Display"; default: return NULL; } @@ -1528,6 +1530,12 @@ void v4l2_ctrl_fill(u32 id, const char **name, enum v4l2_ctrl_type *type, *type = V4L2_CTRL_TYPE_AREA; *flags |= V4L2_CTRL_FLAG_READ_ONLY; break; + case V4L2_CID_COLORIMETRY_HDR10_CLL_INFO: + *type = V4L2_CTRL_TYPE_HDR10_CLL_INFO; + break; + case V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY: + *type = V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY; + break; default: *type = V4L2_CTRL_TYPE_INTEGER; break; @@ -1828,6 +1836,12 @@ static void std_log(const struct v4l2_ctrl *ctrl) case V4L2_CTRL_TYPE_VP8_FRAME: pr_cont("VP8_FRAME"); break; + case V4L2_CTRL_TYPE_HDR10_CLL_INFO: + pr_cont("HDR10_CLL_INFO"); + break; + case V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY: + pr_cont("HDR10_MASTERING_DISPLAY"); + break; default: pr_cont("unknown type %d", ctrl->type); break; @@ -1880,6 +1894,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, struct v4l2_ctrl_hevc_sps *p_hevc_sps; struct v4l2_ctrl_hevc_pps *p_hevc_pps; struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params; + struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering; struct v4l2_area *area; void *p = ptr.p + idx * ctrl->elem_size; unsigned int i; @@ -2175,6 +2190,53 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, zero_padding(*p_hevc_slice_params); break; + case V4L2_CTRL_TYPE_HDR10_CLL_INFO: + break; + + case V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY: + p_hdr10_mastering = p; + + for (i = 0; i < 3; ++i) { + if (p_hdr10_mastering->display_primaries_x[i] < + V4L2_HDR10_MASTERING_PRIMARIES_X_LOW || + p_hdr10_mastering->display_primaries_x[i] > + V4L2_HDR10_MASTERING_PRIMARIES_X_HIGH || + p_hdr10_mastering->display_primaries_y[i] < + V4L2_HDR10_MASTERING_PRIMARIES_Y_LOW || + p_hdr10_mastering->display_primaries_y[i] > + V4L2_HDR10_MASTERING_PRIMARIES_Y_HIGH) + return -EINVAL; + } + + if (p_hdr10_mastering->white_point_x < + V4L2_HDR10_MASTERING_WHITE_POINT_X_LOW || + p_hdr10_mastering->white_point_x > + V4L2_HDR10_MASTERING_WHITE_POINT_X_HIGH || + p_hdr10_mastering->white_point_y < + V4L2_HDR10_MASTERING_WHITE_POINT_Y_LOW || + p_hdr10_mastering->white_point_y > + V4L2_HDR10_MASTERING_WHITE_POINT_Y_HIGH) + return -EINVAL; + + if (p_hdr10_mastering->max_display_mastering_luminance < + V4L2_HDR10_MASTERING_MAX_LUMA_LOW || + p_hdr10_mastering->max_display_mastering_luminance > + V4L2_HDR10_MASTERING_MAX_LUMA_HIGH || + p_hdr10_mastering->min_display_mastering_luminance < + V4L2_HDR10_MASTERING_MIN_LUMA_LOW || + p_hdr10_mastering->min_display_mastering_luminance > + V4L2_HDR10_MASTERING_MIN_LUMA_HIGH) + return -EINVAL; + + /* The following restriction comes from ITU-T Rec. H.265 spec */ + if (p_hdr10_mastering->max_display_mastering_luminance == + V4L2_HDR10_MASTERING_MAX_LUMA_LOW && + p_hdr10_mastering->min_display_mastering_luminance == + V4L2_HDR10_MASTERING_MIN_LUMA_HIGH) + return -EINVAL; + + break; + case V4L2_CTRL_TYPE_AREA: area = p; if (!area->width || !area->height) @@ -2868,6 +2930,12 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, case V4L2_CTRL_TYPE_HEVC_SLICE_PARAMS: elem_size = sizeof(struct v4l2_ctrl_hevc_slice_params); break; + case V4L2_CTRL_TYPE_HDR10_CLL_INFO: + elem_size = sizeof(struct v4l2_ctrl_hdr10_cll_info); + break; + case V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY: + elem_size = sizeof(struct v4l2_ctrl_hdr10_mastering_display); + break; case V4L2_CTRL_TYPE_AREA: elem_size = sizeof(struct v4l2_area); break; diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index dea65c92e86b..c1d20bd8f25f 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -53,6 +53,8 @@ struct video_device; * @p_hevc_sps: Pointer to an HEVC sequence parameter set structure. * @p_hevc_pps: Pointer to an HEVC picture parameter set structure. * @p_hevc_slice_params: Pointer to an HEVC slice parameters structure. + * @p_hdr10_cll: Pointer to an HDR10 Content Light Level structure. + * @p_hdr10_mastering: Pointer to an HDR10 Mastering Display structure. * @p_area: Pointer to an area. * @p: Pointer to a compound value. * @p_const: Pointer to a constant compound value. @@ -77,6 +79,8 @@ union v4l2_ctrl_ptr { struct v4l2_ctrl_hevc_sps *p_hevc_sps; struct v4l2_ctrl_hevc_pps *p_hevc_pps; struct v4l2_ctrl_hevc_slice_params *p_hevc_slice_params; + struct v4l2_ctrl_hdr10_cll_info *p_hdr10_cll; + struct v4l2_ctrl_hdr10_mastering_display *p_hdr10_mastering; struct v4l2_area *p_area; void *p; const void *p_const; diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h index e376d816c56e..d43bec5f1afd 100644 --- a/include/uapi/linux/v4l2-controls.h +++ b/include/uapi/linux/v4l2-controls.h @@ -1865,6 +1865,37 @@ struct v4l2_ctrl_vp8_frame { #define V4L2_CID_COLORIMETRY_CLASS_BASE (V4L2_CTRL_CLASS_COLORIMETRY | 0x900) #define V4L2_CID_COLORIMETRY_CLASS (V4L2_CTRL_CLASS_COLORIMETRY | 1) +#define V4L2_CID_COLORIMETRY_HDR10_CLL_INFO (V4L2_CID_COLORIMETRY_CLASS_BASE + 0) + +struct v4l2_ctrl_hdr10_cll_info { + __u16 max_content_light_level; + __u16 max_pic_average_light_level; +}; + +#define V4L2_CID_COLORIMETRY_HDR10_MASTERING_DISPLAY (V4L2_CID_COLORIMETRY_CLASS_BASE + 1) + +#define V4L2_HDR10_MASTERING_PRIMARIES_X_LOW 5 +#define V4L2_HDR10_MASTERING_PRIMARIES_X_HIGH 37000 +#define V4L2_HDR10_MASTERING_PRIMARIES_Y_LOW 5 +#define V4L2_HDR10_MASTERING_PRIMARIES_Y_HIGH 42000 +#define V4L2_HDR10_MASTERING_WHITE_POINT_X_LOW 5 +#define V4L2_HDR10_MASTERING_WHITE_POINT_X_HIGH 37000 +#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_LOW 5 +#define V4L2_HDR10_MASTERING_WHITE_POINT_Y_HIGH 42000 +#define V4L2_HDR10_MASTERING_MAX_LUMA_LOW 50000 +#define V4L2_HDR10_MASTERING_MAX_LUMA_HIGH 100000000 +#define V4L2_HDR10_MASTERING_MIN_LUMA_LOW 1 +#define V4L2_HDR10_MASTERING_MIN_LUMA_HIGH 50000 + +struct v4l2_ctrl_hdr10_mastering_display { + __u16 display_primaries_x[3]; + __u16 display_primaries_y[3]; + __u16 white_point_x; + __u16 white_point_y; + __u32 max_display_mastering_luminance; + __u32 min_display_mastering_luminance; +}; + /* MPEG-compression definitions kept for backwards compatibility */ #ifndef __KERNEL__ #define V4L2_CTRL_CLASS_MPEG V4L2_CTRL_CLASS_CODEC diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 8d15f6ccc4b4..311a01cc5775 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -1794,6 +1794,9 @@ enum v4l2_ctrl_type { V4L2_CTRL_TYPE_U32 = 0x0102, V4L2_CTRL_TYPE_AREA = 0x0106, + V4L2_CTRL_TYPE_HDR10_CLL_INFO = 0x0110, + V4L2_CTRL_TYPE_HDR10_MASTERING_DISPLAY = 0x0111, + V4L2_CTRL_TYPE_H264_SPS = 0x0200, V4L2_CTRL_TYPE_H264_PPS = 0x0201, V4L2_CTRL_TYPE_H264_SCALING_MATRIX = 0x0202, -- cgit v1.2.3-59-g8ed1b From 3ddcea9f7da0d7df25e12c2f2e06082341fed4fb Mon Sep 17 00:00:00 2001 From: Christian Hewitt Date: Mon, 29 Mar 2021 17:12:26 +0200 Subject: media: rc: add keymaps for mecool-kii-pro/kiii-pro remotes Add keymaps and bindings for the simple IR (NEC) remotes used with the MeCool KII-Pro and MeCool KIII-Pro Android STB devices. Tested-by: Drazen Spio Signed-off-by: Christian Hewitt Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab --- Documentation/devicetree/bindings/media/rc.yaml | 2 + drivers/media/rc/keymaps/Makefile | 2 + drivers/media/rc/keymaps/rc-mecool-kii-pro.c | 91 +++++++++++++++++++++++++ drivers/media/rc/keymaps/rc-mecool-kiii-pro.c | 88 ++++++++++++++++++++++++ include/media/rc-map.h | 2 + 5 files changed, 185 insertions(+) create mode 100644 drivers/media/rc/keymaps/rc-mecool-kii-pro.c create mode 100644 drivers/media/rc/keymaps/rc-mecool-kiii-pro.c (limited to 'include/media') diff --git a/Documentation/devicetree/bindings/media/rc.yaml b/Documentation/devicetree/bindings/media/rc.yaml index 3bedc95b71ce..e3cea8cd74ed 100644 --- a/Documentation/devicetree/bindings/media/rc.yaml +++ b/Documentation/devicetree/bindings/media/rc.yaml @@ -90,6 +90,8 @@ properties: - rc-leadtek-y04g0051 - rc-lme2510 - rc-manli + - rc-mecool-kii-pro + - rc-mecool-kiii-pro - rc-medion-x10 - rc-medion-x10-digitainer - rc-medion-x10-or2x diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile index 7434ecbb7ca0..ae7474a22635 100644 --- a/drivers/media/rc/keymaps/Makefile +++ b/drivers/media/rc/keymaps/Makefile @@ -67,6 +67,8 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-leadtek-y04g0051.o \ rc-lme2510.o \ rc-manli.o \ + rc-mecool-kii-pro.o \ + rc-mecool-kiii-pro.o \ rc-medion-x10.o \ rc-medion-x10-digitainer.o \ rc-medion-x10-or2x.o \ diff --git a/drivers/media/rc/keymaps/rc-mecool-kii-pro.c b/drivers/media/rc/keymaps/rc-mecool-kii-pro.c new file mode 100644 index 000000000000..77ca8a8fade8 --- /dev/null +++ b/drivers/media/rc/keymaps/rc-mecool-kii-pro.c @@ -0,0 +1,91 @@ +// SPDX-License-Identifier: GPL-2.0+ +// +// Copyright (C) 2021 Christian Hewitt + +#include +#include + +// +// Keytable for the Mecool Kii Pro remote control +// + +static struct rc_map_table mecool_kii_pro[] = { + { 0x59, KEY_POWER }, + { 0x19, KEY_MUTE }, + + { 0x42, KEY_RED }, + { 0x40, KEY_GREEN }, + { 0x00, KEY_YELLOW}, + { 0x03, KEY_BLUE }, + + { 0x4a, KEY_REWIND }, + { 0x48, KEY_FORWARD }, + { 0x08, KEY_PREVIOUSSONG}, + { 0x0b, KEY_NEXTSONG}, + + { 0x46, KEY_PLAYPAUSE }, + { 0x44, KEY_STOP }, + { 0x1f, KEY_FAVORITES}, + { 0x04, KEY_PVR }, + + { 0x4d, KEY_EPG }, + { 0x02, KEY_INFO }, + { 0x09, KEY_SUBTITLE }, + { 0x01, KEY_LANGUAGE }, // AUDIO + + { 0x0d, KEY_HOME }, + { 0x11, KEY_TV }, + { 0x45, KEY_MENU }, + { 0x05, KEY_EXIT }, + + { 0x5a, KEY_LEFT }, + { 0x1b, KEY_RIGHT }, + { 0x06, KEY_UP }, + { 0x16, KEY_DOWN }, + { 0x1a, KEY_OK }, + + { 0x13, KEY_VOLUMEUP }, + { 0x17, KEY_VOLUMEDOWN }, + { 0x58, KEY_APPSELECT }, // APPS + { 0x12, KEY_CONTEXT_MENU }, // MOUSE + { 0x55, KEY_CHANNELUP }, // PAGE_UP + { 0x15, KEY_CHANNELDOWN }, // PAGE_DOWN + + { 0x52, KEY_1 }, + { 0x50, KEY_2 }, + { 0x10, KEY_3 }, + { 0x56, KEY_4 }, + { 0x54, KEY_5 }, + { 0x14, KEY_6 }, + { 0x4e, KEY_7 }, + { 0x4c, KEY_8 }, + { 0x0c, KEY_9 }, + { 0x18, KEY_WWW }, + { 0x0f, KEY_0 }, + { 0x51, KEY_DELETE }, +}; + +static struct rc_map_list mecool_kii_pro_map = { + .map = { + .scan = mecool_kii_pro, + .size = ARRAY_SIZE(mecool_kii_pro), + .rc_proto = RC_PROTO_NEC, + .name = RC_MAP_MECOOL_KII_PRO, + } +}; + +static int __init init_rc_map_mecool_kii_pro(void) +{ + return rc_map_register(&mecool_kii_pro_map); +} + +static void __exit exit_rc_map_mecool_kii_pro(void) +{ + rc_map_unregister(&mecool_kii_pro_map); +} + +module_init(init_rc_map_mecool_kii_pro) +module_exit(exit_rc_map_mecool_kii_pro) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Christian Hewitt + +#include +#include + +// +// Keytable for the Mecool Kiii Pro remote control +// + +static struct rc_map_table mecool_kiii_pro[] = { + { 0x59, KEY_POWER }, + + { 0x52, KEY_1 }, + { 0x50, KEY_2 }, + { 0x10, KEY_3 }, + { 0x56, KEY_4 }, + { 0x54, KEY_5 }, + { 0x14, KEY_6 }, + { 0x4e, KEY_7 }, + { 0x4c, KEY_8 }, + { 0x0c, KEY_9 }, + { 0x02, KEY_INFO }, + { 0x0f, KEY_0 }, + { 0x51, KEY_DELETE }, + { 0x1f, KEY_FAVORITES}, + { 0x09, KEY_SUBTITLE }, + { 0x01, KEY_LANGUAGE }, // AUDIO + + { 0x42, KEY_RED }, + { 0x40, KEY_GREEN }, + { 0x00, KEY_YELLOW}, + { 0x03, KEY_BLUE }, // RADIO + + { 0x0d, KEY_HOME }, + { 0x4d, KEY_EPG }, + { 0x45, KEY_MENU }, + { 0x05, KEY_EXIT }, + + { 0x5a, KEY_LEFT }, + { 0x1b, KEY_RIGHT }, + { 0x06, KEY_UP }, + { 0x16, KEY_DOWN }, + { 0x1a, KEY_OK }, + + { 0x13, KEY_VOLUMEUP }, + { 0x17, KEY_VOLUMEDOWN }, + { 0x19, KEY_MUTE }, + { 0x12, KEY_CONTEXT_MENU }, // MOUSE + { 0x55, KEY_CHANNELUP }, // PAGE_UP + { 0x15, KEY_CHANNELDOWN }, // PAGE_DOWN + + { 0x4a, KEY_REWIND }, + { 0x48, KEY_FORWARD }, + { 0x46, KEY_PLAYPAUSE }, + { 0x44, KEY_STOP }, + + { 0x08, KEY_PREVIOUSSONG}, + { 0x0b, KEY_NEXTSONG}, + { 0x04, KEY_PVR }, + { 0x64, KEY_RECORD }, +}; + +static struct rc_map_list mecool_kiii_pro_map = { + .map = { + .scan = mecool_kiii_pro, + .size = ARRAY_SIZE(mecool_kiii_pro), + .rc_proto = RC_PROTO_NEC, + .name = RC_MAP_MECOOL_KIII_PRO, + } +}; + +static int __init init_rc_map_mecool_kiii_pro(void) +{ + return rc_map_register(&mecool_kiii_pro_map); +} + +static void __exit exit_rc_map_mecool_kiii_pro(void) +{ + rc_map_unregister(&mecool_kiii_pro_map); +} + +module_init(init_rc_map_mecool_kiii_pro) +module_exit(exit_rc_map_mecool_kiii_pro) + +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Christian Hewitt Date: Mon, 12 Apr 2021 13:51:23 +0200 Subject: media: v4l2-ctrls: fix reference to freed memory When controls are used together with the Request API, then for each request a v4l2_ctrl_handler struct is allocated. This contains the controls that can be set in a request. If a control is *not* set in the request, then the value used in the most recent previous request must be used, or the current value if it is not found in any outstanding requests. The framework tried to find such a previous request and it would set the 'req' pointer in struct v4l2_ctrl_ref to the v4l2_ctrl_ref of the control in such a previous request. So far, so good. However, when that previous request was applied to the hardware, returned to userspace, and then userspace would re-init or free that request, any 'ref' pointer in still-queued requests would suddenly point to freed memory. This was not noticed before since the drivers that use this expected that each request would always have the controls set, so there was never any need to find a control in older requests. This requirement was relaxed, and now this bug surfaced. It was also made worse by changeset 2fae4d6aabc8 ("media: v4l2-ctrls: v4l2_ctrl_request_complete() should always set ref->req") which increased the chance of this happening. The use of the 'req' pointer in v4l2_ctrl_ref was very fragile, so drop this entirely. Instead add a valid_p_req bool to indicate that p_req contains a valid value for this control. And if it is false, then just use the current value of the control. Note that VIDIOC_G_EXT_CTRLS will always return -EACCES when attempting to get a control from a request until the request is completed. And in that case, all controls in the request will have the control value set (i.e. valid_p_req is true). This means that the whole 'find the most recent previous request containing a control' idea is pointless, and the code can be simplified considerably. The v4l2_g_ext_ctrls_common() function was refactored a bit to make it more understandable. It also avoids updating volatile controls in a completed request since that was already done when the request was completed. Signed-off-by: Hans Verkuil Fixes: 2fae4d6aabc8 ("media: v4l2-ctrls: v4l2_ctrl_request_complete() should always set ref->req") Fixes: 6fa6f831f095 ("media: v4l2-ctrls: add core request support") Cc: # for v5.9 and up Tested-by: Alexandre Courbot Signed-off-by: Mauro Carvalho Chehab --- drivers/media/v4l2-core/v4l2-ctrls.c | 137 ++++++++++++++++------------------- include/media/v4l2-ctrls.h | 12 +-- 2 files changed, 70 insertions(+), 79 deletions(-) (limited to 'include/media') diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c index c7bcc5c25771..0d7fe1bd975a 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls.c +++ b/drivers/media/v4l2-core/v4l2-ctrls.c @@ -2504,7 +2504,16 @@ static void new_to_req(struct v4l2_ctrl_ref *ref) if (!ref) return; ptr_to_ptr(ref->ctrl, ref->ctrl->p_new, ref->p_req); - ref->req = ref; + ref->valid_p_req = true; +} + +/* Copy the current value to the request value */ +static void cur_to_req(struct v4l2_ctrl_ref *ref) +{ + if (!ref) + return; + ptr_to_ptr(ref->ctrl, ref->ctrl->p_cur, ref->p_req); + ref->valid_p_req = true; } /* Copy the request value to the new value */ @@ -2512,8 +2521,8 @@ static void req_to_new(struct v4l2_ctrl_ref *ref) { if (!ref) return; - if (ref->req) - ptr_to_ptr(ref->ctrl, ref->req->p_req, ref->ctrl->p_new); + if (ref->valid_p_req) + ptr_to_ptr(ref->ctrl, ref->p_req, ref->ctrl->p_new); else ptr_to_ptr(ref->ctrl, ref->ctrl->p_cur, ref->ctrl->p_new); } @@ -3694,39 +3703,8 @@ static void v4l2_ctrl_request_queue(struct media_request_object *obj) struct v4l2_ctrl_handler *hdl = container_of(obj, struct v4l2_ctrl_handler, req_obj); struct v4l2_ctrl_handler *main_hdl = obj->priv; - struct v4l2_ctrl_handler *prev_hdl = NULL; - struct v4l2_ctrl_ref *ref_ctrl, *ref_ctrl_prev = NULL; mutex_lock(main_hdl->lock); - if (list_empty(&main_hdl->requests_queued)) - goto queue; - - prev_hdl = list_last_entry(&main_hdl->requests_queued, - struct v4l2_ctrl_handler, requests_queued); - /* - * Note: prev_hdl and hdl must contain the same list of control - * references, so if any differences are detected then that is a - * driver bug and the WARN_ON is triggered. - */ - mutex_lock(prev_hdl->lock); - ref_ctrl_prev = list_first_entry(&prev_hdl->ctrl_refs, - struct v4l2_ctrl_ref, node); - list_for_each_entry(ref_ctrl, &hdl->ctrl_refs, node) { - if (ref_ctrl->req) - continue; - while (ref_ctrl_prev->ctrl->id < ref_ctrl->ctrl->id) { - /* Should never happen, but just in case... */ - if (list_is_last(&ref_ctrl_prev->node, - &prev_hdl->ctrl_refs)) - break; - ref_ctrl_prev = list_next_entry(ref_ctrl_prev, node); - } - if (WARN_ON(ref_ctrl_prev->ctrl->id != ref_ctrl->ctrl->id)) - break; - ref_ctrl->req = ref_ctrl_prev->req; - } - mutex_unlock(prev_hdl->lock); -queue: list_add_tail(&hdl->requests_queued, &main_hdl->requests_queued); hdl->request_is_queued = true; mutex_unlock(main_hdl->lock); @@ -3783,7 +3761,7 @@ v4l2_ctrl_request_hdl_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id) { struct v4l2_ctrl_ref *ref = find_ref_lock(hdl, id); - return (ref && ref->req == ref) ? ref->ctrl : NULL; + return (ref && ref->valid_p_req) ? ref->ctrl : NULL; } EXPORT_SYMBOL_GPL(v4l2_ctrl_request_hdl_ctrl_find); @@ -3972,7 +3950,13 @@ static int class_check(struct v4l2_ctrl_handler *hdl, u32 which) return find_ref_lock(hdl, which | 1) ? 0 : -EINVAL; } -/* Get extended controls. Allocates the helpers array if needed. */ +/* + * Get extended controls. Allocates the helpers array if needed. + * + * Note that v4l2_g_ext_ctrls_common() with 'which' set to + * V4L2_CTRL_WHICH_REQUEST_VAL is only called if the request was + * completed, and in that case valid_p_req is true for all controls. + */ static int v4l2_g_ext_ctrls_common(struct v4l2_ctrl_handler *hdl, struct v4l2_ext_controls *cs, struct video_device *vdev) @@ -3981,9 +3965,10 @@ static int v4l2_g_ext_ctrls_common(struct v4l2_ctrl_handler *hdl, struct v4l2_ctrl_helper *helpers = helper; int ret; int i, j; - bool def_value; + bool is_default, is_request; - def_value = (cs->which == V4L2_CTRL_WHICH_DEF_VAL); + is_default = (cs->which == V4L2_CTRL_WHICH_DEF_VAL); + is_request = (cs->which == V4L2_CTRL_WHICH_REQUEST_VAL); cs->error_idx = cs->count; cs->which = V4L2_CTRL_ID2WHICH(cs->which); @@ -4009,11 +3994,9 @@ static int v4l2_g_ext_ctrls_common(struct v4l2_ctrl_handler *hdl, ret = -EACCES; for (i = 0; !ret && i < cs->count; i++) { - int (*ctrl_to_user)(struct v4l2_ext_control *c, - struct v4l2_ctrl *ctrl); struct v4l2_ctrl *master; - - ctrl_to_user = def_value ? def_to_user : cur_to_user; + bool is_volatile = false; + u32 idx = i; if (helpers[i].mref == NULL) continue; @@ -4023,31 +4006,48 @@ static int v4l2_g_ext_ctrls_common(struct v4l2_ctrl_handler *hdl, v4l2_ctrl_lock(master); - /* g_volatile_ctrl will update the new control values */ - if (!def_value && + /* + * g_volatile_ctrl will update the new control values. + * This makes no sense for V4L2_CTRL_WHICH_DEF_VAL and + * V4L2_CTRL_WHICH_REQUEST_VAL. In the case of requests + * it is v4l2_ctrl_request_complete() that copies the + * volatile controls at the time of request completion + * to the request, so you don't want to do that again. + */ + if (!is_default && !is_request && ((master->flags & V4L2_CTRL_FLAG_VOLATILE) || (master->has_volatiles && !is_cur_manual(master)))) { for (j = 0; j < master->ncontrols; j++) cur_to_new(master->cluster[j]); ret = call_op(master, g_volatile_ctrl); - ctrl_to_user = new_to_user; + is_volatile = true; } - /* If OK, then copy the current (for non-volatile controls) - or the new (for volatile controls) control values to the - caller */ - if (!ret) { - u32 idx = i; - do { - if (helpers[idx].ref->req) - ret = req_to_user(cs->controls + idx, - helpers[idx].ref->req); - else - ret = ctrl_to_user(cs->controls + idx, - helpers[idx].ref->ctrl); - idx = helpers[idx].next; - } while (!ret && idx); + if (ret) { + v4l2_ctrl_unlock(master); + break; } + + /* + * Copy the default value (if is_default is true), the + * request value (if is_request is true and p_req is valid), + * the new volatile value (if is_volatile is true) or the + * current value. + */ + do { + struct v4l2_ctrl_ref *ref = helpers[idx].ref; + + if (is_default) + ret = def_to_user(cs->controls + idx, ref->ctrl); + else if (is_request && ref->valid_p_req) + ret = req_to_user(cs->controls + idx, ref); + else if (is_volatile) + ret = new_to_user(cs->controls + idx, ref->ctrl); + else + ret = cur_to_user(cs->controls + idx, ref->ctrl); + idx = helpers[idx].next; + } while (!ret && idx); + v4l2_ctrl_unlock(master); } @@ -4690,8 +4690,6 @@ void v4l2_ctrl_request_complete(struct media_request *req, unsigned int i; if (ctrl->flags & V4L2_CTRL_FLAG_VOLATILE) { - ref->req = ref; - v4l2_ctrl_lock(master); /* g_volatile_ctrl will update the current control values */ for (i = 0; i < master->ncontrols; i++) @@ -4701,21 +4699,12 @@ void v4l2_ctrl_request_complete(struct media_request *req, v4l2_ctrl_unlock(master); continue; } - if (ref->req == ref) + if (ref->valid_p_req) continue; + /* Copy the current control value into the request */ v4l2_ctrl_lock(ctrl); - if (ref->req) { - ptr_to_ptr(ctrl, ref->req->p_req, ref->p_req); - } else { - ptr_to_ptr(ctrl, ctrl->p_cur, ref->p_req); - /* - * Set ref->req to ensure that when userspace wants to - * obtain the controls of this request it will take - * this value and not the current value of the control. - */ - ref->req = ref; - } + cur_to_req(ref); v4l2_ctrl_unlock(ctrl); } @@ -4779,7 +4768,7 @@ int v4l2_ctrl_request_setup(struct media_request *req, struct v4l2_ctrl_ref *r = find_ref(hdl, master->cluster[i]->id); - if (r->req && r == r->req) { + if (r->valid_p_req) { have_new_data = true; break; } diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index c1d20bd8f25f..a5953b812878 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -304,12 +304,14 @@ struct v4l2_ctrl { * the control has been applied. This prevents applying controls * from a cluster with multiple controls twice (when the first * control of a cluster is applied, they all are). - * @req: If set, this refers to another request that sets this control. + * @valid_p_req: If set, then p_req contains the control value for the request. * @p_req: If the control handler containing this control reference * is bound to a media request, then this points to the - * value of the control that should be applied when the request + * value of the control that must be applied when the request * is executed, or to the value of the control at the time - * that the request was completed. + * that the request was completed. If @valid_p_req is false, + * then this control was never set for this request and the + * control will not be updated when this request is applied. * * Each control handler has a list of these refs. The list_head is used to * keep a sorted-by-control-ID list of all controls, while the next pointer @@ -322,7 +324,7 @@ struct v4l2_ctrl_ref { struct v4l2_ctrl_helper *helper; bool from_other_dev; bool req_done; - struct v4l2_ctrl_ref *req; + bool valid_p_req; union v4l2_ctrl_ptr p_req; }; @@ -349,7 +351,7 @@ struct v4l2_ctrl_ref { * @error: The error code of the first failed control addition. * @request_is_queued: True if the request was queued. * @requests: List to keep track of open control handler request objects. - * For the parent control handler (@req_obj.req == NULL) this + * For the parent control handler (@req_obj.ops == NULL) this * is the list header. When the parent control handler is * removed, it has to unbind and put all these requests since * they refer to the parent. -- cgit v1.2.3-59-g8ed1b