media: mediatek: vcodec: separate encoder and decoder
Subsystems (3)
Yunfei Dong
maintainerv4 cover media: mediatek: vcodec: separate encoder and decoder
With the driver more and more complex, encoder and decoder need to add more parameter in shared struct 'mtk_vcodec_ctx' and 'mtk_vcodec_dev'. Encoder use about 40% and decoder use 60% parameter. Need to allocate extra unused memory when encoder and decoder working.
Separate encoder and decoder in different folder and use independent data struct.
patch 1 remove unused parameter.
patch 2~3 align fw and interrupt related interface.
patch 4~6 remove the dependency of debug log
patch 7~8 separate mtk_vcodec_ctx and mtk_vcodec_dev
patch 9 fix unreasonable parameter
patch 10 removed unused header files
patch 11 separate encoder and decoder in different folder
---
Changed from v3:
- re-write commit message for patch 3.
Changed from v2:
- This patch main changed:
1: add different macro mtk_dec_debug and mtk_enc_debug calling common
macro mtk_vcodec_debug in order to use dev_dbg instead of pr_debug.
2: add different macro mtk_v4l2_venc_dbg and mtk_v4l2_vdec_dbg calling common
macro in order to use dev_dbg instead of pr_debug.
Changed from v1:
- Change pr_dbg to dev_dbg for mtk_v4l2_level and mtk_vcodec_dbg for patch 4.
- Change pr_err to dev_err for mtk_v4l2_err and mtk_vcodec_err for patch 5.
- Fix unreasonable parameter for patch 8.
---
Yunfei Dong (11):
media: mediatek: vcodec: remove unused parameter
media: mediatek: vcodec: align fw interface
media: mediatek: vcodec: Removing struct 'mtk_vcodec_ctx/dev' for
shared interface
media: mediatek: vcodec: Removing useless debug log
media: mediatek: vcodec: remove the dependency of vcodec debug log
media: mediatek: vcodec: replace pr_* with dev_* for v4l2 debug
message
media: mediatek: vcodec: separate struct 'mtk_vcodec_ctx'
media: mediatek: vcodec: separate struct mtk_vcodec_dev
media: mediatek: vcodec: fix unreasonable parameter definition and
style
media: mediatek: vcodec: remove unused include header
media: mediatek: vcodec: separete decoder and encoder
.../media/platform/mediatek/vcodec/Makefile | 55 +-
.../platform/mediatek/vcodec/common/Makefile | 21 +
.../vcodec/common/mtk_vcodec_com_drv.h | 147 +++++
.../vcodec/{ => common}/mtk_vcodec_dbgfs.c | 57 +-
.../vcodec/{ => common}/mtk_vcodec_dbgfs.h | 24 +-
.../vcodec/{ => common}/mtk_vcodec_fw.c | 21 +-
.../vcodec/{ => common}/mtk_vcodec_fw.h | 8 +-
.../vcodec/{ => common}/mtk_vcodec_fw_priv.h | 14 +-
.../vcodec/{ => common}/mtk_vcodec_fw_scp.c | 26 +-
.../vcodec/{ => common}/mtk_vcodec_fw_vpu.c | 64 +-
.../mediatek/vcodec/common/mtk_vcodec_intr.c | 68 +++
.../vcodec/{ => common}/mtk_vcodec_intr.h | 6 +-
.../vcodec/{ => common}/mtk_vcodec_util.c | 67 +--
.../mediatek/vcodec/common/mtk_vcodec_util.h | 70 +++
.../platform/mediatek/vcodec/decoder/Makefile | 25 +
.../vcodec/{ => decoder}/mtk_vcodec_dec.c | 182 +++---
.../vcodec/{ => decoder}/mtk_vcodec_dec.h | 10 +-
.../vcodec/{ => decoder}/mtk_vcodec_dec_drv.c | 84 ++-
.../vcodec/decoder/mtk_vcodec_dec_drv.h | 317 ++++++++++
.../vcodec/{ => decoder}/mtk_vcodec_dec_hw.c | 19 +-
.../vcodec/{ => decoder}/mtk_vcodec_dec_hw.h | 6 +-
.../vcodec/{ => decoder}/mtk_vcodec_dec_pm.c | 38 +-
.../vcodec/{ => decoder}/mtk_vcodec_dec_pm.h | 6 +-
.../{ => decoder}/mtk_vcodec_dec_stateful.c | 176 +++---
.../{ => decoder}/mtk_vcodec_dec_stateless.c | 91 +--
.../{ => decoder}/vdec/vdec_av1_req_lat_if.c | 158 +++--
.../vcodec/{ => decoder}/vdec/vdec_h264_if.c | 79 ++-
.../{ => decoder}/vdec/vdec_h264_req_common.c | 4 +-
.../{ => decoder}/vdec/vdec_h264_req_common.h | 6 +-
.../{ => decoder}/vdec/vdec_h264_req_if.c | 75 ++-
.../vdec/vdec_h264_req_multi_if.c | 157 +++--
.../vdec/vdec_hevc_req_multi_if.c | 129 ++---
.../vcodec/{ => decoder}/vdec/vdec_vp8_if.c | 70 +--
.../{ => decoder}/vdec/vdec_vp8_req_if.c | 81 ++-
.../vcodec/{ => decoder}/vdec/vdec_vp9_if.c | 132 ++---
.../{ => decoder}/vdec/vdec_vp9_req_lat_if.c | 129 ++---
.../vcodec/{ => decoder}/vdec_drv_base.h | 2 +-
.../vcodec/{ => decoder}/vdec_drv_if.c | 12 +-
.../vcodec/{ => decoder}/vdec_drv_if.h | 10 +-
.../vcodec/{ => decoder}/vdec_ipi_msg.h | 0
.../vcodec/{ => decoder}/vdec_msg_queue.c | 64 +-
.../vcodec/{ => decoder}/vdec_msg_queue.h | 14 +-
.../vcodec/{ => decoder}/vdec_vpu_if.c | 57 +-
.../vcodec/{ => decoder}/vdec_vpu_if.h | 6 +-
.../platform/mediatek/vcodec/encoder/Makefile | 11 +
.../vcodec/{ => encoder}/mtk_vcodec_enc.c | 296 +++++-----
.../vcodec/{ => encoder}/mtk_vcodec_enc.h | 12 +-
.../vcodec/{ => encoder}/mtk_vcodec_enc_drv.c | 73 +--
.../vcodec/encoder/mtk_vcodec_enc_drv.h | 256 ++++++++
.../vcodec/{ => encoder}/mtk_vcodec_enc_pm.c | 12 +-
.../vcodec/{ => encoder}/mtk_vcodec_enc_pm.h | 4 +-
.../vcodec/{ => encoder}/venc/venc_h264_if.c | 110 ++--
.../vcodec/{ => encoder}/venc/venc_vp8_if.c | 69 +--
.../vcodec/{ => encoder}/venc_drv_base.h | 4 +-
.../vcodec/{ => encoder}/venc_drv_if.c | 10 +-
.../vcodec/{ => encoder}/venc_drv_if.h | 11 +-
.../vcodec/{ => encoder}/venc_ipi_msg.h | 0
.../vcodec/{ => encoder}/venc_vpu_if.c | 75 +--
.../vcodec/{ => encoder}/venc_vpu_if.h | 3 +-
.../platform/mediatek/vcodec/mtk_vcodec_drv.h | 548 ------------------
.../mediatek/vcodec/mtk_vcodec_intr.c | 43 --
.../mediatek/vcodec/mtk_vcodec_util.h | 83 ---
62 files changed, 2224 insertions(+), 2183 deletions(-)
create mode 100644 drivers/media/platform/mediatek/vcodec/common/Makefile
create mode 100644 drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_com_drv.h
rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_dbgfs.c (76%)
rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_dbgfs.h (62%)
rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_fw.c (75%)
rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_fw.h (86%)
rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_fw_priv.h (75%)
rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_fw_scp.c (70%)
rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_fw_vpu.c (58%)
create mode 100644 drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_intr.c
rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_intr.h (68%)
rename drivers/media/platform/mediatek/vcodec/{ => common}/mtk_vcodec_util.c (55%)
create mode 100644 drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_util.h
create mode 100644 drivers/media/platform/mediatek/vcodec/decoder/Makefile
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec.c (83%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec.h (91%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec_drv.c (83%)
create mode 100644 drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.h
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec_hw.c (91%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec_hw.h (92%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec_pm.c (81%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec_pm.h (61%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec_stateful.c (73%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/mtk_vcodec_dec_stateless.c (84%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_av1_req_lat_if.c (93%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_h264_if.c (84%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_h264_req_common.c (98%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_h264_req_common.h (97%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_h264_req_if.c (86%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_h264_req_multi_if.c (85%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_hevc_req_multi_if.c (90%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_vp8_if.c (87%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_vp8_req_if.c (81%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_vp9_if.c (87%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec/vdec_vp9_req_lat_if.c (94%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_drv_base.h (95%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_drv_if.c (86%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_drv_if.h (89%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_ipi_msg.h (100%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_msg_queue.c (82%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_msg_queue.h (95%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_vpu_if.c (79%)
rename drivers/media/platform/mediatek/vcodec/{ => decoder}/vdec_vpu_if.h (97%)
create mode 100644 drivers/media/platform/mediatek/vcodec/encoder/Makefile
rename drivers/media/platform/mediatek/vcodec/{ => encoder}/mtk_vcodec_enc.c (82%)
rename drivers/media/platform/mediatek/vcodec/{ => encoder}/mtk_vcodec_enc.h (78%)
rename drivers/media/platform/mediatek/vcodec/{ => encoder}/mtk_vcodec_enc_drv.c (86%)
create mode 100644 drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.h
rename drivers/media/platform/mediatek/vcodec/{ => encoder}/mtk_vcodec_enc_pm.c (83%)
rename drivers/media/platform/mediatek/vcodec/{ => encoder}/mtk_vcodec_enc_pm.h (78%)
rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc/venc_h264_if.c (88%)
rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc/venc_vp8_if.c (88%)
rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc_drv_base.h (94%)
rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc_drv_if.c (86%)
rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc_drv_if.h (94%)
rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc_ipi_msg.h (100%)
rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc_vpu_if.c (82%)
rename drivers/media/platform/mediatek/vcodec/{ => encoder}/venc_vpu_if.h (96%)
delete mode 100644 drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h
delete mode 100644 drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c
delete mode 100644 drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.hSignature · 1 line
2.18.0
Yunfei Dong
maintainerPATCH v4 1/11 media: mediatek: vcodec: remove unused parameter
remove unused parameter in struct mtk_vcodec_dev.
--- drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c | 2 -- drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h | 6 ------ drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c | 2 -- 3 files changed, 10 deletions(-)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +0 -2
@@ -336,8 +336,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev) goto err_core_workq; } -init_waitqueue_head (&dev->queue); - vfd_dec =video_device_alloc ();if (!vfd_dec) {mtk_v4l2_err ("Failed to allocate video device" );
drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h +0 -6
@@ -448,10 +448,7 @@ struct mtk_vcodec_enc_pdata {* @decode_workqueue: decode work queue * @encode_workqueue: encode work queue * -* @int_cond: used to identify interrupt condition happen -* @int_type: used to identify what kind of interrupt condition happen * @dev_mutex: video_device lock -* @queue: waitqueue for waiting for completion of device commands * * @dec_irq: decoder irq resource * @enc_irq: h264 encoder irq resource
@@ -496,10 +493,7 @@ struct mtk_vcodec_dev {struct workqueue_struct *decode_workqueue;struct workqueue_struct *encode_workqueue; -int int_cond; -int int_type;struct mutex dev_mutex; -wait_queue_head_t queue;int dec_irq;int enc_irq;
drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c +0 -2
@@ -311,8 +311,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev) goto err_res; } -init_waitqueue_head (&dev->queue); -/* allocate video device for encoder and register it */ vfd_enc =video_device_alloc ();if (!vfd_enc) {
Signature · 1 line
2.18.0
Yunfei Dong
maintainerPATCH v4 2/11 media: mediatek: vcodec: align fw interface
In reply to Yunfei DongAlign scp and vpu firmware interface, remove the depedency for 'struct mtk_vcodec_dev' and 'struct mtk_vcodec_ctx'. It will be much easier to separate video encoder and decoder.
--- .../media/platform/mediatek/vcodec/mtk_vcodec_fw.c | 7 +++---- .../media/platform/mediatek/vcodec/mtk_vcodec_fw.h | 3 +-- .../platform/mediatek/vcodec/mtk_vcodec_fw_priv.h | 11 +++++------ .../platform/mediatek/vcodec/mtk_vcodec_fw_scp.c | 9 ++++++--- .../platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c | 12 ++++++++---- 5 files changed, 23 insertions(+), 19 deletions(-)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c +3 -4
@@ -5,15 +5,14 @@#include "mtk_vcodec_util.h" #include "mtk_vcodec_drv.h" -struct mtk_vcodec_fw *mtk_vcodec_fw_select (struct mtk_vcodec_dev *dev, -enum mtk_vcodec_fw_type type, +struct mtk_vcodec_fw *mtk_vcodec_fw_select (void *priv,enum mtk_vcodec_fw_type type,enum mtk_vcodec_fw_use fw_use) {switch (type) {case VPU : -return mtk_vcodec_fw_vpu_init (dev, fw_use); +return mtk_vcodec_fw_vpu_init (priv, fw_use);case SCP : -return mtk_vcodec_fw_scp_init (dev); +return mtk_vcodec_fw_scp_init (priv, fw_use);default :mtk_v4l2_err ("invalid vcodec fw type" );return ERR_PTR (-EINVAL );
drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.h +1 -2
@@ -25,8 +25,7 @@ struct mtk_vcodec_fw;typedef void (*mtk_vcodec_ipi_handler ) (void *data,unsigned int len,void *priv); -struct mtk_vcodec_fw *mtk_vcodec_fw_select (struct mtk_vcodec_dev *dev, -enum mtk_vcodec_fw_type type, +struct mtk_vcodec_fw *mtk_vcodec_fw_select (void *priv,enum mtk_vcodec_fw_type type,enum mtk_vcodec_fw_use fw_use);void mtk_vcodec_fw_release (struct mtk_vcodec_fw *fw);
drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_priv.h +5 -6
@@ -12,6 +12,7 @@ struct mtk_vcodec_fw {const struct mtk_vcodec_fw_ops *ops;struct platform_device *pdev;struct mtk_scp *scp; +enum mtk_vcodec_fw_use fw_use; };struct mtk_vcodec_fw_ops {
@@ -28,22 +29,20 @@ struct mtk_vcodec_fw_ops { };#if IS_ENABLED (CONFIG_VIDEO_MEDIATEK_VCODEC_VPU ) -struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init (struct mtk_vcodec_dev *dev, -enum mtk_vcodec_fw_use fw_use); +struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init (void *priv,enum mtk_vcodec_fw_use fw_use);#else static inline struct mtk_vcodec_fw * -mtk_vcodec_fw_vpu_init (struct mtk_vcodec_dev *dev, -enum mtk_vcodec_fw_use fw_use) +mtk_vcodec_fw_vpu_init (void *priv,enum mtk_vcodec_fw_use fw_use) {return ERR_PTR (-ENODEV ); }#endif /* CONFIG_VIDEO_MEDIATEK_VCODEC_VPU */ #if IS_ENABLED (CONFIG_VIDEO_MEDIATEK_VCODEC_SCP ) -struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init (struct mtk_vcodec_dev *dev); +struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init (void *priv,enum mtk_vcodec_fw_use fw_use);#else static inline struct mtk_vcodec_fw * -mtk_vcodec_fw_scp_init (struct mtk_vcodec_dev *dev) +mtk_vcodec_fw_scp_init (void *priv,enum mtk_vcodec_fw_use fw_use) {return ERR_PTR (-ENODEV ); }
drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c +6 -3
@@ -53,18 +53,21 @@ static const struct mtk_vcodec_fw_ops mtk_vcodec_rproc_msg = { .release = mtk_vcodec_scp_release, }; -struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init (struct mtk_vcodec_dev *dev) +struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init (void *priv,enum mtk_vcodec_fw_use fw_use) {struct mtk_vcodec_fw *fw; +struct mtk_vcodec_dev *dev = priv; +struct platform_device *plat_dev;struct mtk_scp *scp; - scp =scp_get (dev->plat_dev); + plat_dev = dev->plat_dev; + scp =scp_get (plat_dev);if (!scp) {mtk_v4l2_err ("could not get vdec scp handle" );return ERR_PTR (-EPROBE_DEFER ); } - fw =devm_kzalloc (&dev->plat_dev->dev,sizeof (*fw),GFP_KERNEL ); + fw =devm_kzalloc (&plat_dev->dev,sizeof (*fw),GFP_KERNEL ); fw->type =SCP ; fw->ops = &mtk_vcodec_rproc_msg; fw->scp = scp;
drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c +8 -4
@@ -77,10 +77,11 @@ static const struct mtk_vcodec_fw_ops mtk_vcodec_vpu_msg = { .release = mtk_vcodec_vpu_release, }; -struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init (struct mtk_vcodec_dev *dev, -enum mtk_vcodec_fw_use fw_use) +struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init (void *priv,enum mtk_vcodec_fw_use fw_use) {struct platform_device *fw_pdev; +struct mtk_vcodec_dev *dev = priv; +struct platform_device *plat_dev;struct mtk_vcodec_fw *fw;enum rst_id rst_id;
@@ -94,19 +95,22 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(struct mtk_vcodec_dev *dev,break ; } - fw_pdev =vpu_get_plat_device (dev->plat_dev); + plat_dev = dev->plat_dev; + fw_pdev =vpu_get_plat_device (plat_dev);if (!fw_pdev) {mtk_v4l2_err ("firmware device is not ready" );return ERR_PTR (-EINVAL ); } +vpu_wdt_reg_handler (fw_pdev, mtk_vcodec_vpu_reset_handler, dev, rst_id); - fw =devm_kzalloc (&dev->plat_dev->dev,sizeof (*fw),GFP_KERNEL ); + fw =devm_kzalloc (&plat_dev->dev,sizeof (*fw),GFP_KERNEL );if (!fw)return ERR_PTR (-ENOMEM ); fw->type =VPU ; fw->ops = &mtk_vcodec_vpu_msg; fw->pdev = fw_pdev; + fw->fw_use = fw_use;return fw; }
Signature · 1 line
2.18.0
Yunfei Dong
maintainerPATCH v4 3/11 media: mediatek: vcodec: Removing struct 'mtk_vcodec_ctx/dev' for shared interface
In reply to Yunfei DongThe shared struct 'mtk_vcodec_ctx/dev' will be changed to 'mtk_vcodec_enc_ctx/dev' and 'mtk_vcodec_dec_ctx/dev' in order to separate encoder and decoder. Removing common struct 'mtk_vcodec_ctx/dev' for shared interface which encoder and decoder used at the same time. Then encoder and decoder can call the same interface independently.
--- .../mediatek/vcodec/mtk_vcodec_intr.c | 30 ++++++++++++------- .../mediatek/vcodec/mtk_vcodec_intr.h | 3 +- .../mediatek/vcodec/mtk_vcodec_util.c | 19 +++++------- .../mediatek/vcodec/mtk_vcodec_util.h | 9 ++---- .../mediatek/vcodec/vdec/vdec_vp8_if.c | 14 ++++----- .../mediatek/vcodec/venc/venc_h264_if.c | 2 +- .../mediatek/vcodec/venc/venc_vp8_if.c | 2 +- 7 files changed, 39 insertions(+), 40 deletions(-)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c +19 -11
@@ -11,32 +11,40 @@#include "mtk_vcodec_intr.h" #include "mtk_vcodec_util.h" -int mtk_vcodec_wait_for_done_ctx (struct mtk_vcodec_ctx *ctx, -int command,unsigned int timeout_ms, +int mtk_vcodec_wait_for_done_ctx (void *priv,int command,unsigned int timeout_ms,unsigned int hw_id) { +struct mtk_vcodec_ctx *ctx = priv;long timeout_jiff, ret; -int status =0 ; +int status =0 , ctx_id, ctx_type; +int *ctx_int_cond, *ctx_int_type; +wait_queue_head_t *ctx_queue; + + ctx_id = ctx->id; + ctx_type = ctx->type; + ctx_int_cond = ctx->int_cond; + ctx_int_type = ctx->int_type; + ctx_queue = ctx->queue; timeout_jiff =msecs_to_jiffies (timeout_ms); - ret =wait_event_interruptible_timeout (ctx->queue[hw_id], - ctx->int_cond[hw_id], + ret =wait_event_interruptible_timeout (ctx_queue[hw_id], + ctx_int_cond[hw_id], timeout_jiff);if (!ret) { status =-1 ;/* timeout */ mtk_v4l2_err ("[%d] cmd=%d, type=%d, dec timeout=%ums (%d %d)" , - ctx->id, command, ctx->type, timeout_ms, - ctx->int_cond[hw_id], ctx->int_type[hw_id]); + ctx_id, command, ctx_type, timeout_ms, + ctx_int_cond[hw_id], ctx_int_type[hw_id]); }else if (-ERESTARTSYS == ret) { status =-1 ;mtk_v4l2_err ("[%d] cmd=%d, type=%d, dec inter fail (%d %d)" , - ctx->id, command, ctx->type, - ctx->int_cond[hw_id], ctx->int_type[hw_id]); + ctx_id, command, ctx_type, + ctx_int_cond[hw_id], ctx_int_type[hw_id]); } - ctx->int_cond[hw_id] =0 ; - ctx->int_type[hw_id] =0 ; + ctx_int_cond[hw_id] =0 ; + ctx_int_type[hw_id] =0 ;return status; }
drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.h +1 -2
@@ -12,8 +12,7 @@struct mtk_vcodec_ctx ;/* timeout is ms */ -int mtk_vcodec_wait_for_done_ctx (struct mtk_vcodec_ctx *ctx, -int command,unsigned int timeout_ms, +int mtk_vcodec_wait_for_done_ctx (void *priv,int command,unsigned int timeout_ms,unsigned int hw_id);#endif /* _MTK_VCODEC_INTR_H_ */
drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c +7 -12
@@ -21,24 +21,20 @@ int mtk_v4l2_dbg_level;EXPORT_SYMBOL (mtk_v4l2_dbg_level);#endif -void __iomem *mtk_vcodec_get_reg_addr (struct mtk_vcodec_ctx *data, -unsigned int reg_idx) +void __iomem *mtk_vcodec_get_reg_addr (void __iomem **reg_base,unsigned int reg_idx) { -struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; - -if (!data || reg_idx >=NUM_MAX_VCODEC_REG_BASE ) { +if (reg_idx >=NUM_MAX_VCODEC_REG_BASE ) {mtk_v4l2_err ("Invalid arguments, reg_idx=%d" , reg_idx);return NULL ; } -return ctx->dev->reg_base[reg_idx]; +return reg_base[reg_idx]; }EXPORT_SYMBOL (mtk_vcodec_get_reg_addr); -int mtk_vcodec_mem_alloc (struct mtk_vcodec_ctx *data, -struct mtk_vcodec_mem *mem) +int mtk_vcodec_mem_alloc (void *priv,struct mtk_vcodec_mem *mem) {unsigned long size = mem->size; -struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; +struct mtk_vcodec_ctx *ctx = priv;struct device *dev = &ctx->dev->plat_dev->dev; mem->va =dma_alloc_coherent (dev, size, &mem->dma_addr,GFP_KERNEL );
@@ -57,11 +53,10 @@ int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx *data, }EXPORT_SYMBOL (mtk_vcodec_mem_alloc); -void mtk_vcodec_mem_free (struct mtk_vcodec_ctx *data, -struct mtk_vcodec_mem *mem) +void mtk_vcodec_mem_free (void *priv,struct mtk_vcodec_mem *mem) {unsigned long size = mem->size; -struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; +struct mtk_vcodec_ctx *ctx = priv;struct device *dev = &ctx->dev->plat_dev->dev;if (!mem->va) {
drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +3 -6
@@ -68,12 +68,9 @@ extern int mtk_vcodec_dbg;#define mtk_vcodec_debug_enter (h) mtk_vcodec_debug(h, "+")#define mtk_vcodec_debug_leave (h) mtk_vcodec_debug(h, "-") -void __iomem *mtk_vcodec_get_reg_addr (struct mtk_vcodec_ctx *data, -unsigned int reg_idx); -int mtk_vcodec_mem_alloc (struct mtk_vcodec_ctx *data, -struct mtk_vcodec_mem *mem); -void mtk_vcodec_mem_free (struct mtk_vcodec_ctx *data, -struct mtk_vcodec_mem *mem); +void __iomem *mtk_vcodec_get_reg_addr (void __iomem **reg_base,unsigned int reg_idx); +int mtk_vcodec_mem_alloc (void *priv,struct mtk_vcodec_mem *mem); +void mtk_vcodec_mem_free (void *priv,struct mtk_vcodec_mem *mem);void mtk_vcodec_set_curr_ctx (struct mtk_vcodec_dev *vdec_dev,struct mtk_vcodec_ctx *ctx,int hw_idx); struct mtk_vcodec_ctx *mtk_vcodec_get_curr_ctx(struct mtk_vcodec_dev *vdec_dev,
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +7 -7
@@ -167,13 +167,13 @@ struct vdec_vp8_inst {static void get_hw_reg_base (struct vdec_vp8_inst *inst) { - inst->reg_base.top =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_TOP ); - inst->reg_base.cm =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_CM ); - inst->reg_base.hwd =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_HWD ); - inst->reg_base.sys =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_SYS ); - inst->reg_base.misc =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_MISC ); - inst->reg_base.ld =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_LD ); - inst->reg_base.hwb =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_HWB ); + inst->reg_base.top =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VDEC_TOP ); + inst->reg_base.cm =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VDEC_CM ); + inst->reg_base.hwd =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VDEC_HWD ); + inst->reg_base.sys =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VDEC_SYS ); + inst->reg_base.misc =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VDEC_MISC ); + inst->reg_base.ld =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VDEC_LD ); + inst->reg_base.hwb =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VDEC_HWB ); }static void write_hw_segmentation_data (struct vdec_vp8_inst *inst)
drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c +1 -1
@@ -612,7 +612,7 @@ static int h264_enc_init(struct mtk_vcodec_ctx *ctx) inst->ctx = ctx; inst->vpu_inst.ctx = ctx; inst->vpu_inst.id = is_ext ?SCP_IPI_VENC_H264 :IPI_VENC_H264 ; - inst->hw_base =mtk_vcodec_get_reg_addr (inst->ctx,VENC_SYS ); + inst->hw_base =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VENC_SYS );mtk_vcodec_debug_enter (inst);
drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c +1 -1
@@ -336,7 +336,7 @@ static int vp8_enc_init(struct mtk_vcodec_ctx *ctx) inst->ctx = ctx; inst->vpu_inst.ctx = ctx; inst->vpu_inst.id =IPI_VENC_VP8 ; - inst->hw_base =mtk_vcodec_get_reg_addr (inst->ctx,VENC_LT_SYS ); + inst->hw_base =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VENC_LT_SYS );mtk_vcodec_debug_enter (inst);
Signature · 1 line
2.18.0
Re: [PATCH v4,03/11] media: mediatek: vcodec: Removing struct 'mtk_vcodec_ctx/dev' for shared interface
Le lundi 26 juin 2023 à 11:53 +0800, Yunfei Dong a écrit :
Quoted 160 lines
The shared struct 'mtk_vcodec_ctx/dev' will be changed to 'mtk_vcodec_enc_ctx/dev' and 'mtk_vcodec_dec_ctx/dev' in order to separate encoder and decoder. Removing common struct 'mtk_vcodec_ctx/dev' for shared interface which encoder and decoder used at the same time. Then encoder and decoder can call the same interface independently.
Signed-off-by Yunfei Dong <[email protected]>--- .../mediatek/vcodec/mtk_vcodec_intr.c | 30 ++++++++++++------- .../mediatek/vcodec/mtk_vcodec_intr.h | 3 +- .../mediatek/vcodec/mtk_vcodec_util.c | 19 +++++------- .../mediatek/vcodec/mtk_vcodec_util.h | 9 ++---- .../mediatek/vcodec/vdec/vdec_vp8_if.c | 14 ++++----- .../mediatek/vcodec/venc/venc_h264_if.c | 2 +- .../mediatek/vcodec/venc/venc_vp8_if.c | 2 +- 7 files changed, 39 insertions(+), 40 deletions(-)drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c +19
-11@@ -11,32 +11,40 @@#include "mtk_vcodec_intr.h" #include "mtk_vcodec_util.h" -int mtk_vcodec_wait_for_done_ctx (struct mtk_vcodec_ctx *ctx, -int command,unsigned int timeout_ms, +int mtk_vcodec_wait_for_done_ctx (void *priv,int command,unsigned int timeout_ms,unsigned int hw_id) { +struct mtk_vcodec_ctx *ctx = priv;long timeout_jiff, ret; -int status =0 ; +int status =0 , ctx_id, ctx_type; +int *ctx_int_cond, *ctx_int_type; +wait_queue_head_t *ctx_queue; + + ctx_id = ctx->id; + ctx_type = ctx->type; + ctx_int_cond = ctx->int_cond; + ctx_int_type = ctx->int_type; + ctx_queue = ctx->queue; timeout_jiff =msecs_to_jiffies (timeout_ms); - ret =wait_event_interruptible_timeout (ctx->queue[hw_id], - ctx->int_cond[hw_id], + ret =wait_event_interruptible_timeout (ctx_queue[hw_id], + ctx_int_cond[hw_id], timeout_jiff);if (!ret) { status =-1 ;/* timeout */ mtk_v4l2_err ("[%d] cmd=%d, type=%d, dec timeout=%ums (%d %d)" , - ctx->id, command, ctx->type, timeout_ms, - ctx->int_cond[hw_id], ctx->int_type[hw_id]); + ctx_id, command, ctx_type, timeout_ms, + ctx_int_cond[hw_id], ctx_int_type[hw_id]); }else if (-ERESTARTSYS == ret) { status =-1 ;mtk_v4l2_err ("[%d] cmd=%d, type=%d, dec inter fail (%d %d)" , - ctx->id, command, ctx->type, - ctx->int_cond[hw_id], ctx->int_type[hw_id]); + ctx_id, command, ctx_type, + ctx_int_cond[hw_id], ctx_int_type[hw_id]); } - ctx->int_cond[hw_id] =0 ; - ctx->int_type[hw_id] =0 ; + ctx_int_cond[hw_id] =0 ; + ctx_int_type[hw_id] =0 ;return status; }drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.h +1
-2@@ -12,8 +12,7 @@struct mtk_vcodec_ctx ;/* timeout is ms */ -int mtk_vcodec_wait_for_done_ctx (struct mtk_vcodec_ctx *ctx, -int command,unsigned int timeout_ms, +int mtk_vcodec_wait_for_done_ctx (void *priv,int command,unsigned int timeout_ms,unsigned int hw_id);#endif /* _MTK_VCODEC_INTR_H_ */ drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c +7
-12@@ -21,24 +21,20 @@ int mtk_v4l2_dbg_level;EXPORT_SYMBOL (mtk_v4l2_dbg_level);#endif -void __iomem *mtk_vcodec_get_reg_addr (struct mtk_vcodec_ctx *data, -unsigned int reg_idx) +void __iomem *mtk_vcodec_get_reg_addr (void __iomem **reg_base,unsigned int reg_idx) { -struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; - -if (!data || reg_idx >=NUM_MAX_VCODEC_REG_BASE ) { +if (reg_idx >=NUM_MAX_VCODEC_REG_BASE ) {mtk_v4l2_err ("Invalid arguments, reg_idx=%d" , reg_idx);return NULL ; } -return ctx->dev->reg_base[reg_idx]; +return reg_base[reg_idx]; }EXPORT_SYMBOL (mtk_vcodec_get_reg_addr); -int mtk_vcodec_mem_alloc (struct mtk_vcodec_ctx *data, -struct mtk_vcodec_mem *mem) +int mtk_vcodec_mem_alloc (void *priv,struct mtk_vcodec_mem *mem) {unsigned long size = mem->size; -struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; +struct mtk_vcodec_ctx *ctx = priv;struct device *dev = &ctx->dev->plat_dev->dev; mem->va =dma_alloc_coherent (dev, size, &mem->dma_addr,GFP_KERNEL );@@ -57,11 +53,10 @@ int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx *data, }EXPORT_SYMBOL (mtk_vcodec_mem_alloc); -void mtk_vcodec_mem_free (struct mtk_vcodec_ctx *data, -struct mtk_vcodec_mem *mem) +void mtk_vcodec_mem_free (void *priv,struct mtk_vcodec_mem *mem) {unsigned long size = mem->size; -struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; +struct mtk_vcodec_ctx *ctx = priv;struct device *dev = &ctx->dev->plat_dev->dev;if (!mem->va) {drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +3
-6@@ -68,12 +68,9 @@ extern int mtk_vcodec_dbg;#define mtk_vcodec_debug_enter (h) mtk_vcodec_debug(h, "+")#define mtk_vcodec_debug_leave (h) mtk_vcodec_debug(h, "-") -void __iomem *mtk_vcodec_get_reg_addr (struct mtk_vcodec_ctx *data, -unsigned int reg_idx); -int mtk_vcodec_mem_alloc (struct mtk_vcodec_ctx *data, -struct mtk_vcodec_mem *mem); -void mtk_vcodec_mem_free (struct mtk_vcodec_ctx *data, -struct mtk_vcodec_mem *mem); +void __iomem *mtk_vcodec_get_reg_addr (void __iomem **reg_base,unsigned int reg_idx); +int mtk_vcodec_mem_alloc (void *priv,struct mtk_vcodec_mem *mem); +void mtk_vcodec_mem_free (void *priv,struct mtk_vcodec_mem *mem);void mtk_vcodec_set_curr_ctx (struct mtk_vcodec_dev *vdec_dev,struct mtk_vcodec_ctx *ctx,int hw_idx); struct mtk_vcodec_ctx *mtk_vcodec_get_curr_ctx(struct mtk_vcodec_dev *vdec_dev,drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +0
-0
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c struct vdec_vp8_inst { · line 169
Quoted 3 lines
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +0
-0@@ -167,13 +167,13 @@ struct vdec_vp8_inst {static void get_hw_reg_base (struct vdec_vp8_inst *inst) {
I'd like to suggest:
+ u32 reg_base = inst->ctx->dev->reg_base
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +0
-4- inst->reg_base.top =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_TOP ); - inst->reg_base.cm =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_CM ); - inst->reg_base.hwd =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_HWD ); - inst->reg_base.sys =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_SYS );
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c struct vdec_vp8_inst { · line 176
Quoted 10 lines
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +7
-3- inst->reg_base.misc =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_MISC ); - inst->reg_base.ld =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_LD ); - inst->reg_base.hwb =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_HWB ); + inst->reg_base.top =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VDEC_TOP ); + inst->reg_base.cm =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VDEC_CM ); + inst->reg_base.hwd =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VDEC_HWD ); + inst->reg_base.sys =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VDEC_SYS ); + inst->reg_base.misc =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VDEC_MISC ); + inst->reg_base.ld =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VDEC_LD ); + inst->reg_base.hwb =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VDEC_HWB );
+ inst->reg_base.top = mtk_vcodec_get_reg_addr(reg_base, VDEC_TOP);
+ inst->reg_base.cm = mtk_vcodec_get_reg_addr(reg_base, VDEC_CM);
+ inst->reg_base.hwd = mtk_vcodec_get_reg_addr(reg_base, VDEC_HWD);
+ inst->reg_base.sys = mtk_vcodec_get_reg_addr(reg_base, VDEC_SYS);
+ inst->reg_base.misc = mtk_vcodec_get_reg_addr(reg_base, VDEC_MISC);
+ inst->reg_base.ld = mtk_vcodec_get_reg_addr(reg_base, VDEC_LD);
+ inst->reg_base.hwb = mtk_vcodec_get_reg_addr(reg_base, VDEC_HWB);
With such minor stylistic change:
Quoted 29 lines
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +0
-0}static void write_hw_segmentation_data (struct vdec_vp8_inst *inst)drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c +1
-1@@ -612,7 +612,7 @@ static int h264_enc_init(struct mtk_vcodec_ctx *ctx) inst->ctx = ctx; inst->vpu_inst.ctx = ctx; inst->vpu_inst.id = is_ext ?SCP_IPI_VENC_H264 :IPI_VENC_H264 ; - inst->hw_base =mtk_vcodec_get_reg_addr (inst->ctx,VENC_SYS ); + inst->hw_base =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VENC_SYS );mtk_vcodec_debug_enter (inst);drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c +1
-1@@ -336,7 +336,7 @@ static int vp8_enc_init(struct mtk_vcodec_ctx *ctx) inst->ctx = ctx; inst->vpu_inst.ctx = ctx; inst->vpu_inst.id =IPI_VENC_VP8 ; - inst->hw_base =mtk_vcodec_get_reg_addr (inst->ctx,VENC_LT_SYS ); + inst->hw_base =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VENC_LT_SYS );mtk_vcodec_debug_enter (inst);
Yunfei Dong (董云飞)
maintainerRe: [PATCH v4,03/11] media: mediatek: vcodec: Removing struct 'mtk_vcodec_ctx/dev' for shared interface
Hi Nicolas,
Thanks for you suggestion.
Quoted 225 lines · Nicolas Dufresne
External email : Please do not click links or open attachments until you have verified the sender or the content.
Quoted 1 line · Yunfei Dong
The shared struct 'mtk_vcodec_ctx/dev' will be changed to
'mtk_vcodec_enc_ctx/dev'
Quoted 1 line
and 'mtk_vcodec_dec_ctx/dev' in order to separate encoder and
decoder. Removing
Quoted 1 line
common struct 'mtk_vcodec_ctx/dev' for shared interface which
encoder and decoder
Quoted 1 line
used at the same time. Then encoder and decoder can call the same
interface
Quoted 5 lines
independently.
Signed-off-by Yunfei Dong <[email protected]>--- .../mediatek/vcodec/mtk_vcodec_intr.c | 30 ++++++++++++-------
Quoted 9 lines
.../mediatek/vcodec/mtk_vcodec_intr.h | 3 +- .../mediatek/vcodec/mtk_vcodec_util.c | 19 +++++------- .../mediatek/vcodec/mtk_vcodec_util.h | 9 ++---- .../mediatek/vcodec/vdec/vdec_vp8_if.c | 14 ++++----- .../mediatek/vcodec/venc/venc_h264_if.c | 2 +- .../mediatek/vcodec/venc/venc_vp8_if.c | 2 +- 7 files changed, 39 insertions(+), 40 deletions(-)diff --git
a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.cb/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.cdrivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c line 14
Quoted 10 lines
index
552b4c93d972..daa44f635727100644drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c +1
-2@@ -11,32 +11,40 @@#include "mtk_vcodec_intr.h" #include "mtk_vcodec_util.h" -int mtk_vcodec_wait_for_done_ctx(struct mtk_vcodec_ctx *ctx, - int command, unsigned int timeout_ms, +int mtk_vcodec_wait_for_done_ctx(void *priv, int command, unsignedint
timeout_ms,Quoted 45 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c +18
-9unsigned int hw_id) { +struct mtk_vcodec_ctx *ctx = priv;long timeout_jiff, ret; -int status =0 ; +int status =0 , ctx_id, ctx_type; +int *ctx_int_cond, *ctx_int_type; +wait_queue_head_t *ctx_queue; + +ctx_id = ctx->id; +ctx_type = ctx->type; +ctx_int_cond = ctx->int_cond; +ctx_int_type = ctx->int_type; +ctx_queue = ctx->queue; timeout_jiff =msecs_to_jiffies (timeout_ms); -ret =wait_event_interruptible_timeout (ctx->queue[hw_id], - ctx->int_cond[hw_id], +ret =wait_event_interruptible_timeout (ctx_queue[hw_id], + ctx_int_cond[hw_id], timeout_jiff);if (!ret) { status =-1 ;/* timeout */ mtk_v4l2_err ("[%d] cmd=%d, type=%d, dec timeout=%ums (%d %d)" , - ctx->id, command, ctx->type, timeout_ms, - ctx->int_cond[hw_id], ctx->int_type[hw_id]); + ctx_id, command, ctx_type, timeout_ms, + ctx_int_cond[hw_id], ctx_int_type[hw_id]); }else if (-ERESTARTSYS == ret) { status =-1 ;mtk_v4l2_err ("[%d] cmd=%d, type=%d, dec inter fail (%d %d)" , - ctx->id, command, ctx->type, - ctx->int_cond[hw_id], ctx->int_type[hw_id]); + ctx_id, command, ctx_type, + ctx_int_cond[hw_id], ctx_int_type[hw_id]); } -ctx->int_cond[hw_id] =0 ; -ctx->int_type[hw_id] =0 ; +ctx_int_cond[hw_id] =0 ; +ctx_int_type[hw_id] =0 ;return status; }Quoted 1 line
diff --git
a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.hb/drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.hdrivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.h line 15
Quoted 10 lines
index
9681f492813b..11bf0ef94d5d100644drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.h +1
-2@@ -12,8 +12,7 @@struct mtk_vcodec_ctx ;/* timeout is ms */ -int mtk_vcodec_wait_for_done_ctx(struct mtk_vcodec_ctx *ctx, - int command, unsigned int timeout_ms, +int mtk_vcodec_wait_for_done_ctx(void *priv, int command, unsignedint
timeout_ms,Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.h +0
-0unsigned int hw_id);#endif /* _MTK_VCODEC_INTR_H_ */ diff --git
a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.cb/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.cdrivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c int mtk_v4l2_dbg_level; · line 24
Quoted 10 lines
index
f214e6f67005..847e321f4fcc100644drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c +1
-2@@ -21,24 +21,20 @@ int mtk_v4l2_dbg_level;EXPORT_SYMBOL (mtk_v4l2_dbg_level);#endif -void __iomem *mtk_vcodec_get_reg_addr (struct mtk_vcodec_ctx *data, -unsigned int reg_idx) +void __iomem *mtk_vcodec_get_reg_addr(void __iomem **reg_base,unsigned int
reg_idx)Quoted 13 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c +2
-4{ -struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; - -if (!data || reg_idx >=NUM_MAX_VCODEC_REG_BASE ) { +if (reg_idx >=NUM_MAX_VCODEC_REG_BASE ) {mtk_v4l2_err ("Invalid arguments, reg_idx=%d" , reg_idx);return NULL ; } -return ctx->dev->reg_base[reg_idx]; +return reg_base[reg_idx]; }EXPORT_SYMBOL (mtk_vcodec_get_reg_addr);drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c int mtk_v4l2_dbg_level;
Quoted 10 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c +2
-3-int mtk_vcodec_mem_alloc (struct mtk_vcodec_ctx *data, -struct mtk_vcodec_mem *mem) +int mtk_vcodec_mem_alloc (void *priv,struct mtk_vcodec_mem *mem) {unsigned long size = mem->size; -struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; +struct mtk_vcodec_ctx *ctx = priv;struct device *dev = &ctx->dev->plat_dev->dev; mem->va = dma_alloc_coherent(dev, size, &mem->dma_addr,
GFP_KERNEL);drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx
Quoted 1 line
drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c +0
-0@@ -57,11 +53,10 @@ int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx*data,
Quoted 13 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c +2
-3}EXPORT_SYMBOL (mtk_vcodec_mem_alloc); -void mtk_vcodec_mem_free (struct mtk_vcodec_ctx *data, -struct mtk_vcodec_mem *mem) +void mtk_vcodec_mem_free (void *priv,struct mtk_vcodec_mem *mem) {unsigned long size = mem->size; -struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data; +struct mtk_vcodec_ctx *ctx = priv;struct device *dev = &ctx->dev->plat_dev->dev;if (!mem->va) {Quoted 1 line
diff --git
a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.hb/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.hQuoted 4 lines
index
88d389b65f13..827937bcb4b4100644drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h extern int mtk_vcodec_dbg; · line 71
Quoted 10 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +1
-6@@ -68,12 +68,9 @@ extern int mtk_vcodec_dbg;#define mtk_vcodec_debug_enter (h) mtk_vcodec_debug(h, "+")#define mtk_vcodec_debug_leave (h) mtk_vcodec_debug(h, "-") -void __iomem *mtk_vcodec_get_reg_addr (struct mtk_vcodec_ctx *data, -unsigned int reg_idx); -int mtk_vcodec_mem_alloc (struct mtk_vcodec_ctx *data, -struct mtk_vcodec_mem *mem); -void mtk_vcodec_mem_free (struct mtk_vcodec_ctx *data, -struct mtk_vcodec_mem *mem); +void __iomem *mtk_vcodec_get_reg_addr(void __iomem **reg_base,unsigned int
reg_idx);drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h extern int mtk_vcodec_dbg;
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +2
-0+int mtk_vcodec_mem_alloc (void *priv,struct mtk_vcodec_mem *mem); +void mtk_vcodec_mem_free (void *priv,struct mtk_vcodec_mem *mem);void mtk_vcodec_set_curr_ctx (struct mtk_vcodec_dev *vdec_dev,struct mtk_vcodec_ctx *ctx,int hw_idx); struct mtk_vcodec_ctx *mtk_vcodec_get_curr_ctx(struct
mtk_vcodec_dev*vdec_dev,Quoted 1 line
diff --git
a/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.cb/drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.cdrivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c struct vdec_vp8_inst { · line 169
Quoted 7 lines
index
88c046731754..5edbccc9ae68100644drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +0
-0@@ -167,13 +167,13 @@ struct vdec_vp8_inst {static void get_hw_reg_base (struct vdec_vp8_inst *inst) {I'd like to suggest:
+u32
reg_base=inst->ctx->dev->reg_basedrivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c struct vdec_vp8_inst {
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +0
-5-inst->reg_base.top =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_TOP ); -inst->reg_base.cm =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_CM ); -inst->reg_base.hwd =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_HWD ); -inst->reg_base.sys =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_SYS ); -inst->reg_base.misc = mtk_vcodec_get_reg_addr(inst->ctx,
VDEC_MISC);Quoted 16 lines
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +4
-2-inst->reg_base.ld =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_LD ); -inst->reg_base.hwb =mtk_vcodec_get_reg_addr (inst->ctx,VDEC_HWB ); +inst->reg_base.top =mtk_vcodec_get_reg_addr (inst->ctx->dev- reg_base,VDEC_TOP ); +inst->reg_base.cm =mtk_vcodec_get_reg_addr (inst->ctx->dev- reg_base,VDEC_CM ); +inst->reg_base.hwd =mtk_vcodec_get_reg_addr (inst->ctx->dev- reg_base,VDEC_HWD ); +inst->reg_base.sys = mtk_vcodec_get_reg_addr(inst->ctx->dev-
reg_base,VDEC_SYS);
+inst->reg_base.misc =mtk_vcodec_get_reg_addr(inst->ctx->dev- reg_base, VDEC_MISC);
+inst->reg_base.ld =mtk_vcodec_get_reg_addr(inst->ctx->dev- reg_base, VDEC_LD);
+inst->reg_base.hwb =mtk_vcodec_get_reg_addr(inst->ctx->dev- reg_base, VDEC_HWB);(quoted diff) +7
-0+inst->reg_base.top = mtk_vcodec_get_reg_addr(reg_base, VDEC_TOP); +inst->reg_base.cm = mtk_vcodec_get_reg_addr(reg_base, VDEC_CM); +inst->reg_base.hwd = mtk_vcodec_get_reg_addr(reg_base, VDEC_HWD); +inst->reg_base.sys = mtk_vcodec_get_reg_addr(reg_base, VDEC_SYS); +inst->reg_base.misc = mtk_vcodec_get_reg_addr(reg_base, VDEC_MISC); +inst->reg_base.ld = mtk_vcodec_get_reg_addr(reg_base, VDEC_LD); +inst->reg_base.hwb = mtk_vcodec_get_reg_addr(reg_base, VDEC_HWB);
Quoted 4 lines
With such minor stylistic change:
Reviewed-by Nicolas Dufresne <[email protected]>
Fixed in patch v5, please help to review it again.
Best Regards,
Yunfei Dong
Quoted 38 lines
Quoted 4 lines
}
static void
write_hw_segmentation_data(struct vdec_vp8_inst *inst)
diff --git
a/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.cb/drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.cdrivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c static int h264_enc_init(struct mtk_vcodec_ctx
Quoted 4 lines
index
60fd165c0d94..10365c95ebbe100644drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c +0
-0@@ -612,7 +612,7 @@ static int h264_enc_init(struct mtk_vcodec_ctx*ctx)
drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c static int h264_enc_init(struct mtk_vcodec_ctx *ctx)
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c +1
-1inst->ctx = ctx; inst->vpu_inst.ctx = ctx; inst->vpu_inst.id = is_ext ?SCP_IPI_VENC_H264 :IPI_VENC_H264 ; -inst->hw_base =mtk_vcodec_get_reg_addr (inst->ctx,VENC_SYS ); +inst->hw_base = mtk_vcodec_get_reg_addr(inst->ctx->dev->reg_base,
VENC_SYS);Quoted 4 lines
drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c +0
-0mtk_vcodec_debug_enter (inst);diff --git
a/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.cb/drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.cdrivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c static int vp8_enc_init(struct mtk_vcodec_ctx
Quoted 4 lines
index
56ce58f761f1..73ebc35d7c99100644drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c +0
-0@@ -336,7 +336,7 @@ static int vp8_enc_init(struct mtk_vcodec_ctx*ctx)
drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c static int vp8_enc_init(struct mtk_vcodec_ctx *ctx)
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c +1
-1inst->ctx = ctx; inst->vpu_inst.ctx = ctx; inst->vpu_inst.id =IPI_VENC_VP8 ; -inst->hw_base =mtk_vcodec_get_reg_addr (inst->ctx,VENC_LT_SYS ); +inst->hw_base = mtk_vcodec_get_reg_addr(inst->ctx->dev->reg_base,
VENC_LT_SYS);Quoted 3 lines
drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c +0
-0mtk_vcodec_debug_enter (inst);
Yunfei Dong
maintainerPATCH v4 4/11 media: mediatek: vcodec: Removing useless debug log
In reply to Yunfei DongRemoving unresonable and useless debug log enter and leave in order to simply the log message.
--- .../mediatek/vcodec/mtk_vcodec_enc_drv.c | 1 - .../mediatek/vcodec/mtk_vcodec_util.h | 6 ----- .../mediatek/vcodec/vdec/vdec_h264_if.c | 4 ---- .../mediatek/vcodec/vdec/vdec_h264_req_if.c | 4 ---- .../vcodec/vdec/vdec_h264_req_multi_if.c | 2 -- .../vcodec/vdec/vdec_hevc_req_multi_if.c | 2 -- .../mediatek/vcodec/vdec/vdec_vp8_if.c | 2 -- .../mediatek/vcodec/vdec/vdec_vp8_req_if.c | 2 -- .../platform/mediatek/vcodec/vdec_vpu_if.c | 6 ----- .../mediatek/vcodec/venc/venc_h264_if.c | 22 ------------------- .../mediatek/vcodec/venc/venc_vp8_if.c | 22 ------------------- .../platform/mediatek/vcodec/venc_vpu_if.c | 21 ++++-------------- 12 files changed, 4 insertions(+), 90 deletions(-)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c +0 -1
@@ -459,7 +459,6 @@ static void mtk_vcodec_enc_remove(struct platform_device *pdev) {struct mtk_vcodec_dev *dev =platform_get_drvdata (pdev); -mtk_v4l2_debug_enter ();destroy_workqueue (dev->encode_workqueue);if (dev->m2m_dev_enc)v4l2_m2m_release (dev->m2m_dev_enc);
drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +0 -6
@@ -62,12 +62,6 @@ extern int mtk_vcodec_dbg; ((struct mtk_vcodec_ctx *)(h)->ctx)->id, ##args)#endif -#define mtk_v4l2_debug_enter () mtk_v4l2_debug(3, "+") -#define mtk_v4l2_debug_leave () mtk_v4l2_debug(3, "-") - -#define mtk_vcodec_debug_enter (h) mtk_vcodec_debug(h, "+") -#define mtk_vcodec_debug_leave (h) mtk_vcodec_debug(h, "-") -void __iomem *mtk_vcodec_get_reg_addr (void __iomem **reg_base,unsigned int reg_idx);int mtk_vcodec_mem_alloc (void *priv,struct mtk_vcodec_mem *mem);void mtk_vcodec_mem_free (void *priv,struct mtk_vcodec_mem *mem);
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c +0 -4
@@ -156,8 +156,6 @@ static void free_predication_buf(struct vdec_h264_inst *inst) {struct mtk_vcodec_mem *mem =NULL ; -mtk_vcodec_debug_enter (inst); - inst->vsi->pred_buf_dma =0 ; mem = &inst->pred_buf;if (mem->va)
@@ -311,8 +309,6 @@ static void vdec_h264_deinit(void *h_vdec) {struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec; -mtk_vcodec_debug_enter (inst); -vpu_dec_deinit (&inst->vpu);free_predication_buf (inst);free_mv_buf (inst);
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c +0 -4
@@ -174,8 +174,6 @@ static void free_predication_buf(struct vdec_h264_slice_inst *inst) {struct mtk_vcodec_mem *mem = &inst->pred_buf; -mtk_vcodec_debug_enter (inst); - inst->vsi_ctx.pred_buf_dma =0 ;if (mem->va)mtk_vcodec_mem_free (inst->ctx, mem);
@@ -322,8 +320,6 @@ static void vdec_h264_slice_deinit(void *h_vdec) {struct vdec_h264_slice_inst *inst = h_vdec; -mtk_vcodec_debug_enter (inst); -vpu_dec_deinit (&inst->vpu);free_predication_buf (inst);free_mv_buf (inst);
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c +0 -2
@@ -444,8 +444,6 @@ static void vdec_h264_slice_deinit(void *h_vdec) {struct vdec_h264_slice_inst *inst = h_vdec; -mtk_vcodec_debug_enter (inst); -vpu_dec_deinit (&inst->vpu);vdec_h264_slice_free_mv_buf (inst);vdec_msg_queue_deinit (&inst->ctx->msg_queue, inst->ctx);
drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c +0 -2
@@ -911,8 +911,6 @@ static void vdec_hevc_slice_deinit(void *h_vdec)struct vdec_hevc_slice_inst *inst = h_vdec;struct mtk_vcodec_mem *mem; -mtk_vcodec_debug_enter (inst); -vpu_dec_deinit (&inst->vpu);vdec_hevc_slice_free_mv_buf (inst);
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +0 -2
@@ -601,8 +601,6 @@ static void vdec_vp8_deinit(void *h_vdec) {struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec; -mtk_vcodec_debug_enter (inst); -vpu_dec_deinit (&inst->vpu);free_working_buf (inst);kfree (inst);
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c +0 -2
@@ -421,8 +421,6 @@ static void vdec_vp8_slice_deinit(void *h_vdec) {struct vdec_vp8_slice_inst *inst = h_vdec; -mtk_vcodec_debug_enter (inst); -vpu_dec_deinit (&inst->vpu);vdec_vp8_slice_free_working_buf (inst);kfree (inst);
drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c +0 -6
@@ -183,8 +183,6 @@ int vpu_dec_init(struct vdec_vpu_inst *vpu)struct vdec_ap_ipi_init msg;int err; -mtk_vcodec_debug_enter (vpu); -init_waitqueue_head (&vpu->wq); vpu->handler = vpu_dec_ipi_handler;
@@ -223,8 +221,6 @@ int vpu_dec_start(struct vdec_vpu_inst *vpu, uint32_t *data, unsigned int len)int i;int err =0 ; -mtk_vcodec_debug_enter (vpu); -if (len >ARRAY_SIZE (msg.data)) {mtk_vcodec_err (vpu,"invalid len = %d\n" , len);return -EINVAL ;
@@ -252,8 +248,6 @@ int vpu_dec_get_param(struct vdec_vpu_inst *vpu, uint32_t *data,struct vdec_ap_ipi_get_param msg;int err; -mtk_vcodec_debug_enter (vpu); -if (len >ARRAY_SIZE (msg.data)) {mtk_vcodec_err (vpu,"invalid len = %d\n" , len);return -EINVAL ;
drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c +0 -22
@@ -298,8 +298,6 @@ static void h264_enc_free_work_buf(struct venc_h264_inst *inst) {int i; -mtk_vcodec_debug_enter (inst); -/* Except the SKIP_FRAME buffers, * other buffers need to be freed by AP. */
@@ -309,8 +307,6 @@ static void h264_enc_free_work_buf(struct venc_h264_inst *inst) }mtk_vcodec_mem_free (inst->ctx, &inst->pps_buf); - -mtk_vcodec_debug_leave (inst); }static int h264_enc_alloc_work_buf (struct venc_h264_inst *inst,bool is_34bit)
@@ -321,8 +317,6 @@ static int h264_enc_alloc_work_buf(struct venc_h264_inst *inst, bool is_34bit)u32 vpua, wb_size;int ret =0 ; -mtk_vcodec_debug_enter (inst); -if (is_34bit) wb_34 = inst->vsi_34->work_bufs;else
@@ -406,8 +400,6 @@ static int h264_enc_alloc_work_buf(struct venc_h264_inst *inst, bool is_34bit) goto err_alloc; } -mtk_vcodec_debug_leave (inst); -return ret; err_alloc:
@@ -452,8 +444,6 @@ static int h264_encode_sps(struct venc_h264_inst *inst,int ret =0 ;unsigned int irq_status; -mtk_vcodec_debug_enter (inst); - ret =vpu_enc_encode (&inst->vpu_inst,H264_BS_MODE_SPS ,NULL , bs_buf,NULL );if (ret)return ret;
@@ -478,8 +468,6 @@ static int h264_encode_pps(struct venc_h264_inst *inst,int ret =0 ;unsigned int irq_status; -mtk_vcodec_debug_enter (inst); - ret =vpu_enc_encode (&inst->vpu_inst,H264_BS_MODE_PPS ,NULL , bs_buf,NULL );if (ret)return ret;
@@ -531,7 +519,6 @@ static int h264_encode_frame(struct venc_h264_inst *inst,struct venc_frame_info frame_info;struct mtk_vcodec_ctx *ctx = inst->ctx; -mtk_vcodec_debug_enter (inst);mtk_vcodec_debug (inst,"frm_cnt = %d\n " , inst->frm_cnt);if (MTK_ENC_IOVA_IS_34BIT (ctx)) {
@@ -614,8 +601,6 @@ static int h264_enc_init(struct mtk_vcodec_ctx *ctx) inst->vpu_inst.id = is_ext ?SCP_IPI_VENC_H264 :IPI_VENC_H264 ; inst->hw_base =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VENC_SYS ); -mtk_vcodec_debug_enter (inst); - ret =vpu_enc_init (&inst->vpu_inst);if (MTK_ENC_IOVA_IS_34BIT (ctx))
@@ -623,8 +608,6 @@ static int h264_enc_init(struct mtk_vcodec_ctx *ctx)else inst->vsi = (struct venc_h264_vsi *)inst->vpu_inst.vsi; -mtk_vcodec_debug_leave (inst); -if (ret)kfree (inst);else
@@ -811,8 +794,6 @@ static int h264_enc_set_param(void *handle,break ; } -mtk_vcodec_debug_leave (inst); -return ret; }
@@ -821,14 +802,11 @@ static int h264_enc_deinit(void *handle)int ret =0 ;struct venc_h264_inst *inst = (struct venc_h264_inst *)handle; -mtk_vcodec_debug_enter (inst); - ret =vpu_enc_deinit (&inst->vpu_inst);if (inst->work_buf_allocated)h264_enc_free_work_buf (inst); -mtk_vcodec_debug_leave (inst);kfree (inst);return ret;
drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c +0 -22
@@ -141,16 +141,12 @@ static void vp8_enc_free_work_buf(struct venc_vp8_inst *inst) {int i; -mtk_vcodec_debug_enter (inst); -/* Buffers need to be freed by AP. */ for (i =0 ; i <VENC_VP8_VPU_WORK_BUF_MAX ; i++) {if (inst->work_bufs[i].size ==0 )continue ;mtk_vcodec_mem_free (inst->ctx, &inst->work_bufs[i]); } - -mtk_vcodec_debug_leave (inst); }static int vp8_enc_alloc_work_buf (struct venc_vp8_inst *inst)
@@ -159,8 +155,6 @@ static int vp8_enc_alloc_work_buf(struct venc_vp8_inst *inst)int ret =0 ;struct venc_vp8_vpu_buf *wb = inst->vsi->work_bufs; -mtk_vcodec_debug_enter (inst); -for (i =0 ; i <VENC_VP8_VPU_WORK_BUF_MAX ; i++) {if (wb[i].size ==0 )continue ;
@@ -206,8 +200,6 @@ static int vp8_enc_alloc_work_buf(struct venc_vp8_inst *inst) inst->work_bufs[i].size); } -mtk_vcodec_debug_leave (inst); -return ret; err_alloc:
@@ -338,14 +330,10 @@ static int vp8_enc_init(struct mtk_vcodec_ctx *ctx) inst->vpu_inst.id =IPI_VENC_VP8 ; inst->hw_base =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VENC_LT_SYS ); -mtk_vcodec_debug_enter (inst); - ret =vpu_enc_init (&inst->vpu_inst); inst->vsi = (struct venc_vp8_vsi *)inst->vpu_inst.vsi; -mtk_vcodec_debug_leave (inst); -if (ret)kfree (inst);else
@@ -364,8 +352,6 @@ static int vp8_enc_encode(void *handle,struct venc_vp8_inst *inst = (struct venc_vp8_inst *)handle;struct mtk_vcodec_ctx *ctx = inst->ctx; -mtk_vcodec_debug_enter (inst); -enable_irq (ctx->dev->enc_irq);switch (opt) {
@@ -386,8 +372,6 @@ static int vp8_enc_encode(void *handle, encode_err:disable_irq (ctx->dev->enc_irq); -mtk_vcodec_debug_leave (inst); -return ret; }
@@ -437,8 +421,6 @@ static int vp8_enc_set_param(void *handle,break ; } -mtk_vcodec_debug_leave (inst); -return ret; }
@@ -447,16 +429,12 @@ static int vp8_enc_deinit(void *handle)int ret =0 ;struct venc_vp8_inst *inst = (struct venc_vp8_inst *)handle; -mtk_vcodec_debug_enter (inst); - ret =vpu_enc_deinit (&inst->vpu_inst);if (inst->work_buf_allocated)vp8_enc_free_work_buf (inst); -mtk_vcodec_debug_leave (inst);kfree (inst); -return ret; }
drivers/media/platform/mediatek/vcodec/venc_vpu_if.c +4 -17
@@ -55,8 +55,10 @@ static void vpu_enc_ipi_handler(void *data, unsigned int len, void *priv) vpu->signaled =1 ; vpu->failure = (msg->status !=VENC_IPI_MSG_STATUS_OK ); -if (vpu->failure) - goto failure; +if (vpu->failure) { +mtk_vcodec_err (vpu,"vpu enc status failure %d" , vpu->failure); +return ; + }switch (msg->msg_id) {case VPU_IPIMSG_ENC_INIT_DONE :
@@ -73,9 +75,6 @@ static void vpu_enc_ipi_handler(void *data, unsigned int len, void *priv)mtk_vcodec_err (vpu,"unknown msg id %x" , msg->msg_id);break ; } - -failure: -mtk_vcodec_debug_leave (vpu); } static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg,
@@ -83,8 +82,6 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg, {int status; -mtk_vcodec_debug_enter (vpu); -if (!vpu->ctx->dev->fw_handler) {mtk_vcodec_err (vpu,"inst dev is NULL" );return -EINVAL ;
@@ -100,8 +97,6 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg,if (vpu->failure)return -EINVAL ; -mtk_vcodec_debug_leave (vpu); -return 0 ; }
@@ -110,8 +105,6 @@ int vpu_enc_init(struct venc_vpu_inst *vpu)int status;struct venc_ap_ipi_msg_init out; -mtk_vcodec_debug_enter (vpu); -init_waitqueue_head (&vpu->wq_hd); vpu->signaled =0 ; vpu->failure =0 ;
@@ -132,8 +125,6 @@ int vpu_enc_init(struct venc_vpu_inst *vpu)return -EINVAL ; } -mtk_vcodec_debug_leave (vpu); -return 0 ; }
@@ -345,8 +336,6 @@ int vpu_enc_deinit(struct venc_vpu_inst *vpu) {struct venc_ap_ipi_msg_deinit out; -mtk_vcodec_debug_enter (vpu); -memset (&out,0 ,sizeof (out)); out.msg_id =AP_IPIMSG_ENC_DEINIT ; out.vpu_inst_addr = vpu->inst_addr;
@@ -355,7 +344,5 @@ int vpu_enc_deinit(struct venc_vpu_inst *vpu)return -EINVAL ; } -mtk_vcodec_debug_leave (vpu); -return 0 ; }
Signature · 1 line
2.18.0
Re: [PATCH v4,04/11] media: mediatek: vcodec: Removing useless debug log
Le lundi 26 juin 2023 à 11:53 +0800, Yunfei Dong a écrit :
Quoted 4 lines
Removing unresonable and useless debug log enter and leave in order to simply the log message.
Signed-off-by Yunfei Dong <[email protected]>
Quoted 457 lines
--- .../mediatek/vcodec/mtk_vcodec_enc_drv.c | 1 - .../mediatek/vcodec/mtk_vcodec_util.h | 6 ----- .../mediatek/vcodec/vdec/vdec_h264_if.c | 4 ---- .../mediatek/vcodec/vdec/vdec_h264_req_if.c | 4 ---- .../vcodec/vdec/vdec_h264_req_multi_if.c | 2 -- .../vcodec/vdec/vdec_hevc_req_multi_if.c | 2 -- .../mediatek/vcodec/vdec/vdec_vp8_if.c | 2 -- .../mediatek/vcodec/vdec/vdec_vp8_req_if.c | 2 -- .../platform/mediatek/vcodec/vdec_vpu_if.c | 6 ----- .../mediatek/vcodec/venc/venc_h264_if.c | 22 ------------------- .../mediatek/vcodec/venc/venc_vp8_if.c | 22 ------------------- .../platform/mediatek/vcodec/venc_vpu_if.c | 21 ++++-------------- 12 files changed, 4 insertions(+), 90 deletions(-)drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c +0
-1@@ -459,7 +459,6 @@ static void mtk_vcodec_enc_remove(struct platform_device *pdev) {struct mtk_vcodec_dev *dev =platform_get_drvdata (pdev); -mtk_v4l2_debug_enter ();destroy_workqueue (dev->encode_workqueue);if (dev->m2m_dev_enc)v4l2_m2m_release (dev->m2m_dev_enc);drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +0
-6@@ -62,12 +62,6 @@ extern int mtk_vcodec_dbg; ((struct mtk_vcodec_ctx *)(h)->ctx)->id, ##args)#endif -#define mtk_v4l2_debug_enter () mtk_v4l2_debug(3, "+") -#define mtk_v4l2_debug_leave () mtk_v4l2_debug(3, "-") - -#define mtk_vcodec_debug_enter (h) mtk_vcodec_debug(h, "+") -#define mtk_vcodec_debug_leave (h) mtk_vcodec_debug(h, "-") -void __iomem *mtk_vcodec_get_reg_addr (void __iomem **reg_base,unsigned int reg_idx);int mtk_vcodec_mem_alloc (void *priv,struct mtk_vcodec_mem *mem);void mtk_vcodec_mem_free (void *priv,struct mtk_vcodec_mem *mem);drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c +0
-4@@ -156,8 +156,6 @@ static void free_predication_buf(struct vdec_h264_inst *inst) {struct mtk_vcodec_mem *mem =NULL ; -mtk_vcodec_debug_enter (inst); - inst->vsi->pred_buf_dma =0 ; mem = &inst->pred_buf;if (mem->va)@@ -311,8 +309,6 @@ static void vdec_h264_deinit(void *h_vdec) {struct vdec_h264_inst *inst = (struct vdec_h264_inst *)h_vdec; -mtk_vcodec_debug_enter (inst); -vpu_dec_deinit (&inst->vpu);free_predication_buf (inst);free_mv_buf (inst);drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c +0
-4@@ -174,8 +174,6 @@ static void free_predication_buf(struct vdec_h264_slice_inst *inst) {struct mtk_vcodec_mem *mem = &inst->pred_buf; -mtk_vcodec_debug_enter (inst); - inst->vsi_ctx.pred_buf_dma =0 ;if (mem->va)mtk_vcodec_mem_free (inst->ctx, mem);@@ -322,8 +320,6 @@ static void vdec_h264_slice_deinit(void *h_vdec) {struct vdec_h264_slice_inst *inst = h_vdec; -mtk_vcodec_debug_enter (inst); -vpu_dec_deinit (&inst->vpu);free_predication_buf (inst);free_mv_buf (inst);drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c +0
-2@@ -444,8 +444,6 @@ static void vdec_h264_slice_deinit(void *h_vdec) {struct vdec_h264_slice_inst *inst = h_vdec; -mtk_vcodec_debug_enter (inst); -vpu_dec_deinit (&inst->vpu);vdec_h264_slice_free_mv_buf (inst);vdec_msg_queue_deinit (&inst->ctx->msg_queue, inst->ctx);drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c +0
-2@@ -911,8 +911,6 @@ static void vdec_hevc_slice_deinit(void *h_vdec)struct vdec_hevc_slice_inst *inst = h_vdec;struct mtk_vcodec_mem *mem; -mtk_vcodec_debug_enter (inst); -vpu_dec_deinit (&inst->vpu);vdec_hevc_slice_free_mv_buf (inst);drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +0
-2@@ -601,8 +601,6 @@ static void vdec_vp8_deinit(void *h_vdec) {struct vdec_vp8_inst *inst = (struct vdec_vp8_inst *)h_vdec; -mtk_vcodec_debug_enter (inst); -vpu_dec_deinit (&inst->vpu);free_working_buf (inst);kfree (inst);drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c +0
-2@@ -421,8 +421,6 @@ static void vdec_vp8_slice_deinit(void *h_vdec) {struct vdec_vp8_slice_inst *inst = h_vdec; -mtk_vcodec_debug_enter (inst); -vpu_dec_deinit (&inst->vpu);vdec_vp8_slice_free_working_buf (inst);kfree (inst);drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c +0
-6@@ -183,8 +183,6 @@ int vpu_dec_init(struct vdec_vpu_inst *vpu)struct vdec_ap_ipi_init msg;int err; -mtk_vcodec_debug_enter (vpu); -init_waitqueue_head (&vpu->wq); vpu->handler = vpu_dec_ipi_handler;@@ -223,8 +221,6 @@ int vpu_dec_start(struct vdec_vpu_inst *vpu, uint32_t *data, unsigned int len)int i;int err =0 ; -mtk_vcodec_debug_enter (vpu); -if (len >ARRAY_SIZE (msg.data)) {mtk_vcodec_err (vpu,"invalid len = %d\n" , len);return -EINVAL ;@@ -252,8 +248,6 @@ int vpu_dec_get_param(struct vdec_vpu_inst *vpu, uint32_t *data,struct vdec_ap_ipi_get_param msg;int err; -mtk_vcodec_debug_enter (vpu); -if (len >ARRAY_SIZE (msg.data)) {mtk_vcodec_err (vpu,"invalid len = %d\n" , len);return -EINVAL ;drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c +0
-22@@ -298,8 +298,6 @@ static void h264_enc_free_work_buf(struct venc_h264_inst *inst) {int i; -mtk_vcodec_debug_enter (inst); -/* Except the SKIP_FRAME buffers, * other buffers need to be freed by AP. */ @@ -309,8 +307,6 @@ static void h264_enc_free_work_buf(struct venc_h264_inst *inst) }mtk_vcodec_mem_free (inst->ctx, &inst->pps_buf); - -mtk_vcodec_debug_leave (inst); }static int h264_enc_alloc_work_buf (struct venc_h264_inst *inst,bool is_34bit)@@ -321,8 +317,6 @@ static int h264_enc_alloc_work_buf(struct venc_h264_inst *inst, bool is_34bit)u32 vpua, wb_size;int ret =0 ; -mtk_vcodec_debug_enter (inst); -if (is_34bit) wb_34 = inst->vsi_34->work_bufs;else @@ -406,8 +400,6 @@ static int h264_enc_alloc_work_buf(struct venc_h264_inst *inst, bool is_34bit) goto err_alloc; } -mtk_vcodec_debug_leave (inst); -return ret; err_alloc:@@ -452,8 +444,6 @@ static int h264_encode_sps(struct venc_h264_inst *inst,int ret =0 ;unsigned int irq_status; -mtk_vcodec_debug_enter (inst); - ret =vpu_enc_encode (&inst->vpu_inst,H264_BS_MODE_SPS ,NULL , bs_buf,NULL );if (ret)return ret;@@ -478,8 +468,6 @@ static int h264_encode_pps(struct venc_h264_inst *inst,int ret =0 ;unsigned int irq_status; -mtk_vcodec_debug_enter (inst); - ret =vpu_enc_encode (&inst->vpu_inst,H264_BS_MODE_PPS ,NULL , bs_buf,NULL );if (ret)return ret;@@ -531,7 +519,6 @@ static int h264_encode_frame(struct venc_h264_inst *inst,struct venc_frame_info frame_info;struct mtk_vcodec_ctx *ctx = inst->ctx; -mtk_vcodec_debug_enter (inst);mtk_vcodec_debug (inst,"frm_cnt = %d\n " , inst->frm_cnt);if (MTK_ENC_IOVA_IS_34BIT (ctx)) {@@ -614,8 +601,6 @@ static int h264_enc_init(struct mtk_vcodec_ctx *ctx) inst->vpu_inst.id = is_ext ?SCP_IPI_VENC_H264 :IPI_VENC_H264 ; inst->hw_base =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VENC_SYS ); -mtk_vcodec_debug_enter (inst); - ret =vpu_enc_init (&inst->vpu_inst);if (MTK_ENC_IOVA_IS_34BIT (ctx))@@ -623,8 +608,6 @@ static int h264_enc_init(struct mtk_vcodec_ctx *ctx)else inst->vsi = (struct venc_h264_vsi *)inst->vpu_inst.vsi; -mtk_vcodec_debug_leave (inst); -if (ret)kfree (inst);else @@ -811,8 +794,6 @@ static int h264_enc_set_param(void *handle,break ; } -mtk_vcodec_debug_leave (inst); -return ret; }@@ -821,14 +802,11 @@ static int h264_enc_deinit(void *handle)int ret =0 ;struct venc_h264_inst *inst = (struct venc_h264_inst *)handle; -mtk_vcodec_debug_enter (inst); - ret =vpu_enc_deinit (&inst->vpu_inst);if (inst->work_buf_allocated)h264_enc_free_work_buf (inst); -mtk_vcodec_debug_leave (inst);kfree (inst);return ret;drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c +0
-22@@ -141,16 +141,12 @@ static void vp8_enc_free_work_buf(struct venc_vp8_inst *inst) {int i; -mtk_vcodec_debug_enter (inst); -/* Buffers need to be freed by AP. */ for (i =0 ; i <VENC_VP8_VPU_WORK_BUF_MAX ; i++) {if (inst->work_bufs[i].size ==0 )continue ;mtk_vcodec_mem_free (inst->ctx, &inst->work_bufs[i]); } - -mtk_vcodec_debug_leave (inst); }static int vp8_enc_alloc_work_buf (struct venc_vp8_inst *inst)@@ -159,8 +155,6 @@ static int vp8_enc_alloc_work_buf(struct venc_vp8_inst *inst)int ret =0 ;struct venc_vp8_vpu_buf *wb = inst->vsi->work_bufs; -mtk_vcodec_debug_enter (inst); -for (i =0 ; i <VENC_VP8_VPU_WORK_BUF_MAX ; i++) {if (wb[i].size ==0 )continue ;@@ -206,8 +200,6 @@ static int vp8_enc_alloc_work_buf(struct venc_vp8_inst *inst) inst->work_bufs[i].size); } -mtk_vcodec_debug_leave (inst); -return ret; err_alloc:@@ -338,14 +330,10 @@ static int vp8_enc_init(struct mtk_vcodec_ctx *ctx) inst->vpu_inst.id =IPI_VENC_VP8 ; inst->hw_base =mtk_vcodec_get_reg_addr (inst->ctx->dev->reg_base,VENC_LT_SYS ); -mtk_vcodec_debug_enter (inst); - ret =vpu_enc_init (&inst->vpu_inst); inst->vsi = (struct venc_vp8_vsi *)inst->vpu_inst.vsi; -mtk_vcodec_debug_leave (inst); -if (ret)kfree (inst);else @@ -364,8 +352,6 @@ static int vp8_enc_encode(void *handle,struct venc_vp8_inst *inst = (struct venc_vp8_inst *)handle;struct mtk_vcodec_ctx *ctx = inst->ctx; -mtk_vcodec_debug_enter (inst); -enable_irq (ctx->dev->enc_irq);switch (opt) {@@ -386,8 +372,6 @@ static int vp8_enc_encode(void *handle, encode_err:disable_irq (ctx->dev->enc_irq); -mtk_vcodec_debug_leave (inst); -return ret; }@@ -437,8 +421,6 @@ static int vp8_enc_set_param(void *handle,break ; } -mtk_vcodec_debug_leave (inst); -return ret; }@@ -447,16 +429,12 @@ static int vp8_enc_deinit(void *handle)int ret =0 ;struct venc_vp8_inst *inst = (struct venc_vp8_inst *)handle; -mtk_vcodec_debug_enter (inst); - ret =vpu_enc_deinit (&inst->vpu_inst);if (inst->work_buf_allocated)vp8_enc_free_work_buf (inst); -mtk_vcodec_debug_leave (inst);kfree (inst); -return ret; }drivers/media/platform/mediatek/vcodec/venc_vpu_if.c +4
-17@@ -55,8 +55,10 @@ static void vpu_enc_ipi_handler(void *data, unsigned int len, void *priv) vpu->signaled =1 ; vpu->failure = (msg->status !=VENC_IPI_MSG_STATUS_OK ); -if (vpu->failure) - goto failure; +if (vpu->failure) { +mtk_vcodec_err (vpu,"vpu enc status failure %d" , vpu->failure); +return ; + }switch (msg->msg_id) {case VPU_IPIMSG_ENC_INIT_DONE :@@ -73,9 +75,6 @@ static void vpu_enc_ipi_handler(void *data, unsigned int len, void *priv)mtk_vcodec_err (vpu,"unknown msg id %x" , msg->msg_id);break ; } - -failure: -mtk_vcodec_debug_leave (vpu); } static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg,@@ -83,8 +82,6 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg, {int status; -mtk_vcodec_debug_enter (vpu); -if (!vpu->ctx->dev->fw_handler) {mtk_vcodec_err (vpu,"inst dev is NULL" );return -EINVAL ;@@ -100,8 +97,6 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg,if (vpu->failure)return -EINVAL ; -mtk_vcodec_debug_leave (vpu); -return 0 ; }@@ -110,8 +105,6 @@ int vpu_enc_init(struct venc_vpu_inst *vpu)int status;struct venc_ap_ipi_msg_init out; -mtk_vcodec_debug_enter (vpu); -init_waitqueue_head (&vpu->wq_hd); vpu->signaled =0 ; vpu->failure =0 ;@@ -132,8 +125,6 @@ int vpu_enc_init(struct venc_vpu_inst *vpu)return -EINVAL ; } -mtk_vcodec_debug_leave (vpu); -return 0 ; }@@ -345,8 +336,6 @@ int vpu_enc_deinit(struct venc_vpu_inst *vpu) {struct venc_ap_ipi_msg_deinit out; -mtk_vcodec_debug_enter (vpu); -memset (&out,0 ,sizeof (out)); out.msg_id =AP_IPIMSG_ENC_DEINIT ; out.vpu_inst_addr = vpu->inst_addr;@@ -355,7 +344,5 @@ int vpu_enc_deinit(struct venc_vpu_inst *vpu)return -EINVAL ; } -mtk_vcodec_debug_leave (vpu); -return 0 ; }
Yunfei Dong
maintainerPATCH v4 5/11 media: mediatek: vcodec: remove the dependency of vcodec debug log
In reply to Yunfei Dong'mtk_vcodec_debug' and 'mtk_vcodec_err' depends on 'mtk_vcodec_ctx' to get the index of each instance. Define two different macro mtk_vdec_debug and mtk_venc_debug for decoder and encoder, and re-write macro mtk_vcodec_debug as the common interface which is called by mtk_vdec_debug and mtk_venc_debug. The vcodec debug log can be separeated by encoder and decoder.
--- .../mediatek/vcodec/mtk_vcodec_util.h | 34 +++-- .../vcodec/vdec/vdec_av1_req_lat_if.c | 123 +++++++++-------- .../mediatek/vcodec/vdec/vdec_h264_if.c | 66 +++++----- .../mediatek/vcodec/vdec/vdec_h264_req_if.c | 46 +++---- .../vcodec/vdec/vdec_h264_req_multi_if.c | 124 +++++++++--------- .../vcodec/vdec/vdec_hevc_req_multi_if.c | 94 +++++++------ .../mediatek/vcodec/vdec/vdec_vp8_if.c | 47 ++++--- .../mediatek/vcodec/vdec/vdec_vp8_req_if.c | 66 +++++----- .../mediatek/vcodec/vdec/vdec_vp9_if.c | 122 ++++++++--------- .../vcodec/vdec/vdec_vp9_req_lat_if.c | 108 +++++++-------- .../platform/mediatek/vcodec/vdec_vpu_if.c | 45 ++++--- .../mediatek/vcodec/venc/venc_h264_if.c | 69 +++++----- .../mediatek/vcodec/venc/venc_vp8_if.c | 32 ++--- .../platform/mediatek/vcodec/venc_vpu_if.c | 53 ++++---- 14 files changed, 494 insertions(+), 535 deletions(-)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +21 -13
@@ -31,9 +31,8 @@ struct mtk_vcodec_dev; #define mtk_v4l2_err(fmt, args...) \ pr_err("[MTK_V4L2][ERROR] " fmt "\n", ##args) -#define mtk_vcodec_err(h, fmt, args...) \ - pr_err("[MTK_VCODEC][ERROR][%d]: " fmt "\n", \ - ((struct mtk_vcodec_ctx *)(h)->ctx)->id, ##args) +#define mtk_vcodec_err(inst_id, plat_dev, fmt, args...) \ + dev_err(&(plat_dev)->dev, "[MTK_VCODEC][ERROR][%d]: " fmt "\n", inst_id, ##args)#if defined(CONFIG_DEBUG_FS )extern int mtk_v4l2_dbg_level;
@@ -46,22 +45,31 @@ extern int mtk_vcodec_dbg; __func__, __LINE__, ##args); \ } while (0) -#define mtk_vcodec_debug(h, fmt, args...) \ - do { \ - if (mtk_vcodec_dbg) \ - dev_dbg(&(((struct mtk_vcodec_ctx *)(h)->ctx)->dev->plat_dev->dev), \ - "[MTK_VCODEC][%d]: %s, %d " fmt "\n", \ - ((struct mtk_vcodec_ctx *)(h)->ctx)->id, \ - __func__, __LINE__, ##args); \ +#define mtk_vcodec_debug(inst_id, plat_dev, fmt, args...) \ + do { \ + if (mtk_vcodec_dbg) \ + dev_dbg(&(plat_dev)->dev, "[MTK_VCODEC][%d]: %s, %d " fmt "\n", \ + inst_id, __func__, __LINE__, ##args); \ } while (0)#else #define mtk_v4l2_debug(level, fmt, args...) pr_debug(fmt, ##args) -#define mtk_vcodec_debug(h, fmt, args...) \ - pr_debug("[MTK_VCODEC][%d]: " fmt "\n", \ - ((struct mtk_vcodec_ctx *)(h)->ctx)->id, ##args) +#define mtk_vcodec_debug(inst_id, plat_dev, fmt, args...) \ + 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) +void __iomem *mtk_vcodec_get_reg_addr (void __iomem **reg_base,unsigned int reg_idx);int mtk_vcodec_mem_alloc (void *priv,struct mtk_vcodec_mem *mem);void mtk_vcodec_mem_free (void *priv,struct mtk_vcodec_mem *mem);
drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c +61 -62
319 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c +31 -35
180 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c +23 -23
115 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c +60 -64
275 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c +46 -48
216 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +22 -25
140 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c +33 -33
148 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c +55 -67
327 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c +50 -58
285 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c +22 -23
165 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c +32 -37
207 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c +14 -18
@@ -171,8 +171,7 @@ static int vp8_enc_alloc_work_buf(struct venc_vp8_inst *inst) inst->work_bufs[i].size = wb[i].size; ret =mtk_vcodec_mem_alloc (inst->ctx, &inst->work_bufs[i]);if (ret) { -mtk_vcodec_err (inst, -"cannot alloc work_bufs[%d]" , i); +mtk_venc_err (inst->ctx,"cannot alloc work_bufs[%d]" , i); goto err_alloc; }/*
@@ -193,11 +192,10 @@ static int vp8_enc_alloc_work_buf(struct venc_vp8_inst *inst) } wb[i].iova = inst->work_bufs[i].dma_addr; -mtk_vcodec_debug (inst, -"work_bufs[%d] va=0x%p,iova=%pad,size=%zu" , - i, inst->work_bufs[i].va, - &inst->work_bufs[i].dma_addr, - inst->work_bufs[i].size); +mtk_venc_debug (inst->ctx,"work_bufs[%d] va=0x%p,iova=%pad,size=%zu" , + i, inst->work_bufs[i].va, + &inst->work_bufs[i].dma_addr, + inst->work_bufs[i].size); }return ret;
@@ -216,7 +214,7 @@ static unsigned int vp8_enc_wait_venc_done(struct venc_vp8_inst *inst)if (!mtk_vcodec_wait_for_done_ctx (ctx,MTK_INST_IRQ_RECEIVED ,WAIT_INTR_TIMEOUT_MS ,0 )) { irq_status = ctx->irq_status; -mtk_vcodec_debug (inst,"isr return %x" , irq_status); +mtk_venc_debug (ctx,"isr return %x" , irq_status); }return irq_status; }
@@ -261,8 +259,7 @@ static int vp8_enc_compose_one_frame(struct venc_vp8_inst *inst, }if (bs_buf->size < bs_hdr_len + bs_frm_size + ac_tag_size) { -mtk_vcodec_err (inst,"bitstream buf size is too small(%zu)" , - bs_buf->size); +mtk_venc_err (inst->ctx,"bitstream buf size is too small(%zu)" , bs_buf->size);return -EINVAL ; }
@@ -292,7 +289,7 @@ static int vp8_enc_encode_frame(struct venc_vp8_inst *inst,int ret =0 ;unsigned int irq_status; -mtk_vcodec_debug (inst,"->frm_cnt=%d" , inst->frm_cnt); +mtk_venc_debug (inst->ctx,"->frm_cnt=%d" , inst->frm_cnt); ret =vpu_enc_encode (&inst->vpu_inst,0 , frm_buf, bs_buf,NULL );if (ret)
@@ -300,18 +297,17 @@ static int vp8_enc_encode_frame(struct venc_vp8_inst *inst, irq_status =vp8_enc_wait_venc_done (inst);if (irq_status !=MTK_VENC_IRQ_STATUS_FRM ) { -mtk_vcodec_err (inst,"irq_status=%d failed" , irq_status); +mtk_venc_err (inst->ctx,"irq_status=%d failed" , irq_status);return -EIO ; }if (vp8_enc_compose_one_frame (inst, bs_buf, bs_size)) { -mtk_vcodec_err (inst,"vp8_enc_compose_one_frame failed" ); +mtk_venc_err (inst->ctx,"vp8_enc_compose_one_frame failed" );return -EINVAL ; } inst->frm_cnt++; -mtk_vcodec_debug (inst,"<-size=%d key_frm=%d" , *bs_size, - inst->vpu_inst.is_key_frm); +mtk_venc_debug (inst->ctx,"<-size=%d key_frm=%d" , *bs_size, inst->vpu_inst.is_key_frm);return ret; }
@@ -364,7 +360,7 @@ static int vp8_enc_encode(void *handle,break ;default : -mtk_vcodec_err (inst,"opt not support:%d" , opt); +mtk_venc_err (ctx,"opt not support:%d" , opt); ret = -EINVAL ;break ; }
@@ -382,7 +378,7 @@ static int vp8_enc_set_param(void *handle,int ret =0 ;struct venc_vp8_inst *inst = (struct venc_vp8_inst *)handle; -mtk_vcodec_debug (inst,"->type=%d" , type); +mtk_venc_debug (inst->ctx,"->type=%d" , type);switch (type) {case VENC_SET_PARAM_ENC :
@@ -413,7 +409,7 @@ static int vp8_enc_set_param(void *handle,*/ case VENC_SET_PARAM_TS_MODE : inst->ts_mode =1 ; -mtk_vcodec_debug (inst,"set ts_mode" ); +mtk_venc_debug (inst->ctx,"set ts_mode" );break ;default :
drivers/media/platform/mediatek/vcodec/venc_vpu_if.c +24 -29
169 lines not on this page · raw message
Signature · 1 line
2.18.0
Re: [PATCH v4,05/11] media: mediatek: vcodec: remove the dependency of vcodec debug log
Le lundi 26 juin 2023 à 11:53 +0800, Yunfei Dong a écrit :
Quoted 8 lines
'
mtk_vcodec_debug' and 'mtk_vcodec_err' depends on 'mtk_vcodec_ctx' to get the index of each instance. Define two different macromtk_vdec_debugandmtk_venc_debugfor decoder and encoder, and re-write macromtk_vcodec_debugas the common interface which is called bymtk_vdec_debugandmtk_venc_debug. The vcodec debug log can be separeated by encoder and decoder.Signed-off-by Yunfei Dong <[email protected]>
Quoted 2,998 lines
--- .../mediatek/vcodec/mtk_vcodec_util.h | 34 +++-- .../vcodec/vdec/vdec_av1_req_lat_if.c | 123 +++++++++-------- .../mediatek/vcodec/vdec/vdec_h264_if.c | 66 +++++----- .../mediatek/vcodec/vdec/vdec_h264_req_if.c | 46 +++---- .../vcodec/vdec/vdec_h264_req_multi_if.c | 124 +++++++++--------- .../vcodec/vdec/vdec_hevc_req_multi_if.c | 94 +++++++------ .../mediatek/vcodec/vdec/vdec_vp8_if.c | 47 ++++--- .../mediatek/vcodec/vdec/vdec_vp8_req_if.c | 66 +++++----- .../mediatek/vcodec/vdec/vdec_vp9_if.c | 122 ++++++++--------- .../vcodec/vdec/vdec_vp9_req_lat_if.c | 108 +++++++-------- .../platform/mediatek/vcodec/vdec_vpu_if.c | 45 ++++--- .../mediatek/vcodec/venc/venc_h264_if.c | 69 +++++----- .../mediatek/vcodec/venc/venc_vp8_if.c | 32 ++--- .../platform/mediatek/vcodec/venc_vpu_if.c | 53 ++++---- 14 files changed, 494 insertions(+), 535 deletions(-)drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +21
-13@@ -31,9 +31,8 @@ struct mtk_vcodec_dev; #define mtk_v4l2_err(fmt, args...) \ pr_err("[MTK_V4L2][ERROR] " fmt "\n", ##args) -#define mtk_vcodec_err(h, fmt, args...) \ - pr_err("[MTK_VCODEC][ERROR][%d]: " fmt "\n", \ - ((struct mtk_vcodec_ctx *)(h)->ctx)->id, ##args) +#define mtk_vcodec_err(inst_id, plat_dev, fmt, args...) \ + dev_err(&(plat_dev)->dev, "[MTK_VCODEC][ERROR][%d]: " fmt "\n", inst_id, ##args)#if defined(CONFIG_DEBUG_FS )extern int mtk_v4l2_dbg_level;@@ -46,22 +45,31 @@ extern int mtk_vcodec_dbg; __func__, __LINE__, ##args); \ } while (0) -#define mtk_vcodec_debug(h, fmt, args...) \ - do { \ - if (mtk_vcodec_dbg) \ - dev_dbg(&(((struct mtk_vcodec_ctx *)(h)->ctx)->dev->plat_dev->dev), \ - "[MTK_VCODEC][%d]: %s, %d " fmt "\n", \ - ((struct mtk_vcodec_ctx *)(h)->ctx)->id, \ - __func__, __LINE__, ##args); \ +#define mtk_vcodec_debug(inst_id, plat_dev, fmt, args...) \ + do { \ + if (mtk_vcodec_dbg) \ + dev_dbg(&(plat_dev)->dev, "[MTK_VCODEC][%d]: %s, %d " fmt "\n", \ + inst_id, __func__, __LINE__, ##args); \ } while (0)#else #define mtk_v4l2_debug(level, fmt, args...) pr_debug(fmt, ##args) -#define mtk_vcodec_debug(h, fmt, args...) \ - pr_debug("[MTK_VCODEC][%d]: " fmt "\n", \ - ((struct mtk_vcodec_ctx *)(h)->ctx)->id, ##args) +#define mtk_vcodec_debug(inst_id, plat_dev, fmt, args...) \ + 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) +void __iomem *mtk_vcodec_get_reg_addr (void __iomem **reg_base,unsigned int reg_idx);int mtk_vcodec_mem_alloc (void *priv,struct mtk_vcodec_mem *mem);void mtk_vcodec_mem_free (void *priv,struct mtk_vcodec_mem *mem);drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c +61
-62@@ -778,12 +778,11 @@ static int vdec_av1_slice_init_cdf_table(struct vdec_av1_slice_instance *instanc remote_cdf_table =mtk_vcodec_fw_map_dm_addr (ctx->dev->fw_handler, (u32 )vsi->cdf_table_addr);if (IS_ERR (remote_cdf_table)) { -mtk_vcodec_err (instance,"failed to map cdf table\n" ); +mtk_vdec_err (ctx,"failed to map cdf table\n" );return PTR_ERR (remote_cdf_table); } -mtk_vcodec_debug (instance,"map cdf table to 0x%p\n" , - remote_cdf_table); +mtk_vdec_debug (ctx,"map cdf table to 0x%p\n" , remote_cdf_table);if (instance->cdf_table.va)mtk_vcodec_mem_free (ctx, &instance->cdf_table);@@ -810,11 +809,11 @@ static int vdec_av1_slice_init_iq_table(struct vdec_av1_slice_instance *instance remote_iq_table =mtk_vcodec_fw_map_dm_addr (ctx->dev->fw_handler, (u32 )vsi->iq_table_addr);if (IS_ERR (remote_iq_table)) { -mtk_vcodec_err (instance,"failed to map iq table\n" ); +mtk_vdec_err (ctx,"failed to map iq table\n" );return PTR_ERR (remote_iq_table); } -mtk_vcodec_debug (instance,"map iq table to 0x%p\n" , remote_iq_table); +mtk_vdec_debug (ctx,"map iq table to 0x%p\n" , remote_iq_table);if (instance->iq_table.va)mtk_vcodec_mem_free (ctx, &instance->iq_table);@@ -965,8 +964,8 @@ static int vdec_av1_slice_alloc_working_buffer(struct vdec_av1_slice_instance *iif (level == instance->level)return 0 ; -mtk_vcodec_debug (instance,"resolution level changed from %u to %u, %ux%u" , - instance->level, level, w, h); +mtk_vdec_debug (ctx,"resolution level changed from %u to %u, %ux%u" , + instance->level, level, w, h); max_sb_w =DIV_ROUND_UP (max_w,128 ); max_sb_h =DIV_ROUND_UP (max_h,128 );@@ -1400,17 +1399,17 @@ static int vdec_av1_slice_setup_tile_group(struct vdec_av1_slice_instance *instaif (tile_group->num_tiles != tge_size || tile_group->num_tiles >V4L2_AV1_MAX_TILE_COUNT ) { -mtk_vcodec_err (instance,"invalid tge_size %d, tile_num:%d\n" , - tge_size, tile_group->num_tiles); +mtk_vdec_err (instance->ctx,"invalid tge_size %d, tile_num:%d\n" , + tge_size, tile_group->num_tiles);return -EINVAL ; }for (i =0 ; i < tge_size; i++) {if (i != ctrl_tge[i].tile_row * vsi->frame.uh.tile.tile_cols + ctrl_tge[i].tile_col) { -mtk_vcodec_err (instance,"invalid tge info %d, %d %d %d\n" , - i, ctrl_tge[i].tile_row, ctrl_tge[i].tile_col, - vsi->frame.uh.tile.tile_rows); +mtk_vdec_err (instance->ctx,"invalid tge info %d, %d %d %d\n" , + i, ctrl_tge[i].tile_row, ctrl_tge[i].tile_col, + vsi->frame.uh.tile.tile_rows);return -EINVAL ; } tile_group->tile_size[i] = ctrl_tge[i].tile_size;@@ -1639,7 +1638,7 @@ static void vdec_av1_slice_setup_seg_buffer(struct vdec_av1_slice_instance *inst/* reset segment buffer */ if (uh->primary_ref_frame ==AV1_PRIMARY_REF_NONE || !uh->seg.segmentation_enabled) { -mtk_vcodec_debug (instance,"reset seg %d\n" , vsi->slot_id); +mtk_vdec_debug (instance->ctx,"reset seg %d\n" , vsi->slot_id);if (vsi->slot_id !=AV1_INVALID_IDX ) { buf = &instance->seg[vsi->slot_id];memset (buf->va,0 , buf->size);@@ -1690,18 +1689,18 @@ static void vdec_av1_slice_setup_tile_buffer(struct vdec_av1_slice_instance *ins uh->disable_frame_end_update_cdf == 0) tile_info_buf[tile_info_base +4 ] |= (1 <<17 ); -mtk_vcodec_debug (instance,"// tile buf %d pos(%dx%d) offset 0x%x\n" , - tile_num, tile_row, tile_col, tile_info_base); -mtk_vcodec_debug (instance,"// %08x %08x %08x %08x\n" , - tile_info_buf[tile_info_base +0 ], - tile_info_buf[tile_info_base +1 ], - tile_info_buf[tile_info_base +2 ], - tile_info_buf[tile_info_base +3 ]); -mtk_vcodec_debug (instance,"// %08x %08x %08x %08x\n" , - tile_info_buf[tile_info_base +4 ], - tile_info_buf[tile_info_base +5 ], - tile_info_buf[tile_info_base +6 ], - tile_info_buf[tile_info_base +7 ]); +mtk_vdec_debug (instance->ctx,"// tile buf %d pos(%dx%d) offset 0x%x\n" , + tile_num, tile_row, tile_col, tile_info_base); +mtk_vdec_debug (instance->ctx,"// %08x %08x %08x %08x\n" , + tile_info_buf[tile_info_base +0 ], + tile_info_buf[tile_info_base +1 ], + tile_info_buf[tile_info_base +2 ], + tile_info_buf[tile_info_base +3 ]); +mtk_vdec_debug (instance->ctx,"// %08x %08x %08x %08x\n" , + tile_info_buf[tile_info_base +4 ], + tile_info_buf[tile_info_base +5 ], + tile_info_buf[tile_info_base +6 ], + tile_info_buf[tile_info_base +7 ]); } }@@ -1743,8 +1742,8 @@ static int vdec_av1_slice_update_lat(struct vdec_av1_slice_instance *instance,struct vdec_av1_slice_vsi *vsi; vsi = &pfc->vsi; -mtk_vcodec_debug (instance,"frame %u LAT CRC 0x%08x, output size is %d\n" , - pfc->seq, vsi->state.crc[0 ], vsi->state.out_size); +mtk_vdec_debug (instance->ctx,"frame %u LAT CRC 0x%08x, output size is %d\n" , + pfc->seq, vsi->state.crc[0 ], vsi->state.out_size);/* buffer full, need to re-decode */ if (vsi->state.full) {@@ -1855,12 +1854,12 @@ static int vdec_av1_slice_update_core(struct vdec_av1_slice_instance *instance, {struct vdec_av1_slice_vsi *vsi = instance->core_vsi; -mtk_vcodec_debug (instance,"frame %u Y_CRC %08x %08x %08x %08x\n" , - pfc->seq, vsi->state.crc[0 ], vsi->state.crc[1 ], - vsi->state.crc[2 ], vsi->state.crc[3 ]); -mtk_vcodec_debug (instance,"frame %u C_CRC %08x %08x %08x %08x\n" , - pfc->seq, vsi->state.crc[8 ], vsi->state.crc[9 ], - vsi->state.crc[10 ], vsi->state.crc[11 ]); +mtk_vdec_debug (instance->ctx,"frame %u Y_CRC %08x %08x %08x %08x\n" , + pfc->seq, vsi->state.crc[0 ], vsi->state.crc[1 ], + vsi->state.crc[2 ], vsi->state.crc[3 ]); +mtk_vdec_debug (instance->ctx,"frame %u C_CRC %08x %08x %08x %08x\n" , + pfc->seq, vsi->state.crc[8 ], vsi->state.crc[9 ], + vsi->state.crc[10 ], vsi->state.crc[11 ]);return 0 ; }@@ -1883,14 +1882,14 @@ static int vdec_av1_slice_init(struct mtk_vcodec_ctx *ctx) ret =vpu_dec_init (&instance->vpu);if (ret) { -mtk_vcodec_err (instance,"failed to init vpu dec, ret %d\n" , ret); +mtk_vdec_err (ctx,"failed to init vpu dec, ret %d\n" , ret); goto error_vpu_init; }/* init vsi and global flags */ vsi = instance->vpu.vsi;if (!vsi) { -mtk_vcodec_err (instance,"failed to get AV1 vsi\n" ); +mtk_vdec_err (ctx,"failed to get AV1 vsi\n" ); ret = -EINVAL ; goto error_vsi; }@@ -1898,20 +1897,20 @@ static int vdec_av1_slice_init(struct mtk_vcodec_ctx *ctx) instance->core_vsi =mtk_vcodec_fw_map_dm_addr (ctx->dev->fw_handler, (u32 )vsi->core_vsi);if (!instance->core_vsi) { -mtk_vcodec_err (instance,"failed to get AV1 core vsi\n" ); +mtk_vdec_err (ctx,"failed to get AV1 core vsi\n" ); ret = -EINVAL ; goto error_vsi; }if (vsi->vsi_size !=sizeof (struct vdec_av1_slice_vsi )) -mtk_vcodec_err (instance,"remote vsi size 0x%x mismatch! expected: 0x%zx\n" , - vsi->vsi_size,sizeof (struct vdec_av1_slice_vsi )); +mtk_vdec_err (ctx,"remote vsi size 0x%x mismatch! expected: 0x%zx\n" , + vsi->vsi_size,sizeof (struct vdec_av1_slice_vsi )); instance->irq_enabled =1 ; instance->inneracing_mode =IS_VDEC_INNER_RACING (instance->ctx->dev->dec_capability); -mtk_vcodec_debug (instance,"vsi 0x%p core_vsi 0x%llx 0x%p, inneracing_mode %d\n" , - vsi, vsi->core_vsi, instance->core_vsi, instance->inneracing_mode); +mtk_vdec_debug (ctx,"vsi 0x%p core_vsi 0x%llx 0x%p, inneracing_mode %d\n" , + vsi, vsi->core_vsi, instance->core_vsi, instance->inneracing_mode); ret =vdec_av1_slice_init_cdf_table (instance);if (ret)@@ -1938,7 +1937,7 @@ static void vdec_av1_slice_deinit(void *h_vdec)if (!instance)return ; -mtk_vcodec_debug (instance,"h_vdec 0x%p\n" , h_vdec); +mtk_vdec_debug (instance->ctx,"h_vdec 0x%p\n" , h_vdec);vpu_dec_deinit (&instance->vpu);vdec_av1_slice_free_working_buffer (instance);vdec_msg_queue_deinit (&instance->ctx->msg_queue, instance->ctx);@@ -1951,7 +1950,7 @@ static int vdec_av1_slice_flush(void *h_vdec, struct mtk_vcodec_mem *bs,struct vdec_av1_slice_instance *instance = h_vdec;int i; -mtk_vcodec_debug (instance,"flush ...\n" ); +mtk_vdec_debug (instance->ctx,"flush ...\n" );vdec_msg_queue_wait_lat_buf_full (&instance->ctx->msg_queue);@@ -1966,7 +1965,7 @@ static void vdec_av1_slice_get_pic_info(struct vdec_av1_slice_instance *instancestruct mtk_vcodec_ctx *ctx = instance->ctx;u32 data[3 ]; -mtk_vcodec_debug (instance,"w %u h %u\n" , ctx->picinfo.pic_w, ctx->picinfo.pic_h); +mtk_vdec_debug (ctx,"w %u h %u\n" , ctx->picinfo.pic_w, ctx->picinfo.pic_h); data[0 ] = ctx->picinfo.pic_w; data[1 ] = ctx->picinfo.pic_h;@@ -1996,8 +1995,8 @@ static void vdec_av1_slice_get_crop_info(struct vdec_av1_slice_instance *instanc cr->width = ctx->picinfo.pic_w; cr->height = ctx->picinfo.pic_h; -mtk_vcodec_debug (instance,"l=%d, t=%d, w=%d, h=%d\n" , - cr->left, cr->top, cr->width, cr->height); +mtk_vdec_debug (ctx,"l=%d, t=%d, w=%d, h=%d\n" , + cr->left, cr->top, cr->width, cr->height); }static int vdec_av1_slice_get_param (void *h_vdec,enum vdec_get_param_type type,void *out)@@ -2015,7 +2014,7 @@ static int vdec_av1_slice_get_param(void *h_vdec, enum vdec_get_param_type type,vdec_av1_slice_get_crop_info (instance, out);break ;default : -mtk_vcodec_err (instance,"invalid get parameter type=%d\n" , type); +mtk_vdec_err (instance->ctx,"invalid get parameter type=%d\n" , type);return -EINVAL ; }@@ -2039,7 +2038,7 @@ static int vdec_av1_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,/* init msgQ for the first time */ if (vdec_msg_queue_init (&ctx->msg_queue, ctx, vdec_av1_slice_core_decode,sizeof (*pfc))) { -mtk_vcodec_err (instance,"failed to init AV1 msg queue\n" ); +mtk_vdec_err (ctx,"failed to init AV1 msg queue\n" );return -ENOMEM ; }@@ -2049,7 +2048,7 @@ static int vdec_av1_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, lat_buf =vdec_msg_queue_dqbuf (&ctx->msg_queue.lat_ctx);if (!lat_buf) { -mtk_vcodec_err (instance,"failed to get AV1 lat buf\n" ); +mtk_vdec_err (ctx,"failed to get AV1 lat buf\n" );return -EAGAIN ; } pfc = (struct vdec_av1_slice_pfc *)lat_buf->private_data;@@ -2061,14 +2060,14 @@ static int vdec_av1_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, ret =vdec_av1_slice_setup_lat (instance, bs, lat_buf, pfc);if (ret) { -mtk_vcodec_err (instance,"failed to setup AV1 lat ret %d\n" , ret); +mtk_vdec_err (ctx,"failed to setup AV1 lat ret %d\n" , ret); goto err_free_fb_out; }vdec_av1_slice_vsi_to_remote (vsi, instance->vsi); ret =vpu_dec_start (&instance->vpu,NULL ,0 );if (ret) { -mtk_vcodec_err (instance,"failed to dec AV1 ret %d\n" , ret); +mtk_vdec_err (ctx,"failed to dec AV1 ret %d\n" , ret); goto err_free_fb_out; }if (instance->inneracing_mode)@@ -2080,7 +2079,7 @@ static int vdec_av1_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, MTK_VDEC_LAT0);/* update remote vsi if decode timeout */ if (ret) { -mtk_vcodec_err (instance,"AV1 Frame %d decode timeout %d\n" , pfc->seq, ret); +mtk_vdec_err (ctx,"AV1 Frame %d decode timeout %d\n" , pfc->seq, ret);WRITE_ONCE (instance->vsi->state.timeout,1 ); }vpu_dec_end (&instance->vpu);@@ -2091,7 +2090,7 @@ static int vdec_av1_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,/* LAT trans full, re-decode */ if (ret == -EAGAIN ) { -mtk_vcodec_err (instance,"AV1 Frame %d trans full\n" , pfc->seq); +mtk_vdec_err (ctx,"AV1 Frame %d trans full\n" , pfc->seq);if (!instance->inneracing_mode)vdec_msg_queue_qbuf (&ctx->msg_queue.lat_ctx, lat_buf);return 0 ;@@ -2099,14 +2098,14 @@ static int vdec_av1_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,/* LAT trans full, no more UBE or decode timeout */ if (ret == -ENOMEM || vsi->state.timeout) { -mtk_vcodec_err (instance,"AV1 Frame %d insufficient buffer or timeout\n" , pfc->seq); +mtk_vdec_err (ctx,"AV1 Frame %d insufficient buffer or timeout\n" , pfc->seq);if (!instance->inneracing_mode)vdec_msg_queue_qbuf (&ctx->msg_queue.lat_ctx, lat_buf);return -EBUSY ; } vsi->trans.dma_addr_end += ctx->msg_queue.wdma_addr.dma_addr; -mtk_vcodec_debug (instance,"lat dma 1 0x%pad 0x%pad\n" , - &pfc->vsi.trans.dma_addr, &pfc->vsi.trans.dma_addr_end); +mtk_vdec_debug (ctx,"lat dma 1 0x%pad 0x%pad\n" , + &pfc->vsi.trans.dma_addr, &pfc->vsi.trans.dma_addr_end);vdec_msg_queue_update_ube_wptr (&ctx->msg_queue, vsi->trans.dma_addr_end);@@ -2120,7 +2119,7 @@ static int vdec_av1_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,vdec_msg_queue_qbuf (&ctx->msg_queue.lat_ctx, lat_buf);if (pfc) -mtk_vcodec_err (instance,"slice dec number: %d err: %d" , pfc->seq, ret); +mtk_vdec_err (ctx,"slice dec number: %d err: %d" , pfc->seq, ret);return ret; }@@ -2153,13 +2152,13 @@ static int vdec_av1_slice_core_decode(struct vdec_lat_buf *lat_buf) ret =vdec_av1_slice_setup_core (instance, fb, lat_buf, pfc);if (ret) { -mtk_vcodec_err (instance,"vdec_av1_slice_setup_core\n" ); +mtk_vdec_err (ctx,"vdec_av1_slice_setup_core\n" ); goto err; }vdec_av1_slice_vsi_to_remote (&pfc->vsi, instance->core_vsi); ret =vpu_dec_core (&instance->vpu);if (ret) { -mtk_vcodec_err (instance,"vpu_dec_core\n" ); +mtk_vdec_err (ctx,"vpu_dec_core\n" ); goto err; }@@ -2169,7 +2168,7 @@ static int vdec_av1_slice_core_decode(struct vdec_lat_buf *lat_buf) MTK_VDEC_CORE);/* update remote vsi if decode timeout */ if (ret) { -mtk_vcodec_err (instance,"AV1 frame %d core timeout\n" , pfc->seq); +mtk_vdec_err (ctx,"AV1 frame %d core timeout\n" , pfc->seq);WRITE_ONCE (instance->vsi->state.timeout,1 ); }vpu_dec_core_end (&instance->vpu);@@ -2177,12 +2176,12 @@ static int vdec_av1_slice_core_decode(struct vdec_lat_buf *lat_buf) ret =vdec_av1_slice_update_core (instance, lat_buf, pfc);if (ret) { -mtk_vcodec_err (instance,"vdec_av1_slice_update_core\n" ); +mtk_vdec_err (ctx,"vdec_av1_slice_update_core\n" ); goto err; } -mtk_vcodec_debug (instance,"core dma_addr_end 0x%pad\n" , - &instance->core_vsi->trans.dma_addr_end); +mtk_vdec_debug (ctx,"core dma_addr_end 0x%pad\n" , + &instance->core_vsi->trans.dma_addr_end);vdec_msg_queue_update_ube_rptr (&ctx->msg_queue, instance->core_vsi->trans.dma_addr_end); ctx->dev->vdec_pdata->cap_to_disp (ctx,0 , lat_buf->src_buf_req);drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c +31
-35@@ -144,7 +144,7 @@ static int allocate_predication_buf(struct vdec_h264_inst *inst) inst->pred_buf.size =BUF_PREDICTION_SZ ; err =mtk_vcodec_mem_alloc (inst->ctx, &inst->pred_buf);if (err) { -mtk_vcodec_err (inst,"failed to allocate ppl buf" ); +mtk_vdec_err (inst->ctx,"failed to allocate ppl buf" );return err; }@@ -176,7 +176,7 @@ static int alloc_mv_buf(struct vdec_h264_inst *inst, struct vdec_pic_info *pic) mem->size = buf_sz; err =mtk_vcodec_mem_alloc (inst->ctx, mem);if (err) { -mtk_vcodec_err (inst,"failed to allocate mv buf" ); +mtk_vdec_err (inst->ctx,"failed to allocate mv buf" );return err; } inst->vsi->mv_buf_dma[i] = mem->dma_addr;@@ -207,9 +207,9 @@ static int check_list_validity(struct vdec_h264_inst *inst, bool disp_list)if (list->count >H264_MAX_FB_NUM || list->read_idx >=H264_MAX_FB_NUM || list->write_idx >=H264_MAX_FB_NUM ) { -mtk_vcodec_err (inst,"%s list err: cnt=%d r_idx=%d w_idx=%d" , - disp_list ?"disp" :"free" , list->count, - list->read_idx, list->write_idx); +mtk_vdec_err (inst->ctx,"%s list err: cnt=%d r_idx=%d w_idx=%d" , + disp_list ?"disp" :"free" , list->count, + list->read_idx, list->write_idx);return -EINVAL ; }@@ -226,12 +226,12 @@ static void put_fb_to_free(struct vdec_h264_inst *inst, struct vdec_fb *fb) list = &inst->vsi->list_free;if (list->count ==H264_MAX_FB_NUM ) { -mtk_vcodec_err (inst,"[FB] put fb free_list full" ); +mtk_vdec_err (inst->ctx,"[FB] put fb free_list full" );return ; } -mtk_vcodec_debug (inst,"[FB] put fb into free_list @(%p, %llx)" , - fb->base_y.va, (u64 )fb->base_y.dma_addr); +mtk_vdec_debug (inst->ctx,"[FB] put fb into free_list @(%p, %llx)" , + fb->base_y.va, (u64 )fb->base_y.dma_addr); list->fb_list[list->write_idx].vdec_fb_va = (u64 )(uintptr_t )fb; list->write_idx = (list->write_idx == H264_MAX_FB_NUM - 1) ?@@ -244,10 +244,9 @@ static void get_pic_info(struct vdec_h264_inst *inst, struct vdec_pic_info *pic) { *pic = inst->vsi->pic; -mtk_vcodec_debug (inst,"pic(%d, %d), buf(%d, %d)" , - pic->pic_w, pic->pic_h, pic->buf_w, pic->buf_h); -mtk_vcodec_debug (inst,"fb size: Y(%d), C(%d)" , - pic->fb_sz[0 ], pic->fb_sz[1 ]); +mtk_vdec_debug (inst->ctx,"pic(%d, %d), buf(%d, %d)" , + pic->pic_w, pic->pic_h, pic->buf_w, pic->buf_h); +mtk_vdec_debug (inst->ctx,"fb size: Y(%d), C(%d)" , pic->fb_sz[0 ], pic->fb_sz[1 ]); }static void get_crop_info (struct vdec_h264_inst *inst,struct v4l2_rect *cr)@@ -257,14 +256,14 @@ static void get_crop_info(struct vdec_h264_inst *inst, struct v4l2_rect *cr) cr->width = inst->vsi->crop.width; cr->height = inst->vsi->crop.height; -mtk_vcodec_debug (inst,"l=%d, t=%d, w=%d, h=%d" , - cr->left, cr->top, cr->width, cr->height); +mtk_vdec_debug (inst->ctx,"l=%d, t=%d, w=%d, h=%d" , cr->left, cr->top, + cr->width, cr->height); }static void get_dpb_size (struct vdec_h264_inst *inst,unsigned int *dpb_sz) { *dpb_sz = inst->vsi->dec.dpb_sz; -mtk_vcodec_debug (inst,"sz=%d" , *dpb_sz); +mtk_vdec_debug (inst->ctx,"sz=%d" , *dpb_sz); }static int vdec_h264_init (struct mtk_vcodec_ctx *ctx)@@ -283,7 +282,7 @@ static int vdec_h264_init(struct mtk_vcodec_ctx *ctx) err =vpu_dec_init (&inst->vpu);if (err) { -mtk_vcodec_err (inst,"vdec_h264 init err=%d" , err); +mtk_vdec_err (ctx,"vdec_h264 init err=%d" , err); goto error_free_inst; }@@ -292,7 +291,7 @@ static int vdec_h264_init(struct mtk_vcodec_ctx *ctx)if (err) goto error_deinit; -mtk_vcodec_debug (inst,"H264 Instance >> %p" , inst); +mtk_vdec_debug (ctx,"H264 Instance >> %p" , inst); ctx->drv_handle = inst;return 0 ;@@ -344,8 +343,8 @@ static int vdec_h264_decode(void *h_vdec, struct mtk_vcodec_mem *bs,uint64_t y_fb_dma = fb ? (u64 )fb->base_y.dma_addr :0 ;uint64_t c_fb_dma = fb ? (u64 )fb->base_c.dma_addr :0 ; -mtk_vcodec_debug (inst,"+ [%d] FB y_dma=%llx c_dma=%llx va=%p" , - ++inst->num_nalu, y_fb_dma, c_fb_dma, fb); +mtk_vdec_debug (inst->ctx,"+ [%d] FB y_dma=%llx c_dma=%llx va=%p" , + ++inst->num_nalu, y_fb_dma, c_fb_dma, fb);/* bs NULL means flush decoder */ if (bs ==NULL )@@ -355,15 +354,15 @@ static int vdec_h264_decode(void *h_vdec, struct mtk_vcodec_mem *bs, buf_sz = bs->size; nal_start_idx =find_start_code (buf, buf_sz);if (nal_start_idx <0 ) { -mtk_vcodec_err (inst,"invalid nal start code" ); +mtk_vdec_err (inst->ctx,"invalid nal start code" ); err = -EIO ; goto err_free_fb_out; } nal_start = buf[nal_start_idx]; nal_type =NAL_TYPE (buf[nal_start_idx]); -mtk_vcodec_debug (inst,"\n + NALU[%d] type %d +\n" , inst->num_nalu, - nal_type); +mtk_vdec_debug (inst->ctx,"\n + NALU[%d] type %d +\n" , inst->num_nalu, + nal_type);if (nal_type ==NAL_H264_PPS ) { buf_sz -= nal_start_idx;@@ -384,8 +383,7 @@ static int vdec_h264_decode(void *h_vdec, struct mtk_vcodec_mem *bs, err =vpu_dec_start (vpu, data,2 );if (err) {if (err >0 && (DEC_ERR_RET (err) ==H264_ERR_NOT_VALID )) { -mtk_vcodec_err (inst,"- error bitstream - err = %d -" , - err); +mtk_vdec_err (inst->ctx,"- error bitstream - err = %d -" , err); err = -EIO ; } goto err_free_fb_out;@@ -395,7 +393,7 @@ static int vdec_h264_decode(void *h_vdec, struct mtk_vcodec_mem *bs,if (*res_chg) {struct vdec_pic_info pic; -mtk_vcodec_debug (inst,"- resolution changed -" ); +mtk_vdec_debug (inst->ctx,"- resolution changed -" );get_pic_info (inst, &pic);if (inst->vsi->dec.realloc_mv_buf) {@@ -416,13 +414,12 @@ static int vdec_h264_decode(void *h_vdec, struct mtk_vcodec_mem *bs,vpu_dec_end (vpu); } -mtk_vcodec_debug (inst,"\n - NALU[%d] type=%d -\n" , inst->num_nalu, - nal_type); +mtk_vdec_debug (inst->ctx,"\n - NALU[%d] type=%d -\n" , inst->num_nalu, nal_type);return 0 ; err_free_fb_out:put_fb_to_free (inst, fb); -mtk_vcodec_err (inst,"\n - NALU[%d] err=%d -\n" , inst->num_nalu, err); +mtk_vdec_err (inst->ctx,"\n - NALU[%d] err=%d -\n" , inst->num_nalu, err);return err; }@@ -436,8 +433,7 @@ static void vdec_h264_get_fb(struct vdec_h264_inst *inst,return ;if (list->count ==0 ) { -mtk_vcodec_debug (inst,"[FB] there is no %s fb" , - disp_list ?"disp" :"free" ); +mtk_vdec_debug (inst->ctx,"[FB] there is no %s fb" , disp_list ?"disp" :"free" ); *out_fb =NULL ;return ; }@@ -447,10 +443,10 @@ static void vdec_h264_get_fb(struct vdec_h264_inst *inst, fb->status |= (disp_list ?FB_ST_DISPLAY :FB_ST_FREE ); *out_fb = fb; -mtk_vcodec_debug (inst,"[FB] get %s fb st=%d poc=%d %llx" , - disp_list ?"disp" :"free" , - fb->status, list->fb_list[list->read_idx].poc, - list->fb_list[list->read_idx].vdec_fb_va); +mtk_vdec_debug (inst->ctx,"[FB] get %s fb st=%d poc=%d %llx" , + disp_list ?"disp" :"free" , + fb->status, list->fb_list[list->read_idx].poc, + list->fb_list[list->read_idx].vdec_fb_va); list->read_idx = (list->read_idx ==H264_MAX_FB_NUM -1 ) ?0 : list->read_idx +1 ;@@ -484,7 +480,7 @@ static int vdec_h264_get_param(void *h_vdec, enum vdec_get_param_type type,break ;default : -mtk_vcodec_err (inst,"invalid get parameter type=%d" , type); +mtk_vdec_err (inst->ctx,"invalid get parameter type=%d" , type);return -EINVAL ; }drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c +23
-23@@ -162,7 +162,7 @@ static int allocate_predication_buf(struct vdec_h264_slice_inst *inst) inst->pred_buf.size =BUF_PREDICTION_SZ ; err =mtk_vcodec_mem_alloc (inst->ctx, &inst->pred_buf);if (err) { -mtk_vcodec_err (inst,"failed to allocate ppl buf" ); +mtk_vdec_err (inst->ctx,"failed to allocate ppl buf" );return err; }@@ -195,7 +195,7 @@ static int alloc_mv_buf(struct vdec_h264_slice_inst *inst, mem->size = buf_sz; err =mtk_vcodec_mem_alloc (inst->ctx, mem);if (err) { -mtk_vcodec_err (inst,"failed to allocate mv buf" ); +mtk_vdec_err (inst->ctx,"failed to allocate mv buf" );return err; } inst->vsi_ctx.mv_buf_dma[i] = mem->dma_addr;@@ -230,11 +230,11 @@ static void get_pic_info(struct vdec_h264_slice_inst *inst, ctx->q_data[MTK_Q_DATA_DST ].fmt->num_planes; *pic = ctx->picinfo; -mtk_vcodec_debug (inst,"pic(%d, %d), buf(%d, %d)" , - ctx->picinfo.pic_w, ctx->picinfo.pic_h, - ctx->picinfo.buf_w, ctx->picinfo.buf_h); -mtk_vcodec_debug (inst,"Y/C(%d, %d)" , ctx->picinfo.fb_sz[0 ], - ctx->picinfo.fb_sz[1 ]); +mtk_vdec_debug (inst->ctx,"pic(%d, %d), buf(%d, %d)" , + ctx->picinfo.pic_w, ctx->picinfo.pic_h, + ctx->picinfo.buf_w, ctx->picinfo.buf_h); +mtk_vdec_debug (inst->ctx,"Y/C(%d, %d)" , ctx->picinfo.fb_sz[0 ], + ctx->picinfo.fb_sz[1 ]);if (ctx->last_decoded_picinfo.pic_w != ctx->picinfo.pic_w || ctx->last_decoded_picinfo.pic_h != ctx->picinfo.pic_h) {@@ -259,14 +259,14 @@ static void get_crop_info(struct vdec_h264_slice_inst *inst, struct v4l2_rect *c cr->width = inst->vsi_ctx.crop.width; cr->height = inst->vsi_ctx.crop.height; -mtk_vcodec_debug (inst,"l=%d, t=%d, w=%d, h=%d" , - cr->left, cr->top, cr->width, cr->height); +mtk_vdec_debug (inst->ctx,"l=%d, t=%d, w=%d, h=%d" , + cr->left, cr->top, cr->width, cr->height); }static void get_dpb_size (struct vdec_h264_slice_inst *inst,unsigned int *dpb_sz) { *dpb_sz = inst->vsi_ctx.dec.dpb_sz; -mtk_vcodec_debug (inst,"sz=%d" , *dpb_sz); +mtk_vdec_debug (inst->ctx,"sz=%d" , *dpb_sz); }static int vdec_h264_slice_init (struct mtk_vcodec_ctx *ctx)@@ -285,7 +285,7 @@ static int vdec_h264_slice_init(struct mtk_vcodec_ctx *ctx) err =vpu_dec_init (&inst->vpu);if (err) { -mtk_vcodec_err (inst,"vdec_h264 init err=%d" , err); +mtk_vdec_err (ctx,"vdec_h264 init err=%d" , err); goto error_free_inst; }@@ -297,13 +297,13 @@ static int vdec_h264_slice_init(struct mtk_vcodec_ctx *ctx)if (err) goto error_deinit; -mtk_vcodec_debug (inst,"struct size = %zu,%zu,%zu,%zu\n" , -sizeof (struct mtk_h264_sps_param ), -sizeof (struct mtk_h264_pps_param ), -sizeof (struct mtk_h264_dec_slice_param ), -sizeof (struct mtk_h264_dpb_info )); +mtk_vdec_debug (ctx,"struct size = %zu,%zu,%zu,%zu\n" , +sizeof (struct mtk_h264_sps_param ), +sizeof (struct mtk_h264_pps_param ), +sizeof (struct mtk_h264_dec_slice_param ), +sizeof (struct mtk_h264_dpb_info )); -mtk_vcodec_debug (inst,"H264 Instance >> %p" , inst); +mtk_vdec_debug (ctx,"H264 Instance >> %p" , inst); ctx->drv_handle = inst;return 0 ;@@ -354,8 +354,8 @@ static int vdec_h264_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs, y_fb_dma = fb ? (u64 )fb->base_y.dma_addr :0 ; c_fb_dma = fb ? (u64 )fb->base_c.dma_addr :0 ; -mtk_vcodec_debug (inst,"+ [%d] FB y_dma=%llx c_dma=%llx va=%p" , - inst->num_nalu, y_fb_dma, c_fb_dma, fb); +mtk_vdec_debug (inst->ctx,"+ [%d] FB y_dma=%llx c_dma=%llx va=%p" , + inst->num_nalu, y_fb_dma, c_fb_dma, fb); inst->vsi_ctx.dec.bs_dma = (uint64_t )bs->dma_addr; inst->vsi_ctx.dec.y_fb_dma = y_fb_dma;@@ -380,7 +380,7 @@ static int vdec_h264_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs, *res_chg = inst->vsi_ctx.dec.resolution_changed;if (*res_chg) { -mtk_vcodec_debug (inst,"- resolution changed -" ); +mtk_vdec_debug (inst->ctx,"- resolution changed -" );if (inst->vsi_ctx.dec.realloc_mv_buf) { err =alloc_mv_buf (inst, &inst->ctx->picinfo); inst->vsi_ctx.dec.realloc_mv_buf = false;@@ -404,11 +404,11 @@ static int vdec_h264_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs,vpu_dec_end (vpu);memcpy (&inst->vsi_ctx, inst->vpu.vsi,sizeof (inst->vsi_ctx)); -mtk_vcodec_debug (inst,"\n - NALU[%d]" , inst->num_nalu); +mtk_vdec_debug (inst->ctx,"\n - NALU[%d]" , inst->num_nalu);return 0 ; err_free_fb_out: -mtk_vcodec_err (inst,"\n - NALU[%d] err=%d -\n" , inst->num_nalu, err); +mtk_vdec_err (inst->ctx,"\n - NALU[%d] err=%d -\n" , inst->num_nalu, err);return err; }@@ -430,7 +430,7 @@ static int vdec_h264_slice_get_param(void *h_vdec, enum vdec_get_param_type typebreak ;default : -mtk_vcodec_err (inst,"invalid get parameter type=%d" , type); +mtk_vdec_err (inst->ctx,"invalid get parameter type=%d" , type);return -EINVAL ; }drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c +60
-64@@ -199,7 +199,7 @@ static int vdec_h264_slice_fill_decode_parameters(struct vdec_h264_slice_inst *ireturn PTR_ERR (pps);if (dec_params->flags &V4L2_H264_DECODE_PARAM_FLAG_FIELD_PIC ) { -mtk_vcodec_err (inst,"No support for H.264 field decoding." ); +mtk_vdec_err (inst->ctx,"No support for H.264 field decoding." ); inst->is_field_bitstream = true;return -EINVAL ; }@@ -322,7 +322,7 @@ static int vdec_h264_slice_alloc_mv_buf(struct vdec_h264_slice_inst *inst, mem->size = buf_sz; err =mtk_vcodec_mem_alloc (inst->ctx, mem);if (err) { -mtk_vcodec_err (inst,"failed to allocate mv buf" ); +mtk_vdec_err (inst->ctx,"failed to allocate mv buf" );return err; } }@@ -359,11 +359,11 @@ static void vdec_h264_slice_get_pic_info(struct vdec_h264_slice_inst *inst) inst->cap_num_planes = ctx->q_data[MTK_Q_DATA_DST ].fmt->num_planes; -mtk_vcodec_debug (inst,"pic(%d, %d), buf(%d, %d)" , - ctx->picinfo.pic_w, ctx->picinfo.pic_h, - ctx->picinfo.buf_w, ctx->picinfo.buf_h); -mtk_vcodec_debug (inst,"Y/C(%d, %d)" , ctx->picinfo.fb_sz[0 ], - ctx->picinfo.fb_sz[1 ]); +mtk_vdec_debug (ctx,"pic(%d, %d), buf(%d, %d)" , + ctx->picinfo.pic_w, ctx->picinfo.pic_h, + ctx->picinfo.buf_w, ctx->picinfo.buf_h); +mtk_vdec_debug (ctx,"Y/C(%d, %d)" , ctx->picinfo.fb_sz[0 ], + ctx->picinfo.fb_sz[1 ]);if (ctx->last_decoded_picinfo.pic_w != ctx->picinfo.pic_w || ctx->last_decoded_picinfo.pic_h != ctx->picinfo.pic_h) {@@ -389,8 +389,8 @@ static void vdec_h264_slice_get_crop_info(struct vdec_h264_slice_inst *inst, cr->width = inst->ctx->picinfo.pic_w; cr->height = inst->ctx->picinfo.pic_h; -mtk_vcodec_debug (inst,"l=%d, t=%d, w=%d, h=%d" , - cr->left, cr->top, cr->width, cr->height); +mtk_vdec_debug (inst->ctx,"l=%d, t=%d, w=%d, h=%d" , + cr->left, cr->top, cr->width, cr->height); }static int vdec_h264_slice_init (struct mtk_vcodec_ctx *ctx)@@ -412,7 +412,7 @@ static int vdec_h264_slice_init(struct mtk_vcodec_ctx *ctx) err =vpu_dec_init (&inst->vpu);if (err) { -mtk_vcodec_err (inst,"vdec_h264 init err=%d" , err); +mtk_vdec_err (ctx,"vdec_h264 init err=%d" , err); goto error_free_inst; }@@ -423,14 +423,14 @@ static int vdec_h264_slice_init(struct mtk_vcodec_ctx *ctx) inst->resolution_changed = true; inst->realloc_mv_buf = true; -mtk_vcodec_debug (inst,"lat struct size = %d,%d,%d,%d vsi: %d\n" , - (int )sizeof (struct mtk_h264_sps_param ), - (int )sizeof (struct mtk_h264_pps_param ), - (int )sizeof (struct vdec_h264_slice_lat_dec_param ), - (int )sizeof (struct mtk_h264_dpb_info ), - vsi_size); -mtk_vcodec_debug (inst,"lat H264 instance >> %p, codec_type = 0x%x" , - inst, inst->vpu.codec_type); +mtk_vdec_debug (ctx,"lat struct size = %d,%d,%d,%d vsi: %d\n" , + (int )sizeof (struct mtk_h264_sps_param ), + (int )sizeof (struct mtk_h264_pps_param ), + (int )sizeof (struct vdec_h264_slice_lat_dec_param ), + (int )sizeof (struct mtk_h264_dpb_info ), + vsi_size); +mtk_vdec_debug (ctx,"lat H264 instance >> %p, codec_type = 0x%x" , + inst, inst->vpu.codec_type); ctx->drv_handle = inst;return 0 ;@@ -464,14 +464,14 @@ static int vdec_h264_slice_core_decode(struct vdec_lat_buf *lat_buf)struct mtk_vcodec_mem *mem;struct vdec_vpu_inst *vpu = &inst->vpu; -mtk_vcodec_debug (inst,"[h264-core] vdec_h264 core decode" ); +mtk_vdec_debug (ctx,"[h264-core] vdec_h264 core decode" );memcpy (&inst->vsi_core->h264_slice_params, &share_info->h264_slice_params,sizeof (share_info->h264_slice_params)); fb = ctx->dev->vdec_pdata->get_cap_buffer (ctx);if (!fb) { err = -EBUSY ; -mtk_vcodec_err (inst,"fb buffer is NULL" ); +mtk_vdec_err (ctx,"fb buffer is NULL" ); goto vdec_dec_end; }@@ -483,8 +483,7 @@ static int vdec_h264_slice_core_decode(struct vdec_lat_buf *lat_buf)else c_fb_dma = (u64 )fb->base_c.dma_addr; -mtk_vcodec_debug (inst,"[h264-core] y/c addr = 0x%llx 0x%llx" , y_fb_dma, - c_fb_dma); +mtk_vdec_debug (ctx,"[h264-core] y/c addr = 0x%llx 0x%llx" , y_fb_dma, c_fb_dma); inst->vsi_core->dec.y_fb_dma = y_fb_dma; inst->vsi_core->dec.c_fb_dma = c_fb_dma;@@ -514,7 +513,7 @@ static int vdec_h264_slice_core_decode(struct vdec_lat_buf *lat_buf) err =vpu_dec_core (vpu);if (err) { -mtk_vcodec_err (inst,"core decode err=%d" , err); +mtk_vdec_err (ctx,"core decode err=%d" , err); goto vdec_dec_end; }@@ -522,22 +521,21 @@ static int vdec_h264_slice_core_decode(struct vdec_lat_buf *lat_buf) timeout =mtk_vcodec_wait_for_done_ctx (inst->ctx,MTK_INST_IRQ_RECEIVED ,WAIT_INTR_TIMEOUT_MS ,MTK_VDEC_CORE );if (timeout) -mtk_vcodec_err (inst,"core decode timeout: pic_%d" , - ctx->decoded_frame_cnt); +mtk_vdec_err (ctx,"core decode timeout: pic_%d" , ctx->decoded_frame_cnt); inst->vsi_core->dec.timeout = !!timeout;vpu_dec_core_end (vpu); -mtk_vcodec_debug (inst,"pic[%d] crc: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x" , - ctx->decoded_frame_cnt, - inst->vsi_core->dec.crc[0 ], inst->vsi_core->dec.crc[1 ], - inst->vsi_core->dec.crc[2 ], inst->vsi_core->dec.crc[3 ], - inst->vsi_core->dec.crc[4 ], inst->vsi_core->dec.crc[5 ], - inst->vsi_core->dec.crc[6 ], inst->vsi_core->dec.crc[7 ]); +mtk_vdec_debug (ctx,"pic[%d] crc: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x" , + ctx->decoded_frame_cnt, + inst->vsi_core->dec.crc[0 ], inst->vsi_core->dec.crc[1 ], + inst->vsi_core->dec.crc[2 ], inst->vsi_core->dec.crc[3 ], + inst->vsi_core->dec.crc[4 ], inst->vsi_core->dec.crc[5 ], + inst->vsi_core->dec.crc[6 ], inst->vsi_core->dec.crc[7 ]); vdec_dec_end:vdec_msg_queue_update_ube_rptr (&lat_buf->ctx->msg_queue, share_info->trans_end); ctx->dev->vdec_pdata->cap_to_disp (ctx, !!err, lat_buf->src_buf_req); -mtk_vcodec_debug (inst,"core decode done err=%d" , err); +mtk_vdec_debug (ctx,"core decode done err=%d" , err); ctx->decoded_frame_cnt++;return 0 ; }@@ -594,7 +592,7 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, lat_buf =vdec_msg_queue_dqbuf (&inst->ctx->msg_queue.lat_ctx);if (!lat_buf) { -mtk_vcodec_debug (inst,"failed to get lat buffer" ); +mtk_vdec_debug (inst->ctx,"failed to get lat buffer" );return -EAGAIN ; } share_info = lat_buf->private_data;@@ -623,7 +621,7 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, *res_chg = inst->resolution_changed;if (inst->resolution_changed) { -mtk_vcodec_debug (inst,"- resolution changed -" ); +mtk_vdec_debug (inst->ctx,"- resolution changed -" );if (inst->realloc_mv_buf) { err =vdec_h264_slice_alloc_mv_buf (inst, &inst->ctx->picinfo); inst->realloc_mv_buf = false;@@ -646,19 +644,19 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, inst->vsi->trans_end = inst->ctx->msg_queue.wdma_rptr_addr; inst->vsi->trans_start = inst->ctx->msg_queue.wdma_wptr_addr; -mtk_vcodec_debug (inst,"lat:trans(0x%llx 0x%llx) err:0x%llx" , - inst->vsi->wdma_start_addr, - inst->vsi->wdma_end_addr, - inst->vsi->wdma_err_addr); - -mtk_vcodec_debug (inst,"slice(0x%llx 0x%llx) rprt((0x%llx 0x%llx))" , - inst->vsi->slice_bc_start_addr, - inst->vsi->slice_bc_end_addr, - inst->vsi->trans_start, - inst->vsi->trans_end); +mtk_vdec_debug (inst->ctx,"lat:trans(0x%llx 0x%llx) err:0x%llx" , + inst->vsi->wdma_start_addr, + inst->vsi->wdma_end_addr, + inst->vsi->wdma_err_addr); + +mtk_vdec_debug (inst->ctx,"slice(0x%llx 0x%llx) rprt((0x%llx 0x%llx))" , + inst->vsi->slice_bc_start_addr, + inst->vsi->slice_bc_end_addr, + inst->vsi->trans_start, + inst->vsi->trans_end); err =vpu_dec_start (vpu, data,2 );if (err) { -mtk_vcodec_debug (inst,"lat decode err: %d" , err); +mtk_vdec_debug (inst->ctx,"lat decode err: %d" , err); goto err_free_fb_out; }@@ -677,7 +675,7 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, timeout =mtk_vcodec_wait_for_done_ctx (inst->ctx,MTK_INST_IRQ_RECEIVED ,WAIT_INTR_TIMEOUT_MS ,MTK_VDEC_LAT0 );if (timeout) -mtk_vcodec_err (inst,"lat decode timeout: pic_%d" , inst->slice_dec_num); +mtk_vdec_err (inst->ctx,"lat decode timeout: pic_%d" , inst->slice_dec_num); inst->vsi->dec.timeout = !!timeout; err =vpu_dec_end (vpu);@@ -685,7 +683,7 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,if (!IS_VDEC_INNER_RACING (inst->ctx->dev->dec_capability))vdec_msg_queue_qbuf (&inst->ctx->msg_queue.lat_ctx, lat_buf); inst->slice_dec_num++; -mtk_vcodec_err (inst,"lat dec fail: pic_%d err:%d" , inst->slice_dec_num, err); +mtk_vdec_err (inst->ctx,"lat dec fail: pic_%d err:%d" , inst->slice_dec_num, err);return -EINVAL ; }@@ -698,14 +696,14 @@ static int vdec_h264_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, sizeof(share_info->h264_slice_params));vdec_msg_queue_qbuf (&inst->ctx->msg_queue.core_ctx, lat_buf); } -mtk_vcodec_debug (inst,"dec num: %d lat crc: 0x%x 0x%x 0x%x" , inst->slice_dec_num, - inst->vsi->dec.crc[0 ], inst->vsi->dec.crc[1 ], inst->vsi->dec.crc[2 ]); +mtk_vdec_debug (inst->ctx,"dec num: %d lat crc: 0x%x 0x%x 0x%x" , inst->slice_dec_num, + inst->vsi->dec.crc[0 ], inst->vsi->dec.crc[1 ], inst->vsi->dec.crc[2 ]); inst->slice_dec_num++;return 0 ; err_free_fb_out:vdec_msg_queue_qbuf (&inst->ctx->msg_queue.lat_ctx, lat_buf); -mtk_vcodec_err (inst,"slice dec number: %d err: %d" , inst->slice_dec_num, err); +mtk_vdec_err (inst->ctx,"slice dec number: %d err: %d" , inst->slice_dec_num, err);return err; }@@ -732,8 +730,8 @@ static int vdec_h264_slice_single_decode(void *h_vdec, struct mtk_vcodec_mem *bs y_fb_dma = fb ? (u64 )fb->base_y.dma_addr :0 ; c_fb_dma = fb ? (u64 )fb->base_c.dma_addr :0 ; -mtk_vcodec_debug (inst,"[h264-dec] [%d] y_dma=%llx c_dma=%llx" , - inst->ctx->decoded_frame_cnt, y_fb_dma, c_fb_dma); +mtk_vdec_debug (inst->ctx,"[h264-dec] [%d] y_dma=%llx c_dma=%llx" , + inst->ctx->decoded_frame_cnt, y_fb_dma, c_fb_dma); inst->vsi_ctx.dec.bs_buf_addr = (u64 )bs->dma_addr; inst->vsi_ctx.dec.bs_buf_size = bs->size;@@ -757,7 +755,7 @@ static int vdec_h264_slice_single_decode(void *h_vdec, struct mtk_vcodec_mem *bs *res_chg = inst->resolution_changed;if (inst->resolution_changed) { -mtk_vcodec_debug (inst,"- resolution changed -" ); +mtk_vdec_debug (inst->ctx,"- resolution changed -" );if (inst->realloc_mv_buf) { err =vdec_h264_slice_alloc_mv_buf (inst, &inst->ctx->picinfo); inst->realloc_mv_buf = false;@@ -781,8 +779,7 @@ static int vdec_h264_slice_single_decode(void *h_vdec, struct mtk_vcodec_mem *bs err =mtk_vcodec_wait_for_done_ctx (inst->ctx,MTK_INST_IRQ_RECEIVED ,WAIT_INTR_TIMEOUT_MS ,MTK_VDEC_CORE );if (err) -mtk_vcodec_err (inst,"decode timeout: pic_%d" , - inst->ctx->decoded_frame_cnt); +mtk_vdec_err (inst->ctx,"decode timeout: pic_%d" , inst->ctx->decoded_frame_cnt); inst->vsi->dec.timeout = !!err; err =vpu_dec_end (vpu);@@ -790,19 +787,18 @@ static int vdec_h264_slice_single_decode(void *h_vdec, struct mtk_vcodec_mem *bs goto err_free_fb_out;memcpy (&inst->vsi_ctx, inst->vpu.vsi,sizeof (inst->vsi_ctx)); -mtk_vcodec_debug (inst,"pic[%d] crc: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x" , - inst->ctx->decoded_frame_cnt, - inst->vsi_ctx.dec.crc[0 ], inst->vsi_ctx.dec.crc[1 ], - inst->vsi_ctx.dec.crc[2 ], inst->vsi_ctx.dec.crc[3 ], - inst->vsi_ctx.dec.crc[4 ], inst->vsi_ctx.dec.crc[5 ], - inst->vsi_ctx.dec.crc[6 ], inst->vsi_ctx.dec.crc[7 ]); +mtk_vdec_debug (inst->ctx,"pic[%d] crc: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x" , + inst->ctx->decoded_frame_cnt, + inst->vsi_ctx.dec.crc[0 ], inst->vsi_ctx.dec.crc[1 ], + inst->vsi_ctx.dec.crc[2 ], inst->vsi_ctx.dec.crc[3 ], + inst->vsi_ctx.dec.crc[4 ], inst->vsi_ctx.dec.crc[5 ], + inst->vsi_ctx.dec.crc[6 ], inst->vsi_ctx.dec.crc[7 ]); inst->ctx->decoded_frame_cnt++;return 0 ; err_free_fb_out: -mtk_vcodec_err (inst,"dec frame number: %d err: %d" , - inst->ctx->decoded_frame_cnt, err); +mtk_vdec_err (inst->ctx,"dec frame number: %d err: %d" , inst->ctx->decoded_frame_cnt, err);return err; }@@ -839,7 +835,7 @@ static int vdec_h264_slice_get_param(void *h_vdec, enum vdec_get_param_type typevdec_h264_slice_get_crop_info (inst, out);break ;default : -mtk_vcodec_err (inst,"invalid get parameter type=%d" , type); +mtk_vdec_err (inst->ctx,"invalid get parameter type=%d" , type);return -EINVAL ; }return 0 ;drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c +46
-48@@ -657,7 +657,7 @@ static int vdec_hevc_slice_alloc_mv_buf(struct vdec_hevc_slice_inst *inst, mem->size = buf_sz; err =mtk_vcodec_mem_alloc (inst->ctx, mem);if (err) { -mtk_vcodec_err (inst,"failed to allocate mv buf" ); +mtk_vdec_err (inst->ctx,"failed to allocate mv buf" );return err; } }@@ -694,11 +694,11 @@ static void vdec_hevc_slice_get_pic_info(struct vdec_hevc_slice_inst *inst) inst->cap_num_planes = ctx->q_data[MTK_Q_DATA_DST ].fmt->num_planes; -mtk_vcodec_debug (inst,"pic(%d, %d), buf(%d, %d)" , - ctx->picinfo.pic_w, ctx->picinfo.pic_h, - ctx->picinfo.buf_w, ctx->picinfo.buf_h); -mtk_vcodec_debug (inst,"Y/C(%d, %d)" , ctx->picinfo.fb_sz[0 ], - ctx->picinfo.fb_sz[1 ]); +mtk_vdec_debug (ctx,"pic(%d, %d), buf(%d, %d)" , + ctx->picinfo.pic_w, ctx->picinfo.pic_h, + ctx->picinfo.buf_w, ctx->picinfo.buf_h); +mtk_vdec_debug (ctx,"Y/C(%d, %d)" , ctx->picinfo.fb_sz[0 ], + ctx->picinfo.fb_sz[1 ]);if (ctx->last_decoded_picinfo.pic_w != ctx->picinfo.pic_w || ctx->last_decoded_picinfo.pic_h != ctx->picinfo.pic_h) {@@ -724,8 +724,8 @@ static void vdec_hevc_slice_get_crop_info(struct vdec_hevc_slice_inst *inst, cr->width = inst->ctx->picinfo.pic_w; cr->height = inst->ctx->picinfo.pic_h; -mtk_vcodec_debug (inst,"l=%d, t=%d, w=%d, h=%d" , - cr->left, cr->top, cr->width, cr->height); +mtk_vdec_debug (inst->ctx,"l=%d, t=%d, w=%d, h=%d" , + cr->left, cr->top, cr->width, cr->height); } static int vdec_hevc_slice_setup_lat_buffer(struct vdec_hevc_slice_inst *inst,@@ -747,7 +747,7 @@ static int vdec_hevc_slice_setup_lat_buffer(struct vdec_hevc_slice_inst *inst, *res_chg = inst->resolution_changed;if (inst->resolution_changed) { -mtk_vcodec_debug (inst,"- resolution changed -" ); +mtk_vdec_debug (inst->ctx,"- resolution changed -" );if (inst->realloc_mv_buf) { err =vdec_hevc_slice_alloc_mv_buf (inst, &inst->ctx->picinfo); inst->realloc_mv_buf = false;@@ -779,16 +779,16 @@ static int vdec_hevc_slice_setup_lat_buffer(struct vdec_hevc_slice_inst *inst, share_info->trans.dma_addr = inst->vsi->trans.dma_addr; share_info->trans.dma_addr_end = inst->vsi->trans.dma_addr_end; -mtk_vcodec_debug (inst,"lat: ube addr/size(0x%llx 0x%llx) err:0x%llx" , - inst->vsi->ube.buf, - inst->vsi->ube.padding, - inst->vsi->err_map.buf); +mtk_vdec_debug (inst->ctx,"lat: ube addr/size(0x%llx 0x%llx) err:0x%llx" , + inst->vsi->ube.buf, + inst->vsi->ube.padding, + inst->vsi->err_map.buf); -mtk_vcodec_debug (inst,"slice addr/size(0x%llx 0x%llx) trans start/end((0x%llx 0x%llx))" , - inst->vsi->slice_bc.buf, - inst->vsi->slice_bc.padding, - inst->vsi->trans.buf, - inst->vsi->trans.padding); +mtk_vdec_debug (inst->ctx,"slice addr/size(0x%llx 0x%llx) trans start/end((0x%llx 0x%llx))" , + inst->vsi->slice_bc.buf, + inst->vsi->slice_bc.padding, + inst->vsi->trans.buf, + inst->vsi->trans.padding);return 0 ; }@@ -806,7 +806,7 @@ static int vdec_hevc_slice_setup_core_buffer(struct vdec_hevc_slice_inst *inst, fb = ctx->dev->vdec_pdata->get_cap_buffer (ctx);if (!fb) { -mtk_vcodec_err (inst,"fb buffer is NULL" ); +mtk_vdec_err (inst->ctx,"fb buffer is NULL" );return -EBUSY ; }@@ -817,8 +817,7 @@ static int vdec_hevc_slice_setup_core_buffer(struct vdec_hevc_slice_inst *inst,else c_fb_dma = (u64 )fb->base_c.dma_addr; -mtk_vcodec_debug (inst,"[hevc-core] y/c addr = 0x%llx 0x%llx" , y_fb_dma, - c_fb_dma); +mtk_vdec_debug (inst->ctx,"[hevc-core] y/c addr = 0x%llx 0x%llx" , y_fb_dma, c_fb_dma); inst->vsi_core->fb.y.dma_addr = y_fb_dma; inst->vsi_core->fb.y.size = ctx->picinfo.fb_sz[0 ];@@ -874,7 +873,7 @@ static int vdec_hevc_slice_init(struct mtk_vcodec_ctx *ctx) ctx->drv_handle = inst; err =vpu_dec_init (&inst->vpu);if (err) { -mtk_vcodec_err (inst,"vdec_hevc init err=%d" , err); +mtk_vdec_err (ctx,"vdec_hevc init err=%d" , err); goto error_free_inst; }@@ -891,14 +890,14 @@ static int vdec_hevc_slice_init(struct mtk_vcodec_ctx *ctx)if (err) goto error_free_inst; -mtk_vcodec_debug (inst,"lat struct size = %d,%d,%d,%d vsi: %d\n" , - (int )sizeof (struct mtk_hevc_sps_param ), - (int )sizeof (struct mtk_hevc_pps_param ), - (int )sizeof (struct vdec_hevc_slice_lat_dec_param ), - (int )sizeof (struct mtk_hevc_dpb_info ), +mtk_vdec_debug (ctx,"lat struct size = %d,%d,%d,%d vsi: %d\n" , + (int )sizeof (struct mtk_hevc_sps_param ), + (int )sizeof (struct mtk_hevc_pps_param ), + (int )sizeof (struct vdec_hevc_slice_lat_dec_param ), + (int )sizeof (struct mtk_hevc_dpb_info ), vsi_size); -mtk_vcodec_debug (inst,"lat hevc instance >> %p, codec_type = 0x%x" , - inst, inst->vpu.codec_type); +mtk_vdec_debug (ctx,"lat hevc instance >> %p, codec_type = 0x%x" , + inst, inst->vpu.codec_type);return 0 ; error_free_inst:@@ -930,7 +929,7 @@ static int vdec_hevc_slice_core_decode(struct vdec_lat_buf *lat_buf)struct vdec_hevc_slice_share_info *share_info = lat_buf->private_data;struct vdec_vpu_inst *vpu = &inst->vpu; -mtk_vcodec_debug (inst,"[hevc-core] vdec_hevc core decode" ); +mtk_vdec_debug (ctx,"[hevc-core] vdec_hevc core decode" );memcpy (&inst->vsi_core->hevc_slice_params, &share_info->hevc_slice_params,sizeof (share_info->hevc_slice_params));@@ -942,7 +941,7 @@ static int vdec_hevc_slice_core_decode(struct vdec_lat_buf *lat_buf) share_info); err =vpu_dec_core (vpu);if (err) { -mtk_vcodec_err (inst,"core decode err=%d" , err); +mtk_vdec_err (ctx,"core decode err=%d" , err); goto vdec_dec_end; }@@ -950,22 +949,21 @@ static int vdec_hevc_slice_core_decode(struct vdec_lat_buf *lat_buf) timeout =mtk_vcodec_wait_for_done_ctx (inst->ctx,MTK_INST_IRQ_RECEIVED ,WAIT_INTR_TIMEOUT_MS ,MTK_VDEC_CORE );if (timeout) -mtk_vcodec_err (inst,"core decode timeout: pic_%d" , - ctx->decoded_frame_cnt); +mtk_vdec_err (ctx,"core decode timeout: pic_%d" , ctx->decoded_frame_cnt); inst->vsi_core->dec.timeout = !!timeout;vpu_dec_core_end (vpu); -mtk_vcodec_debug (inst,"pic[%d] crc: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x" , - ctx->decoded_frame_cnt, - inst->vsi_core->dec.crc[0 ], inst->vsi_core->dec.crc[1 ], - inst->vsi_core->dec.crc[2 ], inst->vsi_core->dec.crc[3 ], - inst->vsi_core->dec.crc[4 ], inst->vsi_core->dec.crc[5 ], - inst->vsi_core->dec.crc[6 ], inst->vsi_core->dec.crc[7 ]); +mtk_vdec_debug (ctx,"pic[%d] crc: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x" , + ctx->decoded_frame_cnt, + inst->vsi_core->dec.crc[0 ], inst->vsi_core->dec.crc[1 ], + inst->vsi_core->dec.crc[2 ], inst->vsi_core->dec.crc[3 ], + inst->vsi_core->dec.crc[4 ], inst->vsi_core->dec.crc[5 ], + inst->vsi_core->dec.crc[6 ], inst->vsi_core->dec.crc[7 ]); vdec_dec_end:vdec_msg_queue_update_ube_rptr (&lat_buf->ctx->msg_queue, share_info->trans.dma_addr_end); ctx->dev->vdec_pdata->cap_to_disp (ctx, !!err, lat_buf->src_buf_req); -mtk_vcodec_debug (inst,"core decode done err=%d" , err); +mtk_vdec_debug (ctx,"core decode done err=%d" , err); ctx->decoded_frame_cnt++;return 0 ; }@@ -993,7 +991,7 @@ static int vdec_hevc_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, lat_buf =vdec_msg_queue_dqbuf (&inst->ctx->msg_queue.lat_ctx);if (!lat_buf) { -mtk_vcodec_debug (inst,"failed to get lat buffer" ); +mtk_vdec_debug (inst->ctx,"failed to get lat buffer" );return -EAGAIN ; }@@ -1008,7 +1006,7 @@ static int vdec_hevc_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, err =vpu_dec_start (vpu, data,2 );if (err) { -mtk_vcodec_debug (inst,"lat decode err: %d" , err); +mtk_vdec_debug (inst->ctx,"lat decode err: %d" , err); goto err_free_fb_out; }@@ -1022,7 +1020,7 @@ static int vdec_hevc_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, timeout =mtk_vcodec_wait_for_done_ctx (inst->ctx,MTK_INST_IRQ_RECEIVED ,WAIT_INTR_TIMEOUT_MS ,MTK_VDEC_LAT0 );if (timeout) -mtk_vcodec_err (inst,"lat decode timeout: pic_%d" , inst->slice_dec_num); +mtk_vdec_err (inst->ctx,"lat decode timeout: pic_%d" , inst->slice_dec_num); inst->vsi->dec.timeout = !!timeout; err =vpu_dec_end (vpu);@@ -1030,7 +1028,7 @@ static int vdec_hevc_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,if (!IS_VDEC_INNER_RACING (inst->ctx->dev->dec_capability))vdec_msg_queue_qbuf (&inst->ctx->msg_queue.lat_ctx, lat_buf); inst->slice_dec_num++; -mtk_vcodec_err (inst,"lat dec fail: pic_%d err:%d" , inst->slice_dec_num, err); +mtk_vdec_err (inst->ctx,"lat dec fail: pic_%d err:%d" , inst->slice_dec_num, err);return -EINVAL ; }@@ -1043,14 +1041,14 @@ static int vdec_hevc_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, sizeof(share_info->hevc_slice_params));vdec_msg_queue_qbuf (&inst->ctx->msg_queue.core_ctx, lat_buf); } -mtk_vcodec_debug (inst,"dec num: %d lat crc: 0x%x 0x%x 0x%x" , inst->slice_dec_num, - inst->vsi->dec.crc[0 ], inst->vsi->dec.crc[1 ], inst->vsi->dec.crc[2 ]); +mtk_vdec_debug (inst->ctx,"dec num: %d lat crc: 0x%x 0x%x 0x%x" , inst->slice_dec_num, + inst->vsi->dec.crc[0 ], inst->vsi->dec.crc[1 ], inst->vsi->dec.crc[2 ]); inst->slice_dec_num++;return 0 ; err_free_fb_out:vdec_msg_queue_qbuf (&inst->ctx->msg_queue.lat_ctx, lat_buf); -mtk_vcodec_err (inst,"slice dec number: %d err: %d" , inst->slice_dec_num, err); +mtk_vdec_err (inst->ctx,"slice dec number: %d err: %d" , inst->slice_dec_num, err);return err; }@@ -1081,7 +1079,7 @@ static int vdec_hevc_slice_get_param(void *h_vdec, enum vdec_get_param_type typevdec_hevc_slice_get_crop_info (inst, out);break ;default : -mtk_vcodec_err (inst,"invalid get parameter type=%d" , type); +mtk_vdec_err (inst->ctx,"invalid get parameter type=%d" , type);return -EINVAL ; }return 0 ;drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +22
-25@@ -284,10 +284,10 @@ static void get_pic_info(struct vdec_vp8_inst *inst, struct vdec_pic_info *pic) { *pic = inst->vsi->pic; -mtk_vcodec_debug (inst,"pic(%d, %d), buf(%d, %d)" , - pic->pic_w, pic->pic_h, pic->buf_w, pic->buf_h); -mtk_vcodec_debug (inst,"fb size: Y(%d), C(%d)" , - pic->fb_sz[0 ], pic->fb_sz[1 ]); +mtk_vdec_debug (inst->ctx,"pic(%d, %d), buf(%d, %d)" , + pic->pic_w, pic->pic_h, pic->buf_w, pic->buf_h); +mtk_vdec_debug (inst->ctx,"fb size: Y(%d), C(%d)" , + pic->fb_sz[0 ], pic->fb_sz[1 ]); }static void vp8_dec_finish (struct vdec_vp8_inst *inst)@@ -295,7 +295,7 @@ static void vp8_dec_finish(struct vdec_vp8_inst *inst)struct vdec_fb_node *node;uint64_t prev_y_dma = inst->vsi->dec.prev_y_dma; -mtk_vcodec_debug (inst,"prev fb base dma=%llx" , prev_y_dma); +mtk_vdec_debug (inst->ctx,"prev fb base dma=%llx" , prev_y_dma);/* put last decode ok frame to fb_free_list */ if (prev_y_dma !=0 ) {@@ -370,7 +370,7 @@ static int alloc_working_buf(struct vdec_vp8_inst *inst) mem->size =VP8_WORKING_BUF_SZ ; err =mtk_vcodec_mem_alloc (inst->ctx, mem);if (err) { -mtk_vcodec_err (inst,"Cannot allocate working buffer" ); +mtk_vdec_err (inst->ctx,"Cannot allocate working buffer" );return err; }@@ -404,7 +404,7 @@ static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx) err =vpu_dec_init (&inst->vpu);if (err) { -mtk_vcodec_err (inst,"vdec_vp8 init err=%d" , err); +mtk_vdec_err (ctx,"vdec_vp8 init err=%d" , err); goto error_free_inst; }@@ -415,7 +415,7 @@ static int vdec_vp8_init(struct mtk_vcodec_ctx *ctx) goto error_deinit;get_hw_reg_base (inst); -mtk_vcodec_debug (inst,"VP8 Instance >> %p" , inst); +mtk_vdec_debug (ctx,"VP8 Instance >> %p" , inst); ctx->drv_handle = inst;return 0 ;@@ -448,8 +448,8 @@ static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs, y_fb_dma = fb ? (u64 )fb->base_y.dma_addr :0 ; c_fb_dma = fb ? (u64 )fb->base_c.dma_addr :0 ; -mtk_vcodec_debug (inst,"+ [%d] FB y_dma=%llx c_dma=%llx fb=%p" , - inst->frm_cnt, y_fb_dma, c_fb_dma, fb); +mtk_vdec_debug (inst->ctx,"+ [%d] FB y_dma=%llx c_dma=%llx fb=%p" , + inst->frm_cnt, y_fb_dma, c_fb_dma, fb); inst->cur_fb = fb; dec->bs_dma = (unsigned long )bs->dma_addr;@@ -457,7 +457,7 @@ static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs, dec->cur_y_fb_dma = y_fb_dma; dec->cur_c_fb_dma = c_fb_dma; -mtk_vcodec_debug (inst,"\n + FRAME[%d] +\n" , inst->frm_cnt); +mtk_vdec_debug (inst->ctx,"\n + FRAME[%d] +\n" , inst->frm_cnt);write_hw_segmentation_data (inst);enable_hw_rw_function (inst);@@ -472,7 +472,7 @@ static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs,if (err) {add_fb_to_free_list (inst, fb);if (dec->wait_key_frame) { -mtk_vcodec_debug (inst,"wait key frame !" ); +mtk_vdec_debug (inst->ctx,"wait key frame !" );return 0 ; }@@ -480,7 +480,7 @@ static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs, }if (dec->resolution_changed) { -mtk_vcodec_debug (inst,"- resolution_changed -" ); +mtk_vdec_debug (inst->ctx,"- resolution_changed -" ); *res_chg = true;add_fb_to_free_list (inst, fb);return 0 ;@@ -500,14 +500,13 @@ static int vdec_vp8_decode(void *h_vdec, struct mtk_vcodec_mem *bs,if (err) goto error; -mtk_vcodec_debug (inst,"\n - FRAME[%d] - show=%d\n" , inst->frm_cnt, - dec->show_frame); +mtk_vdec_debug (inst->ctx,"\n - FRAME[%d] - show=%d\n" , inst->frm_cnt, dec->show_frame); inst->frm_cnt++; *res_chg = false;return 0 ; error: -mtk_vcodec_err (inst,"\n - FRAME[%d] - err=%d\n" , inst->frm_cnt, err); +mtk_vdec_err (inst->ctx,"\n - FRAME[%d] - err=%d\n" , inst->frm_cnt, err);return err; }@@ -522,11 +521,10 @@ static void get_disp_fb(struct vdec_vp8_inst *inst, struct vdec_fb **out_fb)list_move_tail (&node->list, &inst->available_fb_node_list); fb = (struct vdec_fb *)node->fb; fb->status |=FB_ST_DISPLAY ; -mtk_vcodec_debug (inst,"[FB] get disp fb %p st=%d" , - node->fb, fb->status); +mtk_vdec_debug (inst->ctx,"[FB] get disp fb %p st=%d" , node->fb, fb->status); }else { fb =NULL ; -mtk_vcodec_debug (inst,"[FB] there is no disp fb" ); +mtk_vdec_debug (inst->ctx,"[FB] there is no disp fb" ); } *out_fb = fb;@@ -543,11 +541,10 @@ static void get_free_fb(struct vdec_vp8_inst *inst, struct vdec_fb **out_fb)list_move_tail (&node->list, &inst->available_fb_node_list); fb = (struct vdec_fb *)node->fb; fb->status |=FB_ST_FREE ; -mtk_vcodec_debug (inst,"[FB] get free fb %p st=%d" , - node->fb, fb->status); +mtk_vdec_debug (inst->ctx,"[FB] get free fb %p st=%d" , node->fb, fb->status); }else { fb =NULL ; -mtk_vcodec_debug (inst,"[FB] there is no free fb" ); +mtk_vdec_debug (inst->ctx,"[FB] there is no free fb" ); } *out_fb = fb;@@ -559,8 +556,8 @@ static void get_crop_info(struct vdec_vp8_inst *inst, struct v4l2_rect *cr) cr->top =0 ; cr->width = inst->vsi->pic.pic_w; cr->height = inst->vsi->pic.pic_h; -mtk_vcodec_debug (inst,"get crop info l=%d, t=%d, w=%d, h=%d" , - cr->left, cr->top, cr->width, cr->height); +mtk_vdec_debug (inst->ctx,"get crop info l=%d, t=%d, w=%d, h=%d" , + cr->left, cr->top, cr->width, cr->height); } static int vdec_vp8_get_param(void *h_vdec, enum vdec_get_param_type type,@@ -590,7 +587,7 @@ static int vdec_vp8_get_param(void *h_vdec, enum vdec_get_param_type type,break ;default : -mtk_vcodec_err (inst,"invalid get parameter type=%d" , type); +mtk_vdec_err (inst->ctx,"invalid get parameter type=%d" , type);return -EINVAL ; }drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c +33
-33@@ -137,11 +137,11 @@ static void vdec_vp8_slice_get_pic_info(struct vdec_vp8_slice_inst *inst) inst->vsi->pic.buf_h = ctx->picinfo.buf_h; inst->vsi->pic.fb_sz[0 ] = ctx->picinfo.fb_sz[0 ]; inst->vsi->pic.fb_sz[1 ] = ctx->picinfo.fb_sz[1 ]; -mtk_vcodec_debug (inst,"pic(%d, %d), buf(%d, %d)" , - ctx->picinfo.pic_w, ctx->picinfo.pic_h, - ctx->picinfo.buf_w, ctx->picinfo.buf_h); -mtk_vcodec_debug (inst,"fb size: Y(%d), C(%d)" , - ctx->picinfo.fb_sz[0 ], ctx->picinfo.fb_sz[1 ]); +mtk_vdec_debug (inst->ctx,"pic(%d, %d), buf(%d, %d)" , + ctx->picinfo.pic_w, ctx->picinfo.pic_h, + ctx->picinfo.buf_w, ctx->picinfo.buf_h); +mtk_vdec_debug (inst->ctx,"fb size: Y(%d), C(%d)" , + ctx->picinfo.fb_sz[0 ], ctx->picinfo.fb_sz[1 ]); }static int vdec_vp8_slice_alloc_working_buf (struct vdec_vp8_slice_inst *inst)@@ -153,7 +153,7 @@ static int vdec_vp8_slice_alloc_working_buf(struct vdec_vp8_slice_inst *inst) mem->size =VP8_SEG_ID_SZ ; err =mtk_vcodec_mem_alloc (inst->ctx, mem);if (err) { -mtk_vcodec_err (inst,"Cannot allocate working buffer" ); +mtk_vdec_err (inst->ctx,"Cannot allocate working buffer" );return err; } inst->vsi->dec.seg_id_buf_dma = (u64 )mem->dma_addr;@@ -162,7 +162,7 @@ static int vdec_vp8_slice_alloc_working_buf(struct vdec_vp8_slice_inst *inst) mem->size =VP8_PP_WRAPY_SZ ; err =mtk_vcodec_mem_alloc (inst->ctx, mem);if (err) { -mtk_vcodec_err (inst,"cannot allocate WRAP Y buffer" ); +mtk_vdec_err (inst->ctx,"cannot allocate WRAP Y buffer" );return err; } inst->vsi->dec.wrap_y_dma = (u64 )mem->dma_addr;@@ -171,7 +171,7 @@ static int vdec_vp8_slice_alloc_working_buf(struct vdec_vp8_slice_inst *inst) mem->size =VP8_PP_WRAPC_SZ ; err =mtk_vcodec_mem_alloc (inst->ctx, mem);if (err) { -mtk_vcodec_err (inst,"cannot allocate WRAP C buffer" ); +mtk_vdec_err (inst->ctx,"cannot allocate WRAP C buffer" );return err; } inst->vsi->dec.wrap_c_dma = (u64 )mem->dma_addr;@@ -180,7 +180,7 @@ static int vdec_vp8_slice_alloc_working_buf(struct vdec_vp8_slice_inst *inst) mem->size =VP8_VLD_PRED_SZ ; err =mtk_vcodec_mem_alloc (inst->ctx, mem);if (err) { -mtk_vcodec_err (inst,"cannot allocate vld wrapper buffer" ); +mtk_vdec_err (inst->ctx,"cannot allocate vld wrapper buffer" );return err; } inst->vsi->dec.vld_wrapper_dma = (u64 )mem->dma_addr;@@ -249,8 +249,8 @@ static int vdec_vp8_slice_get_decode_parameters(struct vdec_vp8_slice_inst *inst vb =vb2_find_buffer (vq, referenct_ts);if (!vb) {if (!V4L2_VP8_FRAME_IS_KEY_FRAME (frame_header)) -mtk_vcodec_err (inst,"reference invalid: index(%d) ts(%lld)" , - index, referenct_ts); +mtk_vdec_err (inst->ctx,"reference invalid: index(%d) ts(%lld)" , + index, referenct_ts); inst->vsi->vp8_dpb_info[index].reference_flag =0 ;continue ; }@@ -291,7 +291,7 @@ static int vdec_vp8_slice_init(struct mtk_vcodec_ctx *ctx) err =vpu_dec_init (&inst->vpu);if (err) { -mtk_vcodec_err (inst,"vdec_vp8 init err=%d" , err); +mtk_vdec_err (ctx,"vdec_vp8 init err=%d" , err); goto error_free_inst; }@@ -300,11 +300,11 @@ static int vdec_vp8_slice_init(struct mtk_vcodec_ctx *ctx)if (err) goto error_deinit; -mtk_vcodec_debug (inst,"vp8 struct size = %d vsi: %d\n" , - (int )sizeof (struct v4l2_ctrl_vp8_frame ), - (int )sizeof (struct vdec_vp8_slice_vsi )); -mtk_vcodec_debug (inst,"vp8:%p, codec_type = 0x%x vsi: 0x%p" , - inst, inst->vpu.codec_type, inst->vpu.vsi); +mtk_vdec_debug (ctx,"vp8 struct size = %d vsi: %d\n" , + (int )sizeof (struct v4l2_ctrl_vp8_frame ), + (int )sizeof (struct vdec_vp8_slice_vsi )); +mtk_vdec_debug (ctx,"vp8:%p, codec_type = 0x%x vsi: 0x%p" , + inst, inst->vpu.codec_type, inst->vpu.vsi); ctx->drv_handle = inst;return 0 ;@@ -350,10 +350,10 @@ static int vdec_vp8_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs, inst->vsi->dec.cur_y_fb_dma = y_fb_dma; inst->vsi->dec.cur_c_fb_dma = c_fb_dma; -mtk_vcodec_debug (inst,"frame[%d] bs(%zu 0x%llx) y/c(0x%llx 0x%llx)" , - inst->ctx->decoded_frame_cnt, - bs->size, (u64 )bs->dma_addr, - y_fb_dma, c_fb_dma); +mtk_vdec_debug (inst->ctx,"frame[%d] bs(%zu 0x%llx) y/c(0x%llx 0x%llx)" , + inst->ctx->decoded_frame_cnt, + bs->size, (u64 )bs->dma_addr, + y_fb_dma, c_fb_dma);v4l2_m2m_buf_copy_metadata (&src_buf_info->m2m_buf.vb, &dst_buf_info->m2m_buf.vb, true);@@ -364,12 +364,12 @@ static int vdec_vp8_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs, err =vpu_dec_start (vpu, &data,1 );if (err) { -mtk_vcodec_debug (inst,"vp8 dec start err!" ); +mtk_vdec_debug (inst->ctx,"vp8 dec start err!" ); goto error; }if (inst->vsi->dec.resolution_changed) { -mtk_vcodec_debug (inst,"- resolution_changed -" ); +mtk_vdec_debug (inst->ctx,"- resolution_changed -" ); *res_chg = true;return 0 ; }@@ -380,15 +380,15 @@ static int vdec_vp8_slice_decode(void *h_vdec, struct mtk_vcodec_mem *bs, err =vpu_dec_end (vpu);if (err || timeout) -mtk_vcodec_debug (inst,"vp8 dec error timeout:%d err: %d pic_%d" , - timeout, err, inst->ctx->decoded_frame_cnt); +mtk_vdec_debug (inst->ctx,"vp8 dec error timeout:%d err: %d pic_%d" , + timeout, err, inst->ctx->decoded_frame_cnt); -mtk_vcodec_debug (inst,"pic[%d] crc: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x" , - inst->ctx->decoded_frame_cnt, - inst->vsi->dec.crc[0 ], inst->vsi->dec.crc[1 ], - inst->vsi->dec.crc[2 ], inst->vsi->dec.crc[3 ], - inst->vsi->dec.crc[4 ], inst->vsi->dec.crc[5 ], - inst->vsi->dec.crc[6 ], inst->vsi->dec.crc[7 ]); +mtk_vdec_debug (inst->ctx,"pic[%d] crc: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x" , + inst->ctx->decoded_frame_cnt, + inst->vsi->dec.crc[0 ], inst->vsi->dec.crc[1 ], + inst->vsi->dec.crc[2 ], inst->vsi->dec.crc[3 ], + inst->vsi->dec.crc[4 ], inst->vsi->dec.crc[5 ], + inst->vsi->dec.crc[6 ], inst->vsi->dec.crc[7 ]); inst->ctx->decoded_frame_cnt++; error:@@ -404,13 +404,13 @@ static int vdec_vp8_slice_get_param(void *h_vdec, enum vdec_get_param_type type,vdec_vp8_slice_get_pic_info (inst);break ;case GET_PARAM_CROP_INFO : -mtk_vcodec_debug (inst,"No need to get vp8 crop information." ); +mtk_vdec_debug (inst->ctx,"No need to get vp8 crop information." );break ;case GET_PARAM_DPB_SIZE : *((unsigned int *)out) =VP8_DPB_SIZE ;break ;default : -mtk_vcodec_err (inst,"invalid get parameter type=%d" , type); +mtk_vdec_err (inst->ctx,"invalid get parameter type=%d" , type);return -EINVAL ; }drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c +55
-67@@ -246,7 +246,7 @@ static void vp9_add_to_fb_free_list(struct vdec_vp9_inst *inst,list_move_tail (&node->list, &inst->fb_free_list); } }else { -mtk_vcodec_debug (inst,"No free fb node" ); +mtk_vdec_debug (inst->ctx,"No free fb node" ); } }@@ -330,7 +330,7 @@ static int vp9_get_sf_ref_fb(struct vdec_vp9_inst *inst) }if (idx ==ARRAY_SIZE (vsi->sf_ref_fb)) { -mtk_vcodec_err (inst,"List Full" ); +mtk_vdec_err (inst->ctx,"List Full" );return -1 ; }@@ -339,7 +339,7 @@ static int vp9_get_sf_ref_fb(struct vdec_vp9_inst *inst) vsi->buf_len_sz_y;if (mtk_vcodec_mem_alloc (inst->ctx, mem_basy_y)) { -mtk_vcodec_err (inst,"Cannot allocate sf_ref_buf y_buf" ); +mtk_vdec_err (inst->ctx,"Cannot allocate sf_ref_buf y_buf" );return -1 ; }@@ -348,7 +348,7 @@ static int vp9_get_sf_ref_fb(struct vdec_vp9_inst *inst) vsi->buf_len_sz_c;if (mtk_vcodec_mem_alloc (inst->ctx, mem_basy_c)) { -mtk_vcodec_err (inst,"Cannot allocate sf_ref_fb c_buf" ); +mtk_vdec_err (inst->ctx,"Cannot allocate sf_ref_fb c_buf" );return -1 ; } vsi->sf_ref_fb[idx].used =0 ;@@ -377,17 +377,13 @@ static bool vp9_alloc_work_buf(struct vdec_vp9_inst *inst)if ((vsi->pic_w > max_pic_w) || (vsi->pic_h > max_pic_h)) { -mtk_vcodec_err (inst,"Invalid w/h %d/%d" , - vsi->pic_w, vsi->pic_h); +mtk_vdec_err (inst->ctx,"Invalid w/h %d/%d" , vsi->pic_w, vsi->pic_h);return false; } -mtk_vcodec_debug (inst,"BUF CHG(%d): w/h/sb_w/sb_h=%d/%d/%d/%d" , - vsi->resolution_changed, - vsi->pic_w, - vsi->pic_h, - vsi->buf_w, - vsi->buf_h); +mtk_vdec_debug (inst->ctx,"BUF CHG(%d): w/h/sb_w/sb_h=%d/%d/%d/%d" , + vsi->resolution_changed, vsi->pic_w, + vsi->pic_h, vsi->buf_w, vsi->buf_h); mem = &inst->mv_buf;if (mem->va)@@ -398,7 +394,7 @@ static bool vp9_alloc_work_buf(struct vdec_vp9_inst *inst) result =mtk_vcodec_mem_alloc (inst->ctx, mem);if (result) { mem->size =0 ; -mtk_vcodec_err (inst,"Cannot allocate mv_buf" ); +mtk_vdec_err (inst->ctx,"Cannot allocate mv_buf" );return false; }/* Set the va again */ @@ -415,7 +411,7 @@ static bool vp9_alloc_work_buf(struct vdec_vp9_inst *inst) result =mtk_vcodec_mem_alloc (inst->ctx, mem);if (result) { mem->size =0 ; -mtk_vcodec_err (inst,"Cannot allocate seg_id_buf" ); +mtk_vdec_err (inst->ctx,"Cannot allocate seg_id_buf" );return false; }/* Set the va again */ @@ -436,7 +432,7 @@ static bool vp9_add_to_fb_disp_list(struct vdec_vp9_inst *inst,struct vdec_fb_node *node;if (!fb) { -mtk_vcodec_err (inst,"fb == NULL" ); +mtk_vdec_err (inst->ctx,"fb == NULL" );return false; }@@ -446,7 +442,7 @@ static bool vp9_add_to_fb_disp_list(struct vdec_vp9_inst *inst, node->fb = fb;list_move_tail (&node->list, &inst->fb_disp_list); }else { -mtk_vcodec_err (inst,"No available fb node" ); +mtk_vdec_err (inst->ctx,"No available fb node" );return false; }@@ -492,10 +488,10 @@ static void vp9_swap_frm_bufs(struct vdec_vp9_inst *inst)* size */ if (frm_to_show->fb !=NULL ) -mtk_vcodec_err (inst, -"inst->cur_fb->base_y.size=%zu, frm_to_show->fb.base_y.size=%zu" , - inst->cur_fb->base_y.size, - frm_to_show->fb->base_y.size); +mtk_vdec_err (inst->ctx, +"base_y.size=%zu, frm_to_show: base_y.size=%zu" , + inst->cur_fb->base_y.size, + frm_to_show->fb->base_y.size); }if (!vp9_is_sf_ref_fb (inst, inst->cur_fb)) {if (vsi->show_frame &BIT (0 ))@@ -582,20 +578,19 @@ static bool vp9_decode_end_proc(struct vdec_vp9_inst *inst)if (!vsi->show_existing_frame) { ret =vp9_wait_dec_end (inst);if (!ret) { -mtk_vcodec_err (inst,"Decode failed, Decode Timeout @[%d]" , - vsi->frm_num); +mtk_vdec_err (inst->ctx,"Decode failed, Decode Timeout @[%d]" , + vsi->frm_num);return false; }if (vpu_dec_end (&inst->vpu)) { -mtk_vcodec_err (inst,"vp9_dec_vpu_end failed" ); +mtk_vdec_err (inst->ctx,"vp9_dec_vpu_end failed" );return false; } -mtk_vcodec_debug (inst,"Decode Ok @%d (%d/%d)" , vsi->frm_num, - vsi->pic_w, vsi->pic_h); +mtk_vdec_debug (inst->ctx,"Decode Ok @%d (%d/%d)" , vsi->frm_num, + vsi->pic_w, vsi->pic_h); }else { -mtk_vcodec_debug (inst,"Decode Ok @%d (show_existing_frame)" , - vsi->frm_num); +mtk_vdec_debug (inst->ctx,"Decode Ok @%d (show_existing_frame)" , vsi->frm_num); }vp9_swap_frm_bufs (inst);@@ -624,10 +619,9 @@ static struct vdec_fb *vp9_rm_from_fb_disp_list(struct vdec_vp9_inst *inst) fb = (struct vdec_fb *)node->fb; fb->status |=FB_ST_DISPLAY ;list_move_tail (&node->list, &inst->available_fb_node_list); -mtk_vcodec_debug (inst,"[FB] get disp fb %p st=%d" , - node->fb, fb->status); +mtk_vdec_debug (inst->ctx,"[FB] get disp fb %p st=%d" , node->fb, fb->status); }else -mtk_vcodec_debug (inst,"[FB] there is no disp fb" ); +mtk_vdec_debug (inst->ctx,"[FB] there is no disp fb" );return fb; }@@ -638,7 +632,7 @@ static bool vp9_add_to_fb_use_list(struct vdec_vp9_inst *inst,struct vdec_fb_node *node;if (!fb) { -mtk_vcodec_debug (inst,"fb == NULL" ); +mtk_vdec_debug (inst->ctx,"fb == NULL" );return false; }@@ -648,7 +642,7 @@ static bool vp9_add_to_fb_use_list(struct vdec_vp9_inst *inst, node->fb = fb;list_move_tail (&node->list, &inst->fb_use_list); }else { -mtk_vcodec_err (inst,"No free fb node" ); +mtk_vdec_err (inst->ctx,"No free fb node" );return false; }return true;@@ -665,7 +659,7 @@ static void vp9_reset(struct vdec_vp9_inst *inst) inst->vsi->sf_next_ref_fb_idx =vp9_get_sf_ref_fb (inst);if (vpu_dec_reset (&inst->vpu)) -mtk_vcodec_err (inst,"vp9_dec_vpu_reset failed" ); +mtk_vdec_err (inst->ctx,"vp9_dec_vpu_reset failed" );/* Set the va again, since vpu_dec_reset will clear mv_buf in vpu */ inst->vsi->mv_buf.va = (unsigned long )inst->mv_buf.va;@@ -706,11 +700,9 @@ static void get_pic_info(struct vdec_vp9_inst *inst, struct vdec_pic_info *pic) pic->buf_w = inst->vsi->buf_w; pic->buf_h = inst->vsi->buf_h; -mtk_vcodec_debug (inst,"pic(%d, %d), buf(%d, %d)" , - pic->pic_w, pic->pic_h, pic->buf_w, pic->buf_h); -mtk_vcodec_debug (inst,"fb size: Y(%d), C(%d)" , - pic->fb_sz[0 ], - pic->fb_sz[1 ]); +mtk_vdec_debug (inst->ctx,"pic(%d, %d), buf(%d, %d)" , + pic->pic_w, pic->pic_h, pic->buf_w, pic->buf_h); +mtk_vdec_debug (inst->ctx,"fb size: Y(%d), C(%d)" , pic->fb_sz[0 ], pic->fb_sz[1 ]); }static void get_disp_fb (struct vdec_vp9_inst *inst,struct vdec_fb **out_fb)@@ -732,10 +724,9 @@ static void get_free_fb(struct vdec_vp9_inst *inst, struct vdec_fb **out_fb)list_move_tail (&node->list, &inst->available_fb_node_list); fb = (struct vdec_fb *)node->fb; fb->status |=FB_ST_FREE ; -mtk_vcodec_debug (inst,"[FB] get free fb %p st=%d" , - node->fb, fb->status); +mtk_vdec_debug (inst->ctx,"[FB] get free fb %p st=%d" , node->fb, fb->status); }else { -mtk_vcodec_debug (inst,"[FB] there is no free fb" ); +mtk_vdec_debug (inst->ctx,"[FB] there is no free fb" ); } *out_fb = fb;@@ -744,18 +735,15 @@ static void get_free_fb(struct vdec_vp9_inst *inst, struct vdec_fb **out_fb)static int validate_vsi_array_indexes (struct vdec_vp9_inst *inst,struct vdec_vp9_vsi *vsi) {if (vsi->sf_frm_idx >=VP9_MAX_FRM_BUF_NUM -1 ) { -mtk_vcodec_err (inst,"Invalid vsi->sf_frm_idx=%u." , - vsi->sf_frm_idx); +mtk_vdec_err (inst->ctx,"Invalid vsi->sf_frm_idx=%u." , vsi->sf_frm_idx);return -EIO ; }if (vsi->frm_to_show_idx >=VP9_MAX_FRM_BUF_NUM ) { -mtk_vcodec_err (inst,"Invalid vsi->frm_to_show_idx=%u." , - vsi->frm_to_show_idx); +mtk_vdec_err (inst->ctx,"Invalid vsi->frm_to_show_idx=%u." , vsi->frm_to_show_idx);return -EIO ; }if (vsi->new_fb_idx >=VP9_MAX_FRM_BUF_NUM ) { -mtk_vcodec_err (inst,"Invalid vsi->new_fb_idx=%u." , - vsi->new_fb_idx); +mtk_vdec_err (inst->ctx,"Invalid vsi->new_fb_idx=%u." , vsi->new_fb_idx);return -EIO ; }return 0 ;@@ -769,7 +757,7 @@ static void vdec_vp9_deinit(void *h_vdec) ret =vpu_dec_deinit (&inst->vpu);if (ret) -mtk_vcodec_err (inst,"vpu_dec_deinit failed" ); +mtk_vdec_err (inst->ctx,"vpu_dec_deinit failed" ); mem = &inst->mv_buf;if (mem->va)@@ -798,7 +786,7 @@ static int vdec_vp9_init(struct mtk_vcodec_ctx *ctx) inst->vpu.ctx = ctx;if (vpu_dec_init (&inst->vpu)) { -mtk_vcodec_err (inst,"vp9_dec_vpu_init failed" ); +mtk_vdec_err (inst->ctx,"vp9_dec_vpu_init failed" ); goto err_deinit_inst; }@@ -829,17 +817,17 @@ static int vdec_vp9_decode(void *h_vdec, struct mtk_vcodec_mem *bs, *res_chg = false;if ((bs ==NULL ) && (fb ==NULL )) { -mtk_vcodec_debug (inst,"[EOS]" ); +mtk_vdec_debug (inst->ctx,"[EOS]" );vp9_reset (inst);return ret; }if (bs ==NULL ) { -mtk_vcodec_err (inst,"bs == NULL" ); +mtk_vdec_err (inst->ctx,"bs == NULL" );return -EINVAL ; } -mtk_vcodec_debug (inst,"Input BS Size = %zu" , bs->size); +mtk_vdec_debug (inst->ctx,"Input BS Size = %zu" , bs->size);while (1 ) {struct vdec_fb *cur_fb =NULL ;@@ -882,7 +870,7 @@ static int vdec_vp9_decode(void *h_vdec, struct mtk_vcodec_mem *bs, ret =vpu_dec_start (&inst->vpu, data,3 );if (ret) { -mtk_vcodec_err (inst,"vpu_dec_start failed" ); +mtk_vdec_err (inst->ctx,"vpu_dec_start failed" ); goto DECODE_ERROR; }@@ -892,7 +880,7 @@ static int vdec_vp9_decode(void *h_vdec, struct mtk_vcodec_mem *bs,if (vsi->show_frame &BIT (2 )) { ret =vpu_dec_start (&inst->vpu,NULL ,0 );if (ret) { -mtk_vcodec_err (inst,"vpu trig decoder failed" ); +mtk_vdec_err (inst->ctx,"vpu trig decoder failed" ); goto DECODE_ERROR; } }@@ -900,7 +888,7 @@ static int vdec_vp9_decode(void *h_vdec, struct mtk_vcodec_mem *bs, ret =validate_vsi_array_indexes (inst, vsi);if (ret) { -mtk_vcodec_err (inst,"Invalid values from VPU." ); +mtk_vdec_err (inst->ctx,"Invalid values from VPU." ); goto DECODE_ERROR; }@@ -926,18 +914,18 @@ static int vdec_vp9_decode(void *h_vdec, struct mtk_vcodec_mem *bs,if (!vp9_is_sf_ref_fb (inst, inst->cur_fb))vp9_add_to_fb_use_list (inst, inst->cur_fb); -mtk_vcodec_debug (inst,"[#pic %d]" , vsi->frm_num); +mtk_vdec_debug (inst->ctx,"[#pic %d]" , vsi->frm_num);if (vsi->show_existing_frame) -mtk_vcodec_debug (inst, -"drv->new_fb_idx=%d, drv->frm_to_show_idx=%d" , - vsi->new_fb_idx, vsi->frm_to_show_idx); +mtk_vdec_debug (inst->ctx, +"drv->new_fb_idx=%d, drv->frm_to_show_idx=%d" , + vsi->new_fb_idx, vsi->frm_to_show_idx);if (vsi->show_existing_frame && (vsi->frm_to_show_idx <VP9_MAX_FRM_BUF_NUM )) { -mtk_vcodec_debug (inst, -"Skip Decode drv->new_fb_idx=%d, drv->frm_to_show_idx=%d" , - vsi->new_fb_idx, vsi->frm_to_show_idx); +mtk_vdec_debug (inst->ctx, +"Skip Decode drv->new_fb_idx=%d, drv->frm_to_show_idx=%d" , + vsi->new_fb_idx, vsi->frm_to_show_idx);vp9_ref_cnt_fb (inst, &vsi->new_fb_idx, vsi->frm_to_show_idx);@@ -954,14 +942,14 @@ static int vdec_vp9_decode(void *h_vdec, struct mtk_vcodec_mem *bs,if (vsi->resolution_changed) { *res_chg = true; -mtk_vcodec_debug (inst,"VDEC_ST_RESOLUTION_CHANGED" ); +mtk_vdec_debug (inst->ctx,"VDEC_ST_RESOLUTION_CHANGED" ); ret =0 ; goto DECODE_ERROR; }if (!vp9_decode_end_proc (inst)) { -mtk_vcodec_err (inst,"vp9_decode_end_proc" ); +mtk_vdec_err (inst->ctx,"vp9_decode_end_proc" ); ret = -EINVAL ; goto DECODE_ERROR; }@@ -985,8 +973,8 @@ static void get_crop_info(struct vdec_vp9_inst *inst, struct v4l2_rect *cr) cr->top =0 ; cr->width = inst->vsi->pic_w; cr->height = inst->vsi->pic_h; -mtk_vcodec_debug (inst,"get crop info l=%d, t=%d, w=%d, h=%d\n" , - cr->left, cr->top, cr->width, cr->height); +mtk_vdec_debug (inst->ctx,"get crop info l=%d, t=%d, w=%d, h=%d\n" , + cr->left, cr->top, cr->width, cr->height); } static int vdec_vp9_get_param(void *h_vdec, enum vdec_get_param_type type,@@ -1012,7 +1000,7 @@ static int vdec_vp9_get_param(void *h_vdec, enum vdec_get_param_type type,get_crop_info (inst, out);break ;default : -mtk_vcodec_err (inst,"not supported param type %d" , type); +mtk_vdec_err (inst->ctx,"not supported param type %d" , type); ret = -EINVAL ;break ; }drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c +50
-58@@ -518,7 +518,7 @@ static int vdec_vp9_slice_init_default_frame_ctx(struct vdec_vp9_slice_instance remote_frame_ctx =mtk_vcodec_fw_map_dm_addr (ctx->dev->fw_handler, (u32 )vsi->default_frame_ctx);if (!remote_frame_ctx) { -mtk_vcodec_err (instance,"failed to map default frame ctx\n" ); +mtk_vdec_err (ctx,"failed to map default frame ctx\n" );return -EINVAL ; }@@ -577,8 +577,8 @@ static int vdec_vp9_slice_alloc_working_buffer(struct vdec_vp9_slice_instance *iif (level == instance->level)return 0 ; -mtk_vcodec_debug (instance,"resolution level changed, from %u to %u, %ux%u" , - instance->level, level, w, h); +mtk_vdec_debug (ctx,"resolution level changed, from %u to %u, %ux%u" , + instance->level, level, w, h); max_sb_w =DIV_ROUND_UP (max_w,64 ); max_sb_h =DIV_ROUND_UP (max_h,64 );@@ -1025,9 +1025,9 @@ static int vdec_vp9_slice_setup_prob_buffer(struct vdec_vp9_slice_instance *inst uh = &vsi->frame.uh; -mtk_vcodec_debug (instance,"ctx dirty %u idx %d\n" , - instance->dirty[uh->frame_context_idx], - uh->frame_context_idx); +mtk_vdec_debug (instance->ctx,"ctx dirty %u idx %d\n" , + instance->dirty[uh->frame_context_idx], + uh->frame_context_idx);if (instance->dirty[uh->frame_context_idx]) frame_ctx = &instance->frame_ctx[uh->frame_context_idx];@@ -1051,7 +1051,7 @@ static void vdec_vp9_slice_setup_seg_buffer(struct vdec_vp9_slice_instance *inst uh->error_resilient_mode || uh->frame_width != instance->width || uh->frame_height != instance->height) { -mtk_vcodec_debug (instance,"reset seg\n" ); +mtk_vdec_debug (instance->ctx,"reset seg\n" );memset (buf->va,0 , buf->size); } }@@ -1093,16 +1093,14 @@ static int vdec_vp9_slice_setup_tile_buffer(struct vdec_vp9_slice_instance *inst cols =1 << cols_log2;if (rows >4 || cols >64 ) { -mtk_vcodec_err (instance,"tile_rows %u tile_cols %u\n" , - rows, cols); +mtk_vdec_err (instance->ctx,"tile_rows %u tile_cols %u\n" , rows, cols);return -EINVAL ; } offset = uh->uncompressed_header_size + uh->header_size_in_bytes;if (bs->size <= offset) { -mtk_vcodec_err (instance,"bs size %zu tile offset %u\n" , - bs->size, offset); +mtk_vdec_err (instance->ctx,"bs size %zu tile offset %u\n" , bs->size, offset);return -EINVAL ; }@@ -1596,14 +1594,12 @@ static int vdec_vp9_slice_update_single(struct vdec_vp9_slice_instance *instance vsi = &pfc->vsi;memcpy (&pfc->state[0 ], &vsi->state,sizeof (vsi->state)); -mtk_vcodec_debug (instance,"Frame %u Y_CRC %08x %08x %08x %08x\n" , - pfc->seq, - vsi->state.crc[0 ], vsi->state.crc[1 ], - vsi->state.crc[2 ], vsi->state.crc[3 ]); -mtk_vcodec_debug (instance,"Frame %u C_CRC %08x %08x %08x %08x\n" , - pfc->seq, - vsi->state.crc[4 ], vsi->state.crc[5 ], - vsi->state.crc[6 ], vsi->state.crc[7 ]); +mtk_vdec_debug (instance->ctx,"Frame %u Y_CRC %08x %08x %08x %08x\n" , + pfc->seq, vsi->state.crc[0 ], vsi->state.crc[1 ], + vsi->state.crc[2 ], vsi->state.crc[3 ]); +mtk_vdec_debug (instance->ctx,"Frame %u C_CRC %08x %08x %08x %08x\n" , + pfc->seq, vsi->state.crc[4 ], vsi->state.crc[5 ], + vsi->state.crc[6 ], vsi->state.crc[7 ]);vdec_vp9_slice_update_prob (instance, vsi);@@ -1624,10 +1620,10 @@ static int vdec_vp9_slice_update_lat(struct vdec_vp9_slice_instance *instance, vsi = &pfc->vsi;memcpy (&pfc->state[0 ], &vsi->state,sizeof (vsi->state)); -mtk_vcodec_debug (instance,"Frame %u LAT CRC 0x%08x %lx %lx\n" , - pfc->seq, vsi->state.crc[0 ], - (unsigned long )vsi->trans.dma_addr, - (unsigned long )vsi->trans.dma_addr_end); +mtk_vdec_debug (instance->ctx,"Frame %u LAT CRC 0x%08x %lx %lx\n" , + pfc->seq, vsi->state.crc[0 ], + (unsigned long )vsi->trans.dma_addr, + (unsigned long )vsi->trans.dma_addr_end);/* buffer full, need to re-decode */ if (vsi->state.full) {@@ -1844,14 +1840,12 @@ static int vdec_vp9_slice_update_core(struct vdec_vp9_slice_instance *instance, vsi = &pfc->vsi;memcpy (&pfc->state[1 ], &vsi->state,sizeof (vsi->state)); -mtk_vcodec_debug (instance,"Frame %u Y_CRC %08x %08x %08x %08x\n" , - pfc->seq, - vsi->state.crc[0 ], vsi->state.crc[1 ], - vsi->state.crc[2 ], vsi->state.crc[3 ]); -mtk_vcodec_debug (instance,"Frame %u C_CRC %08x %08x %08x %08x\n" , - pfc->seq, - vsi->state.crc[4 ], vsi->state.crc[5 ], - vsi->state.crc[6 ], vsi->state.crc[7 ]); +mtk_vdec_debug (instance->ctx,"Frame %u Y_CRC %08x %08x %08x %08x\n" , + pfc->seq, vsi->state.crc[0 ], vsi->state.crc[1 ], + vsi->state.crc[2 ], vsi->state.crc[3 ]); +mtk_vdec_debug (instance->ctx,"Frame %u C_CRC %08x %08x %08x %08x\n" , + pfc->seq, vsi->state.crc[4 ], vsi->state.crc[5 ], + vsi->state.crc[6 ], vsi->state.crc[7 ]);return 0 ; }@@ -1874,7 +1868,7 @@ static int vdec_vp9_slice_init(struct mtk_vcodec_ctx *ctx) ret =vpu_dec_init (&instance->vpu);if (ret) { -mtk_vcodec_err (instance,"failed to init vpu dec, ret %d\n" , ret); +mtk_vdec_err (ctx,"failed to init vpu dec, ret %d\n" , ret); goto error_vpu_init; }@@ -1882,7 +1876,7 @@ static int vdec_vp9_slice_init(struct mtk_vcodec_ctx *ctx) vsi = instance->vpu.vsi;if (!vsi) { -mtk_vcodec_err (instance,"failed to get VP9 vsi\n" ); +mtk_vdec_err (ctx,"failed to get VP9 vsi\n" ); ret = -EINVAL ; goto error_vsi; }@@ -1890,7 +1884,7 @@ static int vdec_vp9_slice_init(struct mtk_vcodec_ctx *ctx) instance->core_vsi =mtk_vcodec_fw_map_dm_addr (ctx->dev->fw_handler, (u32 )vsi->core_vsi);if (!instance->core_vsi) { -mtk_vcodec_err (instance,"failed to get VP9 core vsi\n" ); +mtk_vdec_err (ctx,"failed to get VP9 core vsi\n" ); ret = -EINVAL ; goto error_vsi; }@@ -1931,7 +1925,7 @@ static int vdec_vp9_slice_flush(void *h_vdec, struct mtk_vcodec_mem *bs, {struct vdec_vp9_slice_instance *instance = h_vdec; -mtk_vcodec_debug (instance,"flush ...\n" ); +mtk_vdec_debug (instance->ctx,"flush ...\n" );if (instance->ctx->dev->vdec_pdata->hw_arch !=MTK_VDEC_PURE_SINGLE_CORE )vdec_msg_queue_wait_lat_buf_full (&instance->ctx->msg_queue);return vpu_dec_reset (&instance->vpu);@@ -1942,8 +1936,7 @@ static void vdec_vp9_slice_get_pic_info(struct vdec_vp9_slice_instance *instancestruct mtk_vcodec_ctx *ctx = instance->ctx;unsigned int data[3 ]; -mtk_vcodec_debug (instance,"w %u h %u\n" , - ctx->picinfo.pic_w, ctx->picinfo.pic_h); +mtk_vdec_debug (instance->ctx,"w %u h %u\n" , ctx->picinfo.pic_w, ctx->picinfo.pic_h); data[0 ] = ctx->picinfo.pic_w; data[1 ] = ctx->picinfo.pic_h;@@ -1975,11 +1968,10 @@ static int vdec_vp9_slice_get_param(void *h_vdec, enum vdec_get_param_type type,vdec_vp9_slice_get_dpb_size (instance, out);break ;case GET_PARAM_CROP_INFO : -mtk_vcodec_debug (instance,"No need to get vp9 crop information." ); +mtk_vdec_debug (instance->ctx,"No need to get vp9 crop information." );break ;default : -mtk_vcodec_err (instance,"invalid get parameter type=%d\n" , - type); +mtk_vdec_err (instance->ctx,"invalid get parameter type=%d\n" , type);return -EINVAL ; }@@ -2011,14 +2003,14 @@ static int vdec_vp9_slice_single_decode(void *h_vdec, struct mtk_vcodec_mem *bs, ret =vdec_vp9_slice_setup_single (instance, bs, fb, pfc);if (ret) { -mtk_vcodec_err (instance,"Failed to setup VP9 single ret %d\n" , ret); +mtk_vdec_err (ctx,"Failed to setup VP9 single ret %d\n" , ret);return ret; }vdec_vp9_slice_vsi_to_remote (vsi, instance->vsi); ret =vpu_dec_start (&instance->vpu,NULL ,0 );if (ret) { -mtk_vcodec_err (instance,"Failed to dec VP9 ret %d\n" , ret); +mtk_vdec_err (ctx,"Failed to dec VP9 ret %d\n" , ret);return ret; }@@ -2026,7 +2018,7 @@ static int vdec_vp9_slice_single_decode(void *h_vdec, struct mtk_vcodec_mem *bs, WAIT_INTR_TIMEOUT_MS, MTK_VDEC_CORE);/* update remote vsi if decode timeout */ if (ret) { -mtk_vcodec_err (instance,"VP9 decode timeout %d\n" , ret); +mtk_vdec_err (ctx,"VP9 decode timeout %d\n" , ret);WRITE_ONCE (instance->vsi->state.timeout,1 ); }@@ -2035,7 +2027,7 @@ static int vdec_vp9_slice_single_decode(void *h_vdec, struct mtk_vcodec_mem *bs,vdec_vp9_slice_vsi_from_remote (vsi, instance->vsi,0 ); ret =vdec_vp9_slice_update_single (instance, pfc);if (ret) { -mtk_vcodec_err (instance,"VP9 decode error: %d\n" , ret); +mtk_vdec_err (ctx,"VP9 decode error: %d\n" , ret);return ret; }@@ -2069,7 +2061,7 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, lat_buf =vdec_msg_queue_dqbuf (&instance->ctx->msg_queue.lat_ctx);if (!lat_buf) { -mtk_vcodec_debug (instance,"Failed to get VP9 lat buf\n" ); +mtk_vdec_debug (ctx,"Failed to get VP9 lat buf\n" );return -EAGAIN ; } pfc = (struct vdec_vp9_slice_pfc *)lat_buf->private_data;@@ -2081,14 +2073,14 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, ret =vdec_vp9_slice_setup_lat (instance, bs, lat_buf, pfc);if (ret) { -mtk_vcodec_err (instance,"Failed to setup VP9 lat ret %d\n" , ret); +mtk_vdec_err (ctx,"Failed to setup VP9 lat ret %d\n" , ret); goto err_free_fb_out; }vdec_vp9_slice_vsi_to_remote (vsi, instance->vsi); ret =vpu_dec_start (&instance->vpu,NULL ,0 );if (ret) { -mtk_vcodec_err (instance,"Failed to dec VP9 ret %d\n" , ret); +mtk_vdec_err (ctx,"Failed to dec VP9 ret %d\n" , ret); goto err_free_fb_out; }@@ -2097,7 +2089,7 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs, WAIT_INTR_TIMEOUT_MS, MTK_VDEC_LAT0);/* update remote vsi if decode timeout */ if (ret) { -mtk_vcodec_err (instance,"VP9 decode timeout %d pic %d\n" , ret, pfc->seq); +mtk_vdec_err (ctx,"VP9 decode timeout %d pic %d\n" , ret, pfc->seq);WRITE_ONCE (instance->vsi->state.timeout,1 ); }vpu_dec_end (&instance->vpu);@@ -2108,13 +2100,13 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,/* LAT trans full, no more UBE or decode timeout */ if (ret) { -mtk_vcodec_err (instance,"VP9 decode error: %d\n" , ret); +mtk_vdec_err (ctx,"VP9 decode error: %d\n" , ret); goto err_free_fb_out; } -mtk_vcodec_debug (instance,"lat dma addr: 0x%lx 0x%lx\n" , - (unsigned long )pfc->vsi.trans.dma_addr, - (unsigned long )pfc->vsi.trans.dma_addr_end); +mtk_vdec_debug (ctx,"lat dma addr: 0x%lx 0x%lx\n" , + (unsigned long )pfc->vsi.trans.dma_addr, + (unsigned long )pfc->vsi.trans.dma_addr_end); vdec_msg_queue_update_ube_wptr(&ctx->msg_queue, vsi->trans.dma_addr_end +@@ -2169,14 +2161,14 @@ static int vdec_vp9_slice_core_decode(struct vdec_lat_buf *lat_buf) ret =vdec_vp9_slice_setup_core (instance, fb, lat_buf, pfc);if (ret) { -mtk_vcodec_err (instance,"vdec_vp9_slice_setup_core\n" ); +mtk_vdec_err (ctx,"vdec_vp9_slice_setup_core\n" ); goto err; }vdec_vp9_slice_vsi_to_remote (&pfc->vsi, instance->core_vsi); ret =vpu_dec_core (&instance->vpu);if (ret) { -mtk_vcodec_err (instance,"vpu_dec_core\n" ); +mtk_vdec_err (ctx,"vpu_dec_core\n" ); goto err; }@@ -2185,7 +2177,7 @@ static int vdec_vp9_slice_core_decode(struct vdec_lat_buf *lat_buf) WAIT_INTR_TIMEOUT_MS, MTK_VDEC_CORE);/* update remote vsi if decode timeout */ if (ret) { -mtk_vcodec_err (instance,"VP9 core timeout pic %d\n" , pfc->seq); +mtk_vdec_err (ctx,"VP9 core timeout pic %d\n" , pfc->seq);WRITE_ONCE (instance->core_vsi->state.timeout,1 ); }vpu_dec_core_end (&instance->vpu);@@ -2194,13 +2186,13 @@ static int vdec_vp9_slice_core_decode(struct vdec_lat_buf *lat_buf)vdec_vp9_slice_vsi_from_remote (&pfc->vsi, instance->core_vsi,1 ); ret =vdec_vp9_slice_update_core (instance, lat_buf, pfc);if (ret) { -mtk_vcodec_err (instance,"vdec_vp9_slice_update_core\n" ); +mtk_vdec_err (ctx,"vdec_vp9_slice_update_core\n" ); goto err; } pfc->vsi.trans.dma_addr_end += ctx->msg_queue.wdma_addr.dma_addr; -mtk_vcodec_debug (instance,"core dma_addr_end 0x%lx\n" , - (unsigned long )pfc->vsi.trans.dma_addr_end); +mtk_vdec_debug (ctx,"core dma_addr_end 0x%lx\n" , + (unsigned long )pfc->vsi.trans.dma_addr_end);vdec_msg_queue_update_ube_rptr (&ctx->msg_queue, pfc->vsi.trans.dma_addr_end); ctx->dev->vdec_pdata->cap_to_disp (ctx,0 , lat_buf->src_buf_req);drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c +22
-23@@ -16,7 +16,7 @@ static void handle_init_ack_msg(const struct vdec_vpu_ipi_init_ack *msg)struct vdec_vpu_inst *vpu = (struct vdec_vpu_inst *) (unsigned long )msg->ap_inst_addr; -mtk_vcodec_debug (vpu,"+ ap_inst_addr = 0x%llx" , msg->ap_inst_addr); +mtk_vdec_debug (vpu->ctx,"+ ap_inst_addr = 0x%llx" , msg->ap_inst_addr);/* mapping VPU address to kernel virtual address */ /* the content in vsi is initialized to 0 in VPU */ @@ -24,7 +24,7 @@ static void handle_init_ack_msg(const struct vdec_vpu_ipi_init_ack *msg) msg->vpu_inst_addr); vpu->inst_addr = msg->vpu_inst_addr; -mtk_vcodec_debug (vpu,"- vpu_inst_addr = 0x%x" , vpu->inst_addr); +mtk_vdec_debug (vpu->ctx,"- vpu_inst_addr = 0x%x" , vpu->inst_addr);/* Set default ABI version if dealing with unversioned firmware. */ vpu->fw_abi_version =0 ;@@ -40,7 +40,7 @@ static void handle_init_ack_msg(const struct vdec_vpu_ipi_init_ack *msg)/* Check firmware version. */ vpu->fw_abi_version = msg->vdec_abi_version; -mtk_vcodec_debug (vpu,"firmware version 0x%x\n" , vpu->fw_abi_version); +mtk_vdec_debug (vpu->ctx,"firmware version 0x%x\n" , vpu->fw_abi_version);switch (vpu->fw_abi_version) {case 1 :break ;@@ -48,8 +48,7 @@ static void handle_init_ack_msg(const struct vdec_vpu_ipi_init_ack *msg) vpu->inst_id = msg->inst_id;break ;default : -mtk_vcodec_err (vpu,"unhandled firmware version 0x%x\n" , - vpu->fw_abi_version); +mtk_vdec_err (vpu->ctx,"unhandled firmware version 0x%x\n" , vpu->fw_abi_version); vpu->failure =1 ;break ; }@@ -60,7 +59,7 @@ static void handle_get_param_msg_ack(const struct vdec_vpu_ipi_get_param_ack *msstruct vdec_vpu_inst *vpu = (struct vdec_vpu_inst *) (unsigned long )msg->ap_inst_addr; -mtk_vcodec_debug (vpu,"+ ap_inst_addr = 0x%llx" , msg->ap_inst_addr); +mtk_vdec_debug (vpu->ctx,"+ ap_inst_addr = 0x%llx" , msg->ap_inst_addr);/* param_type is enum vdec_get_param_type */ switch (msg->param_type) {@@ -69,7 +68,7 @@ static void handle_get_param_msg_ack(const struct vdec_vpu_ipi_get_param_ack *ms vpu->fb_sz[1 ] = msg->data[1 ];break ;default : -mtk_vcodec_err (vpu,"invalid get param type=%d" , msg->param_type); +mtk_vdec_err (vpu->ctx,"invalid get param type=%d" , msg->param_type); vpu->failure =1 ;break ; }@@ -96,7 +95,7 @@ static void vpu_dec_ipi_handler(void *data, unsigned int len, void *priv)return ; } -mtk_vcodec_debug (vpu,"+ id=%X" , msg->msg_id); +mtk_vdec_debug (vpu->ctx,"+ id=%X" , msg->msg_id); vpu->failure = msg->status; vpu->signaled =1 ;@@ -119,12 +118,12 @@ static void vpu_dec_ipi_handler(void *data, unsigned int len, void *priv)handle_get_param_msg_ack (data);break ;default : -mtk_vcodec_err (vpu,"invalid msg=%X" , msg->msg_id); +mtk_vdec_err (vpu->ctx,"invalid msg=%X" , msg->msg_id);break ; } } -mtk_vcodec_debug (vpu,"- id=%X" , msg->msg_id); +mtk_vdec_debug (vpu->ctx,"- id=%X" , msg->msg_id); }static int vcodec_vpu_send_msg (struct vdec_vpu_inst *vpu,void *msg,int len)@@ -132,7 +131,7 @@ static int vcodec_vpu_send_msg(struct vdec_vpu_inst *vpu, void *msg, int len)int err, id, msgid; msgid = *(uint32_t *)msg; -mtk_vcodec_debug (vpu,"id=%X" , msgid); +mtk_vdec_debug (vpu->ctx,"id=%X" , msgid); vpu->failure =0 ; vpu->signaled =0 ;@@ -150,8 +149,8 @@ static int vcodec_vpu_send_msg(struct vdec_vpu_inst *vpu, void *msg, int len) err =mtk_vcodec_fw_ipi_send (vpu->ctx->dev->fw_handler, id, msg, len,2000 );if (err) { -mtk_vcodec_err (vpu,"send fail vpu_id=%d msg_id=%X status=%d" , - id, msgid, err); +mtk_vdec_err (vpu->ctx,"send fail vpu_id=%d msg_id=%X status=%d" , + id, msgid, err);return err; }@@ -163,7 +162,7 @@ static int vcodec_send_ap_ipi(struct vdec_vpu_inst *vpu, unsigned int msg_id)struct vdec_ap_ipi_cmd msg;int err =0 ; -mtk_vcodec_debug (vpu,"+ id=%X" , msg_id); +mtk_vdec_debug (vpu->ctx,"+ id=%X" , msg_id);memset (&msg,0 ,sizeof (msg)); msg.msg_id = msg_id;@@ -174,7 +173,7 @@ static int vcodec_send_ap_ipi(struct vdec_vpu_inst *vpu, unsigned int msg_id) msg.codec_type = vpu->codec_type; err =vcodec_vpu_send_msg (vpu, &msg,sizeof (msg)); -mtk_vcodec_debug (vpu,"- id=%X ret=%d" , msg_id, err); +mtk_vdec_debug (vpu->ctx,"- id=%X ret=%d" , msg_id, err);return err; }@@ -189,7 +188,7 @@ int vpu_dec_init(struct vdec_vpu_inst *vpu) err =mtk_vcodec_fw_ipi_register (vpu->ctx->dev->fw_handler, vpu->id, vpu->handler,"vdec" ,NULL );if (err) { -mtk_vcodec_err (vpu,"vpu_ipi_register fail status=%d" , err); +mtk_vdec_err (vpu->ctx,"vpu_ipi_register fail status=%d" , err);return err; }@@ -198,7 +197,7 @@ int vpu_dec_init(struct vdec_vpu_inst *vpu) vpu->core_id, vpu->handler, "vdec", NULL);if (err) { -mtk_vcodec_err (vpu,"vpu_ipi_register core fail status=%d" , err); +mtk_vdec_err (vpu->ctx,"vpu_ipi_register core fail status=%d" , err);return err; } }@@ -208,10 +207,10 @@ int vpu_dec_init(struct vdec_vpu_inst *vpu) msg.ap_inst_addr = (unsigned long )vpu; msg.codec_type = vpu->codec_type; -mtk_vcodec_debug (vpu,"vdec_inst=%p" , vpu); +mtk_vdec_debug (vpu->ctx,"vdec_inst=%p" , vpu); err =vcodec_vpu_send_msg (vpu, (void *)&msg,sizeof (msg)); -mtk_vcodec_debug (vpu,"- ret=%d" , err); +mtk_vdec_debug (vpu->ctx,"- ret=%d" , err);return err; }@@ -222,7 +221,7 @@ int vpu_dec_start(struct vdec_vpu_inst *vpu, uint32_t *data, unsigned int len)int err =0 ;if (len >ARRAY_SIZE (msg.data)) { -mtk_vcodec_err (vpu,"invalid len = %d\n" , len); +mtk_vdec_err (vpu->ctx,"invalid len = %d\n" , len);return -EINVAL ; }@@ -238,7 +237,7 @@ int vpu_dec_start(struct vdec_vpu_inst *vpu, uint32_t *data, unsigned int len) msg.codec_type = vpu->codec_type; err =vcodec_vpu_send_msg (vpu, (void *)&msg,sizeof (msg)); -mtk_vcodec_debug (vpu,"- ret=%d" , err); +mtk_vdec_debug (vpu->ctx,"- ret=%d" , err);return err; }@@ -249,7 +248,7 @@ int vpu_dec_get_param(struct vdec_vpu_inst *vpu, uint32_t *data,int err;if (len >ARRAY_SIZE (msg.data)) { -mtk_vcodec_err (vpu,"invalid len = %d\n" , len); +mtk_vdec_err (vpu->ctx,"invalid len = %d\n" , len);return -EINVAL ; }@@ -261,7 +260,7 @@ int vpu_dec_get_param(struct vdec_vpu_inst *vpu, uint32_t *data, msg.codec_type = vpu->codec_type; err =vcodec_vpu_send_msg (vpu, (void *)&msg,sizeof (msg)); -mtk_vcodec_debug (vpu,"- ret=%d" , err); +mtk_vdec_debug (vpu->ctx,"- ret=%d" , err);return err; }drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c +32
-37@@ -240,13 +240,13 @@ static unsigned int h264_get_profile(struct venc_h264_inst *inst,case V4L2_MPEG_VIDEO_H264_PROFILE_HIGH :return 100 ;case V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE : -mtk_vcodec_err (inst,"unsupported CONSTRAINED_BASELINE" ); +mtk_venc_err (inst->ctx,"unsupported CONSTRAINED_BASELINE" );return 0 ;case V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED : -mtk_vcodec_err (inst,"unsupported EXTENDED" ); +mtk_venc_err (inst->ctx,"unsupported EXTENDED" );return 0 ;default : -mtk_vcodec_debug (inst,"unsupported profile %d" , profile); +mtk_venc_debug (inst->ctx,"unsupported profile %d" , profile);return 100 ; } }@@ -256,7 +256,7 @@ static unsigned int h264_get_level(struct venc_h264_inst *inst, {switch (level) {case V4L2_MPEG_VIDEO_H264_LEVEL_1B : -mtk_vcodec_err (inst,"unsupported 1B" ); +mtk_venc_err (inst->ctx,"unsupported 1B" );return 0 ;case V4L2_MPEG_VIDEO_H264_LEVEL_1_0 :return 10 ;@@ -289,7 +289,7 @@ static unsigned int h264_get_level(struct venc_h264_inst *inst,case V4L2_MPEG_VIDEO_H264_LEVEL_5_1 :return 51 ;default : -mtk_vcodec_debug (inst,"unsupported level %d" , level); +mtk_venc_debug (inst->ctx,"unsupported level %d" , level);return 31 ; } }@@ -360,8 +360,7 @@ static int h264_enc_alloc_work_buf(struct venc_h264_inst *inst, bool is_34bit) ret =mtk_vcodec_mem_alloc (inst->ctx, &inst->work_bufs[i]);if (ret) { -mtk_vcodec_err (inst, -"cannot allocate buf %d" , i); +mtk_venc_err (inst->ctx,"cannot allocate buf %d" , i); goto err_alloc; }/* @@ -385,18 +384,17 @@ static int h264_enc_alloc_work_buf(struct venc_h264_inst *inst, bool is_34bit)else wb[i].iova = inst->work_bufs[i].dma_addr; -mtk_vcodec_debug (inst, -"work_buf[%d] va=0x%p iova=%pad size=%zu" , - i, inst->work_bufs[i].va, - &inst->work_bufs[i].dma_addr, - inst->work_bufs[i].size); +mtk_venc_debug (inst->ctx,"work_buf[%d] va=0x%p iova=%pad size=%zu" , + i, inst->work_bufs[i].va, + &inst->work_bufs[i].dma_addr, + inst->work_bufs[i].size); }/* the pps_buf is used by AP side only */ inst->pps_buf.size =128 ; ret =mtk_vcodec_mem_alloc (inst->ctx, &inst->pps_buf);if (ret) { -mtk_vcodec_err (inst,"cannot allocate pps_buf" ); +mtk_venc_err (inst->ctx,"cannot allocate pps_buf" ); goto err_alloc; }@@ -416,7 +414,7 @@ static unsigned int h264_enc_wait_venc_done(struct venc_h264_inst *inst)if (!mtk_vcodec_wait_for_done_ctx (ctx,MTK_INST_IRQ_RECEIVED ,WAIT_INTR_TIMEOUT_MS ,0 )) { irq_status = ctx->irq_status; -mtk_vcodec_debug (inst,"irq_status %x <-" , irq_status); +mtk_venc_debug (ctx,"irq_status %x <-" , irq_status); }return irq_status; }@@ -450,13 +448,12 @@ static int h264_encode_sps(struct venc_h264_inst *inst, irq_status =h264_enc_wait_venc_done (inst);if (irq_status !=MTK_VENC_IRQ_STATUS_SPS ) { -mtk_vcodec_err (inst,"expect irq status %d" , -MTK_VENC_IRQ_STATUS_SPS ); +mtk_venc_err (inst->ctx,"expect irq status %d" ,MTK_VENC_IRQ_STATUS_SPS );return -EINVAL ; } *bs_size =h264_read_reg (inst,VENC_PIC_BITSTREAM_BYTE_CNT ); -mtk_vcodec_debug (inst,"bs size %d <-" , *bs_size); +mtk_venc_debug (inst->ctx,"bs size %d <-" , *bs_size);return ret; }@@ -474,13 +471,12 @@ static int h264_encode_pps(struct venc_h264_inst *inst, irq_status =h264_enc_wait_venc_done (inst);if (irq_status !=MTK_VENC_IRQ_STATUS_PPS ) { -mtk_vcodec_err (inst,"expect irq status %d" , -MTK_VENC_IRQ_STATUS_PPS ); +mtk_venc_err (inst->ctx,"expect irq status %d" ,MTK_VENC_IRQ_STATUS_PPS );return -EINVAL ; } *bs_size =h264_read_reg (inst,VENC_PIC_BITSTREAM_BYTE_CNT ); -mtk_vcodec_debug (inst,"bs size %d <-" , *bs_size); +mtk_venc_debug (inst->ctx,"bs size %d <-" , *bs_size);return ret; }@@ -519,7 +515,7 @@ static int h264_encode_frame(struct venc_h264_inst *inst,struct venc_frame_info frame_info;struct mtk_vcodec_ctx *ctx = inst->ctx; -mtk_vcodec_debug (inst,"frm_cnt = %d\n " , inst->frm_cnt); +mtk_venc_debug (ctx,"frm_cnt = %d\n " , inst->frm_cnt);if (MTK_ENC_IOVA_IS_34BIT (ctx)) { gop_size = inst->vsi_34->config.gop_size;@@ -532,9 +528,9 @@ static int h264_encode_frame(struct venc_h264_inst *inst, frame_info.skip_frm_count = inst->skip_frm_cnt; frame_info.frm_type =h264_frame_type (inst->frm_cnt, gop_size, intra_period); -mtk_vcodec_debug (inst,"frm_count = %d,skip_frm_count =%d,frm_type=%d.\n" , - frame_info.frm_count, frame_info.skip_frm_count, - frame_info.frm_type); +mtk_venc_debug (ctx,"frm_count = %d,skip_frm_count =%d,frm_type=%d.\n" , + frame_info.frm_count, frame_info.skip_frm_count, + frame_info.frm_type); ret =vpu_enc_encode (&inst->vpu_inst,H264_BS_MODE_FRAME , frm_buf, bs_buf, &frame_info);@@ -557,15 +553,15 @@ static int h264_encode_frame(struct venc_h264_inst *inst, irq_status =h264_enc_wait_venc_done (inst);if (irq_status !=MTK_VENC_IRQ_STATUS_FRM ) { -mtk_vcodec_err (inst,"irq_status=%d failed" , irq_status); +mtk_venc_err (ctx,"irq_status=%d failed" , irq_status);return -EIO ; } *bs_size =h264_read_reg (inst,VENC_PIC_BITSTREAM_BYTE_CNT ); ++inst->frm_cnt; -mtk_vcodec_debug (inst,"frm %d bs_size %d key_frm %d <-" , - inst->frm_cnt, *bs_size, inst->vpu_inst.is_key_frm); +mtk_venc_debug (ctx,"frm %d bs_size %d key_frm %d <-" , + inst->frm_cnt, *bs_size, inst->vpu_inst.is_key_frm);return 0 ; }@@ -576,7 +572,7 @@ static void h264_encode_filler(struct venc_h264_inst *inst, void *buf,unsigned char *p = buf;if (size <H264_FILLER_MARKER_SIZE ) { -mtk_vcodec_err (inst,"filler size too small %d" , size); +mtk_venc_err (inst->ctx,"filler size too small %d" , size);return ; }@@ -626,7 +622,7 @@ static int h264_enc_encode(void *handle,struct venc_h264_inst *inst = (struct venc_h264_inst *)handle;struct mtk_vcodec_ctx *ctx = inst->ctx; -mtk_vcodec_debug (inst,"opt %d ->" , opt); +mtk_venc_debug (ctx,"opt %d ->" , opt);enable_irq (ctx->dev->enc_irq);@@ -661,7 +657,7 @@ static int h264_enc_encode(void *handle,break ; } -mtk_vcodec_debug (inst,"h264_encode_frame prepend SPS/PPS" ); +mtk_venc_debug (ctx,"h264_encode_frame prepend SPS/PPS" ); ret =h264_encode_header (inst, bs_buf, &bs_size_hdr);if (ret)@@ -688,9 +684,8 @@ static int h264_enc_encode(void *handle, result->bs_size = hdr_sz + filler_sz + bs_size_frm; -mtk_vcodec_debug (inst,"hdr %d filler %d frame %d bs %d" , - hdr_sz, filler_sz, bs_size_frm, - result->bs_size); +mtk_venc_debug (ctx,"hdr %d filler %d frame %d bs %d" , + hdr_sz, filler_sz, bs_size_frm, result->bs_size); inst->prepend_hdr =0 ; result->is_key_frm = inst->vpu_inst.is_key_frm;@@ -698,7 +693,7 @@ static int h264_enc_encode(void *handle, }default : -mtk_vcodec_err (inst,"venc_start_opt %d not supported" , opt); +mtk_venc_err (ctx,"venc_start_opt %d not supported" , opt); ret = -EINVAL ;break ; }@@ -706,7 +701,7 @@ static int h264_enc_encode(void *handle, encode_err:disable_irq (ctx->dev->enc_irq); -mtk_vcodec_debug (inst,"opt %d <-" , opt); +mtk_venc_debug (ctx,"opt %d <-" , opt);return ret; }@@ -758,7 +753,7 @@ static int h264_enc_set_param(void *handle,struct mtk_vcodec_ctx *ctx = inst->ctx;const bool is_34bit =MTK_ENC_IOVA_IS_34BIT (ctx); -mtk_vcodec_debug (inst,"->type=%d" , type); +mtk_venc_debug (ctx,"->type=%d" , type);switch (type) {case VENC_SET_PARAM_ENC :@@ -781,7 +776,7 @@ static int h264_enc_set_param(void *handle,case VENC_SET_PARAM_PREPEND_HEADER : inst->prepend_hdr =1 ; -mtk_vcodec_debug (inst,"set prepend header mode" ); +mtk_venc_debug (ctx,"set prepend header mode" );break ;case VENC_SET_PARAM_FORCE_INTRA :case VENC_SET_PARAM_GOP_SIZE :drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c +14
-18@@ -171,8 +171,7 @@ static int vp8_enc_alloc_work_buf(struct venc_vp8_inst *inst) inst->work_bufs[i].size = wb[i].size; ret =mtk_vcodec_mem_alloc (inst->ctx, &inst->work_bufs[i]);if (ret) { -mtk_vcodec_err (inst, -"cannot alloc work_bufs[%d]" , i); +mtk_venc_err (inst->ctx,"cannot alloc work_bufs[%d]" , i); goto err_alloc; }/* @@ -193,11 +192,10 @@ static int vp8_enc_alloc_work_buf(struct venc_vp8_inst *inst) } wb[i].iova = inst->work_bufs[i].dma_addr; -mtk_vcodec_debug (inst, -"work_bufs[%d] va=0x%p,iova=%pad,size=%zu" , - i, inst->work_bufs[i].va, - &inst->work_bufs[i].dma_addr, - inst->work_bufs[i].size); +mtk_venc_debug (inst->ctx,"work_bufs[%d] va=0x%p,iova=%pad,size=%zu" , + i, inst->work_bufs[i].va, + &inst->work_bufs[i].dma_addr, + inst->work_bufs[i].size); }return ret;@@ -216,7 +214,7 @@ static unsigned int vp8_enc_wait_venc_done(struct venc_vp8_inst *inst)if (!mtk_vcodec_wait_for_done_ctx (ctx,MTK_INST_IRQ_RECEIVED ,WAIT_INTR_TIMEOUT_MS ,0 )) { irq_status = ctx->irq_status; -mtk_vcodec_debug (inst,"isr return %x" , irq_status); +mtk_venc_debug (ctx,"isr return %x" , irq_status); }return irq_status; }@@ -261,8 +259,7 @@ static int vp8_enc_compose_one_frame(struct venc_vp8_inst *inst, }if (bs_buf->size < bs_hdr_len + bs_frm_size + ac_tag_size) { -mtk_vcodec_err (inst,"bitstream buf size is too small(%zu)" , - bs_buf->size); +mtk_venc_err (inst->ctx,"bitstream buf size is too small(%zu)" , bs_buf->size);return -EINVAL ; }@@ -292,7 +289,7 @@ static int vp8_enc_encode_frame(struct venc_vp8_inst *inst,int ret =0 ;unsigned int irq_status; -mtk_vcodec_debug (inst,"->frm_cnt=%d" , inst->frm_cnt); +mtk_venc_debug (inst->ctx,"->frm_cnt=%d" , inst->frm_cnt); ret =vpu_enc_encode (&inst->vpu_inst,0 , frm_buf, bs_buf,NULL );if (ret)@@ -300,18 +297,17 @@ static int vp8_enc_encode_frame(struct venc_vp8_inst *inst, irq_status =vp8_enc_wait_venc_done (inst);if (irq_status !=MTK_VENC_IRQ_STATUS_FRM ) { -mtk_vcodec_err (inst,"irq_status=%d failed" , irq_status); +mtk_venc_err (inst->ctx,"irq_status=%d failed" , irq_status);return -EIO ; }if (vp8_enc_compose_one_frame (inst, bs_buf, bs_size)) { -mtk_vcodec_err (inst,"vp8_enc_compose_one_frame failed" ); +mtk_venc_err (inst->ctx,"vp8_enc_compose_one_frame failed" );return -EINVAL ; } inst->frm_cnt++; -mtk_vcodec_debug (inst,"<-size=%d key_frm=%d" , *bs_size, - inst->vpu_inst.is_key_frm); +mtk_venc_debug (inst->ctx,"<-size=%d key_frm=%d" , *bs_size, inst->vpu_inst.is_key_frm);return ret; }@@ -364,7 +360,7 @@ static int vp8_enc_encode(void *handle,break ;default : -mtk_vcodec_err (inst,"opt not support:%d" , opt); +mtk_venc_err (ctx,"opt not support:%d" , opt); ret = -EINVAL ;break ; }@@ -382,7 +378,7 @@ static int vp8_enc_set_param(void *handle,int ret =0 ;struct venc_vp8_inst *inst = (struct venc_vp8_inst *)handle; -mtk_vcodec_debug (inst,"->type=%d" , type); +mtk_venc_debug (inst->ctx,"->type=%d" , type);switch (type) {case VENC_SET_PARAM_ENC :@@ -413,7 +409,7 @@ static int vp8_enc_set_param(void *handle,*/ case VENC_SET_PARAM_TS_MODE : inst->ts_mode =1 ; -mtk_vcodec_debug (inst,"set ts_mode" ); +mtk_venc_debug (inst->ctx,"set ts_mode" );break ;default :drivers/media/platform/mediatek/vcodec/venc_vpu_if.c +24
-29@@ -22,14 +22,13 @@ static void handle_enc_init_msg(struct venc_vpu_inst *vpu, const void *data)return ;/* Check firmware version. */ -mtk_vcodec_debug (vpu,"firmware version: 0x%x\n" , - msg->venc_abi_version); +mtk_venc_debug (vpu->ctx,"firmware version: 0x%x\n" , msg->venc_abi_version);switch (msg->venc_abi_version) {case 1 :break ;default : -mtk_vcodec_err (vpu,"unhandled firmware version 0x%x\n" , - msg->venc_abi_version); +mtk_venc_err (vpu->ctx,"unhandled firmware version 0x%x\n" , + msg->venc_abi_version); vpu->failure =1 ;break ; }@@ -50,13 +49,12 @@ static void vpu_enc_ipi_handler(void *data, unsigned int len, void *priv)struct venc_vpu_inst *vpu = (struct venc_vpu_inst *)(unsigned long )msg->venc_inst; -mtk_vcodec_debug (vpu,"msg_id %x inst %p status %d" , - msg->msg_id, vpu, msg->status); +mtk_venc_debug (vpu->ctx,"msg_id %x inst %p status %d" , msg->msg_id, vpu, msg->status); vpu->signaled =1 ; vpu->failure = (msg->status !=VENC_IPI_MSG_STATUS_OK );if (vpu->failure) { -mtk_vcodec_err (vpu,"vpu enc status failure %d" , vpu->failure); +mtk_venc_err (vpu->ctx,"vpu enc status failure %d" , vpu->failure);return ; }@@ -72,7 +70,7 @@ static void vpu_enc_ipi_handler(void *data, unsigned int len, void *priv)case VPU_IPIMSG_ENC_DEINIT_DONE :break ;default : -mtk_vcodec_err (vpu,"unknown msg id %x" , msg->msg_id); +mtk_venc_err (vpu->ctx,"unknown msg id %x" , msg->msg_id);break ; } }@@ -83,15 +81,15 @@ static int vpu_enc_send_msg(struct venc_vpu_inst *vpu, void *msg,int status;if (!vpu->ctx->dev->fw_handler) { -mtk_vcodec_err (vpu,"inst dev is NULL" ); +mtk_venc_err (vpu->ctx,"inst dev is NULL" );return -EINVAL ; } status =mtk_vcodec_fw_ipi_send (vpu->ctx->dev->fw_handler, vpu->id, msg, len,2000 );if (status) { -mtk_vcodec_err (vpu,"vpu_ipi_send msg_id %x len %d fail %d" , - *(uint32_t *)msg, len, status); +mtk_venc_err (vpu->ctx,"vpu_ipi_send msg_id %x len %d fail %d" , + *(uint32_t *)msg, len, status);return -EINVAL ; }if (vpu->failure)@@ -113,7 +111,7 @@ int vpu_enc_init(struct venc_vpu_inst *vpu) vpu_enc_ipi_handler, "venc", NULL);if (status) { -mtk_vcodec_err (vpu,"vpu_ipi_register fail %d" , status); +mtk_venc_err (vpu->ctx,"vpu_ipi_register fail %d" , status);return -EINVAL ; }@@ -121,7 +119,7 @@ int vpu_enc_init(struct venc_vpu_inst *vpu) out.msg_id =AP_IPIMSG_ENC_INIT ; out.venc_inst = (unsigned long )vpu;if (vpu_enc_send_msg (vpu, &out,sizeof (out))) { -mtk_vcodec_err (vpu,"AP_IPIMSG_ENC_INIT fail" ); +mtk_venc_err (vpu->ctx,"AP_IPIMSG_ENC_INIT fail" );return -EINVAL ; }@@ -157,7 +155,7 @@ int vpu_enc_set_param(struct venc_vpu_inst *vpu,sizeof (struct venc_ap_ipi_msg_set_param );struct venc_ap_ipi_msg_set_param_ext out; -mtk_vcodec_debug (vpu,"id %d ->" , id); +mtk_venc_debug (vpu->ctx,"id %d ->" , id);memset (&out,0 ,sizeof (out)); out.base.msg_id =AP_IPIMSG_ENC_SET_PARAM ;@@ -199,16 +197,15 @@ int vpu_enc_set_param(struct venc_vpu_inst *vpu, out.base.data_item =0 ;break ;default : -mtk_vcodec_err (vpu,"id %d not supported" , id); +mtk_venc_err (vpu->ctx,"id %d not supported" , id);return -EINVAL ; }if (vpu_enc_send_msg (vpu, &out, msg_size)) { -mtk_vcodec_err (vpu, -"AP_IPIMSG_ENC_SET_PARAM %d fail" , id); +mtk_venc_err (vpu->ctx,"AP_IPIMSG_ENC_SET_PARAM %d fail" , id);return -EINVAL ; } -mtk_vcodec_debug (vpu,"id %d <-" , id); +mtk_venc_debug (vpu->ctx,"id %d <-" , id);return 0 ; }@@ -225,7 +222,7 @@ static int vpu_enc_encode_32bits(struct venc_vpu_inst *vpu,sizeof (struct venc_ap_ipi_msg_enc );struct venc_ap_ipi_msg_enc_ext out; -mtk_vcodec_debug (vpu,"bs_mode %d ->" , bs_mode); +mtk_venc_debug (vpu->ctx,"bs_mode %d ->" , bs_mode);memset (&out,0 ,sizeof (out)); out.base.msg_id =AP_IPIMSG_ENC_ENCODE ;@@ -239,7 +236,7 @@ static int vpu_enc_encode_32bits(struct venc_vpu_inst *vpu, out.base.input_addr[1 ] = frm_buf->fb_addr[1 ].dma_addr; out.base.input_addr[2 ] = frm_buf->fb_addr[2 ].dma_addr; }else { -mtk_vcodec_err (vpu,"dma_addr not align to 16" ); +mtk_venc_err (vpu->ctx,"dma_addr not align to 16" );return -EINVAL ; } }@@ -254,8 +251,7 @@ static int vpu_enc_encode_32bits(struct venc_vpu_inst *vpu, out.data[2 ] = frame_info->frm_type; }if (vpu_enc_send_msg (vpu, &out, msg_size)) { -mtk_vcodec_err (vpu,"AP_IPIMSG_ENC_ENCODE %d fail" , - bs_mode); +mtk_venc_err (vpu->ctx,"AP_IPIMSG_ENC_ENCODE %d fail" , bs_mode);return -EINVAL ; }@@ -271,7 +267,7 @@ static int vpu_enc_encode_34bits(struct venc_vpu_inst *vpu,struct venc_ap_ipi_msg_enc_ext_34 out;size_t msg_size =sizeof (struct venc_ap_ipi_msg_enc_ext_34 ); -mtk_vcodec_debug (vpu,"bs_mode %d ->" , bs_mode); +mtk_venc_debug (vpu->ctx,"bs_mode %d ->" , bs_mode);memset (&out,0 ,sizeof (out)); out.msg_id =AP_IPIMSG_ENC_ENCODE ;@@ -286,7 +282,7 @@ static int vpu_enc_encode_34bits(struct venc_vpu_inst *vpu, out.input_addr[1 ] = frm_buf->fb_addr[1 ].dma_addr; out.input_addr[2 ] = frm_buf->fb_addr[2 ].dma_addr; }else { -mtk_vcodec_err (vpu,"dma_addr not align to 16" ); +mtk_venc_err (vpu->ctx,"dma_addr not align to 16" );return -EINVAL ; } }@@ -301,8 +297,7 @@ static int vpu_enc_encode_34bits(struct venc_vpu_inst *vpu, out.data[2 ] = frame_info->frm_type; }if (vpu_enc_send_msg (vpu, &out, msg_size)) { -mtk_vcodec_err (vpu,"AP_IPIMSG_ENC_ENCODE %d fail" , - bs_mode); +mtk_venc_err (vpu->ctx,"AP_IPIMSG_ENC_ENCODE %d fail" , bs_mode);return -EINVAL ; }@@ -326,8 +321,8 @@ int vpu_enc_encode(struct venc_vpu_inst *vpu, unsigned int bs_mode,if (ret)return ret; -mtk_vcodec_debug (vpu,"bs_mode %d state %d size %d key_frm %d <-" , - bs_mode, vpu->state, vpu->bs_size, vpu->is_key_frm); +mtk_venc_debug (vpu->ctx,"bs_mode %d state %d size %d key_frm %d <-" , + bs_mode, vpu->state, vpu->bs_size, vpu->is_key_frm);return 0 ; }@@ -340,7 +335,7 @@ int vpu_enc_deinit(struct venc_vpu_inst *vpu) out.msg_id =AP_IPIMSG_ENC_DEINIT ; out.vpu_inst_addr = vpu->inst_addr;if (vpu_enc_send_msg (vpu, &out,sizeof (out))) { -mtk_vcodec_err (vpu,"AP_IPIMSG_ENC_DEINIT fail" ); +mtk_venc_err (vpu->ctx,"AP_IPIMSG_ENC_DEINIT fail" );return -EINVAL ; }
Yunfei Dong
maintainerPATCH v4 6/11 media: mediatek: vcodec: replace pr_* with dev_* for v4l2 debug message
In reply to Yunfei DongAdding different macro mtk_v4l2_vdec_dbg and mtk_v4l2_venc_dbg for encoder and decoder. Then calling the common marco mtk_v4l2_debug to print debug message.
Replace pr_err with dev_err for 'mtk_v4l2_err' debug message. Replace pr_debug with dev_dbg for 'mtk_v4l2_debug' debug message.
--- .../platform/mediatek/vcodec/mtk_vcodec_dec.c | 116 +++++----- .../mediatek/vcodec/mtk_vcodec_dec_drv.c | 53 ++--- .../mediatek/vcodec/mtk_vcodec_dec_hw.c | 7 +- .../mediatek/vcodec/mtk_vcodec_dec_pm.c | 19 +- .../mediatek/vcodec/mtk_vcodec_dec_stateful.c | 143 ++++++------ .../vcodec/mtk_vcodec_dec_stateless.c | 62 ++--- .../platform/mediatek/vcodec/mtk_vcodec_enc.c | 211 ++++++++---------- .../mediatek/vcodec/mtk_vcodec_enc_drv.c | 45 ++-- .../mediatek/vcodec/mtk_vcodec_enc_pm.c | 8 +- .../platform/mediatek/vcodec/mtk_vcodec_fw.c | 2 +- .../mediatek/vcodec/mtk_vcodec_fw_scp.c | 2 +- .../mediatek/vcodec/mtk_vcodec_fw_vpu.c | 7 +- .../mediatek/vcodec/mtk_vcodec_intr.c | 12 +- .../mediatek/vcodec/mtk_vcodec_util.c | 30 ++- .../mediatek/vcodec/mtk_vcodec_util.h | 24 +- .../vcodec/vdec/vdec_av1_req_lat_if.c | 10 +- .../mediatek/vcodec/vdec/vdec_h264_req_if.c | 14 +- .../vcodec/vdec/vdec_h264_req_multi_if.c | 16 +- .../vcodec/vdec/vdec_hevc_req_multi_if.c | 14 +- .../platform/mediatek/vcodec/vdec_drv_if.c | 4 +- .../platform/mediatek/vcodec/vdec_msg_queue.c | 52 +++-- .../platform/mediatek/vcodec/vdec_msg_queue.h | 2 + .../platform/mediatek/vcodec/vdec_vpu_if.c | 2 +- 23 files changed, 413 insertions(+), 442 deletions(-)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +55 -61
@@ -82,7 +82,7 @@ static int vidioc_decoder_cmd(struct file *file, void *priv,if (ret)return ret; -mtk_v4l2_debug (1 ,"decoder cmd=%u" , cmd->cmd); +mtk_v4l2_vdec_dbg (1 , ctx,"decoder cmd=%u" , cmd->cmd); dst_vq =v4l2_m2m_get_vq (ctx->m2m_ctx,V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE );switch (cmd->cmd) {
@@ -90,11 +90,11 @@ static int vidioc_decoder_cmd(struct file *file, void *priv, src_vq =v4l2_m2m_get_vq (ctx->m2m_ctx,V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE );if (!vb2_is_streaming (src_vq)) { -mtk_v4l2_debug (1 ,"Output stream is off. No need to flush." ); +mtk_v4l2_vdec_dbg (1 , ctx,"Output stream is off. No need to flush." );return 0 ; }if (!vb2_is_streaming (dst_vq)) { -mtk_v4l2_debug (1 ,"Capture stream is off. No need to flush." ); +mtk_v4l2_vdec_dbg (1 , ctx,"Capture stream is off. No need to flush." );return 0 ; }v4l2_m2m_buf_queue (ctx->m2m_ctx, &ctx->empty_flush_buf.vb);
@@ -172,8 +172,7 @@ static int vidioc_vdec_qbuf(struct file *file, void *priv,struct mtk_vcodec_ctx *ctx =fh_to_ctx (priv);if (ctx->state ==MTK_STATE_ABORT ) { -mtk_v4l2_err ("[%d] Call on QBUF after unrecoverable error" , - ctx->id); +mtk_v4l2_vdec_err (ctx,"[%d] Call on QBUF after unrecoverable error" , ctx->id);return -EIO ; }
@@ -186,8 +185,7 @@ static int vidioc_vdec_dqbuf(struct file *file, void *priv,struct mtk_vcodec_ctx *ctx =fh_to_ctx (priv);if (ctx->state ==MTK_STATE_ABORT ) { -mtk_v4l2_err ("[%d] Call on DQBUF after unrecoverable error" , - ctx->id); +mtk_v4l2_vdec_err (ctx,"[%d] Call on DQBUF after unrecoverable error" , ctx->id);return -EIO ; }
@@ -288,11 +286,10 @@ static int vidioc_try_fmt(struct mtk_vcodec_ctx *ctx, struct v4l2_format *f, (pix_fmt_mp->height + 64) <= frmsize->max_height) pix_fmt_mp->height += 64; -mtk_v4l2_debug (0 , -"before resize width=%d, height=%d, after resize width=%d, height=%d, sizeimage=%d" , - tmp_w, tmp_h, pix_fmt_mp->width, - pix_fmt_mp->height, - pix_fmt_mp->width * pix_fmt_mp->height); +mtk_v4l2_vdec_dbg (0 , ctx, +"before resize wxh=%dx%d, after resize wxh=%dx%d, sizeimage=%d" , + tmp_w, tmp_h, pix_fmt_mp->width, pix_fmt_mp->height, + pix_fmt_mp->width * pix_fmt_mp->height); pix_fmt_mp->num_planes = fmt->num_planes; pix_fmt_mp->plane_fmt[0].sizeimage =
@@ -344,7 +341,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv, }if (pix_fmt_mp->plane_fmt[0 ].sizeimage ==0 ) { -mtk_v4l2_err ("sizeimage of output format must be given" ); +mtk_v4l2_vdec_err (ctx,"sizeimage of output format must be given" );return -EINVAL ; }
@@ -432,7 +429,7 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv,const struct mtk_video_fmt *fmt;const struct mtk_vcodec_dec_pdata *dec_pdata = ctx->dev->vdec_pdata; -mtk_v4l2_debug (3 ,"[%d]" , ctx->id); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d]" , ctx->id); q_data =mtk_vdec_get_q_data (ctx, f->type);if (!q_data)
@@ -446,7 +443,7 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv,if (!dec_pdata->uses_stateless_api && f->type ==V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE &&vb2_is_busy (&ctx->m2m_ctx->out_q_ctx.q)) { -mtk_v4l2_err ("out_q_ctx buffers already requested" ); +mtk_v4l2_vdec_err (ctx,"out_q_ctx buffers already requested" ); ret = -EBUSY ; }
@@ -456,7 +453,7 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv,*/ if ((f->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ) &&vb2_is_busy (&ctx->m2m_ctx->cap_q_ctx.q)) { -mtk_v4l2_err ("cap_q_ctx buffers already requested" ); +mtk_v4l2_vdec_err (ctx,"cap_q_ctx buffers already requested" ); ret = -EBUSY ; }
@@ -491,8 +488,8 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv,if (ctx->state ==MTK_STATE_FREE ) { ret =vdec_if_init (ctx, q_data->fmt->fourcc);if (ret) { -mtk_v4l2_err ("[%d]: vdec_if_init() fail ret=%d" , - ctx->id, ret); +mtk_v4l2_vdec_err (ctx,"[%d]: vdec_if_init() fail ret=%d" , + ctx->id, ret);return -EINVAL ; } ctx->state =MTK_STATE_INIT ;
@@ -515,8 +512,8 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv,*/ ret =vdec_if_get_param (ctx,GET_PARAM_PIC_INFO , &ctx->picinfo);if (ret) { -mtk_v4l2_err ("[%d]Error!! Get GET_PARAM_PICTURE_INFO Fail" , - ctx->id); +mtk_v4l2_vdec_err (ctx,"[%d]Error!! Get GET_PARAM_PICTURE_INFO Fail" , + ctx->id); } ctx->last_decoded_picinfo = ctx->picinfo;
@@ -540,11 +537,13 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv, ctx->q_data[MTK_Q_DATA_DST ].coded_width = ctx->picinfo.buf_w; ctx->q_data[MTK_Q_DATA_DST ].coded_height = ctx->picinfo.buf_h; -mtk_v4l2_debug (2 ,"[%d] vdec_if_init() num_plane = %d wxh=%dx%d pic wxh=%dx%d sz[0]=0x%x sz[1]=0x%x" , - ctx->id, pix_mp->num_planes, ctx->picinfo.buf_w, ctx->picinfo.buf_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h, - ctx->q_data[MTK_Q_DATA_DST ].sizeimage[0 ], - ctx->q_data[MTK_Q_DATA_DST ].sizeimage[1 ]); +mtk_v4l2_vdec_dbg (2 , ctx, +"[%d] init() plane:%d wxh=%dx%d pic wxh=%dx%d sz=0x%x_0x%x" , + ctx->id, pix_mp->num_planes, + ctx->picinfo.buf_w, ctx->picinfo.buf_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h, + ctx->q_data[MTK_Q_DATA_DST ].sizeimage[0 ], + ctx->q_data[MTK_Q_DATA_DST ].sizeimage[1 ]); }return 0 ; }
@@ -570,14 +569,11 @@ static int vidioc_enum_framesizes(struct file *file, void *priv, fsize->type =V4L2_FRMSIZE_TYPE_STEPWISE ; fsize->stepwise = dec_pdata->vdec_formats[i].frmsize; -mtk_v4l2_debug (1 ,"%x, %d %d %d %d %d %d" , - ctx->dev->dec_capability, - fsize->stepwise.min_width, - fsize->stepwise.max_width, - fsize->stepwise.step_width, - fsize->stepwise.min_height, - fsize->stepwise.max_height, - fsize->stepwise.step_height); +mtk_v4l2_vdec_dbg (1 , ctx,"%x, %d %d %d %d %d %d" , + ctx->dev->dec_capability, fsize->stepwise.min_width, + fsize->stepwise.max_width, fsize->stepwise.step_width, + fsize->stepwise.min_height, fsize->stepwise.max_height, + fsize->stepwise.step_height);return 0 ; }
@@ -641,7 +637,7 @@ static int vidioc_vdec_g_fmt(struct file *file, void *priv, vq =v4l2_m2m_get_vq (ctx->m2m_ctx, f->type);if (!vq) { -mtk_v4l2_err ("no vb2 queue for type=%d" , f->type); +mtk_v4l2_vdec_err (ctx,"no vb2 queue for type=%d" , f->type);return -EINVAL ; }
@@ -712,8 +708,8 @@ static int vidioc_vdec_g_fmt(struct file *file, void *priv, pix_mp->plane_fmt[1 ].bytesperline = q_data->bytesperline[1 ]; pix_mp->plane_fmt[1 ].sizeimage = q_data->sizeimage[1 ]; -mtk_v4l2_debug (1 ,"[%d] type=%d state=%d Format information could not be read, not ready yet!" , - ctx->id, f->type, ctx->state); +mtk_v4l2_vdec_dbg (1 , ctx,"[%d] type=%d state=%d Format information not ready!" , + ctx->id, f->type, ctx->state); }return 0 ;
@@ -730,7 +726,7 @@ int vb2ops_vdec_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, q_data =mtk_vdec_get_q_data (ctx, vq->type);if (q_data ==NULL ) { -mtk_v4l2_err ("vq->type=%d err\n" , vq->type); +mtk_v4l2_vdec_err (ctx,"vq->type=%d err\n" , vq->type);return -EINVAL ; }
@@ -756,10 +752,9 @@ int vb2ops_vdec_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, sizes[i] = q_data->sizeimage[i]; } -mtk_v4l2_debug (1 , -"[%d]\t type = %d, get %d plane(s), %d buffer(s) of size 0x%x 0x%x " , - ctx->id, vq->type, *nplanes, *nbuffers, - sizes[0 ], sizes[1 ]); +mtk_v4l2_vdec_dbg (1 , ctx, +"[%d]\t type = %d, get %d plane(s), %d buffer(s) of size 0x%x 0x%x " , + ctx->id, vq->type, *nplanes, *nbuffers, sizes[0 ], sizes[1 ]);return 0 ; }
@@ -770,16 +765,15 @@ int vb2ops_vdec_buf_prepare(struct vb2_buffer *vb)struct mtk_q_data *q_data;int i; -mtk_v4l2_debug (3 ,"[%d] (%d) id=%d" , - ctx->id, vb->vb2_queue->type, vb->index); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] (%d) id=%d" , + ctx->id, vb->vb2_queue->type, vb->index); q_data =mtk_vdec_get_q_data (ctx, vb->vb2_queue->type);for (i =0 ; i < q_data->fmt->num_planes; i++) {if (vb2_plane_size (vb, i) < q_data->sizeimage[i]) { -mtk_v4l2_err ("data will not fit into plane %d (%lu < %d)" , - i,vb2_plane_size (vb, i), - q_data->sizeimage[i]); +mtk_v4l2_vdec_err (ctx,"data will not fit into plane %d (%lu < %d)" , + i,vb2_plane_size (vb, i), q_data->sizeimage[i]);return -EINVAL ; }if (!V4L2_TYPE_IS_OUTPUT (vb->type))
@@ -807,7 +801,7 @@ void vb2ops_vdec_buf_finish(struct vb2_buffer *vb)mutex_unlock (&ctx->lock);if (buf_error) { -mtk_v4l2_err ("Unrecoverable error on buffer." ); +mtk_v4l2_vdec_err (ctx,"Unrecoverable error on buffer." ); ctx->state =MTK_STATE_ABORT ; } }
@@ -843,8 +837,8 @@ void vb2ops_vdec_stop_streaming(struct vb2_queue *q)struct mtk_vcodec_ctx *ctx =vb2_get_drv_priv (q);int ret; -mtk_v4l2_debug (3 ,"[%d] (%d) state=(%x) ctx->decoded_frame_cnt=%d" , - ctx->id, q->type, ctx->state, ctx->decoded_frame_cnt); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] (%d) state=(%x) ctx->decoded_frame_cnt=%d" , + ctx->id, q->type, ctx->state, ctx->decoded_frame_cnt);if (q->type ==V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ) {while ((src_buf =v4l2_m2m_src_buf_remove (ctx->m2m_ctx))) {
@@ -870,17 +864,17 @@ void vb2ops_vdec_stop_streaming(struct vb2_queue *q)*/ ctx->picinfo = ctx->last_decoded_picinfo; -mtk_v4l2_debug (2 , -"[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)" , - ctx->id, ctx->last_decoded_picinfo.pic_w, - ctx->last_decoded_picinfo.pic_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h, - ctx->last_decoded_picinfo.buf_w, - ctx->last_decoded_picinfo.buf_h); +mtk_v4l2_vdec_dbg (2 , ctx, +"[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)" , + ctx->id, ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h, + ctx->last_decoded_picinfo.buf_w, + ctx->last_decoded_picinfo.buf_h); ret = ctx->dev->vdec_pdata->flush_decoder (ctx);if (ret) -mtk_v4l2_err ("DecodeFinal failed, ret=%d" , ret); +mtk_v4l2_vdec_err (ctx,"DecodeFinal failed, ret=%d" , ret); } ctx->state =MTK_STATE_FLUSH ;
@@ -905,7 +899,7 @@ static int m2mops_vdec_job_ready(void *m2m_priv) {struct mtk_vcodec_ctx *ctx = m2m_priv; -mtk_v4l2_debug (3 ,"[%d]" , ctx->id); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d]" , ctx->id);if (ctx->state ==MTK_STATE_ABORT )return 0 ;
@@ -973,7 +967,7 @@ int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue *src_vq,struct mtk_vcodec_ctx *ctx = priv;int ret =0 ; -mtk_v4l2_debug (3 ,"[%d]" , ctx->id); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d]" , ctx->id); src_vq->type =V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ; src_vq->io_modes =VB2_DMABUF |VB2_MMAP ;
@@ -988,7 +982,7 @@ int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue *src_vq, ret =vb2_queue_init (src_vq);if (ret) { -mtk_v4l2_err ("Failed to initialize videobuf2 queue(output)" ); +mtk_v4l2_vdec_err (ctx,"Failed to initialize videobuf2 queue(output)" );return ret; } dst_vq->type =V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ;
@@ -1004,7 +998,7 @@ int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue *src_vq, ret =vb2_queue_init (dst_vq);if (ret) -mtk_v4l2_err ("Failed to initialize videobuf2 queue(capture)" ); +mtk_v4l2_vdec_err (ctx,"Failed to initialize videobuf2 queue(capture)" );return ret; }
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +24 -29
189 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c +3 -4
@@ -77,8 +77,7 @@ static irqreturn_t mtk_vdec_hw_irq_handler(int irq, void *priv)/* check if HW active or not */ cg_status =readl (dev->reg_base[VDEC_HW_SYS ]);if (cg_status &VDEC_HW_ACTIVE ) { -mtk_v4l2_err ("vdec active is not 0x0 (0x%08x)" , - cg_status); +mtk_v4l2_vdec_err (ctx,"vdec active is not 0x0 (0x%08x)" , cg_status);return IRQ_HANDLED ; }
@@ -93,8 +92,8 @@ static irqreturn_t mtk_vdec_hw_irq_handler(int irq, void *priv)wake_up_ctx (ctx,MTK_INST_IRQ_RECEIVED , dev->hw_idx); -mtk_v4l2_debug (3 ,"wake up ctx %d, dec_done_status=%x" , - ctx->id, dec_done_status); +mtk_v4l2_vdec_dbg (3 , ctx,"wake up ctx %d, dec_done_status=%x" , + ctx->id, dec_done_status);return IRQ_HANDLED ; }
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +9 -10
@@ -32,7 +32,7 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *if (!dec_clk->clk_info)return -ENOMEM ; }else { -mtk_v4l2_err ("Failed to get vdec clock count" ); +dev_err (&pdev->dev,"Failed to get vdec clock count" );return -EINVAL ; }
@@ -41,14 +41,13 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm * ret =of_property_read_string_index (pdev->dev.of_node,"clock-names" , i, &clk_info->clk_name);if (ret) { -mtk_v4l2_err ("Failed to get clock name id = %d" , i); +dev_err (&pdev->dev,"Failed to get clock name id = %d" , i);return ret; } clk_info->vcodec_clk =devm_clk_get (&pdev->dev, clk_info->clk_name);if (IS_ERR (clk_info->vcodec_clk)) { -mtk_v4l2_err ("devm_clk_get (%d)%s fail" , i, - clk_info->clk_name); +dev_err (&pdev->dev,"devm_clk_get (%d)%s fail" , i, clk_info->clk_name);return PTR_ERR (clk_info->vcodec_clk); } }
@@ -63,7 +62,7 @@ static int mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm) ret =pm_runtime_resume_and_get (pm->dev);if (ret) -mtk_v4l2_err ("pm_runtime_resume_and_get fail %d" , ret); +dev_err (pm->dev,"pm_runtime_resume_and_get fail %d" , ret);return ret; }
@@ -74,7 +73,7 @@ static void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm) ret =pm_runtime_put (pm->dev);if (ret && ret != -EAGAIN ) -mtk_v4l2_err ("pm_runtime_put fail %d" , ret); +dev_err (pm->dev,"pm_runtime_put fail %d" , ret); }static void mtk_vcodec_dec_clock_on (struct mtk_vcodec_pm *pm)
@@ -86,7 +85,7 @@ static void mtk_vcodec_dec_clock_on(struct mtk_vcodec_pm *pm)for (i =0 ; i < dec_clk->clk_num; i++) { ret =clk_prepare_enable (dec_clk->clk_info[i].vcodec_clk);if (ret) { -mtk_v4l2_err ("clk_prepare_enable %d %s fail %d" , i, +dev_err (pm->dev,"clk_prepare_enable %d %s fail %d" , i, dec_clk->clk_info[i].clk_name, ret); goto error; }
@@ -120,7 +119,7 @@ static void mtk_vcodec_dec_enable_irq(struct mtk_vcodec_dev *vdec_dev, int hw_idif (subdev_dev)enable_irq (subdev_dev->dec_irq);else -mtk_v4l2_err ("Failed to get hw dev\n" ); +dev_err (&vdec_dev->plat_dev->dev,"Failed to get hw dev\n" ); }else {enable_irq (vdec_dev->dec_irq); }
@@ -138,7 +137,7 @@ static void mtk_vcodec_dec_disable_irq(struct mtk_vcodec_dev *vdec_dev, int hw_iif (subdev_dev)disable_irq (subdev_dev->dec_irq);else -mtk_v4l2_err ("Failed to get hw dev\n" ); +dev_err (&vdec_dev->plat_dev->dev,"Failed to get hw dev\n" ); }else {disable_irq (vdec_dev->dec_irq); }
@@ -185,7 +184,7 @@ static struct mtk_vcodec_pm *mtk_vcodec_dec_get_pm(struct mtk_vcodec_dev *vdec_dif (subdev_dev)return &subdev_dev->pm; -mtk_v4l2_err ("Failed to get hw dev\n" ); +dev_err (&vdec_dev->plat_dev->dev,"Failed to get hw dev\n" );return NULL ; }
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c +73 -70
337 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c +33 -29
153 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c +92 -119
496 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c +21 -24
141 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c +4 -4
@@ -35,7 +35,7 @@ int mtk_vcodec_init_enc_clk(struct mtk_vcodec_dev *mtkdev)if (!enc_clk->clk_info)return -ENOMEM ; }else { -mtk_v4l2_err ("Failed to get venc clock count" ); +dev_err (pm->dev,"[MTK VCODEC] Failed to get venc clock count" );return -EINVAL ; }
@@ -44,13 +44,13 @@ int mtk_vcodec_init_enc_clk(struct mtk_vcodec_dev *mtkdev) ret =of_property_read_string_index (pdev->dev.of_node,"clock-names" , i, &clk_info->clk_name);if (ret) { -mtk_v4l2_err ("venc failed to get clk name %d" , i); +dev_err (pm->dev,"[MTK VCODEC] venc failed to get clk name %d" , i);return ret; } clk_info->vcodec_clk =devm_clk_get (&pdev->dev, clk_info->clk_name);if (IS_ERR (clk_info->vcodec_clk)) { -mtk_v4l2_err ("venc devm_clk_get (%d)%s fail" , i, +dev_err (pm->dev,"[MTK VCODEC] venc devm_clk_get (%d)%s fail" , i, clk_info->clk_name);return PTR_ERR (clk_info->vcodec_clk); }
@@ -67,7 +67,7 @@ void mtk_vcodec_enc_clock_on(struct mtk_vcodec_pm *pm)for (i =0 ; i < enc_clk->clk_num; i++) { ret =clk_prepare_enable (enc_clk->clk_info[i].vcodec_clk);if (ret) { -mtk_v4l2_err ("venc clk_prepare_enable %d %s fail %d" , i, +dev_err (pm->dev,"[MTK VCODEC] venc clk_prepare_enable %d %s fail %d" , i, enc_clk->clk_info[i].clk_name, ret); goto clkerr; }
drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c +1 -1
@@ -14,7 +14,7 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_select(void *priv, enum mtk_vcodec_fw_type tcase SCP :return mtk_vcodec_fw_scp_init (priv, fw_use);default : -mtk_v4l2_err ("invalid vcodec fw type" ); +pr_err ("invalid vcodec fw type" );return ERR_PTR (-EINVAL ); } }
drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c +1 -1
@@ -63,7 +63,7 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use plat_dev = dev->plat_dev; scp =scp_get (plat_dev);if (!scp) { -mtk_v4l2_err ("could not get vdec scp handle" ); +dev_err (&dev->plat_dev->dev,"could not get vdec scp handle" );return ERR_PTR (-EPROBE_DEFER ); }
drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c +3 -4
@@ -56,13 +56,12 @@ static void mtk_vcodec_vpu_reset_handler(void *priv)struct mtk_vcodec_dev *dev = priv;struct mtk_vcodec_ctx *ctx; -mtk_v4l2_err ("Watchdog timeout!!" ); +dev_err (&dev->plat_dev->dev,"Watchdog timeout!!" );mutex_lock (&dev->dev_mutex);list_for_each_entry (ctx, &dev->ctx_list, list) { ctx->state =MTK_STATE_ABORT ; -mtk_v4l2_debug (0 ,"[%d] Change to state MTK_STATE_ABORT" , - ctx->id); +mtk_v4l2_vdec_dbg (0 , ctx,"[%d] Change to state MTK_STATE_ABORT" , ctx->id); }mutex_unlock (&dev->dev_mutex); }
@@ -98,7 +97,7 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(void *priv, enum mtk_vcodec_fw_use plat_dev = dev->plat_dev; fw_pdev =vpu_get_plat_device (plat_dev);if (!fw_pdev) { -mtk_v4l2_err ("firmware device is not ready" ); +dev_err (&dev->plat_dev->dev,"firmware device is not ready" );return ERR_PTR (-EINVAL ); }
drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c +6 -6
@@ -33,14 +33,14 @@ int mtk_vcodec_wait_for_done_ctx(void *priv, int command, unsigned int timeout_mif (!ret) { status =-1 ;/* timeout */ -mtk_v4l2_err ("[%d] cmd=%d, type=%d, dec timeout=%ums (%d %d)" , - ctx_id, command, ctx_type, timeout_ms, - ctx_int_cond[hw_id], ctx_int_type[hw_id]); +dev_err (&ctx->dev->plat_dev->dev,"[%d] cmd=%d, type=%d, dec timeout=%ums (%d %d)" , + ctx_id, command, ctx_type, timeout_ms, + ctx_int_cond[hw_id], ctx_int_type[hw_id]); }else if (-ERESTARTSYS == ret) { status =-1 ; -mtk_v4l2_err ("[%d] cmd=%d, type=%d, dec inter fail (%d %d)" , - ctx_id, command, ctx_type, - ctx_int_cond[hw_id], ctx_int_type[hw_id]); +dev_err (&ctx->dev->plat_dev->dev,"[%d] cmd=%d, type=%d, dec inter fail (%d %d)" , + ctx_id, command, ctx_type, + ctx_int_cond[hw_id], ctx_int_type[hw_id]); } ctx_int_cond[hw_id] =0 ;
drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c +14 -16
@@ -24,7 +24,7 @@ EXPORT_SYMBOL(mtk_v4l2_dbg_level);void __iomem *mtk_vcodec_get_reg_addr (void __iomem **reg_base,unsigned int reg_idx) {if (reg_idx >=NUM_MAX_VCODEC_REG_BASE ) { -mtk_v4l2_err ("Invalid arguments, reg_idx=%d" , reg_idx); +pr_err ("Invalid arguments, reg_idx=%d" , reg_idx);return NULL ; }return reg_base[reg_idx];
@@ -39,15 +39,14 @@ int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem) mem->va =dma_alloc_coherent (dev, size, &mem->dma_addr,GFP_KERNEL );if (!mem->va) { -mtk_v4l2_err ("%s dma_alloc size=%ld failed!" ,dev_name (dev), - size); +mtk_v4l2_vdec_err (ctx,"%s dma_alloc size=%ld failed!" ,dev_name (dev), size);return -ENOMEM ; } -mtk_v4l2_debug (3 ,"[%d] - va = %p" , ctx->id, mem->va); -mtk_v4l2_debug (3 ,"[%d] - dma = 0x%lx" , ctx->id, - (unsigned long )mem->dma_addr); -mtk_v4l2_debug (3 ,"[%d] size = 0x%lx" , ctx->id, size); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] - va = %p" , ctx->id, mem->va); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] - dma = 0x%lx" , ctx->id, + (unsigned long )mem->dma_addr); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] size = 0x%lx" , ctx->id, size);return 0 ; }
@@ -60,15 +59,14 @@ void mtk_vcodec_mem_free(void *priv, struct mtk_vcodec_mem *mem)struct device *dev = &ctx->dev->plat_dev->dev;if (!mem->va) { -mtk_v4l2_err ("%s dma_free size=%ld failed!" ,dev_name (dev), - size); +mtk_v4l2_vdec_err (ctx,"%s dma_free size=%ld failed!" ,dev_name (dev), size);return ; } -mtk_v4l2_debug (3 ,"[%d] - va = %p" , ctx->id, mem->va); -mtk_v4l2_debug (3 ,"[%d] - dma = 0x%lx" , ctx->id, - (unsigned long )mem->dma_addr); -mtk_v4l2_debug (3 ,"[%d] size = 0x%lx" , ctx->id, size); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] - va = %p" , ctx->id, mem->va); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] - dma = 0x%lx" , ctx->id, + (unsigned long )mem->dma_addr); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] size = 0x%lx" , ctx->id, size);dma_free_coherent (dev, size, mem->va, mem->dma_addr); mem->va =NULL ;
@@ -80,7 +78,7 @@ EXPORT_SYMBOL(mtk_vcodec_mem_free);void *mtk_vcodec_get_hw_dev (struct mtk_vcodec_dev *dev,int hw_idx) {if (hw_idx >=MTK_VDEC_HW_MAX || hw_idx <0 || !dev->subdev_dev[hw_idx]) { -mtk_v4l2_err ("hw idx is out of range:%d" , hw_idx); +dev_err (&dev->plat_dev->dev,"hw idx is out of range:%d" , hw_idx);return NULL ; }
@@ -98,7 +96,7 @@ void mtk_vcodec_set_curr_ctx(struct mtk_vcodec_dev *vdec_dev,if (vdec_dev->vdec_pdata->is_subdev_supported) { subdev_dev =mtk_vcodec_get_hw_dev (vdec_dev, hw_idx);if (!subdev_dev) { -mtk_v4l2_err ("Failed to get hw dev" ); +dev_err (&vdec_dev->plat_dev->dev,"Failed to get hw dev" );spin_unlock_irqrestore (&vdec_dev->irqlock, flags);return ; }
@@ -121,7 +119,7 @@ struct mtk_vcodec_ctx *mtk_vcodec_get_curr_ctx(struct mtk_vcodec_dev *vdec_dev,if (vdec_dev->vdec_pdata->is_subdev_supported) { subdev_dev =mtk_vcodec_get_hw_dev (vdec_dev, hw_idx);if (!subdev_dev) { -mtk_v4l2_err ("Failed to get hw dev" ); +dev_err (&vdec_dev->plat_dev->dev,"Failed to get hw dev" );spin_unlock_irqrestore (&vdec_dev->irqlock, flags);return NULL ; }
drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +17 -7
@@ -28,8 +28,8 @@ struct mtk_vcodec_dev;#undef pr_fmt#define pr_fmt (fmt) "%s(),%d: " fmt, __func__, __LINE__ -#define mtk_v4l2_err(fmt, args...) \ - pr_err("[MTK_V4L2][ERROR] " fmt "\n", ##args) +#define mtk_v4l2_err(plat_dev, fmt, args...) \ + dev_err(&(plat_dev)->dev, "[MTK_V4L2][ERROR] " fmt "\n", ##args) #define mtk_vcodec_err(inst_id, plat_dev, fmt, args...) \ dev_err(&(plat_dev)->dev, "[MTK_VCODEC][ERROR][%d]: " fmt "\n", inst_id, ##args)
@@ -38,11 +38,11 @@ struct mtk_vcodec_dev;extern int mtk_v4l2_dbg_level;extern int mtk_vcodec_dbg; -#define mtk_v4l2_debug(level, fmt, args...) \ - do { \ - if (mtk_v4l2_dbg_level >= (level)) \ - pr_debug("[MTK_V4L2] %s, %d: " fmt "\n", \ - __func__, __LINE__, ##args); \ +#define mtk_v4l2_debug(plat_dev, level, fmt, args...) \ + do { \ + if (mtk_v4l2_dbg_level >= (level)) \ + dev_dbg(&(plat_dev)->dev, "[MTK_V4L2] %s, %d: " fmt "\n", \ + __func__, __LINE__, ##args); \ } while (0) #define mtk_vcodec_debug(inst_id, plat_dev, fmt, args...) \
@@ -70,6 +70,16 @@ extern int mtk_vcodec_dbg; #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_mem_alloc (void *priv,struct mtk_vcodec_mem *mem);void mtk_vcodec_mem_free (void *priv,struct mtk_vcodec_mem *mem);
drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c +5 -5
@@ -861,8 +861,8 @@ static void vdec_av1_slice_decrease_ref_count(struct vdec_av1_slice_slot *slots, frame_info[fb_idx].ref_count--;if (frame_info[fb_idx].ref_count <0 ) { frame_info[fb_idx].ref_count =0 ; -mtk_v4l2_err ("av1_error: %s() fb_idx %d decrease ref_count error\n" , - __func__, fb_idx); +pr_err ("av1_error: %s() fb_idx %d decrease ref_count error\n" , + __func__, fb_idx); }vdec_av1_slice_clear_fb (&frame_info[fb_idx]);
@@ -910,7 +910,7 @@ static void vdec_av1_slice_setup_slot(struct vdec_av1_slice_instance *instance, vsi->slot_id =vdec_av1_slice_get_new_slot (vsi);if (vsi->slot_id ==AV1_INVALID_IDX ) { -mtk_v4l2_err ("warning:av1 get invalid index slot\n" ); +mtk_v4l2_vdec_err (instance->ctx,"warning:av1 get invalid index slot\n" ); vsi->slot_id =0 ; } cur_frame_info = &vsi->slots.frame_info[vsi->slot_id];
@@ -1504,8 +1504,8 @@ static void vdec_av1_slice_setup_ref(struct vdec_av1_slice_pfc *pfc, slot_id = frame->ref_frame_map[ref_idx]; frame_info = &slots->frame_info[slot_id];if (slot_id ==AV1_INVALID_IDX ) { -mtk_v4l2_err ("cannot match reference[%d] 0x%llx\n" , i, - ctrl_fh->reference_frame_ts[ref_idx]); +pr_err ("cannot match reference[%d] 0x%llx\n" , i, + ctrl_fh->reference_frame_ts[ref_idx]); frame->order_hints[i] =0 ; frame->ref_frame_valid[i] =0 ;continue ;
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c +7 -7
@@ -187,7 +187,7 @@ static int alloc_mv_buf(struct vdec_h264_slice_inst *inst,struct mtk_vcodec_mem *mem =NULL ;unsigned int buf_sz =mtk_vdec_h264_get_mv_buf_size (pic->buf_w, pic->buf_h); -mtk_v4l2_debug (3 ,"size = 0x%x" , buf_sz); +mtk_v4l2_vdec_dbg (3 , inst->ctx,"size = 0x%x" , buf_sz);for (i =0 ; i <H264_MAX_MV_NUM ; i++) { mem = &inst->mv_buf[i];if (mem->va)
@@ -243,12 +243,12 @@ static void get_pic_info(struct vdec_h264_slice_inst *inst, ctx->last_decoded_picinfo.buf_h != ctx->picinfo.buf_h) inst->vsi_ctx.dec.realloc_mv_buf = true; -mtk_v4l2_debug (1 ,"ResChg: (%d %d) : old(%d, %d) -> new(%d, %d)" , - inst->vsi_ctx.dec.resolution_changed, - inst->vsi_ctx.dec.realloc_mv_buf, - ctx->last_decoded_picinfo.pic_w, - ctx->last_decoded_picinfo.pic_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h); +mtk_v4l2_vdec_dbg (1 , inst->ctx,"ResChg: (%d %d) : old(%d, %d) -> new(%d, %d)" , + inst->vsi_ctx.dec.resolution_changed, + inst->vsi_ctx.dec.realloc_mv_buf, + ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h); } }
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c +8 -8
@@ -294,7 +294,7 @@ static void vdec_h264_slice_fill_decode_reflist(struct vdec_h264_slice_inst *insmtk_vdec_h264_fill_dpb_info (inst->ctx, &slice_param->decode_params, slice_param->h264_dpb_info); -mtk_v4l2_debug (3 ,"cur poc = %d\n" , dec_params->bottom_field_order_cnt); +mtk_v4l2_vdec_dbg (3 , inst->ctx,"cur poc = %d\n" , dec_params->bottom_field_order_cnt);/* Build the reference lists */ v4l2_h264_init_reflist_builder (&reflist_builder, dec_params, sps, inst->dpb);
@@ -314,7 +314,7 @@ static int vdec_h264_slice_alloc_mv_buf(struct vdec_h264_slice_inst *inst,struct mtk_vcodec_mem *mem;int i, err; -mtk_v4l2_debug (3 ,"size = 0x%x" , buf_sz); +mtk_v4l2_vdec_dbg (3 , inst->ctx,"size = 0x%x" , buf_sz);for (i =0 ; i <H264_MAX_MV_NUM ; i++) { mem = &inst->mv_buf[i];if (mem->va)
@@ -372,12 +372,12 @@ static void vdec_h264_slice_get_pic_info(struct vdec_h264_slice_inst *inst) ctx->last_decoded_picinfo.buf_h != ctx->picinfo.buf_h) inst->realloc_mv_buf = true; -mtk_v4l2_debug (1 ,"resChg: (%d %d) : old(%d, %d) -> new(%d, %d)" , - inst->resolution_changed, - inst->realloc_mv_buf, - ctx->last_decoded_picinfo.pic_w, - ctx->last_decoded_picinfo.pic_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h); +mtk_v4l2_vdec_dbg (1 , inst->ctx,"resChg: (%d %d) : old(%d, %d) -> new(%d, %d)" , + inst->resolution_changed, + inst->realloc_mv_buf, + ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h); } }
drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c +7 -7
@@ -649,7 +649,7 @@ static int vdec_hevc_slice_alloc_mv_buf(struct vdec_hevc_slice_inst *inst,struct mtk_vcodec_mem *mem;int i, err; -mtk_v4l2_debug (3 ,"allocate mv buffer size = 0x%x" , buf_sz); +mtk_v4l2_vdec_dbg (3 , inst->ctx,"allocate mv buffer size = 0x%x" , buf_sz);for (i =0 ; i <HEVC_MAX_MV_NUM ; i++) { mem = &inst->mv_buf[i];if (mem->va)
@@ -707,12 +707,12 @@ static void vdec_hevc_slice_get_pic_info(struct vdec_hevc_slice_inst *inst) ctx->last_decoded_picinfo.buf_h != ctx->picinfo.buf_h) inst->realloc_mv_buf = true; -mtk_v4l2_debug (1 ,"resChg: (%d %d) : old(%d, %d) -> new(%d, %d)" , - inst->resolution_changed, - inst->realloc_mv_buf, - ctx->last_decoded_picinfo.pic_w, - ctx->last_decoded_picinfo.pic_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h); +mtk_v4l2_vdec_dbg (1 , inst->ctx,"resChg: (%d %d) : old(%d, %d) -> new(%d, %d)" , + inst->resolution_changed, + inst->realloc_mv_buf, + ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h); } }
drivers/media/platform/mediatek/vcodec/vdec_drv_if.c +2 -2
@@ -75,7 +75,7 @@ int vdec_if_decode(struct mtk_vcodec_ctx *ctx, struct mtk_vcodec_mem *bs,if (bs) {if ((bs->dma_addr &63 ) !=0 ) { -mtk_v4l2_err ("bs dma_addr should 64 byte align" ); +mtk_v4l2_vdec_err (ctx,"bs dma_addr should 64 byte align" );return -EINVAL ; } }
@@ -83,7 +83,7 @@ int vdec_if_decode(struct mtk_vcodec_ctx *ctx, struct mtk_vcodec_mem *bs,if (fb) {if (((fb->base_y.dma_addr &511 ) !=0 ) || ((fb->base_c.dma_addr &511 ) !=0 )) { -mtk_v4l2_err ("frame buffer dma_addr should 512 byte align" ); +mtk_v4l2_vdec_err (ctx,"frame buffer dma_addr should 512 byte align" );return -EINVAL ; } }
drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c +25 -27
148 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h +2 -0
@@ -100,6 +100,7 @@ struct vdec_lat_buf {* @empty_lat_buf: the last lat buf used to flush decode * @core_dec_done: core work queue decode done event * @status: current context decode status for core hardware +* @ctx: mtk vcodec context information */ struct vdec_msg_queue {struct vdec_lat_buf lat_buf[NUM_BUFFER_COUNT ];
@@ -118,6 +119,7 @@ struct vdec_msg_queue {struct vdec_lat_buf empty_lat_buf;wait_queue_head_t core_dec_done;int status; +struct mtk_vcodec_ctx *ctx; };/**
drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c +1 -1
@@ -91,7 +91,7 @@ static void vpu_dec_ipi_handler(void *data, unsigned int len, void *priv) (unsigned long )msg->ap_inst_addr;if (!vpu) { -mtk_v4l2_err ("ap_inst_addr is NULL, did the SCP hang or crash?" ); +mtk_v4l2_vdec_err (vpu->ctx,"ap_inst_addr is NULL, did the SCP hang or crash?" );return ; }
Signature · 1 line
2.18.0
Re: [PATCH v4,06/11] media: mediatek: vcodec: replace pr_* with dev_* for v4l2 debug message
Le lundi 26 juin 2023 à 11:53 +0800, Yunfei Dong a écrit :
Quoted 1,161 lines
Adding different macro
mtk_v4l2_vdec_dbgandmtk_v4l2_venc_dbgfor encoder and decoder. Then calling the common marcomtk_v4l2_debugto print debug message.Replace
pr_errwithdev_errfor 'mtk_v4l2_err' debug message. Replacepr_debugwithdev_dbgfor 'mtk_v4l2_debug' debug message.Signed-off-by Yunfei Dong <[email protected]>--- .../platform/mediatek/vcodec/mtk_vcodec_dec.c | 116 +++++----- .../mediatek/vcodec/mtk_vcodec_dec_drv.c | 53 ++--- .../mediatek/vcodec/mtk_vcodec_dec_hw.c | 7 +- .../mediatek/vcodec/mtk_vcodec_dec_pm.c | 19 +- .../mediatek/vcodec/mtk_vcodec_dec_stateful.c | 143 ++++++------ .../vcodec/mtk_vcodec_dec_stateless.c | 62 ++--- .../platform/mediatek/vcodec/mtk_vcodec_enc.c | 211 ++++++++---------- .../mediatek/vcodec/mtk_vcodec_enc_drv.c | 45 ++-- .../mediatek/vcodec/mtk_vcodec_enc_pm.c | 8 +- .../platform/mediatek/vcodec/mtk_vcodec_fw.c | 2 +- .../mediatek/vcodec/mtk_vcodec_fw_scp.c | 2 +- .../mediatek/vcodec/mtk_vcodec_fw_vpu.c | 7 +- .../mediatek/vcodec/mtk_vcodec_intr.c | 12 +- .../mediatek/vcodec/mtk_vcodec_util.c | 30 ++- .../mediatek/vcodec/mtk_vcodec_util.h | 24 +- .../vcodec/vdec/vdec_av1_req_lat_if.c | 10 +- .../mediatek/vcodec/vdec/vdec_h264_req_if.c | 14 +- .../vcodec/vdec/vdec_h264_req_multi_if.c | 16 +- .../vcodec/vdec/vdec_hevc_req_multi_if.c | 14 +- .../platform/mediatek/vcodec/vdec_drv_if.c | 4 +- .../platform/mediatek/vcodec/vdec_msg_queue.c | 52 +++-- .../platform/mediatek/vcodec/vdec_msg_queue.h | 2 + .../platform/mediatek/vcodec/vdec_vpu_if.c | 2 +- 23 files changed, 413 insertions(+), 442 deletions(-)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +55
-61@@ -82,7 +82,7 @@ static int vidioc_decoder_cmd(struct file *file, void *priv,if (ret)return ret; -mtk_v4l2_debug (1 ,"decoder cmd=%u" , cmd->cmd); +mtk_v4l2_vdec_dbg (1 , ctx,"decoder cmd=%u" , cmd->cmd); dst_vq =v4l2_m2m_get_vq (ctx->m2m_ctx,V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE );switch (cmd->cmd) {@@ -90,11 +90,11 @@ static int vidioc_decoder_cmd(struct file *file, void *priv, src_vq =v4l2_m2m_get_vq (ctx->m2m_ctx,V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE );if (!vb2_is_streaming (src_vq)) { -mtk_v4l2_debug (1 ,"Output stream is off. No need to flush." ); +mtk_v4l2_vdec_dbg (1 , ctx,"Output stream is off. No need to flush." );return 0 ; }if (!vb2_is_streaming (dst_vq)) { -mtk_v4l2_debug (1 ,"Capture stream is off. No need to flush." ); +mtk_v4l2_vdec_dbg (1 , ctx,"Capture stream is off. No need to flush." );return 0 ; }v4l2_m2m_buf_queue (ctx->m2m_ctx, &ctx->empty_flush_buf.vb);@@ -172,8 +172,7 @@ static int vidioc_vdec_qbuf(struct file *file, void *priv,struct mtk_vcodec_ctx *ctx =fh_to_ctx (priv);if (ctx->state ==MTK_STATE_ABORT ) { -mtk_v4l2_err ("[%d] Call on QBUF after unrecoverable error" , - ctx->id); +mtk_v4l2_vdec_err (ctx,"[%d] Call on QBUF after unrecoverable error" , ctx->id);return -EIO ; }@@ -186,8 +185,7 @@ static int vidioc_vdec_dqbuf(struct file *file, void *priv,struct mtk_vcodec_ctx *ctx =fh_to_ctx (priv);if (ctx->state ==MTK_STATE_ABORT ) { -mtk_v4l2_err ("[%d] Call on DQBUF after unrecoverable error" , - ctx->id); +mtk_v4l2_vdec_err (ctx,"[%d] Call on DQBUF after unrecoverable error" , ctx->id);return -EIO ; }@@ -288,11 +286,10 @@ static int vidioc_try_fmt(struct mtk_vcodec_ctx *ctx, struct v4l2_format *f, (pix_fmt_mp->height + 64) <= frmsize->max_height) pix_fmt_mp->height += 64; -mtk_v4l2_debug (0 , -"before resize width=%d, height=%d, after resize width=%d, height=%d, sizeimage=%d" , - tmp_w, tmp_h, pix_fmt_mp->width, - pix_fmt_mp->height, - pix_fmt_mp->width * pix_fmt_mp->height); +mtk_v4l2_vdec_dbg (0 , ctx, +"before resize wxh=%dx%d, after resize wxh=%dx%d, sizeimage=%d" , + tmp_w, tmp_h, pix_fmt_mp->width, pix_fmt_mp->height, + pix_fmt_mp->width * pix_fmt_mp->height); pix_fmt_mp->num_planes = fmt->num_planes; pix_fmt_mp->plane_fmt[0].sizeimage =@@ -344,7 +341,7 @@ static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv, }if (pix_fmt_mp->plane_fmt[0 ].sizeimage ==0 ) { -mtk_v4l2_err ("sizeimage of output format must be given" ); +mtk_v4l2_vdec_err (ctx,"sizeimage of output format must be given" );return -EINVAL ; }@@ -432,7 +429,7 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv,const struct mtk_video_fmt *fmt;const struct mtk_vcodec_dec_pdata *dec_pdata = ctx->dev->vdec_pdata; -mtk_v4l2_debug (3 ,"[%d]" , ctx->id); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d]" , ctx->id); q_data =mtk_vdec_get_q_data (ctx, f->type);if (!q_data)@@ -446,7 +443,7 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv,if (!dec_pdata->uses_stateless_api && f->type ==V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE &&vb2_is_busy (&ctx->m2m_ctx->out_q_ctx.q)) { -mtk_v4l2_err ("out_q_ctx buffers already requested" ); +mtk_v4l2_vdec_err (ctx,"out_q_ctx buffers already requested" ); ret = -EBUSY ; }@@ -456,7 +453,7 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv,*/ if ((f->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ) &&vb2_is_busy (&ctx->m2m_ctx->cap_q_ctx.q)) { -mtk_v4l2_err ("cap_q_ctx buffers already requested" ); +mtk_v4l2_vdec_err (ctx,"cap_q_ctx buffers already requested" ); ret = -EBUSY ; }@@ -491,8 +488,8 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv,if (ctx->state ==MTK_STATE_FREE ) { ret =vdec_if_init (ctx, q_data->fmt->fourcc);if (ret) { -mtk_v4l2_err ("[%d]: vdec_if_init() fail ret=%d" , - ctx->id, ret); +mtk_v4l2_vdec_err (ctx,"[%d]: vdec_if_init() fail ret=%d" , + ctx->id, ret);return -EINVAL ; } ctx->state =MTK_STATE_INIT ;@@ -515,8 +512,8 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv,*/ ret =vdec_if_get_param (ctx,GET_PARAM_PIC_INFO , &ctx->picinfo);if (ret) { -mtk_v4l2_err ("[%d]Error!! Get GET_PARAM_PICTURE_INFO Fail" , - ctx->id); +mtk_v4l2_vdec_err (ctx,"[%d]Error!! Get GET_PARAM_PICTURE_INFO Fail" , + ctx->id); } ctx->last_decoded_picinfo = ctx->picinfo;@@ -540,11 +537,13 @@ static int vidioc_vdec_s_fmt(struct file *file, void *priv, ctx->q_data[MTK_Q_DATA_DST ].coded_width = ctx->picinfo.buf_w; ctx->q_data[MTK_Q_DATA_DST ].coded_height = ctx->picinfo.buf_h; -mtk_v4l2_debug (2 ,"[%d] vdec_if_init() num_plane = %d wxh=%dx%d pic wxh=%dx%d sz[0]=0x%x sz[1]=0x%x" , - ctx->id, pix_mp->num_planes, ctx->picinfo.buf_w, ctx->picinfo.buf_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h, - ctx->q_data[MTK_Q_DATA_DST ].sizeimage[0 ], - ctx->q_data[MTK_Q_DATA_DST ].sizeimage[1 ]); +mtk_v4l2_vdec_dbg (2 , ctx, +"[%d] init() plane:%d wxh=%dx%d pic wxh=%dx%d sz=0x%x_0x%x" , + ctx->id, pix_mp->num_planes, + ctx->picinfo.buf_w, ctx->picinfo.buf_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h, + ctx->q_data[MTK_Q_DATA_DST ].sizeimage[0 ], + ctx->q_data[MTK_Q_DATA_DST ].sizeimage[1 ]); }return 0 ; }@@ -570,14 +569,11 @@ static int vidioc_enum_framesizes(struct file *file, void *priv, fsize->type =V4L2_FRMSIZE_TYPE_STEPWISE ; fsize->stepwise = dec_pdata->vdec_formats[i].frmsize; -mtk_v4l2_debug (1 ,"%x, %d %d %d %d %d %d" , - ctx->dev->dec_capability, - fsize->stepwise.min_width, - fsize->stepwise.max_width, - fsize->stepwise.step_width, - fsize->stepwise.min_height, - fsize->stepwise.max_height, - fsize->stepwise.step_height); +mtk_v4l2_vdec_dbg (1 , ctx,"%x, %d %d %d %d %d %d" , + ctx->dev->dec_capability, fsize->stepwise.min_width, + fsize->stepwise.max_width, fsize->stepwise.step_width, + fsize->stepwise.min_height, fsize->stepwise.max_height, + fsize->stepwise.step_height);return 0 ; }@@ -641,7 +637,7 @@ static int vidioc_vdec_g_fmt(struct file *file, void *priv, vq =v4l2_m2m_get_vq (ctx->m2m_ctx, f->type);if (!vq) { -mtk_v4l2_err ("no vb2 queue for type=%d" , f->type); +mtk_v4l2_vdec_err (ctx,"no vb2 queue for type=%d" , f->type);return -EINVAL ; }@@ -712,8 +708,8 @@ static int vidioc_vdec_g_fmt(struct file *file, void *priv, pix_mp->plane_fmt[1 ].bytesperline = q_data->bytesperline[1 ]; pix_mp->plane_fmt[1 ].sizeimage = q_data->sizeimage[1 ]; -mtk_v4l2_debug (1 ,"[%d] type=%d state=%d Format information could not be read, not ready yet!" , - ctx->id, f->type, ctx->state); +mtk_v4l2_vdec_dbg (1 , ctx,"[%d] type=%d state=%d Format information not ready!" , + ctx->id, f->type, ctx->state); }return 0 ;@@ -730,7 +726,7 @@ int vb2ops_vdec_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, q_data =mtk_vdec_get_q_data (ctx, vq->type);if (q_data ==NULL ) { -mtk_v4l2_err ("vq->type=%d err\n" , vq->type); +mtk_v4l2_vdec_err (ctx,"vq->type=%d err\n" , vq->type);return -EINVAL ; }@@ -756,10 +752,9 @@ int vb2ops_vdec_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers, sizes[i] = q_data->sizeimage[i]; } -mtk_v4l2_debug (1 , -"[%d]\t type = %d, get %d plane(s), %d buffer(s) of size 0x%x 0x%x " , - ctx->id, vq->type, *nplanes, *nbuffers, - sizes[0 ], sizes[1 ]); +mtk_v4l2_vdec_dbg (1 , ctx, +"[%d]\t type = %d, get %d plane(s), %d buffer(s) of size 0x%x 0x%x " , + ctx->id, vq->type, *nplanes, *nbuffers, sizes[0 ], sizes[1 ]);return 0 ; }@@ -770,16 +765,15 @@ int vb2ops_vdec_buf_prepare(struct vb2_buffer *vb)struct mtk_q_data *q_data;int i; -mtk_v4l2_debug (3 ,"[%d] (%d) id=%d" , - ctx->id, vb->vb2_queue->type, vb->index); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] (%d) id=%d" , + ctx->id, vb->vb2_queue->type, vb->index); q_data =mtk_vdec_get_q_data (ctx, vb->vb2_queue->type);for (i =0 ; i < q_data->fmt->num_planes; i++) {if (vb2_plane_size (vb, i) < q_data->sizeimage[i]) { -mtk_v4l2_err ("data will not fit into plane %d (%lu < %d)" , - i,vb2_plane_size (vb, i), - q_data->sizeimage[i]); +mtk_v4l2_vdec_err (ctx,"data will not fit into plane %d (%lu < %d)" , + i,vb2_plane_size (vb, i), q_data->sizeimage[i]);return -EINVAL ; }if (!V4L2_TYPE_IS_OUTPUT (vb->type))@@ -807,7 +801,7 @@ void vb2ops_vdec_buf_finish(struct vb2_buffer *vb)mutex_unlock (&ctx->lock);if (buf_error) { -mtk_v4l2_err ("Unrecoverable error on buffer." ); +mtk_v4l2_vdec_err (ctx,"Unrecoverable error on buffer." ); ctx->state =MTK_STATE_ABORT ; } }@@ -843,8 +837,8 @@ void vb2ops_vdec_stop_streaming(struct vb2_queue *q)struct mtk_vcodec_ctx *ctx =vb2_get_drv_priv (q);int ret; -mtk_v4l2_debug (3 ,"[%d] (%d) state=(%x) ctx->decoded_frame_cnt=%d" , - ctx->id, q->type, ctx->state, ctx->decoded_frame_cnt); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] (%d) state=(%x) ctx->decoded_frame_cnt=%d" , + ctx->id, q->type, ctx->state, ctx->decoded_frame_cnt);if (q->type ==V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ) {while ((src_buf =v4l2_m2m_src_buf_remove (ctx->m2m_ctx))) {@@ -870,17 +864,17 @@ void vb2ops_vdec_stop_streaming(struct vb2_queue *q)*/ ctx->picinfo = ctx->last_decoded_picinfo; -mtk_v4l2_debug (2 , -"[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)" , - ctx->id, ctx->last_decoded_picinfo.pic_w, - ctx->last_decoded_picinfo.pic_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h, - ctx->last_decoded_picinfo.buf_w, - ctx->last_decoded_picinfo.buf_h); +mtk_v4l2_vdec_dbg (2 , ctx, +"[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)" , + ctx->id, ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h, + ctx->last_decoded_picinfo.buf_w, + ctx->last_decoded_picinfo.buf_h); ret = ctx->dev->vdec_pdata->flush_decoder (ctx);if (ret) -mtk_v4l2_err ("DecodeFinal failed, ret=%d" , ret); +mtk_v4l2_vdec_err (ctx,"DecodeFinal failed, ret=%d" , ret); } ctx->state =MTK_STATE_FLUSH ;@@ -905,7 +899,7 @@ static int m2mops_vdec_job_ready(void *m2m_priv) {struct mtk_vcodec_ctx *ctx = m2m_priv; -mtk_v4l2_debug (3 ,"[%d]" , ctx->id); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d]" , ctx->id);if (ctx->state ==MTK_STATE_ABORT )return 0 ;@@ -973,7 +967,7 @@ int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue *src_vq,struct mtk_vcodec_ctx *ctx = priv;int ret =0 ; -mtk_v4l2_debug (3 ,"[%d]" , ctx->id); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d]" , ctx->id); src_vq->type =V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ; src_vq->io_modes =VB2_DMABUF |VB2_MMAP ;@@ -988,7 +982,7 @@ int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue *src_vq, ret =vb2_queue_init (src_vq);if (ret) { -mtk_v4l2_err ("Failed to initialize videobuf2 queue(output)" ); +mtk_v4l2_vdec_err (ctx,"Failed to initialize videobuf2 queue(output)" );return ret; } dst_vq->type =V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ;@@ -1004,7 +998,7 @@ int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue *src_vq, ret =vb2_queue_init (dst_vq);if (ret) -mtk_v4l2_err ("Failed to initialize videobuf2 queue(capture)" ); +mtk_v4l2_vdec_err (ctx,"Failed to initialize videobuf2 queue(capture)" );return ret; }drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +24
-29@@ -25,7 +25,7 @@#include "mtk_vcodec_util.h" #include "mtk_vcodec_fw.h" -static int mtk_vcodec_get_hw_count (struct mtk_vcodec_dev *dev) +static int mtk_vcodec_get_hw_count (struct mtk_vcodec_ctx *ctx,struct mtk_vcodec_dev *dev) {switch (dev->vdec_pdata->hw_arch) {case MTK_VDEC_PURE_SINGLE_CORE :@@ -33,7 +33,7 @@ static int mtk_vcodec_get_hw_count(struct mtk_vcodec_dev *dev)case MTK_VDEC_LAT_SINGLE_CORE :return MTK_VDEC_ONE_LAT_ONE_CORE ;default : -mtk_v4l2_err ("hw arch %d not supported" , dev->vdec_pdata->hw_arch); +mtk_v4l2_vdec_err (ctx,"hw arch %d not supported" , dev->vdec_pdata->hw_arch);return MTK_VDEC_NO_HW ; } }@@ -52,8 +52,7 @@ static irqreturn_t mtk_vcodec_dec_irq_handler(int irq, void *priv)/* check if HW active or not */ cg_status =readl (dev->reg_base[0 ]);if ((cg_status &VDEC_HW_ACTIVE ) !=0 ) { -mtk_v4l2_err ("DEC ISR, VDEC active is not 0x0 (0x%08x)" , - cg_status); +mtk_v4l2_vdec_err (ctx,"DEC ISR, VDEC active is not 0x0 (0x%08x)" , cg_status);return IRQ_HANDLED ; }@@ -71,9 +70,7 @@ static irqreturn_t mtk_vcodec_dec_irq_handler(int irq, void *priv)wake_up_ctx (ctx,MTK_INST_IRQ_RECEIVED ,0 ); -mtk_v4l2_debug (3 , -"mtk_vcodec_dec_irq_handler :wake up ctx %d, dec_done_status=%x" , - ctx->id, dec_done_status); +mtk_v4l2_vdec_dbg (3 , ctx,"wake up ctx %d, dec_done_status=%x" , ctx->id, dec_done_status);return IRQ_HANDLED ; }@@ -96,7 +93,7 @@ static int mtk_vcodec_get_reg_bases(struct mtk_vcodec_dev *dev)if (IS_ERR (dev->reg_base[i]))return PTR_ERR (dev->reg_base[i]); -mtk_v4l2_debug (2 ,"reg[%d] base=%p" , i, dev->reg_base[i]); +dev_dbg (&pdev->dev,"reg[%d] base=%p" , i, dev->reg_base[i]); }return 0 ;@@ -156,7 +153,7 @@ static int fops_vcodec_open(struct file *file)INIT_LIST_HEAD (&ctx->list); ctx->dev = dev;if (ctx->dev->vdec_pdata->is_subdev_supported) { - hw_count =mtk_vcodec_get_hw_count (dev); + hw_count =mtk_vcodec_get_hw_count (ctx, dev);if (!hw_count || !dev->subdev_prob_done) { ret = -EINVAL ; goto err_ctrls_setup;@@ -176,15 +173,14 @@ static int fops_vcodec_open(struct file *file) ctx->type =MTK_INST_DECODER ; ret = dev->vdec_pdata->ctrls_setup (ctx);if (ret) { -mtk_v4l2_err ("Failed to setup mt vcodec controls" ); +mtk_v4l2_vdec_err (ctx,"Failed to setup mt vcodec controls" ); goto err_ctrls_setup; } ctx->m2m_ctx =v4l2_m2m_ctx_init (dev->m2m_dev_dec, ctx, &mtk_vcodec_dec_queue_init);if (IS_ERR ((__force void *)ctx->m2m_ctx)) { ret =PTR_ERR ((__force void *)ctx->m2m_ctx); -mtk_v4l2_err ("Failed to v4l2_m2m_ctx_init() (%d)" , - ret); +mtk_v4l2_vdec_err (ctx,"Failed to v4l2_m2m_ctx_init() (%d)" , ret); goto err_m2m_ctx_init; } src_vq = v4l2_m2m_get_vq(ctx->m2m_ctx,@@ -202,14 +198,14 @@ static int fops_vcodec_open(struct file *file)* Return 0 if downloading firmware successfully, * otherwise it is failed */ -mtk_v4l2_err ("failed to load firmware!" ); +mtk_v4l2_vdec_err (ctx,"failed to load firmware!" ); goto err_load_fw; } dev->dec_capability =mtk_vcodec_fw_get_vdec_capa (dev->fw_handler); -mtk_v4l2_debug (0 ,"decoder capability %x" , dev->dec_capability); +mtk_v4l2_vdec_dbg (0 , ctx,"decoder capability %x" , dev->dec_capability); } ctx->dev->vdec_pdata->init_vdec_params (ctx);@@ -218,8 +214,7 @@ static int fops_vcodec_open(struct file *file)mtk_vcodec_dbgfs_create (ctx);mutex_unlock (&dev->dev_mutex); -mtk_v4l2_debug (0 ,"%s decoder [%d]" ,dev_name (&dev->plat_dev->dev), - ctx->id); +mtk_v4l2_vdec_dbg (0 , ctx,"%s decoder [%d]" ,dev_name (&dev->plat_dev->dev), ctx->id);return ret;/* Deinit when failure occurred */ @@ -241,7 +236,7 @@ static int fops_vcodec_release(struct file *file)struct mtk_vcodec_dev *dev =video_drvdata (file);struct mtk_vcodec_ctx *ctx =fh_to_ctx (file->private_data); -mtk_v4l2_debug (0 ,"[%d] decoder" , ctx->id); +mtk_v4l2_vdec_dbg (0 , ctx,"[%d] decoder" , ctx->id);mutex_lock (&dev->dev_mutex);/* @@ -296,7 +291,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) &rproc_phandle)) { fw_type = SCP; } else { -mtk_v4l2_err ("Could not get vdec IPI device" ); +dev_dbg (&pdev->dev,"Could not get vdec IPI device" );return -ENODEV ; }dma_set_max_seg_size (&pdev->dev,UINT_MAX );@@ -316,7 +311,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev)alloc_ordered_workqueue ("core-decoder" ,WQ_MEM_RECLAIM |WQ_FREEZABLE );if (!dev->core_workqueue) { -mtk_v4l2_err ("Failed to create core workqueue" ); +dev_dbg (&pdev->dev,"Failed to create core workqueue" ); ret = -EINVAL ; goto err_res; }@@ -332,13 +327,13 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ret =v4l2_device_register (&pdev->dev, &dev->v4l2_dev);if (ret) { -mtk_v4l2_err ("v4l2_device_register err=%d" , ret); +dev_err (&pdev->dev,"v4l2_device_register err=%d" , ret); goto err_core_workq; } vfd_dec =video_device_alloc ();if (!vfd_dec) { -mtk_v4l2_err ("Failed to allocate video device" ); +dev_err (&pdev->dev,"Failed to allocate video device" ); ret = -ENOMEM ; goto err_dec_alloc; }@@ -359,7 +354,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) dev->m2m_dev_dec =v4l2_m2m_init (&mtk_vdec_m2m_ops);if (IS_ERR ((__force void *)dev->m2m_dev_dec)) { -mtk_v4l2_err ("Failed to init mem2mem dec device" ); +dev_err (&pdev->dev,"Failed to init mem2mem dec device" ); ret =PTR_ERR ((__force void *)dev->m2m_dev_dec); goto err_dec_alloc; }@@ -368,7 +363,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev)alloc_ordered_workqueue (MTK_VCODEC_DEC_NAME ,WQ_MEM_RECLAIM |WQ_FREEZABLE );if (!dev->decode_workqueue) { -mtk_v4l2_err ("Failed to create decode workqueue" ); +dev_err (&pdev->dev,"Failed to create decode workqueue" ); ret = -EINVAL ; goto err_event_workq; }@@ -377,7 +372,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ret =of_platform_populate (pdev->dev.of_node,NULL ,NULL , &pdev->dev);if (ret) { -mtk_v4l2_err ("Main device of_platform_populate failed." ); +dev_err (&pdev->dev,"Main device of_platform_populate failed." ); goto err_reg_cont; } }else {@@ -390,7 +385,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ret =video_register_device (vfd_dec,VFL_TYPE_VIDEO ,-1 );if (ret) { -mtk_v4l2_err ("Failed to register video device" ); +dev_err (&pdev->dev,"Failed to register video device" ); goto err_reg_cont; }@@ -409,21 +404,21 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ret =v4l2_m2m_register_media_controller (dev->m2m_dev_dec, dev->vfd_dec,MEDIA_ENT_F_PROC_VIDEO_DECODER );if (ret) { -mtk_v4l2_err ("Failed to register media controller" ); +dev_err (&pdev->dev,"Failed to register media controller" ); goto err_dec_mem_init; } ret =media_device_register (&dev->mdev_dec);if (ret) { -mtk_v4l2_err ("Failed to register media device" ); +dev_err (&pdev->dev,"Failed to register media device" ); goto err_media_reg; } -mtk_v4l2_debug (0 ,"media registered as /dev/media%d" , vfd_dec->minor); +dev_dbg (&pdev->dev,"media registered as /dev/media%d" , vfd_dec->minor); }mtk_vcodec_dbgfs_init (dev, false); -mtk_v4l2_debug (0 ,"decoder registered as /dev/video%d" , vfd_dec->minor); +dev_dbg (&pdev->dev,"decoder registered as /dev/video%d" , vfd_dec->minor);return 0 ;drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c +3
-4@@ -77,8 +77,7 @@ static irqreturn_t mtk_vdec_hw_irq_handler(int irq, void *priv)/* check if HW active or not */ cg_status =readl (dev->reg_base[VDEC_HW_SYS ]);if (cg_status &VDEC_HW_ACTIVE ) { -mtk_v4l2_err ("vdec active is not 0x0 (0x%08x)" , - cg_status); +mtk_v4l2_vdec_err (ctx,"vdec active is not 0x0 (0x%08x)" , cg_status);return IRQ_HANDLED ; }@@ -93,8 +92,8 @@ static irqreturn_t mtk_vdec_hw_irq_handler(int irq, void *priv)wake_up_ctx (ctx,MTK_INST_IRQ_RECEIVED , dev->hw_idx); -mtk_v4l2_debug (3 ,"wake up ctx %d, dec_done_status=%x" , - ctx->id, dec_done_status); +mtk_v4l2_vdec_dbg (3 , ctx,"wake up ctx %d, dec_done_status=%x" , + ctx->id, dec_done_status);return IRQ_HANDLED ; }drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +9
-10@@ -32,7 +32,7 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm *if (!dec_clk->clk_info)return -ENOMEM ; }else { -mtk_v4l2_err ("Failed to get vdec clock count" ); +dev_err (&pdev->dev,"Failed to get vdec clock count" );return -EINVAL ; }@@ -41,14 +41,13 @@ int mtk_vcodec_init_dec_clk(struct platform_device *pdev, struct mtk_vcodec_pm * ret =of_property_read_string_index (pdev->dev.of_node,"clock-names" , i, &clk_info->clk_name);if (ret) { -mtk_v4l2_err ("Failed to get clock name id = %d" , i); +dev_err (&pdev->dev,"Failed to get clock name id = %d" , i);return ret; } clk_info->vcodec_clk =devm_clk_get (&pdev->dev, clk_info->clk_name);if (IS_ERR (clk_info->vcodec_clk)) { -mtk_v4l2_err ("devm_clk_get (%d)%s fail" , i, - clk_info->clk_name); +dev_err (&pdev->dev,"devm_clk_get (%d)%s fail" , i, clk_info->clk_name);return PTR_ERR (clk_info->vcodec_clk); } }@@ -63,7 +62,7 @@ static int mtk_vcodec_dec_pw_on(struct mtk_vcodec_pm *pm) ret =pm_runtime_resume_and_get (pm->dev);if (ret) -mtk_v4l2_err ("pm_runtime_resume_and_get fail %d" , ret); +dev_err (pm->dev,"pm_runtime_resume_and_get fail %d" , ret);return ret; }@@ -74,7 +73,7 @@ static void mtk_vcodec_dec_pw_off(struct mtk_vcodec_pm *pm) ret =pm_runtime_put (pm->dev);if (ret && ret != -EAGAIN ) -mtk_v4l2_err ("pm_runtime_put fail %d" , ret); +dev_err (pm->dev,"pm_runtime_put fail %d" , ret); }static void mtk_vcodec_dec_clock_on (struct mtk_vcodec_pm *pm)@@ -86,7 +85,7 @@ static void mtk_vcodec_dec_clock_on(struct mtk_vcodec_pm *pm)for (i =0 ; i < dec_clk->clk_num; i++) { ret =clk_prepare_enable (dec_clk->clk_info[i].vcodec_clk);if (ret) { -mtk_v4l2_err ("clk_prepare_enable %d %s fail %d" , i, +dev_err (pm->dev,"clk_prepare_enable %d %s fail %d" , i, dec_clk->clk_info[i].clk_name, ret); goto error; }@@ -120,7 +119,7 @@ static void mtk_vcodec_dec_enable_irq(struct mtk_vcodec_dev *vdec_dev, int hw_idif (subdev_dev)enable_irq (subdev_dev->dec_irq);else -mtk_v4l2_err ("Failed to get hw dev\n" ); +dev_err (&vdec_dev->plat_dev->dev,"Failed to get hw dev\n" ); }else {enable_irq (vdec_dev->dec_irq); }@@ -138,7 +137,7 @@ static void mtk_vcodec_dec_disable_irq(struct mtk_vcodec_dev *vdec_dev, int hw_iif (subdev_dev)disable_irq (subdev_dev->dec_irq);else -mtk_v4l2_err ("Failed to get hw dev\n" ); +dev_err (&vdec_dev->plat_dev->dev,"Failed to get hw dev\n" ); }else {disable_irq (vdec_dev->dec_irq); }@@ -185,7 +184,7 @@ static struct mtk_vcodec_pm *mtk_vcodec_dec_get_pm(struct mtk_vcodec_dev *vdec_dif (subdev_dev)return &subdev_dev->pm; -mtk_v4l2_err ("Failed to get hw dev\n" ); +dev_err (&vdec_dev->plat_dev->dev,"Failed to get hw dev\n" );return NULL ; }drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c +73
-70@@ -61,15 +61,16 @@ static struct vb2_buffer *get_display_buffer(struct mtk_vcodec_ctx *ctx)struct mtk_video_dec_buf *dstbuf;struct vb2_v4l2_buffer *vb; -mtk_v4l2_debug (3 ,"[%d]" , ctx->id); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d]" , ctx->id);if (vdec_if_get_param (ctx,GET_PARAM_DISP_FRAME_BUFFER , &disp_frame_buffer)) { -mtk_v4l2_err ("[%d]Cannot get param : GET_PARAM_DISP_FRAME_BUFFER" , ctx->id); +mtk_v4l2_vdec_err (ctx,"[%d]Cannot get param : GET_PARAM_DISP_FRAME_BUFFER" , + ctx->id);return NULL ; }if (!disp_frame_buffer) { -mtk_v4l2_debug (3 ,"No display frame buffer" ); +mtk_v4l2_vdec_dbg (3 , ctx,"No display frame buffer" );return NULL ; }@@ -78,9 +79,9 @@ static struct vb2_buffer *get_display_buffer(struct mtk_vcodec_ctx *ctx) vb = &dstbuf->m2m_buf.vb;mutex_lock (&ctx->lock);if (dstbuf->used) { -mtk_v4l2_debug (2 ,"[%d]status=%x queue id=%d to done_list %d" , - ctx->id, disp_frame_buffer->status, - vb->vb2_buf.index, dstbuf->queued_in_vb2); +mtk_v4l2_vdec_dbg (2 , ctx,"[%d]status=%x queue id=%d to done_list %d" , + ctx->id, disp_frame_buffer->status, + vb->vb2_buf.index, dstbuf->queued_in_vb2);v4l2_m2m_buf_done (vb,VB2_BUF_STATE_DONE ); ctx->decoded_frame_cnt++;@@ -105,16 +106,16 @@ static struct vb2_buffer *get_free_buffer(struct mtk_vcodec_ctx *ctx)if (vdec_if_get_param (ctx,GET_PARAM_FREE_FRAME_BUFFER , &free_frame_buffer)) { -mtk_v4l2_err ("[%d] Error!! Cannot get param" , ctx->id); +mtk_v4l2_vdec_err (ctx,"[%d] Error!! Cannot get param" , ctx->id);return NULL ; }if (!free_frame_buffer) { -mtk_v4l2_debug (3 ," No free frame buffer" ); +mtk_v4l2_vdec_dbg (3 , ctx," No free frame buffer" );return NULL ; } -mtk_v4l2_debug (3 ,"[%d] tmp_frame_addr = 0x%p" , ctx->id, - free_frame_buffer); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] tmp_frame_addr = 0x%p" , ctx->id, + free_frame_buffer); dstbuf = container_of(free_frame_buffer, struct mtk_video_dec_buf, frame_buffer);@@ -131,9 +132,9 @@ static struct vb2_buffer *get_free_buffer(struct mtk_vcodec_ctx *ctx)* This reduce overheads that dq/q unused capture * buffer. In this case, queued_in_vb2 = true. */ -mtk_v4l2_debug (2 ,"[%d]status=%x queue id=%d to rdy_queue %d" , - ctx->id, free_frame_buffer->status, - vb->vb2_buf.index, dstbuf->queued_in_vb2); +mtk_v4l2_vdec_dbg (2 , ctx,"[%d]status=%x queue id=%d to rdy_queue %d" , + ctx->id, free_frame_buffer->status, + vb->vb2_buf.index, dstbuf->queued_in_vb2);v4l2_m2m_buf_queue (ctx->m2m_ctx, vb); }else if (!dstbuf->queued_in_vb2 && dstbuf->queued_in_v4l2) {/* @@ -146,10 +147,10 @@ static struct vb2_buffer *get_free_buffer(struct mtk_vcodec_ctx *ctx)* means this buffer is not from previous decode * output. */ -mtk_v4l2_debug (2 , -"[%d]status=%x queue id=%d to rdy_queue" , - ctx->id, free_frame_buffer->status, - vb->vb2_buf.index); +mtk_v4l2_vdec_dbg (2 , ctx, +"[%d]status=%x queue id=%d to rdy_queue" , + ctx->id, free_frame_buffer->status, + vb->vb2_buf.index);v4l2_m2m_buf_queue (ctx->m2m_ctx, vb); dstbuf->queued_in_vb2 = true; }else {@@ -161,10 +162,10 @@ static struct vb2_buffer *get_free_buffer(struct mtk_vcodec_ctx *ctx)* When this buffer q from user space, it could * directly q to vb2 buffer */ -mtk_v4l2_debug (3 ,"[%d]status=%x err queue id=%d %d %d" , - ctx->id, free_frame_buffer->status, - vb->vb2_buf.index, dstbuf->queued_in_vb2, - dstbuf->queued_in_v4l2); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d]status=%x err queue id=%d %d %d" , + ctx->id, free_frame_buffer->status, + vb->vb2_buf.index, dstbuf->queued_in_vb2, + dstbuf->queued_in_v4l2); } dstbuf->used = false; }@@ -191,7 +192,7 @@ static void mtk_vdec_queue_res_chg_event(struct mtk_vcodec_ctx *ctx) .u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION, }; -mtk_v4l2_debug (1 ,"[%d]" , ctx->id); +mtk_v4l2_vdec_dbg (1 , ctx,"[%d]" , ctx->id);v4l2_event_queue_fh (&ctx->fh, &ev_src_ch); }@@ -202,7 +203,7 @@ static int mtk_vdec_flush_decoder(struct mtk_vcodec_ctx *ctx) ret =vdec_if_decode (ctx,NULL ,NULL , &res_chg);if (ret) -mtk_v4l2_err ("DecodeFinal failed, ret=%d" , ret); +mtk_v4l2_vdec_err (ctx,"DecodeFinal failed, ret=%d" , ret);clean_display_buffer (ctx);clean_free_buffer (ctx);@@ -221,14 +222,14 @@ static void mtk_vdec_update_fmt(struct mtk_vcodec_ctx *ctx,for (k =0 ; k < num_supported_formats; k++) { fmt = &mtk_video_formats[k];if (fmt->fourcc == pixelformat) { -mtk_v4l2_debug (1 ,"Update cap fourcc(%d -> %d)" , - dst_q_data->fmt->fourcc, pixelformat); +mtk_v4l2_vdec_dbg (1 , ctx,"Update cap fourcc(%d -> %d)" , + dst_q_data->fmt->fourcc, pixelformat); dst_q_data->fmt = fmt;return ; } } -mtk_v4l2_err ("Cannot get fourcc(%d), using init value" , pixelformat); +mtk_v4l2_vdec_err (ctx,"Cannot get fourcc(%d), using init value" , pixelformat); }static int mtk_vdec_pic_info_update (struct mtk_vcodec_ctx *ctx)@@ -238,7 +239,8 @@ static int mtk_vdec_pic_info_update(struct mtk_vcodec_ctx *ctx)if (vdec_if_get_param (ctx,GET_PARAM_PIC_INFO , &ctx->last_decoded_picinfo)) { -mtk_v4l2_err ("[%d]Error!! Cannot get param : GET_PARAM_PICTURE_INFO ERR" , ctx->id); +mtk_v4l2_vdec_err (ctx,"[%d]Error!! Cannot get param : GET_PARAM_PICTURE_INFO ERR" , + ctx->id);return -EINVAL ; }@@ -246,7 +248,7 @@ static int mtk_vdec_pic_info_update(struct mtk_vcodec_ctx *ctx) ctx->last_decoded_picinfo.pic_h == 0 || ctx->last_decoded_picinfo.buf_w == 0 || ctx->last_decoded_picinfo.buf_h == 0) { -mtk_v4l2_err ("Cannot get correct pic info" ); +mtk_v4l2_vdec_err (ctx,"Cannot get correct pic info" );return -EINVAL ; }@@ -258,15 +260,15 @@ static int mtk_vdec_pic_info_update(struct mtk_vcodec_ctx *ctx) ctx->last_decoded_picinfo.pic_h == ctx->picinfo.pic_h)return 0 ; -mtk_v4l2_debug (1 ,"[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)" , ctx->id, - ctx->last_decoded_picinfo.pic_w, - ctx->last_decoded_picinfo.pic_h, ctx->picinfo.pic_w, - ctx->picinfo.pic_h, ctx->last_decoded_picinfo.buf_w, - ctx->last_decoded_picinfo.buf_h); +mtk_v4l2_vdec_dbg (1 , ctx,"[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)" , ctx->id, + ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, ctx->picinfo.pic_w, + ctx->picinfo.pic_h, ctx->last_decoded_picinfo.buf_w, + ctx->last_decoded_picinfo.buf_h); ret =vdec_if_get_param (ctx,GET_PARAM_DPB_SIZE , &dpbsize);if (dpbsize ==0 ) -mtk_v4l2_err ("Incorrect dpb size, ret=%d" , ret); +mtk_v4l2_vdec_err (ctx,"Incorrect dpb size, ret=%d" , ret); ctx->dpb_size = dpbsize;@@ -288,14 +290,14 @@ static void mtk_vdec_worker(struct work_struct *work) src_buf =v4l2_m2m_next_src_buf (ctx->m2m_ctx);if (!src_buf) {v4l2_m2m_job_finish (dev->m2m_dev_dec, ctx->m2m_ctx); -mtk_v4l2_debug (1 ,"[%d] src_buf empty!!" , ctx->id); +mtk_v4l2_vdec_dbg (1 , ctx,"[%d] src_buf empty!!" , ctx->id);return ; } dst_buf =v4l2_m2m_next_dst_buf (ctx->m2m_ctx);if (!dst_buf) {v4l2_m2m_job_finish (dev->m2m_dev_dec, ctx->m2m_ctx); -mtk_v4l2_debug (1 ,"[%d] dst_buf empty!!" , ctx->id); +mtk_v4l2_vdec_dbg (1 , ctx,"[%d] dst_buf empty!!" , ctx->id);return ; }@@ -313,15 +315,15 @@ static void mtk_vdec_worker(struct work_struct *work)vb2_dma_contig_plane_dma_addr (&dst_buf->vb2_buf,1 ); pfb->base_c.size = ctx->picinfo.fb_sz[1 ]; pfb->status =0 ; -mtk_v4l2_debug (3 ,"===>[%d] vdec_if_decode() ===>" , ctx->id); +mtk_v4l2_vdec_dbg (3 , ctx,"===>[%d] vdec_if_decode() ===>" , ctx->id); -mtk_v4l2_debug (3 , -"id=%d Framebuf pfb=%p VA=%p Y_DMA=%pad C_DMA=%pad Size=%zx" , - dst_buf->vb2_buf.index, pfb, pfb->base_y.va, - &pfb->base_y.dma_addr, &pfb->base_c.dma_addr, pfb->base_y.size); +mtk_v4l2_vdec_dbg (3 , ctx, +"id=%d Framebuf pfb=%p VA=%p Y_DMA=%pad C_DMA=%pad Size=%zx" , + dst_buf->vb2_buf.index, pfb, pfb->base_y.va, + &pfb->base_y.dma_addr, &pfb->base_c.dma_addr, pfb->base_y.size);if (src_buf == &ctx->empty_flush_buf.vb) { -mtk_v4l2_debug (1 ,"Got empty flush input buffer." ); +mtk_v4l2_vdec_dbg (1 , ctx,"Got empty flush input buffer." ); src_buf =v4l2_m2m_src_buf_remove (ctx->m2m_ctx);/* update dst buf status */ @@ -350,12 +352,12 @@ static void mtk_vdec_worker(struct work_struct *work) buf.size = (size_t )src_buf->vb2_buf.planes[0 ].bytesused;if (!buf.va) {v4l2_m2m_job_finish (dev->m2m_dev_dec, ctx->m2m_ctx); -mtk_v4l2_err ("[%d] id=%d src_addr is NULL!!" , ctx->id, - src_buf->vb2_buf.index); +mtk_v4l2_vdec_err (ctx,"[%d] id=%d src_addr is NULL!!" , ctx->id, + src_buf->vb2_buf.index);return ; } -mtk_v4l2_debug (3 ,"[%d] Bitstream VA=%p DMA=%pad Size=%zx vb=%p" , - ctx->id, buf.va, &buf.dma_addr, buf.size, src_buf); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] Bitstream VA=%p DMA=%pad Size=%zx vb=%p" , + ctx->id, buf.va, &buf.dma_addr, buf.size, src_buf); dst_buf->vb2_buf.timestamp = src_buf->vb2_buf.timestamp; dst_buf->timecode = src_buf->timecode;mutex_lock (&ctx->lock);@@ -366,9 +368,10 @@ static void mtk_vdec_worker(struct work_struct *work) ret =vdec_if_decode (ctx, &buf, pfb, &res_chg);if (ret) { -mtk_v4l2_err (" <===[%d], src_buf[%d] sz=0x%zx pts=%llu dst_buf[%d] vdec_if_decode() ret=%d res_chg=%d===>" , - ctx->id, src_buf->vb2_buf.index, buf.size, - src_buf->vb2_buf.timestamp, dst_buf->vb2_buf.index, ret, res_chg); +mtk_v4l2_vdec_err (ctx, +"[%d] decode src[%d] sz=0x%zx pts=%llu dst[%d] ret=%d res_chg=%d" , + ctx->id, src_buf->vb2_buf.index, buf.size, + src_buf->vb2_buf.timestamp, dst_buf->vb2_buf.index, ret, res_chg); src_buf =v4l2_m2m_src_buf_remove (ctx->m2m_ctx);if (ret == -EIO ) {mutex_lock (&ctx->lock);@@ -421,8 +424,8 @@ static void vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb)struct vb2_v4l2_buffer *vb2_v4l2;struct mtk_q_data *dst_q_data; -mtk_v4l2_debug (3 ,"[%d] (%d) id=%d, vb=%p" , ctx->id, - vb->vb2_queue->type, vb->index, vb); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] (%d) id=%d, vb=%p" , ctx->id, + vb->vb2_queue->type, vb->index, vb);/* * check if this buffer is ready to be used after decode */ @@ -448,20 +451,19 @@ static void vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb)v4l2_m2m_buf_queue (ctx->m2m_ctx,to_vb2_v4l2_buffer (vb));if (ctx->state !=MTK_STATE_INIT ) { -mtk_v4l2_debug (3 ,"[%d] already init driver %d" , ctx->id, - ctx->state); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] already init driver %d" , ctx->id, ctx->state);return ; } src_buf =v4l2_m2m_next_src_buf (ctx->m2m_ctx);if (!src_buf) { -mtk_v4l2_err ("No src buffer" ); +mtk_v4l2_vdec_err (ctx,"No src buffer" );return ; }if (src_buf == &ctx->empty_flush_buf.vb) {/* This shouldn't happen. Just in case. */ -mtk_v4l2_err ("Invalid flush buffer." ); +mtk_v4l2_vdec_err (ctx,"Invalid flush buffer." );v4l2_m2m_src_buf_remove (ctx->m2m_ctx);return ; }@@ -469,9 +471,8 @@ static void vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb) src_mem.va =vb2_plane_vaddr (&src_buf->vb2_buf,0 ); src_mem.dma_addr =vb2_dma_contig_plane_dma_addr (&src_buf->vb2_buf,0 ); src_mem.size = (size_t )src_buf->vb2_buf.planes[0 ].bytesused; -mtk_v4l2_debug (2 ,"[%d] buf id=%d va=%p dma=%pad size=%zx" , ctx->id, - src_buf->vb2_buf.index, src_mem.va, &src_mem.dma_addr, - src_mem.size); +mtk_v4l2_vdec_dbg (2 , ctx,"[%d] buf id=%d va=%p dma=%pad size=%zx" , ctx->id, + src_buf->vb2_buf.index, src_mem.va, &src_mem.dma_addr, src_mem.size); ret =vdec_if_decode (ctx, &src_mem,NULL , &res_chg);if (ret || !res_chg) {@@ -484,20 +485,22 @@ static void vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb) src_buf =v4l2_m2m_src_buf_remove (ctx->m2m_ctx);if (ret == -EIO ) { -mtk_v4l2_err ("[%d] Unrecoverable error in vdec_if_decode." , ctx->id); +mtk_v4l2_vdec_err (ctx,"[%d] Unrecoverable error in vdec_if_decode." , + ctx->id); ctx->state =MTK_STATE_ABORT ;v4l2_m2m_buf_done (src_buf,VB2_BUF_STATE_ERROR ); }else {v4l2_m2m_buf_done (src_buf,VB2_BUF_STATE_DONE ); } -mtk_v4l2_debug (ret ?0 :1 , -"[%d] vdec_if_decode() src_buf=%d, size=%zu, fail=%d, res_chg=%d" , - ctx->id, src_buf->vb2_buf.index, src_mem.size, ret, res_chg); +mtk_v4l2_vdec_dbg (ret ?0 :1 , ctx, +"[%d] decode() src_buf=%d, size=%zu, fail=%d, res_chg=%d" , + ctx->id, src_buf->vb2_buf.index, src_mem.size, ret, res_chg);return ; }if (vdec_if_get_param (ctx,GET_PARAM_PIC_INFO , &ctx->picinfo)) { -mtk_v4l2_err ("[%d]Error!! Cannot get param : GET_PARAM_PICTURE_INFO ERR" , ctx->id); +mtk_v4l2_vdec_err (ctx,"[%d]Error!! Cannot get param : GET_PARAM_PICTURE_INFO ERR" , + ctx->id);return ; }@@ -508,17 +511,17 @@ static void vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb) dst_q_data->bytesperline[i] = ctx->picinfo.buf_w; } -mtk_v4l2_debug (2 ,"[%d] vdec_if_init() OK wxh=%dx%d pic wxh=%dx%d sz[0]=0x%x sz[1]=0x%x" , - ctx->id, ctx->picinfo.buf_w, ctx->picinfo.buf_h, ctx->picinfo.pic_w, - ctx->picinfo.pic_h, dst_q_data->sizeimage[0 ], dst_q_data->sizeimage[1 ]); +mtk_v4l2_vdec_dbg (2 , ctx,"[%d] init OK wxh=%dx%d pic wxh=%dx%d sz[0]=0x%x sz[1]=0x%x" , + ctx->id, ctx->picinfo.buf_w, ctx->picinfo.buf_h, ctx->picinfo.pic_w, + ctx->picinfo.pic_h, dst_q_data->sizeimage[0 ], dst_q_data->sizeimage[1 ]); ret =vdec_if_get_param (ctx,GET_PARAM_DPB_SIZE , &dpbsize);if (dpbsize ==0 ) -mtk_v4l2_err ("[%d] GET_PARAM_DPB_SIZE fail=%d" , ctx->id, ret); +mtk_v4l2_vdec_err (ctx,"[%d] GET_PARAM_DPB_SIZE fail=%d" , ctx->id, ret); ctx->dpb_size = dpbsize; ctx->state =MTK_STATE_HEADER ; -mtk_v4l2_debug (1 ,"[%d] dpbsize=%d" , ctx->id, ctx->dpb_size); +mtk_v4l2_vdec_dbg (1 , ctx,"[%d] dpbsize=%d" , ctx->id, ctx->dpb_size);mtk_vdec_queue_res_chg_event (ctx); }@@ -533,7 +536,7 @@ static int mtk_vdec_g_v_ctrl(struct v4l2_ctrl *ctrl)if (ctx->state >=MTK_STATE_HEADER ) { ctrl->val = ctx->dpb_size; }else { -mtk_v4l2_debug (0 ,"Seqinfo not ready" ); +mtk_v4l2_vdec_dbg (0 , ctx,"Seqinfo not ready" ); ctrl->val =0 ; }break ;@@ -570,7 +573,7 @@ static int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_ctx *ctx) V4L2_MPEG_VIDEO_H264_PROFILE_MAIN);if (ctx->ctrl_hdl.error) { -mtk_v4l2_err ("Adding control failed %d" , ctx->ctrl_hdl.error); +mtk_v4l2_vdec_err (ctx,"Adding control failed %d" , ctx->ctrl_hdl.error);return ctx->ctrl_hdl.error; }drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c +27
-23@@ -232,10 +232,10 @@ static void mtk_vdec_stateless_cap_to_disp(struct mtk_vcodec_ctx *ctx, int error vb2_dst =v4l2_m2m_dst_buf_remove (ctx->m2m_ctx);if (vb2_dst) {v4l2_m2m_buf_done (vb2_dst, state); -mtk_v4l2_debug (2 ,"free frame buffer id:%d to done list" , - vb2_dst->vb2_buf.index); +mtk_v4l2_vdec_dbg (2 , ctx,"free frame buffer id:%d to done list" , + vb2_dst->vb2_buf.index); }else { -mtk_v4l2_err ("dst buffer is NULL" ); +mtk_v4l2_vdec_err (ctx,"dst buffer is NULL" ); }if (src_buf_req)@@ -251,7 +251,7 @@ static struct vdec_fb *vdec_get_cap_buffer(struct mtk_vcodec_ctx *ctx) vb2_v4l2 =v4l2_m2m_next_dst_buf (ctx->m2m_ctx);if (!vb2_v4l2) { -mtk_v4l2_debug (1 ,"[%d] dst_buf empty!!" , ctx->id); +mtk_v4l2_vdec_dbg (1 , ctx,"[%d] dst_buf empty!!" , ctx->id);return NULL ; }@@ -269,9 +269,10 @@ static struct vdec_fb *vdec_get_cap_buffer(struct mtk_vcodec_ctx *ctx)vb2_dma_contig_plane_dma_addr (dst_buf,1 ); pfb->base_c.size = ctx->q_data[MTK_Q_DATA_DST ].sizeimage[1 ]; } -mtk_v4l2_debug (1 ,"id=%d Framebuf pfb=%p VA=%p Y_DMA=%pad C_DMA=%pad Size=%zx frame_count = %d" , - dst_buf->index, pfb, pfb->base_y.va, &pfb->base_y.dma_addr, - &pfb->base_c.dma_addr, pfb->base_y.size, ctx->decoded_frame_cnt); +mtk_v4l2_vdec_dbg (1 , ctx, +"id=%d Framebuf pfb=%p VA=%p Y/C_DMA=%pad_%pad Sz=%zx frame_count = %d" , + dst_buf->index, pfb, pfb->base_y.va, &pfb->base_y.dma_addr, + &pfb->base_c.dma_addr, pfb->base_y.size, ctx->decoded_frame_cnt);return pfb; }@@ -300,7 +301,7 @@ static void mtk_vdec_worker(struct work_struct *work) vb2_v4l2_src =v4l2_m2m_next_src_buf (ctx->m2m_ctx);if (!vb2_v4l2_src) {v4l2_m2m_job_finish (dev->m2m_dev_dec, ctx->m2m_ctx); -mtk_v4l2_debug (1 ,"[%d] no available source buffer" , ctx->id); +mtk_v4l2_vdec_dbg (1 , ctx,"[%d] no available source buffer" , ctx->id);return ; }@@ -309,33 +310,34 @@ static void mtk_vdec_worker(struct work_struct *work) m2m_buf.vb); bs_src = &dec_buf_src->bs_buffer; -mtk_v4l2_debug (3 ,"[%d] (%d) id=%d, vb=%p" , ctx->id, - vb2_src->vb2_queue->type, vb2_src->index, vb2_src); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] (%d) id=%d, vb=%p" , ctx->id, + vb2_src->vb2_queue->type, vb2_src->index, vb2_src); bs_src->va =vb2_plane_vaddr (vb2_src,0 ); bs_src->dma_addr =vb2_dma_contig_plane_dma_addr (vb2_src,0 ); bs_src->size = (size_t )vb2_src->planes[0 ].bytesused;if (!bs_src->va) {v4l2_m2m_job_finish (dev->m2m_dev_dec, ctx->m2m_ctx); -mtk_v4l2_err ("[%d] id=%d source buffer is NULL" , ctx->id, - vb2_src->index); +mtk_v4l2_vdec_err (ctx,"[%d] id=%d source buffer is NULL" , ctx->id, + vb2_src->index);return ; } -mtk_v4l2_debug (3 ,"[%d] Bitstream VA=%p DMA=%pad Size=%zx vb=%p" , - ctx->id, bs_src->va, &bs_src->dma_addr, bs_src->size, vb2_src); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] Bitstream VA=%p DMA=%pad Size=%zx vb=%p" , + ctx->id, bs_src->va, &bs_src->dma_addr, bs_src->size, vb2_src);/* Apply request controls. */ src_buf_req = vb2_src->req_obj.req;if (src_buf_req)v4l2_ctrl_request_setup (src_buf_req, &ctx->ctrl_hdl);else -mtk_v4l2_err ("vb2 buffer media request is NULL" ); +mtk_v4l2_vdec_err (ctx,"vb2 buffer media request is NULL" ); ret =vdec_if_decode (ctx, bs_src,NULL , &res_chg);if (ret && ret != -EAGAIN ) { -mtk_v4l2_err (" <===[%d], src_buf[%d] sz=0x%zx pts=%llu vdec_if_decode() ret=%d res_chg=%d===>" , - ctx->id, vb2_src->index, bs_src->size, - vb2_src->timestamp, ret, res_chg); +mtk_v4l2_vdec_err (ctx, +"[%d] decode src_buf[%d] sz=0x%zx pts=%llu ret=%d res_chg=%d" , + ctx->id, vb2_src->index, bs_src->size, + vb2_src->timestamp, ret, res_chg);if (ret == -EIO ) {mutex_lock (&ctx->lock); dec_buf_src->error = true;@@ -363,7 +365,8 @@ static void vb2ops_vdec_stateless_buf_queue(struct vb2_buffer *vb)struct mtk_vcodec_ctx *ctx =vb2_get_drv_priv (vb->vb2_queue);struct vb2_v4l2_buffer *vb2_v4l2 =to_vb2_v4l2_buffer (vb); -mtk_v4l2_debug (3 ,"[%d] (%d) id=%d, vb=%p" , ctx->id, vb->vb2_queue->type, vb->index, vb); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] (%d) id=%d, vb=%p" , ctx->id, vb->vb2_queue->type, + vb->index, vb);mutex_lock (&ctx->lock);v4l2_m2m_buf_queue (ctx->m2m_ctx, vb2_v4l2);@@ -374,9 +377,9 @@ static void vb2ops_vdec_stateless_buf_queue(struct vb2_buffer *vb)/* If an OUTPUT buffer, we may need to update the state */ if (ctx->state ==MTK_STATE_INIT ) { ctx->state =MTK_STATE_HEADER ; -mtk_v4l2_debug (1 ,"Init driver from init to header." ); +mtk_v4l2_vdec_dbg (1 , ctx,"Init driver from init to header." ); }else { -mtk_v4l2_debug (3 ,"[%d] already init driver %d" , ctx->id, ctx->state); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] already init driver %d" , ctx->id, ctx->state); } }@@ -393,7 +396,7 @@ static int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_ctx *ctx)v4l2_ctrl_handler_init (&ctx->ctrl_hdl,NUM_CTRLS );if (ctx->ctrl_hdl.error) { -mtk_v4l2_err ("v4l2_ctrl_handler_init failed\n" ); +mtk_v4l2_vdec_err (ctx,"v4l2_ctrl_handler_init failed\n" );return ctx->ctrl_hdl.error; }@@ -402,7 +405,8 @@ static int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_ctx *ctx)v4l2_ctrl_new_custom (&ctx->ctrl_hdl, &cfg,NULL );if (ctx->ctrl_hdl.error) { -mtk_v4l2_err ("Adding control %d failed %d" , i, ctx->ctrl_hdl.error); +mtk_v4l2_vdec_err (ctx,"Adding control %d failed %d" , i, + ctx->ctrl_hdl.error);return ctx->ctrl_hdl.error; } }
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c static int fops_media_request_validate(struct media_request *mreq) · line 429
Quoted 6 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c +1
-1@@ -421,11 +425,11 @@ static int fops_media_request_validate(struct media_request *mreq)/* We expect exactly one buffer with the request */ break ;case 0 : -mtk_v4l2_debug (1 ,"No buffer provided with the request" ); +pr_debug ("[MTK VCODEC] No buffer provided with the request" );
I suggest following the same format as the macro, "<devname>:
[MTK_V4L2][ERROR]", you can probably have a macro for that formatting. This would ensure consitency for all the trace without context. Some of the trace don't even name anything MTK/VCODEC, like av1_error: prefix. I'd like to see these fixed.
pr_debug(MTK_DBG_STR "No buffer provided with...");
Or add ...no_ctx() debug macro, prepending the string ? This would be up to your preference.
regards,
Nicolas
Quoted 1,323 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c +5
-5return -ENOENT ;default : -mtk_v4l2_debug (1 ,"Too many buffers (%d) provided with the request" , - buffer_cnt); +pr_debug ("[MTK VCODEC] Too many buffers (%d) provided with the request" , + buffer_cnt);return -EINVAL ; }@@ -470,13 +474,13 @@ static void mtk_vcodec_add_formats(unsigned int fourcc, mtk_video_formats[count_formats].num_planes =2 ;break ;default : -mtk_v4l2_err ("Can not add unsupported format type" ); +mtk_v4l2_vdec_err (ctx,"Can not add unsupported format type" );return ; } num_formats++; -mtk_v4l2_debug (3 ,"num_formats: %d dec_capability: 0x%x" , - count_formats, ctx->dev->dec_capability); +mtk_v4l2_vdec_dbg (3 , ctx,"num_formats: %d dec_capability: 0x%x" , + count_formats, ctx->dev->dec_capability); }static void mtk_vcodec_get_supported_formats (struct mtk_vcodec_ctx *ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c +92
-119@@ -51,63 +51,53 @@ static int vidioc_venc_s_ctrl(struct v4l2_ctrl *ctrl)switch (ctrl->id) {case V4L2_CID_MPEG_VIDEO_BITRATE_MODE : -mtk_v4l2_debug (2 ,"V4L2_CID_MPEG_VIDEO_BITRATE_MODE val= %d" , - ctrl->val); +mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_BITRATE_MODE val= %d" , ctrl->val);if (ctrl->val !=V4L2_MPEG_VIDEO_BITRATE_MODE_CBR ) { -mtk_v4l2_err ("Unsupported bitrate mode =%d" , ctrl->val); +mtk_v4l2_venc_err (ctx,"Unsupported bitrate mode =%d" , ctrl->val); ret = -EINVAL ; }break ;case V4L2_CID_MPEG_VIDEO_BITRATE : -mtk_v4l2_debug (2 ,"V4L2_CID_MPEG_VIDEO_BITRATE val = %d" , - ctrl->val); +mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_BITRATE val = %d" , ctrl->val); p->bitrate = ctrl->val; ctx->param_change |=MTK_ENCODE_PARAM_BITRATE ;break ;case V4L2_CID_MPEG_VIDEO_B_FRAMES : -mtk_v4l2_debug (2 ,"V4L2_CID_MPEG_VIDEO_B_FRAMES val = %d" , - ctrl->val); +mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_B_FRAMES val = %d" , ctrl->val); p->num_b_frame = ctrl->val;break ;case V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE : -mtk_v4l2_debug (2 ,"V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE val = %d" , - ctrl->val); +mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_FRAME_RC_ENABLE val = %d" , + ctrl->val); p->rc_frame = ctrl->val;break ;case V4L2_CID_MPEG_VIDEO_H264_MAX_QP : -mtk_v4l2_debug (2 ,"V4L2_CID_MPEG_VIDEO_H264_MAX_QP val = %d" , - ctrl->val); +mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_H264_MAX_QP val = %d" , ctrl->val); p->h264_max_qp = ctrl->val;break ;case V4L2_CID_MPEG_VIDEO_HEADER_MODE : -mtk_v4l2_debug (2 ,"V4L2_CID_MPEG_VIDEO_HEADER_MODE val = %d" , - ctrl->val); +mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_HEADER_MODE val = %d" , ctrl->val); p->seq_hdr_mode = ctrl->val;break ;case V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE : -mtk_v4l2_debug (2 ,"V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE val = %d" , - ctrl->val); +mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_MB_RC_ENABLE val = %d" , ctrl->val); p->rc_mb = ctrl->val;break ;case V4L2_CID_MPEG_VIDEO_H264_PROFILE : -mtk_v4l2_debug (2 ,"V4L2_CID_MPEG_VIDEO_H264_PROFILE val = %d" , - ctrl->val); +mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_H264_PROFILE val = %d" , ctrl->val); p->h264_profile = ctrl->val;break ;case V4L2_CID_MPEG_VIDEO_H264_LEVEL : -mtk_v4l2_debug (2 ,"V4L2_CID_MPEG_VIDEO_H264_LEVEL val = %d" , - ctrl->val); +mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_H264_LEVEL val = %d" , ctrl->val); p->h264_level = ctrl->val;break ;case V4L2_CID_MPEG_VIDEO_H264_I_PERIOD : -mtk_v4l2_debug (2 ,"V4L2_CID_MPEG_VIDEO_H264_I_PERIOD val = %d" , - ctrl->val); +mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_H264_I_PERIOD val = %d" , ctrl->val); p->intra_period = ctrl->val; ctx->param_change |=MTK_ENCODE_PARAM_INTRA_PERIOD ;break ;case V4L2_CID_MPEG_VIDEO_GOP_SIZE : -mtk_v4l2_debug (2 ,"V4L2_CID_MPEG_VIDEO_GOP_SIZE val = %d" , - ctrl->val); +mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_GOP_SIZE val = %d" , ctrl->val); p->gop_size = ctrl->val; ctx->param_change |=MTK_ENCODE_PARAM_GOP_SIZE ;break ;@@ -116,10 +106,10 @@ static int vidioc_venc_s_ctrl(struct v4l2_ctrl *ctrl)* FIXME - what vp8 profiles are actually supported? * The ctrl is added (with only profile 0 supported) for now. */ -mtk_v4l2_debug (2 ,"V4L2_CID_MPEG_VIDEO_VP8_PROFILE val = %d" , ctrl->val); +mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_VP8_PROFILE val = %d" , ctrl->val);break ;case V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME : -mtk_v4l2_debug (2 ,"V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME" ); +mtk_v4l2_venc_dbg (2 , ctx,"V4L2_CID_MPEG_VIDEO_FORCE_KEY_FRAME" ); p->force_intra =1 ; ctx->param_change |=MTK_ENCODE_PARAM_FORCE_INTRA ;break ;@@ -341,11 +331,12 @@ static int vidioc_try_fmt_out(struct mtk_vcodec_ctx *ctx, struct v4l2_format *f,if (pix_fmt_mp->height < tmp_h && (pix_fmt_mp->height +32 ) <= max_height) pix_fmt_mp->height +=32 ; -mtk_v4l2_debug (0 ,"before resize w=%d, h=%d, after resize w=%d, h=%d, sizeimage=%d %d" , - tmp_w, tmp_h, pix_fmt_mp->width, - pix_fmt_mp->height, - pix_fmt_mp->plane_fmt[0 ].sizeimage, - pix_fmt_mp->plane_fmt[1 ].sizeimage); +mtk_v4l2_venc_dbg (0 , ctx, +"before resize wxh=%dx%d, after resize wxh=%dx%d, sizeimage=%d %d" , + tmp_w, tmp_h, pix_fmt_mp->width, + pix_fmt_mp->height, + pix_fmt_mp->plane_fmt[0 ].sizeimage, + pix_fmt_mp->plane_fmt[1 ].sizeimage); pix_fmt_mp->num_planes = fmt->num_planes; pix_fmt_mp->plane_fmt[0].sizeimage =@@ -396,7 +387,7 @@ static void mtk_venc_set_param(struct mtk_vcodec_ctx *ctx, param->input_yuv_fmt =VENC_YUV_FORMAT_NV21 ;break ;default : -mtk_v4l2_err ("Unsupported fourcc =%d" , q_data_src->fmt->fourcc); +mtk_v4l2_venc_err (ctx,"Unsupported fourcc =%d" , q_data_src->fmt->fourcc);break ; } param->h264_profile = enc_params->h264_profile;@@ -414,13 +405,13 @@ static void mtk_venc_set_param(struct mtk_vcodec_ctx *ctx, param->gop_size = enc_params->gop_size; param->bitrate = enc_params->bitrate; -mtk_v4l2_debug (0 , -"fmt 0x%x, P/L %d/%d, w/h %d/%d, buf %d/%d, fps/bps %d/%d, gop %d, i_period %d" , - param->input_yuv_fmt, param->h264_profile, - param->h264_level, param->width, param->height, - param->buf_width, param->buf_height, - param->frm_rate, param->bitrate, - param->gop_size, param->intra_period); +mtk_v4l2_venc_dbg (0 , ctx, +"fmt 0x%x, P/L %d/%d w/h %d/%d buf %d/%d fps/bps %d/%d gop %d i_per %d" , + param->input_yuv_fmt, param->h264_profile, + param->h264_level, param->width, param->height, + param->buf_width, param->buf_height, + param->frm_rate, param->bitrate, + param->gop_size, param->intra_period); } static int vidioc_venc_s_fmt_cap(struct file *file, void *priv,@@ -435,12 +426,12 @@ static int vidioc_venc_s_fmt_cap(struct file *file, void *priv, vq =v4l2_m2m_get_vq (ctx->m2m_ctx, f->type);if (!vq) { -mtk_v4l2_err ("fail to get vq" ); +mtk_v4l2_venc_err (ctx,"fail to get vq" );return -EINVAL ; }if (vb2_is_busy (vq)) { -mtk_v4l2_err ("queue busy" ); +mtk_v4l2_venc_err (ctx,"queue busy" );return -EBUSY ; }@@ -468,8 +459,8 @@ static int vidioc_venc_s_fmt_cap(struct file *file, void *priv,if (ctx->state ==MTK_STATE_FREE ) { ret =venc_if_init (ctx, q_data->fmt->fourcc);if (ret) { -mtk_v4l2_err ("venc_if_init failed=%d, codec type=%x" , - ret, q_data->fmt->fourcc); +mtk_v4l2_venc_err (ctx,"venc_if_init failed=%d, codec type=%x" , + ret, q_data->fmt->fourcc);return -EBUSY ; } ctx->state =MTK_STATE_INIT ;@@ -490,12 +481,12 @@ static int vidioc_venc_s_fmt_out(struct file *file, void *priv, vq =v4l2_m2m_get_vq (ctx->m2m_ctx, f->type);if (!vq) { -mtk_v4l2_err ("fail to get vq" ); +mtk_v4l2_venc_err (ctx,"fail to get vq" );return -EINVAL ; }if (vb2_is_busy (vq)) { -mtk_v4l2_err ("queue busy" ); +mtk_v4l2_venc_err (ctx,"queue busy" );return -EBUSY ; }@@ -670,8 +661,8 @@ static int vidioc_venc_qbuf(struct file *file, void *priv,struct mtk_vcodec_ctx *ctx =fh_to_ctx (priv);if (ctx->state ==MTK_STATE_ABORT ) { -mtk_v4l2_err ("[%d] Call on QBUF after unrecoverable error" , - ctx->id); +mtk_v4l2_venc_err (ctx,"[%d] Call on QBUF after unrecoverable error" , + ctx->id);return -EIO ; }@@ -685,8 +676,8 @@ static int vidioc_venc_dqbuf(struct file *file, void *priv,int ret;if (ctx->state ==MTK_STATE_ABORT ) { -mtk_v4l2_err ("[%d] Call on QBUF after unrecoverable error" , - ctx->id); +mtk_v4l2_venc_err (ctx,"[%d] Call on QBUF after unrecoverable error" , + ctx->id);return -EIO ; }@@ -724,8 +715,8 @@ static int vidioc_encoder_cmd(struct file *file, void *priv,int ret;if (ctx->state ==MTK_STATE_ABORT ) { -mtk_v4l2_err ("[%d] Call to CMD after unrecoverable error" , - ctx->id); +mtk_v4l2_venc_err (ctx,"[%d] Call to CMD after unrecoverable error" , + ctx->id);return -EIO ; }@@ -737,7 +728,7 @@ static int vidioc_encoder_cmd(struct file *file, void *priv,if (ctx->is_flushing)return -EBUSY ; -mtk_v4l2_debug (1 ,"encoder cmd=%u" , cmd->cmd); +mtk_v4l2_venc_dbg (1 , ctx,"encoder cmd=%u" , cmd->cmd); dst_vq =v4l2_m2m_get_vq (ctx->m2m_ctx,V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE );@@ -746,11 +737,11 @@ static int vidioc_encoder_cmd(struct file *file, void *priv, src_vq =v4l2_m2m_get_vq (ctx->m2m_ctx,V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE );if (!vb2_is_streaming (src_vq)) { -mtk_v4l2_debug (1 ,"Output stream is off. No need to flush." ); +mtk_v4l2_venc_dbg (1 , ctx,"Output stream is off. No need to flush." );return 0 ; }if (!vb2_is_streaming (dst_vq)) { -mtk_v4l2_debug (1 ,"Capture stream is off. No need to flush." ); +mtk_v4l2_venc_dbg (1 , ctx,"Capture stream is off. No need to flush." );return 0 ; } ctx->is_flushing = true;@@ -841,9 +832,8 @@ static int vb2ops_venc_buf_prepare(struct vb2_buffer *vb)for (i =0 ; i < q_data->fmt->num_planes; i++) {if (vb2_plane_size (vb, i) < q_data->sizeimage[i]) { -mtk_v4l2_err ("data will not fit into plane %d (%lu < %d)" , - i,vb2_plane_size (vb, i), - q_data->sizeimage[i]); +mtk_v4l2_venc_err (ctx,"data will not fit into plane %d (%lu < %d)" , + i,vb2_plane_size (vb, i), q_data->sizeimage[i]);return -EINVAL ; } }@@ -863,10 +853,8 @@ static void vb2ops_venc_buf_queue(struct vb2_buffer *vb)if ((vb->vb2_queue->type ==V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ) && (ctx->param_change !=MTK_ENCODE_PARAM_NONE )) { -mtk_v4l2_debug (1 ,"[%d] Before id=%d encode parameter change %x" , - ctx->id, - vb2_v4l2->vb2_buf.index, - ctx->param_change); +mtk_v4l2_venc_dbg (1 , ctx,"[%d] Before id=%d encode parameter change %x" , + ctx->id, vb2_v4l2->vb2_buf.index, ctx->param_change); mtk_buf->param_change = ctx->param_change; mtk_buf->enc_params = ctx->enc_params; ctx->param_change =MTK_ENCODE_PARAM_NONE ;@@ -901,14 +889,14 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count) ret =pm_runtime_resume_and_get (&ctx->dev->plat_dev->dev);if (ret <0 ) { -mtk_v4l2_err ("pm_runtime_resume_and_get fail %d" , ret); +mtk_v4l2_venc_err (ctx,"pm_runtime_resume_and_get fail %d" , ret); goto err_start_stream; }mtk_venc_set_param (ctx, ¶m); ret =venc_if_set_param (ctx,VENC_SET_PARAM_ENC , ¶m);if (ret) { -mtk_v4l2_err ("venc_if_set_param failed=%d" , ret); +mtk_v4l2_venc_err (ctx,"venc_if_set_param failed=%d" , ret); ctx->state =MTK_STATE_ABORT ; goto err_set_param; }@@ -921,7 +909,7 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count)VENC_SET_PARAM_PREPEND_HEADER , NULL);if (ret) { -mtk_v4l2_err ("venc_if_set_param failed=%d" , ret); +mtk_v4l2_venc_err (ctx,"venc_if_set_param failed=%d" , ret); ctx->state =MTK_STATE_ABORT ; goto err_set_param; }@@ -933,7 +921,7 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count) err_set_param: pm_ret =pm_runtime_put (&ctx->dev->plat_dev->dev);if (pm_ret <0 ) -mtk_v4l2_err ("pm_runtime_put fail %d" , pm_ret); +mtk_v4l2_venc_err (ctx,"pm_runtime_put fail %d" , pm_ret); err_start_stream:for (i =0 ; i < q->num_buffers; ++i) {@@ -944,9 +932,8 @@ static int vb2ops_venc_start_streaming(struct vb2_queue *q, unsigned int count)* can be marked as done. */ if (buf && buf->state ==VB2_BUF_STATE_ACTIVE ) { -mtk_v4l2_debug (0 ,"[%d] id=%d, type=%d, %d -> VB2_BUF_STATE_QUEUED" , - ctx->id, i, q->type, - (int )buf->state); +mtk_v4l2_venc_dbg (0 , ctx,"[%d] id=%d, type=%d, %d->VB2_BUF_STATE_QUEUED" , + ctx->id, i, q->type, (int )buf->state);v4l2_m2m_buf_done (to_vb2_v4l2_buffer (buf),VB2_BUF_STATE_QUEUED ); }@@ -961,7 +948,7 @@ static void vb2ops_venc_stop_streaming(struct vb2_queue *q)struct vb2_v4l2_buffer *src_buf, *dst_buf;int ret; -mtk_v4l2_debug (2 ,"[%d]-> type=%d" , ctx->id, q->type); +mtk_v4l2_venc_dbg (2 , ctx,"[%d]-> type=%d" , ctx->id, q->type);if (q->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ) {while ((dst_buf =v4l2_m2m_dst_buf_remove (ctx->m2m_ctx))) {@@ -972,7 +959,7 @@ static void vb2ops_venc_stop_streaming(struct vb2_queue *q)if (ctx->is_flushing) {struct v4l2_m2m_buffer *b, *n; -mtk_v4l2_debug (1 ,"STREAMOFF called while flushing" ); +mtk_v4l2_venc_dbg (1 , ctx,"STREAMOFF called while flushing" );/* * STREAMOFF could be called before the flush buffer is * dequeued. Check whether empty flush buf is still in @@ -1006,21 +993,21 @@ static void vb2ops_venc_stop_streaming(struct vb2_queue *q) vb2_is_streaming(&ctx->m2m_ctx->out_q_ctx.q)) || (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE && vb2_is_streaming(&ctx->m2m_ctx->cap_q_ctx.q))) { -mtk_v4l2_debug (1 ,"[%d]-> q type %d out=%d cap=%d" , - ctx->id, q->type, -vb2_is_streaming (&ctx->m2m_ctx->out_q_ctx.q), -vb2_is_streaming (&ctx->m2m_ctx->cap_q_ctx.q)); +mtk_v4l2_venc_dbg (1 , ctx,"[%d]-> q type %d out=%d cap=%d" , + ctx->id, q->type, +vb2_is_streaming (&ctx->m2m_ctx->out_q_ctx.q), +vb2_is_streaming (&ctx->m2m_ctx->cap_q_ctx.q));return ; }/* Release the encoder if both streams are stopped. */ ret =venc_if_deinit (ctx);if (ret) -mtk_v4l2_err ("venc_if_deinit failed=%d" , ret); +mtk_v4l2_venc_err (ctx,"venc_if_deinit failed=%d" , ret); ret =pm_runtime_put (&ctx->dev->plat_dev->dev);if (ret <0 ) -mtk_v4l2_err ("pm_runtime_put fail %d" , ret); +mtk_v4l2_venc_err (ctx,"pm_runtime_put fail %d" , ret); ctx->state =MTK_STATE_FREE ; }@@ -1054,7 +1041,7 @@ static int mtk_venc_encode_header(void *priv) dst_buf =v4l2_m2m_dst_buf_remove (ctx->m2m_ctx);if (!dst_buf) { -mtk_v4l2_debug (1 ,"No dst buffer" ); +mtk_v4l2_venc_dbg (1 , ctx,"No dst buffer" );return -EINVAL ; }@@ -1062,12 +1049,10 @@ static int mtk_venc_encode_header(void *priv) bs_buf.dma_addr =vb2_dma_contig_plane_dma_addr (&dst_buf->vb2_buf,0 ); bs_buf.size = (size_t )dst_buf->vb2_buf.planes[0 ].length; -mtk_v4l2_debug (1 , -"[%d] buf id=%d va=0x%p dma_addr=0x%llx size=%zu" , - ctx->id, - dst_buf->vb2_buf.index, bs_buf.va, - (u64 )bs_buf.dma_addr, - bs_buf.size); +mtk_v4l2_venc_dbg (1 , ctx, +"[%d] buf id=%d va=0x%p dma_addr=0x%llx size=%zu" , + ctx->id, dst_buf->vb2_buf.index, bs_buf.va, + (u64 )bs_buf.dma_addr, bs_buf.size); ret = venc_if_encode(ctx, VENC_START_OPT_ENCODE_SEQUENCE_HEADER,@@ -1077,7 +1062,7 @@ static int mtk_venc_encode_header(void *priv)vb2_set_plane_payload (&dst_buf->vb2_buf,0 ,0 ); ctx->state =MTK_STATE_ABORT ;v4l2_m2m_buf_done (dst_buf,VB2_BUF_STATE_ERROR ); -mtk_v4l2_err ("venc_if_encode failed=%d" , ret); +mtk_v4l2_venc_err (ctx,"venc_if_encode failed=%d" , ret);return -EINVAL ; } src_buf =v4l2_m2m_next_src_buf (ctx->m2m_ctx);@@ -1085,7 +1070,7 @@ static int mtk_venc_encode_header(void *priv) dst_buf->vb2_buf.timestamp = src_buf->vb2_buf.timestamp; dst_buf->timecode = src_buf->timecode; }else { -mtk_v4l2_err ("No timestamp for the header buffer." ); +mtk_v4l2_venc_err (ctx,"No timestamp for the header buffer." ); } ctx->state =MTK_STATE_HEADER ;@@ -1114,10 +1099,8 @@ static int mtk_venc_param_change(struct mtk_vcodec_ctx *ctx)if (mtk_buf->param_change &MTK_ENCODE_PARAM_BITRATE ) { enc_prm.bitrate = mtk_buf->enc_params.bitrate; -mtk_v4l2_debug (1 ,"[%d] id=%d, change param br=%d" , - ctx->id, - vb2_v4l2->vb2_buf.index, - enc_prm.bitrate); +mtk_v4l2_venc_dbg (1 , ctx,"[%d] id=%d, change param br=%d" , + ctx->id, vb2_v4l2->vb2_buf.index, enc_prm.bitrate); ret |=venc_if_set_param (ctx,VENC_SET_PARAM_ADJUST_BITRATE , &enc_prm);@@ -1125,27 +1108,23 @@ static int mtk_venc_param_change(struct mtk_vcodec_ctx *ctx)if (!ret && mtk_buf->param_change &MTK_ENCODE_PARAM_FRAMERATE ) { enc_prm.frm_rate = mtk_buf->enc_params.framerate_num / mtk_buf->enc_params.framerate_denom; -mtk_v4l2_debug (1 ,"[%d] id=%d, change param fr=%d" , - ctx->id, - vb2_v4l2->vb2_buf.index, - enc_prm.frm_rate); +mtk_v4l2_venc_dbg (1 , ctx,"[%d] id=%d, change param fr=%d" , + ctx->id, vb2_v4l2->vb2_buf.index, enc_prm.frm_rate); ret |=venc_if_set_param (ctx,VENC_SET_PARAM_ADJUST_FRAMERATE , &enc_prm); }if (!ret && mtk_buf->param_change &MTK_ENCODE_PARAM_GOP_SIZE ) { enc_prm.gop_size = mtk_buf->enc_params.gop_size; -mtk_v4l2_debug (1 ,"change param intra period=%d" , - enc_prm.gop_size); +mtk_v4l2_venc_dbg (1 , ctx,"change param intra period=%d" , enc_prm.gop_size); ret |=venc_if_set_param (ctx,VENC_SET_PARAM_GOP_SIZE , &enc_prm); }if (!ret && mtk_buf->param_change &MTK_ENCODE_PARAM_FORCE_INTRA ) { -mtk_v4l2_debug (1 ,"[%d] id=%d, change param force I=%d" , - ctx->id, - vb2_v4l2->vb2_buf.index, - mtk_buf->enc_params.force_intra); +mtk_v4l2_venc_dbg (1 , ctx,"[%d] id=%d, change param force I=%d" , + ctx->id, vb2_v4l2->vb2_buf.index, + mtk_buf->enc_params.force_intra);if (mtk_buf->enc_params.force_intra) ret |= venc_if_set_param(ctx, VENC_SET_PARAM_FORCE_INTRA,@@ -1156,8 +1135,8 @@ static int mtk_venc_param_change(struct mtk_vcodec_ctx *ctx)if (ret) { ctx->state =MTK_STATE_ABORT ; -mtk_v4l2_err ("venc_if_set_param %d failed=%d" , - mtk_buf->param_change, ret); +mtk_v4l2_venc_err (ctx,"venc_if_set_param %d failed=%d" , + mtk_buf->param_change, ret);return -1 ; }@@ -1218,14 +1197,11 @@ static void mtk_venc_worker(struct work_struct *work) bs_buf.dma_addr =vb2_dma_contig_plane_dma_addr (&dst_buf->vb2_buf,0 ); bs_buf.size = (size_t )dst_buf->vb2_buf.planes[0 ].length; -mtk_v4l2_debug (2 , -"Framebuf PA=%llx Size=0x%zx;PA=0x%llx Size=0x%zx;PA=0x%llx Size=%zu" , - (u64 )frm_buf.fb_addr[0 ].dma_addr, - frm_buf.fb_addr[0 ].size, - (u64 )frm_buf.fb_addr[1 ].dma_addr, - frm_buf.fb_addr[1 ].size, - (u64 )frm_buf.fb_addr[2 ].dma_addr, - frm_buf.fb_addr[2 ].size); +mtk_v4l2_venc_dbg (2 , ctx, +"Framebuf PA=%llx Size=0x%zx;PA=0x%llx Size=0x%zx;PA=0x%llx Size=%zu" , + (u64 )frm_buf.fb_addr[0 ].dma_addr, frm_buf.fb_addr[0 ].size, + (u64 )frm_buf.fb_addr[1 ].dma_addr, frm_buf.fb_addr[1 ].size, + (u64 )frm_buf.fb_addr[2 ].dma_addr, frm_buf.fb_addr[2 ].size); ret =venc_if_encode (ctx,VENC_START_OPT_ENCODE_FRAME , &frm_buf, &bs_buf, &enc_result);@@ -1240,20 +1216,19 @@ static void mtk_venc_worker(struct work_struct *work)v4l2_m2m_buf_done (src_buf,VB2_BUF_STATE_ERROR );vb2_set_plane_payload (&dst_buf->vb2_buf,0 ,0 );v4l2_m2m_buf_done (dst_buf,VB2_BUF_STATE_ERROR ); -mtk_v4l2_err ("venc_if_encode failed=%d" , ret); +mtk_v4l2_venc_err (ctx,"venc_if_encode failed=%d" , ret); }else {v4l2_m2m_buf_done (src_buf,VB2_BUF_STATE_DONE );vb2_set_plane_payload (&dst_buf->vb2_buf,0 , enc_result.bs_size);v4l2_m2m_buf_done (dst_buf,VB2_BUF_STATE_DONE ); -mtk_v4l2_debug (2 ,"venc_if_encode bs size=%d" , - enc_result.bs_size); +mtk_v4l2_venc_dbg (2 , ctx,"venc_if_encode bs size=%d" , + enc_result.bs_size); }v4l2_m2m_job_finish (ctx->dev->m2m_dev_enc, ctx->m2m_ctx); -mtk_v4l2_debug (1 ,"<=== src_buf[%d] dst_buf[%d] venc_if_encode ret=%d Size=%u===>" , - src_buf->vb2_buf.index, dst_buf->vb2_buf.index, ret, - enc_result.bs_size); +mtk_v4l2_venc_dbg (1 , ctx,"<=== src_buf[%d] dst_buf[%d] venc_if_encode ret=%d Size=%u===>" , + src_buf->vb2_buf.index, dst_buf->vb2_buf.index, ret, enc_result.bs_size); }static void m2mops_venc_device_run (void *priv)@@ -1277,8 +1252,7 @@ static int m2mops_venc_job_ready(void *m2m_priv)struct mtk_vcodec_ctx *ctx = m2m_priv;if (ctx->state ==MTK_STATE_ABORT || ctx->state ==MTK_STATE_FREE ) { -mtk_v4l2_debug (3 ,"[%d]Not ready: state=0x%x." , - ctx->id, ctx->state); +mtk_v4l2_venc_dbg (3 , ctx,"[%d]Not ready: state=0x%x." , ctx->id, ctx->state);return 0 ; }@@ -1413,8 +1387,7 @@ int mtk_vcodec_enc_ctrls_setup(struct mtk_vcodec_ctx *ctx)if (handler->error) { -mtk_v4l2_err ("Init control handler fail %d" , - handler->error); +mtk_v4l2_venc_err (ctx,"Init control handler fail %d" , handler->error);return handler->error; }@@ -1482,7 +1455,7 @@ void mtk_vcodec_enc_release(struct mtk_vcodec_ctx *ctx)int ret =venc_if_deinit (ctx);if (ret) -mtk_v4l2_err ("venc_if_deinit failed=%d" , ret); +mtk_v4l2_venc_err (ctx,"venc_if_deinit failed=%d" , ret); ctx->state =MTK_STATE_FREE ; }drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c +21
-24@@ -97,12 +97,11 @@ static irqreturn_t mtk_vcodec_enc_irq_handler(int irq, void *priv) core_id = dev->venc_pdata->core_id;if (core_id <0 || core_id >=NUM_MAX_VCODEC_REG_BASE ) { -mtk_v4l2_err ("Invalid core id: %d, ctx id: %d" , - core_id, ctx->id); +mtk_v4l2_venc_err (ctx,"Invalid core id: %d, ctx id: %d" , core_id, ctx->id);return IRQ_HANDLED ; } -mtk_v4l2_debug (1 ,"id: %d, core id: %d" , ctx->id, core_id); +mtk_v4l2_venc_dbg (1 , ctx,"id: %d, core id: %d" , ctx->id, core_id); addr = dev->reg_base[core_id] +MTK_VENC_IRQ_ACK_OFFSET ;@@ -143,16 +142,14 @@ static int fops_vcodec_open(struct file *file) ctx->type =MTK_INST_ENCODER ; ret =mtk_vcodec_enc_ctrls_setup (ctx);if (ret) { -mtk_v4l2_err ("Failed to setup controls() (%d)" , - ret); +mtk_v4l2_venc_err (ctx,"Failed to setup controls() (%d)" , ret); goto err_ctrls_setup; } ctx->m2m_ctx =v4l2_m2m_ctx_init (dev->m2m_dev_enc, ctx, &mtk_vcodec_enc_queue_init);if (IS_ERR ((__force void *)ctx->m2m_ctx)) { ret =PTR_ERR ((__force void *)ctx->m2m_ctx); -mtk_v4l2_err ("Failed to v4l2_m2m_ctx_init() (%d)" , - ret); +mtk_v4l2_venc_err (ctx,"Failed to v4l2_m2m_ctx_init() (%d)" , ret); goto err_m2m_ctx_init; } src_vq = v4l2_m2m_get_vq(ctx->m2m_ctx,@@ -171,23 +168,23 @@ static int fops_vcodec_open(struct file *file)* Return 0 if downloading firmware successfully, * otherwise it is failed */ -mtk_v4l2_err ("vpu_load_firmware failed!" ); +mtk_v4l2_venc_err (ctx,"vpu_load_firmware failed!" ); goto err_load_fw; } dev->enc_capability =mtk_vcodec_fw_get_venc_capa (dev->fw_handler); -mtk_v4l2_debug (0 ,"encoder capability %x" , dev->enc_capability); +mtk_v4l2_venc_dbg (0 , ctx,"encoder capability %x" , dev->enc_capability); } -mtk_v4l2_debug (2 ,"Create instance [%d]@%p m2m_ctx=%p " , - ctx->id, ctx, ctx->m2m_ctx); +mtk_v4l2_venc_dbg (2 , ctx,"Create instance [%d]@%p m2m_ctx=%p " , + ctx->id, ctx, ctx->m2m_ctx);list_add (&ctx->list, &dev->ctx_list);mutex_unlock (&dev->dev_mutex); -mtk_v4l2_debug (0 ,"%s encoder [%d]" ,dev_name (&dev->plat_dev->dev), - ctx->id); +mtk_v4l2_venc_dbg (0 , ctx,"%s encoder [%d]" ,dev_name (&dev->plat_dev->dev), + ctx->id);return ret;/* Deinit when failure occurred */ @@ -209,7 +206,7 @@ static int fops_vcodec_release(struct file *file)struct mtk_vcodec_dev *dev =video_drvdata (file);struct mtk_vcodec_ctx *ctx =fh_to_ctx (file->private_data); -mtk_v4l2_debug (1 ,"[%d] encoder" , ctx->id); +mtk_v4l2_venc_dbg (1 , ctx,"[%d] encoder" , ctx->id);mutex_lock (&dev->dev_mutex);v4l2_m2m_ctx_release (ctx->m2m_ctx);@@ -255,7 +252,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) &rproc_phandle)) { fw_type = SCP; } else { -mtk_v4l2_err ("Could not get venc IPI device" ); +dev_err (&pdev->dev,"[MTK VCODEC] Could not get venc IPI device" );return -ENODEV ; }dma_set_max_seg_size (&pdev->dev,UINT_MAX );@@ -267,7 +264,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) dev->venc_pdata =of_device_get_match_data (&pdev->dev); ret =mtk_vcodec_init_enc_clk (dev);if (ret <0 ) { -dev_err (&pdev->dev,"Failed to get mtk vcodec clock source!" ); +dev_err (&pdev->dev,"[MTK VCODEC] Failed to get mtk vcodec clock source!" ); goto err_enc_pm; }@@ -292,7 +289,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) 0, pdev->name, dev);if (ret) {dev_err (&pdev->dev, -"Failed to install dev->enc_irq %d (%d) core_id (%d)" , +"[MTK VCODEC] Failed to install dev->enc_irq %d (%d) core_id (%d)" , dev->enc_irq, ret, dev->venc_pdata->core_id); ret = -EINVAL ; goto err_res;@@ -307,14 +304,14 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ret =v4l2_device_register (&pdev->dev, &dev->v4l2_dev);if (ret) { -mtk_v4l2_err ("v4l2_device_register err=%d" , ret); +dev_err (&pdev->dev,"[MTK VCODEC] v4l2_device_register err=%d" , ret); goto err_res; }/* allocate video device for encoder and register it */ vfd_enc =video_device_alloc ();if (!vfd_enc) { -mtk_v4l2_err ("Failed to allocate video device" ); +dev_err (&pdev->dev,"[MTK VCODEC] Failed to allocate video device" ); ret = -ENOMEM ; goto err_enc_alloc; }@@ -335,7 +332,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) dev->m2m_dev_enc =v4l2_m2m_init (&mtk_venc_m2m_ops);if (IS_ERR ((__force void *)dev->m2m_dev_enc)) { -mtk_v4l2_err ("Failed to init mem2mem enc device" ); +dev_err (&pdev->dev,"[MTK VCODEC] Failed to init mem2mem enc device" ); ret =PTR_ERR ((__force void *)dev->m2m_dev_enc); goto err_enc_mem_init; }@@ -345,20 +342,20 @@ static int mtk_vcodec_probe(struct platform_device *pdev)WQ_MEM_RECLAIM | WQ_FREEZABLE);if (!dev->encode_workqueue) { -mtk_v4l2_err ("Failed to create encode workqueue" ); +dev_err (&pdev->dev,"[MTK VCODEC] Failed to create encode workqueue" ); ret = -EINVAL ; goto err_event_workq; } ret =video_register_device (vfd_enc,VFL_TYPE_VIDEO ,-1 );if (ret) { -mtk_v4l2_err ("Failed to register video device" ); +dev_err (&pdev->dev,"[MTK VCODEC] Failed to register video device" ); goto err_enc_reg; }mtk_vcodec_dbgfs_init (dev, true); -mtk_v4l2_debug (0 ,"encoder %d registered as /dev/video%d" , - dev->venc_pdata->core_id, vfd_enc->num); +dev_dbg (&pdev->dev,"[MTK VCODEC] encoder %d registered as /dev/video%d" , + dev->venc_pdata->core_id, vfd_enc->num);return 0 ;drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_pm.c +4
-4@@ -35,7 +35,7 @@ int mtk_vcodec_init_enc_clk(struct mtk_vcodec_dev *mtkdev)if (!enc_clk->clk_info)return -ENOMEM ; }else { -mtk_v4l2_err ("Failed to get venc clock count" ); +dev_err (pm->dev,"[MTK VCODEC] Failed to get venc clock count" );return -EINVAL ; }@@ -44,13 +44,13 @@ int mtk_vcodec_init_enc_clk(struct mtk_vcodec_dev *mtkdev) ret =of_property_read_string_index (pdev->dev.of_node,"clock-names" , i, &clk_info->clk_name);if (ret) { -mtk_v4l2_err ("venc failed to get clk name %d" , i); +dev_err (pm->dev,"[MTK VCODEC] venc failed to get clk name %d" , i);return ret; } clk_info->vcodec_clk =devm_clk_get (&pdev->dev, clk_info->clk_name);if (IS_ERR (clk_info->vcodec_clk)) { -mtk_v4l2_err ("venc devm_clk_get (%d)%s fail" , i, +dev_err (pm->dev,"[MTK VCODEC] venc devm_clk_get (%d)%s fail" , i, clk_info->clk_name);return PTR_ERR (clk_info->vcodec_clk); }@@ -67,7 +67,7 @@ void mtk_vcodec_enc_clock_on(struct mtk_vcodec_pm *pm)for (i =0 ; i < enc_clk->clk_num; i++) { ret =clk_prepare_enable (enc_clk->clk_info[i].vcodec_clk);if (ret) { -mtk_v4l2_err ("venc clk_prepare_enable %d %s fail %d" , i, +dev_err (pm->dev,"[MTK VCODEC] venc clk_prepare_enable %d %s fail %d" , i, enc_clk->clk_info[i].clk_name, ret); goto clkerr; }drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw.c +1
-1@@ -14,7 +14,7 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_select(void *priv, enum mtk_vcodec_fw_type tcase SCP :return mtk_vcodec_fw_scp_init (priv, fw_use);default : -mtk_v4l2_err ("invalid vcodec fw type" ); +pr_err ("invalid vcodec fw type" );return ERR_PTR (-EINVAL ); } }drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_scp.c +1
-1@@ -63,7 +63,7 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_scp_init(void *priv, enum mtk_vcodec_fw_use plat_dev = dev->plat_dev; scp =scp_get (plat_dev);if (!scp) { -mtk_v4l2_err ("could not get vdec scp handle" ); +dev_err (&dev->plat_dev->dev,"could not get vdec scp handle" );return ERR_PTR (-EPROBE_DEFER ); }drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c +3
-4@@ -56,13 +56,12 @@ static void mtk_vcodec_vpu_reset_handler(void *priv)struct mtk_vcodec_dev *dev = priv;struct mtk_vcodec_ctx *ctx; -mtk_v4l2_err ("Watchdog timeout!!" ); +dev_err (&dev->plat_dev->dev,"Watchdog timeout!!" );mutex_lock (&dev->dev_mutex);list_for_each_entry (ctx, &dev->ctx_list, list) { ctx->state =MTK_STATE_ABORT ; -mtk_v4l2_debug (0 ,"[%d] Change to state MTK_STATE_ABORT" , - ctx->id); +mtk_v4l2_vdec_dbg (0 , ctx,"[%d] Change to state MTK_STATE_ABORT" , ctx->id); }mutex_unlock (&dev->dev_mutex); }@@ -98,7 +97,7 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(void *priv, enum mtk_vcodec_fw_use plat_dev = dev->plat_dev; fw_pdev =vpu_get_plat_device (plat_dev);if (!fw_pdev) { -mtk_v4l2_err ("firmware device is not ready" ); +dev_err (&dev->plat_dev->dev,"firmware device is not ready" );return ERR_PTR (-EINVAL ); }drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c +6
-6@@ -33,14 +33,14 @@ int mtk_vcodec_wait_for_done_ctx(void *priv, int command, unsigned int timeout_mif (!ret) { status =-1 ;/* timeout */ -mtk_v4l2_err ("[%d] cmd=%d, type=%d, dec timeout=%ums (%d %d)" , - ctx_id, command, ctx_type, timeout_ms, - ctx_int_cond[hw_id], ctx_int_type[hw_id]); +dev_err (&ctx->dev->plat_dev->dev,"[%d] cmd=%d, type=%d, dec timeout=%ums (%d %d)" , + ctx_id, command, ctx_type, timeout_ms, + ctx_int_cond[hw_id], ctx_int_type[hw_id]); }else if (-ERESTARTSYS == ret) { status =-1 ; -mtk_v4l2_err ("[%d] cmd=%d, type=%d, dec inter fail (%d %d)" , - ctx_id, command, ctx_type, - ctx_int_cond[hw_id], ctx_int_type[hw_id]); +dev_err (&ctx->dev->plat_dev->dev,"[%d] cmd=%d, type=%d, dec inter fail (%d %d)" , + ctx_id, command, ctx_type, + ctx_int_cond[hw_id], ctx_int_type[hw_id]); } ctx_int_cond[hw_id] =0 ;drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c +14
-16@@ -24,7 +24,7 @@ EXPORT_SYMBOL(mtk_v4l2_dbg_level);void __iomem *mtk_vcodec_get_reg_addr (void __iomem **reg_base,unsigned int reg_idx) {if (reg_idx >=NUM_MAX_VCODEC_REG_BASE ) { -mtk_v4l2_err ("Invalid arguments, reg_idx=%d" , reg_idx); +pr_err ("Invalid arguments, reg_idx=%d" , reg_idx);return NULL ; }return reg_base[reg_idx];@@ -39,15 +39,14 @@ int mtk_vcodec_mem_alloc(void *priv, struct mtk_vcodec_mem *mem) mem->va =dma_alloc_coherent (dev, size, &mem->dma_addr,GFP_KERNEL );if (!mem->va) { -mtk_v4l2_err ("%s dma_alloc size=%ld failed!" ,dev_name (dev), - size); +mtk_v4l2_vdec_err (ctx,"%s dma_alloc size=%ld failed!" ,dev_name (dev), size);return -ENOMEM ; } -mtk_v4l2_debug (3 ,"[%d] - va = %p" , ctx->id, mem->va); -mtk_v4l2_debug (3 ,"[%d] - dma = 0x%lx" , ctx->id, - (unsigned long )mem->dma_addr); -mtk_v4l2_debug (3 ,"[%d] size = 0x%lx" , ctx->id, size); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] - va = %p" , ctx->id, mem->va); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] - dma = 0x%lx" , ctx->id, + (unsigned long )mem->dma_addr); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] size = 0x%lx" , ctx->id, size);return 0 ; }@@ -60,15 +59,14 @@ void mtk_vcodec_mem_free(void *priv, struct mtk_vcodec_mem *mem)struct device *dev = &ctx->dev->plat_dev->dev;if (!mem->va) { -mtk_v4l2_err ("%s dma_free size=%ld failed!" ,dev_name (dev), - size); +mtk_v4l2_vdec_err (ctx,"%s dma_free size=%ld failed!" ,dev_name (dev), size);return ; } -mtk_v4l2_debug (3 ,"[%d] - va = %p" , ctx->id, mem->va); -mtk_v4l2_debug (3 ,"[%d] - dma = 0x%lx" , ctx->id, - (unsigned long )mem->dma_addr); -mtk_v4l2_debug (3 ,"[%d] size = 0x%lx" , ctx->id, size); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] - va = %p" , ctx->id, mem->va); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] - dma = 0x%lx" , ctx->id, + (unsigned long )mem->dma_addr); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] size = 0x%lx" , ctx->id, size);dma_free_coherent (dev, size, mem->va, mem->dma_addr); mem->va =NULL ;@@ -80,7 +78,7 @@ EXPORT_SYMBOL(mtk_vcodec_mem_free);void *mtk_vcodec_get_hw_dev (struct mtk_vcodec_dev *dev,int hw_idx) {if (hw_idx >=MTK_VDEC_HW_MAX || hw_idx <0 || !dev->subdev_dev[hw_idx]) { -mtk_v4l2_err ("hw idx is out of range:%d" , hw_idx); +dev_err (&dev->plat_dev->dev,"hw idx is out of range:%d" , hw_idx);return NULL ; }@@ -98,7 +96,7 @@ void mtk_vcodec_set_curr_ctx(struct mtk_vcodec_dev *vdec_dev,if (vdec_dev->vdec_pdata->is_subdev_supported) { subdev_dev =mtk_vcodec_get_hw_dev (vdec_dev, hw_idx);if (!subdev_dev) { -mtk_v4l2_err ("Failed to get hw dev" ); +dev_err (&vdec_dev->plat_dev->dev,"Failed to get hw dev" );spin_unlock_irqrestore (&vdec_dev->irqlock, flags);return ; }@@ -121,7 +119,7 @@ struct mtk_vcodec_ctx *mtk_vcodec_get_curr_ctx(struct mtk_vcodec_dev *vdec_dev,if (vdec_dev->vdec_pdata->is_subdev_supported) { subdev_dev =mtk_vcodec_get_hw_dev (vdec_dev, hw_idx);if (!subdev_dev) { -mtk_v4l2_err ("Failed to get hw dev" ); +dev_err (&vdec_dev->plat_dev->dev,"Failed to get hw dev" );spin_unlock_irqrestore (&vdec_dev->irqlock, flags);return NULL ; }drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +17
-7@@ -28,8 +28,8 @@ struct mtk_vcodec_dev;#undef pr_fmt#define pr_fmt (fmt) "%s(),%d: " fmt, __func__, __LINE__ -#define mtk_v4l2_err(fmt, args...) \ - pr_err("[MTK_V4L2][ERROR] " fmt "\n", ##args) +#define mtk_v4l2_err(plat_dev, fmt, args...) \ + dev_err(&(plat_dev)->dev, "[MTK_V4L2][ERROR] " fmt "\n", ##args) #define mtk_vcodec_err(inst_id, plat_dev, fmt, args...) \ dev_err(&(plat_dev)->dev, "[MTK_VCODEC][ERROR][%d]: " fmt "\n", inst_id, ##args)@@ -38,11 +38,11 @@ struct mtk_vcodec_dev;extern int mtk_v4l2_dbg_level;extern int mtk_vcodec_dbg; -#define mtk_v4l2_debug(level, fmt, args...) \ - do { \ - if (mtk_v4l2_dbg_level >= (level)) \ - pr_debug("[MTK_V4L2] %s, %d: " fmt "\n", \ - __func__, __LINE__, ##args); \ +#define mtk_v4l2_debug(plat_dev, level, fmt, args...) \ + do { \ + if (mtk_v4l2_dbg_level >= (level)) \ + dev_dbg(&(plat_dev)->dev, "[MTK_V4L2] %s, %d: " fmt "\n", \ + __func__, __LINE__, ##args); \ } while (0) #define mtk_vcodec_debug(inst_id, plat_dev, fmt, args...) \@@ -70,6 +70,16 @@ extern int mtk_vcodec_dbg; #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_mem_alloc (void *priv,struct mtk_vcodec_mem *mem);void mtk_vcodec_mem_free (void *priv,struct mtk_vcodec_mem *mem);drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c +5
-5@@ -861,8 +861,8 @@ static void vdec_av1_slice_decrease_ref_count(struct vdec_av1_slice_slot *slots, frame_info[fb_idx].ref_count--;if (frame_info[fb_idx].ref_count <0 ) { frame_info[fb_idx].ref_count =0 ; -mtk_v4l2_err ("av1_error: %s() fb_idx %d decrease ref_count error\n" , - __func__, fb_idx); +pr_err ("av1_error: %s() fb_idx %d decrease ref_count error\n" , + __func__, fb_idx); }vdec_av1_slice_clear_fb (&frame_info[fb_idx]);@@ -910,7 +910,7 @@ static void vdec_av1_slice_setup_slot(struct vdec_av1_slice_instance *instance, vsi->slot_id =vdec_av1_slice_get_new_slot (vsi);if (vsi->slot_id ==AV1_INVALID_IDX ) { -mtk_v4l2_err ("warning:av1 get invalid index slot\n" ); +mtk_v4l2_vdec_err (instance->ctx,"warning:av1 get invalid index slot\n" ); vsi->slot_id =0 ; } cur_frame_info = &vsi->slots.frame_info[vsi->slot_id];@@ -1504,8 +1504,8 @@ static void vdec_av1_slice_setup_ref(struct vdec_av1_slice_pfc *pfc, slot_id = frame->ref_frame_map[ref_idx]; frame_info = &slots->frame_info[slot_id];if (slot_id ==AV1_INVALID_IDX ) { -mtk_v4l2_err ("cannot match reference[%d] 0x%llx\n" , i, - ctrl_fh->reference_frame_ts[ref_idx]); +pr_err ("cannot match reference[%d] 0x%llx\n" , i, + ctrl_fh->reference_frame_ts[ref_idx]); frame->order_hints[i] =0 ; frame->ref_frame_valid[i] =0 ;continue ;drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c +7
-7@@ -187,7 +187,7 @@ static int alloc_mv_buf(struct vdec_h264_slice_inst *inst,struct mtk_vcodec_mem *mem =NULL ;unsigned int buf_sz =mtk_vdec_h264_get_mv_buf_size (pic->buf_w, pic->buf_h); -mtk_v4l2_debug (3 ,"size = 0x%x" , buf_sz); +mtk_v4l2_vdec_dbg (3 , inst->ctx,"size = 0x%x" , buf_sz);for (i =0 ; i <H264_MAX_MV_NUM ; i++) { mem = &inst->mv_buf[i];if (mem->va)@@ -243,12 +243,12 @@ static void get_pic_info(struct vdec_h264_slice_inst *inst, ctx->last_decoded_picinfo.buf_h != ctx->picinfo.buf_h) inst->vsi_ctx.dec.realloc_mv_buf = true; -mtk_v4l2_debug (1 ,"ResChg: (%d %d) : old(%d, %d) -> new(%d, %d)" , - inst->vsi_ctx.dec.resolution_changed, - inst->vsi_ctx.dec.realloc_mv_buf, - ctx->last_decoded_picinfo.pic_w, - ctx->last_decoded_picinfo.pic_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h); +mtk_v4l2_vdec_dbg (1 , inst->ctx,"ResChg: (%d %d) : old(%d, %d) -> new(%d, %d)" , + inst->vsi_ctx.dec.resolution_changed, + inst->vsi_ctx.dec.realloc_mv_buf, + ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h); } }drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c +8
-8@@ -294,7 +294,7 @@ static void vdec_h264_slice_fill_decode_reflist(struct vdec_h264_slice_inst *insmtk_vdec_h264_fill_dpb_info (inst->ctx, &slice_param->decode_params, slice_param->h264_dpb_info); -mtk_v4l2_debug (3 ,"cur poc = %d\n" , dec_params->bottom_field_order_cnt); +mtk_v4l2_vdec_dbg (3 , inst->ctx,"cur poc = %d\n" , dec_params->bottom_field_order_cnt);/* Build the reference lists */ v4l2_h264_init_reflist_builder (&reflist_builder, dec_params, sps, inst->dpb);@@ -314,7 +314,7 @@ static int vdec_h264_slice_alloc_mv_buf(struct vdec_h264_slice_inst *inst,struct mtk_vcodec_mem *mem;int i, err; -mtk_v4l2_debug (3 ,"size = 0x%x" , buf_sz); +mtk_v4l2_vdec_dbg (3 , inst->ctx,"size = 0x%x" , buf_sz);for (i =0 ; i <H264_MAX_MV_NUM ; i++) { mem = &inst->mv_buf[i];if (mem->va)@@ -372,12 +372,12 @@ static void vdec_h264_slice_get_pic_info(struct vdec_h264_slice_inst *inst) ctx->last_decoded_picinfo.buf_h != ctx->picinfo.buf_h) inst->realloc_mv_buf = true; -mtk_v4l2_debug (1 ,"resChg: (%d %d) : old(%d, %d) -> new(%d, %d)" , - inst->resolution_changed, - inst->realloc_mv_buf, - ctx->last_decoded_picinfo.pic_w, - ctx->last_decoded_picinfo.pic_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h); +mtk_v4l2_vdec_dbg (1 , inst->ctx,"resChg: (%d %d) : old(%d, %d) -> new(%d, %d)" , + inst->resolution_changed, + inst->realloc_mv_buf, + ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h); } }drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c +7
-7@@ -649,7 +649,7 @@ static int vdec_hevc_slice_alloc_mv_buf(struct vdec_hevc_slice_inst *inst,struct mtk_vcodec_mem *mem;int i, err; -mtk_v4l2_debug (3 ,"allocate mv buffer size = 0x%x" , buf_sz); +mtk_v4l2_vdec_dbg (3 , inst->ctx,"allocate mv buffer size = 0x%x" , buf_sz);for (i =0 ; i <HEVC_MAX_MV_NUM ; i++) { mem = &inst->mv_buf[i];if (mem->va)@@ -707,12 +707,12 @@ static void vdec_hevc_slice_get_pic_info(struct vdec_hevc_slice_inst *inst) ctx->last_decoded_picinfo.buf_h != ctx->picinfo.buf_h) inst->realloc_mv_buf = true; -mtk_v4l2_debug (1 ,"resChg: (%d %d) : old(%d, %d) -> new(%d, %d)" , - inst->resolution_changed, - inst->realloc_mv_buf, - ctx->last_decoded_picinfo.pic_w, - ctx->last_decoded_picinfo.pic_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h); +mtk_v4l2_vdec_dbg (1 , inst->ctx,"resChg: (%d %d) : old(%d, %d) -> new(%d, %d)" , + inst->resolution_changed, + inst->realloc_mv_buf, + ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h); } }drivers/media/platform/mediatek/vcodec/vdec_drv_if.c +2
-2@@ -75,7 +75,7 @@ int vdec_if_decode(struct mtk_vcodec_ctx *ctx, struct mtk_vcodec_mem *bs,if (bs) {if ((bs->dma_addr &63 ) !=0 ) { -mtk_v4l2_err ("bs dma_addr should 64 byte align" ); +mtk_v4l2_vdec_err (ctx,"bs dma_addr should 64 byte align" );return -EINVAL ; } }@@ -83,7 +83,7 @@ int vdec_if_decode(struct mtk_vcodec_ctx *ctx, struct mtk_vcodec_mem *bs,if (fb) {if (((fb->base_y.dma_addr &511 ) !=0 ) || ((fb->base_c.dma_addr &511 ) !=0 )) { -mtk_v4l2_err ("frame buffer dma_addr should 512 byte align" ); +mtk_v4l2_vdec_err (ctx,"frame buffer dma_addr should 512 byte align" );return -EINVAL ; } }drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c +25
-27@@ -77,7 +77,7 @@ int vdec_msg_queue_qbuf(struct vdec_msg_queue_ctx *msg_ctx, struct vdec_lat_buf head =vdec_get_buf_list (msg_ctx->hardware_index, buf);if (!head) { -mtk_v4l2_err ("fail to qbuf: %d" , msg_ctx->hardware_index); +mtk_v4l2_vdec_err (buf->ctx,"fail to qbuf: %d" , msg_ctx->hardware_index);return -EINVAL ; }@@ -95,8 +95,8 @@ int vdec_msg_queue_qbuf(struct vdec_msg_queue_ctx *msg_ctx, struct vdec_lat_buf } } -mtk_v4l2_debug (3 ,"enqueue buf type: %d addr: 0x%p num: %d" , - msg_ctx->hardware_index, buf, msg_ctx->ready_num); +mtk_v4l2_vdec_dbg (3 , buf->ctx,"enqueue buf type: %d addr: 0x%p num: %d" , + msg_ctx->hardware_index, buf, msg_ctx->ready_num);spin_unlock (&msg_ctx->ready_lock);return 0 ;@@ -123,8 +123,6 @@ struct vdec_lat_buf *vdec_msg_queue_dqbuf(struct vdec_msg_queue_ctx *msg_ctx)spin_lock (&msg_ctx->ready_lock);if (list_empty (&msg_ctx->ready_queue)) { -mtk_v4l2_debug (3 ,"queue is NULL, type:%d num: %d" , - msg_ctx->hardware_index, msg_ctx->ready_num);spin_unlock (&msg_ctx->ready_lock);if (msg_ctx->hardware_index ==MTK_VDEC_CORE )@@ -146,15 +144,15 @@ struct vdec_lat_buf *vdec_msg_queue_dqbuf(struct vdec_msg_queue_ctx *msg_ctx) head =vdec_get_buf_list (msg_ctx->hardware_index, buf);if (!head) {spin_unlock (&msg_ctx->ready_lock); -mtk_v4l2_err ("fail to dqbuf: %d" , msg_ctx->hardware_index); +mtk_v4l2_vdec_err (buf->ctx,"fail to dqbuf: %d" , msg_ctx->hardware_index);return NULL ; }list_del (head);vdec_msg_queue_dec (&buf->ctx->msg_queue, msg_ctx->hardware_index); msg_ctx->ready_num--; -mtk_v4l2_debug (3 ,"dqueue buf type:%d addr: 0x%p num: %d" , - msg_ctx->hardware_index, buf, msg_ctx->ready_num); +mtk_v4l2_vdec_dbg (3 , buf->ctx,"dqueue buf type:%d addr: 0x%p num: %d" , + msg_ctx->hardware_index, buf, msg_ctx->ready_num);spin_unlock (&msg_ctx->ready_lock);return buf;@@ -164,7 +162,7 @@ void vdec_msg_queue_update_ube_rptr(struct vdec_msg_queue *msg_queue, uint64_t u {spin_lock (&msg_queue->lat_ctx.ready_lock); msg_queue->wdma_rptr_addr = ube_rptr; -mtk_v4l2_debug (3 ,"update ube rprt (0x%llx)" , ube_rptr); +mtk_v4l2_vdec_dbg (3 , msg_queue->ctx,"update ube rprt (0x%llx)" , ube_rptr);spin_unlock (&msg_queue->lat_ctx.ready_lock); }@@ -172,20 +170,19 @@ void vdec_msg_queue_update_ube_wptr(struct vdec_msg_queue *msg_queue, uint64_t u {spin_lock (&msg_queue->lat_ctx.ready_lock); msg_queue->wdma_wptr_addr = ube_wptr; -mtk_v4l2_debug (3 ,"update ube wprt: (0x%llx 0x%llx) offset: 0x%llx" , - msg_queue->wdma_rptr_addr, msg_queue->wdma_wptr_addr, - ube_wptr); +mtk_v4l2_vdec_dbg (3 , msg_queue->ctx,"update ube wprt: (0x%llx 0x%llx) offset: 0x%llx" , + msg_queue->wdma_rptr_addr, msg_queue->wdma_wptr_addr, + ube_wptr);spin_unlock (&msg_queue->lat_ctx.ready_lock); }bool vdec_msg_queue_wait_lat_buf_full (struct vdec_msg_queue *msg_queue) {if (atomic_read (&msg_queue->lat_list_cnt) ==NUM_BUFFER_COUNT ) { -mtk_v4l2_debug (3 ,"wait buf full: list(%d %d) ready_num:%d status:%d" , -atomic_read (&msg_queue->lat_list_cnt), -atomic_read (&msg_queue->core_list_cnt), - msg_queue->lat_ctx.ready_num, - msg_queue->status); +mtk_v4l2_vdec_dbg (3 , msg_queue->ctx,"wait buf full: (%d %d) ready:%d status:%d" , +atomic_read (&msg_queue->lat_list_cnt), +atomic_read (&msg_queue->core_list_cnt), + msg_queue->lat_ctx.ready_num, msg_queue->status);return true; }@@ -193,10 +190,10 @@ bool vdec_msg_queue_wait_lat_buf_full(struct vdec_msg_queue *msg_queue)vdec_msg_queue_qbuf (&msg_queue->core_ctx, &msg_queue->empty_lat_buf);wait_event (msg_queue->core_dec_done, msg_queue->flush_done); -mtk_v4l2_debug (3 ,"flush done => ready_num:%d status:%d list(%d %d)" , - msg_queue->lat_ctx.ready_num, msg_queue->status, -atomic_read (&msg_queue->lat_list_cnt), -atomic_read (&msg_queue->core_list_cnt)); +mtk_v4l2_vdec_dbg (3 , msg_queue->ctx,"flush done => ready_num:%d status:%d list(%d %d)" , + msg_queue->lat_ctx.ready_num, msg_queue->status, +atomic_read (&msg_queue->lat_list_cnt), +atomic_read (&msg_queue->core_list_cnt));return false; }@@ -305,7 +302,7 @@ int vdec_msg_queue_init(struct vdec_msg_queue *msg_queue, ctx->picinfo.buf_h); err =mtk_vcodec_mem_alloc (ctx, &msg_queue->wdma_addr);if (err) { -mtk_v4l2_err ("failed to allocate wdma_addr buf" ); +mtk_v4l2_vdec_err (ctx,"failed to allocate wdma_addr buf" );return -ENOMEM ; } msg_queue->wdma_rptr_addr = msg_queue->wdma_addr.dma_addr;@@ -315,20 +312,21 @@ int vdec_msg_queue_init(struct vdec_msg_queue *msg_queue, msg_queue->empty_lat_buf.core_decode =NULL ; msg_queue->empty_lat_buf.is_last_frame = true; + msg_queue->ctx = ctx;for (i =0 ; i <NUM_BUFFER_COUNT ; i++) { lat_buf = &msg_queue->lat_buf[i]; lat_buf->wdma_err_addr.size =VDEC_ERR_MAP_SZ_AVC ; err =mtk_vcodec_mem_alloc (ctx, &lat_buf->wdma_err_addr);if (err) { -mtk_v4l2_err ("failed to allocate wdma_err_addr buf[%d]" , i); +mtk_v4l2_vdec_err (ctx,"failed to allocate wdma_err_addr buf[%d]" , i); goto mem_alloc_err; } lat_buf->slice_bc_addr.size =VDEC_LAT_SLICE_HEADER_SZ ; err =mtk_vcodec_mem_alloc (ctx, &lat_buf->slice_bc_addr);if (err) { -mtk_v4l2_err ("failed to allocate wdma_addr buf[%d]" , i); +mtk_v4l2_vdec_err (ctx,"failed to allocate wdma_addr buf[%d]" , i); goto mem_alloc_err; }@@ -336,14 +334,14 @@ int vdec_msg_queue_init(struct vdec_msg_queue *msg_queue, lat_buf->rd_mv_addr.size =VDEC_RD_MV_BUFFER_SZ ; err =mtk_vcodec_mem_alloc (ctx, &lat_buf->rd_mv_addr);if (err) { -mtk_v4l2_err ("failed to allocate rd_mv_addr buf[%d]" , i); +mtk_v4l2_vdec_err (ctx,"failed to allocate rd_mv_addr buf[%d]" , i);return -ENOMEM ; } lat_buf->tile_addr.size =VDEC_LAT_TILE_SZ ; err =mtk_vcodec_mem_alloc (ctx, &lat_buf->tile_addr);if (err) { -mtk_v4l2_err ("failed to allocate tile_addr buf[%d]" , i); +mtk_v4l2_vdec_err (ctx,"failed to allocate tile_addr buf[%d]" , i);return -ENOMEM ; } }@@ -359,7 +357,7 @@ int vdec_msg_queue_init(struct vdec_msg_queue *msg_queue, lat_buf->is_last_frame = false; err =vdec_msg_queue_qbuf (&msg_queue->lat_ctx, lat_buf);if (err) { -mtk_v4l2_err ("failed to qbuf buf[%d]" , i); +mtk_v4l2_vdec_err (ctx,"failed to qbuf buf[%d]" , i); goto mem_alloc_err; } }drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h +2
-0@@ -100,6 +100,7 @@ struct vdec_lat_buf {* @empty_lat_buf: the last lat buf used to flush decode * @core_dec_done: core work queue decode done event * @status: current context decode status for core hardware +* @ctx: mtk vcodec context information */ struct vdec_msg_queue {struct vdec_lat_buf lat_buf[NUM_BUFFER_COUNT ];@@ -118,6 +119,7 @@ struct vdec_msg_queue {struct vdec_lat_buf empty_lat_buf;wait_queue_head_t core_dec_done;int status; +struct mtk_vcodec_ctx *ctx; };/** drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c +1
-1@@ -91,7 +91,7 @@ static void vpu_dec_ipi_handler(void *data, unsigned int len, void *priv) (unsigned long )msg->ap_inst_addr;if (!vpu) { -mtk_v4l2_err ("ap_inst_addr is NULL, did the SCP hang or crash?" ); +mtk_v4l2_vdec_err (vpu->ctx,"ap_inst_addr is NULL, did the SCP hang or crash?" );return ; }
Yunfei Dong (董云飞)
maintainerRe: [PATCH v4,06/11] media: mediatek: vcodec: replace pr_* with dev_* for v4l2 debug message
Hi Nicolas,
Thanks for your suggestion.
Quoted 1,367 lines · Nicolas Dufresne
External email : Please do not click links or open attachments until you have verified the sender or the content.
Quoted 2 lines · Yunfei Dong
Adding different macro
mtk_v4l2_vdec_dbgandmtk_v4l2_venc_dbgfor encoder and decoder. Then calling the common marcomtk_v4l2_debugto
Quoted 6 lines
print debug message.
Replace
pr_errwithdev_errfor 'mtk_v4l2_err' debug message. Replacepr_debugwithdev_dbgfor 'mtk_v4l2_debug' debug message.Signed-off-by Yunfei Dong <[email protected]>Quoted 8 lines
--- .../platform/mediatek/vcodec/mtk_vcodec_dec.c | 116 +++++----- .../mediatek/vcodec/mtk_vcodec_dec_drv.c | 53 ++--- .../mediatek/vcodec/mtk_vcodec_dec_hw.c | 7 +- .../mediatek/vcodec/mtk_vcodec_dec_pm.c | 19 +- .../mediatek/vcodec/mtk_vcodec_dec_stateful.c | 143 ++++++------ .../vcodec/mtk_vcodec_dec_stateless.c | 62 ++--- .../platform/mediatek/vcodec/mtk_vcodec_enc.c | 211 ++++++++----------
Quoted 18 lines
.../mediatek/vcodec/mtk_vcodec_enc_drv.c | 45 ++-- .../mediatek/vcodec/mtk_vcodec_enc_pm.c | 8 +- .../platform/mediatek/vcodec/mtk_vcodec_fw.c | 2 +- .../mediatek/vcodec/mtk_vcodec_fw_scp.c | 2 +- .../mediatek/vcodec/mtk_vcodec_fw_vpu.c | 7 +- .../mediatek/vcodec/mtk_vcodec_intr.c | 12 +- .../mediatek/vcodec/mtk_vcodec_util.c | 30 ++- .../mediatek/vcodec/mtk_vcodec_util.h | 24 +- .../vcodec/vdec/vdec_av1_req_lat_if.c | 10 +- .../mediatek/vcodec/vdec/vdec_h264_req_if.c | 14 +- .../vcodec/vdec/vdec_h264_req_multi_if.c | 16 +- .../vcodec/vdec/vdec_hevc_req_multi_if.c | 14 +- .../platform/mediatek/vcodec/vdec_drv_if.c | 4 +- .../platform/mediatek/vcodec/vdec_msg_queue.c | 52 +++-- .../platform/mediatek/vcodec/vdec_msg_queue.h | 2 + .../platform/mediatek/vcodec/vdec_vpu_if.c | 2 +- 23 files changed, 413 insertions(+), 442 deletions(-)Quoted 1 line
diff --git
a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.cb/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.cdrivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_decoder_cmd(struct file *file,
Quoted 4 lines
index
93fcea821001..269f90fe0a1a100644drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +0
-0@@ -82,7 +82,7 @@ static int vidioc_decoder_cmd(struct file *file,void *priv,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_decoder_cmd(struct file
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-1if (ret)return ret; -mtk_v4l2_debug (1 ,"decoder cmd=%u" , cmd->cmd); +mtk_v4l2_vdec_dbg (1 , ctx,"decoder cmd=%u" , cmd->cmd); dst_vq =v4l2_m2m_get_vq (ctx->m2m_ctx,V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE );switch (cmd->cmd) {@@ -90,11 +90,11 @@ static int vidioc_decoder_cmd(struct file*file, void *priv,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_decoder_cmd(struct file *file, void *priv,
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-1src_vq =v4l2_m2m_get_vq (ctx->m2m_ctx,V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE );if (!vb2_is_streaming (src_vq)) { -mtk_v4l2_debug (1 ,"Output stream is off. No need to flush." ); +mtk_v4l2_vdec_dbg(1, ctx, "Output stream is off. No need toflush.");
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_decoder_cmd(struct file *file, void *priv,
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-1return 0 ; }if (!vb2_is_streaming (dst_vq)) { -mtk_v4l2_debug (1 ,"Capture stream is off. No need to flush." ); +mtk_v4l2_vdec_dbg(1, ctx, "Capture stream is off. No need toflush.");
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_qbuf(struct file *file,
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +0
-0return 0 ; }v4l2_m2m_buf_queue (ctx->m2m_ctx, &ctx->empty_flush_buf.vb);@@ -172,8 +172,7 @@ static int vidioc_vdec_qbuf(struct file *file,void *priv,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_qbuf(struct file *file, void *priv,
Quoted 6 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-2struct mtk_vcodec_ctx *ctx =fh_to_ctx (priv);if (ctx->state ==MTK_STATE_ABORT ) { -mtk_v4l2_err ("[%d] Call on QBUF after unrecoverable error" , -ctx->id); +mtk_v4l2_vdec_err(ctx, "[%d] Call on QBUF after unrecoverableerror",
ctx->id);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_dqbuf(struct file *file,
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +0
-0return -EIO ; }@@ -186,8 +185,7 @@ static int vidioc_vdec_dqbuf(struct file *file,void *priv,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_dqbuf(struct file *file, void *priv,
Quoted 6 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-2struct mtk_vcodec_ctx *ctx =fh_to_ctx (priv);if (ctx->state ==MTK_STATE_ABORT ) { -mtk_v4l2_err ("[%d] Call on DQBUF after unrecoverable error" , -ctx->id); +mtk_v4l2_vdec_err(ctx, "[%d] Call on DQBUF after unrecoverableerror",
ctx->id);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_try_fmt(struct
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +0
-0return -EIO ; }@@ -288,11 +286,10 @@ static int vidioc_try_fmt(struct
mtk_vcodec_ctx*ctx, structv4l2_format*f,drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_try_fmt(struct mtk_vcodec_ctx *ctx, struct v4l2_format *f,
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +0
-2(pix_fmt_mp->height + 64) <= frmsize->max_height) pix_fmt_mp->height += 64; -mtk_v4l2_debug(0, -"before resize width=%d, height=%d, after resize width=%d,height=%d, sizeimage=%d",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_try_fmt_vid_out_mplane(struct
Quoted 11 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +4
-3-tmp_w, tmp_h, pix_fmt_mp->width, -pix_fmt_mp->height, -pix_fmt_mp->width * pix_fmt_mp->height); +mtk_v4l2_vdec_dbg (0 , ctx, +"before resize wxh=%dx%d, after resize wxh=%dx%d, sizeimage=%d" , + tmp_w, tmp_h, pix_fmt_mp->width, pix_fmt_mp->height, + pix_fmt_mp->width * pix_fmt_mp->height); pix_fmt_mp->num_planes = fmt->num_planes; pix_fmt_mp->plane_fmt[0].sizeimage =@@ -344,7 +341,7 @@ static int vidioc_try_fmt_vid_out_mplane(structfile *file, void *priv,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_try_fmt_vid_out_mplane(struct file *file, void *priv,
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-1}if (pix_fmt_mp->plane_fmt[0 ].sizeimage ==0 ) { -mtk_v4l2_err ("sizeimage of output format must be given" ); +mtk_v4l2_vdec_err(ctx, "sizeimage of output format must begiven");
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_s_fmt(struct file *file,
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +0
-0return -EINVAL ; }@@ -432,7 +429,7 @@ static int vidioc_vdec_s_fmt(struct file *file,void *priv,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_s_fmt(struct file *file,
Quoted 10 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-1const struct mtk_video_fmt *fmt;const struct mtk_vcodec_dec_pdata *dec_pdata = ctx->dev- vdec_pdata; -mtk_v4l2_debug (3 ,"[%d]" , ctx->id); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d]" , ctx->id); q_data =mtk_vdec_get_q_data (ctx, f->type);if (!q_data)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +0
-0@@ -446,7 +443,7 @@ static int vidioc_vdec_s_fmt(struct file *file,void *priv,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_s_fmt(struct file *file,
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-1if (!dec_pdata->uses_stateless_api && f->type ==V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE &&vb2_is_busy (&ctx->m2m_ctx->out_q_ctx.q)) { -mtk_v4l2_err ("out_q_ctx buffers already requested" ); +mtk_v4l2_vdec_err (ctx,"out_q_ctx buffers already requested" ); ret = -EBUSY ; }@@ -456,7 +453,7 @@ static int vidioc_vdec_s_fmt(struct file *file,void *priv,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_s_fmt(struct file *file,
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-1*/ if ((f->type ==V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ) &&vb2_is_busy (&ctx->m2m_ctx->cap_q_ctx.q)) { -mtk_v4l2_err ("cap_q_ctx buffers already requested" ); +mtk_v4l2_vdec_err (ctx,"cap_q_ctx buffers already requested" ); ret = -EBUSY ; }@@ -491,8 +488,8 @@ static int vidioc_vdec_s_fmt(struct file *file,void *priv,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_s_fmt(struct file *file,
Quoted 11 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +2
-2if (ctx->state ==MTK_STATE_FREE ) { ret =vdec_if_init (ctx, q_data->fmt->fourcc);if (ret) { -mtk_v4l2_err ("[%d]: vdec_if_init() fail ret=%d" , -ctx->id, ret); +mtk_v4l2_vdec_err (ctx,"[%d]: vdec_if_init() fail ret=%d" , + ctx->id, ret);return -EINVAL ; } ctx->state =MTK_STATE_INIT ;@@ -515,8 +512,8 @@ static int vidioc_vdec_s_fmt(struct file *file,void *priv,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_s_fmt(struct file *file, void *priv,
Quoted 6 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-2*/ ret =vdec_if_get_param (ctx,GET_PARAM_PIC_INFO , &ctx->picinfo);if (ret) { -mtk_v4l2_err ("[%d]Error!! Get GET_PARAM_PICTURE_INFO Fail" , - ctx->id); +mtk_v4l2_vdec_err(ctx, "[%d]Error!! Get GET_PARAM_PICTURE_INFOFail",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_s_fmt(struct file
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-0+ ctx->id); } ctx->last_decoded_picinfo = ctx->picinfo;@@ -540,11 +537,13 @@ static int vidioc_vdec_s_fmt(struct file*file, void *priv,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_s_fmt(struct file *file, void *priv,
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +0
-1ctx->q_data[MTK_Q_DATA_DST ].coded_width = ctx->picinfo.buf_w; ctx->q_data[MTK_Q_DATA_DST ].coded_height = ctx->picinfo.buf_h; -mtk_v4l2_debug(2, "[%d] vdec_if_init() num_plane = %d wxh=%dx%dpic wxh=%dx%d sz[0]=0x%x sz[1]=0x%x",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_enum_framesizes(struct file
Quoted 16 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +7
-4- ctx->id, pix_mp->num_planes, ctx->picinfo.buf_w, ctx- picinfo.buf_h, - ctx->picinfo.pic_w, ctx->picinfo.pic_h, - ctx->q_data[MTK_Q_DATA_DST ].sizeimage[0 ], - ctx->q_data[MTK_Q_DATA_DST].sizeimage[1]); +mtk_v4l2_vdec_dbg (2 , ctx, +"[%d] init() plane:%d wxh=%dx%d pic wxh=%dx%d sz=0x%x_0x%x" , + ctx->id, pix_mp->num_planes, + ctx->picinfo.buf_w, ctx->picinfo.buf_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h, + ctx->q_data[MTK_Q_DATA_DST ].sizeimage[0 ], + ctx->q_data[MTK_Q_DATA_DST ].sizeimage[1 ]); }return 0 ; }@@ -570,14 +569,11 @@ static int vidioc_enum_framesizes(struct file*file, void *priv,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_g_fmt(struct file *file,
Quoted 20 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +5
-8fsize->type =V4L2_FRMSIZE_TYPE_STEPWISE ; fsize->stepwise = dec_pdata->vdec_formats[i].frmsize; -mtk_v4l2_debug (1 ,"%x, %d %d %d %d %d %d" , -ctx->dev->dec_capability, -fsize->stepwise.min_width, -fsize->stepwise.max_width, -fsize->stepwise.step_width, -fsize->stepwise.min_height, -fsize->stepwise.max_height, -fsize->stepwise.step_height); +mtk_v4l2_vdec_dbg (1 , ctx,"%x, %d %d %d %d %d %d" , + ctx->dev->dec_capability, fsize->stepwise.min_width, + fsize->stepwise.max_width, fsize->stepwise.step_width, + fsize->stepwise.min_height, fsize->stepwise.max_height, + fsize->stepwise.step_height);return 0 ; }@@ -641,7 +637,7 @@ static int vidioc_vdec_g_fmt(struct file *file,void *priv,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_g_fmt(struct file *file,
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-1vq =v4l2_m2m_get_vq (ctx->m2m_ctx, f->type);if (!vq) { -mtk_v4l2_err ("no vb2 queue for type=%d" , f->type); +mtk_v4l2_vdec_err (ctx,"no vb2 queue for type=%d" , f->type);return -EINVAL ; }@@ -712,8 +708,8 @@ static int vidioc_vdec_g_fmt(struct file *file,void *priv,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_g_fmt(struct file *file, void *priv,
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +0
-1pix_mp->plane_fmt[1 ].bytesperline = q_data->bytesperline[1 ]; pix_mp->plane_fmt[1 ].sizeimage = q_data->sizeimage[1 ]; -mtk_v4l2_debug(1, "[%d] type=%d state=%d Format information couldnot be read, not ready yet!",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int vidioc_vdec_g_fmt(struct file *file, · line 711
Quoted 2 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-1-ctx->id, f->type, ctx->state); +mtk_v4l2_vdec_dbg(1, ctx, "[%d] type=%d state=%d Formatinformation not ready!",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c int vb2ops_vdec_queue_setup(struct vb2_queue
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-0+ ctx->id, f->type, ctx->state); }return 0 ;@@ -730,7 +726,7 @@ int vb2ops_vdec_queue_setup(struct vb2_queue*vq, unsigned int *nbuffers,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c int vb2ops_vdec_queue_setup(struct vb2_queue
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-1q_data =mtk_vdec_get_q_data (ctx, vq->type);if (q_data ==NULL ) { -mtk_v4l2_err ("vq->type=%d err\n" , vq->type); +mtk_v4l2_vdec_err (ctx,"vq->type=%d err\n" , vq->type);return -EINVAL ; }@@ -756,10 +752,9 @@ int vb2ops_vdec_queue_setup(struct vb2_queue*vq, unsigned int *nbuffers,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c int vb2ops_vdec_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +0
-2sizes[i] = q_data->sizeimage[i]; } -mtk_v4l2_debug(1, -"[%d]\t type = %d, get %d plane(s), %d buffer(s) of size 0x%x 0x%x",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c int vb2ops_vdec_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +2
-2-ctx->id, vq->type, *nplanes, *nbuffers, -sizes[0], sizes[1]); +mtk_v4l2_vdec_dbg(1, ctx, + "[%d]\t type = %d, get %d plane(s), %d buffer(s) of size 0x%x0x%x ",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c int vb2ops_vdec_buf_prepare(struct vb2_buffer
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-0+ ctx->id, vq->type, *nplanes, *nbuffers, sizes[0], sizes[1]);return 0 ; }@@ -770,16 +765,15 @@ int vb2ops_vdec_buf_prepare(struct vb2_buffer*vb)
Quoted 6 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-2struct mtk_q_data *q_data;int i; -mtk_v4l2_debug (3 ,"[%d] (%d) id=%d" , -ctx->id, vb->vb2_queue->type, vb->index); +mtk_v4l2_vdec_dbg(3, ctx, "[%d] (%d) id=%d",drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c int vb2ops_vdec_buf_prepare(struct vb2_buffer *vb)
Quoted 10 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +2
-3+ ctx->id, vb->vb2_queue->type, vb->index); q_data =mtk_vdec_get_q_data (ctx, vb->vb2_queue->type);for (i =0 ; i < q_data->fmt->num_planes; i++) {if (vb2_plane_size (vb, i) < q_data->sizeimage[i]) { -mtk_v4l2_err ("data will not fit into plane %d (%lu < %d)" , -i,vb2_plane_size (vb, i), -q_data->sizeimage[i]); +mtk_v4l2_vdec_err(ctx, "data will not fit into plane %d (%lu <%d)",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c void vb2ops_vdec_buf_finish(struct vb2_buffer
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-0+ i, vb2_plane_size(vb, i), q_data->sizeimage[i]);return -EINVAL ; }if (!V4L2_TYPE_IS_OUTPUT (vb->type))@@ -807,7 +801,7 @@ void vb2ops_vdec_buf_finish(struct vb2_buffer*vb)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c void vb2ops_vdec_stop_streaming(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-1mutex_unlock (&ctx->lock);if (buf_error) { -mtk_v4l2_err ("Unrecoverable error on buffer." ); +mtk_v4l2_vdec_err (ctx,"Unrecoverable error on buffer." ); ctx->state =MTK_STATE_ABORT ; } }@@ -843,8 +837,8 @@ void vb2ops_vdec_stop_streaming(struct
vb2_queue*q)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c void vb2ops_vdec_stop_streaming(struct
Quoted 13 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +2
-2struct mtk_vcodec_ctx *ctx =vb2_get_drv_priv (q);int ret; -mtk_v4l2_debug (3 ,"[%d] (%d) state=(%x) ctx- decoded_frame_cnt=%d", -ctx->id, q->type, ctx->state, ctx->decoded_frame_cnt); +mtk_v4l2_vdec_dbg(3 , ctx,"[%d] (%d) state=(%x) ctx- decoded_frame_cnt=%d", + ctx->id, q->type, ctx->state, ctx->decoded_frame_cnt);if (
q->type==V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) { while ((src_buf=v4l2_m2m_src_buf_remove(ctx->m2m_ctx))) {drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +0
-0@@ -870,17 +864,17 @@ void vb2ops_vdec_stop_streaming(struct
vb2_queue*q)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c static int m2mops_vdec_job_ready(void
Quoted 26 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +8
-8*/ ctx->picinfo = ctx->last_decoded_picinfo; -mtk_v4l2_debug (2 , -"[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)" , -ctx->id, ctx->last_decoded_picinfo.pic_w, -ctx->last_decoded_picinfo.pic_h, -ctx->picinfo.pic_w, ctx->picinfo.pic_h, -ctx->last_decoded_picinfo.buf_w, -ctx->last_decoded_picinfo.buf_h); +mtk_v4l2_vdec_dbg (2 , ctx, +"[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)" , + ctx->id, ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, + ctx->picinfo.pic_w, ctx->picinfo.pic_h, + ctx->last_decoded_picinfo.buf_w, + ctx->last_decoded_picinfo.buf_h); ret = ctx->dev->vdec_pdata->flush_decoder (ctx);if (ret) -mtk_v4l2_err ("DecodeFinal failed, ret=%d" , ret); +mtk_v4l2_vdec_err (ctx,"DecodeFinal failed, ret=%d" , ret); } ctx->state =MTK_STATE_FLUSH ;@@ -905,7 +899,7 @@ static int m2mops_vdec_job_ready(void
*m2m_priv)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c int mtk_vcodec_dec_queue_init(void *priv,
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-1{struct mtk_vcodec_ctx *ctx = m2m_priv; -mtk_v4l2_debug (3 ,"[%d]" , ctx->id); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d]" , ctx->id);if (ctx->state ==MTK_STATE_ABORT )return 0 ;@@ -973,7 +967,7 @@ int mtk_vcodec_dec_queue_init(void *priv,struct
vb2_queue*src_vq,drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c int mtk_vcodec_dec_queue_init(void *priv,
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-1struct mtk_vcodec_ctx *ctx = priv;int ret =0 ; -mtk_v4l2_debug (3 ,"[%d]" , ctx->id); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d]" , ctx->id); src_vq->type=V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE ; src_vq->io_modes=VB2_DMABUF |VB2_MMAP ;@@ -988,7 +982,7 @@ int mtk_vcodec_dec_queue_init(void *priv,struct
vb2_queue*src_vq,drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue *src_vq,
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-1ret =vb2_queue_init (src_vq);if (ret) { -mtk_v4l2_err ("Failed to initialize videobuf2 queue(output)" ); +mtk_v4l2_vdec_err(ctx, "Failed to initialize videobuf2queue(output)");
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c int mtk_vcodec_dec_queue_init(void *priv,
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +0
-0return ret; } dst_vq->type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ;@@ -1004,7 +998,7 @@ int mtk_vcodec_dec_queue_init(void *priv,struct
vb2_queue*src_vq,drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c int mtk_vcodec_dec_queue_init(void *priv, struct vb2_queue *src_vq,
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +1
-1ret =vb2_queue_init (dst_vq);if (ret) -mtk_v4l2_err ("Failed to initialize videobuf2 queue(capture)" ); +mtk_v4l2_vdec_err(ctx, "Failed to initialize videobuf2queue(capture)");
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +0
-0return ret; }diff --git
a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.cb/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.cdrivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c line 28
Quoted 9 lines
index
03721eda2769..4469c2411f40100644drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +1
-1@@ -25,7 +25,7 @@#include "mtk_vcodec_util.h" #include "mtk_vcodec_fw.h" -static int mtk_vcodec_get_hw_count (struct mtk_vcodec_dev *dev) +static int mtk_vcodec_get_hw_count(struct mtk_vcodec_ctx *ctx,struct
mtk_vcodec_dev*dev)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static int mtk_vcodec_get_hw_count(struct
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +0
-0{switch (dev->vdec_pdata->hw_arch) {case MTK_VDEC_PURE_SINGLE_CORE :@@ -33,7 +33,7 @@ static int mtk_vcodec_get_hw_count(struct
mtk_vcodec_dev*dev)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static irqreturn_t mtk_vcodec_dec_irq_handler(int
Quoted 11 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +1
-1case MTK_VDEC_LAT_SINGLE_CORE :return MTK_VDEC_ONE_LAT_ONE_CORE ;default : -mtk_v4l2_err ("hw arch %d not supported" , dev->vdec_pdata- hw_arch); +mtk_v4l2_vdec_err (ctx,"hw arch %d not supported" , dev- vdec_pdata->hw_arch);return MTK_VDEC_NO_HW ;}
}drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +0
-0@@ -52,8 +52,7 @@ static irqreturn_t mtk_vcodec_dec_irq_handler(intirq, void *priv)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static irqreturn_t mtk_vcodec_dec_irq_handler(int irq, void *priv)
Quoted 6 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +1
-2/* check if HW active or not */ cg_status =readl (dev->reg_base[0 ]);if ((cg_status &VDEC_HW_ACTIVE ) !=0 ) { -mtk_v4l2_err ("DEC ISR, VDEC active is not 0x0 (0x%08x)" , - cg_status); +mtk_v4l2_vdec_err(ctx, "DEC ISR, VDEC active is not 0x0 (0x%08x)",
cg_status);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static irqreturn_t mtk_vcodec_dec_irq_handler(int
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +0
-0return IRQ_HANDLED ; }@@ -71,9 +70,7 @@ static irqreturn_t mtk_vcodec_dec_irq_handler(intirq, void *priv)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static irqreturn_t mtk_vcodec_dec_irq_handler(int irq, void *priv)
Quoted 7 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +1
-3wake_up_ctx (ctx,MTK_INST_IRQ_RECEIVED ,0 ); -mtk_v4l2_debug (3 , -"mtk_vcodec_dec_irq_handler :wake up ctx %d, dec_done_status=%x" , -ctx->id, dec_done_status); +mtk_v4l2_vdec_dbg(3, ctx, "wake up ctx %d, dec_done_status=%x",
ctx->id,dec_done_status);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static int mtk_vcodec_get_reg_bases(struct
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +0
-0return IRQ_HANDLED ; }@@ -96,7 +93,7 @@ static int mtk_vcodec_get_reg_bases(struct
mtk_vcodec_dev*dev)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static int fops_vcodec_open(struct file
Quoted 18 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +2
-2if (IS_ERR (dev->reg_base[i]))return PTR_ERR (dev->reg_base[i]); -mtk_v4l2_debug (2 ,"reg[%d] base=%p" , i, dev->reg_base[i]); +dev_dbg (&pdev->dev,"reg[%d] base=%p" , i, dev->reg_base[i]); }return 0 ;@@ -156,7 +153,7 @@ static int fops_vcodec_open(struct file *file)INIT_LIST_HEAD (&ctx->list); ctx->dev = dev;if (ctx->dev->vdec_pdata->is_subdev_supported) { -hw_count =mtk_vcodec_get_hw_count (dev); +hw_count =mtk_vcodec_get_hw_count (ctx, dev);if (!hw_count || !dev->subdev_prob_done) { ret = -EINVAL ; goto err_ctrls_setup;@@ -176,15 +173,14 @@ static int fops_vcodec_open(struct file*file)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static int fops_vcodec_open(struct file
Quoted 18 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +2
-3ctx->type =MTK_INST_DECODER ; ret = dev->vdec_pdata->ctrls_setup (ctx);if (ret) { -mtk_v4l2_err ("Failed to setup mt vcodec controls" ); +mtk_v4l2_vdec_err (ctx,"Failed to setup mt vcodec controls" ); goto err_ctrls_setup; } ctx->m2m_ctx =v4l2_m2m_ctx_init (dev->m2m_dev_dec, ctx, &mtk_vcodec_dec_queue_init);if (IS_ERR ((__force void *)ctx->m2m_ctx)) { ret =PTR_ERR ((__force void *)ctx->m2m_ctx); -mtk_v4l2_err ("Failed to v4l2_m2m_ctx_init() (%d)" , -ret); +mtk_v4l2_vdec_err (ctx,"Failed to v4l2_m2m_ctx_init() (%d)" , ret); goto err_m2m_ctx_init; } src_vq = v4l2_m2m_get_vq(ctx->m2m_ctx,@@ -202,14 +198,14 @@ static int fops_vcodec_open(struct file*file)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static int fops_vcodec_release(struct file
Quoted 30 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +2
-2* Return 0 if downloading firmware successfully, * otherwise it is failed */ -mtk_v4l2_err ("failed to load firmware!" ); +mtk_v4l2_vdec_err (ctx,"failed to load firmware!" ); goto err_load_fw; } dev->dec_capability =mtk_vcodec_fw_get_vdec_capa (dev->fw_handler); -mtk_v4l2_debug (0 ,"decoder capability %x" , dev->dec_capability); +mtk_v4l2_vdec_dbg (0 , ctx,"decoder capability %x" , dev- dec_capability); }
ctx->dev->vdec_pdata->init_vdec_params(ctx);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +1
-2@@ -218,8 +214,7 @@ static int fops_vcodec_open(struct file *file)mtk_vcodec_dbgfs_create (ctx);mutex_unlock (&dev->dev_mutex); -mtk_v4l2_debug (0 ,"%s decoder [%d]" ,dev_name (&dev->plat_dev- dev), -ctx->id); +mtk_v4l2_vdec_dbg (0 , ctx,"%s decoder [%d]" ,dev_name (&dev- plat_dev->dev), ctx->id);return ret;/* Deinit when failure occurred */
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +0
-0@@ -241,7 +236,7 @@ static int fops_vcodec_release(struct file*file)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static int mtk_vcodec_probe(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +1
-1struct mtk_vcodec_dev *dev =video_drvdata (file);struct mtk_vcodec_ctx *ctx =fh_to_ctx (file->private_data); -mtk_v4l2_debug (0 ,"[%d] decoder" , ctx->id); +mtk_v4l2_vdec_dbg (0 , ctx,"[%d] decoder" , ctx->id);mutex_lock (&dev->dev_mutex);/* @@ -296,7 +291,7 @@ static int mtk_vcodec_probe(struct
platform_device*pdev)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static int mtk_vcodec_probe(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +1
-1&rproc_phandle)) { fw_type = SCP; } else { -mtk_v4l2_err ("Could not get vdec IPI device" ); +dev_dbg (&pdev->dev,"Could not get vdec IPI device" );return -ENODEV ; }dma_set_max_seg_size (&pdev->dev,UINT_MAX );@@ -316,7 +311,7 @@ static int mtk_vcodec_probe(struct
platform_device*pdev)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static int mtk_vcodec_probe(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +1
-1alloc_ordered_workqueue ("core-decoder" ,WQ_MEM_RECLAIM |WQ_FREEZABLE );if (!dev->core_workqueue) { -mtk_v4l2_err ("Failed to create core workqueue" ); +dev_dbg (&pdev->dev,"Failed to create core workqueue" ); ret = -EINVAL ; goto err_res; }@@ -332,13 +327,13 @@ static int mtk_vcodec_probe(struct
platform_device*pdev)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static int mtk_vcodec_probe(struct
Quoted 16 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +2
-2ret =v4l2_device_register (&pdev->dev, &dev->v4l2_dev);if (ret) { -mtk_v4l2_err ("v4l2_device_register err=%d" , ret); +dev_err (&pdev->dev,"v4l2_device_register err=%d" , ret); goto err_core_workq; } vfd_dec =video_device_alloc ();if (!vfd_dec) { -mtk_v4l2_err ("Failed to allocate video device" ); +dev_err (&pdev->dev,"Failed to allocate video device" ); ret = -ENOMEM ; goto err_dec_alloc; }@@ -359,7 +354,7 @@ static int mtk_vcodec_probe(struct
platform_device*pdev)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static int mtk_vcodec_probe(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +1
-1dev->m2m_dev_dec =v4l2_m2m_init (&mtk_vdec_m2m_ops);if (IS_ERR ((__force void *)dev->m2m_dev_dec)) { -mtk_v4l2_err ("Failed to init mem2mem dec device" ); +dev_err (&pdev->dev,"Failed to init mem2mem dec device" ); ret =PTR_ERR ((__force void *)dev->m2m_dev_dec); goto err_dec_alloc; }@@ -368,7 +363,7 @@ static int mtk_vcodec_probe(struct
platform_device*pdev)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static int mtk_vcodec_probe(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +1
-1alloc_ordered_workqueue (MTK_VCODEC_DEC_NAME ,WQ_MEM_RECLAIM |WQ_FREEZABLE );if (!dev->decode_workqueue) { -mtk_v4l2_err ("Failed to create decode workqueue" ); +dev_err (&pdev->dev,"Failed to create decode workqueue" ); ret = -EINVAL ; goto err_event_workq; }@@ -377,7 +372,7 @@ static int mtk_vcodec_probe(struct
platform_device*pdev)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static int mtk_vcodec_probe(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +1
-1ret =of_platform_populate (pdev->dev.of_node,NULL ,NULL , &pdev->dev);if (ret) { -mtk_v4l2_err ("Main device of_platform_populate failed." ); +dev_err (&pdev->dev,"Main device of_platform_populate failed." ); goto err_reg_cont; } }else {@@ -390,7 +385,7 @@ static int mtk_vcodec_probe(struct
platform_device*pdev)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c static int mtk_vcodec_probe(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +1
-1ret =video_register_device (vfd_dec,VFL_TYPE_VIDEO ,-1 );if (ret) { -mtk_v4l2_err ("Failed to register video device" ); +dev_err (&pdev->dev,"Failed to register video device" ); goto err_reg_cont; }@@ -409,21 +404,21 @@ static int mtk_vcodec_probe(struct
platform_device*pdev)Quoted 28 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +3
-4ret =v4l2_m2m_register_media_controller (dev->m2m_dev_dec, dev- vfd_dec,MEDIA_ENT_F_PROC_VIDEO_DECODER );if (ret) { -mtk_v4l2_err ("Failed to register media controller" ); +dev_err (&pdev->dev,"Failed to register media controller" ); goto err_dec_mem_init; } ret =media_device_register (&dev->mdev_dec);if (ret) { -mtk_v4l2_err ("Failed to register media device" ); +dev_err (&pdev->dev,"Failed to register media device" ); goto err_media_reg; } -mtk_v4l2_debug (0 ,"media registered as /dev/media%d" , vfd_dec- minor); +dev_dbg (&pdev->dev,"media registered as /dev/media%d" , vfd_dec- minor); }mtk_vcodec_dbgfs_init (dev, false); -mtk_v4l2_debug(0, "decoder registered as /dev/video%d", vfd_dec-minor);
+dev_dbg(&pdev->dev, "decoder registered as /dev/video%d", vfd_dec- minor);Quoted 3 lines
return 0;
diff --git
a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.cb/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.cdrivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c static irqreturn_t mtk_vdec_hw_irq_handler(int
Quoted 4 lines
index
e1cb2f8dca33..7c4d8ec201e3100644drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c +0
-0@@ -77,8 +77,7 @@ static irqreturn_t mtk_vdec_hw_irq_handler(intirq, void *priv)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c static irqreturn_t mtk_vdec_hw_irq_handler(int irq, void *priv)
Quoted 6 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c +1
-2/* check if HW active or not */ cg_status =readl (dev->reg_base[VDEC_HW_SYS ]);if (cg_status &VDEC_HW_ACTIVE ) { -mtk_v4l2_err ("vdec active is not 0x0 (0x%08x)" , - cg_status); +mtk_v4l2_vdec_err(ctx, "vdec active is not 0x0 (0x%08x)",
cg_status);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c static irqreturn_t mtk_vdec_hw_irq_handler(int
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c +0
-0return IRQ_HANDLED ; }@@ -93,8 +92,8 @@ static irqreturn_t mtk_vdec_hw_irq_handler(intirq, void *priv)
Quoted 11 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c +2
-2wake_up_ctx (ctx,MTK_INST_IRQ_RECEIVED , dev->hw_idx); -mtk_v4l2_debug (3 ,"wake up ctx %d, dec_done_status=%x" , - ctx->id, dec_done_status); +mtk_v4l2_vdec_dbg (3 , ctx,"wake up ctx %d, dec_done_status=%x" , + ctx->id, dec_done_status);return IRQ_HANDLED ; }diff --git
a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.cb/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.cdrivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c int mtk_vcodec_init_dec_clk(struct
Quoted 4 lines
index
777d445999e9..3ab996705b97100644drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-0@@ -32,7 +32,7 @@ int mtk_vcodec_init_dec_clk(struct
platform_device*pdev, structmtk_vcodec_pm*drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c int mtk_vcodec_init_dec_clk(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1if (!dec_clk->clk_info)return -ENOMEM ; }else { -mtk_v4l2_err ("Failed to get vdec clock count" ); +dev_err (&pdev->dev,"Failed to get vdec clock count" );return -EINVAL ; }@@ -41,14 +41,13 @@ int mtk_vcodec_init_dec_clk(struct
platform_device*pdev, structmtk_vcodec_pm*drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static int mtk_vcodec_dec_pw_on(struct
Quoted 18 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-3ret =of_property_read_string_index (pdev->dev.of_node,"clock-names" , i, &clk_info->clk_name);if (ret) { -mtk_v4l2_err ("Failed to get clock name id = %d" , i); +dev_err (&pdev->dev,"Failed to get clock name id = %d" , i);return ret; } clk_info->vcodec_clk =devm_clk_get (&pdev->dev, clk_info->clk_name);if (IS_ERR (clk_info->vcodec_clk)) { -mtk_v4l2_err ("devm_clk_get (%d)%s fail" , i, -clk_info->clk_name); +dev_err (&pdev->dev,"devm_clk_get (%d)%s fail" , i, clk_info- clk_name);return PTR_ERR (clk_info->vcodec_clk); }}
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-0@@ -63,7 +62,7 @@ static int mtk_vcodec_dec_pw_on(struct
mtk_vcodec_pm*pm)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vcodec_dec_pw_off(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1ret =pm_runtime_resume_and_get (pm->dev);if (ret) -mtk_v4l2_err ("pm_runtime_resume_and_get fail %d" , ret); +dev_err (pm->dev,"pm_runtime_resume_and_get fail %d" , ret);return ret; }@@ -74,7 +73,7 @@ static void mtk_vcodec_dec_pw_off(struct
mtk_vcodec_pm*pm)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vcodec_dec_clock_on(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1ret =pm_runtime_put (pm->dev);if (ret && ret != -EAGAIN ) -mtk_v4l2_err ("pm_runtime_put fail %d" , ret); +dev_err (pm->dev,"pm_runtime_put fail %d" , ret); }static void mtk_vcodec_dec_clock_on (struct mtk_vcodec_pm *pm)@@ -86,7 +85,7 @@ static void mtk_vcodec_dec_clock_on(struct
mtk_vcodec_pm*pm)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vcodec_dec_enable_irq(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1for (i =0 ; i < dec_clk->clk_num; i++) { ret =clk_prepare_enable (dec_clk->clk_info[i].vcodec_clk);if (ret) { -mtk_v4l2_err ("clk_prepare_enable %d %s fail %d" , i, +dev_err (pm->dev,"clk_prepare_enable %d %s fail %d" , i, dec_clk->clk_info[i].clk_name, ret); goto error; }@@ -120,7 +119,7 @@ static void mtk_vcodec_dec_enable_irq(struct
mtk_vcodec_dev*vdec_dev, inthw_iddrivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vcodec_dec_disable_irq(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1if (subdev_dev)enable_irq (subdev_dev->dec_irq);else -mtk_v4l2_err ("Failed to get hw dev\n" ); +dev_err (&vdec_dev->plat_dev->dev,"Failed to get hw dev\n" ); }else {enable_irq (vdec_dev->dec_irq); }@@ -138,7 +137,7 @@ static void mtk_vcodec_dec_disable_irq(struct
mtk_vcodec_dev*vdec_dev, inthw_idrivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static struct mtk_vcodec_pm
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1if (subdev_dev)disable_irq (subdev_dev->dec_irq);else -mtk_v4l2_err ("Failed to get hw dev\n" ); +dev_err (&vdec_dev->plat_dev->dev,"Failed to get hw dev\n" ); }else {disable_irq (vdec_dev->dec_irq); }@@ -185,7 +184,7 @@ static struct mtk_vcodec_pm*mtk_vcodec_dec_get_pm(struct
mtk_vcodec_dev*vdec_dQuoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1if (subdev_dev)return &subdev_dev->pm; -mtk_v4l2_err ("Failed to get hw dev\n" ); +dev_err (&vdec_dev->plat_dev->dev,"Failed to get hw dev\n" );return NULL ; }diff --git
a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.cb/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.cQuoted 2 lines
index
0fbd030026c7..3c289b08bc87100644
---
a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.cQuoted 1 line
+++
b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.cdrivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static struct vb2_buffer
Quoted 1 line
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-0@@ -61,15 +61,16 @@ static struct vb2_buffer*get_display_buffer(struct
mtk_vcodec_ctx*ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static struct vb2_buffer · line 67
Quoted 8 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-2struct mtk_video_dec_buf *dstbuf;struct vb2_v4l2_buffer *vb; -mtk_v4l2_debug (3 ,"[%d]" , ctx->id); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d]" , ctx->id);if (vdec_if_get_param (ctx,GET_PARAM_DISP_FRAME_BUFFER , &disp_frame_buffer)) { -mtk_v4l2_err("[%d]Cannot get param : GET_PARAM_DISP_FRAME_BUFFER",
ctx->id);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static struct vb2_buffer · line 67
Quoted 1 line
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-0+mtk_v4l2_vdec_err(ctx, "[%d]Cannot get param :
GET_PARAM_DISP_FRAME_BUFFER",drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static struct vb2_buffer
Quoted 11 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-1+ ctx->id);return NULL ; }if (!disp_frame_buffer) { -mtk_v4l2_debug (3 ,"No display frame buffer" ); +mtk_v4l2_vdec_dbg (3 , ctx,"No display frame buffer" );return NULL ; }@@ -78,9 +79,9 @@ static struct vb2_buffer*get_display_buffer(struct
mtk_vcodec_ctx*ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static struct vb2_buffer · line 82
Quoted 7 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-3vb = &dstbuf->m2m_buf.vb;mutex_lock (&ctx->lock);if (dstbuf->used) { -mtk_v4l2_debug (2 ,"[%d]status=%x queue id=%d to done_list %d" , - ctx->id, disp_frame_buffer->status, - vb->vb2_buf.index, dstbuf->queued_in_vb2); +mtk_v4l2_vdec_dbg(2, ctx, "[%d]status=%x queue id=%d to done_list%d",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static struct vb2_buffer
Quoted 6 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-0+ ctx->id, disp_frame_buffer->status, + vb->vb2_buf.index, dstbuf->queued_in_vb2);v4l2_m2m_buf_done (vb,VB2_BUF_STATE_DONE ); ctx->decoded_frame_cnt++;@@ -105,16 +106,16 @@ static struct vb2_buffer*get_free_buffer(struct
mtk_vcodec_ctx*ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static struct vb2_buffer
Quoted 21 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +4
-4if (vdec_if_get_param (ctx,GET_PARAM_FREE_FRAME_BUFFER , &free_frame_buffer)) { -mtk_v4l2_err ("[%d] Error!! Cannot get param" , ctx->id); +mtk_v4l2_vdec_err (ctx,"[%d] Error!! Cannot get param" , ctx->id);return NULL ; }if (!free_frame_buffer) { -mtk_v4l2_debug (3 ," No free frame buffer" ); +mtk_v4l2_vdec_dbg (3 , ctx," No free frame buffer" );return NULL ; } -mtk_v4l2_debug (3 ,"[%d] tmp_frame_addr = 0x%p" , ctx->id, - free_frame_buffer); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] tmp_frame_addr = 0x%p" , ctx->id, + free_frame_buffer); dstbuf = container_of(free_frame_buffer, struct mtk_video_dec_buf, frame_buffer);@@ -131,9 +132,9 @@ static struct vb2_buffer*get_free_buffer(struct
mtk_vcodec_ctx*ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static struct vb2_buffer · line 135
Quoted 7 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-3* This reduce overheads that dq/q unused capture * buffer. In this case, queued_in_vb2 = true. */ -mtk_v4l2_debug (2 ,"[%d]status=%x queue id=%d to rdy_queue %d" , - ctx->id, free_frame_buffer->status, - vb->vb2_buf.index, dstbuf->queued_in_vb2); +mtk_v4l2_vdec_dbg(2, ctx, "[%d]status=%x queue id=%d to rdy_queue%d",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static struct vb2_buffer
Quoted 6 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-0+ ctx->id, free_frame_buffer->status, + vb->vb2_buf.index, dstbuf->queued_in_vb2);v4l2_m2m_buf_queue (ctx->m2m_ctx, vb); }else if (!dstbuf->queued_in_vb2 && dstbuf->queued_in_v4l2) {/* @@ -146,10 +147,10 @@ static struct vb2_buffer*get_free_buffer(struct
mtk_vcodec_ctx*ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static struct vb2_buffer
Quoted 15 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +4
-4* means this buffer is not from previous decode * output. */ -mtk_v4l2_debug (2 , -"[%d]status=%x queue id=%d to rdy_queue" , - ctx->id, free_frame_buffer->status, - vb->vb2_buf.index); +mtk_v4l2_vdec_dbg (2 , ctx, +"[%d]status=%x queue id=%d to rdy_queue" , + ctx->id, free_frame_buffer->status, + vb->vb2_buf.index);v4l2_m2m_buf_queue (ctx->m2m_ctx, vb); dstbuf->queued_in_vb2 = true; }else {@@ -161,10 +162,10 @@ static struct vb2_buffer*get_free_buffer(struct
mtk_vcodec_ctx*ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_queue_res_chg_event(struct
Quoted 15 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +4
-4* When this buffer q from user space, it could * directly q to vb2 buffer */ -mtk_v4l2_debug (3 ,"[%d]status=%x err queue id=%d %d %d" , - ctx->id, free_frame_buffer->status, - vb->vb2_buf.index, dstbuf->queued_in_vb2, - dstbuf->queued_in_v4l2); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d]status=%x err queue id=%d %d %d" , + ctx->id, free_frame_buffer->status, + vb->vb2_buf.index, dstbuf->queued_in_vb2, + dstbuf->queued_in_v4l2); } dstbuf->used = false; }@@ -191,7 +192,7 @@ static void mtk_vdec_queue_res_chg_event(struct
mtk_vcodec_ctx*ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static int mtk_vdec_flush_decoder(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1.u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION, }; -mtk_v4l2_debug (1 ,"[%d]" , ctx->id); +mtk_v4l2_vdec_dbg (1 , ctx,"[%d]" , ctx->id);v4l2_event_queue_fh (&ctx->fh, &ev_src_ch); }@@ -202,7 +203,7 @@ static int mtk_vdec_flush_decoder(struct
mtk_vcodec_ctx*ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_update_fmt(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1ret =vdec_if_decode (ctx,NULL ,NULL , &res_chg);if (ret) -mtk_v4l2_err ("DecodeFinal failed, ret=%d" , ret); +mtk_v4l2_vdec_err (ctx,"DecodeFinal failed, ret=%d" , ret);clean_display_buffer (ctx);clean_free_buffer (ctx);@@ -221,14 +222,14 @@ static void mtk_vdec_update_fmt(struct
mtk_vcodec_ctx*ctx,drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_update_fmt(struct · line 231
Quoted 13 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-3for (k =0 ; k < num_supported_formats; k++) { fmt = &mtk_video_formats[k];if (fmt->fourcc == pixelformat) { -mtk_v4l2_debug (1 ,"Update cap fourcc(%d -> %d)" , - dst_q_data->fmt->fourcc, pixelformat); +mtk_v4l2_vdec_dbg (1 , ctx,"Update cap fourcc(%d -> %d)" , + dst_q_data->fmt->fourcc, pixelformat); dst_q_data->fmt = fmt;return ; } } -mtk_v4l2_err("Cannot get fourcc(%d), using init value",pixelformat);
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_update_fmt(struct · line 232
Quoted 1 line
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-0+mtk_v4l2_vdec_err(ctx, "Cannot get fourcc(%d), using init value",pixelformat);
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static int mtk_vdec_pic_info_update(struct
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-0}static int mtk_vdec_pic_info_update (struct mtk_vcodec_ctx *ctx)@@ -238,7 +239,8 @@ static int mtk_vdec_pic_info_update(struct
mtk_vcodec_ctx*ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static int mtk_vdec_pic_info_update(struct · line 240
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-1if (vdec_if_get_param (ctx,GET_PARAM_PIC_INFO , &ctx->last_decoded_picinfo)) { -mtk_v4l2_err("[%d]Error!! Cannot get param :
GET_PARAM_PICTURE_INFOERR",ctx->id);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static int mtk_vdec_pic_info_update(struct · line 241
Quoted 1 line
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-0+mtk_v4l2_vdec_err(ctx, "[%d]Error!! Cannot get param :
GET_PARAM_PICTURE_INFOERR",drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static int mtk_vdec_pic_info_update(struct
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-0+ ctx->id);return -EINVAL ; }@@ -246,7 +248,7 @@ static int mtk_vdec_pic_info_update(struct
mtk_vcodec_ctx*ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static int mtk_vdec_pic_info_update(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1ctx->last_decoded_picinfo.pic_h == 0 || ctx->last_decoded_picinfo.buf_w == 0 || ctx->last_decoded_picinfo.buf_h == 0) { -mtk_v4l2_err ("Cannot get correct pic info" ); +mtk_v4l2_vdec_err (ctx,"Cannot get correct pic info" );return -EINVAL ; }@@ -258,15 +260,15 @@ static int mtk_vdec_pic_info_update(struct
mtk_vcodec_ctx*ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static int mtk_vdec_pic_info_update(struct · line 261
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-1ctx->last_decoded_picinfo.pic_h == ctx->picinfo.pic_h)return 0 ; -mtk_v4l2_debug(1, "[%d]-> new(%d,%d), old(%d,%d), real(%d,%d)",
ctx->id,drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static int mtk_vdec_pic_info_update(struct · line 263
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-4- ctx->last_decoded_picinfo.pic_w, - ctx->last_decoded_picinfo.pic_h, ctx->picinfo.pic_w, - ctx->picinfo.pic_h, ctx->last_decoded_picinfo.buf_w, - ctx->last_decoded_picinfo.buf_h); +mtk_v4l2_vdec_dbg(1, ctx, "[%d]-> new(%d,%d), old(%d,%d),
real(%d,%d)",ctx->id,drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_worker(struct
Quoted 13 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +5
-1+ ctx->last_decoded_picinfo.pic_w, + ctx->last_decoded_picinfo.pic_h, ctx->picinfo.pic_w, + ctx->picinfo.pic_h, ctx->last_decoded_picinfo.buf_w, + ctx->last_decoded_picinfo.buf_h); ret =vdec_if_get_param (ctx,GET_PARAM_DPB_SIZE , &dpbsize);if (dpbsize ==0 ) -mtk_v4l2_err ("Incorrect dpb size, ret=%d" , ret); +mtk_v4l2_vdec_err (ctx,"Incorrect dpb size, ret=%d" , ret); ctx->dpb_size = dpbsize;@@ -288,14 +290,14 @@ static void mtk_vdec_worker(struct
work_struct*work)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_worker(struct
Quoted 17 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-2src_buf =v4l2_m2m_next_src_buf (ctx->m2m_ctx);if (!src_buf) {v4l2_m2m_job_finish (dev->m2m_dev_dec, ctx->m2m_ctx); -mtk_v4l2_debug (1 ,"[%d] src_buf empty!!" , ctx->id); +mtk_v4l2_vdec_dbg (1 , ctx,"[%d] src_buf empty!!" , ctx->id);return ; } dst_buf =v4l2_m2m_next_dst_buf (ctx->m2m_ctx);if (!dst_buf) {v4l2_m2m_job_finish (dev->m2m_dev_dec, ctx->m2m_ctx); -mtk_v4l2_debug (1 ,"[%d] dst_buf empty!!" , ctx->id); +mtk_v4l2_vdec_dbg (1 , ctx,"[%d] dst_buf empty!!" , ctx->id);return ; }@@ -313,15 +315,15 @@ static void mtk_vdec_worker(struct
work_struct*work)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_worker(struct · line 320
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-3vb2_dma_contig_plane_dma_addr (&dst_buf->vb2_buf,1 ); pfb->base_c.size = ctx->picinfo.fb_sz[1 ]; pfb->status =0 ; -mtk_v4l2_debug (3 ,"===>[%d] vdec_if_decode() ===>" , ctx->id); +mtk_v4l2_vdec_dbg (3 , ctx,"===>[%d] vdec_if_decode() ===>" , ctx- id); -mtk_v4l2_debug(3, - "id=%d Framebuf pfb=%p VA=%p Y_DMA=%pad C_DMA=%padSize=%zx",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_worker(struct
Quoted 15 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +5
-3- dst_buf->vb2_buf.index, pfb, pfb->base_y.va, - &pfb->base_y.dma_addr, &pfb->base_c.dma_addr, pfb- base_y.size); +mtk_v4l2_vdec_dbg (3 , ctx, +"id=%d Framebuf pfb=%p VA=%p Y_DMA=%pad C_DMA=%pad Size=%zx" , + dst_buf->vb2_buf.index, pfb, pfb->base_y.va, + &pfb->base_y.dma_addr, &pfb->base_c.dma_addr, pfb->base_y.size);if (src_buf == &ctx->empty_flush_buf.vb) { -mtk_v4l2_debug (1 ,"Got empty flush input buffer." ); +mtk_v4l2_vdec_dbg (1 , ctx,"Got empty flush input buffer." ); src_buf =v4l2_m2m_src_buf_remove (ctx->m2m_ctx);/* update dst buf status */
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-0@@ -350,12 +352,12 @@ static void mtk_vdec_worker(struct
work_struct*work)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_worker(struct · line 359
Quoted 12 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +3
-4buf.size = (size_t )src_buf->vb2_buf.planes[0 ].bytesused;if (!buf.va) {v4l2_m2m_job_finish (dev->m2m_dev_dec, ctx->m2m_ctx); -mtk_v4l2_err ("[%d] id=%d src_addr is NULL!!" , ctx->id, - src_buf->vb2_buf.index); +mtk_v4l2_vdec_err (ctx,"[%d] id=%d src_addr is NULL!!" , ctx->id, + src_buf->vb2_buf.index);return ; } -mtk_v4l2_debug (3 ,"[%d] Bitstream VA=%p DMA=%pad Size=%zx vb=%p" , - ctx->id, buf.va, &buf.dma_addr, buf.size, src_buf); +mtk_v4l2_vdec_dbg(3, ctx, "[%d] Bitstream VA=%p DMA=%pad Size=%zxvb=%p",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_worker(struct work_struct
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-0+ ctx->id, buf.va, &buf.dma_addr, buf.size, src_buf); dst_buf->vb2_buf.timestamp = src_buf->vb2_buf.timestamp; dst_buf->timecode = src_buf->timecode;mutex_lock (&ctx->lock);@@ -366,9 +368,10 @@ static void mtk_vdec_worker(struct work_struct*work)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_worker(struct work_struct · line 369
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-1ret =vdec_if_decode (ctx, &buf, pfb, &res_chg);if (ret) { -mtk_v4l2_err(" <===[%d], src_buf[%d] sz=0x%zx pts=%llu dst_buf[%d]
vdec_if_decode()ret=%d res_chg=%d===>",drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_worker(struct work_struct · line 371
Quoted 2 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-2- ctx->id, src_buf->vb2_buf.index, buf.size, - src_buf->vb2_buf.timestamp, dst_buf->vb2_buf.index, ret,
res_chg);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_worker(struct work_struct · line 372
Quoted 2 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-0+mtk_v4l2_vdec_err(ctx, + "[%d] decode src[%d] sz=0x%zx pts=%llu dst[%d] ret=%dres_chg=%d",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_worker(struct work_struct · line 374
Quoted 2 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-0+ ctx->id, src_buf->vb2_buf.index, buf.size, + src_buf->vb2_buf.timestamp, dst_buf->vb2_buf.index, ret,
res_chg);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-0src_buf =v4l2_m2m_src_buf_remove (ctx->m2m_ctx);if (ret == -EIO ) {mutex_lock (&ctx->lock);@@ -421,8 +424,8 @@ static void
vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void
Quoted 11 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-2struct vb2_v4l2_buffer *vb2_v4l2;struct mtk_q_data *dst_q_data; -mtk_v4l2_debug (3 ,"[%d] (%d) id=%d, vb=%p" , ctx->id, - vb->vb2_queue->type, vb->index, vb); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] (%d) id=%d, vb=%p" , ctx->id, + vb->vb2_queue->type, vb->index, vb);/* * check if this buffer is ready to be used after decode */ @@ -448,20 +451,19 @@ static void
vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void · line 454
Quoted 6 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-2v4l2_m2m_buf_queue (ctx->m2m_ctx,to_vb2_v4l2_buffer (vb));if (ctx->state !=MTK_STATE_INIT ) { -mtk_v4l2_debug (3 ,"[%d] already init driver %d" , ctx->id, - ctx->state); +mtk_v4l2_vdec_dbg(3, ctx, "[%d] already init driver %d", ctx->id,
ctx->state);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void
Quoted 18 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-2return ; } src_buf =v4l2_m2m_next_src_buf (ctx->m2m_ctx);if (!src_buf) { -mtk_v4l2_err ("No src buffer" ); +mtk_v4l2_vdec_err (ctx,"No src buffer" );return ; }if (src_buf == &ctx->empty_flush_buf.vb) {/* This shouldn't happen. Just in case. */ -mtk_v4l2_err ("Invalid flush buffer." ); +mtk_v4l2_vdec_err (ctx,"Invalid flush buffer." );v4l2_m2m_src_buf_remove (ctx->m2m_ctx);return ; }@@ -469,9 +471,8 @@ static void
vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void · line 476
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-3src_mem.va =vb2_plane_vaddr (&src_buf->vb2_buf,0 ); src_mem.dma_addr =vb2_dma_contig_plane_dma_addr (&src_buf- vb2_buf,0 ); src_mem.size = (size_t )src_buf->vb2_buf.planes[0 ].bytesused; -mtk_v4l2_debug (2 ,"[%d] buf id=%d va=%p dma=%pad size=%zx" , ctx- id, - src_buf->vb2_buf.index, src_mem.va, &src_mem.dma_addr, - src_mem.size); +mtk_v4l2_vdec_dbg(2, ctx, "[%d] buf id=%d va=%p dma=%padsize=%zx",
ctx->id,drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void · line 477
Quoted 1 line
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-0+ src_buf->vb2_buf.index, src_mem.va, &src_mem.dma_addr,src_mem.size);
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-0ret =vdec_if_decode (ctx, &src_mem,NULL , &res_chg);if (ret || !res_chg) {
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-0@@ -484,20 +485,22 @@ static void
vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void · line 488
Quoted 6 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1src_buf =v4l2_m2m_src_buf_remove (ctx->m2m_ctx);if (ret == -EIO ) { -mtk_v4l2_err ("[%d] Unrecoverable error in vdec_if_decode." , ctx- id); +mtk_v4l2_vdec_err(ctx, "[%d] Unrecoverable error in
vdec_if_decode.",drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void · line 494
Quoted 8 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-2+ ctx->id); ctx->state =MTK_STATE_ABORT ;v4l2_m2m_buf_done (src_buf,VB2_BUF_STATE_ERROR ); }else {v4l2_m2m_buf_done (src_buf,VB2_BUF_STATE_DONE ); } -mtk_v4l2_debug(ret ? 0 : 1, - "[%d] vdec_if_decode() src_buf=%d, size=%zu, fail=%d,res_chg=%d",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void · line 495
Quoted 1 line
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-1- ctx->id, src_buf->vb2_buf.index, src_mem.size, ret,
res_chg);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void · line 500
Quoted 8 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +3
-1+mtk_v4l2_vdec_dbg (ret ?0 :1 , ctx, +"[%d] decode() src_buf=%d, size=%zu, fail=%d, res_chg=%d" , + ctx->id, src_buf->vb2_buf.index, src_mem.size, ret, res_chg);return ; }if (vdec_if_get_param (ctx,GET_PARAM_PIC_INFO , &ctx->picinfo)) { -mtk_v4l2_err("[%d]Error!! Cannot get param :
GET_PARAM_PICTURE_INFOERR",ctx->id);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void · line 502
Quoted 1 line
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-0+mtk_v4l2_vdec_err(ctx, "[%d]Error!! Cannot get param :
GET_PARAM_PICTURE_INFOERR",drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-0+ ctx->id);return ; }@@ -508,17 +511,17 @@ static void
vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void · line 511
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-1dst_q_data->bytesperline[i] = ctx->picinfo.buf_w; } -mtk_v4l2_debug(2, "[%d] vdec_if_init() OK wxh=%dx%d pic wxh=%dx%dsz[0]=0x%x sz[1]=0x%x",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void · line 516
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-2- ctx->id, ctx->picinfo.buf_w, ctx->picinfo.buf_h, ctx- picinfo.pic_w, - ctx->picinfo.pic_h, dst_q_data->sizeimage[0 ], dst_q_data- sizeimage[1]); +mtk_v4l2_vdec_dbg(2, ctx, "[%d] init OK wxh=%dx%d pic wxh=%dx%dsz[0]=0x%x sz[1]=0x%x",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void · line 524
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +3
-1+ ctx->id, ctx->picinfo.buf_w, ctx->picinfo.buf_h, ctx- picinfo.pic_w, + ctx->picinfo.pic_h, dst_q_data->sizeimage[0 ], dst_q_data- sizeimage[1]); ret =vdec_if_get_param (ctx,GET_PARAM_DPB_SIZE , &dpbsize);if (dpbsize ==0 ) -mtk_v4l2_err ("[%d] GET_PARAM_DPB_SIZE fail=%d" , ctx->id, ret); +mtk_v4l2_vdec_err(ctx, "[%d] GET_PARAM_DPB_SIZE fail=%d", ctx->id,ret);
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static int mtk_vdec_g_v_ctrl(struct v4l2_ctrl
Quoted 10 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1ctx->dpb_size = dpbsize; ctx->state =MTK_STATE_HEADER ; -mtk_v4l2_debug (1 ,"[%d] dpbsize=%d" , ctx->id, ctx->dpb_size); +mtk_v4l2_vdec_dbg(1, ctx, "[%d] dpbsize=%d", ctx->id, ctx-
dpb_size);
mtk_vdec_queue_res_chg_event(ctx);
}drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-0@@ -533,7 +536,7 @@ static int mtk_vdec_g_v_ctrl(struct v4l2_ctrl*ctrl)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static int mtk_vcodec_dec_ctrls_setup(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1if (ctx->state >=MTK_STATE_HEADER ) { ctrl->val = ctx->dpb_size; }else { -mtk_v4l2_debug (0 ,"Seqinfo not ready" ); +mtk_v4l2_vdec_dbg (0 , ctx,"Seqinfo not ready" ); ctrl->val =0 ; }break ;@@ -570,7 +573,7 @@ static int mtk_vcodec_dec_ctrls_setup(struct
mtk_vcodec_ctx*ctx)Quoted 10 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1V4L2_MPEG_VIDEO_H264_PROFILE_MAIN);if (ctx->ctrl_hdl.error) { -mtk_v4l2_err ("Adding control failed %d" , ctx->ctrl_hdl.error); +mtk_v4l2_vdec_err (ctx,"Adding control failed %d" , ctx- ctrl_hdl.error);return ctx->ctrl_hdl.error; }diff --git
a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.cb/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.cQuoted 2 lines
index
db1e14a1bd6c..ffe05ff31dd1100644
---
a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.cQuoted 1 line
+++
b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.cdrivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void
Quoted 1 line
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-0@@ -232,10 +232,10 @@ static voidmtk_vdec_stateless_cap_to_disp(struct
mtk_vcodec_ctx*ctx, int errordrivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static struct vdec_fb
Quoted 14 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +3
-3vb2_dst =v4l2_m2m_dst_buf_remove (ctx->m2m_ctx);if (vb2_dst) {v4l2_m2m_buf_done (vb2_dst, state); -mtk_v4l2_debug (2 ,"free frame buffer id:%d to done list" , - vb2_dst->vb2_buf.index); +mtk_v4l2_vdec_dbg (2 , ctx,"free frame buffer id:%d to done list" , + vb2_dst->vb2_buf.index); }else { -mtk_v4l2_err ("dst buffer is NULL" ); +mtk_v4l2_vdec_err (ctx,"dst buffer is NULL" ); }if (src_buf_req)@@ -251,7 +251,7 @@ static struct vdec_fb*vdec_get_cap_buffer(struct
mtk_vcodec_ctx*ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static struct vdec_fb
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1vb2_v4l2 =v4l2_m2m_next_dst_buf (ctx->m2m_ctx);if (!vb2_v4l2) { -mtk_v4l2_debug (1 ,"[%d] dst_buf empty!!" , ctx->id); +mtk_v4l2_vdec_dbg (1 , ctx,"[%d] dst_buf empty!!" , ctx->id);return NULL ; }@@ -269,9 +269,10 @@ static struct vdec_fb*vdec_get_cap_buffer(struct
mtk_vcodec_ctx*ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static struct vdec_fb · line 272
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-1vb2_dma_contig_plane_dma_addr (dst_buf,1 ); pfb->base_c.size = ctx->q_data[MTK_Q_DATA_DST ].sizeimage[1 ]; } -mtk_v4l2_debug(1, "id=%d Framebuf pfb=%p VA=%p Y_DMA=%padC_DMA=%pad Size=%zx
frame_count= %d",drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static struct vdec_fb · line 274
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-2- dst_buf->index, pfb, pfb->base_y.va, &pfb->base_y.dma_addr, - &pfb->base_c.dma_addr, pfb->base_y.size, ctx- decoded_frame_cnt); +mtk_v4l2_vdec_dbg(1, ctx, + "id=%d Framebuf pfb=%p VA=%p Y/C_DMA=%pad_%pad Sz=%zx
frame_count= %d",drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_worker(struct work_struct
Quoted 7 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-0+ dst_buf->index, pfb, pfb->base_y.va, &pfb->base_y.dma_addr, + &pfb->base_c.dma_addr, pfb->base_y.size, ctx- decoded_frame_cnt);return pfb;
}drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-0@@ -300,7 +301,7 @@ static void mtk_vdec_worker(struct work_struct*work)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_worker(struct
Quoted 10 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1vb2_v4l2_src =v4l2_m2m_next_src_buf (ctx->m2m_ctx);if (!vb2_v4l2_src) {v4l2_m2m_job_finish (dev->m2m_dev_dec, ctx->m2m_ctx); -mtk_v4l2_debug (1 ,"[%d] no available source buffer" , ctx->id); +mtk_v4l2_vdec_dbg (1 , ctx,"[%d] no available source buffer" , ctx- id);return ; }@@ -309,33 +310,34 @@ static void mtk_vdec_worker(struct
work_struct*work)Quoted 13 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-2m2m_buf.vb); bs_src = &dec_buf_src->bs_buffer; -mtk_v4l2_debug (3 ,"[%d] (%d) id=%d, vb=%p" , ctx->id, - vb2_src->vb2_queue->type, vb2_src->index, vb2_src); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] (%d) id=%d, vb=%p" , ctx->id, + vb2_src->vb2_queue->type, vb2_src->index, vb2_src); bs_src->va =vb2_plane_vaddr (vb2_src,0 ); bs_src->dma_addr =vb2_dma_contig_plane_dma_addr (vb2_src,0 ); bs_src->size = (size_t )vb2_src->planes[0 ].bytesused;if (!bs_src->va) {v4l2_m2m_job_finish (dev->m2m_dev_dec, ctx->m2m_ctx);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_worker(struct · line 327
Quoted 10 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-4-mtk_v4l2_err ("[%d] id=%d source buffer is NULL" , ctx->id, - vb2_src->index); +mtk_v4l2_vdec_err (ctx,"[%d] id=%d source buffer is NULL" , ctx- id, + vb2_src->index);return ; } -mtk_v4l2_debug(3, "[%d] Bitstream VA=%p DMA=%pad Size=%zx vb=%p", - ctx->id, bs_src->va, &bs_src->dma_addr, bs_src->size,
vb2_src);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_worker(struct · line 327
Quoted 1 line
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-0+mtk_v4l2_vdec_dbg(3, ctx, "[%d] Bitstream VA=%p DMA=%pad Size=%zxvb=%p",
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void mtk_vdec_worker(struct · line 337
Quoted 12 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-2+ ctx->id, bs_src->va, &bs_src->dma_addr, bs_src->size, vb2_src);/* Apply request controls. */ src_buf_req = vb2_src->req_obj.req;if (src_buf_req)v4l2_ctrl_request_setup (src_buf_req, &ctx->ctrl_hdl);else -mtk_v4l2_err ("vb2 buffer media request is NULL" ); +mtk_v4l2_vdec_err (ctx,"vb2 buffer media request is NULL" ); ret =vdec_if_decode (ctx, bs_src,NULL , &res_chg);if (ret && ret != -EAGAIN ) { -mtk_v4l2_err(" <===[%d], src_buf[%d] sz=0x%zx pts=%llu
vdec_if_decode()ret=%d res_chg=%d===>",drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void
Quoted 10 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +4
-2- ctx->id, vb2_src->index, bs_src->size, - vb2_src->timestamp, ret, res_chg); +mtk_v4l2_vdec_err (ctx, +"[%d] decode src_buf[%d] sz=0x%zx pts=%llu ret=%d res_chg=%d" , + ctx->id, vb2_src->index, bs_src->size, + vb2_src->timestamp, ret, res_chg);if (ret == -EIO ) {mutex_lock (&ctx->lock);
dec_buf_src->error= true;drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-0@@ -363,7 +365,8 @@ static void
vb2ops_vdec_stateless_buf_queue(struct vb2_buffer *vb)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void
Quoted 12 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-1struct mtk_vcodec_ctx *ctx =vb2_get_drv_priv (vb->vb2_queue);struct vb2_v4l2_buffer *vb2_v4l2 =to_vb2_v4l2_buffer (vb); -mtk_v4l2_debug (3 ,"[%d] (%d) id=%d, vb=%p" , ctx->id, vb- vb2_queue->type, vb->index, vb); +mtk_v4l2_vdec_dbg (3 , ctx,"[%d] (%d) id=%d, vb=%p" , ctx->id, vb- vb2_queue->type, + vb->index, vb);
mutex_lock(&ctx->lock);
v4l2_m2m_buf_queue(ctx->m2m_ctx, vb2_v4l2);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-0@@ -374,9 +377,9 @@ static void
vb2ops_vdec_stateless_buf_queue(struct vb2_buffer *vb)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static void · line 383
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-2/* If an OUTPUT buffer, we may need to update the state */ if (ctx->state ==MTK_STATE_INIT ) { ctx->state =MTK_STATE_HEADER ; -mtk_v4l2_debug (1 ,"Init driver from init to header." ); +mtk_v4l2_vdec_dbg (1 , ctx,"Init driver from init to header." ); }else { -mtk_v4l2_debug (3 ,"[%d] already init driver %d" , ctx->id, ctx- state); +mtk_v4l2_vdec_dbg(3, ctx, "[%d] already init driver %d", ctx->id,
ctx->state);drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static int mtk_vcodec_dec_ctrls_setup(struct
Quoted 4 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-0} }@@ -393,7 +396,7 @@ static int mtk_vcodec_dec_ctrls_setup(struct
mtk_vcodec_ctx*ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static int mtk_vcodec_dec_ctrls_setup(struct
Quoted 9 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1v4l2_ctrl_handler_init (&ctx->ctrl_hdl,NUM_CTRLS );if (ctx->ctrl_hdl.error) { -mtk_v4l2_err ("v4l2_ctrl_handler_init failed\n" ); +mtk_v4l2_vdec_err (ctx,"v4l2_ctrl_handler_init failed\n" );return ctx->ctrl_hdl.error; }@@ -402,7 +405,8 @@ static int mtk_vcodec_dec_ctrls_setup(struct
mtk_vcodec_ctx*ctx)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static int fops_media_request_validate(struct
Quoted 11 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +2
-1v4l2_ctrl_new_custom (&ctx->ctrl_hdl, &cfg,NULL );if (ctx->ctrl_hdl.error) { -mtk_v4l2_err ("Adding control %d failed %d" , i, ctx- ctrl_hdl.error); +mtk_v4l2_vdec_err (ctx,"Adding control %d failed %d" , i, + ctx->ctrl_hdl.error);return ctx->ctrl_hdl.error; } }@@ -421,11 +425,11 @@ static int fops_media_request_validate(struct
media_request*mreq)drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c static int fops_media_request_validate(struct · line 429
Quoted 6 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +1
-1/* We expect exactly one buffer with the request */ break ;case 0 : -mtk_v4l2_debug (1 ,"No buffer provided with the request" ); +pr_debug ("[MTK VCODEC] No buffer provided with the request" );I suggest following the same format as the macro, "<devname>:
[MTK_V4L2][ERROR]", you can probably have a macro for that formatting. This
would ensure consitency for all the trace without context. Some of the trace
don't even name anything MTK/VCODEC, likeav1_error: prefix. I'd like to see
these fixed.
Quoted 9 lines
pr_debug(MTK_DBG_STR "No buffer provided with...");Or add ...no_ctx() debug macro, prepending the string ? This would be up to your
preference.regards,
Nicolas
For pr_debug and pr_err only be used for several functions. Prefer to add two macro for vcodec and v4l2 debug.
#define MTK_DBG_VCODEC_STR "[MTK_VCODEC]"
#define MTK_DBG_V4L2_STR "[MTK_V4L2]"
Best Regards,
Yunfei Dong
Quoted 20 lines
Review
Quoted 3 lines
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +0
-0/** (quoted diff) +0
-0
b/drivers/media/platform/mediatek/vcodec/vdec_vpu_if.cdrivers/media/platform/mediatek/vcodec/vdec_vpu_if.c static void vpu_dec_ipi_handler(void *data,
Quoted 4 lines
index
ab15ee6e2005..d82391411ba1100644drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c +0
-0@@ -91,7 +91,7 @@ static void vpu_dec_ipi_handler(void *data,unsigned int len, void *priv)
drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c static void vpu_dec_ipi_handler(void *data, unsigned int len, void *priv)
Quoted 5 lines
drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c +1
-1(unsigned long )msg->ap_inst_addr;if (!vpu) { -mtk_v4l2_err ("ap_inst_addr is NULL, did the SCP hang or crash?" ); +mtk_v4l2_vdec_err(vpu->ctx, "ap_inst_addr is NULL, did the SCPhang or crash?");
Quoted 3 lines
drivers/media/platform/mediatek/vcodec/vdec_vpu_if.c +0
-0return ; }
Yunfei Dong
maintainerPATCH v4 7/11 media: mediatek: vcodec: separate struct 'mtk_vcodec_ctx'
In reply to Yunfei DongAdding different context struct for encoder and decoder and removing struct 'mtk_vcodec_ctx'.
--- .../mediatek/vcodec/mtk_vcodec_com_drv.h | 76 +++++ .../mediatek/vcodec/mtk_vcodec_dbgfs.c | 6 +- .../mediatek/vcodec/mtk_vcodec_dbgfs.h | 10 +- .../platform/mediatek/vcodec/mtk_vcodec_dec.c | 60 ++-- .../platform/mediatek/vcodec/mtk_vcodec_dec.h | 10 +- .../mediatek/vcodec/mtk_vcodec_dec_drv.c | 10 +- .../mediatek/vcodec/mtk_vcodec_dec_drv.h | 158 ++++++++++ .../mediatek/vcodec/mtk_vcodec_dec_hw.c | 4 +- .../mediatek/vcodec/mtk_vcodec_dec_hw.h | 2 +- .../mediatek/vcodec/mtk_vcodec_dec_pm.c | 8 +- .../mediatek/vcodec/mtk_vcodec_dec_pm.h | 4 +- .../mediatek/vcodec/mtk_vcodec_dec_stateful.c | 28 +- .../vcodec/mtk_vcodec_dec_stateless.c | 22 +- .../platform/mediatek/vcodec/mtk_vcodec_drv.h | 269 +----------------- .../platform/mediatek/vcodec/mtk_vcodec_enc.c | 78 ++--- .../platform/mediatek/vcodec/mtk_vcodec_enc.h | 12 +- .../mediatek/vcodec/mtk_vcodec_enc_drv.c | 10 +- .../mediatek/vcodec/mtk_vcodec_enc_drv.h | 158 ++++++++++ .../mediatek/vcodec/mtk_vcodec_fw_vpu.c | 35 ++- .../mediatek/vcodec/mtk_vcodec_intr.c | 33 ++- .../mediatek/vcodec/mtk_vcodec_intr.h | 3 +- .../mediatek/vcodec/mtk_vcodec_util.c | 12 +- .../mediatek/vcodec/mtk_vcodec_util.h | 8 +- .../vcodec/vdec/vdec_av1_req_lat_if.c | 22 +- .../mediatek/vcodec/vdec/vdec_h264_if.c | 6 +- .../vcodec/vdec/vdec_h264_req_common.c | 4 +- .../vcodec/vdec/vdec_h264_req_common.h | 4 +- .../mediatek/vcodec/vdec/vdec_h264_req_if.c | 8 +- .../vcodec/vdec/vdec_h264_req_multi_if.c | 10 +- .../vcodec/vdec/vdec_hevc_req_multi_if.c | 16 +- .../mediatek/vcodec/vdec/vdec_vp8_if.c | 4 +- .../mediatek/vcodec/vdec/vdec_vp8_req_if.c | 10 +- .../mediatek/vcodec/vdec/vdec_vp9_if.c | 8 +- .../vcodec/vdec/vdec_vp9_req_lat_if.c | 18 +- .../platform/mediatek/vcodec/vdec_drv_base.h | 2 +- .../platform/mediatek/vcodec/vdec_drv_if.c | 8 +- .../platform/mediatek/vcodec/vdec_drv_if.h | 8 +- .../platform/mediatek/vcodec/vdec_msg_queue.c | 8 +- .../platform/mediatek/vcodec/vdec_msg_queue.h | 10 +- .../platform/mediatek/vcodec/vdec_vpu_if.h | 4 +- .../mediatek/vcodec/venc/venc_h264_if.c | 12 +- .../mediatek/vcodec/venc/venc_vp8_if.c | 8 +- .../platform/mediatek/vcodec/venc_drv_base.h | 2 +- .../platform/mediatek/vcodec/venc_drv_if.c | 14 +- .../platform/mediatek/vcodec/venc_drv_if.h | 8 +- .../platform/mediatek/vcodec/venc_vpu_if.h | 2 +- 46 files changed, 698 insertions(+), 514 deletions(-) create mode 100644 drivers/media/platform/mediatek/vcodec/mtk_vcodec_com_drv.h create mode 100644 drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.h create mode 100644 drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.h
drivers/media/platform/mediatek/vcodec/mtk_vcodec_com_drv.h new file +76 -0
@@ -0,0 +1,76 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2023 MediaTek Inc. +* Author: Yunfei Dong <[email protected]> +*/ + +#ifndef _MTK_VCODEC_COM_DRV_H_ +#define _MTK_VCODEC_COM_DRV_H_ + +#include <linux/platform_device.h> +#include <linux/videodev2.h> +#include <media/v4l2-ctrls.h> +#include <media/v4l2-device.h> +#include <media/v4l2-ioctl.h> +#include <media/v4l2-mem2mem.h> +#include <media/videobuf2-core.h> + +#define MTK_VCODEC_MAX_PLANES 3 + +/** +* enum mtk_instance_state - The state of an MTK Vcodec instance. +* @MTK_STATE_FREE: default state when instance is created +* @MTK_STATE_INIT: vcodec instance is initialized +* @MTK_STATE_HEADER: vdec had sps/pps header parsed or venc +* had sps/pps header encoded +* @MTK_STATE_FLUSH: vdec is flushing. Only used by decoder +* @MTK_STATE_ABORT: vcodec should be aborted +*/ +enum mtk_instance_state { +MTK_STATE_FREE =0 , +MTK_STATE_INIT =1 , +MTK_STATE_HEADER =2 , +MTK_STATE_FLUSH =3 , +MTK_STATE_ABORT =4 , +}; + +enum mtk_fmt_type { +MTK_FMT_DEC =0 , +MTK_FMT_ENC =1 , +MTK_FMT_FRAME =2 , +}; + +/* +* struct mtk_video_fmt - Structure used to store information about pixelformats +*/ +struct mtk_video_fmt { +u32 fourcc; +enum mtk_fmt_type type; +u32 num_planes; +u32 flags; +struct v4l2_frmsize_stepwise frmsize; +}; + +/* +* struct mtk_q_data - Structure used to store information about queue +*/ +struct mtk_q_data { +unsigned int visible_width; +unsigned int visible_height; +unsigned int coded_width; +unsigned int coded_height; +enum v4l2_field field; +unsigned int bytesperline[MTK_VCODEC_MAX_PLANES ]; +unsigned int sizeimage[MTK_VCODEC_MAX_PLANES ]; +const struct mtk_video_fmt *fmt; +}; + +/* +* enum mtk_instance_type - The type of an MTK Vcodec instance. +*/ +enum mtk_instance_type { +MTK_INST_DECODER =0 , +MTK_INST_ENCODER =1 , +}; + +#endif /* _MTK_VCODEC_COM_DRV_H_ */
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c +3 -3
@@ -10,7 +10,7 @@#include "mtk_vcodec_drv.h" #include "mtk_vcodec_util.h" -static void mtk_vdec_dbgfs_get_format_type (struct mtk_vcodec_ctx *ctx,char *buf, +static void mtk_vdec_dbgfs_get_format_type (struct mtk_vcodec_dec_ctx *ctx,char *buf,int *used,int total) {int curr_len;
@@ -91,7 +91,7 @@ static ssize_t mtk_vdec_dbgfs_read(struct file *filp, char __user *ubuf,struct mtk_vcodec_dev *vcodec_dev = filp->private_data;struct mtk_vcodec_dbgfs *dbgfs = &vcodec_dev->dbgfs;struct mtk_vcodec_dbgfs_inst *dbgfs_inst; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;int total_len =200 * (dbgfs->inst_count ==0 ?1 : dbgfs->inst_count);int used_len =0 , curr_len, ret;bool dbgfs_index[MTK_VDEC_DBGFS_MAX ] = {0 };
@@ -143,7 +143,7 @@ static const struct file_operations vdec_fops = { .read = mtk_vdec_dbgfs_read, }; -void mtk_vcodec_dbgfs_create (struct mtk_vcodec_ctx *ctx) +void mtk_vcodec_dbgfs_create (struct mtk_vcodec_dec_ctx *ctx) {struct mtk_vcodec_dbgfs_inst *dbgfs_inst;struct mtk_vcodec_dev *vcodec_dev = ctx->dev;
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.h +5 -5
@@ -8,7 +8,7 @@#define __MTK_VCODEC_DBGFS_H__struct mtk_vcodec_dev ; -struct mtk_vcodec_ctx ; +struct mtk_vcodec_dec_ctx ;/* * enum mtk_vdec_dbgfs_log_index - used to get different debug information
@@ -22,12 +22,12 @@ enum mtk_vdec_dbgfs_log_index {/** * struct mtk_vcodec_dbgfs_inst - debugfs information for each inst * @node: list node for each inst -* @vcodec_ctx: struct mtk_vcodec_ctx +* @vcodec_ctx: struct mtk_vcodec_dec_ctx * @inst_id: index of the context that the same with ctx->id */ struct mtk_vcodec_dbgfs_inst {struct list_head node; -struct mtk_vcodec_ctx *vcodec_ctx; +struct mtk_vcodec_dec_ctx *vcodec_ctx;int inst_id; };
@@ -50,12 +50,12 @@ struct mtk_vcodec_dbgfs { };#if defined(CONFIG_DEBUG_FS ) -void mtk_vcodec_dbgfs_create (struct mtk_vcodec_ctx *ctx); +void mtk_vcodec_dbgfs_create (struct mtk_vcodec_dec_ctx *ctx);void mtk_vcodec_dbgfs_remove (struct mtk_vcodec_dev *vcodec_dev,int ctx_id);void mtk_vcodec_dbgfs_init (struct mtk_vcodec_dev *vcodec_dev,bool is_encode);void mtk_vcodec_dbgfs_deinit (struct mtk_vcodec_dev *vcodec_dev);#else -static inline void mtk_vcodec_dbgfs_create (struct mtk_vcodec_ctx *ctx) +static inline void mtk_vcodec_dbgfs_create (struct mtk_vcodec_dec_ctx *ctx) { }
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.c +30 -30
235 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec.h +6 -4
@@ -11,6 +11,8 @@#include <media/videobuf2-core.h> #include <media/v4l2-mem2mem.h> +#include "mtk_vcodec_dec_drv.h" +#define VCODEC_DEC_ALIGNED_64 64#define VCODEC_CAPABILITY_4K_DISABLED 0x10#define VCODEC_DEC_4K_CODED_WIDTH 4096U
@@ -78,12 +80,12 @@ extern const struct mtk_vcodec_dec_pdata mtk_vdec_single_core_pdata;* mtk_vdec_lock get decoder hw lock and set curr_ctx * to ctx instance that get lock */ -void mtk_vdec_unlock (struct mtk_vcodec_ctx *ctx); -void mtk_vdec_lock (struct mtk_vcodec_ctx *ctx); +void mtk_vdec_unlock (struct mtk_vcodec_dec_ctx *ctx); +void mtk_vdec_lock (struct mtk_vcodec_dec_ctx *ctx);int mtk_vcodec_dec_queue_init (void *priv,struct vb2_queue *src_vq,struct vb2_queue *dst_vq); -void mtk_vcodec_dec_set_default_params (struct mtk_vcodec_ctx *ctx); -void mtk_vcodec_dec_release (struct mtk_vcodec_ctx *ctx); +void mtk_vcodec_dec_set_default_params (struct mtk_vcodec_dec_ctx *ctx); +void mtk_vcodec_dec_release (struct mtk_vcodec_dec_ctx *ctx);/* * VB2 ops
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.c +5 -5
@@ -25,7 +25,7 @@#include "mtk_vcodec_util.h" #include "mtk_vcodec_fw.h" -static int mtk_vcodec_get_hw_count (struct mtk_vcodec_ctx *ctx,struct mtk_vcodec_dev *dev) +static int mtk_vcodec_get_hw_count (struct mtk_vcodec_dec_ctx *ctx,struct mtk_vcodec_dev *dev) {switch (dev->vdec_pdata->hw_arch) {case MTK_VDEC_PURE_SINGLE_CORE :
@@ -41,7 +41,7 @@ static int mtk_vcodec_get_hw_count(struct mtk_vcodec_ctx *ctx, struct mtk_vcodecstatic irqreturn_t mtk_vcodec_dec_irq_handler (int irq,void *priv) {struct mtk_vcodec_dev *dev = priv; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;u32 cg_status =0 ;unsigned int dec_done_status =0 ; void __iomem *vdec_misc_addr = dev->reg_base[VDEC_MISC] +
@@ -68,7 +68,7 @@ static irqreturn_t mtk_vcodec_dec_irq_handler(int irq, void *priv)writel ((readl (vdec_misc_addr) & ~VDEC_IRQ_CLR ), dev->reg_base[VDEC_MISC ] +VDEC_IRQ_CFG_REG ); -wake_up_ctx (ctx,MTK_INST_IRQ_RECEIVED ,0 ); +wake_up_dec_ctx (ctx,MTK_INST_IRQ_RECEIVED ,0 );mtk_v4l2_vdec_dbg (3 , ctx,"wake up ctx %d, dec_done_status=%x" , ctx->id, dec_done_status);
@@ -137,7 +137,7 @@ static int mtk_vcodec_init_dec_resources(struct mtk_vcodec_dev *dev)static int fops_vcodec_open (struct file *file) {struct mtk_vcodec_dev *dev =video_drvdata (file); -struct mtk_vcodec_ctx *ctx =NULL ; +struct mtk_vcodec_dec_ctx *ctx =NULL ;int ret =0 , i, hw_count;struct vb2_queue *src_vq;
@@ -234,7 +234,7 @@ static int fops_vcodec_open(struct file *file)static int fops_vcodec_release (struct file *file) {struct mtk_vcodec_dev *dev =video_drvdata (file); -struct mtk_vcodec_ctx *ctx =fh_to_ctx (file->private_data); +struct mtk_vcodec_dec_ctx *ctx =fh_to_dec_ctx (file->private_data);mtk_v4l2_vdec_dbg (0 , ctx,"[%d] decoder" , ctx->id);mutex_lock (&dev->dev_mutex);
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_drv.h new file +158 -0
158 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.c +2 -2
@@ -66,7 +66,7 @@ static int mtk_vdec_hw_prob_done(struct mtk_vcodec_dev *vdec_dev)static irqreturn_t mtk_vdec_hw_irq_handler (int irq,void *priv) {struct mtk_vdec_hw_dev *dev = priv; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;u32 cg_status;unsigned int dec_done_status; void __iomem *vdec_misc_addr = dev->reg_base[VDEC_HW_MISC] +
@@ -90,7 +90,7 @@ static irqreturn_t mtk_vdec_hw_irq_handler(int irq, void *priv)writel (dec_done_status |VDEC_IRQ_CFG , vdec_misc_addr);writel (dec_done_status & ~VDEC_IRQ_CLR , vdec_misc_addr); -wake_up_ctx (ctx,MTK_INST_IRQ_RECEIVED , dev->hw_idx); +wake_up_dec_ctx (ctx,MTK_INST_IRQ_RECEIVED , dev->hw_idx);mtk_v4l2_vdec_dbg (3 , ctx,"wake up ctx %d, dec_done_status=%x" , ctx->id, dec_done_status);
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_hw.h +1 -1
@@ -48,7 +48,7 @@ struct mtk_vdec_hw_dev {struct mtk_vcodec_dev *main_dev;void __iomem *reg_base[VDEC_HW_MAX ]; -struct mtk_vcodec_ctx *curr_ctx; +struct mtk_vcodec_dec_ctx *curr_ctx;int dec_irq;struct mtk_vcodec_pm pm;
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.c +4 -4
@@ -143,7 +143,7 @@ static void mtk_vcodec_dec_disable_irq(struct mtk_vcodec_dev *vdec_dev, int hw_i } } -static void mtk_vcodec_load_racing_info (struct mtk_vcodec_ctx *ctx) +static void mtk_vcodec_load_racing_info (struct mtk_vcodec_dec_ctx *ctx) {void __iomem *vdec_racing_addr;int j;
@@ -157,7 +157,7 @@ static void mtk_vcodec_load_racing_info(struct mtk_vcodec_ctx *ctx)mutex_unlock (&ctx->dev->dec_racing_info_mutex); } -static void mtk_vcodec_record_racing_info (struct mtk_vcodec_ctx *ctx) +static void mtk_vcodec_record_racing_info (struct mtk_vcodec_dec_ctx *ctx) {void __iomem *vdec_racing_addr;int j;
@@ -231,7 +231,7 @@ static void mtk_vcodec_dec_child_dev_off(struct mtk_vcodec_dev *vdec_dev, } } -void mtk_vcodec_dec_enable_hardware (struct mtk_vcodec_ctx *ctx,int hw_idx) +void mtk_vcodec_dec_enable_hardware (struct mtk_vcodec_dec_ctx *ctx,int hw_idx) {mutex_lock (&ctx->dev->dec_mutex[hw_idx]);
@@ -247,7 +247,7 @@ void mtk_vcodec_dec_enable_hardware(struct mtk_vcodec_ctx *ctx, int hw_idx) }EXPORT_SYMBOL_GPL (mtk_vcodec_dec_enable_hardware); -void mtk_vcodec_dec_disable_hardware (struct mtk_vcodec_ctx *ctx,int hw_idx) +void mtk_vcodec_dec_disable_hardware (struct mtk_vcodec_dec_ctx *ctx,int hw_idx) {if (IS_VDEC_INNER_RACING (ctx->dev->dec_capability))mtk_vcodec_record_racing_info (ctx);
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_pm.h +2 -2
@@ -11,7 +11,7 @@int mtk_vcodec_init_dec_clk (struct platform_device *pdev,struct mtk_vcodec_pm *pm); -void mtk_vcodec_dec_enable_hardware (struct mtk_vcodec_ctx *ctx,int hw_idx); -void mtk_vcodec_dec_disable_hardware (struct mtk_vcodec_ctx *ctx,int hw_idx); +void mtk_vcodec_dec_enable_hardware (struct mtk_vcodec_dec_ctx *ctx,int hw_idx); +void mtk_vcodec_dec_disable_hardware (struct mtk_vcodec_dec_ctx *ctx,int hw_idx);#endif /* _MTK_VCODEC_DEC_PM_H_ */
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateful.c +14 -14
@@ -55,7 +55,7 @@ static const unsigned int num_supported_formats =* Note the buffers returned from codec driver may still be in driver's * reference list. */ -static struct vb2_buffer *get_display_buffer (struct mtk_vcodec_ctx *ctx) +static struct vb2_buffer *get_display_buffer (struct mtk_vcodec_dec_ctx *ctx) {struct vdec_fb *disp_frame_buffer =NULL ;struct mtk_video_dec_buf *dstbuf;
@@ -98,7 +98,7 @@ static struct vb2_buffer *get_display_buffer(struct mtk_vcodec_ctx *ctx)* previous sps/pps/resolution change decode, or do nothing if user * space still owns this buffer */ -static struct vb2_buffer *get_free_buffer (struct mtk_vcodec_ctx *ctx) +static struct vb2_buffer *get_free_buffer (struct mtk_vcodec_dec_ctx *ctx) {struct mtk_video_dec_buf *dstbuf;struct vdec_fb *free_frame_buffer =NULL ;
@@ -173,19 +173,19 @@ static struct vb2_buffer *get_free_buffer(struct mtk_vcodec_ctx *ctx)return &vb->vb2_buf; } -static void clean_display_buffer (struct mtk_vcodec_ctx *ctx) +static void clean_display_buffer (struct mtk_vcodec_dec_ctx *ctx) {while (get_display_buffer (ctx)) ; } -static void clean_free_buffer (struct mtk_vcodec_ctx *ctx) +static void clean_free_buffer (struct mtk_vcodec_dec_ctx *ctx) {while (get_free_buffer (ctx)) ; } -static void mtk_vdec_queue_res_chg_event (struct mtk_vcodec_ctx *ctx) +static void mtk_vdec_queue_res_chg_event (struct mtk_vcodec_dec_ctx *ctx) {static const struct v4l2_event ev_src_ch = { .type =V4L2_EVENT_SOURCE_CHANGE ,
@@ -196,7 +196,7 @@ static void mtk_vdec_queue_res_chg_event(struct mtk_vcodec_ctx *ctx)v4l2_event_queue_fh (&ctx->fh, &ev_src_ch); } -static int mtk_vdec_flush_decoder (struct mtk_vcodec_ctx *ctx) +static int mtk_vdec_flush_decoder (struct mtk_vcodec_dec_ctx *ctx) {bool res_chg;int ret;
@@ -211,7 +211,7 @@ static int mtk_vdec_flush_decoder(struct mtk_vcodec_ctx *ctx)return 0 ; } -static void mtk_vdec_update_fmt (struct mtk_vcodec_ctx *ctx, +static void mtk_vdec_update_fmt (struct mtk_vcodec_dec_ctx *ctx,unsigned int pixelformat) {const struct mtk_video_fmt *fmt;
@@ -232,7 +232,7 @@ static void mtk_vdec_update_fmt(struct mtk_vcodec_ctx *ctx,mtk_v4l2_vdec_err (ctx,"Cannot get fourcc(%d), using init value" , pixelformat); } -static int mtk_vdec_pic_info_update (struct mtk_vcodec_ctx *ctx) +static int mtk_vdec_pic_info_update (struct mtk_vcodec_dec_ctx *ctx) {unsigned int dpbsize =0 ;int ret;
@@ -277,8 +277,8 @@ static int mtk_vdec_pic_info_update(struct mtk_vcodec_ctx *ctx)static void mtk_vdec_worker (struct work_struct *work) { -struct mtk_vcodec_ctx *ctx = - container_of(work, struct mtk_vcodec_ctx, decode_work); +struct mtk_vcodec_dec_ctx *ctx = + container_of(work, struct mtk_vcodec_dec_ctx, decode_work);struct mtk_vcodec_dev *dev = ctx->dev;struct vb2_v4l2_buffer *src_buf, *dst_buf;struct mtk_vcodec_mem buf;
@@ -420,7 +420,7 @@ static void vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb)bool res_chg = false;int ret;unsigned int dpbsize =1 , i; -struct mtk_vcodec_ctx *ctx =vb2_get_drv_priv (vb->vb2_queue); +struct mtk_vcodec_dec_ctx *ctx =vb2_get_drv_priv (vb->vb2_queue);struct vb2_v4l2_buffer *vb2_v4l2;struct mtk_q_data *dst_q_data;
@@ -528,7 +528,7 @@ static void vb2ops_vdec_stateful_buf_queue(struct vb2_buffer *vb)static int mtk_vdec_g_v_ctrl (struct v4l2_ctrl *ctrl) { -struct mtk_vcodec_ctx *ctx =ctrl_to_ctx (ctrl); +struct mtk_vcodec_dec_ctx *ctx =ctrl_to_dec_ctx (ctrl);int ret =0 ;switch (ctrl->id) {
@@ -550,7 +550,7 @@ static const struct v4l2_ctrl_ops mtk_vcodec_dec_ctrl_ops = { .g_volatile_ctrl = mtk_vdec_g_v_ctrl, }; -static int mtk_vcodec_dec_ctrls_setup (struct mtk_vcodec_ctx *ctx) +static int mtk_vcodec_dec_ctrls_setup (struct mtk_vcodec_dec_ctx *ctx) {struct v4l2_ctrl *ctrl;
@@ -581,7 +581,7 @@ static int mtk_vcodec_dec_ctrls_setup(struct mtk_vcodec_ctx *ctx)return 0 ; } -static void mtk_init_vdec_params (struct mtk_vcodec_ctx *ctx) +static void mtk_init_vdec_params (struct mtk_vcodec_dec_ctx *ctx) {unsigned int i;
drivers/media/platform/mediatek/vcodec/mtk_vcodec_dec_stateless.c +11 -11
@@ -218,7 +218,7 @@ static const struct v4l2_frmsize_stepwise stepwise_fhd = { .step_height = 16 }; -static void mtk_vdec_stateless_cap_to_disp (struct mtk_vcodec_ctx *ctx,int error, +static void mtk_vdec_stateless_cap_to_disp (struct mtk_vcodec_dec_ctx *ctx,int error,struct media_request *src_buf_req) {struct vb2_v4l2_buffer *vb2_dst;
@@ -242,7 +242,7 @@ static void mtk_vdec_stateless_cap_to_disp(struct mtk_vcodec_ctx *ctx, int errorv4l2_ctrl_request_complete (src_buf_req, &ctx->ctrl_hdl); } -static struct vdec_fb *vdec_get_cap_buffer (struct mtk_vcodec_ctx *ctx) +static struct vdec_fb *vdec_get_cap_buffer (struct mtk_vcodec_dec_ctx *ctx) {struct mtk_video_dec_buf *framebuf;struct vb2_v4l2_buffer *vb2_v4l2;
@@ -279,15 +279,15 @@ static struct vdec_fb *vdec_get_cap_buffer(struct mtk_vcodec_ctx *ctx)static void vb2ops_vdec_buf_request_complete (struct vb2_buffer *vb) { -struct mtk_vcodec_ctx *ctx =vb2_get_drv_priv (vb->vb2_queue); +struct mtk_vcodec_dec_ctx *ctx =vb2_get_drv_priv (vb->vb2_queue);v4l2_ctrl_request_complete (vb->req_obj.req, &ctx->ctrl_hdl); }static void mtk_vdec_worker (struct work_struct *work) { -struct mtk_vcodec_ctx *ctx = - container_of(work, struct mtk_vcodec_ctx, decode_work); +struct mtk_vcodec_dec_ctx *ctx = + container_of(work, struct mtk_vcodec_dec_ctx, decode_work);struct mtk_vcodec_dev *dev = ctx->dev;struct vb2_v4l2_buffer *vb2_v4l2_src;struct vb2_buffer *vb2_src;
@@ -362,7 +362,7 @@ static void mtk_vdec_worker(struct work_struct *work)static void vb2ops_vdec_stateless_buf_queue (struct vb2_buffer *vb) { -struct mtk_vcodec_ctx *ctx =vb2_get_drv_priv (vb->vb2_queue); +struct mtk_vcodec_dec_ctx *ctx =vb2_get_drv_priv (vb->vb2_queue);struct vb2_v4l2_buffer *vb2_v4l2 =to_vb2_v4l2_buffer (vb); mtk_v4l2_vdec_dbg(3, ctx, "[%d] (%d) id=%d, vb=%p", ctx->id, vb->vb2_queue->type,
@@ -383,14 +383,14 @@ static void vb2ops_vdec_stateless_buf_queue(struct vb2_buffer *vb) } } -static int mtk_vdec_flush_decoder (struct mtk_vcodec_ctx *ctx) +static int mtk_vdec_flush_decoder (struct mtk_vcodec_dec_ctx *ctx) {bool res_chg;return vdec_if_decode (ctx,NULL ,NULL , &res_chg); } -static int mtk_vcodec_dec_ctrls_setup (struct mtk_vcodec_ctx *ctx) +static int mtk_vcodec_dec_ctrls_setup (struct mtk_vcodec_dec_ctx *ctx) {unsigned int i;
@@ -442,7 +442,7 @@ const struct media_device_ops mtk_vcodec_media_ops = { };static void mtk_vcodec_add_formats (unsigned int fourcc, -struct mtk_vcodec_ctx *ctx) +struct mtk_vcodec_dec_ctx *ctx) {struct mtk_vcodec_dev *dev = ctx->dev;const struct mtk_vcodec_dec_pdata *pdata = dev->vdec_pdata;
@@ -483,7 +483,7 @@ static void mtk_vcodec_add_formats(unsigned int fourcc, count_formats, ctx->dev->dec_capability); } -static void mtk_vcodec_get_supported_formats (struct mtk_vcodec_ctx *ctx) +static void mtk_vcodec_get_supported_formats (struct mtk_vcodec_dec_ctx *ctx) {int cap_format_count =0 , out_format_count =0 ;
@@ -526,7 +526,7 @@ static void mtk_vcodec_get_supported_formats(struct mtk_vcodec_ctx *ctx) mtk_video_formats[cap_format_count + out_format_count -1 ]; } -static void mtk_init_vdec_params (struct mtk_vcodec_ctx *ctx) +static void mtk_init_vdec_params (struct mtk_vcodec_dec_ctx *ctx) {struct vb2_queue *src_vq;
drivers/media/platform/mediatek/vcodec/mtk_vcodec_drv.h +11 -258
331 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.c +39 -39
306 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc.h +7 -5
@@ -11,6 +11,8 @@#include <media/videobuf2-core.h> #include <media/v4l2-mem2mem.h> +#include "mtk_vcodec_enc_drv.h" +#define MTK_VENC_IRQ_STATUS_SPS 0x1#define MTK_VENC_IRQ_STATUS_PPS 0x2#define MTK_VENC_IRQ_STATUS_FRM 0x4
@@ -39,12 +41,12 @@ struct mtk_video_enc_buf {extern const struct v4l2_ioctl_ops mtk_venc_ioctl_ops;extern const struct v4l2_m2m_ops mtk_venc_m2m_ops; -int mtk_venc_unlock (struct mtk_vcodec_ctx *ctx); -int mtk_venc_lock (struct mtk_vcodec_ctx *ctx); +int mtk_venc_unlock (struct mtk_vcodec_enc_ctx *ctx); +int mtk_venc_lock (struct mtk_vcodec_enc_ctx *ctx);int mtk_vcodec_enc_queue_init (void *priv,struct vb2_queue *src_vq,struct vb2_queue *dst_vq); -void mtk_vcodec_enc_release (struct mtk_vcodec_ctx *ctx); -int mtk_vcodec_enc_ctrls_setup (struct mtk_vcodec_ctx *ctx); -void mtk_vcodec_enc_set_default_params (struct mtk_vcodec_ctx *ctx); +void mtk_vcodec_enc_release (struct mtk_vcodec_enc_ctx *ctx); +int mtk_vcodec_enc_ctrls_setup (struct mtk_vcodec_enc_ctx *ctx); +void mtk_vcodec_enc_set_default_params (struct mtk_vcodec_enc_ctx *ctx);#endif /* _MTK_VCODEC_ENC_H_ */
drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.c +5 -5
@@ -86,13 +86,13 @@ static void clean_irq_status(unsigned int irq_status, void __iomem *addr)static irqreturn_t mtk_vcodec_enc_irq_handler (int irq,void *priv) {struct mtk_vcodec_dev *dev = priv; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_enc_ctx *ctx;unsigned long flags;void __iomem *addr;int core_id;spin_lock_irqsave (&dev->irqlock, flags); - ctx = dev->curr_ctx; + ctx = dev->curr_enc_ctx;spin_unlock_irqrestore (&dev->irqlock, flags); core_id = dev->venc_pdata->core_id;
@@ -110,14 +110,14 @@ static irqreturn_t mtk_vcodec_enc_irq_handler(int irq, void *priv)clean_irq_status (ctx->irq_status, addr); -wake_up_ctx (ctx,MTK_INST_IRQ_RECEIVED ,0 ); +wake_up_enc_ctx (ctx,MTK_INST_IRQ_RECEIVED ,0 );return IRQ_HANDLED ; }static int fops_vcodec_open (struct file *file) {struct mtk_vcodec_dev *dev =video_drvdata (file); -struct mtk_vcodec_ctx *ctx =NULL ; +struct mtk_vcodec_enc_ctx *ctx =NULL ;int ret =0 ;struct vb2_queue *src_vq;
@@ -204,7 +204,7 @@ static int fops_vcodec_open(struct file *file)static int fops_vcodec_release (struct file *file) {struct mtk_vcodec_dev *dev =video_drvdata (file); -struct mtk_vcodec_ctx *ctx =fh_to_ctx (file->private_data); +struct mtk_vcodec_enc_ctx *ctx =fh_to_enc_ctx (file->private_data);mtk_v4l2_venc_dbg (1 , ctx,"[%d] encoder" , ctx->id);mutex_lock (&dev->dev_mutex);
drivers/media/platform/mediatek/vcodec/mtk_vcodec_enc_drv.h new file +158 -0
158 lines not on this page · raw message
drivers/media/platform/mediatek/vcodec/mtk_vcodec_fw_vpu.c +26 -9
@@ -51,10 +51,25 @@ static void mtk_vcodec_vpu_release(struct mtk_vcodec_fw *fw)put_device (&fw->pdev->dev); } -static void mtk_vcodec_vpu_reset_handler (void *priv) +static void mtk_vcodec_vpu_reset_dec_handler (void *priv) {struct mtk_vcodec_dev *dev = priv; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx; + +dev_err (&dev->plat_dev->dev,"Watchdog timeout!!" ); + +mutex_lock (&dev->dev_mutex); +list_for_each_entry (ctx, &dev->ctx_list, list) { + ctx->state =MTK_STATE_ABORT ; +mtk_v4l2_vdec_dbg (0 , ctx,"[%d] Change to state MTK_STATE_ABORT" , ctx->id); + } +mutex_unlock (&dev->dev_mutex); +} + +static void mtk_vcodec_vpu_reset_enc_handler (void *priv) +{ +struct mtk_vcodec_dev *dev = priv; +struct mtk_vcodec_enc_ctx *ctx;dev_err (&dev->plat_dev->dev,"Watchdog timeout!!" );
@@ -84,14 +99,13 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(void *priv, enum mtk_vcodec_fw_usestruct mtk_vcodec_fw *fw;enum rst_id rst_id; -switch (fw_use) { -case ENCODER : +if (fw_use ==ENCODER ) { rst_id =VPU_RST_ENC ; -break ; -case DECODER : -default : + }else if (fw_use ==DECODER ) { rst_id =VPU_RST_DEC ; -break ; + }else { +pr_err ("Invalid fw_use %d (use a resonable fw id here)\n" , fw_use); +return ERR_PTR (-EINVAL ); } plat_dev = dev->plat_dev;
@@ -101,7 +115,10 @@ struct mtk_vcodec_fw *mtk_vcodec_fw_vpu_init(void *priv, enum mtk_vcodec_fw_usereturn ERR_PTR (-EINVAL ); } -vpu_wdt_reg_handler (fw_pdev, mtk_vcodec_vpu_reset_handler, dev, rst_id); +if (fw_use ==DECODER ) +vpu_wdt_reg_handler (fw_pdev, mtk_vcodec_vpu_reset_dec_handler, priv, rst_id); +else +vpu_wdt_reg_handler (fw_pdev, mtk_vcodec_vpu_reset_enc_handler, priv, rst_id); fw =devm_kzalloc (&plat_dev->dev,sizeof (*fw),GFP_KERNEL );if (!fw)
drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.c +25 -8
@@ -14,17 +14,34 @@int mtk_vcodec_wait_for_done_ctx (void *priv,int command,unsigned int timeout_ms,unsigned int hw_id) { -struct mtk_vcodec_ctx *ctx = priv; +int instance_type = *((int *)priv);long timeout_jiff, ret;int status =0 , ctx_id, ctx_type;int *ctx_int_cond, *ctx_int_type;wait_queue_head_t *ctx_queue; +struct platform_device *pdev; - ctx_id = ctx->id; - ctx_type = ctx->type; - ctx_int_cond = ctx->int_cond; - ctx_int_type = ctx->int_type; - ctx_queue = ctx->queue; +if (instance_type ==DECODER ) { +struct mtk_vcodec_dec_ctx *ctx; + ctx = priv; + + ctx_id = ctx->id; + ctx_type = ctx->type; + ctx_int_cond = ctx->int_cond; + ctx_int_type = ctx->int_type; + ctx_queue = ctx->queue; + pdev = ctx->dev->plat_dev; + }else { +struct mtk_vcodec_enc_ctx *ctx; + ctx = priv; + + ctx_id = ctx->id; + ctx_type = ctx->type; + ctx_int_cond = ctx->int_cond; + ctx_int_type = ctx->int_type; + ctx_queue = ctx->queue; + pdev = ctx->dev->plat_dev; + } timeout_jiff =msecs_to_jiffies (timeout_ms); ret = wait_event_interruptible_timeout(ctx_queue[hw_id],
@@ -33,12 +50,12 @@ int mtk_vcodec_wait_for_done_ctx(void *priv, int command, unsigned int timeout_mif (!ret) { status =-1 ;/* timeout */ -dev_err (&ctx->dev->plat_dev->dev,"[%d] cmd=%d, type=%d, dec timeout=%ums (%d %d)" , +dev_err (&pdev->dev,"[%d] cmd=%d, type=%d, dec timeout=%ums (%d %d)" , ctx_id, command, ctx_type, timeout_ms, ctx_int_cond[hw_id], ctx_int_type[hw_id]); }else if (-ERESTARTSYS == ret) { status =-1 ; -dev_err (&ctx->dev->plat_dev->dev,"[%d] cmd=%d, type=%d, dec inter fail (%d %d)" , +dev_err (&pdev->dev,"[%d] cmd=%d, type=%d, dec inter fail (%d %d)" , ctx_id, command, ctx_type, ctx_int_cond[hw_id], ctx_int_type[hw_id]); }
drivers/media/platform/mediatek/vcodec/mtk_vcodec_intr.h +2 -1
@@ -9,7 +9,8 @@#define MTK_INST_IRQ_RECEIVED 0x1 -struct mtk_vcodec_ctx ; +struct mtk_vcodec_dec_ctx ; +struct mtk_vcodec_enc_ctx ;/* timeout is ms */ int mtk_vcodec_wait_for_done_ctx(void *priv, int command, unsigned int timeout_ms,
drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.c +6 -6
@@ -34,7 +34,7 @@ EXPORT_SYMBOL(mtk_vcodec_get_reg_addr);int mtk_vcodec_mem_alloc (void *priv,struct mtk_vcodec_mem *mem) {unsigned long size = mem->size; -struct mtk_vcodec_ctx *ctx = priv; +struct mtk_vcodec_dec_ctx *ctx = priv;struct device *dev = &ctx->dev->plat_dev->dev; mem->va =dma_alloc_coherent (dev, size, &mem->dma_addr,GFP_KERNEL );
@@ -55,7 +55,7 @@ EXPORT_SYMBOL(mtk_vcodec_mem_alloc);void mtk_vcodec_mem_free (void *priv,struct mtk_vcodec_mem *mem) {unsigned long size = mem->size; -struct mtk_vcodec_ctx *ctx = priv; +struct mtk_vcodec_dec_ctx *ctx = priv;struct device *dev = &ctx->dev->plat_dev->dev;if (!mem->va) {
@@ -87,7 +87,7 @@ void *mtk_vcodec_get_hw_dev(struct mtk_vcodec_dev *dev, int hw_idx)EXPORT_SYMBOL (mtk_vcodec_get_hw_dev);void mtk_vcodec_set_curr_ctx (struct mtk_vcodec_dev *vdec_dev, -struct mtk_vcodec_ctx *ctx,int hw_idx) +struct mtk_vcodec_dec_ctx *ctx,int hw_idx) {unsigned long flags;struct mtk_vdec_hw_dev *subdev_dev;
@@ -108,11 +108,11 @@ void mtk_vcodec_set_curr_ctx(struct mtk_vcodec_dev *vdec_dev, }EXPORT_SYMBOL (mtk_vcodec_set_curr_ctx); -struct mtk_vcodec_ctx *mtk_vcodec_get_curr_ctx (struct mtk_vcodec_dev *vdec_dev, -unsigned int hw_idx) +struct mtk_vcodec_dec_ctx *mtk_vcodec_get_curr_ctx (struct mtk_vcodec_dev *vdec_dev, +unsigned int hw_idx) {unsigned long flags; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;struct mtk_vdec_hw_dev *subdev_dev;spin_lock_irqsave (&vdec_dev->irqlock, flags);
drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h +4 -4
@@ -22,7 +22,7 @@ struct mtk_vcodec_fb {dma_addr_t dma_addr; }; -struct mtk_vcodec_ctx ; +struct mtk_vcodec_dec_ctx ;struct mtk_vcodec_dev ;#undef pr_fmt
@@ -84,9 +84,9 @@ void __iomem *mtk_vcodec_get_reg_addr(void __iomem **reg_base, unsigned int reg_int mtk_vcodec_mem_alloc (void *priv,struct mtk_vcodec_mem *mem);void mtk_vcodec_mem_free (void *priv,struct mtk_vcodec_mem *mem);void mtk_vcodec_set_curr_ctx (struct mtk_vcodec_dev *vdec_dev, -struct mtk_vcodec_ctx *ctx,int hw_idx); -struct mtk_vcodec_ctx *mtk_vcodec_get_curr_ctx (struct mtk_vcodec_dev *vdec_dev, -unsigned int hw_idx); +struct mtk_vcodec_dec_ctx *ctx,int hw_idx); +struct mtk_vcodec_dec_ctx *mtk_vcodec_get_curr_ctx (struct mtk_vcodec_dev *vdec_dev, +unsigned int hw_idx);void *mtk_vcodec_get_hw_dev (struct mtk_vcodec_dev *dev,int hw_idx);#endif /* _MTK_VCODEC_UTIL_H_ */
drivers/media/platform/mediatek/vcodec/vdec/vdec_av1_req_lat_if.c +11 -11
@@ -706,7 +706,7 @@ struct vdec_av1_slice_pfc {* @seq: global picture sequence */ struct vdec_av1_slice_instance { -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;struct vdec_vpu_inst vpu;struct mtk_vcodec_mem iq_table;
@@ -756,7 +756,7 @@ static inline bool vdec_av1_slice_need_scale(u32 ref_width, u32 ref_height, (this_height <= (ref_height <<4 )); } -static void *vdec_av1_get_ctrl_ptr (struct mtk_vcodec_ctx *ctx,int id) +static void *vdec_av1_get_ctrl_ptr (struct mtk_vcodec_dec_ctx *ctx,int id) {struct v4l2_ctrl *ctrl =v4l2_ctrl_find (&ctx->ctrl_hdl, id);
@@ -769,7 +769,7 @@ static void *vdec_av1_get_ctrl_ptr(struct mtk_vcodec_ctx *ctx, int id)static int vdec_av1_slice_init_cdf_table (struct vdec_av1_slice_instance *instance) {u8 *remote_cdf_table; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;struct vdec_av1_slice_init_vsi *vsi;int ret;
@@ -800,7 +800,7 @@ static int vdec_av1_slice_init_cdf_table(struct vdec_av1_slice_instance *instancstatic int vdec_av1_slice_init_iq_table (struct vdec_av1_slice_instance *instance) {u8 *remote_iq_table; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;struct vdec_av1_slice_init_vsi *vsi;int ret;
@@ -937,7 +937,7 @@ static void vdec_av1_slice_setup_slot(struct vdec_av1_slice_instance *instance,static int vdec_av1_slice_alloc_working_buffer (struct vdec_av1_slice_instance *instance,struct vdec_av1_slice_vsi *vsi) { -struct mtk_vcodec_ctx *ctx = instance->ctx; +struct mtk_vcodec_dec_ctx *ctx = instance->ctx;enum vdec_av1_slice_resolution_level level;u32 max_sb_w, max_sb_h, max_w, max_h, w, h;int i, ret;
@@ -1020,7 +1020,7 @@ static int vdec_av1_slice_alloc_working_buffer(struct vdec_av1_slice_instance *istatic void vdec_av1_slice_free_working_buffer (struct vdec_av1_slice_instance *instance) { -struct mtk_vcodec_ctx *ctx = instance->ctx; +struct mtk_vcodec_dec_ctx *ctx = instance->ctx;int i;for (i =0 ; i <ARRAY_SIZE (instance->mv); i++)
@@ -1864,7 +1864,7 @@ static int vdec_av1_slice_update_core(struct vdec_av1_slice_instance *instance,return 0 ; } -static int vdec_av1_slice_init (struct mtk_vcodec_ctx *ctx) +static int vdec_av1_slice_init (struct mtk_vcodec_dec_ctx *ctx) {struct vdec_av1_slice_instance *instance;struct vdec_av1_slice_init_vsi *vsi;
@@ -1962,7 +1962,7 @@ static int vdec_av1_slice_flush(void *h_vdec, struct mtk_vcodec_mem *bs,static void vdec_av1_slice_get_pic_info (struct vdec_av1_slice_instance *instance) { -struct mtk_vcodec_ctx *ctx = instance->ctx; +struct mtk_vcodec_dec_ctx *ctx = instance->ctx;u32 data[3 ];mtk_vdec_debug (ctx,"w %u h %u\n" , ctx->picinfo.pic_w, ctx->picinfo.pic_h);
@@ -1988,7 +1988,7 @@ static inline void vdec_av1_slice_get_dpb_size(struct vdec_av1_slice_instance *istatic void vdec_av1_slice_get_crop_info (struct vdec_av1_slice_instance *instance,struct v4l2_rect *cr) { -struct mtk_vcodec_ctx *ctx = instance->ctx; +struct mtk_vcodec_dec_ctx *ctx = instance->ctx; cr->left =0 ; cr->top =0 ;
@@ -2028,7 +2028,7 @@ static int vdec_av1_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,struct vdec_lat_buf *lat_buf;struct vdec_av1_slice_pfc *pfc;struct vdec_av1_slice_vsi *vsi; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;int ret;if (!instance || !instance->ctx)
@@ -2128,7 +2128,7 @@ static int vdec_av1_slice_core_decode(struct vdec_lat_buf *lat_buf) {struct vdec_av1_slice_instance *instance;struct vdec_av1_slice_pfc *pfc; -struct mtk_vcodec_ctx *ctx =NULL ; +struct mtk_vcodec_dec_ctx *ctx =NULL ;struct vdec_fb *fb =NULL ;int ret = -EINVAL ;
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_if.c +3 -3
@@ -117,7 +117,7 @@ struct vdec_h264_vsi {/** * struct vdec_h264_inst - h264 decoder instance * @num_nalu : how many nalus be decoded -* @ctx : point to mtk_vcodec_ctx +* @ctx : point to mtk_vcodec_dec_ctx * @pred_buf : HW working predication buffer * @mv_buf : HW working motion vector buffer * @vpu : VPU instance
@@ -125,7 +125,7 @@ struct vdec_h264_vsi {*/ struct vdec_h264_inst {unsigned int num_nalu; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;struct mtk_vcodec_mem pred_buf;struct mtk_vcodec_mem mv_buf[H264_MAX_FB_NUM ];struct vdec_vpu_inst vpu;
@@ -266,7 +266,7 @@ static void get_dpb_size(struct vdec_h264_inst *inst, unsigned int *dpb_sz)mtk_vdec_debug (inst->ctx,"sz=%d" , *dpb_sz); } -static int vdec_h264_init (struct mtk_vcodec_ctx *ctx) +static int vdec_h264_init (struct mtk_vcodec_dec_ctx *ctx) {struct vdec_h264_inst *inst =NULL ;int err;
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_common.c +2 -2
@@ -33,7 +33,7 @@ void mtk_vdec_h264_get_ref_list(u8 *ref_list,memset (&ref_list[num_valid],0x20 ,32 - num_valid); } -void *mtk_vdec_h264_get_ctrl_ptr (struct mtk_vcodec_ctx *ctx,int id) +void *mtk_vdec_h264_get_ctrl_ptr (struct mtk_vcodec_dec_ctx *ctx,int id) {struct v4l2_ctrl *ctrl =v4l2_ctrl_find (&ctx->ctrl_hdl, id);
@@ -43,7 +43,7 @@ void *mtk_vdec_h264_get_ctrl_ptr(struct mtk_vcodec_ctx *ctx, int id)return ctrl->p_cur.p; } -void mtk_vdec_h264_fill_dpb_info (struct mtk_vcodec_ctx *ctx, +void mtk_vdec_h264_fill_dpb_info (struct mtk_vcodec_dec_ctx *ctx,struct slice_api_h264_decode_param *decode_params,struct mtk_h264_dpb_info *h264_dpb_info) {
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_common.h +2 -2
@@ -182,7 +182,7 @@ void mtk_vdec_h264_get_ref_list(u8 *ref_list,* * Return: returns CID ctrl address. */ -void *mtk_vdec_h264_get_ctrl_ptr (struct mtk_vcodec_ctx *ctx,int id); +void *mtk_vdec_h264_get_ctrl_ptr (struct mtk_vcodec_dec_ctx *ctx,int id);/** * mtk_vdec_h264_fill_dpb_info - get each CID contrl address.
@@ -191,7 +191,7 @@ void *mtk_vdec_h264_get_ctrl_ptr(struct mtk_vcodec_ctx *ctx, int id);* @decode_params: slice decode params * @h264_dpb_info: dpb buffer information */ -void mtk_vdec_h264_fill_dpb_info (struct mtk_vcodec_ctx *ctx, +void mtk_vdec_h264_fill_dpb_info (struct mtk_vcodec_dec_ctx *ctx,struct slice_api_h264_decode_param *decode_params,struct mtk_h264_dpb_info *h264_dpb_info);
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_if.c +4 -4
@@ -74,7 +74,7 @@ struct vdec_h264_vsi {/** * struct vdec_h264_slice_inst - h264 decoder instance * @num_nalu : how many nalus be decoded -* @ctx : point to mtk_vcodec_ctx +* @ctx : point to mtk_vcodec_dec_ctx * @pred_buf : HW working predication buffer * @mv_buf : HW working motion vector buffer * @vpu : VPU instance
@@ -84,7 +84,7 @@ struct vdec_h264_vsi {*/ struct vdec_h264_slice_inst {unsigned int num_nalu; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;struct mtk_vcodec_mem pred_buf;struct mtk_vcodec_mem mv_buf[H264_MAX_MV_NUM ];struct vdec_vpu_inst vpu;
@@ -220,7 +220,7 @@ static void free_mv_buf(struct vdec_h264_slice_inst *inst)static void get_pic_info (struct vdec_h264_slice_inst *inst,struct vdec_pic_info *pic) { -struct mtk_vcodec_ctx *ctx = inst->ctx; +struct mtk_vcodec_dec_ctx *ctx = inst->ctx; ctx->picinfo.buf_w =ALIGN (ctx->picinfo.pic_w,VCODEC_DEC_ALIGNED_64 ); ctx->picinfo.buf_h =ALIGN (ctx->picinfo.pic_h,VCODEC_DEC_ALIGNED_64 );
@@ -269,7 +269,7 @@ static void get_dpb_size(struct vdec_h264_slice_inst *inst, unsigned int *dpb_szmtk_vdec_debug (inst->ctx,"sz=%d" , *dpb_sz); } -static int vdec_h264_slice_init (struct mtk_vcodec_ctx *ctx) +static int vdec_h264_slice_init (struct mtk_vcodec_dec_ctx *ctx) {struct vdec_h264_slice_inst *inst;int err;
drivers/media/platform/mediatek/vcodec/vdec/vdec_h264_req_multi_if.c +5 -5
@@ -133,7 +133,7 @@ struct vdec_h264_slice_share_info {* struct vdec_h264_slice_inst - h264 decoder instance * * @slice_dec_num: how many picture be decoded -* @ctx: point to mtk_vcodec_ctx +* @ctx: point to mtk_vcodec_dec_ctx * @pred_buf: HW working predication buffer * @mv_buf: HW working motion vector buffer * @vpu: VPU instance
@@ -153,7 +153,7 @@ struct vdec_h264_slice_share_info {*/ struct vdec_h264_slice_inst {unsigned int slice_dec_num; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;struct mtk_vcodec_mem pred_buf;struct mtk_vcodec_mem mv_buf[H264_MAX_MV_NUM ];struct vdec_vpu_inst vpu;
@@ -344,7 +344,7 @@ static void vdec_h264_slice_free_mv_buf(struct vdec_h264_slice_inst *inst)static void vdec_h264_slice_get_pic_info (struct vdec_h264_slice_inst *inst) { -struct mtk_vcodec_ctx *ctx = inst->ctx; +struct mtk_vcodec_dec_ctx *ctx = inst->ctx;u32 data[3 ]; data[0 ] = ctx->picinfo.pic_w;
@@ -393,7 +393,7 @@ static void vdec_h264_slice_get_crop_info(struct vdec_h264_slice_inst *inst, cr->left, cr->top, cr->width, cr->height); } -static int vdec_h264_slice_init (struct mtk_vcodec_ctx *ctx) +static int vdec_h264_slice_init (struct mtk_vcodec_dec_ctx *ctx) {struct vdec_h264_slice_inst *inst;int err, vsi_size;
@@ -457,7 +457,7 @@ static int vdec_h264_slice_core_decode(struct vdec_lat_buf *lat_buf)u64 vdec_fb_va;u64 y_fb_dma, c_fb_dma;int err, timeout, i; -struct mtk_vcodec_ctx *ctx = lat_buf->ctx; +struct mtk_vcodec_dec_ctx *ctx = lat_buf->ctx;struct vdec_h264_slice_inst *inst = ctx->drv_handle;struct vb2_v4l2_buffer *vb2_v4l2;struct vdec_h264_slice_share_info *share_info = lat_buf->private_data;
drivers/media/platform/mediatek/vcodec/vdec/vdec_hevc_req_multi_if.c +8 -8
@@ -344,7 +344,7 @@ struct vdec_hevc_slice_share_info {* struct vdec_hevc_slice_inst - hevc decoder instance * * @slice_dec_num: how many picture be decoded -* @ctx: point to mtk_vcodec_ctx +* @ctx: point to mtk_vcodec_dec_ctx * @mv_buf: HW working motion vector buffer * @vpu: VPU instance * @vsi: vsi used for lat
@@ -359,7 +359,7 @@ struct vdec_hevc_slice_share_info {*/ struct vdec_hevc_slice_inst {unsigned int slice_dec_num; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;struct mtk_vcodec_mem mv_buf[HEVC_MAX_MV_NUM ];struct vdec_vpu_inst vpu;struct vdec_hevc_slice_vsi *vsi;
@@ -380,7 +380,7 @@ static unsigned int vdec_hevc_get_mv_buf_size(unsigned int width, unsigned int hreturn 64 * unit_size; } -static void *vdec_hevc_get_ctrl_ptr (struct mtk_vcodec_ctx *ctx,int id) +static void *vdec_hevc_get_ctrl_ptr (struct mtk_vcodec_dec_ctx *ctx,int id) {struct v4l2_ctrl *ctrl =v4l2_ctrl_find (&ctx->ctrl_hdl, id);
@@ -390,7 +390,7 @@ static void *vdec_hevc_get_ctrl_ptr(struct mtk_vcodec_ctx *ctx, int id)return ctrl->p_cur.p; } -static void vdec_hevc_fill_dpb_info (struct mtk_vcodec_ctx *ctx, +static void vdec_hevc_fill_dpb_info (struct mtk_vcodec_dec_ctx *ctx,struct slice_api_hevc_decode_param *decode_params,struct mtk_hevc_dpb_info *hevc_dpb_info) {
@@ -679,7 +679,7 @@ static void vdec_hevc_slice_free_mv_buf(struct vdec_hevc_slice_inst *inst)static void vdec_hevc_slice_get_pic_info (struct vdec_hevc_slice_inst *inst) { -struct mtk_vcodec_ctx *ctx = inst->ctx; +struct mtk_vcodec_dec_ctx *ctx = inst->ctx;u32 data[3 ]; data[0 ] = ctx->picinfo.pic_w;
@@ -798,7 +798,7 @@ static int vdec_hevc_slice_setup_core_buffer(struct vdec_hevc_slice_inst *inst, struct vdec_lat_buf *lat_buf) {struct mtk_vcodec_mem *mem; -struct mtk_vcodec_ctx *ctx = inst->ctx; +struct mtk_vcodec_dec_ctx *ctx = inst->ctx;struct vb2_v4l2_buffer *vb2_v4l2;struct vdec_fb *fb;u64 y_fb_dma, c_fb_dma;
@@ -853,7 +853,7 @@ static int vdec_hevc_slice_setup_core_buffer(struct vdec_hevc_slice_inst *inst,return 0 ; } -static int vdec_hevc_slice_init (struct mtk_vcodec_ctx *ctx) +static int vdec_hevc_slice_init (struct mtk_vcodec_dec_ctx *ctx) {struct vdec_hevc_slice_inst *inst;int err, vsi_size;
@@ -924,7 +924,7 @@ static void vdec_hevc_slice_deinit(void *h_vdec)static int vdec_hevc_slice_core_decode (struct vdec_lat_buf *lat_buf) {int err, timeout; -struct mtk_vcodec_ctx *ctx = lat_buf->ctx; +struct mtk_vcodec_dec_ctx *ctx = lat_buf->ctx;struct vdec_hevc_slice_inst *inst = ctx->drv_handle;struct vdec_hevc_slice_share_info *share_info = lat_buf->private_data;struct vdec_vpu_inst *vpu = &inst->vpu;
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_if.c +2 -2
@@ -160,7 +160,7 @@ struct vdec_vp8_inst {struct mtk_vcodec_mem working_buf;struct vdec_vp8_hw_reg_base reg_base;unsigned int frm_cnt; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;struct vdec_vpu_inst vpu;struct vdec_vp8_vsi *vsi; };
@@ -388,7 +388,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) +static int vdec_vp8_init (struct mtk_vcodec_dec_ctx *ctx) {struct vdec_vp8_inst *inst;int err;
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp8_req_if.c +5 -5
@@ -101,12 +101,12 @@ struct vdec_vp8_slice_inst {struct mtk_vcodec_mem wrap_y_buf;struct mtk_vcodec_mem wrap_c_buf;struct mtk_vcodec_mem vld_wrapper_buf; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;struct vdec_vpu_inst vpu;struct vdec_vp8_slice_vsi *vsi; }; -static void *vdec_vp8_slice_get_ctrl_ptr (struct mtk_vcodec_ctx *ctx,int id) +static void *vdec_vp8_slice_get_ctrl_ptr (struct mtk_vcodec_dec_ctx *ctx,int id) {struct v4l2_ctrl *ctrl =v4l2_ctrl_find (&ctx->ctrl_hdl, id);
@@ -118,7 +118,7 @@ static void *vdec_vp8_slice_get_ctrl_ptr(struct mtk_vcodec_ctx *ctx, int id)static void vdec_vp8_slice_get_pic_info (struct vdec_vp8_slice_inst *inst) { -struct mtk_vcodec_ctx *ctx = inst->ctx; +struct mtk_vcodec_dec_ctx *ctx = inst->ctx;unsigned int data[3 ]; data[0 ] = ctx->picinfo.pic_w;
@@ -233,7 +233,7 @@ static u64 vdec_vp8_slice_get_ref_by_ts(const struct v4l2_ctrl_vp8_frame *frame_static int vdec_vp8_slice_get_decode_parameters (struct vdec_vp8_slice_inst *inst) {const struct v4l2_ctrl_vp8_frame *frame_header; -struct mtk_vcodec_ctx *ctx = inst->ctx; +struct mtk_vcodec_dec_ctx *ctx = inst->ctx;struct vb2_queue *vq;struct vb2_buffer *vb;u64 referenct_ts;
@@ -272,7 +272,7 @@ static int vdec_vp8_slice_get_decode_parameters(struct vdec_vp8_slice_inst *instreturn 0 ; } -static int vdec_vp8_slice_init (struct mtk_vcodec_ctx *ctx) +static int vdec_vp8_slice_init (struct mtk_vcodec_dec_ctx *ctx) {struct vdec_vp8_slice_inst *inst;int err;
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_if.c +4 -4
@@ -196,7 +196,7 @@ struct vdec_vp9_inst {struct list_head fb_free_list;struct list_head fb_disp_list;struct vdec_fb *cur_fb; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;struct vdec_vpu_inst vpu;struct vdec_vp9_vsi *vsi;unsigned int total_frm_cnt;
@@ -531,7 +531,7 @@ static void vp9_swap_frm_bufs(struct vdec_vp9_inst *inst)static bool vp9_wait_dec_end (struct vdec_vp9_inst *inst) { -struct mtk_vcodec_ctx *ctx = inst->ctx; +struct mtk_vcodec_dec_ctx *ctx = inst->ctx; mtk_vcodec_wait_for_done_ctx(inst->ctx, MTK_INST_IRQ_RECEIVED,
@@ -543,7 +543,7 @@ static bool vp9_wait_dec_end(struct vdec_vp9_inst *inst)return false; } -static struct vdec_vp9_inst *vp9_alloc_inst (struct mtk_vcodec_ctx *ctx) +static struct vdec_vp9_inst *vp9_alloc_inst (struct mtk_vcodec_dec_ctx *ctx) {int result;struct mtk_vcodec_mem mem;
@@ -771,7 +771,7 @@ static void vdec_vp9_deinit(void *h_vdec)vp9_free_inst (inst); } -static int vdec_vp9_init (struct mtk_vcodec_ctx *ctx) +static int vdec_vp9_init (struct mtk_vcodec_dec_ctx *ctx) {struct vdec_vp9_inst *inst;
drivers/media/platform/mediatek/vcodec/vdec/vdec_vp9_req_lat_if.c +9 -9
@@ -445,7 +445,7 @@ struct vdec_vp9_slice_ref {* @counts_helper: counts table according to newest kernel spec */ struct vdec_vp9_slice_instance { -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;struct vdec_vpu_inst vpu;int seq;
@@ -506,7 +506,7 @@ static int vdec_vp9_slice_init_default_frame_ctx(struct vdec_vp9_slice_instance {struct vdec_vp9_slice_frame_ctx *remote_frame_ctx;struct vdec_vp9_slice_frame_ctx *frame_ctx; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;struct vdec_vp9_slice_init_vsi *vsi;int ret =0 ;
@@ -543,7 +543,7 @@ static int vdec_vp9_slice_init_default_frame_ctx(struct vdec_vp9_slice_instancestatic int vdec_vp9_slice_alloc_working_buffer (struct vdec_vp9_slice_instance *instance,struct vdec_vp9_slice_vsi *vsi) { -struct mtk_vcodec_ctx *ctx = instance->ctx; +struct mtk_vcodec_dec_ctx *ctx = instance->ctx;enum vdec_vp9_slice_resolution_level level;/* super blocks */ unsigned int max_sb_w;
@@ -635,7 +635,7 @@ static int vdec_vp9_slice_alloc_working_buffer(struct vdec_vp9_slice_instance *istatic void vdec_vp9_slice_free_working_buffer (struct vdec_vp9_slice_instance *instance) { -struct mtk_vcodec_ctx *ctx = instance->ctx; +struct mtk_vcodec_dec_ctx *ctx = instance->ctx;int i;for (i =0 ; i <ARRAY_SIZE (instance->mv); i++) {
@@ -1850,7 +1850,7 @@ static int vdec_vp9_slice_update_core(struct vdec_vp9_slice_instance *instance,return 0 ; } -static int vdec_vp9_slice_init (struct mtk_vcodec_ctx *ctx) +static int vdec_vp9_slice_init (struct mtk_vcodec_dec_ctx *ctx) {struct vdec_vp9_slice_instance *instance;struct vdec_vp9_slice_init_vsi *vsi;
@@ -1933,7 +1933,7 @@ static int vdec_vp9_slice_flush(void *h_vdec, struct mtk_vcodec_mem *bs,static void vdec_vp9_slice_get_pic_info (struct vdec_vp9_slice_instance *instance) { -struct mtk_vcodec_ctx *ctx = instance->ctx; +struct mtk_vcodec_dec_ctx *ctx = instance->ctx;unsigned int data[3 ];mtk_vdec_debug (instance->ctx,"w %u h %u\n" , ctx->picinfo.pic_w, ctx->picinfo.pic_h);
@@ -1984,7 +1984,7 @@ static int vdec_vp9_slice_single_decode(void *h_vdec, struct mtk_vcodec_mem *bs,struct vdec_vp9_slice_instance *instance = h_vdec;struct vdec_vp9_slice_pfc *pfc = &instance->sc_pfc;struct vdec_vp9_slice_vsi *vsi; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;int ret;if (!instance || !instance->ctx)
@@ -2042,7 +2042,7 @@ static int vdec_vp9_slice_lat_decode(void *h_vdec, struct mtk_vcodec_mem *bs,struct vdec_lat_buf *lat_buf;struct vdec_vp9_slice_pfc *pfc;struct vdec_vp9_slice_vsi *vsi; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;int ret;if (!instance || !instance->ctx)
@@ -2137,7 +2137,7 @@ static int vdec_vp9_slice_core_decode(struct vdec_lat_buf *lat_buf) {struct vdec_vp9_slice_instance *instance;struct vdec_vp9_slice_pfc *pfc; -struct mtk_vcodec_ctx *ctx =NULL ; +struct mtk_vcodec_dec_ctx *ctx =NULL ;struct vdec_fb *fb =NULL ;int ret = -EINVAL ;
drivers/media/platform/mediatek/vcodec/vdec_drv_base.h +1 -1
@@ -15,7 +15,7 @@ struct vdec_common_if {* @ctx : [in] mtk v4l2 context * @h_vdec : [out] driver handle */ -int (*init)(struct mtk_vcodec_ctx *ctx); +int (*init)(struct mtk_vcodec_dec_ctx *ctx);/** * (*decode)() - trigger decode
drivers/media/platform/mediatek/vcodec/vdec_drv_if.c +4 -4
@@ -14,7 +14,7 @@#include "vdec_drv_base.h" #include "mtk_vcodec_dec_pm.h" -int vdec_if_init (struct mtk_vcodec_ctx *ctx,unsigned int fourcc) +int vdec_if_init (struct mtk_vcodec_dec_ctx *ctx,unsigned int fourcc) {enum mtk_vdec_hw_arch hw_arch = ctx->dev->vdec_pdata->hw_arch;int ret =0 ;
@@ -68,7 +68,7 @@ int vdec_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)return ret; } -int vdec_if_decode (struct mtk_vcodec_ctx *ctx,struct mtk_vcodec_mem *bs, +int vdec_if_decode (struct mtk_vcodec_dec_ctx *ctx,struct mtk_vcodec_mem *bs,struct vdec_fb *fb,bool *res_chg) {int ret =0 ;
@@ -100,7 +100,7 @@ int vdec_if_decode(struct mtk_vcodec_ctx *ctx, struct mtk_vcodec_mem *bs,return ret; } -int vdec_if_get_param (struct mtk_vcodec_ctx *ctx,enum vdec_get_param_type type, +int vdec_if_get_param (struct mtk_vcodec_dec_ctx *ctx,enum vdec_get_param_type type,void *out) {int ret =0 ;
@@ -115,7 +115,7 @@ int vdec_if_get_param(struct mtk_vcodec_ctx *ctx, enum vdec_get_param_type type,return ret; } -void vdec_if_deinit (struct mtk_vcodec_ctx *ctx) +void vdec_if_deinit (struct mtk_vcodec_dec_ctx *ctx) {if (!ctx->drv_handle)return ;
drivers/media/platform/mediatek/vcodec/vdec_drv_if.h +4 -4
@@ -69,14 +69,14 @@ extern const struct vdec_common_if vdec_av1_slice_lat_if;* @ctx : [in] v4l2 context * @fourcc : [in] video format fourcc, V4L2_PIX_FMT_H264/VP8/VP9.. */ -int vdec_if_init (struct mtk_vcodec_ctx *ctx,unsigned int fourcc); +int vdec_if_init (struct mtk_vcodec_dec_ctx *ctx,unsigned int fourcc);/** * vdec_if_deinit() - deinitialize decode driver * @ctx : [in] v4l2 context * */ -void vdec_if_deinit (struct mtk_vcodec_ctx *ctx); +void vdec_if_deinit (struct mtk_vcodec_dec_ctx *ctx);/** * vdec_if_decode() - trigger decode
@@ -90,7 +90,7 @@ void vdec_if_deinit(struct mtk_vcodec_ctx *ctx);* * Return: 0 on success. -EIO on unrecoverable error. */ -int vdec_if_decode (struct mtk_vcodec_ctx *ctx,struct mtk_vcodec_mem *bs, +int vdec_if_decode (struct mtk_vcodec_dec_ctx *ctx,struct mtk_vcodec_mem *bs,struct vdec_fb *fb,bool *res_chg);/**
@@ -99,7 +99,7 @@ int vdec_if_decode(struct mtk_vcodec_ctx *ctx, struct mtk_vcodec_mem *bs,* @type : [in] input parameter type * @out : [out] buffer to store query result */ -int vdec_if_get_param (struct mtk_vcodec_ctx *ctx,enum vdec_get_param_type type, +int vdec_if_get_param (struct mtk_vcodec_dec_ctx *ctx,enum vdec_get_param_type type,void *out);#endif
drivers/media/platform/mediatek/vcodec/vdec_msg_queue.c +4 -4
@@ -199,7 +199,7 @@ bool vdec_msg_queue_wait_lat_buf_full(struct vdec_msg_queue *msg_queue) }void vdec_msg_queue_deinit (struct vdec_msg_queue *msg_queue, -struct mtk_vcodec_ctx *ctx) +struct mtk_vcodec_dec_ctx *ctx) {struct vdec_lat_buf *lat_buf;struct mtk_vcodec_mem *mem;
@@ -237,8 +237,8 @@ static void vdec_msg_queue_core_work(struct work_struct *work) {struct vdec_msg_queue *msg_queue = container_of(work, struct vdec_msg_queue, core_work); -struct mtk_vcodec_ctx *ctx = - container_of(msg_queue, struct mtk_vcodec_ctx, msg_queue); +struct mtk_vcodec_dec_ctx *ctx = + container_of(msg_queue, struct mtk_vcodec_dec_ctx, msg_queue);struct mtk_vcodec_dev *dev = ctx->dev;struct vdec_lat_buf *lat_buf;
@@ -278,7 +278,7 @@ static void vdec_msg_queue_core_work(struct work_struct *work) }int vdec_msg_queue_init (struct vdec_msg_queue *msg_queue, -struct mtk_vcodec_ctx *ctx,core_decode_cb_t core_decode, +struct mtk_vcodec_dec_ctx *ctx,core_decode_cb_t core_decode,int private_size) {struct vdec_lat_buf *lat_buf;
drivers/media/platform/mediatek/vcodec/vdec_msg_queue.h +5 -5
@@ -17,7 +17,7 @@#define NUM_BUFFER_COUNT 3struct vdec_lat_buf ; -struct mtk_vcodec_ctx ; +struct mtk_vcodec_dec_ctx ;struct mtk_vcodec_dev ;typedef int (*core_decode_cb_t )(struct vdec_lat_buf *lat_buf);
@@ -76,7 +76,7 @@ struct vdec_lat_buf {struct media_request *src_buf_req;void *private_data; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;core_decode_cb_t core_decode;struct list_head lat_list;struct list_head core_list;
@@ -119,7 +119,7 @@ struct vdec_msg_queue {struct vdec_lat_buf empty_lat_buf;wait_queue_head_t core_dec_done;int status; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx; };/**
@@ -132,7 +132,7 @@ struct vdec_msg_queue {* Return: returns 0 if init successfully, or fail. */ int vdec_msg_queue_init (struct vdec_msg_queue *msg_queue, -struct mtk_vcodec_ctx *ctx,core_decode_cb_t core_decode, +struct mtk_vcodec_dec_ctx *ctx,core_decode_cb_t core_decode,int private_size);/**
@@ -188,6 +188,6 @@ bool vdec_msg_queue_wait_lat_buf_full(struct vdec_msg_queue *msg_queue);* @ctx: v4l2 ctx */ void vdec_msg_queue_deinit (struct vdec_msg_queue *msg_queue, -struct mtk_vcodec_ctx *ctx); +struct mtk_vcodec_dec_ctx *ctx);#endif
drivers/media/platform/mediatek/vcodec/vdec_vpu_if.h +2 -2
@@ -9,7 +9,7 @@#include "mtk_vcodec_fw.h" -struct mtk_vcodec_ctx ; +struct mtk_vcodec_dec_ctx ;/** * struct vdec_vpu_inst - VPU instance for video codec
@@ -40,7 +40,7 @@ struct vdec_vpu_inst {uint32_t fw_abi_version;uint32_t inst_id;unsigned int signaled; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_dec_ctx *ctx;wait_queue_head_t wq;mtk_vcodec_ipi_handler handler;unsigned int codec_type;
drivers/media/platform/mediatek/vcodec/venc/venc_h264_if.c +6 -6
@@ -221,7 +221,7 @@ struct venc_h264_inst {struct venc_vpu_inst vpu_inst;struct venc_h264_vsi *vsi;struct venc_h264_vsi_34 *vsi_34; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_enc_ctx *ctx; };static inline u32 h264_read_reg (struct venc_h264_inst *inst,u32 addr)
@@ -409,7 +409,7 @@ static int h264_enc_alloc_work_buf(struct venc_h264_inst *inst, bool is_34bit)static unsigned int h264_enc_wait_venc_done (struct venc_h264_inst *inst) {unsigned int irq_status =0 ; -struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)inst->ctx; +struct mtk_vcodec_enc_ctx *ctx = (struct mtk_vcodec_enc_ctx *)inst->ctx;if (!mtk_vcodec_wait_for_done_ctx (ctx,MTK_INST_IRQ_RECEIVED ,WAIT_INTR_TIMEOUT_MS ,0 )) {
@@ -513,7 +513,7 @@ static int h264_encode_frame(struct venc_h264_inst *inst,unsigned int intra_period;unsigned int irq_status;struct venc_frame_info frame_info; -struct mtk_vcodec_ctx *ctx = inst->ctx; +struct mtk_vcodec_enc_ctx *ctx = inst->ctx;mtk_venc_debug (ctx,"frm_cnt = %d\n " , inst->frm_cnt);
@@ -582,7 +582,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) +static int h264_enc_init (struct mtk_vcodec_enc_ctx *ctx) {const bool is_ext =MTK_ENC_CTX_IS_EXT (ctx);int ret =0 ;
@@ -620,7 +620,7 @@ static int h264_enc_encode(void *handle, {int ret =0 ;struct venc_h264_inst *inst = (struct venc_h264_inst *)handle; -struct mtk_vcodec_ctx *ctx = inst->ctx; +struct mtk_vcodec_enc_ctx *ctx = inst->ctx;mtk_venc_debug (ctx,"opt %d ->" , opt);
@@ -750,7 +750,7 @@ static int h264_enc_set_param(void *handle, {int ret =0 ;struct venc_h264_inst *inst = (struct venc_h264_inst *)handle; -struct mtk_vcodec_ctx *ctx = inst->ctx; +struct mtk_vcodec_enc_ctx *ctx = inst->ctx;const bool is_34bit =MTK_ENC_IOVA_IS_34BIT (ctx);mtk_venc_debug (ctx,"->type=%d" , type);
drivers/media/platform/mediatek/vcodec/venc/venc_vp8_if.c +4 -4
@@ -129,7 +129,7 @@ struct venc_vp8_inst {unsigned int ts_mode;struct venc_vpu_inst vpu_inst;struct venc_vp8_vsi *vsi; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_enc_ctx *ctx; };static inline u32 vp8_enc_read_reg (struct venc_vp8_inst *inst,u32 addr)
@@ -209,7 +209,7 @@ static int vp8_enc_alloc_work_buf(struct venc_vp8_inst *inst)static unsigned int vp8_enc_wait_venc_done (struct venc_vp8_inst *inst) {unsigned int irq_status =0 ; -struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)inst->ctx; +struct mtk_vcodec_enc_ctx *ctx = (struct mtk_vcodec_enc_ctx *)inst->ctx;if (!mtk_vcodec_wait_for_done_ctx (ctx,MTK_INST_IRQ_RECEIVED ,WAIT_INTR_TIMEOUT_MS ,0 )) {
@@ -312,7 +312,7 @@ static int vp8_enc_encode_frame(struct venc_vp8_inst *inst,return ret; } -static int vp8_enc_init (struct mtk_vcodec_ctx *ctx) +static int vp8_enc_init (struct mtk_vcodec_enc_ctx *ctx) {int ret =0 ;struct venc_vp8_inst *inst;
@@ -346,7 +346,7 @@ static int vp8_enc_encode(void *handle, {int ret =0 ;struct venc_vp8_inst *inst = (struct venc_vp8_inst *)handle; -struct mtk_vcodec_ctx *ctx = inst->ctx; +struct mtk_vcodec_enc_ctx *ctx = inst->ctx;enable_irq (ctx->dev->enc_irq);
drivers/media/platform/mediatek/vcodec/venc_drv_base.h +1 -1
@@ -19,7 +19,7 @@ struct venc_common_if {* @ctx: [in] mtk v4l2 context * @handle: [out] driver handle */ -int (*init)(struct mtk_vcodec_ctx *ctx); +int (*init)(struct mtk_vcodec_enc_ctx *ctx);/** * (*encode)() - trigger encode
drivers/media/platform/mediatek/vcodec/venc_drv_if.c +7 -7
@@ -16,7 +16,7 @@#include "mtk_vcodec_enc.h" #include "mtk_vcodec_enc_pm.h" -int venc_if_init (struct mtk_vcodec_ctx *ctx,unsigned int fourcc) +int venc_if_init (struct mtk_vcodec_enc_ctx *ctx,unsigned int fourcc) {int ret =0 ;
@@ -40,8 +40,8 @@ int venc_if_init(struct mtk_vcodec_ctx *ctx, unsigned int fourcc)return ret; } -int venc_if_set_param (struct mtk_vcodec_ctx *ctx, -enum venc_set_param_type type,struct venc_enc_param *in) +int venc_if_set_param (struct mtk_vcodec_enc_ctx *ctx, +enum venc_set_param_type type,struct venc_enc_param *in) {int ret =0 ;
@@ -54,7 +54,7 @@ int venc_if_set_param(struct mtk_vcodec_ctx *ctx,return ret; } -int venc_if_encode (struct mtk_vcodec_ctx *ctx, +int venc_if_encode (struct mtk_vcodec_enc_ctx *ctx,enum venc_start_opt opt,struct venc_frm_buf *frm_buf,struct mtk_vcodec_mem *bs_buf,struct venc_done_result *result)
@@ -65,7 +65,7 @@ int venc_if_encode(struct mtk_vcodec_ctx *ctx,mtk_venc_lock (ctx);spin_lock_irqsave (&ctx->dev->irqlock, flags); - ctx->dev->curr_ctx = ctx; + ctx->dev->curr_enc_ctx = ctx;spin_unlock_irqrestore (&ctx->dev->irqlock, flags);mtk_vcodec_enc_clock_on (&ctx->dev->pm);
@@ -74,14 +74,14 @@ int venc_if_encode(struct mtk_vcodec_ctx *ctx,mtk_vcodec_enc_clock_off (&ctx->dev->pm);spin_lock_irqsave (&ctx->dev->irqlock, flags); - ctx->dev->curr_ctx =NULL ; + ctx->dev->curr_enc_ctx =NULL ;spin_unlock_irqrestore (&ctx->dev->irqlock, flags);mtk_venc_unlock (ctx);return ret; } -int venc_if_deinit (struct mtk_vcodec_ctx *ctx) +int venc_if_deinit (struct mtk_vcodec_enc_ctx *ctx) {int ret =0 ;
drivers/media/platform/mediatek/vcodec/venc_drv_if.h +4 -4
@@ -132,14 +132,14 @@ extern const struct venc_common_if venc_vp8_if;* @fourcc: encoder input format * Return: 0 if creating handle successfully, otherwise it is failed. */ -int venc_if_init (struct mtk_vcodec_ctx *ctx,unsigned int fourcc); +int venc_if_init (struct mtk_vcodec_enc_ctx *ctx,unsigned int fourcc);/* * venc_if_deinit - Release the driver handle * @ctx: device context * Return: 0 if releasing handle successfully, otherwise it is failed. */ -int venc_if_deinit (struct mtk_vcodec_ctx *ctx); +int venc_if_deinit (struct mtk_vcodec_enc_ctx *ctx);/* * venc_if_set_param - Set parameter to driver
@@ -148,7 +148,7 @@ int venc_if_deinit(struct mtk_vcodec_ctx *ctx);* @in: input parameter * Return: 0 if setting param successfully, otherwise it is failed. */ -int venc_if_set_param (struct mtk_vcodec_ctx *ctx, +int venc_if_set_param (struct mtk_vcodec_enc_ctx *ctx,enum venc_set_param_type type,struct venc_enc_param *in);
@@ -161,7 +161,7 @@ int venc_if_set_param(struct mtk_vcodec_ctx *ctx,* @result: encode result * Return: 0 if encoding frame successfully, otherwise it is failed. */ -int venc_if_encode(struct mtk_vcodec_ctx *ctx, +int venc_if_encode(struct mtk_vcodec_enc_ctx *ctx, enum venc_start_opt opt, struct venc_frm_buf *frm_buf, struct mtk_vcodec_mem *bs_buf,
drivers/media/platform/mediatek/vcodec/venc_vpu_if.h +1 -1
@@ -35,7 +35,7 @@ struct venc_vpu_inst {unsigned int inst_addr;void *vsi;int id; -struct mtk_vcodec_ctx *ctx; +struct mtk_vcodec_enc_ctx *ctx; };int vpu_enc_init (struct venc_vpu_inst *vpu);
Signature · 1 line
2.18.0