public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: "CK Hu (胡俊光)" <ck.hu@mediatek.com>
To: "matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
	"tzimmermann@suse.de" <tzimmermann@suse.de>,
	"simona@ffwll.ch" <simona@ffwll.ch>,
	"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Jay Liu (刘博)" <Jay.Liu@mediatek.com>,
	"airlied@gmail.com" <airlied@gmail.com>,
	"krzk+dt@kernel.org" <krzk+dt@kernel.org>,
	"robh@kernel.org" <robh@kernel.org>,
	"p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
	"maarten.lankhorst@linux.intel.com"
	<maarten.lankhorst@linux.intel.com>,
	"mripard@kernel.org" <mripard@kernel.org>,
	"Yongqiang Niu (牛永强)" <yongqiang.niu@mediatek.com>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"hsinyi@chromium.org" <hsinyi@chromium.org>
Cc: "dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@mediatek.com>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 2/7] drm/mediatek: fix CCORR mtk_ctm_s31_32_to_s1_n function issue
Date: Wed, 26 Feb 2025 06:41:41 +0000	[thread overview]
Message-ID: <6bca3cc4dc7c64e78c7ee6174544f0683b4f5fac.camel@mediatek.com> (raw)
In-Reply-To: <20250219092040.11227-3-jay.liu@mediatek.com>

On Wed, 2025-02-19 at 17:20 +0800, Jay Liu wrote:
> if matrixbit is 11,
> The range of color matrix is from 0 to (BIT(11) - 1).
> Values from 0 to (BIT(11) - 1) represent positive numbers,
> values from BIT(11) to (BIT(12) - 1) represent negative numbers.
> For example, -1 need converted to 8191.
> 
> Fixes: 738ed4156fba ("drm/mediatek: Add matrix_bits private data for ccorr")
> 
> Signed-off-by: Jay Liu <jay.liu@mediatek.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_disp_ccorr.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c b/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c
> index 94e82b3fa2d8..a9f91b71534b 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_ccorr.c
> @@ -100,6 +100,15 @@ static u16 mtk_ctm_s31_32_to_s1_n(u64 in, u32 n)
>  		r |= (in >> (32 - n)) & GENMASK(n, 0);
>  	}
>  
> +	/*
> +	 *The range of r is from 0 to (BIT(n + 1) - 1),
> +	 *where values from 0 to (BIT(n) - 1) represent positive numbers,
> +	 *and values from BIT(n) to (BIT(n + 1) - 1) represent negative numbers.
> +	 *For example, if n is 11, -1 will be converted to 8191.
> +	 */
> +	if (r & BIT(n + 1))
> +		r = (~(r & GENMASK(n, 0)) + 1) & GENMASK(n + 1, 0);
> +

This function is to change s31.32 to s1.n, but it seems you change s31.32 to two's complement.
If so, use drm_color_ctm_s31_32_to_qm_n().
In addition, are you sure that MT8183 and MT8192 hardware use two's complement?

Regards,
CK

>  	return r;
>  }
>  


  parent reply	other threads:[~2025-02-26  6:41 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-19  9:20 [PATCH 0/7] porting pq compnent for MT8196 Jay Liu
2025-02-19  9:20 ` [PATCH 1/7] drm/mediatek: Add CCORR component support " Jay Liu
2025-02-19 12:49   ` AngeloGioacchino Del Regno
2025-02-24 12:49     ` Jay Liu (刘博)
2025-02-26 11:36     ` Jay Liu (刘博)
2025-02-26 12:14       ` AngeloGioacchino Del Regno
2025-02-26  7:09   ` CK Hu (胡俊光)
2025-02-19  9:20 ` [PATCH 2/7] drm/mediatek: fix CCORR mtk_ctm_s31_32_to_s1_n function issue Jay Liu
2025-02-19 12:49   ` AngeloGioacchino Del Regno
2025-02-26  6:41   ` CK Hu (胡俊光) [this message]
2025-02-19  9:20 ` [PATCH 3/7] drm/mediatek: Add TDSHP component support for MT8196 Jay Liu
2025-02-19 12:37   ` AngeloGioacchino Del Regno
2025-02-26  7:40   ` CK Hu (胡俊光)
2025-02-19  9:20 ` [PATCH 4/7] dt-bindings: display: mediatek: ccorr: Add " Jay Liu
2025-02-19  9:23   ` Krzysztof Kozlowski
2025-02-19 12:49   ` AngeloGioacchino Del Regno
2025-02-19  9:20 ` [PATCH 5/7] dt-bindings: display: mediatek: dither: " Jay Liu
2025-02-19  9:20 ` [PATCH 6/7] dt-bindings: display: mediatek: gamma: " Jay Liu
2025-02-19  9:20 ` [PATCH 7/7] dt-bindings: display: mediatek: tdshp: " Jay Liu
2025-02-19  9:25   ` Krzysztof Kozlowski
2025-02-19 12:49     ` AngeloGioacchino Del Regno
2025-02-26 11:37     ` Jay Liu (刘博)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6bca3cc4dc7c64e78c7ee6174544f0683b4f5fac.camel@mediatek.com \
    --to=ck.hu@mediatek.com \
    --cc=Jay.Liu@mediatek.com \
    --cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
    --cc=airlied@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hsinyi@chromium.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=matthias.bgg@gmail.com \
    --cc=mripard@kernel.org \
    --cc=p.zabel@pengutronix.de \
    --cc=robh@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=yongqiang.niu@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox