* Re: [PATCH RESEND v3 3/9] drm/mediatek: Adjust mtk_drm_gamma_set_common parameters [not found] ` <44d19c4ea29bdbf3a07890ed25fd637f8805b6c6.camel@mediatek.com> @ 2022-09-14 1:10 ` Jason-JH Lin 0 siblings, 0 replies; 11+ messages in thread From: Jason-JH Lin @ 2022-09-14 1:10 UTC (permalink / raw) To: CK Hu, Chun-Kuang Hu, Rob Herring, Krzysztof Kozlowski, Matthias Brugger, AngeloGioacchino Del Regno Cc: Rex-BC Chen, Singo Chang, dri-devel, linux-mediatek, devicetree, linux-kernel, linux-arm-kernel, Project_Global_Chrome_Upstream_Group Hi CK, Thanks for the reviews. On Mon, 2022-09-12 at 10:48 +0800, CK Hu wrote: > Hi, Jason: > > On Mon, 2022-09-12 at 09:30 +0800, Jason-JH.Lin wrote: > > Adjust the parameters in mtk_drm_gamma_set_common() > > - add (struct device *dev) to get lut_diff from gamma's driver > > data > > - remove (bool lut_diff) and use false as default value in the > > function > > > > Fixes: 051524cbe62d ("FROMGIT: drm/mediatek: Add lut diff flag for > > new gamma hardware support") > > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com> > > --- > > drivers/gpu/drm/mediatek/mtk_disp_aal.c | 2 +- > > drivers/gpu/drm/mediatek/mtk_disp_drv.h | 2 +- > > drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 13 +++++++------ > > 3 files changed, 9 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_aal.c > > b/drivers/gpu/drm/mediatek/mtk_disp_aal.c > > index 0f9d7efb61d7..6517e0a5a7d8 100644 > > --- a/drivers/gpu/drm/mediatek/mtk_disp_aal.c > > +++ b/drivers/gpu/drm/mediatek/mtk_disp_aal.c > > @@ -66,7 +66,7 @@ void mtk_aal_gamma_set(struct device *dev, struct > > drm_crtc_state *state) > > struct mtk_disp_aal *aal = dev_get_drvdata(dev); > > > > if (aal->data && aal->data->has_gamma) > > - mtk_gamma_set_common(aal->regs, state, false); > > + mtk_gamma_set_common(NULL, aal->regs, state); > > } > > > > void mtk_aal_start(struct device *dev) > > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_drv.h > > b/drivers/gpu/drm/mediatek/mtk_disp_drv.h > > index 33e61a136bbc..a83e5fbc8724 100644 > > --- a/drivers/gpu/drm/mediatek/mtk_disp_drv.h > > +++ b/drivers/gpu/drm/mediatek/mtk_disp_drv.h > > @@ -52,7 +52,7 @@ void mtk_gamma_config(struct device *dev, > > unsigned > > int w, > > unsigned int h, unsigned int vrefresh, > > unsigned int bpc, struct cmdq_pkt *cmdq_pkt); > > void mtk_gamma_set(struct device *dev, struct drm_crtc_state > > *state); > > -void mtk_gamma_set_common(void __iomem *regs, struct > > drm_crtc_state > > *state, bool lut_diff); > > +void mtk_gamma_set_common(struct device *dev, void __iomem *regs, > > struct drm_crtc_state *state); > > This function is called by both aal and gamma driver, so I would like > to pass struct device dev because priv data of aal and gamma are > different. Make this function command for both aal and gamma driver. > > Regards, > CK > I think handle the priv data of AAL in the gamma_set_common function will make this function coupling with AAL. So I'll drop this patch and move the gamma priv data to gamma_set and just pass the necessary parameters for gamma_set_common. Regards, Jason-JH.Lin > > void mtk_gamma_start(struct device *dev); > > void mtk_gamma_stop(struct device *dev); > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c > > b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c > > index bbd558a036ec..f54a6a618348 100644 > > --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c > > +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c > > @@ -54,14 +54,19 @@ void mtk_gamma_clk_disable(struct device *dev) > > clk_disable_unprepare(gamma->clk); > > } > > > > -void mtk_gamma_set_common(void __iomem *regs, struct > > drm_crtc_state > > *state, bool lut_diff) > > +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; > > unsigned int i, reg; > > struct drm_color_lut *lut; > > void __iomem *lut_base; > > u32 word; > > u32 diff[3] = {0}; > > > > + if (gamma && gamma->data) > > + lut_diff = gamma->data->lut_diff; > > + > > if (state->gamma_lut) { > > reg = readl(regs + DISP_GAMMA_CFG); > > reg = reg | GAMMA_LUT_EN; > > @@ -91,12 +96,8 @@ void mtk_gamma_set_common(void __iomem *regs, > > struct drm_crtc_state *state, bool > > void mtk_gamma_set(struct device *dev, struct drm_crtc_state > > *state) > > { > > struct mtk_disp_gamma *gamma = dev_get_drvdata(dev); > > - bool lut_diff = false; > > - > > - if (gamma->data) > > - lut_diff = gamma->data->lut_diff; > > > > - mtk_gamma_set_common(gamma->regs, state, lut_diff); > > + mtk_gamma_set_common(dev, gamma->regs, state); > > } > > > > void mtk_gamma_config(struct device *dev, unsigned int w, > > -- Jason-JH Lin <jason-jh.lin@mediatek.com> ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20220912013006.27541-5-jason-jh.lin@mediatek.com>]
[parent not found: <e1945785da7c56bbb7fe94926c39fc6c3593cdb0.camel@mediatek.com>]
* Re: [PATCH RESEND v3 4/9] drm/mediatek: Add gamma support different lut_size for other SoC [not found] ` <e1945785da7c56bbb7fe94926c39fc6c3593cdb0.camel@mediatek.com> @ 2022-09-14 1:14 ` Jason-JH Lin 0 siblings, 0 replies; 11+ messages in thread From: Jason-JH Lin @ 2022-09-14 1:14 UTC (permalink / raw) To: CK Hu, Chun-Kuang Hu, Rob Herring, Krzysztof Kozlowski, Matthias Brugger, AngeloGioacchino Del Regno Cc: Rex-BC Chen, Singo Chang, dri-devel, linux-mediatek, devicetree, linux-kernel, linux-arm-kernel, Project_Global_Chrome_Upstream_Group Hi CK, Thanks for the reviews. On Mon, 2022-09-12 at 11:14 +0800, CK Hu wrote: > Hi, Jason: > > On Mon, 2022-09-12 at 09:30 +0800, Jason-JH.Lin wrote: > > 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. > > Separate these two modification to two patches. In the patch of > mtk_drm_gamma_get_lut_size(), consider the aal driver. > > Regards, > CK OK, I'll separate them. Regards, Jason-JH.Lin ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20220912013006.27541-6-jason-jh.lin@mediatek.com>]
[parent not found: <b740f81d62ce73e08a2a43637b4f951298b1c28a.camel@mediatek.com>]
* Re: [PATCH RESEND v3 5/9] drm/mediatek: Add gamma support different lut_bits for other SoC [not found] ` <b740f81d62ce73e08a2a43637b4f951298b1c28a.camel@mediatek.com> @ 2022-09-14 1:17 ` Jason-JH Lin 0 siblings, 0 replies; 11+ messages in thread From: Jason-JH Lin @ 2022-09-14 1:17 UTC (permalink / raw) To: CK Hu, Chun-Kuang Hu, Rob Herring, Krzysztof Kozlowski, Matthias Brugger, AngeloGioacchino Del Regno Cc: Rex-BC Chen, Singo Chang, dri-devel, linux-mediatek, devicetree, linux-kernel, linux-arm-kernel, Project_Global_Chrome_Upstream_Group Hi CK, Thanks for the reviews. On Mon, 2022-09-12 at 11:40 +0800, CK Hu wrote: > Hi, Jason: > > On Mon, 2022-09-12 at 09:30 +0800, Jason-JH.Lin wrote: > > Add lut_bits in gamma driver data for each SoC and adjust the usage > > of lut_bits in mtk_drm_gamma_set_common(). > > > > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com> > > --- > > drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 36 ++++++++++++++++--- > > -- > > -- > > 1 file changed, 25 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c > > b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c > > index 0a1022032b71..be82d15a5204 100644 > > --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c > > +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c > > @@ -25,11 +25,14 @@ > > > > #define LUT_10BIT_MASK 0x03ff > > #define LUT_SIZE_DEFAULT 512 /* for setting > > gamma lut from AAL */ > > +#define LUT_BITS_DEFAULT 10 > > +#define LUT_INPUT_BITS 16 /* input lut > > bit from application */ > > I think we should use drm_color_lut_extract() to let the input bits > transparent. So add one patch to use drm_color_lut_extract(), and > then > apply this patch. > > Regards, > CK OK, I'll separate it to 2 patches, 1 is using drm_color_lut_extract() to handle with input lut data and the other is adding gamma support lut_bits and shift_bits. Regards, Jason-JH.Lin ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20220912013006.27541-9-jason-jh.lin@mediatek.com>]
[parent not found: <ecdb209437e78b3273374ef963fd2c5c64ba88fd.camel@mediatek.com>]
* Re: [PATCH RESEND v3 8/9] drm/mediatek: Add clear RELAY_MODE bit to set gamma [not found] ` <ecdb209437e78b3273374ef963fd2c5c64ba88fd.camel@mediatek.com> @ 2022-09-14 1:26 ` Jason-JH Lin 0 siblings, 0 replies; 11+ messages in thread From: Jason-JH Lin @ 2022-09-14 1:26 UTC (permalink / raw) To: CK Hu, Chun-Kuang Hu, Rob Herring, Krzysztof Kozlowski, Matthias Brugger, AngeloGioacchino Del Regno Cc: Rex-BC Chen, Singo Chang, dri-devel, linux-mediatek, devicetree, linux-kernel, linux-arm-kernel, Project_Global_Chrome_Upstream_Group Hi CK, Thanks for the reviews. On Mon, 2022-09-12 at 10:26 +0800, CK Hu wrote: > Hi, Jason: > > On Mon, 2022-09-12 at 09:30 +0800, Jason-JH.Lin wrote: > > Since the bootlaoder may set the RELAY_MODE to gamma be for the > > kerenl, > > we have to clear the RELAY_MODE bit to make sure that the gamma is > > enabled correctly. > > > > Fixes: b10023b03082 ("FROMGIT: drm/mediatek: Separate gamma > > module") > > Fixes: 69a4237ab1d1 ("drm/mediatek: Separate gamma module") > > and move this patch to the first patch of this series so this patch > could be picked to early stable branch. > > Regards, > CK Ok, I'll move it to the first patch. Regards, Jason-JH.Lin ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20220912013006.27541-2-jason-jh.lin@mediatek.com>]
* Re: [PATCH RESEND v3 1/9] dt-bindings: mediatek: modify item formatting for gamma [not found] ` <20220912013006.27541-2-jason-jh.lin@mediatek.com> @ 2022-09-18 9:59 ` Krzysztof Kozlowski 0 siblings, 0 replies; 11+ messages in thread From: Krzysztof Kozlowski @ 2022-09-18 9:59 UTC (permalink / raw) To: Jason-JH.Lin, Chun-Kuang Hu, Rob Herring, Krzysztof Kozlowski, Matthias Brugger, AngeloGioacchino Del Regno Cc: CK Hu, Rex-BC Chen, Singo Chang, dri-devel, linux-mediatek, devicetree, linux-kernel, linux-arm-kernel, Project_Global_Chrome_Upstream_Group, zheng-yan.chen On 12/09/2022 02:29, Jason-JH.Lin wrote: > From: "zheng-yan.chen" <zheng-yan.chen@mediatek.com> > > Since the items with only one const should be dedicated as enum, > merge all such items into one enum item. > > Fixes: 4ed545e7d100 ("dt-bindings: display: mediatek: disp: split each block to individual yaml") > Signed-off-by: zheng-yan.chen <zheng-yan.chen@mediatek.com> > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20220912013006.27541-3-jason-jh.lin@mediatek.com>]
* Re: [PATCH RESEND v3 2/9] dt-bindings: mediatek: Add gamma compatible for mt8195 [not found] ` <20220912013006.27541-3-jason-jh.lin@mediatek.com> @ 2022-09-18 9:59 ` Krzysztof Kozlowski 0 siblings, 0 replies; 11+ messages in thread From: Krzysztof Kozlowski @ 2022-09-18 9:59 UTC (permalink / raw) To: Jason-JH.Lin, Chun-Kuang Hu, Rob Herring, Krzysztof Kozlowski, Matthias Brugger, AngeloGioacchino Del Regno Cc: CK Hu, Rex-BC Chen, Singo Chang, dri-devel, linux-mediatek, devicetree, linux-kernel, linux-arm-kernel, Project_Global_Chrome_Upstream_Group, zheng-yan.chen On 12/09/2022 02:29, Jason-JH.Lin wrote: > From: "zheng-yan.chen" <zheng-yan.chen@mediatek.com> > > mt8195 uses 10bit-to-12bit gamma-LUT, which is not compatible with > current 9bit-to-10bit gamma-LUT. > > This patch thus add constant compatible for mt8195, which means that > mt8195 should only use specified mt8195 gamma driver data. > > Also, delete related compatible from enum, to ensure that > mt8195 will not accidentally get others' gamma driver data and thus > cause fatal error. > > Signed-off-by: zheng-yan.chen <zheng-yan.chen@mediatek.com> > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com> > Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH RESEND v3 0/9] Add gamma lut support for mt8195 [not found] <20220912013006.27541-1-jason-jh.lin@mediatek.com> ` (5 preceding siblings ...) [not found] ` <20220912013006.27541-3-jason-jh.lin@mediatek.com> @ 2023-04-26 11:43 ` AngeloGioacchino Del Regno 2023-04-27 15:15 ` AngeloGioacchino Del Regno [not found] ` <20220912013006.27541-7-jason-jh.lin@mediatek.com> 7 siblings, 1 reply; 11+ messages in thread From: AngeloGioacchino Del Regno @ 2023-04-26 11:43 UTC (permalink / raw) To: Jason-JH.Lin, Chun-Kuang Hu, Rob Herring, Krzysztof Kozlowski, Matthias Brugger Cc: CK Hu, Rex-BC Chen, Singo Chang, dri-devel, linux-mediatek, devicetree, linux-kernel, linux-arm-kernel, Project_Global_Chrome_Upstream_Group Il 12/09/22 03:29, Jason-JH.Lin ha scritto: > Since the gamma_set_common() function for previous SoC, > such as mt8173 and mt8183, is designed for 9bit-to-10bit > conversion. > mt8195 is using 10bit-to-12bit conversion, which is > not compatible with the previous function. > > Thus, need to update the function to fit the need of mt8195. Hello, can you please respin and fix this series on the latest linux-next? Besides, please test it carefully: as far as I can see, GNOME Night Light (or others) are not working on MT8195 (color temperature/ccorr). As for gamma itself, that's not working either; you can test it with a tool that will create a color profile by applying a new VCGT table, please look at [1] if you need tools. We can confirm that color correction works on at least MT8192 (colord), so it's MT8195 at fault. [1]: https://github.com/zb3/gnome-gamma-tool Regards, Angelo > --- > Change in RESEND v3: > Fix build warning >>> drivers/gpu/drm/mediatek/mtk_disp_gamma.c:59:14: warning: no previous prototype for 'mtk_gamma_get_size' [-Wmissing-prototypes] > > Change in v3: > 1. separate 1 dt-binding patch to 2 patches, 1 is for modifying > multiple items list to one and 1 is for moving mt8195 compatible. > 2. redefine variables to reduce memory usage. > 3. delete unused symbols. > 4. separate 1 drm/mediatek patch to 6 patches. > 5. rebase on tag 'next-20220909' > > Jason-JH.Lin (5): > drm/mediatek: Adjust mtk_drm_gamma_set_common parameters > drm/mediatek: Add gamma support different lut_size for other SoC > drm/mediatek: Add gamma support different lut_bits for other SoC > drm/mediatek: Add gamma support different bank_size for other SoC > drm/mediatek: Add clear RELAY_MODE bit to set gamma > > zheng-yan.chen (4): > dt-bindings: mediatek: modify item formatting for gamma > dt-bindings: mediatek: Add gamma compatible for mt8195 > drm/mediatek: Add gamma lut support for mt8195 > arm64: dts: Modify gamma compatible for mt8195 > > .../display/mediatek/mediatek,gamma.yaml | 8 +- > arch/arm64/boot/dts/mediatek/mt8195.dtsi | 2 +- > drivers/gpu/drm/mediatek/mtk_disp_aal.c | 2 +- > drivers/gpu/drm/mediatek/mtk_disp_drv.h | 3 +- > drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 115 ++++++++++++++---- > 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 ++ > 8 files changed, 109 insertions(+), 35 deletions(-) > ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH RESEND v3 0/9] Add gamma lut support for mt8195 2023-04-26 11:43 ` [PATCH RESEND v3 0/9] Add gamma lut support " AngeloGioacchino Del Regno @ 2023-04-27 15:15 ` AngeloGioacchino Del Regno 2023-04-28 6:45 ` Jason-JH Lin (林睿祥) 0 siblings, 1 reply; 11+ messages in thread From: AngeloGioacchino Del Regno @ 2023-04-27 15:15 UTC (permalink / raw) To: Jason-JH.Lin, Chun-Kuang Hu, Rob Herring, Krzysztof Kozlowski, Matthias Brugger Cc: CK Hu, Rex-BC Chen, Singo Chang, dri-devel, linux-mediatek, devicetree, linux-kernel, linux-arm-kernel, Project_Global_Chrome_Upstream_Group Il 26/04/23 13:43, AngeloGioacchino Del Regno ha scritto: > Il 12/09/22 03:29, Jason-JH.Lin ha scritto: >> Since the gamma_set_common() function for previous SoC, >> such as mt8173 and mt8183, is designed for 9bit-to-10bit >> conversion. >> mt8195 is using 10bit-to-12bit conversion, which is >> not compatible with the previous function. >> >> Thus, need to update the function to fit the need of mt8195. > > Hello, > can you please respin and fix this series on the latest linux-next? > > Besides, please test it carefully: as far as I can see, GNOME Night Light > (or others) are not working on MT8195 (color temperature/ccorr). > As for gamma itself, that's not working either; you can test it with a tool > that will create a color profile by applying a new VCGT table, please look > at [1] if you need tools. > > We can confirm that color correction works on at least MT8192 (colord), so > it's MT8195 at fault. > > [1]: https://github.com/zb3/gnome-gamma-tool > Nevermind. I've actually fixed this code and refactored it a bit as well. I'll push my own version soon. No action required. Regards, Angelo ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH RESEND v3 0/9] Add gamma lut support for mt8195 2023-04-27 15:15 ` AngeloGioacchino Del Regno @ 2023-04-28 6:45 ` Jason-JH Lin (林睿祥) 0 siblings, 0 replies; 11+ messages in thread From: Jason-JH Lin (林睿祥) @ 2023-04-28 6:45 UTC (permalink / raw) To: matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com, chunkuang.hu@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org Cc: linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Singo Chang (張興國), devicetree@vger.kernel.org, CK Hu (胡俊光), dri-devel@lists.freedesktop.org, Project_Global_Chrome_Upstream_Group, linux-arm-kernel@lists.infradead.org, Rex-BC Chen (陳柏辰) Hi Angelo, On Thu, 2023-04-27 at 17:15 +0200, AngeloGioacchino Del Regno wrote: > External email : Please do not click links or open attachments until > you have verified the sender or the content. > > > Il 26/04/23 13:43, AngeloGioacchino Del Regno ha scritto: > > Il 12/09/22 03:29, Jason-JH.Lin ha scritto: > > > Since the gamma_set_common() function for previous SoC, > > > such as mt8173 and mt8183, is designed for 9bit-to-10bit > > > conversion. > > > mt8195 is using 10bit-to-12bit conversion, which is > > > not compatible with the previous function. > > > > > > Thus, need to update the function to fit the need of mt8195. > > > > Hello, > > can you please respin and fix this series on the latest linux-next? > > > > Besides, please test it carefully: as far as I can see, GNOME Night > > Light > > (or others) are not working on MT8195 (color temperature/ccorr). > > As for gamma itself, that's not working either; you can test it > > with a tool > > that will create a color profile by applying a new VCGT table, > > please look > > at [1] if you need tools. > > > > We can confirm that color correction works on at least MT8192 > > (colord), so > > it's MT8195 at fault. > > > > [1]: > > https://urldefense.com/v3/__https://github.com/zb3/gnome-gamma-tool__;!!CTRNKA9wMg0ARbw!ib5vs_mqKWlyC8VbLNZbc4Fc0-e6dL5Z-OM5pLsVRnQOWAckR6ETV1mRYRkz-5rKB7fdYvY4LrYoHKDlv6jPSKzoC-245JTYaQ$ > > > > Nevermind. I've actually fixed this code and refactored it a bit as > well. > > I'll push my own version soon. No action required. > > Regards, > Angelo > OK~ Thanks for your great help! :) Regards, Jason-JH.Lin ^ permalink raw reply [flat|nested] 11+ messages in thread
[parent not found: <20220912013006.27541-7-jason-jh.lin@mediatek.com>]
[parent not found: <3c67e742bdb06e55ba170a0a6dc79e6f6833c0e7.camel@mediatek.com>]
* Re: [PATCH RESEND v3 6/9] drm/mediatek: Add gamma support different bank_size for other SoC [not found] ` <3c67e742bdb06e55ba170a0a6dc79e6f6833c0e7.camel@mediatek.com> @ 2022-09-14 1:28 ` Jason-JH Lin 0 siblings, 0 replies; 11+ messages in thread From: Jason-JH Lin @ 2022-09-14 1:28 UTC (permalink / raw) To: CK Hu, Chun-Kuang Hu, Rob Herring, Krzysztof Kozlowski, Matthias Brugger, AngeloGioacchino Del Regno Cc: Rex-BC Chen, Singo Chang, dri-devel, linux-mediatek, devicetree, linux-kernel, linux-arm-kernel, Project_Global_Chrome_Upstream_Group Hi CK, Thanks for the reviews. On Mon, 2022-09-12 at 13:12 +0800, CK Hu wrote: > Hi, Jason: > > On Mon, 2022-09-12 at 09:30 +0800, Jason-JH.Lin wrote: > > Add multiple bank support for mt8195. > > If bank size is 0 which means no bank support. > > > > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com> > > --- > > drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 45 +++++++++++++------ > > ---- > > 1 file changed, 26 insertions(+), 19 deletions(-) > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c > > b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c > > index be82d15a5204..45da2b6206c8 100644 > > --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c > > +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c > > @@ -21,6 +21,7 @@ > > #define GAMMA_LUT_EN BIT(1) > > #define GAMMA_DITHERING BIT(2) > > #define DISP_GAMMA_SIZE 0x0030 > > +#define DISP_GAMMA_BANK 0x0100 > > #define DISP_GAMMA_LUT 0x0700 > > > > #define LUT_10BIT_MASK 0x03ff > > @@ -33,6 +34,7 @@ struct mtk_disp_gamma_data { > > bool lut_diff; > > u16 lut_size; > > u8 lut_bits; > > + u16 bank_size; > > }; > > > > /* > > @@ -75,9 +77,10 @@ void mtk_gamma_set_common(struct device *dev, > > void > > __iomem *regs, struct drm_crt > > struct mtk_disp_gamma *gamma = dev_get_drvdata(dev); > > bool lut_diff = false; > > u16 lut_size = LUT_SIZE_DEFAULT; > > + u16 bank_size = lut_size; > > u8 lut_bits = LUT_BITS_DEFAULT; > > u8 shift_bits; > > - unsigned int i, reg; > > + unsigned int i, j, reg, bank_num; > > struct drm_color_lut *lut; > > void __iomem *lut_base; > > u32 word, mask; > > @@ -87,8 +90,10 @@ void mtk_gamma_set_common(struct device *dev, > > void > > __iomem *regs, struct drm_crt > > lut_diff = gamma->data->lut_diff; > > lut_size = gamma->data->lut_size; > > lut_bits = gamma->data->lut_bits; > > + bank_size = gamma->data->bank_size; > > } > > > > + bank_num = lut_size / bank_size; > > shift_bits = LUT_INPUT_BITS - lut_bits; > > mask = GENMASK(lut_bits - 1, 0); > > > > @@ -98,25 +103,27 @@ void mtk_gamma_set_common(struct device *dev, > > void __iomem *regs, struct drm_crt > > writel(reg, regs + DISP_GAMMA_CFG); > > lut_base = regs + DISP_GAMMA_LUT; > > lut = (struct drm_color_lut *)state->gamma_lut->data; > > - for (i = 0; i < lut_size; i++) { > > - > > - if (!lut_diff || (i % 2 == 0)) { > > - word = (((lut[i].red >> shift_bits) & > > mask) << 20) + > > - (((lut[i].green >> shift_bits) > > & mask) << 10) + > > - ((lut[i].blue >> shift_bits) & > > mask); > > - } else { > > - diff[0] = (lut[i].red >> shift_bits) - > > - (lut[i - 1].red >> > > shift_bits); > > - diff[1] = (lut[i].green >> shift_bits) > > - > > - (lut[i - 1].green >> > > shift_bits); > > - diff[2] = (lut[i].blue >> shift_bits) - > > - (lut[i - 1].blue >> > > shift_bits); > > - > > - word = ((diff[0] & mask) << 20) + > > - ((diff[1] & mask) << 10) + > > - (diff[2] & mask); > > + for (j = 0; j < bank_num; j++) { > > + writel(j, regs + DISP_GAMMA_BANK); > > Does mt8173 and mt8183 has this register? If not, do not set this > register in mt8173 and mt8183. > > Regards, > CK mt8173 and mt8183 don't have this register, so I'll fix it. Regards, Jason-JH.Lin ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH RESEND v3 6/9] drm/mediatek: Add gamma support different bank_size for other SoC [not found] ` <20220912013006.27541-7-jason-jh.lin@mediatek.com> [not found] ` <3c67e742bdb06e55ba170a0a6dc79e6f6833c0e7.camel@mediatek.com> @ 2023-04-26 12:06 ` AngeloGioacchino Del Regno 1 sibling, 0 replies; 11+ messages in thread From: AngeloGioacchino Del Regno @ 2023-04-26 12:06 UTC (permalink / raw) To: Jason-JH.Lin, Chun-Kuang Hu, Rob Herring, Krzysztof Kozlowski, Matthias Brugger Cc: CK Hu, Rex-BC Chen, Singo Chang, dri-devel, linux-mediatek, devicetree, linux-kernel, linux-arm-kernel, Project_Global_Chrome_Upstream_Group Il 12/09/22 03:30, Jason-JH.Lin ha scritto: > Add multiple bank support for mt8195. > If bank size is 0 which means no bank support. > > Signed-off-by: Jason-JH.Lin <jason-jh.lin@mediatek.com> > --- > drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 45 +++++++++++++---------- > 1 file changed, 26 insertions(+), 19 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c > index be82d15a5204..45da2b6206c8 100644 > --- a/drivers/gpu/drm/mediatek/mtk_disp_gamma.c > +++ b/drivers/gpu/drm/mediatek/mtk_disp_gamma.c > @@ -21,6 +21,7 @@ > #define GAMMA_LUT_EN BIT(1) > #define GAMMA_DITHERING BIT(2) > #define DISP_GAMMA_SIZE 0x0030 > +#define DISP_GAMMA_BANK 0x0100 > #define DISP_GAMMA_LUT 0x0700 > > #define LUT_10BIT_MASK 0x03ff > @@ -33,6 +34,7 @@ struct mtk_disp_gamma_data { > bool lut_diff; > u16 lut_size; > u8 lut_bits; > + u16 bank_size; > }; > > /* > @@ -75,9 +77,10 @@ void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crt > struct mtk_disp_gamma *gamma = dev_get_drvdata(dev); > bool lut_diff = false; > u16 lut_size = LUT_SIZE_DEFAULT; > + u16 bank_size = lut_size; Just use gamma->data->bank_size directly, as platform data is always present. > u8 lut_bits = LUT_BITS_DEFAULT; > u8 shift_bits; > - unsigned int i, reg; > + unsigned int i, j, reg, bank_num; > struct drm_color_lut *lut; > void __iomem *lut_base; > u32 word, mask; > @@ -87,8 +90,10 @@ void mtk_gamma_set_common(struct device *dev, void __iomem *regs, struct drm_crt > lut_diff = gamma->data->lut_diff; > lut_size = gamma->data->lut_size; > lut_bits = gamma->data->lut_bits; > + bank_size = gamma->data->bank_size; You shall set bank_size = 512 to MT8173 and MT8183, otherwise they break, as this will set bank_size to 0. > } > > + bank_num = lut_size / bank_size; > shift_bits = LUT_INPUT_BITS - lut_bits; > mask = GENMASK(lut_bits - 1, 0); > Regards, Angelo ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2023-04-28 6:45 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <20220912013006.27541-1-jason-jh.lin@mediatek.com> [not found] ` <20220912013006.27541-4-jason-jh.lin@mediatek.com> [not found] ` <44d19c4ea29bdbf3a07890ed25fd637f8805b6c6.camel@mediatek.com> 2022-09-14 1:10 ` [PATCH RESEND v3 3/9] drm/mediatek: Adjust mtk_drm_gamma_set_common parameters Jason-JH Lin [not found] ` <20220912013006.27541-5-jason-jh.lin@mediatek.com> [not found] ` <e1945785da7c56bbb7fe94926c39fc6c3593cdb0.camel@mediatek.com> 2022-09-14 1:14 ` [PATCH RESEND v3 4/9] drm/mediatek: Add gamma support different lut_size for other SoC Jason-JH Lin [not found] ` <20220912013006.27541-6-jason-jh.lin@mediatek.com> [not found] ` <b740f81d62ce73e08a2a43637b4f951298b1c28a.camel@mediatek.com> 2022-09-14 1:17 ` [PATCH RESEND v3 5/9] drm/mediatek: Add gamma support different lut_bits " Jason-JH Lin [not found] ` <20220912013006.27541-9-jason-jh.lin@mediatek.com> [not found] ` <ecdb209437e78b3273374ef963fd2c5c64ba88fd.camel@mediatek.com> 2022-09-14 1:26 ` [PATCH RESEND v3 8/9] drm/mediatek: Add clear RELAY_MODE bit to set gamma Jason-JH Lin [not found] ` <20220912013006.27541-2-jason-jh.lin@mediatek.com> 2022-09-18 9:59 ` [PATCH RESEND v3 1/9] dt-bindings: mediatek: modify item formatting for gamma Krzysztof Kozlowski [not found] ` <20220912013006.27541-3-jason-jh.lin@mediatek.com> 2022-09-18 9:59 ` [PATCH RESEND v3 2/9] dt-bindings: mediatek: Add gamma compatible for mt8195 Krzysztof Kozlowski 2023-04-26 11:43 ` [PATCH RESEND v3 0/9] Add gamma lut support " AngeloGioacchino Del Regno 2023-04-27 15:15 ` AngeloGioacchino Del Regno 2023-04-28 6:45 ` Jason-JH Lin (林睿祥) [not found] ` <20220912013006.27541-7-jason-jh.lin@mediatek.com> [not found] ` <3c67e742bdb06e55ba170a0a6dc79e6f6833c0e7.camel@mediatek.com> 2022-09-14 1:28 ` [PATCH RESEND v3 6/9] drm/mediatek: Add gamma support different bank_size for other SoC Jason-JH Lin 2023-04-26 12:06 ` AngeloGioacchino Del Regno
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).