History

media: v4l2: extend the CSC API to subdevice.

This patch extends the CSC API in video devices to be supported also on sub-devices. The flag V4L2_MBUS_FRAMEFMT_SET_CSC set by the application when calling VIDIOC_SUBDEV_S_FMT ioctl. The flags: V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE, V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC, V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC/V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION are set by the driver in the VIDIOC_SUBDEV_ENUM_MBUS_CODE ioctl. New 'flags' fields were added to the structs v4l2_subdev_mbus_code_enum, v4l2_mbus_framefmt which are borrowed from the 'reserved' field The patch also replaces the 'ycbcr_enc' field in 'struct v4l2_mbus_framefmt' with a union that includes 'hsv_enc'

Dafna Hirschfeld committed 6 years ago

Commit 62aacfa1 parent 2f491464 files · +157 −14Browse files

Showing the changes to include/uapi (2 of 4 files). Show all

Unified · Split

2 files
  1. include/uapi/linux/v4l2-mediabus.h +13 −2
  2. include/uapi/linux/v4l2-subdev.h +9 −1
include/uapi/linux/v4l2-mediabus.h+13−2
@@ -16,6 +16,8 @@ · 15 unmodified lines
1616 #include <linux/types.h>
1717 #include <linux/videodev2.h>
1818
19+#define V4L2_MBUS_FRAMEFMT_SET_CSC 0x0001
20+
1921 /**
2022 * struct v4l2_mbus_framefmt - frame format on the media bus
2123 * @width: image width
@@ -24,8 +26,11 @@ · 2 unmodified lines
2426 * @field: used interlacing type (from enum v4l2_field)
2527 * @colorspace: colorspace of the data (from enum v4l2_colorspace)
2628 * @ycbcr_enc: YCbCr encoding of the data (from enum v4l2_ycbcr_encoding)
29+ * @hsv_enc: HSV encoding of the data (from enum v4l2_hsv_encoding)
2730 * @quantization: quantization of the data (from enum v4l2_quantization)
2831 * @xfer_func: transfer function of the data (from enum v4l2_xfer_func)
32+ * @flags: flags (V4L2_MBUS_FRAMEFMT_*)
33+ * @reserved: reserved bytes that can be later used
2934 */
3035 struct v4l2_mbus_framefmt {
3136 __u32 width;
@@ -33,10 +38,16 @@ struct v4l2_mbus_framefmt { · 1 unmodified line
3338 __u32 code;
3439 __u32 field;
3540 __u32 colorspace;
36− __u16 ycbcr_enc;
41+ union {
42+ /* enum v4l2_ycbcr_encoding */
43+ __u16 ycbcr_enc;
44+ /* enum v4l2_hsv_encoding */
45+ __u16 hsv_enc;
46+ };
3747 __u16 quantization;
3848 __u16 xfer_func;
39− __u16 reserved[11];
49+ __u16 flags;
50+ __u16 reserved[10];
4051 };
4152
4253 #ifndef __KERNEL__
include/uapi/linux/v4l2-subdev.h+9−1
@@ -65,19 +65,27 @@ struct v4l2_subdev_crop { · 64 unmodified lines
6565 __u32 reserved[8];
6666 };
6767
68+#define V4L2_SUBDEV_MBUS_CODE_CSC_COLORSPACE 0x00000001
69+#define V4L2_SUBDEV_MBUS_CODE_CSC_XFER_FUNC 0x00000002
70+#define V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC 0x00000004
71+#define V4L2_SUBDEV_MBUS_CODE_CSC_HSV_ENC V4L2_SUBDEV_MBUS_CODE_CSC_YCBCR_ENC
72+#define V4L2_SUBDEV_MBUS_CODE_CSC_QUANTIZATION 0x00000008
73+
6874 /**
6975 * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
7076 * @pad: pad number, as reported by the media API
7177 * @index: format index during enumeration
7278 * @code: format code (MEDIA_BUS_FMT_ definitions)
7379 * @which: format type (from enum v4l2_subdev_format_whence)
80+ * @flags: flags set by the driver, (V4L2_SUBDEV_MBUS_CODE_*)
7481 */
7582 struct v4l2_subdev_mbus_code_enum {
7683 __u32 pad;
7784 __u32 index;
7885 __u32 code;
7986 __u32 which;
80− __u32 reserved[8];
87+ __u32 flags;
88+ __u32 reserved[7];
8189 };
8290
8391 /**