The FWHT stateless 'uAPI' was staging and marked explicitly in the V4L2 specification that it will change and is unstable. Note that these control IDs were never exported as a public API, they were only defined in kernel-local headers (fwht-ctrls.h). Now, the FWHT stateless controls is ready to be part of the stable uAPI. While not too late: - Rename V4L2_CID_MPEG_VIDEO_FWHT_PARAMS to V4L2_CID_STATELESS_FWHT_PARAMS. - Move the contents of fwht-ctrls.h to v4l2-controls.h. - Move the public parts of drivers/media/test-drivers/vicodec/codec-fwht.h to v4l2-controls.h. - Add V4L2_CTRL_TYPE_FWHT_PARAMS control initialization and validation. - Add p_fwht_params to struct v4l2_ext_control.
Showing the changes to include/uapi (2 of 8 files). Show all
Unified · Split
| @@ -1565,6 +1565,76 @@ struct v4l2_ctrl_h264_decode_params { · 1564 unmodified lines | ||
| 1565 | 1565 | }; |
| 1566 | 1566 | |
| 1567 | 1567 | |
| 1568 | +/* Stateless FWHT control, used by the vicodec driver */ | |
| 1569 | + | |
| 1570 | +/* Current FWHT version */ | |
| 1571 | +#define V4L2_FWHT_VERSION 3 | |
| 1572 | + | |
| 1573 | +/* Set if this is an interlaced format */ | |
| 1574 | +#define V4L2_FWHT_FL_IS_INTERLACED BIT(0) | |
| 1575 | +/* Set if this is a bottom-first (NTSC) interlaced format */ | |
| 1576 | +#define V4L2_FWHT_FL_IS_BOTTOM_FIRST BIT(1) | |
| 1577 | +/* Set if each 'frame' contains just one field */ | |
| 1578 | +#define V4L2_FWHT_FL_IS_ALTERNATE BIT(2) | |
| 1579 | +/* | |
| 1580 | + * If V4L2_FWHT_FL_IS_ALTERNATE was set, then this is set if this | |
| 1581 | + * 'frame' is the bottom field, else it is the top field. | |
| 1582 | + */ | |
| 1583 | +#define V4L2_FWHT_FL_IS_BOTTOM_FIELD BIT(3) | |
| 1584 | +/* Set if the Y' plane is uncompressed */ | |
| 1585 | +#define V4L2_FWHT_FL_LUMA_IS_UNCOMPRESSED BIT(4) | |
| 1586 | +/* Set if the Cb plane is uncompressed */ | |
| 1587 | +#define V4L2_FWHT_FL_CB_IS_UNCOMPRESSED BIT(5) | |
| 1588 | +/* Set if the Cr plane is uncompressed */ | |
| 1589 | +#define V4L2_FWHT_FL_CR_IS_UNCOMPRESSED BIT(6) | |
| 1590 | +/* Set if the chroma plane is full height, if cleared it is half height */ | |
| 1591 | +#define V4L2_FWHT_FL_CHROMA_FULL_HEIGHT BIT(7) | |
| 1592 | +/* Set if the chroma plane is full width, if cleared it is half width */ | |
| 1593 | +#define V4L2_FWHT_FL_CHROMA_FULL_WIDTH BIT(8) | |
| 1594 | +/* Set if the alpha plane is uncompressed */ | |
| 1595 | +#define V4L2_FWHT_FL_ALPHA_IS_UNCOMPRESSED BIT(9) | |
| 1596 | +/* Set if this is an I Frame */ | |
| 1597 | +#define V4L2_FWHT_FL_I_FRAME BIT(10) | |
| 1598 | + | |
| 1599 | +/* A 4-values flag - the number of components - 1 */ | |
| 1600 | +#define V4L2_FWHT_FL_COMPONENTS_NUM_MSK GENMASK(18, 16) | |
| 1601 | +#define V4L2_FWHT_FL_COMPONENTS_NUM_OFFSET 16 | |
| 1602 | + | |
| 1603 | +/* A 4-values flag - the pixel encoding type */ | |
| 1604 | +#define V4L2_FWHT_FL_PIXENC_MSK GENMASK(20, 19) | |
| 1605 | +#define V4L2_FWHT_FL_PIXENC_OFFSET 19 | |
| 1606 | +#define V4L2_FWHT_FL_PIXENC_YUV (1 << V4L2_FWHT_FL_PIXENC_OFFSET) | |
| 1607 | +#define V4L2_FWHT_FL_PIXENC_RGB (2 << V4L2_FWHT_FL_PIXENC_OFFSET) | |
| 1608 | +#define V4L2_FWHT_FL_PIXENC_HSV (3 << V4L2_FWHT_FL_PIXENC_OFFSET) | |
| 1609 | + | |
| 1610 | +#define V4L2_CID_STATELESS_FWHT_PARAMS (V4L2_CID_CODEC_STATELESS_BASE + 100) | |
| 1611 | +/** | |
| 1612 | + * struct v4l2_ctrl_fwht_params - FWHT parameters | |
| 1613 | + * | |
| 1614 | + * @backward_ref_ts: timestamp of the V4L2 capture buffer to use as reference. | |
| 1615 | + * The timestamp refers to the timestamp field in struct v4l2_buffer. | |
| 1616 | + * Use v4l2_timeval_to_ns() to convert the struct timeval to a __u64. | |
| 1617 | + * @version: must be V4L2_FWHT_VERSION. | |
| 1618 | + * @width: width of frame. | |
| 1619 | + * @height: height of frame. | |
| 1620 | + * @flags: FWHT flags (see V4L2_FWHT_FL_*). | |
| 1621 | + * @colorspace: the colorspace (enum v4l2_colorspace). | |
| 1622 | + * @xfer_func: the transfer function (enum v4l2_xfer_func). | |
| 1623 | + * @ycbcr_enc: the Y'CbCr encoding (enum v4l2_ycbcr_encoding). | |
| 1624 | + * @quantization: the quantization (enum v4l2_quantization). | |
| 1625 | + */ | |
| 1626 | +struct v4l2_ctrl_fwht_params { | |
| 1627 | + __u64 backward_ref_ts; | |
| 1628 | + __u32 version; | |
| 1629 | + __u32 width; | |
| 1630 | + __u32 height; | |
| 1631 | + __u32 flags; | |
| 1632 | + __u32 colorspace; | |
| 1633 | + __u32 xfer_func; | |
| 1634 | + __u32 ycbcr_enc; | |
| 1635 | + __u32 quantization; | |
| 1636 | +}; | |
| 1637 | + | |
| 1568 | 1638 | /* MPEG-compression definitions kept for backwards compatibility */ |
| 1569 | 1639 | #ifndef __KERNEL__ |
| 1570 | 1640 | #define V4L2_CTRL_CLASS_MPEG V4L2_CTRL_CLASS_CODEC |
| @@ -1740,6 +1740,7 @@ struct v4l2_ext_control { · 1739 unmodified lines | ||
| 1740 | 1740 | struct v4l2_ctrl_h264_pred_weights __user *p_h264_pred_weights; |
| 1741 | 1741 | struct v4l2_ctrl_h264_slice_params __user *p_h264_slice_params; |
| 1742 | 1742 | struct v4l2_ctrl_h264_decode_params __user *p_h264_decode_params; |
| 1743 | + struct v4l2_ctrl_fwht_params __user *p_fwht_params; | |
| 1743 | 1744 | void __user *ptr; |
| 1744 | 1745 | }; |
| 1745 | 1746 | } __attribute__ ((packed)); |
| @@ -1793,6 +1794,8 @@ enum v4l2_ctrl_type { · 47 unmodified lines | ||
| 1793 | 1794 | V4L2_CTRL_TYPE_H264_SLICE_PARAMS = 0x0203, |
| 1794 | 1795 | V4L2_CTRL_TYPE_H264_DECODE_PARAMS = 0x0204, |
| 1795 | 1796 | V4L2_CTRL_TYPE_H264_PRED_WEIGHTS = 0x0205, |
| 1797 | + | |
| 1798 | + V4L2_CTRL_TYPE_FWHT_PARAMS = 0x0220, | |
| 1796 | 1799 | }; |
| 1797 | 1800 | |
| 1798 | 1801 | /* Used in the VIDIOC_QUERYCTRL ioctl for querying controls */ |