mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
To: Pekka Paalanen <pekka.paalanen@collabora.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard	 <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Chun-Kuang Hu	 <chunkuang.hu@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	AngeloGioacchino Del Regno	
	<angelogioacchino.delregno@collabora.com>,
	dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	linux-mediatek@lists.infradead.org,
	 linux-arm-kernel@lists.infradead.org, daniels@collabora.com,
	 ariel.dalessandro@collabora.com, kernel@collabora.com
Subject: Re: [PATCH 09/11] drm/colorop: Introduce 3x3 Matrix
Date: Fri, 06 Feb 2026 09:05:11 -0500	[thread overview]
Message-ID: <2fc9635430e6af0c175d6d019b7cd1598034892c.camel@collabora.com> (raw)
In-Reply-To: <20260206112702.4afdbc48@eldfell>

On Fri, 2026-02-06 at 11:27 +0200, Pekka Paalanen wrote:
> On Tue, 23 Dec 2025 16:44:50 -0300
> Nícolas F. R. A. Prado <nfraprado@collabora.com> wrote:
> 
> > Introduce a 3x3 Matrix colorop analogous to the 3x4 Matrix colorop,
> > with
> > the difference of not supporting offset coefficients.
> > 
> > Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
> > ---
> >  drivers/gpu/drm/drm_atomic.c      |  1 +
> >  drivers/gpu/drm/drm_atomic_uapi.c |  3 +++
> >  drivers/gpu/drm/drm_colorop.c     | 21 +++++++++++++++++++++
> >  include/drm/drm_colorop.h         |  3 +++
> >  include/uapi/drm/drm_mode.h       | 16 ++++++++++++++++
> >  5 files changed, 44 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic.c
> > b/drivers/gpu/drm/drm_atomic.c
> > index 6d3ea8056b60..bf4a31c02b70 100644
> > --- a/drivers/gpu/drm/drm_atomic.c
> > +++ b/drivers/gpu/drm/drm_atomic.c
> > @@ -802,6 +802,7 @@ static void
> > drm_atomic_colorop_print_state(struct drm_printer *p,
> >  		drm_printf(p, "\tdata blob id=%d\n", state->data ?
> > state->data->base.id : 0);
> >  		break;
> >  	case DRM_COLOROP_CTM_3X4:
> > +	case DRM_COLOROP_CTM_3X3:
> >  		drm_printf(p, "\tdata blob id=%d\n", state->data ?
> > state->data->base.id : 0);
> >  		break;
> >  	case DRM_COLOROP_MULTIPLIER:
> > diff --git a/drivers/gpu/drm/drm_atomic_uapi.c
> > b/drivers/gpu/drm/drm_atomic_uapi.c
> > index 7320db4b8489..7a70e894a2ef 100644
> > --- a/drivers/gpu/drm/drm_atomic_uapi.c
> > +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> > @@ -709,6 +709,9 @@ static int
> > drm_atomic_color_set_data_property(struct drm_colorop *colorop,
> >  		size = colorop->size * colorop->size * colorop-
> > >size *
> >  		       sizeof(struct drm_color_lut32);
> >  		break;
> > +	case DRM_COLOROP_CTM_3X3:
> > +		size = sizeof(struct drm_color_ctm);
> > +		break;
> >  	default:
> >  		/* should never get here */
> >  		return -EINVAL;
> > diff --git a/drivers/gpu/drm/drm_colorop.c
> > b/drivers/gpu/drm/drm_colorop.c
> > index a19e03fb9c7c..51c1a0726dfa 100644
> > --- a/drivers/gpu/drm/drm_colorop.c
> > +++ b/drivers/gpu/drm/drm_colorop.c
> > @@ -68,6 +68,7 @@ static const struct drm_prop_enum_list
> > drm_colorop_type_enum_list[] = {
> >  	{ DRM_COLOROP_CTM_3X4, "3x4 Matrix"},
> >  	{ DRM_COLOROP_MULTIPLIER, "Multiplier"},
> >  	{ DRM_COLOROP_3D_LUT, "3D LUT"},
> > +	{ DRM_COLOROP_CTM_3X3, "3x3 Matrix"},
> >  };
> >  
> >  static const char * const colorop_curve_1d_type_names[] = {
> > @@ -377,6 +378,26 @@ int drm_plane_colorop_ctm_3x4_init(struct
> > drm_device *dev, struct drm_colorop *c
> >  }
> >  EXPORT_SYMBOL(drm_plane_colorop_ctm_3x4_init);
> >  
> > +int drm_plane_colorop_ctm_3x3_init(struct drm_device *dev, struct
> > drm_colorop *colorop,
> > +				   struct drm_plane *plane, const
> > struct drm_colorop_funcs *funcs,
> > +				   uint32_t flags)
> > +{
> > +	int ret;
> > +
> > +	ret = drm_plane_colorop_init(dev, colorop, plane, funcs,
> > DRM_COLOROP_CTM_3X3, flags);
> > +	if (ret)
> > +		return ret;
> > +
> > +	ret = drm_colorop_create_data_prop(dev, colorop);
> > +	if (ret)
> > +		return ret;
> > +
> > +	drm_colorop_reset(colorop);
> > +
> > +	return 0;
> > +}
> > +EXPORT_SYMBOL(drm_plane_colorop_ctm_3x3_init);
> > +
> >  /**
> >   * drm_plane_colorop_mult_init - Initialize a
> > DRM_COLOROP_MULTIPLIER
> >   *
> > diff --git a/include/drm/drm_colorop.h b/include/drm/drm_colorop.h
> > index 8ec98521607d..ee7fa0eb5dbf 100644
> > --- a/include/drm/drm_colorop.h
> > +++ b/include/drm/drm_colorop.h
> > @@ -426,6 +426,9 @@ int drm_plane_colorop_curve_1d_lut_init(struct
> > drm_device *dev, struct drm_color
> >  int drm_plane_colorop_ctm_3x4_init(struct drm_device *dev, struct
> > drm_colorop *colorop,
> >  				   struct drm_plane *plane, const
> > struct drm_colorop_funcs *funcs,
> >  				   uint32_t flags);
> > +int drm_plane_colorop_ctm_3x3_init(struct drm_device *dev, struct
> > drm_colorop *colorop,
> > +				   struct drm_plane *plane, const
> > struct drm_colorop_funcs *funcs,
> > +				   uint32_t flags);
> >  int drm_plane_colorop_mult_init(struct drm_device *dev, struct
> > drm_colorop *colorop,
> >  				struct drm_plane *plane, const
> > struct drm_colorop_funcs *funcs,
> >  				uint32_t flags);
> > diff --git a/include/uapi/drm/drm_mode.h
> > b/include/uapi/drm/drm_mode.h
> > index cbbbfc1dfe2b..b894b19eb9f8 100644
> > --- a/include/uapi/drm/drm_mode.h
> > +++ b/include/uapi/drm/drm_mode.h
> > @@ -964,6 +964,22 @@ enum drm_colorop_type {
> >  	 *         color = lut3d[index]
> >  	 */
> >  	DRM_COLOROP_3D_LUT,
> > +
> > +	/**
> > +	 * @DRM_COLOROP_CTM_3X3:
> > +	 *
> > +	 * enum string "3x3 Matrix"
> > +	 *
> > +	 * A 3x3 matrix. Its values are specified via the
> > +	 * &drm_color_ctm struct provided via the DATA property.
> > +	 *
> > +	 * The DATA blob is a float[9]:
> > +	 * out   matrix          in
> > +	 * | R |   | 0  1  2 |   | R |
> > +	 * | G | = | 3  4  5 | x | G |
> > +	 * | B |   | 6  7  8 |   | B |
> > +	 */
> > +	DRM_COLOROP_CTM_3X3,
> >  };
> >  
> >  /**
> > 
> 
> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
> 
> FWIW, the statement "The DATA blob is a float[9]" is incorrect, but
> the
> same wording exists already with the DRM_COLOROP_CTM_3X4. The data
> type
> is not a float, nor is it a float reinterpreted as __u64 (they are
> not
> even the same size). Documentation for the structs explains the
> correct
> type, which is a fixed-point number.
> 
> The struct types document also the layout, so there is no need to
> repeat the layout here. It may be worth mentioning that the blob must
> contain exactly one instance of the struct.

Makes sense, thanks! I'll fix that in v2.

-- 
Thanks,

Nícolas

  reply	other threads:[~2026-02-06 14:05 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-23 19:44 [PATCH 00/11] Plane Color Pipeline support for MediaTek Nícolas F. R. A. Prado
2025-12-23 19:44 ` [PATCH 01/11] drm/mediatek: Introduce DDP plane_colorops_init() hook Nícolas F. R. A. Prado
2026-02-06 10:07   ` AngeloGioacchino Del Regno
2026-02-06 14:13     ` Nícolas F. R. A. Prado
2025-12-23 19:44 ` [PATCH 02/11] drm/mediatek: Initialize colorops when creating plane Nícolas F. R. A. Prado
2026-02-06 10:07   ` AngeloGioacchino Del Regno
2025-12-23 19:44 ` [PATCH 03/11] drm/mediatek: ovl: Add supports_plane_colorops flag Nícolas F. R. A. Prado
2025-12-24  2:17   ` Macpaul Lin (林智斌)
2026-02-06 10:07   ` AngeloGioacchino Del Regno
2026-02-06 14:10     ` Nícolas F. R. A. Prado
2025-12-23 19:44 ` [PATCH 04/11] drm/mediatek: ovl: Enable per-plane color operations on MT8195 Nícolas F. R. A. Prado
2025-12-24  2:19   ` Macpaul Lin (林智斌)
2026-02-06 10:07   ` AngeloGioacchino Del Regno
2026-02-06 14:11     ` Nícolas F. R. A. Prado
2025-12-23 19:44 ` [PATCH 05/11] drm/mediatek: ovl: Implement support for Inverse Gamma Nícolas F. R. A. Prado
2026-02-25  8:54   ` CK Hu (胡俊光)
2026-02-25  9:40     ` CK Hu (胡俊光)
2025-12-23 19:44 ` [PATCH 06/11] drm/mediatek: Add plane_colorops_init() DDP hook for OVL Nícolas F. R. A. Prado
2025-12-24  2:20   ` Macpaul Lin (林智斌)
2026-02-25  8:58   ` CK Hu (胡俊光)
2025-12-23 19:44 ` [PATCH 07/11] drm/colorop: Introduce HLG EOTF Nícolas F. R. A. Prado
2025-12-24  2:21   ` Macpaul Lin (林智斌)
2026-02-06  8:51   ` Pekka Paalanen
2026-02-06 14:02     ` Nícolas F. R. A. Prado
2025-12-23 19:44 ` [PATCH 08/11] drm/mediatek: ovl: Implement support for Gamma Nícolas F. R. A. Prado
2026-03-03  6:53   ` CK Hu (胡俊光)
2026-03-18 13:04     ` Nícolas F. R. A. Prado
2025-12-23 19:44 ` [PATCH 09/11] drm/colorop: Introduce 3x3 Matrix Nícolas F. R. A. Prado
2026-02-06  9:27   ` Pekka Paalanen
2026-02-06 14:05     ` Nícolas F. R. A. Prado [this message]
2025-12-23 19:44 ` [PATCH 10/11] drm/mediatek: ovl: Enable support for R2R Color Space Conversion Nícolas F. R. A. Prado
2026-03-03  7:16   ` CK Hu (胡俊光)
2026-03-18 13:18     ` Nícolas F. R. A. Prado
2025-12-23 19:44 ` [PATCH 11/11] drm/mediatek: Check 3x3 Matrix colorop has DATA set Nícolas F. R. A. Prado
2026-03-03  7:21   ` CK Hu (胡俊光)
2025-12-29 18:53 ` [PATCH 00/11] Plane Color Pipeline support for MediaTek Shengyu Qu
2026-01-01 12:37   ` Shengyu Qu
2026-01-02 18:40     ` Harry Wentland
2026-02-06  9:09       ` Pekka Paalanen
2026-02-06 13:28         ` Nícolas F. R. A. Prado
2026-02-26  6:24           ` CK Hu (胡俊光)
2026-02-26 10:26             ` AngeloGioacchino Del Regno
2026-02-26 10:51               ` AngeloGioacchino Del Regno
2026-03-18 12:43                 ` Nícolas F. R. A. Prado
2026-01-07 20:01   ` Xaver Hugl

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=2fc9635430e6af0c175d6d019b7cd1598034892c.camel@collabora.com \
    --to=nfraprado@collabora.com \
    --cc=airlied@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=ariel.dalessandro@collabora.com \
    --cc=chunkuang.hu@kernel.org \
    --cc=daniels@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@collabora.com \
    --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=pekka.paalanen@collabora.com \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    /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

all inboxes | Powered by JetHome®