[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <cd08cc1ed6765970ba0ad8590bebf7de651e68e3.camel@mediatek.com>
Date: Wed, 14 Sep 2022 09:35:58 +0800
From: Jason-JH Lin <jason-jh.lin@...iatek.com>
To: AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Chun-Kuang Hu <chunkuang.hu@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Matthias Brugger <matthias.bgg@...il.com>
CC: CK Hu <ck.hu@...iatek.com>, Rex-BC Chen <rex-bc.chen@...iatek.com>,
"Singo Chang" <singo.chang@...iatek.com>,
<dri-devel@...ts.freedesktop.org>,
<linux-mediatek@...ts.infradead.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>,
<Project_Global_Chrome_Upstream_Group@...iatek.com>
Subject: Re: [PATCH v3 4/9] drm/mediatek: Add gamma support different
lut_size for other SoC
Hi Angelo,
Thanks for the reviews.
On Mon, 2022-09-12 at 12:24 +0200, AngeloGioacchino Del Regno wrote:
> Il 11/09/22 17:37, Jason-JH.Lin ha scritto:
> > 1. Add mtk_drm_gamma_get_lut_size() and remove MTK_LUT_SIZE macro.
> > 2. Add lut_size to gamma driver data for different SoC.
> >
> > Signed-off-by: Jason-JH.Lin <jason-jh.lin@...iatek.com>
> > ---
> > drivers/gpu/drm/mediatek/mtk_disp_drv.h | 1 +
> > drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 22
> > +++++++++++++++++++--
> > drivers/gpu/drm/mediatek/mtk_drm_crtc.c | 4 ++--
> > drivers/gpu/drm/mediatek/mtk_drm_crtc.h | 1 -
> > drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 9 +++++++++
> > 5 files changed, 32 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> > b/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> > index a83e5fbc8724..6a05bb56e693 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> > +++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h
> > @@ -51,6 +51,7 @@ void mtk_gamma_clk_disable(struct device *dev);
> > void mtk_gamma_config(struct device *dev, unsigned int w,
> > unsigned int h, unsigned int vrefresh,
> > unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
> > +unsigned int mtk_gamma_get_lut_size(struct device *dev);
> > void mtk_gamma_set(struct device *dev, struct drm_crtc_state
> > *state);
> > void mtk_gamma_set_common(struct device *dev, void __iomem *regs,
> > struct drm_crtc_state *state);
> > void mtk_gamma_start(struct device *dev);
> > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> > b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> > index f54a6a618348..e69d0b205b9a 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> > @@ -24,10 +24,12 @@
> > #define DISP_GAMMA_LUT 0x0700
> >
> > #define LUT_10BIT_MASK 0x03ff
> > +#define LUT_SIZE_DEFAULT 512 /* for setting
> > gamma lut from AAL */
> >
> > struct mtk_disp_gamma_data {
> > bool has_dither;
> > bool lut_diff;
> > + u16 lut_size;
> > };
> >
> > /*
> > @@ -54,18 +56,32 @@ void mtk_gamma_clk_disable(struct device *dev)
> > clk_disable_unprepare(gamma->clk);
> > }
> >
> > +unsigned int mtk_gamma_get_size(struct device *dev)
> > +{
> > + struct mtk_disp_gamma *gamma = dev_get_drvdata(dev);
> > + unsigned int lut_size = LUT_SIZE_DEFAULT;
> > +
> > + if (gamma && gamma->data)
> > + lut_size = gamma->data->lut_size;
> > +
> > + return lut_size;
> > +}
> > +
> > void mtk_gamma_set_common(struct device *dev, void __iomem *regs,
> > struct drm_crtc_state *state)
> > {
> > struct mtk_disp_gamma *gamma = dev_get_drvdata(dev);
> > bool lut_diff = false;
> > + u16 lut_size = LUT_SIZE_DEFAULT;
>
> This makes us get a double assignment in case gamma->data is
> populated.
>
> > unsigned int i, reg;
> > struct drm_color_lut *lut;
> > void __iomem *lut_base;
> > u32 word;
> > u32 diff[3] = {0};
> >
> > - if (gamma && gamma->data)
> > + if (gamma && gamma->data) {
> > lut_diff = gamma->data->lut_diff;
> > + lut_size = gamma->data->lut_size;
> > + }
>
> ...you can avoid it like that:
>
> } else {
> lut_size = LUT_SIZE_DEFAULT;
> }
>
>
> Regards,
> Angelo
>
OK, I'll fix it, but I'll move the gamma priv data handling to the
mtk_gamma_set.
Regards,
Jason-JH.Lin
>
--
Jason-JH Lin <jason-jh.lin@...iatek.com>
Powered by blists - more mailing lists