From nobody Tue Feb 10 14:32:50 2026 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1FE7E349B0D for ; Tue, 23 Dec 2025 18:03:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766513019; cv=pass; b=nBQGNJ4KaQ8ubYCkyzi8Er8+XseR7n9plMA4NUSdxx98ymaSOMBgPJ+p4TBCVj2qsfTLPsX4VCvQDmy4y+PrlT51rb6nzxEfTR5eR2uhFWxM/3YLhvgWnS2zT7ujkUIyoXrC7vqqwabFVRFpATDwywYW+1CAvd3vraAf2LkClU8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766513019; c=relaxed/simple; bh=KDPxSZn2VpvPbiyI2Yt3WUcJYkmoQIaN7UEcEL939Wo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bHxcdGXcFloYIw1ZR1gnnVggnNW09bo9Lyi1cw4BU4JNU9XLPTUAMBgq+TM3oZj5mFH+iZICermEDo7daoZnvwowe39oSM9vJjycNDCUpkNhPaY6MjlcFvGAyWGpAB71YUV5sTOwqytGBnnWkw+nYFBOdoFM57gbQFsgpPPp818= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=ariel.dalessandro@collabora.com header.b=eLcOHqrZ; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=ariel.dalessandro@collabora.com header.b="eLcOHqrZ" ARC-Seal: i=1; a=rsa-sha256; t=1766512993; cv=none; d=zohomail.com; s=zohoarc; b=AnXQojUSU/SyeSwoEQUIph28dP8qWrF3PJZDU3B1Um1fNvnzgNlB5WcPzw2HOQrHxBt2KP8VoBdQfndLWl0qx1e6d6VDqSHwbuktdWDjZ5bEaF3Q5hbgEXhd/h9npnGqrulXVV6yATHC2+pOdDIum/D6yXzyhOL8PSQ1ybHUvMU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1766512993; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=KQReQiFpv6vZH7tYZ7DJo6ma1E0VnjzdL856AhiNzYA=; b=DCisu1eNWGmf7tYJhocosCn1Hyz9fq2KQTeZx88cAf4b5yPtFE0Vf2cdqBdM5IBqz1amamOdjUdqrY0UHt98Bmb+Jb8NAbyomHRLhMuw+Y8iF+JYlerVWxUpGywL5HKwLQv0FkDWaDAWx4BwXsUNhLBbCpbdn46JtTO81WAZKik= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=ariel.dalessandro@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1766512993; s=zohomail; d=collabora.com; i=ariel.dalessandro@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:References:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=KQReQiFpv6vZH7tYZ7DJo6ma1E0VnjzdL856AhiNzYA=; b=eLcOHqrZqUKGbA1EUMUhA67zqGG7wacpi4TA8MRaM1aQCKtCJ8Kovbnsfo7aVFUk Wk8nDaDCR5uPnFtAzFio5968CYwBR1QSGceeaSKP8bvhtaXGtL5/JNTqPuXQJMjiqp8 cSpL4seJAUXEYKMOpXOzSoWXLjSx+/94k7x+rp+k= Received: by mx.zohomail.com with SMTPS id 1766512991205778.3247202321545; Tue, 23 Dec 2025 10:03:11 -0800 (PST) From: Ariel D'Alessandro Date: Tue, 23 Dec 2025 15:01:33 -0300 Subject: [PATCH v3 13/21] drm: Add helper to extract a 3x4 matrix from any CTM matrix dimensions Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20251223-mtk-post-blend-color-pipeline-v3-13-7d969f9a37a0@collabora.com> References: <20251223-mtk-post-blend-color-pipeline-v3-0-7d969f9a37a0@collabora.com> In-Reply-To: <20251223-mtk-post-blend-color-pipeline-v3-0-7d969f9a37a0@collabora.com> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Louis Chauvet , Haneen Mohammed , Melissa Wen Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, kernel@collabora.com, =?utf-8?q?N=C3=ADcolas_F=2E_R=2E_A=2E_Prado?= , Ariel D'Alessandro X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1766512902; l=1982; i=ariel.dalessandro@collabora.com; s=20251223; h=from:subject:message-id; bh=KDPxSZn2VpvPbiyI2Yt3WUcJYkmoQIaN7UEcEL939Wo=; b=qnlX0IQTN43U2W1rLFFR9Hu6CLDTEzbDqEoVpJxhhRN6OHJKVQZExbywOREW7WxC/jba2punH ej+ld5idnz6CvU8OlR0wb6rrw61LGe0Xd8Umba9l0QOnpZyqDXymST/ X-Developer-Key: i=ariel.dalessandro@collabora.com; a=ed25519; pk=QZRL9EsSBV3/FhDHi9L/7ZTz2dwa7iyqgl+y1UYaQXQ= X-ZohoMailClient: External Add a common helper to ease the conversion from both 3x3 or 3x4 matrices to a CTM 3x4 matrix. This is handy for code that needs to handle both dimensions. Signed-off-by: Ariel D'Alessandro --- include/drm/drm_color_mgmt.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/include/drm/drm_color_mgmt.h b/include/drm/drm_color_mgmt.h index 5140691f476a9..51279267ed3fd 100644 --- a/include/drm/drm_color_mgmt.h +++ b/include/drm/drm_color_mgmt.h @@ -66,6 +66,40 @@ static inline u32 drm_color_lut32_extract(u32 user_input= , int bit_precision) (1ULL << 32) - 1); } =20 +/** + * drm_color_ctm_to_ctm_3x4 - Copy CTM matrix contents to 3x4 dimensions m= atrix + * + * @dest: The destination CTM 3x4 dimensions matrix + * @src: The source CTM matrix (3x3 or 3x4 dimensions depending on @ctm_3x= 4) + * @ctm_3x4: Boolean indicating the source CTM matrix dimensions + * + * Copy the contents of a CTM matrix from @src, to a CTM 3x4 dimensions ma= trix. + * The source matrix can be 3x3 or 3x4 dimensions depending on the @ctm_3x4 + * boolean argument. + */ +static inline void drm_color_ctm_to_ctm_3x4(struct drm_color_ctm_3x4 *dest, + void *src, bool ctm_3x4) +{ + if (ctm_3x4) { + *dest =3D *(struct drm_color_ctm_3x4 *)src; + } else { + struct drm_color_ctm *ctm =3D (struct drm_color_ctm *)src; + + dest->matrix[0] =3D ctm->matrix[0]; + dest->matrix[1] =3D ctm->matrix[1]; + dest->matrix[2] =3D ctm->matrix[2]; + dest->matrix[3] =3D 0; + dest->matrix[4] =3D ctm->matrix[3]; + dest->matrix[5] =3D ctm->matrix[4]; + dest->matrix[6] =3D ctm->matrix[5]; + dest->matrix[7] =3D 0; + dest->matrix[8] =3D ctm->matrix[6]; + dest->matrix[9] =3D ctm->matrix[7]; + dest->matrix[10] =3D ctm->matrix[8]; + dest->matrix[11] =3D 0; + } +} + u64 drm_color_ctm_s31_32_to_qm_n(u64 user_input, u32 m, u32 n); =20 void drm_crtc_enable_color_mgmt(struct drm_crtc *crtc, --=20 2.51.0