media: mtk-vcodec: cleanups and fixes
Subsystems (2)
cover media: mtk-vcodec: cleanups and fixes
This series extracts the cleanup patches from the RFC of MT8183 support [1] as these patches can already be merged. MT8183 support will be sent separately.
[1] https://patchwork.kernel.org/cover/10963769/
Changes since RFC:
- Replaced all GPLv2 headers with SPDX
- Replaced EXPORT_SYMBOL with EXPORT_SYMBOL_GPL
Alexandre Courbot (4):
media: mtk-vcodec: replace GPLv2 with SPDX
media: mtk-vcodec: avoid unneeded pointer-to-long conversions
media: mtk-vcodec: remove unneeded proxy functions
media: mtk-vcodec: constify formats
Yunfei Dong (1):
media: mtk-vcodec: support single-buffer frames
.../platform/mtk-vcodec/mtk_vcodec_dec.c | 45 ++++++++----------- .../platform/mtk-vcodec/mtk_vcodec_dec.h | 15 +------ .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 15 +------ .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 14 +----- .../platform/mtk-vcodec/mtk_vcodec_dec_pm.h | 14 +----- .../platform/mtk-vcodec/mtk_vcodec_drv.h | 19 ++------ .../platform/mtk-vcodec/mtk_vcodec_enc.c | 34 +++++--------- .../platform/mtk-vcodec/mtk_vcodec_enc.h | 15 +------ .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 15 +------ .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c | 14 +----- .../platform/mtk-vcodec/mtk_vcodec_enc_pm.h | 14 +----- .../platform/mtk-vcodec/mtk_vcodec_intr.c | 14 +----- .../platform/mtk-vcodec/mtk_vcodec_intr.h | 14 +----- .../platform/mtk-vcodec/mtk_vcodec_util.c | 15 +------ .../platform/mtk-vcodec/mtk_vcodec_util.h | 15 +------ .../platform/mtk-vcodec/vdec/vdec_h264_if.c | 35 ++++----------- .../platform/mtk-vcodec/vdec/vdec_vp8_if.c | 36 ++++----------- .../platform/mtk-vcodec/vdec/vdec_vp9_if.c | 37 ++++----------- .../media/platform/mtk-vcodec/vdec_drv_base.h | 22 +++------ .../media/platform/mtk-vcodec/vdec_drv_if.c | 29 ++++-------- .../media/platform/mtk-vcodec/vdec_drv_if.h | 15 +------ .../media/platform/mtk-vcodec/vdec_ipi_msg.h | 15 +------ .../media/platform/mtk-vcodec/vdec_vpu_if.c | 14 +----- .../media/platform/mtk-vcodec/vdec_vpu_if.h | 14 +----- .../platform/mtk-vcodec/venc/venc_h264_if.c | 36 +++------------ .../platform/mtk-vcodec/venc/venc_vp8_if.c | 35 +++------------ .../media/platform/mtk-vcodec/venc_drv_base.h | 25 +++-------- .../media/platform/mtk-vcodec/venc_drv_if.c | 27 +++-------- .../media/platform/mtk-vcodec/venc_drv_if.h | 17 +------ .../media/platform/mtk-vcodec/venc_ipi_msg.h | 17 +------ .../media/platform/mtk-vcodec/venc_vpu_if.c | 15 +------ .../media/platform/mtk-vcodec/venc_vpu_if.h | 15 +------ 32 files changed, 114 insertions(+), 562 deletions(-)
Signature · 1 line
2.22.0.rc1.311.g5d7573a151-goog
PATCH 1/5 media: mtk-vcodec: replace GPLv2 with SPDX
Replace the GPLv2 boilerplate with the corresponding SPDX reference.
--- .../media/platform/mtk-vcodec/mtk_vcodec_dec.c | 15 +-------------- .../media/platform/mtk-vcodec/mtk_vcodec_dec.h | 15 +-------------- .../platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 15 +-------------- .../platform/mtk-vcodec/mtk_vcodec_dec_pm.c | 14 +------------- .../platform/mtk-vcodec/mtk_vcodec_dec_pm.h | 14 +------------- .../media/platform/mtk-vcodec/mtk_vcodec_drv.h | 15 +-------------- .../media/platform/mtk-vcodec/mtk_vcodec_enc.c | 15 +-------------- .../media/platform/mtk-vcodec/mtk_vcodec_enc.h | 15 +-------------- .../platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 15 +-------------- .../platform/mtk-vcodec/mtk_vcodec_enc_pm.c | 14 +------------- .../platform/mtk-vcodec/mtk_vcodec_enc_pm.h | 14 +------------- .../media/platform/mtk-vcodec/mtk_vcodec_intr.c | 14 +------------- .../media/platform/mtk-vcodec/mtk_vcodec_intr.h | 14 +------------- .../media/platform/mtk-vcodec/mtk_vcodec_util.c | 15 +-------------- .../media/platform/mtk-vcodec/mtk_vcodec_util.h | 15 +-------------- .../platform/mtk-vcodec/vdec/vdec_h264_if.c | 14 +------------- .../platform/mtk-vcodec/vdec/vdec_vp8_if.c | 15 +-------------- .../platform/mtk-vcodec/vdec/vdec_vp9_if.c | 16 +--------------- .../media/platform/mtk-vcodec/vdec_drv_base.h | 14 +------------- drivers/media/platform/mtk-vcodec/vdec_drv_if.c | 15 +-------------- drivers/media/platform/mtk-vcodec/vdec_drv_if.h | 15 +-------------- .../media/platform/mtk-vcodec/vdec_ipi_msg.h | 15 +-------------- drivers/media/platform/mtk-vcodec/vdec_vpu_if.c | 14 +------------- drivers/media/platform/mtk-vcodec/vdec_vpu_if.h | 14 +------------- .../platform/mtk-vcodec/venc/venc_h264_if.c | 17 +---------------- .../platform/mtk-vcodec/venc/venc_vp8_if.c | 16 +--------------- .../media/platform/mtk-vcodec/venc_drv_base.h | 17 +---------------- drivers/media/platform/mtk-vcodec/venc_drv_if.c | 17 +---------------- drivers/media/platform/mtk-vcodec/venc_drv_if.h | 17 +---------------- .../media/platform/mtk-vcodec/venc_ipi_msg.h | 17 +---------------- drivers/media/platform/mtk-vcodec/venc_vpu_if.c | 15 +-------------- drivers/media/platform/mtk-vcodec/venc_vpu_if.h | 15 +-------------- 32 files changed, 32 insertions(+), 450 deletions(-)
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c +1 -14
@@ -1,17 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include <media/v4l2-event.h> #include <media/v4l2-mem2mem.h>
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.h +1 -14
@@ -1,17 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _MTK_VCODEC_DEC_H_#define _MTK_VCODEC_DEC_H_
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c +1 -14
@@ -1,17 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include <linux/slab.h> #include <linux/interrupt.h>
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.c +1 -13
@@ -1,16 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include <linux/clk.h> #include <linux/of_address.h>
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_pm.h +1 -13
@@ -1,16 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _MTK_VCODEC_DEC_PM_H_#define _MTK_VCODEC_DEC_PM_H_
drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h +1 -14
@@ -1,17 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _MTK_VCODEC_DRV_H_#define _MTK_VCODEC_DRV_H_
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +1 -14
@@ -1,17 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include <media/v4l2-event.h> #include <media/v4l2-mem2mem.h>
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.h +1 -14
@@ -1,17 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _MTK_VCODEC_ENC_H_#define _MTK_VCODEC_ENC_H_
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +1 -14
@@ -1,17 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include <linux/slab.h> #include <linux/interrupt.h>
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.c +1 -13
@@ -1,16 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include <linux/clk.h> #include <linux/of_address.h>
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_pm.h +1 -13
@@ -1,16 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _MTK_VCODEC_ENC_PM_H_#define _MTK_VCODEC_ENC_PM_H_
drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.c +1 -13
@@ -1,16 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include <linux/errno.h> #include <linux/wait.h>
drivers/media/platform/mtk-vcodec/mtk_vcodec_intr.h +1 -13
@@ -1,16 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _MTK_VCODEC_INTR_H_#define _MTK_VCODEC_INTR_H_
drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c +1 -14
@@ -1,17 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include <linux/module.h>
drivers/media/platform/mtk-vcodec/mtk_vcodec_util.h +1 -14
@@ -1,17 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _MTK_VCODEC_UTIL_H_#define _MTK_VCODEC_UTIL_H_
drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c +1 -13
@@ -1,16 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include <linux/module.h> #include <linux/slab.h>
drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c +1 -14
@@ -1,17 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: Jungchang Tsao <[email protected]> -* PC Chen <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include <linux/slab.h> #include "../vdec_drv_if.h"
drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c +1 -15
@@ -1,18 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: Daniel Hsiao <[email protected]> -* Kai-Sean Yang <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU General Public License -* version 2 as published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include <linux/fs.h> #include <linux/slab.h>
drivers/media/platform/mtk-vcodec/vdec_drv_base.h +1 -13
@@ -1,16 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _VDEC_DRV_BASE_#define _VDEC_DRV_BASE_
drivers/media/platform/mtk-vcodec/vdec_drv_if.c +1 -14
@@ -1,17 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include <linux/interrupt.h> #include <linux/kernel.h>
drivers/media/platform/mtk-vcodec/vdec_drv_if.h +1 -14
@@ -1,17 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _VDEC_DRV_IF_H_#define _VDEC_DRV_IF_H_
drivers/media/platform/mtk-vcodec/vdec_ipi_msg.h +1 -14
@@ -1,17 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* -* This program is free software; you can redistribute it and/or -* modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _VDEC_IPI_MSG_H_#define _VDEC_IPI_MSG_H_
drivers/media/platform/mtk-vcodec/vdec_vpu_if.c +1 -13
@@ -1,16 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include "mtk_vcodec_drv.h" #include "mtk_vcodec_util.h"
drivers/media/platform/mtk-vcodec/vdec_vpu_if.h +1 -13
@@ -1,16 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PC Chen <[email protected]> -* -* This program is free software; you can redistribute it and/or modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _VDEC_VPU_IF_H_#define _VDEC_VPU_IF_H_
drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c +1 -16
@@ -1,19 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: Jungchang Tsao <[email protected]> -* Daniel Hsiao <[email protected]> -* PoChun Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or -* modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include <linux/interrupt.h> #include <linux/kernel.h>
drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c +1 -15
@@ -1,18 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: Daniel Hsiao <[email protected]> -* PoChun Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or -* modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include <linux/interrupt.h> #include <linux/kernel.h>
drivers/media/platform/mtk-vcodec/venc_drv_base.h +1 -16
@@ -1,19 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: Daniel Hsiao <[email protected]> -* Jungchang Tsao <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or -* modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _VENC_DRV_BASE_#define _VENC_DRV_BASE_
drivers/media/platform/mtk-vcodec/venc_drv_if.c +1 -16
@@ -1,19 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: Daniel Hsiao <[email protected]> -* Jungchang Tsao <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or -* modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include <linux/interrupt.h> #include <linux/kernel.h>
drivers/media/platform/mtk-vcodec/venc_drv_if.h +1 -16
@@ -1,19 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: Daniel Hsiao <[email protected]> -* Jungchang Tsao <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or -* modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _VENC_DRV_IF_H_#define _VENC_DRV_IF_H_
drivers/media/platform/mtk-vcodec/venc_ipi_msg.h +1 -16
@@ -1,19 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: Jungchang Tsao <[email protected]> -* Daniel Hsiao <[email protected]> -* Tiffany Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or -* modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _VENC_IPI_MSG_H_#define _VENC_IPI_MSG_H_
drivers/media/platform/mtk-vcodec/venc_vpu_if.c +1 -14
@@ -1,17 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PoChun Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or -* modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +// SPDX-License-Identifier: GPL-2.0 #include "mtk_vpu.h" #include "venc_ipi_msg.h"
drivers/media/platform/mtk-vcodec/venc_vpu_if.h +1 -14
@@ -1,17 +1,4 @@ -/* -* Copyright (c) 2016 MediaTek Inc. -* Author: PoChun Lin <[email protected]> -* -* This program is free software; you can redistribute it and/or -* modify -* it under the terms of the GNU General Public License version 2 as -* published by the Free Software Foundation. -* -* This program is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -*/ +/* SPDX-License-Identifier: GPL-2.0 */ #ifndef _VENC_VPU_IF_H_#define _VENC_VPU_IF_H_
Signature · 1 line
2.22.0.rc1.311.g5d7573a151-goog
PATCH 2/5 media: mtk-vcodec: avoid unneeded pointer-to-long conversions
In reply to Alexandre CourbotThe interface used to communicate with the firmware casts pointers into unsigned longs and back again in order to store private references, all of this for pointers that remain purely in the kernel. Replace these unsigned longs with void pointers to make the code a bit sturdier and easier to follow.
Also simplify some interfaces by removing arguments that could be infered from others.
--- drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h | 2 +- .../media/platform/mtk-vcodec/vdec/vdec_h264_if.c | 12 ++++++------ drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c | 12 ++++++------ drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c | 12 ++++++------ drivers/media/platform/mtk-vcodec/vdec_drv_base.h | 8 ++++---- drivers/media/platform/mtk-vcodec/vdec_drv_if.c | 2 +- .../media/platform/mtk-vcodec/venc/venc_h264_if.c | 10 +++++----- drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c | 10 +++++----- drivers/media/platform/mtk-vcodec/venc_drv_base.h | 8 ++++---- drivers/media/platform/mtk-vcodec/venc_drv_if.c | 2 +- 10 files changed, 39 insertions(+), 39 deletions(-)
drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h +1 -1
@@ -268,7 +268,7 @@ struct mtk_vcodec_ctx {const struct vdec_common_if *dec_if;const struct venc_common_if *enc_if; -unsigned long drv_handle; +void *drv_handle;struct vdec_pic_info picinfo;int dpb_size;
drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c +6 -6
@@ -262,7 +262,7 @@ static void get_dpb_size(struct vdec_h264_inst *inst, unsigned int *dpb_sz)mtk_vcodec_debug (inst,"sz=%d" , *dpb_sz); } -static int vdec_h264_init (struct mtk_vcodec_ctx *ctx,unsigned long *h_vdec) +static int vdec_h264_init (struct mtk_vcodec_ctx *ctx) {struct vdec_h264_inst *inst =NULL ;int err;
@@ -291,7 +291,7 @@ static int vdec_h264_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)mtk_vcodec_debug (inst,"H264 Instance >> %p" , inst); - *h_vdec = (unsigned long )inst; + ctx->drv_handle = inst;return 0 ; error_deinit:
@@ -302,7 +302,7 @@ static int vdec_h264_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)return err; } -static void vdec_h264_deinit (unsigned long h_vdec) +static void vdec_h264_deinit (void *h_vdec) {struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec;
@@ -327,7 +327,7 @@ static int find_start_code(unsigned char *data, unsigned int data_sz)return -1 ; } -static int vdec_h264_decode (unsigned long h_vdec,struct mtk_vcodec_mem *bs, +static int vdec_h264_decode (void *h_vdec,struct mtk_vcodec_mem *bs,struct vdec_fb *fb,bool *res_chg) {struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec;
@@ -447,8 +447,8 @@ static void vdec_h264_get_fb(struct vdec_h264_inst *inst, list->count--; } -static int vdec_h264_get_param (unsigned long h_vdec, -enum vdec_get_param_type type,void *out) +static int vdec_h264_get_param (void *h_vdec,enum vdec_get_param_type type, +void *out) {struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec;
drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c +6 -6
@@ -383,7 +383,7 @@ static void free_working_buf(struct vdec_vp8_inst *inst) inst->vsi->dec.working_buf_dma =0 ; } -static int vdec_vp8_init (struct mtk_vcodec_ctx *ctx,unsigned long *h_vdec) +static int vdec_vp8_init (struct mtk_vcodec_ctx *ctx) {struct vdec_vp8_inst *inst;int err;
@@ -414,7 +414,7 @@ static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)get_hw_reg_base (inst);mtk_vcodec_debug (inst,"VP8 Instance >> %p" , inst); - *h_vdec = (unsigned long )inst; + ctx->drv_handle = inst;return 0 ; error_deinit:
@@ -424,7 +424,7 @@ static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)return err; } -static int vdec_vp8_decode (unsigned long h_vdec,struct mtk_vcodec_mem *bs, +static int vdec_vp8_decode (void *h_vdec,struct mtk_vcodec_mem *bs,struct vdec_fb *fb,bool *res_chg) {struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;
@@ -560,8 +560,8 @@ static void get_crop_info(struct vdec_vp8_inst *inst, struct v4l2_rect *cr) cr->left, cr->top, cr->width, cr->height); } -static int vdec_vp8_get_param (unsigned long h_vdec, -enum vdec_get_param_type type,void *out) +static int vdec_vp8_get_param (void *h_vdec,enum vdec_get_param_type type, +void *out) {struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;
@@ -594,7 +594,7 @@ static int vdec_vp8_get_param(unsigned long h_vdec,return 0 ; } -static void vdec_vp8_deinit (unsigned long h_vdec) +static void vdec_vp8_deinit (void *h_vdec) {struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;
drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c +6 -6
@@ -751,7 +751,7 @@ static int validate_vsi_array_indexes(struct vdec_vp9_inst *inst,return 0 ; } -static void vdec_vp9_deinit (unsigned long h_vdec) +static void vdec_vp9_deinit (void *h_vdec) {struct vdec_vp9_inst *inst = (struct vdec_vp9_inst *)h_vdec;struct mtk_vcodec_mem *mem;
@@ -773,7 +773,7 @@ static void vdec_vp9_deinit(unsigned long h_vdec)vp9_free_inst (inst); } -static int vdec_vp9_init (struct mtk_vcodec_ctx *ctx,unsigned long *h_vdec) +static int vdec_vp9_init (struct mtk_vcodec_ctx *ctx) {struct vdec_vp9_inst *inst;
@@ -797,7 +797,7 @@ static int vdec_vp9_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec) inst->vsi = (struct vdec_vp9_vsi *)inst->vpu.vsi;init_all_fb_lists (inst); - (*h_vdec) = (unsigned long )inst; + ctx->drv_handle = inst;return 0 ; err_deinit_inst:
@@ -806,7 +806,7 @@ static int vdec_vp9_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)return -EINVAL ; } -static int vdec_vp9_decode (unsigned long h_vdec,struct mtk_vcodec_mem *bs, +static int vdec_vp9_decode (void *h_vdec,struct mtk_vcodec_mem *bs,struct vdec_fb *fb,bool *res_chg) {int ret =0 ;
@@ -963,8 +963,8 @@ static void get_crop_info(struct vdec_vp9_inst *inst, struct v4l2_rect *cr) cr->left, cr->top, cr->width, cr->height); } -static int vdec_vp9_get_param (unsigned long h_vdec, -enum vdec_get_param_type type,void *out) +static int vdec_vp9_get_param (void *h_vdec,enum vdec_get_param_type type, +void *out) {struct vdec_vp9_inst *inst = (struct vdec_vp9_inst *)h_vdec;int ret =0 ;
drivers/media/platform/mtk-vcodec/vdec_drv_base.h +4 -4
@@ -13,7 +13,7 @@ struct vdec_common_if {* @ctx : [in] mtk v4l2 context * @h_vdec : [out] driver handle */ -int (*init)(struct mtk_vcodec_ctx *ctx,unsigned long *h_vdec); +int (*init)(struct mtk_vcodec_ctx *ctx);/** * (*decode)() - trigger decode
@@ -22,7 +22,7 @@ struct vdec_common_if {* @fb : [in] frame buffer to store decoded frame * @res_chg : [out] resolution change happen */ -int (*decode)(unsigned long h_vdec,struct mtk_vcodec_mem *bs, +int (*decode)(void *h_vdec,struct mtk_vcodec_mem *bs,struct vdec_fb *fb,bool *res_chg);/**
@@ -31,14 +31,14 @@ struct vdec_common_if {* @type : [in] input parameter type * @out : [out] buffer to store query result */ -int (*get_param)(unsigned long h_vdec,enum vdec_get_param_type type, +int (*get_param)(void *h_vdec,enum vdec_get_param_type type,void *out);/** * (*deinit)() - deinitialize driver. * @h_vdec : [in] driver handle to be deinit */ - void (*deinit)(unsigned long h_vdec); + void (*deinit)(void *h_vdec); };#endif
drivers/media/platform/mtk-vcodec/vdec_drv_if.c +1 -1
@@ -34,7 +34,7 @@ int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)mtk_vdec_lock (ctx);mtk_vcodec_dec_clock_on (&ctx->dev->pm); - ret = ctx->dec_if->init (ctx, &ctx->drv_handle); + ret = ctx->dec_if->init (ctx);mtk_vcodec_dec_clock_off (&ctx->dev->pm);mtk_vdec_unlock (ctx);
drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c +5 -5
@@ -452,7 +452,7 @@ static void h264_encode_filler(struct venc_h264_inst *inst, void *buf,memset (p,0xff , size); } -static int h264_enc_init (struct mtk_vcodec_ctx *ctx,unsigned long *handle) +static int h264_enc_init (struct mtk_vcodec_ctx *ctx) {int ret =0 ;struct venc_h264_inst *inst;
@@ -478,12 +478,12 @@ static int h264_enc_init(struct mtk_vcodec_ctx *ctx, unsigned long *handle)if (ret)kfree (inst);else - (*handle) = (unsigned long )inst; + ctx->drv_handle = inst;return ret; } -static int h264_enc_encode(unsigned long handle, +static int h264_enc_encode(void *handle, enum venc_start_opt opt, struct venc_frm_buf *frm_buf, struct mtk_vcodec_mem *bs_buf,
@@ -578,7 +578,7 @@ static int h264_enc_encode(unsigned long handle,return ret; } -static int h264_enc_set_param (unsigned long handle, +static int h264_enc_set_param (void *handle,enum venc_set_param_type type,struct venc_enc_param *enc_prm) {
@@ -631,7 +631,7 @@ static int h264_enc_set_param(unsigned long handle,return ret; } -static int h264_enc_deinit (unsigned long handle) +static int h264_enc_deinit (void *handle) {int ret =0 ;struct venc_h264_inst *inst = (struct venc_h264_inst *)handle;
drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c +5 -5
@@ -318,7 +318,7 @@ static int vp8_enc_encode_frame(struct venc_vp8_inst *inst,return ret; } -static int vp8_enc_init (struct mtk_vcodec_ctx *ctx,unsigned long *handle) +static int vp8_enc_init (struct mtk_vcodec_ctx *ctx) {int ret =0 ;struct venc_vp8_inst *inst;
@@ -344,12 +344,12 @@ static int vp8_enc_init(struct mtk_vcodec_ctx *ctx, unsigned long *handle)if (ret)kfree (inst);else - (*handle) = (unsigned long )inst; + ctx->drv_handle = inst;return ret; } -static int vp8_enc_encode(unsigned long handle, +static int vp8_enc_encode(void *handle, enum venc_start_opt opt, struct venc_frm_buf *frm_buf, struct mtk_vcodec_mem *bs_buf,
@@ -386,7 +386,7 @@ static int vp8_enc_encode(unsigned long handle,return ret; } -static int vp8_enc_set_param (unsigned long handle, +static int vp8_enc_set_param (void *handle,enum venc_set_param_type type,struct venc_enc_param *enc_prm) {
@@ -437,7 +437,7 @@ static int vp8_enc_set_param(unsigned long handle,return ret; } -static int vp8_enc_deinit (unsigned long handle) +static int vp8_enc_deinit (void *handle) {int ret =0 ;struct venc_vp8_inst *inst = (struct venc_vp8_inst *)handle;
drivers/media/platform/mtk-vcodec/venc_drv_base.h +4 -4
@@ -13,7 +13,7 @@ struct venc_common_if {* @ctx: [in] mtk v4l2 context * @handle: [out] driver handle */ -int (*init)(struct mtk_vcodec_ctx *ctx,unsigned long *handle); +int (*init)(struct mtk_vcodec_ctx *ctx);/** * (*encode)() - trigger encode
@@ -23,7 +23,7 @@ struct venc_common_if {* @bs_buf: [in] bitstream buffer to store output bitstream * @result: [out] encode result */ -int (*encode)(unsigned long handle,enum venc_start_opt opt, +int (*encode)(void *handle,enum venc_start_opt opt,struct venc_frm_buf *frm_buf,struct mtk_vcodec_mem *bs_buf,struct venc_done_result *result);
@@ -34,14 +34,14 @@ struct venc_common_if {* @type: [in] parameter type * @in: [in] buffer to store the parameter */ -int (*set_param)(unsigned long handle,enum venc_set_param_type type, +int (*set_param)(void *handle,enum venc_set_param_type type,struct venc_enc_param *in);/** * (*deinit)() - deinitialize driver. * @handle: [in] driver handle */ - int (*deinit)(unsigned long handle); + int (*deinit)(void *handle); };#endif
drivers/media/platform/mtk-vcodec/venc_drv_if.c +1 -1
@@ -31,7 +31,7 @@ int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)mtk_venc_lock (ctx);mtk_vcodec_enc_clock_on (&ctx->dev->pm); - ret = ctx->enc_if->init (ctx, (unsigned long *)&ctx->drv_handle); + ret = ctx->enc_if->init (ctx);mtk_vcodec_enc_clock_off (&ctx->dev->pm);mtk_venc_unlock (ctx);
Signature · 1 line
2.22.0.rc1.311.g5d7573a151-goog
Mauro Carvalho Chehab
maintainerRe: [PATCH 2/5] media: mtk-vcodec: avoid unneeded pointer-to-long conversions
Em Tue, 4 Jun 2019 18:37:34 +0900 Alexandre Courbot <[email protected]> escreveu:
Quoted 8 lines
The interface used to communicate with the firmware casts pointers into unsigned longs and back again in order to store private references, all of this for pointers that remain purely in the kernel. Replace these unsigned longs with void pointers to make the code a bit sturdier and easier to follow.
Also simplify some interfaces by removing arguments that could be infered from others.
This generate lots of sparse warnings:
drivers/media/platform/mtk-vcodec/vdec_drv_if.c:64:32: warning: Using plain integer as NULL pointer drivers/media/platform/mtk-vcodec/vdec_drv_if.c:87:32: warning: Using plain integer as NULL pointer drivers/media/platform/mtk-vcodec/vdec_drv_if.c:99:32: warning: Using plain integer as NULL pointer
drivers/media/platform/mtk-vcodec/vdec_drv_if.c:108:27: warning: Using plain integer as NULL pointer drivers/media/platform/mtk-vcodec/venc_drv_if.c:86:32: warning: Using plain integer as NULL pointer drivers/media/platform/mtk-vcodec/venc_drv_if.c:95:27: warning: Using plain integer as NULL pointer
Please fix and re-submit.
Regards,
Mauro
Quoted 369 lines
Signed-off-by Alexandre Courbot <[email protected]>--- drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h | 2 +- .../media/platform/mtk-vcodec/vdec/vdec_h264_if.c | 12 ++++++------ drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c | 12 ++++++------ drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c | 12 ++++++------ drivers/media/platform/mtk-vcodec/vdec_drv_base.h | 8 ++++---- drivers/media/platform/mtk-vcodec/vdec_drv_if.c | 2 +- .../media/platform/mtk-vcodec/venc/venc_h264_if.c | 10 +++++----- drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c | 10 +++++----- drivers/media/platform/mtk-vcodec/venc_drv_base.h | 8 ++++---- drivers/media/platform/mtk-vcodec/venc_drv_if.c | 2 +- 10 files changed, 39 insertions(+), 39 deletions(-)drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h +1
-1@@ -268,7 +268,7 @@ struct mtk_vcodec_ctx {const struct vdec_common_if *dec_if;const struct venc_common_if *enc_if; -unsigned long drv_handle; +void *drv_handle;struct vdec_pic_info picinfo;int dpb_size;drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c +6
-6@@ -262,7 +262,7 @@ static void get_dpb_size(struct vdec_h264_inst *inst, unsigned int *dpb_sz)mtk_vcodec_debug (inst,"sz=%d" , *dpb_sz); } -static int vdec_h264_init (struct mtk_vcodec_ctx *ctx,unsigned long *h_vdec) +static int vdec_h264_init (struct mtk_vcodec_ctx *ctx) {struct vdec_h264_inst *inst =NULL ;int err;@@ -291,7 +291,7 @@ static int vdec_h264_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)mtk_vcodec_debug (inst,"H264 Instance >> %p" , inst); - *h_vdec = (unsigned long )inst; + ctx->drv_handle = inst;return 0 ; error_deinit:@@ -302,7 +302,7 @@ static int vdec_h264_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)return err; } -static void vdec_h264_deinit (unsigned long h_vdec) +static void vdec_h264_deinit (void *h_vdec) {struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec;@@ -327,7 +327,7 @@ static int find_start_code(unsigned char *data, unsigned int data_sz)return -1 ; } -static int vdec_h264_decode (unsigned long h_vdec,struct mtk_vcodec_mem *bs, +static int vdec_h264_decode (void *h_vdec,struct mtk_vcodec_mem *bs,struct vdec_fb *fb,bool *res_chg) {struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec;@@ -447,8 +447,8 @@ static void vdec_h264_get_fb(struct vdec_h264_inst *inst, list->count--; } -static int vdec_h264_get_param (unsigned long h_vdec, -enum vdec_get_param_type type,void *out) +static int vdec_h264_get_param (void *h_vdec,enum vdec_get_param_type type, +void *out) {struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec;drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c +6
-6@@ -383,7 +383,7 @@ static void free_working_buf(struct vdec_vp8_inst *inst) inst->vsi->dec.working_buf_dma =0 ; } -static int vdec_vp8_init (struct mtk_vcodec_ctx *ctx,unsigned long *h_vdec) +static int vdec_vp8_init (struct mtk_vcodec_ctx *ctx) {struct vdec_vp8_inst *inst;int err;@@ -414,7 +414,7 @@ static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)get_hw_reg_base (inst);mtk_vcodec_debug (inst,"VP8 Instance >> %p" , inst); - *h_vdec = (unsigned long )inst; + ctx->drv_handle = inst;return 0 ; error_deinit:@@ -424,7 +424,7 @@ static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)return err; } -static int vdec_vp8_decode (unsigned long h_vdec,struct mtk_vcodec_mem *bs, +static int vdec_vp8_decode (void *h_vdec,struct mtk_vcodec_mem *bs,struct vdec_fb *fb,bool *res_chg) {struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;@@ -560,8 +560,8 @@ static void get_crop_info(struct vdec_vp8_inst *inst, struct v4l2_rect *cr) cr->left, cr->top, cr->width, cr->height); } -static int vdec_vp8_get_param (unsigned long h_vdec, -enum vdec_get_param_type type,void *out) +static int vdec_vp8_get_param (void *h_vdec,enum vdec_get_param_type type, +void *out) {struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;@@ -594,7 +594,7 @@ static int vdec_vp8_get_param(unsigned long h_vdec,return 0 ; } -static void vdec_vp8_deinit (unsigned long h_vdec) +static void vdec_vp8_deinit (void *h_vdec) {struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec;drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c +6
-6@@ -751,7 +751,7 @@ static int validate_vsi_array_indexes(struct vdec_vp9_inst *inst,return 0 ; } -static void vdec_vp9_deinit (unsigned long h_vdec) +static void vdec_vp9_deinit (void *h_vdec) {struct vdec_vp9_inst *inst = (struct vdec_vp9_inst *)h_vdec;struct mtk_vcodec_mem *mem;@@ -773,7 +773,7 @@ static void vdec_vp9_deinit(unsigned long h_vdec)vp9_free_inst (inst); } -static int vdec_vp9_init (struct mtk_vcodec_ctx *ctx,unsigned long *h_vdec) +static int vdec_vp9_init (struct mtk_vcodec_ctx *ctx) {struct vdec_vp9_inst *inst;@@ -797,7 +797,7 @@ static int vdec_vp9_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec) inst->vsi = (struct vdec_vp9_vsi *)inst->vpu.vsi;init_all_fb_lists (inst); - (*h_vdec) = (unsigned long )inst; + ctx->drv_handle = inst;return 0 ; err_deinit_inst:@@ -806,7 +806,7 @@ static int vdec_vp9_init(struct mtk_vcodec_ctx *ctx, unsigned long *h_vdec)return -EINVAL ; } -static int vdec_vp9_decode (unsigned long h_vdec,struct mtk_vcodec_mem *bs, +static int vdec_vp9_decode (void *h_vdec,struct mtk_vcodec_mem *bs,struct vdec_fb *fb,bool *res_chg) {int ret =0 ;@@ -963,8 +963,8 @@ static void get_crop_info(struct vdec_vp9_inst *inst, struct v4l2_rect *cr) cr->left, cr->top, cr->width, cr->height); } -static int vdec_vp9_get_param (unsigned long h_vdec, -enum vdec_get_param_type type,void *out) +static int vdec_vp9_get_param (void *h_vdec,enum vdec_get_param_type type, +void *out) {struct vdec_vp9_inst *inst = (struct vdec_vp9_inst *)h_vdec;int ret =0 ;drivers/media/platform/mtk-vcodec/vdec_drv_base.h +4
-4@@ -13,7 +13,7 @@ struct vdec_common_if {* @ctx : [in] mtk v4l2 context * @h_vdec : [out] driver handle */ -int (*init)(struct mtk_vcodec_ctx *ctx,unsigned long *h_vdec); +int (*init)(struct mtk_vcodec_ctx *ctx);/** * (*decode)() - trigger decode @@ -22,7 +22,7 @@ struct vdec_common_if {* @fb : [in] frame buffer to store decoded frame * @res_chg : [out] resolution change happen */ -int (*decode)(unsigned long h_vdec,struct mtk_vcodec_mem *bs, +int (*decode)(void *h_vdec,struct mtk_vcodec_mem *bs,struct vdec_fb *fb,bool *res_chg);/** @@ -31,14 +31,14 @@ struct vdec_common_if {* @type : [in] input parameter type * @out : [out] buffer to store query result */ -int (*get_param)(unsigned long h_vdec,enum vdec_get_param_type type, +int (*get_param)(void *h_vdec,enum vdec_get_param_type type,void *out);/** * (*deinit)() - deinitialize driver. * @h_vdec : [in] driver handle to be deinit */ - void (*deinit)(unsigned long h_vdec); + void (*deinit)(void *h_vdec); };#endif drivers/media/platform/mtk-vcodec/vdec_drv_if.c +1
-1@@ -34,7 +34,7 @@ int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)mtk_vdec_lock (ctx);mtk_vcodec_dec_clock_on (&ctx->dev->pm); - ret = ctx->dec_if->init (ctx, &ctx->drv_handle); + ret = ctx->dec_if->init (ctx);mtk_vcodec_dec_clock_off (&ctx->dev->pm);mtk_vdec_unlock (ctx);drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c +5
-5@@ -452,7 +452,7 @@ static void h264_encode_filler(struct venc_h264_inst *inst, void *buf,memset (p,0xff , size); } -static int h264_enc_init (struct mtk_vcodec_ctx *ctx,unsigned long *handle) +static int h264_enc_init (struct mtk_vcodec_ctx *ctx) {int ret =0 ;struct venc_h264_inst *inst;@@ -478,12 +478,12 @@ static int h264_enc_init(struct mtk_vcodec_ctx *ctx, unsigned long *handle)if (ret)kfree (inst);else - (*handle) = (unsigned long )inst; + ctx->drv_handle = inst;return ret; } -static int h264_enc_encode(unsigned long handle, +static int h264_enc_encode(void *handle, enum venc_start_opt opt, struct venc_frm_buf *frm_buf, struct mtk_vcodec_mem *bs_buf,@@ -578,7 +578,7 @@ static int h264_enc_encode(unsigned long handle,return ret; } -static int h264_enc_set_param (unsigned long handle, +static int h264_enc_set_param (void *handle,enum venc_set_param_type type,struct venc_enc_param *enc_prm) {@@ -631,7 +631,7 @@ static int h264_enc_set_param(unsigned long handle,return ret; } -static int h264_enc_deinit (unsigned long handle) +static int h264_enc_deinit (void *handle) {int ret =0 ;struct venc_h264_inst *inst = (struct venc_h264_inst *)handle;drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c +5
-5@@ -318,7 +318,7 @@ static int vp8_enc_encode_frame(struct venc_vp8_inst *inst,return ret; } -static int vp8_enc_init (struct mtk_vcodec_ctx *ctx,unsigned long *handle) +static int vp8_enc_init (struct mtk_vcodec_ctx *ctx) {int ret =0 ;struct venc_vp8_inst *inst;@@ -344,12 +344,12 @@ static int vp8_enc_init(struct mtk_vcodec_ctx *ctx, unsigned long *handle)if (ret)kfree (inst);else - (*handle) = (unsigned long )inst; + ctx->drv_handle = inst;return ret; } -static int vp8_enc_encode(unsigned long handle, +static int vp8_enc_encode(void *handle, enum venc_start_opt opt, struct venc_frm_buf *frm_buf, struct mtk_vcodec_mem *bs_buf,@@ -386,7 +386,7 @@ static int vp8_enc_encode(unsigned long handle,return ret; } -static int vp8_enc_set_param (unsigned long handle, +static int vp8_enc_set_param (void *handle,enum venc_set_param_type type,struct venc_enc_param *enc_prm) {@@ -437,7 +437,7 @@ static int vp8_enc_set_param(unsigned long handle,return ret; } -static int vp8_enc_deinit (unsigned long handle) +static int vp8_enc_deinit (void *handle) {int ret =0 ;struct venc_vp8_inst *inst = (struct venc_vp8_inst *)handle;drivers/media/platform/mtk-vcodec/venc_drv_base.h +4
-4@@ -13,7 +13,7 @@ struct venc_common_if {* @ctx: [in] mtk v4l2 context * @handle: [out] driver handle */ -int (*init)(struct mtk_vcodec_ctx *ctx,unsigned long *handle); +int (*init)(struct mtk_vcodec_ctx *ctx);/** * (*encode)() - trigger encode @@ -23,7 +23,7 @@ struct venc_common_if {* @bs_buf: [in] bitstream buffer to store output bitstream * @result: [out] encode result */ -int (*encode)(unsigned long handle,enum venc_start_opt opt, +int (*encode)(void *handle,enum venc_start_opt opt,struct venc_frm_buf *frm_buf,struct mtk_vcodec_mem *bs_buf,struct venc_done_result *result);@@ -34,14 +34,14 @@ struct venc_common_if {* @type: [in] parameter type * @in: [in] buffer to store the parameter */ -int (*set_param)(unsigned long handle,enum venc_set_param_type type, +int (*set_param)(void *handle,enum venc_set_param_type type,struct venc_enc_param *in);/** * (*deinit)() - deinitialize driver. * @handle: [in] driver handle */ - int (*deinit)(unsigned long handle); + int (*deinit)(void *handle); };#endif drivers/media/platform/mtk-vcodec/venc_drv_if.c +0
-0
drivers/media/platform/mtk-vcodec/venc_drv_if.c int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc) · line 37
Quoted 8 lines
drivers/media/platform/mtk-vcodec/venc_drv_if.c +1
-1@@ -31,7 +31,7 @@ int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)mtk_venc_lock (ctx);mtk_vcodec_enc_clock_on (&ctx->dev->pm); - ret = ctx->enc_if->init (ctx, (unsigned long *)&ctx->drv_handle); + ret = ctx->enc_if->init (ctx);mtk_vcodec_enc_clock_off (&ctx->dev->pm);mtk_venc_unlock (ctx);
Thanks,
Mauro
PATCH 3/5 media: mtk-vcodec: remove unneeded proxy functions
In reply to Alexandre CourbotWe were getting the codec interface through a proxy function that does not bring anything compared to just accessing the interface definition directly, so just do that. Also make the decoder interfaces const.
--- .../media/platform/mtk-vcodec/vdec/vdec_h264_if.c | 9 +-------- drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c | 9 +-------- drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c | 9 +-------- drivers/media/platform/mtk-vcodec/vdec_drv_if.c | 12 ++++++------ .../media/platform/mtk-vcodec/venc/venc_h264_if.c | 9 +-------- drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c | 9 +-------- drivers/media/platform/mtk-vcodec/venc_drv_if.c | 8 ++++---- 7 files changed, 15 insertions(+), 50 deletions(-)
drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c +1 -8
@@ -481,16 +481,9 @@ static int vdec_h264_get_param(void *h_vdec, enum vdec_get_param_type type,return 0 ; } -static struct vdec_common_if vdec_h264_if = { +const struct vdec_common_if vdec_h264_if = { .init = vdec_h264_init, .decode = vdec_h264_decode, .get_param = vdec_h264_get_param, .deinit = vdec_h264_deinit, }; - -struct vdec_common_if *get_h264_dec_comm_if (void ); - -struct vdec_common_if *get_h264_dec_comm_if (void ) -{ -return &vdec_h264_if; -}
drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c +1 -8
@@ -605,16 +605,9 @@ static void vdec_vp8_deinit(void *h_vdec)kfree (inst); } -static struct vdec_common_if vdec_vp8_if = { +const struct vdec_common_if vdec_vp8_if = { .init = vdec_vp8_init, .decode = vdec_vp8_decode, .get_param = vdec_vp8_get_param, .deinit = vdec_vp8_deinit, }; - -struct vdec_common_if *get_vp8_dec_comm_if (void ); - -struct vdec_common_if *get_vp8_dec_comm_if (void ) -{ -return &vdec_vp8_if; -}
drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c +1 -8
@@ -994,16 +994,9 @@ static int vdec_vp9_get_param(void *h_vdec, enum vdec_get_param_type type,return ret; } -static struct vdec_common_if vdec_vp9_if = { +const struct vdec_common_if vdec_vp9_if = { .init = vdec_vp9_init, .decode = vdec_vp9_decode, .get_param = vdec_vp9_get_param, .deinit = vdec_vp9_deinit, }; - -struct vdec_common_if *get_vp9_dec_comm_if (void ); - -struct vdec_common_if *get_vp9_dec_comm_if (void ) -{ -return &vdec_vp9_if; -}
drivers/media/platform/mtk-vcodec/vdec_drv_if.c +6 -6
@@ -10,9 +10,9 @@#include "mtk_vcodec_dec_pm.h" #include "mtk_vpu.h" -const struct vdec_common_if *get_h264_dec_comm_if (void ); -const struct vdec_common_if *get_vp8_dec_comm_if (void ); -const struct vdec_common_if *get_vp9_dec_comm_if (void ); +extern const struct vdec_common_if vdec_h264_if; +extern const struct vdec_common_if vdec_vp8_if; +extern const struct vdec_common_if vdec_vp9_if;int vdec_if_init (struct mtk_vcodec_ctx *ctx,unsigned int fourcc) {
@@ -20,13 +20,13 @@ int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)switch (fourcc) {case V4L2_PIX_FMT_H264 : - ctx->dec_if =get_h264_dec_comm_if (); + ctx->dec_if = &vdec_h264_if;break ;case V4L2_PIX_FMT_VP8 : - ctx->dec_if =get_vp8_dec_comm_if (); + ctx->dec_if = &vdec_vp8_if;break ;case V4L2_PIX_FMT_VP9 : - ctx->dec_if =get_vp9_dec_comm_if (); + ctx->dec_if = &vdec_vp9_if;break ;default :return -EINVAL ;
drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c +1 -8
@@ -649,16 +649,9 @@ static int h264_enc_deinit(void *handle)return ret; } -static const struct venc_common_if venc_h264_if = { +const struct venc_common_if venc_h264_if = { .init = h264_enc_init, .encode = h264_enc_encode, .set_param = h264_enc_set_param, .deinit = h264_enc_deinit, }; - -const struct venc_common_if *get_h264_enc_comm_if (void ); - -const struct venc_common_if *get_h264_enc_comm_if (void ) -{ -return &venc_h264_if; -}
drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c +1 -8
@@ -455,16 +455,9 @@ static int vp8_enc_deinit(void *handle)return ret; } -static const struct venc_common_if venc_vp8_if = { +const struct venc_common_if venc_vp8_if = { .init = vp8_enc_init, .encode = vp8_enc_encode, .set_param = vp8_enc_set_param, .deinit = vp8_enc_deinit, }; - -const struct venc_common_if *get_vp8_enc_comm_if (void ); - -const struct venc_common_if *get_vp8_enc_comm_if (void ) -{ -return &venc_vp8_if; -}
drivers/media/platform/mtk-vcodec/venc_drv_if.c +4 -4
@@ -11,8 +11,8 @@#include "mtk_vcodec_enc_pm.h" #include "mtk_vpu.h" -const struct venc_common_if *get_h264_enc_comm_if (void ); -const struct venc_common_if *get_vp8_enc_comm_if (void ); +extern const struct venc_common_if venc_h264_if; +extern const struct venc_common_if venc_vp8_if;int venc_if_init (struct mtk_vcodec_ctx *ctx,unsigned int fourcc) {
@@ -20,10 +20,10 @@ int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)switch (fourcc) {case V4L2_PIX_FMT_VP8 : - ctx->enc_if =get_vp8_enc_comm_if (); + ctx->enc_if = &venc_vp8_if;break ;case V4L2_PIX_FMT_H264 : - ctx->enc_if =get_h264_enc_comm_if (); + ctx->enc_if = &venc_h264_if;break ;default :return -EINVAL ;
Signature · 1 line
2.22.0.rc1.311.g5d7573a151-goog
Re: [PATCH 3/5] media: mtk-vcodec: remove unneeded proxy functions
Quoted 164 lines · Alexandre Courbot
We were getting the codec interface through a proxy function that does not bring anything compared to just accessing the interface definition directly, so just do that. Also make the decoder interfaces const.
Signed-off-by Alexandre Courbot <[email protected]>--- .../media/platform/mtk-vcodec/vdec/vdec_h264_if.c | 9 +-------- drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c | 9 +-------- drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c | 9 +-------- drivers/media/platform/mtk-vcodec/vdec_drv_if.c | 12 ++++++------ .../media/platform/mtk-vcodec/venc/venc_h264_if.c | 9 +-------- drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c | 9 +-------- drivers/media/platform/mtk-vcodec/venc_drv_if.c | 8 ++++---- 7 files changed, 15 insertions(+), 50 deletions(-)drivers/media/platform/mtk-vcodec/vdec/vdec_h264_if.c +1
-8@@ -481,16 +481,9 @@ static int vdec_h264_get_param(void *h_vdec, enum vdec_get_param_type type,return 0 ; } -static struct vdec_common_if vdec_h264_if = { +const struct vdec_common_if vdec_h264_if = { .init = vdec_h264_init, .decode = vdec_h264_decode, .get_param = vdec_h264_get_param, .deinit = vdec_h264_deinit, }; - -struct vdec_common_if *get_h264_dec_comm_if (void ); - -struct vdec_common_if *get_h264_dec_comm_if (void ) -{ -return &vdec_h264_if; -}drivers/media/platform/mtk-vcodec/vdec/vdec_vp8_if.c +1
-8@@ -605,16 +605,9 @@ static void vdec_vp8_deinit(void *h_vdec)kfree (inst); } -static struct vdec_common_if vdec_vp8_if = { +const struct vdec_common_if vdec_vp8_if = { .init = vdec_vp8_init, .decode = vdec_vp8_decode, .get_param = vdec_vp8_get_param, .deinit = vdec_vp8_deinit, }; - -struct vdec_common_if *get_vp8_dec_comm_if (void ); - -struct vdec_common_if *get_vp8_dec_comm_if (void ) -{ -return &vdec_vp8_if; -}drivers/media/platform/mtk-vcodec/vdec/vdec_vp9_if.c +1
-8@@ -994,16 +994,9 @@ static int vdec_vp9_get_param(void *h_vdec, enum vdec_get_param_type type,return ret; } -static struct vdec_common_if vdec_vp9_if = { +const struct vdec_common_if vdec_vp9_if = { .init = vdec_vp9_init, .decode = vdec_vp9_decode, .get_param = vdec_vp9_get_param, .deinit = vdec_vp9_deinit, }; - -struct vdec_common_if *get_vp9_dec_comm_if (void ); - -struct vdec_common_if *get_vp9_dec_comm_if (void ) -{ -return &vdec_vp9_if; -}drivers/media/platform/mtk-vcodec/vdec_drv_if.c +6
-6@@ -10,9 +10,9 @@#include "mtk_vcodec_dec_pm.h" #include "mtk_vpu.h" -const struct vdec_common_if *get_h264_dec_comm_if (void ); -const struct vdec_common_if *get_vp8_dec_comm_if (void ); -const struct vdec_common_if *get_vp9_dec_comm_if (void ); +extern const struct vdec_common_if vdec_h264_if; +extern const struct vdec_common_if vdec_vp8_if; +extern const struct vdec_common_if vdec_vp9_if;int vdec_if_init (struct mtk_vcodec_ctx *ctx,unsigned int fourcc) {@@ -20,13 +20,13 @@ int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)switch (fourcc) {case V4L2_PIX_FMT_H264 : - ctx->dec_if =get_h264_dec_comm_if (); + ctx->dec_if = &vdec_h264_if;break ;case V4L2_PIX_FMT_VP8 : - ctx->dec_if =get_vp8_dec_comm_if (); + ctx->dec_if = &vdec_vp8_if;break ;case V4L2_PIX_FMT_VP9 : - ctx->dec_if =get_vp9_dec_comm_if (); + ctx->dec_if = &vdec_vp9_if;break ;default :return -EINVAL ;drivers/media/platform/mtk-vcodec/venc/venc_h264_if.c +1
-8@@ -649,16 +649,9 @@ static int h264_enc_deinit(void *handle)return ret; } -static const struct venc_common_if venc_h264_if = { +const struct venc_common_if venc_h264_if = { .init = h264_enc_init, .encode = h264_enc_encode, .set_param = h264_enc_set_param, .deinit = h264_enc_deinit, }; - -const struct venc_common_if *get_h264_enc_comm_if (void ); - -const struct venc_common_if *get_h264_enc_comm_if (void ) -{ -return &venc_h264_if; -}drivers/media/platform/mtk-vcodec/venc/venc_vp8_if.c +1
-8@@ -455,16 +455,9 @@ static int vp8_enc_deinit(void *handle)return ret; } -static const struct venc_common_if venc_vp8_if = { +const struct venc_common_if venc_vp8_if = { .init = vp8_enc_init, .encode = vp8_enc_encode, .set_param = vp8_enc_set_param, .deinit = vp8_enc_deinit, }; - -const struct venc_common_if *get_vp8_enc_comm_if (void ); - -const struct venc_common_if *get_vp8_enc_comm_if (void ) -{ -return &venc_vp8_if; -}drivers/media/platform/mtk-vcodec/venc_drv_if.c +0
-0
drivers/media/platform/mtk-vcodec/venc_drv_if.c line 15
Quoted 7 lines
drivers/media/platform/mtk-vcodec/venc_drv_if.c +2
-2@@ -11,8 +11,8 @@#include "mtk_vcodec_enc_pm.h" #include "mtk_vpu.h" -const struct venc_common_if *get_h264_enc_comm_if (void ); -const struct venc_common_if *get_vp8_enc_comm_if (void ); +extern const struct venc_common_if venc_h264_if; +extern const struct venc_common_if venc_vp8_if;
This should be moved to a header. checkpatch gives me:
Applying: media: mtk-vcodec: remove unneeded proxy functions
WARNING: externs should be avoided in .c files
#79: FILE: drivers/media/platform/mtk-vcodec/vdec_drv_if.c:14:
+extern const struct vdec_common_if vdec_vp8_if;
WARNING: externs should be avoided in .c files
#80: FILE: drivers/media/platform/mtk-vcodec/vdec_drv_if.c:15:
+extern const struct vdec_common_if vdec_vp9_if;
WARNING: externs should be avoided in .c files
#156: FILE: drivers/media/platform/mtk-vcodec/venc_drv_if.c:15:
+extern const struct venc_common_if venc_vp8_if;
And I agree with checkpatch here.
I'll drop this patch from the series, but I'll take the others.
Regards,
Hans
Quoted 17 lines
drivers/media/platform/mtk-vcodec/venc_drv_if.c +2
-2int venc_if_init (struct mtk_vcodec_ctx *ctx,unsigned int fourcc) {@@ -20,10 +20,10 @@ int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)switch (fourcc) {case V4L2_PIX_FMT_VP8 : - ctx->enc_if =get_vp8_enc_comm_if (); + ctx->enc_if = &venc_vp8_if;break ;case V4L2_PIX_FMT_H264 : - ctx->enc_if =get_h264_enc_comm_if (); + ctx->enc_if = &venc_h264_if;break ;default :return -EINVAL ;
PATCH 4/5 media: mtk-vcodec: constify formats
In reply to Alexandre CourbotFormats are read-only internal memory structures, so make them const.
--- .../platform/mtk-vcodec/mtk_vcodec_dec.c | 19 ++++++++++--------- .../platform/mtk-vcodec/mtk_vcodec_drv.h | 2 +- .../platform/mtk-vcodec/mtk_vcodec_enc.c | 19 ++++++++++--------- 3 files changed, 21 insertions(+), 19 deletions(-)
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c +10 -9
@@ -19,7 +19,7 @@#define DFT_CFG_WIDTH MTK_VDEC_MIN_W#define DFT_CFG_HEIGHT MTK_VDEC_MIN_H -static struct mtk_video_fmt mtk_video_formats[] = { +static const struct mtk_video_fmt mtk_video_formats[] = { { .fourcc =V4L2_PIX_FMT_H264 , .type =MTK_FMT_DEC ,
@@ -63,9 +63,9 @@ static const struct mtk_codec_framesizes mtk_vdec_framesizes[] = {#define NUM_SUPPORTED_FRAMESIZE ARRAY_SIZE(mtk_vdec_framesizes)#define NUM_FORMATS ARRAY_SIZE(mtk_video_formats) -static struct mtk_video_fmt *mtk_vdec_find_format (struct v4l2_format *f) +static const struct mtk_video_fmt *mtk_vdec_find_format (struct v4l2_format *f) { -struct mtk_video_fmt *fmt; +const struct mtk_video_fmt *fmt;unsigned int k;for (k =0 ; k <NUM_FORMATS ; k++) {
@@ -266,7 +266,7 @@ static void mtk_vdec_flush_decoder(struct mtk_vcodec_ctx *ctx)static void mtk_vdec_update_fmt (struct mtk_vcodec_ctx *ctx,unsigned int pixelformat) { -struct mtk_video_fmt *fmt; +const struct mtk_video_fmt *fmt;struct mtk_q_data *dst_q_data;unsigned int k;
@@ -639,7 +639,8 @@ static int vidioc_vdec_subscribe_evt(struct v4l2_fh *fh, } } -static int vidioc_try_fmt (struct v4l2_format *f,struct mtk_video_fmt *fmt) +static int vidioc_try_fmt (struct v4l2_format *f, +const struct mtk_video_fmt *fmt) {struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;int i;
@@ -712,7 +713,7 @@ static int vidioc_try_fmt(struct v4l2_format *f, struct mtk_video_fmt *fmt)static int vidioc_try_fmt_vid_cap_mplane (struct file *file,void *priv,struct v4l2_format *f) { -struct mtk_video_fmt *fmt; +const struct mtk_video_fmt *fmt; fmt =mtk_vdec_find_format (f);if (!fmt) {
@@ -727,7 +728,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv, struct v4l2_format *f) {struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; -struct mtk_video_fmt *fmt; +const struct mtk_video_fmt *fmt; fmt =mtk_vdec_find_format (f);if (!fmt) {
@@ -821,7 +822,7 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv,struct v4l2_pix_format_mplane *pix_mp;struct mtk_q_data *q_data;int ret =0 ; -struct mtk_video_fmt *fmt; +const struct mtk_video_fmt *fmt;mtk_v4l2_debug (3 ,"[%d]" , ctx->id);
@@ -920,7 +921,7 @@ static int vidioc_enum_framesizes(struct file *file, void *priv,static int vidioc_enum_fmt (struct v4l2_fmtdesc *f,bool output_queue) { -struct mtk_video_fmt *fmt; +const struct mtk_video_fmt *fmt;int i, j =0 ;for (i =0 ; i <NUM_FORMATS ; i++) {
drivers/media/platform/mtk-vcodec/mtk_vcodec_drv.h +1 -1
@@ -124,7 +124,7 @@ struct mtk_q_data {enum v4l2_field field;unsigned int bytesperline[MTK_VCODEC_MAX_PLANES ];unsigned int sizeimage[MTK_VCODEC_MAX_PLANES ]; -struct mtk_video_fmt *fmt; +const struct mtk_video_fmt *fmt; };/**
drivers/media/platform/mtk-vcodec/mtk_vcodec_enc.c +10 -9
@@ -24,7 +24,7 @@static void mtk_venc_worker (struct work_struct *work); -static struct mtk_video_fmt mtk_video_formats[] = { +static const struct mtk_video_fmt mtk_video_formats[] = { { .fourcc =V4L2_PIX_FMT_NV12M , .type =MTK_FMT_FRAME ,
@@ -153,7 +153,7 @@ static const struct v4l2_ctrl_ops mtk_vcodec_enc_ctrl_ops = {static int vidioc_enum_fmt (struct v4l2_fmtdesc *f,bool output_queue) { -struct mtk_video_fmt *fmt; +const struct mtk_video_fmt *fmt;int i, j =0 ;for (i =0 ; i <NUM_FORMATS ; ++i) {
@@ -261,9 +261,9 @@ static struct mtk_q_data *mtk_venc_get_q_data(struct mtk_vcodec_ctx *ctx,return &ctx->q_data[MTK_Q_DATA_DST ]; } -static struct mtk_video_fmt *mtk_venc_find_format (struct v4l2_format *f) +static const struct mtk_video_fmt *mtk_venc_find_format (struct v4l2_format *f) { -struct mtk_video_fmt *fmt; +const struct mtk_video_fmt *fmt;unsigned int k;for (k =0 ; k <NUM_FORMATS ; k++) {
@@ -278,7 +278,8 @@ static struct mtk_video_fmt *mtk_venc_find_format(struct v4l2_format *f)/* V4L2 specification suggests the driver corrects the format struct if any of * the dimensions is unsupported */ -static int vidioc_try_fmt (struct v4l2_format *f,struct mtk_video_fmt *fmt) +static int vidioc_try_fmt (struct v4l2_format *f, +const struct mtk_video_fmt *fmt) {struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;int i;
@@ -414,7 +415,7 @@ static int vidioc_venc_s_fmt_cap(struct file *file, void *priv,struct vb2_queue *vq;struct mtk_q_data *q_data;int i, ret; -struct mtk_video_fmt *fmt; +const struct mtk_video_fmt *fmt; vq =v4l2_m2m_get_vq (ctx->m2m_ctx, f->type);if (!vq) {
@@ -476,7 +477,7 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv,struct vb2_queue *vq;struct mtk_q_data *q_data;int ret, i; -struct mtk_video_fmt *fmt; +const struct mtk_video_fmt *fmt;struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp; vq =v4l2_m2m_get_vq (ctx->m2m_ctx, f->type);
@@ -575,7 +576,7 @@ static int vidioc_venc_g_fmt(struct file *file, void *priv,static int vidioc_try_fmt_vid_cap_mplane (struct file *file,void *priv,struct v4l2_format *f) { -struct mtk_video_fmt *fmt; +const struct mtk_video_fmt *fmt;struct mtk_vcodec_ctx *ctx =fh_to_ctx (priv); fmt =mtk_venc_find_format (f);
@@ -594,7 +595,7 @@ static int vidioc_try_fmt_vid_cap_mplane(struct file *file, void *priv,static int vidioc_try_fmt_vid_out_mplane (struct file *file,void *priv,struct v4l2_format *f) { -struct mtk_video_fmt *fmt; +const struct mtk_video_fmt *fmt; fmt =mtk_venc_find_format (f);if (!fmt) {
Signature · 1 line
2.22.0.rc1.311.g5d7573a151-goog
PATCH 5/5 media: mtk-vcodec: support single-buffer frames
In reply to Alexandre CourbotFrom: Yunfei Dong <[email protected]>
MT8183 will use a multi-planar format backed by a single buffer. Adapt the existing code to be able to handle such frames instead of assuming each frame is backed by two buffers.
--- drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/media/platform/mtk-vcodec/mtk_vcodec_dec.c +7 -4
@@ -117,8 +117,9 @@ static struct vb2_buffer *get_display_buffer(struct mtk_vcodec_ctx *ctx)if (dstbuf->used) {vb2_set_plane_payload (&dstbuf->vb.vb2_buf,0 , ctx->picinfo.fb_sz[0 ]); -vb2_set_plane_payload (&dstbuf->vb.vb2_buf,1 , - ctx->picinfo.fb_sz[1 ]); +if (ctx->q_data[MTK_Q_DATA_DST ].fmt->num_planes ==2 ) +vb2_set_plane_payload (&dstbuf->vb.vb2_buf,1 , + ctx->picinfo.fb_sz[1 ]); mtk_v4l2_debug(2, "[%d]status=%x queue id=%d to done_list %d",
@@ -389,7 +390,8 @@ static void mtk_vdec_worker(struct work_struct *work)vdec_if_decode (ctx,NULL ,NULL , &res_chg);clean_display_buffer (ctx);vb2_set_plane_payload (&dst_buf_info->vb.vb2_buf,0 ,0 ); -vb2_set_plane_payload (&dst_buf_info->vb.vb2_buf,1 ,0 ); +if (ctx->q_data[MTK_Q_DATA_DST ].fmt->num_planes ==2 ) +vb2_set_plane_payload (&dst_buf_info->vb.vb2_buf,1 ,0 ); dst_buf->flags |=V4L2_BUF_FLAG_LAST ;v4l2_m2m_buf_done (&dst_buf_info->vb,VB2_BUF_STATE_DONE );clean_free_buffer (ctx);
@@ -1320,7 +1322,8 @@ static void vb2ops_vdec_stop_streaming(struct vb2_queue *q)while ((dst_buf =v4l2_m2m_dst_buf_remove (ctx->m2m_ctx))) {vb2_set_plane_payload (&dst_buf->vb2_buf,0 ,0 ); -vb2_set_plane_payload (&dst_buf->vb2_buf,1 ,0 ); +if (ctx->q_data[MTK_Q_DATA_DST ].fmt->num_planes ==2 ) +vb2_set_plane_payload (&dst_buf->vb2_buf,1 ,0 );v4l2_m2m_buf_done (dst_buf,VB2_BUF_STATE_ERROR ); }
Signature · 1 line
2.22.0.rc1.311.g5d7573a151-goog