Another spin [1] of the support for the MT8183 stateless decoder taken from the Chrome OS tree. This version is updated to work with the latest revision of the stateless API. It requires the SCP support patchset [2] and thus is not yet suitable for merging, except maybe the first 3 to 6 patches. Patches 1 to 3 are cleanup/fixes and can be merged as-is. The mtk-vcodec driver already supports the MT8173 chip, which uses the stateful codec API. Therefore the first step, since MT8183 uses the stateless codec API, is to isolate the stateful ops from the common code and into its own file, which is what patch 4 does. Patches 5 and 6 abstract the firmware in the same way, and add a firmware version number that will be used by MT8183 firmware. Patch 7 adds support for communicating with a SCP firmware, and requires the SCP support series to compile. Patches 8 and 9 add the documentation and declarations of the MM21 format, a proprietary block format that MT8183 decodes into. The MDP3 m2m block is capable of converting this format into something more common. Patch 10 and 11 add general support for stateless codecs, and support for decoding a H.264 stream using a stateless codec. Patch 12 adds support for the media device required to create requests for stateless decoding. Finally, patch 13 enables MT8183. Although the code is not mergeable yet, I thought it would be interesting to publish it as a RFC that illustrates how another driver implements the stateless codec API. Reviews are also of course welcome. [1] https://patchwork.kernel.org/cover/10963719/ [2] https://lkml.org/lkml/2019/9/5/63 Alexandre Courbot (5): media: mtk-vcodec: vdec: set VPI IPI handler in one place media: mtk-vcodec: vdec: clean up vidioc_vdec_s_fmt a bit media: mtk-vcodec: vdec: handle firmware version field media: add Mediatek's MM21 format media: doc: Add documentation for MM21 video format Yunfei Dong (8): media: mtk-vcodec: vdec: fix incorrect pointer dereference media: mtk-vcodec: vdec: move stateful ops into their own file media: mtk-vcodec: abstract firmware interface media: mtk-vcodec: add SCP firmware ops media: mtk-vcodec: vdec: support stateless API media: mtk-vcodec: vdec: support stateless H.264 decoding media: mtk-vcodec: vdec: add media device if using stateless api media: mtk-vcodec: enable MT8183 decoder .../media/uapi/v4l/pixfmt-reserved.rst | 10 + drivers/media/platform/Kconfig | 1 + drivers/media/platform/mtk-vcodec/Makefile | 7 +- .../platform/mtk-vcodec/mtk_vcodec_dec.c | 770 +++--------------- .../platform/mtk-vcodec/mtk_vcodec_dec.h | 30 +- .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 103 ++- .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 1 - .../mtk-vcodec/mtk_vcodec_dec_stateful.c | 631 ++++++++++++++ .../mtk-vcodec/mtk_vcodec_dec_stateless.c | 494 +++++++++++ .../platform/mtk-vcodec/mtk_vcodec_drv.h | 60 +- .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 49 +- .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c | 2 - .../media/platform/mtk-vcodec/mtk_vcodec_fw.c | 208 +++++ .../media/platform/mtk-vcodec/mtk_vcodec_fw.h | 38 + .../platform/mtk-vcodec/mtk_vcodec_util.c | 1 - .../platform/mtk-vcodec/vdec/vdec_h264_if.c | 2 - .../mtk-vcodec/vdec/vdec_h264_req_if.c | 627 ++++++++++++++ .../platform/mtk-vcodec/vdec/vdec_vp8_if.c | 2 - .../platform/mtk-vcodec/vdec/vdec_vp9_if.c | 2 - .../media/platform/mtk-vcodec/vdec_drv_base.h | 2 - .../media/platform/mtk-vcodec/vdec_drv_if.c | 4 +- .../media/platform/mtk-vcodec/vdec_drv_if.h | 1 + .../media/platform/mtk-vcodec/vdec_ipi_msg.h | 7 + .../media/platform/mtk-vcodec/vdec_vpu_if.c | 40 +- .../media/platform/mtk-vcodec/vdec_vpu_if.h | 20 +- .../platform/mtk-vcodec/venc/venc_h264_if.c | 15 +- .../platform/mtk-vcodec/venc/venc_vp8_if.c | 8 +- .../media/platform/mtk-vcodec/venc_drv_if.c | 1 - .../media/platform/mtk-vcodec/venc_ipi_msg.h | 2 + .../media/platform/mtk-vcodec/venc_vpu_if.c | 15 +- .../media/platform/mtk-vcodec/venc_vpu_if.h | 5 +- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 33 files changed, 2397 insertions(+), 763 deletions(-) create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_stateful.c create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_stateless.c create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_fw.c create mode 100644 drivers/media/platform/mtk-vcodec/mtk_vcodec_fw.h create mode 100644 drivers/media/platform/mtk-vcodec/vdec/vdec_h264_req_if.c -- 2.23.0.187.g17f5b7556c-goog