[PATCH v1 06/10] drm/mediatek: add ETHDR support for MT8195

CK Hu ck.hu at mediatek.com
Wed Jul 21 22:25:41 PDT 2021


Hi, Nancy:

On Thu, 2021-07-22 at 09:32 +0800, Nancy.Lin wrote:
> Hi Chun-Kuang,
> 
> On Mon, 2021-07-19 at 07:56 +0800, Chun-Kuang Hu wrote:
> > Hi, Nancy:
> > 
> > Nancy.Lin <nancy.lin at mediatek.com> 於 2021年7月17日 週六 下午5:04寫道:
> > > 
> > > Add ETHDR module files:
> > > ETHDR is designed for HDR video and graphics conversion in the
> > > external
> > > display path. It handles multiple HDR input types and performs tone
> > > mapping, color space/color format conversion, and then combines
> > > different layers, output the required HDR or SDR signal to the
> > > subsequent display path.
> > > 
> > > Signed-off-by: Nancy.Lin <nancy.lin at mediatek.com>
> > > ---
> > >  drivers/gpu/drm/mediatek/Makefile           |   3 +-
> > >  drivers/gpu/drm/mediatek/mtk_disp_drv.h     |   8 +
> > >  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c |  11 +
> > >  drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h |   1 +
> > >  drivers/gpu/drm/mediatek/mtk_drm_drv.c      |   4 +
> > >  drivers/gpu/drm/mediatek/mtk_drm_drv.h      |   1 +
> > >  drivers/gpu/drm/mediatek/mtk_ethdr.c        | 537
> > > ++++++++++++++++++++
> > >  drivers/gpu/drm/mediatek/mtk_ethdr.h        |  20 +
> > >  8 files changed, 584 insertions(+), 1 deletion(-)
> > >  create mode 100644 drivers/gpu/drm/mediatek/mtk_ethdr.c
> > >  create mode 100644 drivers/gpu/drm/mediatek/mtk_ethdr.h
> > > 
> > > +
> > > +void mtk_ethdr_layer_on(struct device *dev, unsigned int idx,
> > > +                       struct cmdq_pkt *cmdq_pkt)
> > > +{
> > > +       struct mtk_ethdr *priv = dev_get_drvdata(dev);
> > > +       struct mtk_ethdr_comp *mixer = &priv-
> > > >ethdr_comp[ETHDR_MIXER];
> > > +
> > > +       dev_dbg(dev, "%s+ idx:%d", __func__, idx);
> > > +
> > > +       if (idx < 4)
> > > +               mtk_ddp_write_mask(cmdq_pkt, BIT(idx), &mixer-
> > > >cmdq_base,
> > > +                                  mixer->regs, MIX_SRC_CON,
> > > BIT(idx));
> > > +}
> > > +
> > > +void mtk_ethdr_layer_off(struct device *dev, unsigned int idx,
> > > +                        struct cmdq_pkt *cmdq_pkt)
> > > +{
> > > +       struct mtk_ethdr *priv = dev_get_drvdata(dev);
> > > +       struct mtk_ethdr_comp *mixer = &priv-
> > > >ethdr_comp[ETHDR_MIXER];
> > > +
> > > +       dev_dbg(dev, "%s+ idx:%d", __func__, idx);
> > > +
> > > +       switch (idx) {
> > > +       case 0:
> > > +               mtk_ddp_write_mask(cmdq_pkt, 0, &mixer->cmdq_base,
> > > +                                  mixer->regs, MIX_L0_SRC_SIZE,
> > > ~0);
> > > +               break;
> > > +       case 1:
> > > +               mtk_ddp_write_mask(cmdq_pkt, 0, &mixer->cmdq_base,
> > > +                                  mixer->regs, MIX_L1_SRC_SIZE,
> > > ~0);
> > > +               break;
> > > +       case 2:
> > > +               mtk_ddp_write_mask(cmdq_pkt, 0, &mixer->cmdq_base,
> > > +                                  mixer->regs, MIX_L2_SRC_SIZE,
> > > ~0);
> > > +               break;
> > > +       case 3:
> > > +               mtk_ddp_write_mask(cmdq_pkt, 0, &mixer->cmdq_base,
> > > +                                  mixer->regs, MIX_L3_SRC_SIZE,
> > > ~0);
> > > +               break;
> > > +       default:
> > > +               dev_dbg(dev, "%s Wrong layer ID\n", __func__);
> > > +               break;
> > > +       }
> > 
> > Why not just
> > 
> >                mtk_ddp_write_mask(cmdq_pkt, 0, &mixer->cmdq_base,
> >                                   mixer->regs, MIX_SRC_CON,
> > BIT(idx));
> > 
> 
> There are two modes in Mixer.
> 1. Background relay mode: all layers off
> 2. Normal mix mode: at least one layer on
> The timing of the two modes is different, so keep using the normal mix
> mode.
> Just set the layer region to 0 when the layer off.

layer_on() and layer_off() does different things. Comparing before turn
on a layer with after turn on->off a layer, the register setting are
different. I would like just restore the register. 

Regards,
CK

> 
> > > +}
> > > +




More information about the Linux-mediatek mailing list