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
16#include <linux/types.h>16#include <linux/types.h>
17#include <linux/videodev2.h>17#include <linux/videodev2.h>
18 18
19#define V4L2_MBUS_FRAMEFMT_SET_CSC 0x0001
20
19/**21/**
20 * struct v4l2_mbus_framefmt - frame format on the media bus22 * struct v4l2_mbus_framefmt - frame format on the media bus
21 * @width: image width23 * @width: image width
@@ -24,8 +26,11 @@ · 2 unmodified lines
24 * @field: used interlacing type (from enum v4l2_field)26 * @field: used interlacing type (from enum v4l2_field)
25 * @colorspace: colorspace of the data (from enum v4l2_colorspace)27 * @colorspace: colorspace of the data (from enum v4l2_colorspace)
26 * @ycbcr_enc: YCbCr encoding of the data (from enum v4l2_ycbcr_encoding)28 * @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)
27 * @quantization: quantization of the data (from enum v4l2_quantization)30 * @quantization: quantization of the data (from enum v4l2_quantization)
28 * @xfer_func: transfer function of the data (from enum v4l2_xfer_func)31 * @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
29 */34 */
30struct v4l2_mbus_framefmt {35struct v4l2_mbus_framefmt {
31 __u32 width;36 __u32 width;
@@ -33,10 +38,16 @@ struct v4l2_mbus_framefmt { · 1 unmodified line
33 __u32 code;38 __u32 code;
34 __u32 field;39 __u32 field;
35 __u32 colorspace;40 __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 };
37 __u16 quantization;47 __u16 quantization;
38 __u16 xfer_func;48 __u16 xfer_func;
39 __u16 reserved[11];49 __u16 flags;
50 __u16 reserved[10];
40};51};
41 52
42#ifndef __KERNEL__53#ifndef __KERNEL__
include/uapi/linux/v4l2-subdev.h+9−1
@@ -65,19 +65,27 @@ struct v4l2_subdev_crop { · 64 unmodified lines
65 __u32 reserved[8];65 __u32 reserved[8];
66};66};
67 67
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
68/**74/**
69 * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration75 * struct v4l2_subdev_mbus_code_enum - Media bus format enumeration
70 * @pad: pad number, as reported by the media API76 * @pad: pad number, as reported by the media API
71 * @index: format index during enumeration77 * @index: format index during enumeration
72 * @code: format code (MEDIA_BUS_FMT_ definitions)78 * @code: format code (MEDIA_BUS_FMT_ definitions)
73 * @which: format type (from enum v4l2_subdev_format_whence)79 * @which: format type (from enum v4l2_subdev_format_whence)
80 * @flags: flags set by the driver, (V4L2_SUBDEV_MBUS_CODE_*)
74 */81 */
75struct v4l2_subdev_mbus_code_enum {82struct v4l2_subdev_mbus_code_enum {
76 __u32 pad;83 __u32 pad;
77 __u32 index;84 __u32 index;
78 __u32 code;85 __u32 code;
79 __u32 which;86 __u32 which;
80 __u32 reserved[8];87 __u32 flags;
88 __u32 reserved[7];
81};89};
82 90
83/**91/**