devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yunfei Dong (董云飞)" <Yunfei.Dong@mediatek.com>
To: "nhebert@chromium.org" <nhebert@chromium.org>,
	"wenst@chromium.org" <wenst@chromium.org>,
	"nfraprado@collabora.com" <nfraprado@collabora.com>,
	"benjamin.gaignard@collabora.com"
	<benjamin.gaignard@collabora.com>,
	"angelogioacchino.delregno@collabora.com" 
	<angelogioacchino.delregno@collabora.com>,
	"nicolas.dufresne@collabora.com" <nicolas.dufresne@collabora.com>,
	"hverkuil-cisco@xs4all.nl" <hverkuil-cisco@xs4all.nl>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mediatek@lists.infradead.org" 
	<linux-mediatek@lists.infradead.org>,
	"frkoenig@chromium.org" <frkoenig@chromium.org>,
	"stevecho@chromium.org" <stevecho@chromium.org>,
	"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"daniel@ffwll.ch" <daniel@ffwll.ch>,
	Project_Global_Chrome_Upstream_Group 
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"hsinyi@chromium.org" <hsinyi@chromium.org>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH v2,04/10] media: mediatek: vcodec: remove the dependency of debug log
Date: Thu, 8 Jun 2023 07:27:52 +0000	[thread overview]
Message-ID: <6bb7e4b283332f1b76c1550347cb245a57eee90b.camel@mediatek.com> (raw)
In-Reply-To: <ad28c125d9efca1f7e422fffe42dd56cef66b349.camel@collabora.com>

Hi Nicolas,

Thanks for your review.
On Wed, 2023-06-07 at 21:41 -0400, Nicolas Dufresne wrote:
>  	 
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>  Hi Yunfei,
> 
> Le mercredi 07 juin 2023 à 16:48 +0800, Yunfei Dong a écrit :
> > 'mtk_vcodec_debug' and 'mtk_vcodec_err' depends on 'mtk_vcodec_ctx'
> > to get the index of each instance, using the index directly instead
> > of with 'mtk_vcodec_ctx'.
> > 
> > Signed-off-by: Yunfei Dong <yunfei.dong@mediatek.com>
> > ---
> >  .../mediatek/vcodec/mtk_vcodec_util.h         |  26 ++-
> >  .../vcodec/vdec/vdec_av1_req_lat_if.c         | 105 +++++++-----
> >  .../mediatek/vcodec/vdec/vdec_h264_if.c       |  62 ++++---
> >  .../mediatek/vcodec/vdec/vdec_h264_req_if.c   |  39 +++--
> >  .../vcodec/vdec/vdec_h264_req_multi_if.c      |  80 +++++----
> >  .../vcodec/vdec/vdec_hevc_req_multi_if.c      |  67 ++++----
> >  .../mediatek/vcodec/vdec/vdec_vp8_if.c        |  54 ++++---
> >  .../mediatek/vcodec/vdec/vdec_vp8_req_if.c    |  46 +++---
> >  .../mediatek/vcodec/vdec/vdec_vp9_if.c        | 152 ++++++++++--
> ------
> >  .../vcodec/vdec/vdec_vp9_req_lat_if.c         |  84 ++++++----
> >  .../platform/mediatek/vcodec/vdec_vpu_if.c    |  59 ++++---
> >  .../mediatek/vcodec/venc/venc_h264_if.c       |  86 +++++-----
> >  .../mediatek/vcodec/venc/venc_vp8_if.c        |  48 +++---
> >  .../platform/mediatek/vcodec/venc_vpu_if.c    |  64 ++++----
> >  14 files changed, 565 insertions(+), 407 deletions(-)
> > 
> > diff --git
> a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h
> b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h
> > index ecb0bdf3a4f4..ddc12c3e2983 100644
> > --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h
> > +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_util.h
> > @@ -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(plat_dev, inst_id, 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,27 +45,24 @@ 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(plat_dev, inst_id, fmt,
> args...)                               \
> > +do
> {                                                                    
>         \
> > +if
> (mtk_vcodec_dbg)                                                     
> \
> > +dev_dbg(&(plat_dev)->dev, "[MTK_VCODEC][%d]: %s, %d " fmt "\n", \
> 
> At least in this patch, you systematically pass plat_dev as
> <something>->ctx->dev->plat_dev, which is quite long and verbose, any
> reason we
> can't just pass that <something> here ? We can follow the same
> structure path
> for both encoder/decoder ?
> 

In order to separate encode and decoder, need to define two different
struct mtk_vcodec_dec_ctx and struct mtk_vcodec_enc_ctx.

struct mtk_vcodec_ctx won't be used again, need to use platform device
to print dev_dbg and dev_err.

encoder and decoder using the same interface to print log message.

Best Regards,
Yunfei Dong
> > +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",\
> 
...snip...

  reply	other threads:[~2023-06-08  7:28 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07  8:48 [PATCH v2,0/10] media: mediatek: vcodec: separate encoder and decoder Yunfei Dong
2023-06-07  8:48 ` [PATCH v2,01/10] media: mediatek: vcodec: remove unused parameter Yunfei Dong
2023-06-07  8:48 ` [PATCH v2,02/10] media: mediatek: vcodec: align fw interface Yunfei Dong
2023-06-07  8:48 ` [PATCH v2,03/10] media: mediatek: vcodec: re-write shared interface Yunfei Dong
2023-06-07  8:48 ` [PATCH v2,04/10] media: mediatek: vcodec: remove the dependency of debug log Yunfei Dong
2023-06-08  1:41   ` Nicolas Dufresne
2023-06-08  7:27     ` Yunfei Dong (董云飞) [this message]
2023-06-08 13:11       ` Nicolas Dufresne
2023-06-08 14:06         ` AngeloGioacchino Del Regno
2023-06-08 15:17           ` Nicolas Dufresne
2023-06-11  2:09             ` Yunfei Dong (董云飞)
2023-06-14  9:17             ` Yunfei Dong (董云飞)
2023-06-14 11:50               ` AngeloGioacchino Del Regno
2023-06-07  8:48 ` [PATCH v2,05/10] mediatek: vcodec: replace pr_* with dev_* for v4l2 debug message Yunfei Dong
2023-06-07  8:48 ` [PATCH v2,06/10] mediatek: vcodec: separate struct mtk_vcodec_ctx Yunfei Dong
2023-06-07  8:48 ` [PATCH v2,07/10] mediatek: vcodec: separate struct mtk_vcodec_dev Yunfei Dong
2023-06-07  8:48 ` [PATCH v2,08/10] mediatek: vcodec: fix unreasonable parameter definition and style Yunfei Dong
2023-06-07  8:49 ` [PATCH v2,09/10] mediatek: vcodec: remove unused include header Yunfei Dong
2023-06-07  8:49 ` [PATCH v2,10/10] mediatek: vcodec: separete decoder and encoder Yunfei Dong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6bb7e4b283332f1b76c1550347cb245a57eee90b.camel@mediatek.com \
    --to=yunfei.dong@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=benjamin.gaignard@collabora.com \
    --cc=daniel@ffwll.ch \
    --cc=devicetree@vger.kernel.org \
    --cc=frkoenig@chromium.org \
    --cc=hsinyi@chromium.org \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=nfraprado@collabora.com \
    --cc=nhebert@chromium.org \
    --cc=nicolas.dufresne@collabora.com \
    --cc=stevecho@chromium.org \
    --cc=wenst@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).