Hello, This patch series is an attempt at factorizing some of the boiler plate code that we find in most stateless codec drivers (and potentially stateful codec ones too). It's been designed mostly based on the hantro and cedrus driver and I decided to implement a third one using these helpers to prove that they can be used more widely. Those helpers are rather basic, and we could probably extend them (or add new ones) to further simplify codec drivers, but with those in place we already have a good level of code re-usability without forcing anyone to use them if they feel they need things to be done differently. Note that the H264 codec lib should soon see addition of helpers to create the P/B0/B1 reflists (which are needed by both the hantro and rockchip drivers), but I'd like the uAPI discussion on how to support interlaced content to take place before providing generic helpers for that. I'd appreciate some feedback on patches 1-4. Patch 5 is here to show how those helpers can be used and has dependencies on various H264 that are still being discussed [1][2], so expect some kbuild failure reports. Thanks, Boris [1]https://patchwork.kernel.org/patch/11004013/ [2]https://patchwork.kernel.org/project/linux-media/list/?series=129567 Boris Brezillon (5): media: vb2: Add a helper to get the vb2 buffer attached to a request media: v4l2: Prepare things for addition of m2m codec helpers media: v4l2: Add m2m codec helpers media: v4l2: Provide helpers for H264 codecs media: rockchip: Add the rkvdec driver .../media/common/videobuf2/videobuf2-core.c | 23 + drivers/media/v4l2-core/Kconfig | 9 + drivers/media/v4l2-core/Makefile | 3 + drivers/media/v4l2-core/v4l2-mem2mem-codec.c | 1170 +++++++++++++++++ .../{v4l2-mem2mem.c => v4l2-mem2mem-core.c} | 0 .../media/v4l2-core/v4l2-mem2mem-h264-codec.c | 47 + drivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile | 1 + drivers/staging/media/rockchip/Kconfig | 16 + drivers/staging/media/rockchip/Makefile | 2 + drivers/staging/media/rockchip/vdec/Kconfig | 16 + drivers/staging/media/rockchip/vdec/Makefile | 3 + .../staging/media/rockchip/vdec/rkvdec-h264.c | 909 +++++++++++++ .../staging/media/rockchip/vdec/rkvdec-regs.h | 305 +++++ drivers/staging/media/rockchip/vdec/rkvdec.c | 564 ++++++++ drivers/staging/media/rockchip/vdec/rkvdec.h | 94 ++ include/media/v4l2-mem2mem-codec.h | 317 +++++ include/media/v4l2-mem2mem-h264-codec.h | 100 ++ include/media/videobuf2-core.h | 11 + 19 files changed, 3592 insertions(+) create mode 100644 drivers/media/v4l2-core/v4l2-mem2mem-codec.c rename drivers/media/v4l2-core/{v4l2-mem2mem.c => v4l2-mem2mem-core.c} (100%) create mode 100644 drivers/media/v4l2-core/v4l2-mem2mem-h264-codec.c create mode 100644 drivers/staging/media/rockchip/Kconfig create mode 100644 drivers/staging/media/rockchip/Makefile create mode 100644 drivers/staging/media/rockchip/vdec/Kconfig create mode 100644 drivers/staging/media/rockchip/vdec/Makefile create mode 100644 drivers/staging/media/rockchip/vdec/rkvdec-h264.c create mode 100644 drivers/staging/media/rockchip/vdec/rkvdec-regs.h create mode 100644 drivers/staging/media/rockchip/vdec/rkvdec.c create mode 100644 drivers/staging/media/rockchip/vdec/rkvdec.h create mode 100644 include/media/v4l2-mem2mem-codec.h create mode 100644 include/media/v4l2-mem2mem-h264-codec.h -- 2.21.0