History

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 ...

Linus Torvalds committed 8 years ago

Commit b3491d82 parents 59fc453 e4183d3102 files · +6166 −385Browse files

Showing the changes to include/uapi/linux (3 of 102 files). Show all

Unified · Split

3 files
  1. include/uapi/linux/media.h +8 −0
  2. include/uapi/linux/v4l2-controls.h +65 −0
  3. include/uapi/linux/videodev2.h +29 −4
include/uapi/linux/media.h+8−0
@@ -369,6 +369,14 @@ struct media_v2_topology { · 368 unmodified lines
369369 #define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum)
370370 #define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc)
371371 #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)
372380
373381 #ifndef __KERNEL__
374382
include/uapi/linux/v4l2-controls.h+65−0
@@ -402,6 +402,9 @@ enum v4l2_mpeg_video_multi_slice_mode { · 401 unmodified lines
402402 #define V4L2_CID_MPEG_VIDEO_MV_V_SEARCH_RANGE (V4L2_CID_MPEG_BASE+228)
403403 #define V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME (V4L2_CID_MPEG_BASE+229)
404404
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+
405408 #define V4L2_CID_MPEG_VIDEO_H263_I_FRAME_QP (V4L2_CID_MPEG_BASE+300)
406409 #define V4L2_CID_MPEG_VIDEO_H263_P_FRAME_QP (V4L2_CID_MPEG_BASE+301)
407410 #define V4L2_CID_MPEG_VIDEO_H263_B_FRAME_QP (V4L2_CID_MPEG_BASE+302)
@@ -1092,4 +1095,66 @@ enum v4l2_detect_md_mode { · 684 unmodified lines
10921095 #define V4L2_CID_DETECT_MD_THRESHOLD_GRID (V4L2_CID_DETECT_CLASS_BASE + 3)
10931096 #define V4L2_CID_DETECT_MD_REGION_GRID (V4L2_CID_DETECT_CLASS_BASE + 4)
10941097
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+
1103+struct 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+
1115+struct 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+
1133+struct 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+
1147+struct 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+
10951160 #endif
include/uapi/linux/videodev2.h+29−4
@@ -646,6 +646,7 @@ struct v4l2_pix_format { · 645 unmodified lines
646646 #define V4L2_PIX_FMT_H263 v4l2_fourcc('H', '2', '6', '3') /* H263 */
647647 #define V4L2_PIX_FMT_MPEG1 v4l2_fourcc('M', 'P', 'G', '1') /* MPEG-1 ES */
648648 #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 */
649650 #define V4L2_PIX_FMT_MPEG4 v4l2_fourcc('M', 'P', 'G', '4') /* MPEG-4 part 2 ES */
650651 #define V4L2_PIX_FMT_XVID v4l2_fourcc('X', 'V', 'I', 'D') /* Xvid */
651652 #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 { · 35 unmodified lines
687688 #define V4L2_PIX_FMT_Z16 v4l2_fourcc('Z', '1', '6', ' ') /* Depth data 16-bit */
688689 #define V4L2_PIX_FMT_MT21C v4l2_fourcc('M', 'T', '2', '1') /* Mediatek compressed block mode */
689690 #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 */
690692
691693 /* 10bit raw bayer packed, 32 bytes for every 25 pixels, last LSB 6 bits unused */
692694 #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 { · 175 unmodified lines
868870 __u32 count;
869871 __u32 type; /* enum v4l2_buf_type */
870872 __u32 memory; /* enum v4l2_memory */
871− __u32 reserved[2];
873+ __u32 capabilities;
874+ __u32 reserved[1];
872875 };
873876
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+
874883 /**
875884 * struct v4l2_plane - plane info for multi-planar buffers
876885 * @bytesused: number of bytes occupied by data in the plane (payload)
@@ -929,6 +938,7 @@ struct v4l2_plane { · 52 unmodified lines
929938 * @length: size in bytes of the buffer (NOT its payload) for single-plane
930939 * buffers (when type != *_MPLANE); number of elements in the
931940 * planes array for multi-plane buffers
941+ * @request_fd: fd of the request that this buffer should use
932942 *
933943 * Contains data exchanged by application and driver using one of the Streaming
934944 * I/O methods.
@@ -953,7 +963,10 @@ struct v4l2_buffer { · 18 unmodified lines
953963 } m;
954964 __u32 length;
955965 __u32 reserved2;
956− __u32 reserved;
966+ union {
967+ __s32 request_fd;
968+ __u32 reserved;
969+ };
957970 };
958971
959972 /* Flags for 'flags' field */
@@ -971,6 +984,8 @@ struct v4l2_buffer { · 11 unmodified lines
971984 #define V4L2_BUF_FLAG_BFRAME 0x00000020
972985 /* Buffer is ready, but the data contained within is corrupted. */
973986 #define V4L2_BUF_FLAG_ERROR 0x00000040
987+/* Buffer is added to an unqueued request */
988+#define V4L2_BUF_FLAG_IN_REQUEST 0x00000080
974989 /* timecode field is valid */
975990 #define V4L2_BUF_FLAG_TIMECODE 0x00000100
976991 /* Buffer is prepared for queuing */
@@ -989,6 +1004,8 @@ struct v4l2_buffer { · 12 unmodified lines
9891004 #define V4L2_BUF_FLAG_TSTAMP_SRC_SOE 0x00010000
9901005 /* mem2mem encoder/decoder */
9911006 #define V4L2_BUF_FLAG_LAST 0x00100000
1007+/* request_fd is valid */
1008+#define V4L2_BUF_FLAG_REQUEST_FD 0x00800000
9921009
9931010 /**
9941011 * struct v4l2_exportbuffer - export of video buffer as DMABUF file descriptor
@@ -1605,6 +1622,8 @@ struct v4l2_ext_control { · 610 unmodified lines
16051622 __u8 __user *p_u8;
16061623 __u16 __user *p_u16;
16071624 __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;
16081627 void __user *ptr;
16091628 };
16101629 } __attribute__ ((packed));
@@ -1618,7 +1637,8 @@ struct v4l2_ext_controls { · 7 unmodified lines
16181637 };
16191638 __u32 count;
16201639 __u32 error_idx;
1621− __u32 reserved[2];
1640+ __s32 request_fd;
1641+ __u32 reserved[1];
16221642 struct v4l2_ext_control *controls;
16231643 };
16241644
@@ -1631,6 +1651,7 @@ struct v4l2_ext_controls { · 6 unmodified lines
16311651 #define V4L2_CTRL_MAX_DIMS (4)
16321652 #define V4L2_CTRL_WHICH_CUR_VAL 0
16331653 #define V4L2_CTRL_WHICH_DEF_VAL 0x0f000000
1654+#define V4L2_CTRL_WHICH_REQUEST_VAL 0x0f010000
16341655
16351656 enum v4l2_ctrl_type {
16361657 V4L2_CTRL_TYPE_INTEGER = 1,
@@ -1648,6 +1669,8 @@ enum v4l2_ctrl_type { · 11 unmodified lines
16481669 V4L2_CTRL_TYPE_U8 = 0x0100,
16491670 V4L2_CTRL_TYPE_U16 = 0x0101,
16501671 V4L2_CTRL_TYPE_U32 = 0x0102,
1672+ V4L2_CTRL_TYPE_MPEG2_SLICE_PARAMS = 0x0103,
1673+ V4L2_CTRL_TYPE_MPEG2_QUANTIZATION = 0x0104,
16511674 };
16521675
16531676 /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */
@@ -2321,6 +2344,7 @@ struct v4l2_dbg_chip_info { · 667 unmodified lines
23212344 * return: number of created buffers
23222345 * @memory: enum v4l2_memory; buffer memory type
23232346 * @format: frame format, for which buffers are requested
2347+ * @capabilities: capabilities of this buffer type.
23242348 * @reserved: future extensions
23252349 */
23262350 struct v4l2_create_buffers {
@@ -2328,7 +2352,8 @@ struct v4l2_create_buffers { · 1 unmodified line
23282352 __u32 count;
23292353 __u32 memory;
23302354 struct v4l2_format format;
2331− __u32 reserved[8];
2355+ __u32 capabilities;
2356+ __u32 reserved[7];
23322357 };
23332358
23342359 /*