2022-08-25 02:09:03

by Ming Qian

[permalink] [raw]
Subject: [PATCH v5 0/4] media: amphion: add support for contiguous format

amphion vpu support non contiguous planes yuv format,
but when we make pipeline with other device,
the device may only support contiguous format,
for example, amphion encoder support NV12M,
but the capture device may only support NV12.
we can't connect them directly.

So to improve compatibility, driver can add support for contiguous
format in the same time.

Then encoder can support NV12 and NV12M,
decoder can support NV12_8L128 and NV12M_8L128.

v5
- make some change according to Tommaso's comments
v4
- set bytesperline of compressed formats to 0
v3
- negotiate bytesperline with user
- zero the reserved of v4l2_format
v2
-- fix an uninitialized array index read error
-- remove an used variable

Ming Qian (4):
media: add nv12_8l128 and nv12_10be_8l128 video format.
media: amphion: tell and handle contiguous and non contiguous format
media: amphion: decoder add support for contiguous planes
media: amphion: encoder add support for contiguous planes

.../media/v4l/pixfmt-yuv-planar.rst | 8 +
drivers/media/platform/amphion/vdec.c | 203 ++++++++++--------
drivers/media/platform/amphion/venc.c | 41 ++--
drivers/media/platform/amphion/vpu.h | 4 +-
drivers/media/platform/amphion/vpu_dbg.c | 8 +-
drivers/media/platform/amphion/vpu_helpers.c | 45 +++-
drivers/media/platform/amphion/vpu_helpers.h | 2 +
drivers/media/platform/amphion/vpu_malone.c | 3 +-
drivers/media/platform/amphion/vpu_v4l2.c | 169 +++++++++++----
drivers/media/platform/amphion/vpu_v4l2.h | 3 +-
drivers/media/platform/amphion/vpu_windsor.c | 8 +-
drivers/media/v4l2-core/v4l2-ioctl.c | 2 +
include/uapi/linux/videodev2.h | 2 +
13 files changed, 333 insertions(+), 165 deletions(-)

--
2.37.1


2022-08-25 02:10:13

by Ming Qian

[permalink] [raw]
Subject: [PATCH v5 4/4] media: amphion: encoder add support for contiguous planes

encoder add support for contiguous formats NV12

Signed-off-by: Ming Qian <[email protected]>
Reviewed-by: Tommaso Merciai <[email protected]>
---
drivers/media/platform/amphion/venc.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c
index 060a1ee78b17..3cbe8ce637e5 100644
--- a/drivers/media/platform/amphion/venc.c
+++ b/drivers/media/platform/amphion/venc.c
@@ -72,6 +72,14 @@ static const struct vpu_format venc_formats[] = {
.mem_planes = 2,
.comp_planes = 2,
.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
+ .sibling = V4L2_PIX_FMT_NV12,
+ },
+ {
+ .pixfmt = V4L2_PIX_FMT_NV12,
+ .mem_planes = 1,
+ .comp_planes = 2,
+ .type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE,
+ .sibling = V4L2_PIX_FMT_NV12M,
},
{
.pixfmt = V4L2_PIX_FMT_H264,
--
2.37.1

2022-08-25 02:14:10

by Ming Qian

[permalink] [raw]
Subject: [PATCH v5 3/4] media: amphion: decoder add support for contiguous planes

decoder add support for contiguous formats
V4L2_PIX_FMT_NV12_8L128 and V4L2_PIX_FMT_NV12_10BE_8L128

Signed-off-by: Ming Qian <[email protected]>
Reviewed-by: Tommaso Merciai <[email protected]>
---
drivers/media/platform/amphion/vdec.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)

diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c
index 48ab664fa7ef..9c3324717cbc 100644
--- a/drivers/media/platform/amphion/vdec.c
+++ b/drivers/media/platform/amphion/vdec.c
@@ -72,12 +72,28 @@ static const struct vpu_format vdec_formats[] = {
.mem_planes = 2,
.comp_planes = 2,
.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
+ .sibling = V4L2_PIX_FMT_NV12_8L128,
+ },
+ {
+ .pixfmt = V4L2_PIX_FMT_NV12_8L128,
+ .mem_planes = 1,
+ .comp_planes = 2,
+ .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
+ .sibling = V4L2_PIX_FMT_NV12M_8L128,
},
{
.pixfmt = V4L2_PIX_FMT_NV12M_10BE_8L128,
.mem_planes = 2,
.comp_planes = 2,
.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
+ .sibling = V4L2_PIX_FMT_NV12_10BE_8L128,
+ },
+ {
+ .pixfmt = V4L2_PIX_FMT_NV12_10BE_8L128,
+ .mem_planes = 1,
+ .comp_planes = 2,
+ .type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE,
+ .sibling = V4L2_PIX_FMT_NV12M_10BE_8L128
},
{
.pixfmt = V4L2_PIX_FMT_H264,
--
2.37.1