lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1611811310.25395.4.camel@mtksdaap41>
Date:   Thu, 28 Jan 2021 13:21:50 +0800
From:   CK Hu <ck.hu@...iatek.com>
To:     Hsin-Yi Wang <hsinyi@...omium.org>
CC:     Mark Rutland <mark.rutland@....com>,
        Devicetree List <devicetree@...r.kernel.org>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        "David Airlie" <airlied@...ux.ie>,
        lkml <linux-kernel@...r.kernel.org>,
        dri-devel <dri-devel@...ts.freedesktop.org>,
        Yongqiang Niu <yongqiang.niu@...iatek.com>,
        <Project_Global_Chrome_Upstream_Group@...iatek.com>,
        "moderated list:ARM/Mediatek SoC support" 
        <linux-mediatek@...ts.infradead.org>,
        "Daniel Vetter" <daniel@...ll.ch>,
        Matthias Brugger <matthias.bgg@...il.com>,
        "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" 
        <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH v10 4/9] drm/mediatek: generalize mtk_dither_set()
 function

On Thu, 2021-01-28 at 13:09 +0800, Hsin-Yi Wang wrote:
> On Thu, Jan 28, 2021 at 12:39 PM CK Hu <ck.hu@...iatek.com> wrote:
> >
> > Hi, Hsin-Yi:
> >
> > On Wed, 2021-01-27 at 12:54 +0800, Hsin-Yi Wang wrote:
> > > There may be data structure other than mtk_ddp_comp_dev that would call
> > > mtk_dither_set(), so use regs as parameter instead of device.
> >
> > You does not change the interface of mtk_dither_set(). You move the
> > common part in mtk_dither_set() to a new function which could be called
> > by another caller.
> >
> > Regards,
> > CK.
> >
> Current mtk_dither_set() cast dev data to struct mtk_ddp_comp_dev. But
> mtk_disp_gamma in next patch would also call this function. But it's
> dev data is struct mtk_disp_gamma, which is different, so we can't
> cast to mtk_ddp_comp_dev. I separate the necessary parameters (regs,
> cmdq_reg) out, so both component dither and gamma can both call this
> separated function.

I know this. This patch looks good to me but the description would
confuse me.From the description, it seems that you modify the interface
of mtk_dither_set(). So please modify the description to be more clear.

Regards,
CK

> 
> This is similar to the mtk_gamma_set_common() in the next patch, which
> gamma and aal both used.
> 
> > >
> > > Signed-off-by: Hsin-Yi Wang <hsinyi@...omium.org>
> > > ---
> > >  drivers/gpu/drm/mediatek/mtk_disp_drv.h     |  4 ++++
> > >  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 25 +++++++++++++--------
> > >  2 files changed, 20 insertions(+), 9 deletions(-)
> > >
> > > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_drv.h b/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> > > index 46d199b7b4a29..c50d5fc9fd349 100644
> > > --- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> > > +++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> > > @@ -17,6 +17,10 @@ void mtk_color_config(struct device *dev, unsigned int w,
> > >                     unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
> > >  void mtk_color_start(struct device *dev);
> > >
> > > +void mtk_dither_set_common(void __iomem *regs, struct cmdq_client_reg *cmdq_reg,
> > > +                        unsigned int bpc, unsigned int CFG,
> > > +                        struct cmdq_pkt *cmdq_pkt);
> > > +
> > >  void mtk_dpi_start(struct device *dev);
> > >  void mtk_dpi_stop(struct device *dev);
> > >
> > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> > > index 7b5293429426d..53d25823a37cc 100644
> > > --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> > > +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> > > @@ -151,33 +151,40 @@ static void mtk_ddp_clk_disable(struct device *dev)
> > >       clk_disable_unprepare(priv->clk);
> > >  }
> > >
> > > -static void mtk_dither_set(struct device *dev, unsigned int bpc,
> > > -                 unsigned int CFG, struct cmdq_pkt *cmdq_pkt)
> > > -{
> > > -     struct mtk_ddp_comp_dev *priv = dev_get_drvdata(dev);
> > >
> > > +void mtk_dither_set_common(void __iomem *regs, struct cmdq_client_reg *cmdq_reg,
> > > +                        unsigned int bpc, unsigned int CFG, struct cmdq_pkt *cmdq_pkt)
> > > +{
> > >       /* If bpc equal to 0, the dithering function didn't be enabled */
> > >       if (bpc == 0)
> > >               return;
> > >
> > >       if (bpc >= MTK_MIN_BPC) {
> > > -             mtk_ddp_write(cmdq_pkt, 0, &priv->cmdq_reg, priv->regs, DISP_DITHER_5);
> > > -             mtk_ddp_write(cmdq_pkt, 0, &priv->cmdq_reg, priv->regs, DISP_DITHER_7);
> > > +             mtk_ddp_write(cmdq_pkt, 0, cmdq_reg, regs, DISP_DITHER_5);
> > > +             mtk_ddp_write(cmdq_pkt, 0, cmdq_reg, regs, DISP_DITHER_7);
> > >               mtk_ddp_write(cmdq_pkt,
> > >                             DITHER_LSB_ERR_SHIFT_R(MTK_MAX_BPC - bpc) |
> > >                             DITHER_ADD_LSHIFT_R(MTK_MAX_BPC - bpc) |
> > >                             DITHER_NEW_BIT_MODE,
> > > -                           &priv->cmdq_reg, priv->regs, DISP_DITHER_15);
> > > +                           cmdq_reg, regs, DISP_DITHER_15);
> > >               mtk_ddp_write(cmdq_pkt,
> > >                             DITHER_LSB_ERR_SHIFT_B(MTK_MAX_BPC - bpc) |
> > >                             DITHER_ADD_LSHIFT_B(MTK_MAX_BPC - bpc) |
> > >                             DITHER_LSB_ERR_SHIFT_G(MTK_MAX_BPC - bpc) |
> > >                             DITHER_ADD_LSHIFT_G(MTK_MAX_BPC - bpc),
> > > -                           &priv->cmdq_reg, priv->regs, DISP_DITHER_16);
> > > -             mtk_ddp_write(cmdq_pkt, DISP_DITHERING, &priv->cmdq_reg, priv->regs, CFG);
> > > +                           cmdq_reg, regs, DISP_DITHER_16);
> > > +             mtk_ddp_write(cmdq_pkt, DISP_DITHERING, cmdq_reg, regs, CFG);
> > >       }
> > >  }
> > >
> > > +static void mtk_dither_set(struct device *dev, unsigned int bpc,
> > > +                 unsigned int CFG, struct cmdq_pkt *cmdq_pkt)
> > > +{
> > > +     struct mtk_ddp_comp_dev *priv = dev_get_drvdata(dev);
> > > +
> > > +     mtk_dither_set_common(priv->regs, &priv->cmdq_reg, bpc, CFG, cmdq_pkt);
> > > +}
> > > +
> > >  static void mtk_od_config(struct device *dev, unsigned int w,
> > >                         unsigned int h, unsigned int vrefresh,
> > >                         unsigned int bpc, struct cmdq_pkt *cmdq_pkt)
> >
> 
> _______________________________________________
> Linux-mediatek mailing list
> Linux-mediatek@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-mediatek

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ