aboutsummaryrefslogtreecommitdiffstats
path: root/include/uapi/linux
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-10-31 13:53:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-10-31 13:53:29 -0400
commitb3491d8430dd25f0a4e00c33d60da22a9bd9d052 (patch)
treea3506967c871971bf9e5920dca5316c5346763df /include/uapi/linux
parent59fc453b21f767f2fb0ff4dc0a947e9b9c9e6d14 (diff)
parente4183d3256e3cd668e899d06af66da5aac3a51af (diff)
Merge tag 'media/v4.20-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull new experimental media request API from Mauro Carvalho Chehab: "A new media request API This API is needed to support device drivers that can dynamically change their parameters for each new frame. The latest versions of Google camera and codec HAL depends on such feature. At this stage, it supports only stateless codecs. It has been discussed for a long time (at least over the last 3-4 years), and we finally reached to something that seem to work. This series contain both the API and core changes required to support it and a new m2m decoder driver (cedrus). As the current API is still experimental, the only real driver using it (cedrus) was added at staging[1]. We intend to keep it there for a while, in order to test the API. Only when we're sure that this API works for other cases (like encoders), we'll move this driver out of staging and set the API into a stone. [1] We added support for the vivid virtual driver (used only for testing) to it too, as it makes easier to test the API for the ones that don't have the cedrus hardware" * tag 'media/v4.20-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (53 commits) media: dt-bindings: Document the Rockchip VPU bindings media: platform: Add Cedrus VPU decoder driver media: dt-bindings: media: Document bindings for the Cedrus VPU driver media: v4l: Add definition for the Sunxi tiled NV12 format media: v4l: Add definitions for MPEG-2 slice format and metadata media: videobuf2-core: Rework and rename helper for request buffer count media: v4l2-ctrls.c: initialize an error return code with zero media: v4l2-compat-ioctl32.c: add missing documentation for a field media: media-request: update documentation media: media-request: EPERM -> EACCES/EBUSY media: v4l2-ctrls: improve media_request_(un)lock_for_update media: v4l2-ctrls: use media_request_(un)lock_for_access media: media-request: add media_request_(un)lock_for_access media: vb2: set reqbufs/create_bufs capabilities media: videodev2.h: add new capabilities for buffer types media: buffer.rst: only set V4L2_BUF_FLAG_REQUEST_FD for QBUF media: v4l2-ctrls: return -EACCES if request wasn't completed media: media-request: return -EINVAL for invalid request_fds media: vivid: add request support media: vivid: add mc ...
Diffstat (limited to 'include/uapi/linux')
-rw-r--r--include/uapi/linux/media.h8
-rw-r--r--include/uapi/linux/v4l2-controls.h65
-rw-r--r--include/uapi/linux/videodev2.h33
3 files changed, 102 insertions, 4 deletions
diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
index 36f76e777ef9..e5d0c5c611b5 100644
--- a/include/uapi/linux/media.h
+++ b/include/uapi/linux/media.h
@@ -369,6 +369,14 @@ struct media_v2_topology {
369#define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum) 369#define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum)
370#define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc) 370#define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc)
371#define MEDIA_IOC_G_TOPOLOGY _IOWR('|', 0x04, struct media_v2_topology) 371#define MEDIA_IOC_G_TOPOLOGY _IOWR('|', 0x04, struct media_v2_topology)
372#define MEDIA_IOC_REQUEST_ALLOC _IOR ('|', 0x05, int)
373
374/*
375 * These ioctls are called on the request file descriptor as returned
376 * by MEDIA_IOC_REQUEST_ALLOC.
377 */
378#define MEDIA_REQUEST_IOC_QUEUE _IO('|', 0x80)
379#define MEDIA_REQUEST_IOC_REINIT _IO('|', 0x81)
372 380
373#ifndef __KERNEL__ 381#ifndef __KERNEL__
374 382
diff --git a/include/uapi/linux/v4l2-controls.h b/include/uapi/linux/v4l2-controls.h
index e4ee10ee917d..51b095898f4b 100644
--- a/include/uapi/linux/v4l2-controls.h
+++ b/include/uapi/linux/v4l2-controls.h
@@ -402,6 +402,9 @@ enum v4l2_mpeg_video_multi_slice_mode {
402#define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_MPEG_BASE+228) 402#define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_MPEG_BASE+228)
403#define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_MPEG_BASE+229) 403#define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_MPEG_BASE+229)
404 404
405#define V4L2_CID_MPEG_VIDEO_MPEG2_SLICE_PARAMS (V4L2_CID_MPEG_BASE+250)
406#define V4L2_CID_MPEG_VIDEO_MPEG2_QUANTIZATION (V4L2_CID_MPEG_BASE+251)
407
405#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300) 408#define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
406#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301) 409#define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
407#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302) 410#define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302)
@@ -1092,4 +1095,66 @@ enum v4l2_detect_md_mode {
1092#define V4L2_CID_DETECT_MD_THRESHOLD_GRID (V4L2_CID_DETECT_CLASS_BASE + 3) 1095#define V4L2_CID_DETECT_MD_THRESHOLD_GRID (V4L2_CID_DETECT_CLASS_BASE + 3)
1093#define V4L2_CID_DETECT_MD_REGION_GRID (V4L2_CID_DETECT_CLASS_BASE + 4) 1096#define V4L2_CID_DETECT_MD_REGION_GRID (V4L2_CID_DETECT_CLASS_BASE + 4)
1094 1097
1098#define V4L2_MPEG2_PICTURE_CODING_TYPE_I 1
1099#define V4L2_MPEG2_PICTURE_CODING_TYPE_P 2
1100#define V4L2_MPEG2_PICTURE_CODING_TYPE_B 3
1101#define V4L2_MPEG2_PICTURE_CODING_TYPE_D 4
1102
1103struct v4l2_mpeg2_sequence {
1104 /* ISO/IEC 13818-2, ITU-T Rec. H.262: Sequence header */
1105 __u16 horizontal_size;
1106 __u16 vertical_size;
1107 __u32 vbv_buffer_size;
1108
1109 /* ISO/IEC 13818-2, ITU-T Rec. H.262: Sequence extension */
1110 __u8 profile_and_level_indication;
1111 __u8 progressive_sequence;
1112 __u8 chroma_format;
1113};
1114
1115struct v4l2_mpeg2_picture {
1116 /* ISO/IEC 13818-2, ITU-T Rec. H.262: Picture header */
1117 __u8 picture_coding_type;
1118
1119 /* ISO/IEC 13818-2, ITU-T Rec. H.262: Picture coding extension */
1120 __u8 f_code[2][2];
1121 __u8 intra_dc_precision;
1122 __u8 picture_structure;
1123 __u8 top_field_first;
1124 __u8 frame_pred_frame_dct;
1125 __u8 concealment_motion_vectors;
1126 __u8 q_scale_type;
1127 __u8 intra_vlc_format;
1128 __u8 alternate_scan;
1129 __u8 repeat_first_field;
1130 __u8 progressive_frame;
1131};
1132
1133struct v4l2_ctrl_mpeg2_slice_params {
1134 __u32 bit_size;
1135 __u32 data_bit_offset;
1136
1137 struct v4l2_mpeg2_sequence sequence;
1138 struct v4l2_mpeg2_picture picture;
1139
1140 /* ISO/IEC 13818-2, ITU-T Rec. H.262: Slice */
1141 __u8 quantiser_scale_code;
1142
1143 __u8 backward_ref_index;
1144 __u8 forward_ref_index;
1145};
1146
1147struct v4l2_ctrl_mpeg2_quantization {
1148 /* ISO/IEC 13818-2, ITU-T Rec. H.262: Quant matrix extension */
1149 __u8 load_intra_quantiser_matrix;
1150 __u8 load_non_intra_quantiser_matrix;
1151 __u8 load_chroma_intra_quantiser_matrix;
1152 __u8 load_chroma_non_intra_quantiser_matrix;
1153
1154 __u8 intra_quantiser_matrix[64];
1155 __u8 non_intra_quantiser_matrix[64];
1156 __u8 chroma_intra_quantiser_matrix[64];
1157 __u8 chroma_non_intra_quantiser_matrix[64];
1158};
1159
1095#endif 1160#endif
diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
index 29729d580452..c8e8ff810190 100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -646,6 +646,7 @@ struct v4l2_pix_format {
646#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */ 646#define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */
647#define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */ 647#define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */
648#define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES */ 648#define V4L2_PIX_FMT_MPEG2 v4l2_fourcc('M', 'P', 'G', '2') /* MPEG-2 ES */
649#define V4L2_PIX_FMT_MPEG2_SLICE v4l2_fourcc('M', 'G', '2', 'S') /* MPEG-2 parsed slice data */
649#define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 part 2 ES */ 650#define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 part 2 ES */
650#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */ 651#define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */
651#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */ 652#define V4L2_PIX_FMT_VC1_ANNEX_G v4l2_fourcc('V', 'C', '1', 'G') /* SMPTE 421M Annex G compliant stream */
@@ -687,6 +688,7 @@ struct v4l2_pix_format {
687#define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ') /* Depth data 16-bit */ 688#define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ') /* Depth data 16-bit */
688#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */ 689#define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */
689#define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I') /* Intel Planar Greyscale 10-bit and Depth 16-bit */ 690#define V4L2_PIX_FMT_INZI v4l2_fourcc('I', 'N', 'Z', 'I') /* Intel Planar Greyscale 10-bit and Depth 16-bit */
691#define V4L2_PIX_FMT_SUNXI_TILED_NV12 v4l2_fourcc('S', 'T', '1', '2') /* Sunxi Tiled NV12 Format */
690 692
691/* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */ 693/* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */
692#define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */ 694#define V4L2_PIX_FMT_IPU3_SBGGR10 v4l2_fourcc('i', 'p', '3', 'b') /* IPU3 packed 10-bit BGGR bayer */
@@ -868,9 +870,16 @@ struct v4l2_requestbuffers {
868 __u32 count; 870 __u32 count;
869 __u32 type; /* enum v4l2_buf_type */ 871 __u32 type; /* enum v4l2_buf_type */
870 __u32 memory; /* enum v4l2_memory */ 872 __u32 memory; /* enum v4l2_memory */
871 __u32 reserved[2]; 873 __u32 capabilities;
874 __u32 reserved[1];
872}; 875};
873 876
877/* capabilities for struct v4l2_requestbuffers and v4l2_create_buffers */
878#define V4L2_BUF_CAP_SUPPORTS_MMAP (1 << 0)
879#define V4L2_BUF_CAP_SUPPORTS_USERPTR (1 << 1)
880#define V4L2_BUF_CAP_SUPPORTS_DMABUF (1 << 2)
881#define V4L2_BUF_CAP_SUPPORTS_REQUESTS (1 << 3)
882
874/** 883/**
875 * struct v4l2_plane - plane info for multi-planar buffers 884 * struct v4l2_plane - plane info for multi-planar buffers
876 * @bytesused: number of bytes occupied by data in the plane (payload) 885 * @bytesused: number of bytes occupied by data in the plane (payload)
@@ -929,6 +938,7 @@ struct v4l2_plane {
929 * @length: size in bytes of the buffer (NOT its payload) for single-plane 938 * @length: size in bytes of the buffer (NOT its payload) for single-plane
930 * buffers (when type != *_MPLANE); number of elements in the 939 * buffers (when type != *_MPLANE); number of elements in the
931 * planes array for multi-plane buffers 940 * planes array for multi-plane buffers
941 * @request_fd: fd of the request that this buffer should use
932 * 942 *
933 * Contains data exchanged by application and driver using one of the Streaming 943 * Contains data exchanged by application and driver using one of the Streaming
934 * I/O methods. 944 * I/O methods.
@@ -953,7 +963,10 @@ struct v4l2_buffer {
953 } m; 963 } m;
954 __u32 length; 964 __u32 length;
955 __u32 reserved2; 965 __u32 reserved2;
956 __u32 reserved; 966 union {
967 __s32 request_fd;
968 __u32 reserved;
969 };
957}; 970};
958 971
959/* Flags for 'flags' field */ 972/* Flags for 'flags' field */
@@ -971,6 +984,8 @@ struct v4l2_buffer {
971#define V4L2_BUF_FLAG_BFRAME 0x00000020 984#define V4L2_BUF_FLAG_BFRAME 0x00000020
972/* Buffer is ready, but the data contained within is corrupted. */ 985/* Buffer is ready, but the data contained within is corrupted. */
973#define V4L2_BUF_FLAG_ERROR 0x00000040 986#define V4L2_BUF_FLAG_ERROR 0x00000040
987/* Buffer is added to an unqueued request */
988#define V4L2_BUF_FLAG_IN_REQUEST 0x00000080
974/* timecode field is valid */ 989/* timecode field is valid */
975#define V4L2_BUF_FLAG_TIMECODE 0x00000100 990#define V4L2_BUF_FLAG_TIMECODE 0x00000100
976/* Buffer is prepared for queuing */ 991/* Buffer is prepared for queuing */
@@ -989,6 +1004,8 @@ struct v4l2_buffer {
989#define V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000 1004#define V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000
990/* mem2mem encoder/decoder */ 1005/* mem2mem encoder/decoder */
991#define V4L2_BUF_FLAG_LAST 0x00100000 1006#define V4L2_BUF_FLAG_LAST 0x00100000
1007/* request_fd is valid */
1008#define V4L2_BUF_FLAG_REQUEST_FD 0x00800000
992 1009
993/** 1010/**
994 * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor 1011 * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor
@@ -1605,6 +1622,8 @@ struct v4l2_ext_control {
1605 __u8 __user *p_u8; 1622 __u8 __user *p_u8;
1606 __u16 __user *p_u16; 1623 __u16 __user *p_u16;
1607 __u32 __user *p_u32; 1624 __u32 __user *p_u32;
1625 struct v4l2_ctrl_mpeg2_slice_params __user *p_mpeg2_slice_params;
1626 struct v4l2_ctrl_mpeg2_quantization __user *p_mpeg2_quantization;
1608 void __user *ptr; 1627 void __user *ptr;
1609 }; 1628 };
1610} __attribute__ ((packed)); 1629} __attribute__ ((packed));
@@ -1618,7 +1637,8 @@ struct v4l2_ext_controls {
1618 }; 1637 };
1619 __u32 count; 1638 __u32 count;
1620 __u32 error_idx; 1639 __u32 error_idx;
1621 __u32 reserved[2]; 1640 __s32 request_fd;
1641 __u32 reserved[1];
1622 struct v4l2_ext_control *controls; 1642 struct v4l2_ext_control *controls;
1623}; 1643};
1624 1644
@@ -1631,6 +1651,7 @@ struct v4l2_ext_controls {
1631#define V4L2_CTRL_MAX_DIMS (4) 1651#define V4L2_CTRL_MAX_DIMS (4)
1632#define V4L2_CTRL_WHICH_CUR_VAL 0 1652#define V4L2_CTRL_WHICH_CUR_VAL 0
1633#define V4L2_CTRL_WHICH_DEF_VAL 0x0f000000 1653#define V4L2_CTRL_WHICH_DEF_VAL 0x0f000000
1654#define V4L2_CTRL_WHICH_REQUEST_VAL 0x0f010000
1634 1655
1635enum v4l2_ctrl_type { 1656enum v4l2_ctrl_type {
1636 V4L2_CTRL_TYPE_INTEGER = 1, 1657 V4L2_CTRL_TYPE_INTEGER = 1,
@@ -1648,6 +1669,8 @@ enum v4l2_ctrl_type {
1648 V4L2_CTRL_TYPE_U8 = 0x0100, 1669 V4L2_CTRL_TYPE_U8 = 0x0100,
1649 V4L2_CTRL_TYPE_U16 = 0x0101, 1670 V4L2_CTRL_TYPE_U16 = 0x0101,
1650 V4L2_CTRL_TYPE_U32 = 0x0102, 1671 V4L2_CTRL_TYPE_U32 = 0x0102,
1672 V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS = 0x0103,
1673 V4L2_CTRL_TYPE_MPEG2_QUANTIZATION = 0x0104,
1651}; 1674};
1652 1675
1653/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ 1676/* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
@@ -2321,6 +2344,7 @@ struct v4l2_dbg_chip_info {
2321 * return: number of created buffers 2344 * return: number of created buffers
2322 * @memory: enum v4l2_memory; buffer memory type 2345 * @memory: enum v4l2_memory; buffer memory type
2323 * @format: frame format, for which buffers are requested 2346 * @format: frame format, for which buffers are requested
2347 * @capabilities: capabilities of this buffer type.
2324 * @reserved: future extensions 2348 * @reserved: future extensions
2325 */ 2349 */
2326struct v4l2_create_buffers { 2350struct v4l2_create_buffers {
@@ -2328,7 +2352,8 @@ struct v4l2_create_buffers {
2328 __u32 count; 2352 __u32 count;
2329 __u32 memory; 2353 __u32 memory;
2330 struct v4l2_format format; 2354 struct v4l2_format format;
2331 __u32 reserved[8]; 2355 __u32 capabilities;
2356 __u32 reserved[7];
2332}; 2357};
2333 2358
2334/* 2359/*