media: mediatek: vcodec: separate decoder and encoder

Move all decoder files to folder decoder.
Move all encoder files to folder encoder.
Move common files which shared for encoder and decoder to folder common.

Change include header files and Makefile to fix build error.

Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
Yunfei Dong 2023-07-29 10:55:14 +08:00 committed by Mauro Carvalho Chehab
parent 183b0b4bd1
commit 0934d37596
59 changed files with 118 additions and 110 deletions

View File

@ -1,54 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-dec.o \
mtk-vcodec-enc.o \
mtk-vcodec-common.o \
mtk-vcodec-dec-hw.o
mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
vdec/vdec_vp8_if.o \
vdec/vdec_vp8_req_if.o \
vdec/vdec_vp9_if.o \
vdec/vdec_vp9_req_lat_if.o \
vdec/vdec_av1_req_lat_if.o \
vdec/vdec_h264_req_if.o \
vdec/vdec_h264_req_common.o \
vdec/vdec_h264_req_multi_if.o \
vdec/vdec_hevc_req_multi_if.o \
mtk_vcodec_dec_drv.o \
vdec_drv_if.o \
vdec_vpu_if.o \
vdec_msg_queue.o \
mtk_vcodec_dec.o \
mtk_vcodec_dec_stateful.o \
mtk_vcodec_dec_stateless.o \
mtk_vcodec_dec_pm.o \
mtk-vcodec-dec-hw-y := mtk_vcodec_dec_hw.o
mtk-vcodec-enc-y := venc/venc_vp8_if.o \
venc/venc_h264_if.o \
mtk_vcodec_enc.o \
mtk_vcodec_enc_drv.o \
mtk_vcodec_enc_pm.o \
venc_drv_if.o \
venc_vpu_if.o \
mtk-vcodec-common-y := mtk_vcodec_intr.o \
mtk_vcodec_util.o \
mtk_vcodec_fw.o \
ifneq ($(CONFIG_VIDEO_MEDIATEK_VCODEC_VPU),)
mtk-vcodec-common-y += mtk_vcodec_fw_vpu.o
endif
ifneq ($(CONFIG_VIDEO_MEDIATEK_VCODEC_SCP),)
mtk-vcodec-common-y += mtk_vcodec_fw_scp.o
endif
ifneq ($(CONFIG_DEBUG_FS),)
obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-dbgfs.o
mtk-vcodec-dbgfs-y := mtk_vcodec_dbgfs.o
endif
obj-y += common/
obj-y += encoder/
obj-y += decoder/

View File

@ -0,0 +1,21 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-common.o
mtk-vcodec-common-y := mtk_vcodec_intr.o \
mtk_vcodec_util.o \
mtk_vcodec_fw.o \
ifneq ($(CONFIG_VIDEO_MEDIATEK_VCODEC_VPU),)
mtk-vcodec-common-y += mtk_vcodec_fw_vpu.o
endif
ifneq ($(CONFIG_VIDEO_MEDIATEK_VCODEC_SCP),)
mtk-vcodec-common-y += mtk_vcodec_fw_scp.o
endif
ifneq ($(CONFIG_DEBUG_FS),)
obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-dbgfs.o
mtk-vcodec-dbgfs-y := mtk_vcodec_dbgfs.o
endif

View File

@ -7,8 +7,8 @@
#include <linux/debugfs.h>
#include "mtk_vcodec_dbgfs.h"
#include "mtk_vcodec_dec_drv.h"
#include "mtk_vcodec_enc_drv.h"
#include "../decoder/mtk_vcodec_dec_drv.h"
#include "../encoder/mtk_vcodec_enc_drv.h"
#include "mtk_vcodec_util.h"
static void mtk_vdec_dbgfs_get_format_type(struct mtk_vcodec_dec_ctx *ctx, char *buf,

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "mtk_vcodec_dec_drv.h"
#include "mtk_vcodec_enc_drv.h"
#include "../decoder/mtk_vcodec_dec_drv.h"
#include "../encoder/mtk_vcodec_enc_drv.h"
#include "mtk_vcodec_fw_priv.h"
struct mtk_vcodec_fw *mtk_vcodec_fw_select(void *priv, enum mtk_vcodec_fw_type type,

View File

@ -6,7 +6,7 @@
#include <linux/remoteproc.h>
#include <linux/remoteproc/mtk_scp.h>
#include "../vpu/mtk_vpu.h"
#include "../../vpu/mtk_vpu.h"
struct mtk_vcodec_dec_dev;
struct mtk_vcodec_enc_dev;

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "mtk_vcodec_dec_drv.h"
#include "mtk_vcodec_enc_drv.h"
#include "../decoder/mtk_vcodec_dec_drv.h"
#include "../encoder/mtk_vcodec_enc_drv.h"
#include "mtk_vcodec_fw_priv.h"
static int mtk_vcodec_scp_load_firmware(struct mtk_vcodec_fw *fw)

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "mtk_vcodec_dec_drv.h"
#include "mtk_vcodec_enc_drv.h"
#include "../decoder/mtk_vcodec_dec_drv.h"
#include "../encoder/mtk_vcodec_enc_drv.h"
#include "mtk_vcodec_fw_priv.h"
static int mtk_vcodec_vpu_load_firmware(struct mtk_vcodec_fw *fw)

View File

@ -7,8 +7,8 @@
#include <linux/errno.h>
#include <linux/wait.h>
#include "mtk_vcodec_dec_drv.h"
#include "mtk_vcodec_enc_drv.h"
#include "../decoder/mtk_vcodec_dec_drv.h"
#include "../encoder/mtk_vcodec_enc_drv.h"
#include "mtk_vcodec_intr.h"
int mtk_vcodec_wait_for_done_ctx(void *priv, int command, unsigned int timeout_ms,

View File

@ -9,9 +9,9 @@
#include <linux/of.h>
#include <linux/regmap.h>
#include "mtk_vcodec_dec_drv.h"
#include "mtk_vcodec_enc_drv.h"
#include "mtk_vcodec_dec_hw.h"
#include "../decoder/mtk_vcodec_dec_drv.h"
#include "../encoder/mtk_vcodec_enc_drv.h"
#include "../decoder/mtk_vcodec_dec_hw.h"
#if defined(CONFIG_DEBUG_FS)
int mtk_vcodec_dbg;

View File

@ -62,28 +62,6 @@ extern int mtk_vcodec_dbg;
dev_dbg(&(plat_dev)->dev, "[MTK_VCODEC][%d]: " fmt "\n", inst_id, ##args)
#endif
#define mtk_vdec_err(ctx, fmt, args...) \
mtk_vcodec_err((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args)
#define mtk_vdec_debug(ctx, fmt, args...) \
mtk_vcodec_debug((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args)
#define mtk_venc_err(ctx, fmt, args...) \
mtk_vcodec_err((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args)
#define mtk_venc_debug(ctx, fmt, args...) \
mtk_vcodec_debug((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args)
#define mtk_v4l2_vdec_err(ctx, fmt, args...) mtk_v4l2_err((ctx)->dev->plat_dev, fmt, ##args)
#define mtk_v4l2_vdec_dbg(level, ctx, fmt, args...) \
mtk_v4l2_debug((ctx)->dev->plat_dev, level, fmt, ##args)
#define mtk_v4l2_venc_err(ctx, fmt, args...) mtk_v4l2_err((ctx)->dev->plat_dev, fmt, ##args)
#define mtk_v4l2_venc_dbg(level, ctx, fmt, args...) \
mtk_v4l2_debug((ctx)->dev->plat_dev, level, fmt, ##args)
void __iomem *mtk_vcodec_get_reg_addr(void __iomem **reg_base, unsigned int reg_idx);
int mtk_vcodec_write_vdecsys(struct mtk_vcodec_dec_ctx *ctx, unsigned int reg, unsigned int val);
int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem);

View File

@ -0,0 +1,25 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-dec.o \
mtk-vcodec-dec-hw.o
mtk-vcodec-dec-y := vdec/vdec_h264_if.o \
vdec/vdec_vp8_if.o \
vdec/vdec_vp8_req_if.o \
vdec/vdec_vp9_if.o \
vdec/vdec_vp9_req_lat_if.o \
vdec/vdec_av1_req_lat_if.o \
vdec/vdec_h264_req_if.o \
vdec/vdec_h264_req_common.o \
vdec/vdec_h264_req_multi_if.o \
vdec/vdec_hevc_req_multi_if.o \
mtk_vcodec_dec_drv.o \
vdec_drv_if.o \
vdec_vpu_if.o \
vdec_msg_queue.o \
mtk_vcodec_dec.o \
mtk_vcodec_dec_stateful.o \
mtk_vcodec_dec_stateless.o \
mtk_vcodec_dec_pm.o \
mtk-vcodec-dec-hw-y := mtk_vcodec_dec_hw.o

View File

@ -24,7 +24,7 @@
#include "mtk_vcodec_dec.h"
#include "mtk_vcodec_dec_hw.h"
#include "mtk_vcodec_dec_pm.h"
#include "mtk_vcodec_intr.h"
#include "../common/mtk_vcodec_intr.h"
static int mtk_vcodec_get_hw_count(struct mtk_vcodec_dec_ctx *ctx, struct mtk_vcodec_dec_dev *dev)
{

View File

@ -7,10 +7,10 @@
#ifndef _MTK_VCODEC_DEC_DRV_H_
#define _MTK_VCODEC_DEC_DRV_H_
#include "mtk_vcodec_cmn_drv.h"
#include "mtk_vcodec_dbgfs.h"
#include "mtk_vcodec_fw_priv.h"
#include "mtk_vcodec_util.h"
#include "../common/mtk_vcodec_cmn_drv.h"
#include "../common/mtk_vcodec_dbgfs.h"
#include "../common/mtk_vcodec_fw_priv.h"
#include "../common/mtk_vcodec_util.h"
#include "vdec_msg_queue.h"
#define MTK_VCODEC_DEC_NAME "mtk-vcodec-dec"
@ -303,4 +303,15 @@ wake_up_dec_ctx(struct mtk_vcodec_dec_ctx *ctx, unsigned int reason, unsigned in
wake_up_interruptible(&ctx->queue[hw_id]);
}
#define mtk_vdec_err(ctx, fmt, args...) \
mtk_vcodec_err((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args)
#define mtk_vdec_debug(ctx, fmt, args...) \
mtk_vcodec_debug((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args)
#define mtk_v4l2_vdec_err(ctx, fmt, args...) mtk_v4l2_err((ctx)->dev->plat_dev, fmt, ##args)
#define mtk_v4l2_vdec_dbg(level, ctx, fmt, args...) \
mtk_v4l2_debug((ctx)->dev->plat_dev, level, fmt, ##args)
#endif /* _MTK_VCODEC_DEC_DRV_H_ */

View File

@ -15,7 +15,7 @@
#include "mtk_vcodec_dec.h"
#include "mtk_vcodec_dec_hw.h"
#include "mtk_vcodec_dec_pm.h"
#include "mtk_vcodec_intr.h"
#include "../common/mtk_vcodec_intr.h"
static const struct of_device_id mtk_vdec_hw_match[] = {
{

View File

@ -9,7 +9,7 @@
#include <media/videobuf2-dma-contig.h>
#include "../mtk_vcodec_dec.h"
#include "../mtk_vcodec_intr.h"
#include "../../common/mtk_vcodec_intr.h"
#include "../vdec_drv_base.h"
#include "../vdec_drv_if.h"
#include "../vdec_vpu_if.h"

View File

@ -9,7 +9,7 @@
#include "../vdec_drv_if.h"
#include "../mtk_vcodec_dec.h"
#include "../mtk_vcodec_intr.h"
#include "../../common/mtk_vcodec_intr.h"
#include "../vdec_vpu_if.h"
#include "../vdec_drv_base.h"

View File

@ -7,7 +7,7 @@
#include <media/videobuf2-dma-contig.h>
#include "../mtk_vcodec_dec.h"
#include "../mtk_vcodec_intr.h"
#include "../../common/mtk_vcodec_intr.h"
#include "../vdec_drv_base.h"
#include "../vdec_drv_if.h"
#include "../vdec_vpu_if.h"

View File

@ -11,7 +11,7 @@
#include <media/videobuf2-dma-contig.h>
#include "../mtk_vcodec_dec.h"
#include "../mtk_vcodec_intr.h"
#include "../../common/mtk_vcodec_intr.h"
#include "../vdec_drv_base.h"
#include "../vdec_drv_if.h"
#include "../vdec_vpu_if.h"

View File

@ -9,7 +9,7 @@
#include <media/videobuf2-dma-contig.h>
#include "../mtk_vcodec_dec.h"
#include "../mtk_vcodec_intr.h"
#include "../../common/mtk_vcodec_intr.h"
#include "../vdec_drv_base.h"
#include "../vdec_drv_if.h"
#include "../vdec_vpu_if.h"

View File

@ -8,7 +8,7 @@
#include <linux/slab.h>
#include "../vdec_drv_if.h"
#include "../mtk_vcodec_dec.h"
#include "../mtk_vcodec_intr.h"
#include "../../common/mtk_vcodec_intr.h"
#include "../vdec_vpu_if.h"
#include "../vdec_drv_base.h"

View File

@ -10,7 +10,7 @@
#include <uapi/linux/v4l2-controls.h>
#include "../mtk_vcodec_dec.h"
#include "../mtk_vcodec_intr.h"
#include "../../common/mtk_vcodec_intr.h"
#include "../vdec_drv_base.h"
#include "../vdec_drv_if.h"
#include "../vdec_vpu_if.h"

View File

@ -12,7 +12,7 @@
#include <linux/delay.h>
#include <linux/time.h>
#include "../mtk_vcodec_intr.h"
#include "../../common/mtk_vcodec_intr.h"
#include "../vdec_drv_base.h"
#include "../vdec_vpu_if.h"

View File

@ -10,7 +10,7 @@
#include <media/v4l2-vp9.h>
#include "../mtk_vcodec_dec.h"
#include "../mtk_vcodec_intr.h"
#include "../../common/mtk_vcodec_intr.h"
#include "../vdec_drv_base.h"
#include "../vdec_drv_if.h"
#include "../vdec_vpu_if.h"

View File

@ -0,0 +1,11 @@
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_VIDEO_MEDIATEK_VCODEC) += mtk-vcodec-enc.o
mtk-vcodec-enc-y := venc/venc_vp8_if.o \
venc/venc_h264_if.o \
mtk_vcodec_enc.o \
mtk_vcodec_enc_drv.o \
mtk_vcodec_enc_pm.o \
venc_drv_if.o \
venc_vpu_if.o \

View File

@ -18,7 +18,7 @@
#include "mtk_vcodec_enc.h"
#include "mtk_vcodec_enc_pm.h"
#include "mtk_vcodec_intr.h"
#include "../common/mtk_vcodec_intr.h"
static const struct mtk_video_fmt mtk_video_formats_output[] = {
{

View File

@ -7,10 +7,10 @@
#ifndef _MTK_VCODEC_ENC_DRV_H_
#define _MTK_VCODEC_ENC_DRV_H_
#include "mtk_vcodec_cmn_drv.h"
#include "mtk_vcodec_dbgfs.h"
#include "mtk_vcodec_fw_priv.h"
#include "mtk_vcodec_util.h"
#include "../common/mtk_vcodec_cmn_drv.h"
#include "../common/mtk_vcodec_dbgfs.h"
#include "../common/mtk_vcodec_fw_priv.h"
#include "../common/mtk_vcodec_util.h"
#define MTK_VCODEC_ENC_NAME "mtk-vcodec-enc"
@ -232,4 +232,15 @@ wake_up_enc_ctx(struct mtk_vcodec_enc_ctx *ctx, unsigned int reason, unsigned in
wake_up_interruptible(&ctx->queue[hw_id]);
}
#define mtk_venc_err(ctx, fmt, args...) \
mtk_vcodec_err((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args)
#define mtk_venc_debug(ctx, fmt, args...) \
mtk_vcodec_debug((ctx)->id, (ctx)->dev->plat_dev, fmt, ##args)
#define mtk_v4l2_venc_err(ctx, fmt, args...) mtk_v4l2_err((ctx)->dev->plat_dev, fmt, ##args)
#define mtk_v4l2_venc_dbg(level, ctx, fmt, args...) \
mtk_v4l2_debug((ctx)->dev->plat_dev, level, fmt, ##args)
#endif /* _MTK_VCODEC_ENC_DRV_H_ */

View File

@ -11,7 +11,7 @@
#include <linux/slab.h>
#include "../mtk_vcodec_enc_drv.h"
#include "../mtk_vcodec_intr.h"
#include "../../common/mtk_vcodec_intr.h"
#include "../mtk_vcodec_enc.h"
#include "../mtk_vcodec_enc_pm.h"
#include "../venc_drv_base.h"

View File

@ -10,7 +10,7 @@
#include <linux/slab.h>
#include "../mtk_vcodec_enc_drv.h"
#include "../mtk_vcodec_intr.h"
#include "../../common/mtk_vcodec_intr.h"
#include "../mtk_vcodec_enc.h"
#include "../mtk_vcodec_enc_pm.h"
#include "../venc_drv_base.h"