[DKIM] [PATCH v12, 13/17] media: mediatek: vcodec: Extract H264 common code
yunfei.dong at mediatek.com
yunfei.dong at mediatek.com
Thu May 12 19:57:22 PDT 2022
Dear Hans,
Thanks for your suggestion.
On Thu, 2022-05-12 at 11:31 +0200, Hans Verkuil wrote:
> Hi Yunfei,
>
> On 5/12/22 04:19, Yunfei Dong wrote:
> > Mt8192 can use some of common code with mt8183. Moves them to
> > a new file in order to reuse.
> >
> > Signed-off-by: Yunfei Dong <yunfei.dong at mediatek.com>
> > Reviewed-by: Nicolas Dufresne <nicolas.dufresne at collabora.com>
> > ---
> > .../media/platform/mediatek/vcodec/Makefile | 1 +
> > .../vcodec/vdec/vdec_h264_req_common.c | 310 +++++++++++++
> > .../vcodec/vdec/vdec_h264_req_common.h | 274 +++++++++++
> > .../mediatek/vcodec/vdec/vdec_h264_req_if.c | 427 ++----------
> > ------
> > 4 files changed, 629 insertions(+), 383 deletions(-)
> > create mode 100644
> > drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_common.c
> > create mode 100644
> > drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_common.h
> >
> > diff --git a/drivers/media/platform/mediatek/vcodec/Makefile
> > b/drivers/media/platform/mediatek/vcodec/Makefile
> > index 359619653a0e..3f41d748eee5 100644
> > --- a/drivers/media/platform/mediatek/vcodec/Makefile
> > +++ b/drivers/media/platform/mediatek/vcodec/Makefile
> > @@ -9,6 +9,7 @@ mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
> > vdec/vdec_vp8_if.o \
> > vdec/vdec_vp9_if.o \
> > vdec/vdec_h264_req_if.o \
> > + vdec/vdec_h264_req_common.o \
> > mtk_vcodec_dec_drv.o \
> > vdec_drv_if.o \
> > vdec_vpu_if.o \
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_common.
> > c
> > b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_common.
> > c
> > new file mode 100644
> > index 000000000000..4e7c9d47751d
> > --- /dev/null
> > +++
> > b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_common.
> > c
> > @@ -0,0 +1,310 @@
>
> <snip>
>
> Here there is still a cast to iomem:
>
> > +void mtk_vdec_h264_copy_scaling_matrix(struct
> > slice_api_h264_scaling_matrix *dst_matrix,
> > + const struct
> > v4l2_ctrl_h264_scaling_matrix *src_matrix)
> > +{
> > + memcpy_toio((void __iomem *)dst_matrix->scaling_list_4x4,
> > src_matrix->scaling_list_4x4,
> > + sizeof(dst_matrix->scaling_list_4x4));
> > +
> > + memcpy_toio((void __iomem *)dst_matrix->scaling_list_8x8,
> > src_matrix->scaling_list_8x8,
> > + sizeof(dst_matrix->scaling_list_8x8));
> > +}
>
> <snip>
>
> > diff --git
> > a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c
> > b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c
> > index 27119aa31dd9..b055ceea481d 100644
> > ---
> > a/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c
> > +++
> > b/drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c
>
> <snip>
>
> > -static void
> > -get_h264_scaling_matrix(struct slice_api_h264_scaling_matrix
> > *dst_matrix,
> > - const struct v4l2_ctrl_h264_scaling_matrix
> > *src_matrix)
> > -{
> > - memcpy(dst_matrix->scaling_list_4x4, src_matrix-
> > >scaling_list_4x4,
> > - sizeof(dst_matrix->scaling_list_4x4));
> > -
> > - memcpy(dst_matrix->scaling_list_8x8, src_matrix-
> > >scaling_list_8x8,
> > - sizeof(dst_matrix->scaling_list_8x8));
> > -}
>
> but that function was moved (AFAICT) from vdec_h264_req_if.c where a
> regular memcpy was
> used.
>
> Did you miss one iomem case?
>
> Can I change mtk_vdec_h264_copy_scaling_matrix() to:
>
> void mtk_vdec_h264_copy_scaling_matrix(struct
> slice_api_h264_scaling_matrix *dst_matrix,
> const struct
> v4l2_ctrl_h264_scaling_matrix *src_matrix)
> {
> memcpy(dst_matrix->scaling_list_4x4, src_matrix-
> >scaling_list_4x4,
> sizeof(dst_matrix->scaling_list_4x4));
>
> memcpy(dst_matrix->scaling_list_8x8, src_matrix-
> >scaling_list_8x8,
> sizeof(dst_matrix->scaling_list_8x8));
> }
>
> If that's OK, then I'll do that manually, so no need to post a v13.
>
> Everything else looks fine, so this is the only issue that needs to
> be resolved.
>
> Regards,
>
1: For h264_req_if.c no need to add __iomem anymore. You can help to
change it directly.
2: Could you please help to add for whole series: Tested-by: Nícolas F.
R. A. Prado <nfraprado at collabora.com>
according to Nicolas's mail.
Hi Yunfei,
With this series, and the new scp.img for mt8192 [1] (still waiting to
get
merged), I was able to get the following fluster scores on
mt8192-asurada-spherion:
VP8: 59/61
VP9: 249/303
H.264: 92/135
So for the whole series:
Tested-by: Nícolas F. R. A. Prado <nfraprado at collabora.com>
> Hans
>
Best Regards,
Yunfei Dong
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek
More information about the linux-arm-kernel
mailing list