Re: [PATCH v4 5/5] media: meson: vdec: add VP9 decoder support

From: Hans Verkuil
Date: Fri Feb 14 2020 - 10:04:54 EST


On 2/6/20 9:41 AM, Neil Armstrong wrote:
> From: Maxime Jourdan <mjourdan@xxxxxxxxxxxx>
>
> This adds VP9 decoding for the Amlogic GXL, G12A & SM1 SoCs, using
> the commong "HEVC" HW decoder.
>
> For G12A & SM1, it uses the IOMMU support from the firmware.
>
> For 10bit decoding, the firmware can only decode in the proprietary
> Amlogic Framebuffer Compression format, but can output in 8bit NV12
> buffer while writing the decoded frame.
>
> Signed-off-by: Maxime Jourdan <mjourdan@xxxxxxxxxxxx>
> Signed-off-by: Neil Armstrong <narmstrong@xxxxxxxxxxxx>
> ---
> drivers/staging/media/meson/vdec/Makefile | 2 +-
> drivers/staging/media/meson/vdec/codec_vp9.c | 2138 +++++++++++++++++
> drivers/staging/media/meson/vdec/codec_vp9.h | 13 +
> drivers/staging/media/meson/vdec/hevc_regs.h | 7 +
> drivers/staging/media/meson/vdec/vdec.c | 5 +
> .../staging/media/meson/vdec/vdec_helpers.c | 4 +
> .../staging/media/meson/vdec/vdec_platform.c | 38 +
> 7 files changed, 2206 insertions(+), 1 deletion(-)
> create mode 100644 drivers/staging/media/meson/vdec/codec_vp9.c
> create mode 100644 drivers/staging/media/meson/vdec/codec_vp9.h
>
> diff --git a/drivers/staging/media/meson/vdec/Makefile b/drivers/staging/media/meson/vdec/Makefile
> index f55b6e625034..6e726af84ac9 100644
> --- a/drivers/staging/media/meson/vdec/Makefile
> +++ b/drivers/staging/media/meson/vdec/Makefile
> @@ -3,6 +3,6 @@
>
> meson-vdec-objs = esparser.o vdec.o vdec_helpers.o vdec_platform.o
> meson-vdec-objs += vdec_1.o vdec_hevc.o
> -meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_hevc_common.o
> +meson-vdec-objs += codec_mpeg12.o codec_h264.o codec_hevc_common.o codec_vp9.o
>
> obj-$(CONFIG_VIDEO_MESON_VDEC) += meson-vdec.o
> diff --git a/drivers/staging/media/meson/vdec/codec_vp9.c b/drivers/staging/media/meson/vdec/codec_vp9.c
> new file mode 100644
> index 000000000000..e7ffbc6dd892
> --- /dev/null
> +++ b/drivers/staging/media/meson/vdec/codec_vp9.c
> @@ -0,0 +1,2138 @@

...

> +#define ROUND_POWER_OF_TWO(value, num) (((value) + (1 << ((num) - 1))) >> (num))

Checkpatch says:

CHECK: Macro argument reuse 'num' - possible side-effects?
#377: FILE: drivers/staging/media/meson/vdec/codec_vp9.c:330:
+#define ROUND_POWER_OF_TWO(value, num) (((value) + (1 << ((num) - 1))) >> (num))

While num is const in this source, I do prefer if this is turned into a static inline.

It's just safer.

Regards,

Hans