[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e0a8ea5406e81bcf06304e6c42efcd54af8bcbbf.camel@mediatek.com>
Date: Thu, 12 Oct 2023 03:52:48 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: "angelogioacchino.delregno@...labora.com"
<angelogioacchino.delregno@...labora.com>,
"chunkuang.hu@...nel.org" <chunkuang.hu@...nel.org>
CC: "linux-mediatek@...ts.infradead.org"
<linux-mediatek@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"wenst@...omium.org" <wenst@...omium.org>,
Jason-JH Lin (林睿祥)
<Jason-JH.Lin@...iatek.com>,
"kernel@...labora.com" <kernel@...labora.com>,
"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
"amergnat@...libre.com" <amergnat@...libre.com>,
"ehristev@...labora.com" <ehristev@...labora.com>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"matthias.bgg@...il.com" <matthias.bgg@...il.com>
Subject: Re: [PATCH v10 09/16] drm/mediatek: gamma: Support specifying number
of bits per LUT component
Hi, Angelo:
On Fri, 2023-08-04 at 09:28 +0200, AngeloGioacchino Del Regno wrote:
> New SoCs, like MT8195, not only may support bigger lookup tables, but
> have got a different register layout to support bigger precision:
> support specifying the number of `lut_bits` for each SoC and use it
> in mtk_gamma_set_common() to perform the right calculation.
I would like to merge this patch with the 12-bit lut support.
>
> Signed-off-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@...labora.com>
> Reviewed-by: Jason-JH.Lin <jason-jh.lin@...iatek.com>
> Reviewed-by: Alexandre Mergnat <amergnat@...libre.com>
> ---
> drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 15 +++++++++------
> 1 file changed, 9 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> index 001b98694761..1845bd326a6d 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c
> @@ -38,6 +38,7 @@ struct mtk_disp_gamma_data {
> bool has_dither;
> bool lut_diff;
> u16 lut_size;
> + u8 lut_bits;
> };
>
> /*
> @@ -91,9 +92,9 @@ void mtk_gamma_set(struct device *dev, struct
> drm_crtc_state *state)
> for (i = 0; i < gamma->data->lut_size; i++) {
> struct drm_color_lut diff, hwlut;
>
> - hwlut.red = drm_color_lut_extract(lut[i].red,
> LUT_BITS_DEFAULT);
> - hwlut.green = drm_color_lut_extract(lut[i].green,
> LUT_BITS_DEFAULT);
> - hwlut.blue = drm_color_lut_extract(lut[i].blue,
> LUT_BITS_DEFAULT);
> + hwlut.red = drm_color_lut_extract(lut[i].red, gamma-
> >data->lut_bits);
> + hwlut.green = drm_color_lut_extract(lut[i].green,
> gamma->data->lut_bits);
> + hwlut.blue = drm_color_lut_extract(lut[i].blue, gamma-
> >data->lut_bits);
>
> if (!gamma->data->lut_diff || (i % 2 == 0)) {
> word = FIELD_PREP(DISP_GAMMA_LUT_10BIT_R,
> hwlut.red);
> @@ -101,13 +102,13 @@ void mtk_gamma_set(struct device *dev, struct
> drm_crtc_state *state)
> word |= FIELD_PREP(DISP_GAMMA_LUT_10BIT_B,
> hwlut.blue);
> } else {
> diff.red = lut[i].red - lut[i - 1].red;
> - diff.red = drm_color_lut_extract(diff.red,
> LUT_BITS_DEFAULT);
> + diff.red = drm_color_lut_extract(diff.red,
> gamma->data->lut_bits);
>
> diff.green = lut[i].green - lut[i - 1].green;
> - diff.green = drm_color_lut_extract(diff.green,
> LUT_BITS_DEFAULT);
> + diff.green = drm_color_lut_extract(diff.green,
> gamma->data->lut_bits);
>
> diff.blue = lut[i].blue - lut[i - 1].blue;
> - diff.blue = drm_color_lut_extract(diff.blue,
> LUT_BITS_DEFAULT);
> + diff.blue = drm_color_lut_extract(diff.blue,
> gamma->data->lut_bits);
>
> word = FIELD_PREP(DISP_GAMMA_LUT_10BIT_R,
> diff.red);
> word |= FIELD_PREP(DISP_GAMMA_LUT_10BIT_G,
> diff.green);
> @@ -217,10 +218,12 @@ static int mtk_disp_gamma_remove(struct
> platform_device *pdev)
>
> static const struct mtk_disp_gamma_data mt8173_gamma_driver_data = {
> .has_dither = true,
> + .lut_bits = 10,
> .lut_size = 512,
> };
>
> static const struct mtk_disp_gamma_data mt8183_gamma_driver_data = {
> + .lut_bits = 10,
> .lut_diff = true,
> .lut_size = 512,
> };
Powered by blists - more mailing lists