lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6bca3cc4dc7c64e78c7ee6174544f0683b4f5fac.camel@mediatek.com>
Date: Wed, 26 Feb 2025 06:41:41 +0000
From: CK Hu (胡俊光) <ck.hu@...iatek.com>
To: "matthias.bgg@...il.com" <matthias.bgg@...il.com>, "tzimmermann@...e.de"
	<tzimmermann@...e.de>, "simona@...ll.ch" <simona@...ll.ch>,
	"chunkuang.hu@...nel.org" <chunkuang.hu@...nel.org>, "AngeloGioacchino Del
 Regno" <angelogioacchino.delregno@...labora.com>,
	Jay Liu (刘博) <Jay.Liu@...iatek.com>,
	"airlied@...il.com" <airlied@...il.com>, "krzk+dt@...nel.org"
	<krzk+dt@...nel.org>, "robh@...nel.org" <robh@...nel.org>,
	"p.zabel@...gutronix.de" <p.zabel@...gutronix.de>,
	"maarten.lankhorst@...ux.intel.com" <maarten.lankhorst@...ux.intel.com>,
	"mripard@...nel.org" <mripard@...nel.org>,
	Yongqiang Niu (牛永强)
	<yongqiang.niu@...iatek.com>, "conor+dt@...nel.org" <conor+dt@...nel.org>,
	"hsinyi@...omium.org" <hsinyi@...omium.org>
CC: "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
	"linux-mediatek@...ts.infradead.org" <linux-mediatek@...ts.infradead.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Project_Global_Chrome_Upstream_Group
	<Project_Global_Chrome_Upstream_Group@...iatek.com>,
	"linux-arm-kernel@...ts.infradead.org" <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH 2/7] drm/mediatek: fix CCORR mtk_ctm_s31_32_to_s1_n
 function issue

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@...iatek.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;
>  }
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ