From: Pekka Paalanen <pekka.paalanen@collabora.com>
To: Melissa Wen <mwen@igalia.com>
Cc: Alex Hung <alex.hung@amd.com>,
dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
wayland-devel@lists.freedesktop.org, harry.wentland@amd.com,
leo.liu@amd.com, ville.syrjala@linux.intel.com,
contact@emersion.fr, jadahl@redhat.com,
sebastian.wick@redhat.com, shashank.sharma@amd.com,
agoins@nvidia.com, joshua@froggi.es, mdaenzer@redhat.com,
aleixpol@kde.org, xaver.hugl@gmail.com, victoria@system76.com,
daniel@ffwll.ch, uma.shankar@intel.com, quic_naseer@quicinc.com,
quic_cbraga@quicinc.com, quic_abhinavk@quicinc.com,
marcan@marcan.st, Liviu.Dudau@arm.com, sashamcintosh@google.com,
chaitanya.kumar.borah@intel.com, louis.chauvet@bootlin.com,
Daniel Stone <daniels@collabora.com>
Subject: Re: [PATCH V9 26/43] drm/amd/display: Add support for sRGB EOTF in DEGAM block
Date: Tue, 13 May 2025 10:42:12 +0300 [thread overview]
Message-ID: <20250513104213.1c5d905a@eldfell> (raw)
In-Reply-To: <twwndnvjm6rmxdt4cs747fixvplpeuy3yh3ho6d4yq3y3prhub@fag4kafh2xct>
[-- Attachment #1: Type: text/plain, Size: 6397 bytes --]
On Mon, 12 May 2025 15:50:17 -0300
Melissa Wen <mwen@igalia.com> wrote:
> On 04/29, Alex Hung wrote:
> > Expose one 1D curve colorop with support for
> > DRM_COLOROP_1D_CURVE_SRGB_EOTF and program HW to perform
> > the sRGB transform when the colorop is not in bypass.
> >
> > With this change the following IGT test passes:
> > kms_colorop --run plane-XR30-XR30-srgb_eotf
> >
> > The color pipeline now consists of a single colorop:
> > 1. 1D curve colorop w/ sRGB EOTF
> >
> > Signed-off-by: Alex Hung <alex.hung@amd.com>
> > Co-developed-by: Harry Wentland <harry.wentland@amd.com>
> > Signed-off-by: Harry Wentland <harry.wentland@amd.com>
> > Reviewed-by: Daniel Stone <daniels@collabora.com>
> > ---
> > V9:
> > - Update function names by _plane_ (Chaitanya Kumar Borah)
> > - Update replace cleanup code by drm_colorop_pipeline_destroy (Simon Ser)
> >
> > v8:
> > - Fix incorrect && by || in __set_colorop_in_tf_1d_curve (Leo Li)
> >
> > v7:
> > - Fix checkpatch warnings
> > - Change switch "{ }" position
> > - Delete double ";"
> > - Delete "{ }" for single-line if-statement
> > - Add a new line at EOF
> > - Change SPDX-License-Identifier: GPL-2.0+ from // to /* */
> >
> > v6:
> > - cleanup if colorop alloc or init fails
> >
> > .../gpu/drm/amd/display/amdgpu_dm/Makefile | 3 +-
> > .../amd/display/amdgpu_dm/amdgpu_dm_color.c | 86 +++++++++++++++++++
> > .../amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 69 +++++++++++++++
> > .../amd/display/amdgpu_dm/amdgpu_dm_colorop.h | 34 ++++++++
> > .../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 10 +++
> > 5 files changed, 201 insertions(+), 1 deletion(-)
> > create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c
> > create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.h
> >
> > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/Makefile b/drivers/gpu/drm/amd/display/amdgpu_dm/Makefile
> > index ab2a97e354da..46158d67ab12 100644
> > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/Makefile
> > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/Makefile
> > @@ -38,7 +38,8 @@ AMDGPUDM = \
> > amdgpu_dm_pp_smu.o \
> > amdgpu_dm_psr.o \
> > amdgpu_dm_replay.o \
> > - amdgpu_dm_wb.o
> > + amdgpu_dm_wb.o \
> > + amdgpu_dm_colorop.o
> >
> > ifdef CONFIG_DRM_AMD_DC_FP
> > AMDGPUDM += dc_fpu.o
> > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
> > index ebabfe3a512f..0b513ab5050f 100644
> > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
> > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
> > @@ -668,6 +668,18 @@ amdgpu_tf_to_dc_tf(enum amdgpu_transfer_function tf)
> > }
> > }
> >
> > +static enum dc_transfer_func_predefined
> > +amdgpu_colorop_tf_to_dc_tf(enum drm_colorop_curve_1d_type tf)
> > +{
> > + switch (tf) {
> > + case DRM_COLOROP_1D_CURVE_SRGB_EOTF:
> > + case DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF:
> > + return TRANSFER_FUNCTION_SRGB;
> > + default:
> > + return TRANSFER_FUNCTION_LINEAR;
> > + }
> > +}
> > +
> > static void __to_dc_lut3d_color(struct dc_rgb *rgb,
> > const struct drm_color_lut lut,
> > int bit_precision)
> > @@ -1137,6 +1149,59 @@ __set_dm_plane_degamma(struct drm_plane_state *plane_state,
> > return 0;
> > }
> >
> > +static int
> > +__set_colorop_in_tf_1d_curve(struct dc_plane_state *dc_plane_state,
> > + struct drm_colorop_state *colorop_state)
> > +{
> > + struct dc_transfer_func *tf = &dc_plane_state->in_transfer_func;
> > + struct drm_colorop *colorop = colorop_state->colorop;
> > + struct drm_device *drm = colorop->dev;
> > +
> > + if (colorop->type != DRM_COLOROP_1D_CURVE ||
> > + colorop_state->curve_1d_type != DRM_COLOROP_1D_CURVE_SRGB_EOTF)
> > + return -EINVAL;
> > +
> > + if (colorop_state->bypass) {
> > + tf->type = TF_TYPE_BYPASS;
> > + tf->tf = TRANSFER_FUNCTION_LINEAR;
> > + return 0;
> > + }
> > +
> > + drm_dbg(drm, "Degamma colorop with ID: %d\n", colorop->base.id);
> > +
> > + tf->type = TF_TYPE_PREDEFINED;
> > + tf->tf = amdgpu_colorop_tf_to_dc_tf(colorop_state->curve_1d_type);
> > +
> > + return 0;
> > +}
> > +
> > +static int
> > +__set_dm_plane_colorop_degamma(struct drm_plane_state *plane_state,
> > + struct dc_plane_state *dc_plane_state,
> > + struct drm_colorop *colorop)
> > +{
> > + struct drm_colorop *old_colorop;
> > + struct drm_colorop_state *colorop_state = NULL, *new_colorop_state;
> > + struct drm_atomic_state *state = plane_state->state;
> > + int i = 0;
> > +
> > + old_colorop = colorop;
> > +
> > + /* 1st op: 1d curve - degamma */
> > + for_each_new_colorop_in_state(state, colorop, new_colorop_state, i) {
> > + if (new_colorop_state->colorop == old_colorop &&
> > + new_colorop_state->curve_1d_type == DRM_COLOROP_1D_CURVE_SRGB_EOTF) {
> > + colorop_state = new_colorop_state;
> > + break;
> > + }
> > + }
> > +
> > + if (!colorop_state)
> > + return -EINVAL;
> > +
> > + return __set_colorop_in_tf_1d_curve(dc_plane_state, colorop_state);
>
> I wonder what will happen if plane degamma isn't set, but CRTC degamma
> LUT or legacy CRTC regamma LUT (with its implicity sRGB degamma) is used
> together with other plane color ops.
>
> I can imagine the mess, so I think CRTC degamma LUT and legacy CRTC
> regamma LUT should be somehow entirely disabled (or rejected) if plane
> color pipeline is in use.
Hi Melissa,
if using a plane color pipeline means that a CRTC LUT cannot be used, it
will severely limit the usefulness of the whole KMS color processing. In
Weston's case it would prohibit *all* KMS off-loading when color
management is in use.
Weston chooses to do composition and blending in an optical space. This
means that plane color pipelines are required to convert incoming
pixels into the optical space, and a CRTC LUT (a CRTC color pipeline in
the future) is required to convert from the optical space to the
monitor signalling (electrical space).
I don't know what "with its implicity sRGB degamma" means, but there
cannot be any implicit curves at all. The driver has no knowledge of
how the framebuffer pixels are encoded, nor about what the blending
space should be.
Thanks,
pq
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2025-05-13 12:33 UTC|newest]
Thread overview: 82+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-30 1:10 [PATCH V9 00/43] Color Pipeline API w/ VKMS Alex Hung
2025-04-30 1:10 ` [PATCH V9 01/43] drm: Add helper for conversion from signed-magnitude Alex Hung
2025-04-30 1:10 ` [PATCH V9 02/43] drm/vkms: Add kunit tests for VKMS LUT handling Alex Hung
2025-04-30 1:10 ` [PATCH V9 03/43] drm/doc/rfc: Describe why prescriptive color pipeline is needed Alex Hung
2025-05-15 9:30 ` Simon Ser
2025-04-30 1:10 ` [PATCH V9 04/43] drm/colorop: Introduce new drm_colorop mode object Alex Hung
2025-04-30 1:10 ` [PATCH V9 05/43] drm/colorop: Add TYPE property Alex Hung
2025-04-30 1:10 ` [PATCH V9 06/43] drm/colorop: Add 1D Curve subtype Alex Hung
2025-04-30 1:10 ` [PATCH V9 07/43] drm/colorop: Add BYPASS property Alex Hung
2025-04-30 1:10 ` [PATCH V9 08/43] drm/colorop: Add NEXT property Alex Hung
2025-04-30 1:10 ` [PATCH V9 09/43] drm/colorop: Add atomic state print for drm_colorop Alex Hung
2025-04-30 1:10 ` [PATCH V9 10/43] drm/plane: Add COLOR PIPELINE property Alex Hung
2025-04-30 1:10 ` [PATCH V9 11/43] drm/colorop: Introduce DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE Alex Hung
2025-04-30 1:10 ` [PATCH V9 12/43] Documentation/gpu: document drm_colorop Alex Hung
2025-04-30 1:10 ` [PATCH V9 13/43] drm/colorop: Add destroy functions for color pipeline Alex Hung
2025-05-15 9:34 ` Simon Ser
2025-04-30 1:10 ` [PATCH V9 14/43] drm/vkms: Add enumerated 1D curve colorop Alex Hung
2025-04-30 1:10 ` [PATCH V9 15/43] drm/vkms: Add kunit tests for linear and sRGB LUTs Alex Hung
2025-05-07 10:03 ` kernel test robot
2025-04-30 1:10 ` [PATCH V9 16/43] drm/colorop: Add 3x4 CTM type Alex Hung
2025-06-16 11:30 ` Borah, Chaitanya Kumar
2025-06-16 13:32 ` Pekka Paalanen
2025-06-17 5:33 ` Borah, Chaitanya Kumar
2025-06-17 15:25 ` Ville Syrjälä
2025-04-30 1:10 ` [PATCH V9 17/43] drm/vkms: Use s32 for internal color pipeline precision Alex Hung
2025-04-30 1:10 ` [PATCH V9 18/43] drm/vkms: add 3x4 matrix in color pipeline Alex Hung
2025-04-30 1:10 ` [PATCH V9 19/43] drm/tests: Add a few tests around drm_fixed.h Alex Hung
2025-04-30 1:10 ` [PATCH V9 20/43] drm/vkms: Add tests for CTM handling Alex Hung
2025-04-30 1:10 ` [PATCH V9 21/43] drm/colorop: pass plane_color_pipeline client cap to atomic check Alex Hung
2025-04-30 1:10 ` [PATCH V9 22/43] drm/colorop: define a new macro for_each_new_colorop_in_state Alex Hung
2025-05-12 18:32 ` Melissa Wen
2025-04-30 1:10 ` [PATCH V9 23/43] drm/amd/display: Ignore deprecated props when plane_color_pipeline set Alex Hung
2025-04-30 1:10 ` [PATCH V9 24/43] drm/amd/display: Add bypass COLOR PIPELINE Alex Hung
2025-05-12 18:41 ` Melissa Wen
2025-04-30 1:10 ` [PATCH V9 25/43] drm/amd/display: Skip color pipeline initialization for cursor plane Alex Hung
2025-04-30 1:10 ` [PATCH V9 26/43] drm/amd/display: Add support for sRGB EOTF in DEGAM block Alex Hung
2025-05-12 18:50 ` Melissa Wen
2025-05-13 7:42 ` Pekka Paalanen [this message]
2025-05-13 15:36 ` Melissa Wen
2025-05-13 20:39 ` Harry Wentland
2025-05-15 10:57 ` Pekka Paalanen
2025-04-30 1:10 ` [PATCH V9 27/43] drm/amd/display: Add support for sRGB Inverse EOTF in SHAPER block Alex Hung
2025-04-30 1:10 ` [PATCH V9 28/43] drm/amd/display: Add support for sRGB EOTF in BLND block Alex Hung
2025-04-30 1:10 ` [PATCH V9 29/43] drm/colorop: Add PQ 125 EOTF and its inverse Alex Hung
2025-04-30 1:11 ` [PATCH V9 30/43] drm/amd/display: Enable support for PQ 125 EOTF and Inverse Alex Hung
2025-04-30 1:11 ` [PATCH V9 31/43] drm/colorop: add BT2020/BT709 OETF and Inverse OETF Alex Hung
2025-05-15 9:35 ` Simon Ser
2025-04-30 1:11 ` [PATCH V9 32/43] drm/amd/display: Add support for BT.709 and BT.2020 TFs Alex Hung
2025-05-12 19:37 ` Melissa Wen
2025-04-30 1:11 ` [PATCH V9 33/43] drm/colorop: Add 1D Curve Custom LUT type Alex Hung
2025-04-30 1:11 ` [PATCH V9 34/43] drm/amd/display: add shaper and blend colorops for 1D Curve Custom LUT Alex Hung
2025-04-30 1:11 ` [PATCH V9 35/43] drm/amd/display: add 3x4 matrix colorop Alex Hung
2025-05-07 12:08 ` kernel test robot
2025-04-30 1:11 ` [PATCH V9 36/43] drm/colorop: Add mutliplier type Alex Hung
2025-05-12 20:02 ` Melissa Wen
2025-04-30 1:11 ` [PATCH V9 37/43] drm/amd/display: add multiplier colorop Alex Hung
2025-04-30 1:11 ` [PATCH V9 38/43] drm/amd/display: Swap matrix and multiplier Alex Hung
2025-04-30 1:11 ` [PATCH V9 39/43] drm/colorop: Define LUT_1D interpolation Alex Hung
2025-04-30 1:11 ` [PATCH V9 40/43] drm/colorop: allow non-bypass colorops Alex Hung
2025-05-15 9:37 ` Simon Ser
2025-04-30 1:11 ` [PATCH V9 41/43] drm/colorop: Add 3D LUT support to color pipeline Alex Hung
2025-04-30 1:11 ` [PATCH V9 42/43] drm/amd/display: add 3D LUT colorop Alex Hung
2025-05-13 0:52 ` Melissa Wen
2025-05-13 3:29 ` Alex Hung
2025-05-13 15:52 ` Melissa Wen
2025-04-30 1:11 ` [PATCH V9 43/43] drm/amd/display: Add AMD color pipeline doc Alex Hung
2025-05-13 15:59 ` [PATCH V9 00/43] Color Pipeline API w/ VKMS Melissa Wen
2025-05-15 9:45 ` Simon Ser
2025-05-15 14:10 ` Harry Wentland
2025-05-15 14:15 ` Simon Ser
2025-05-15 17:19 ` Daniel Stone
2025-05-15 18:02 ` Harry Wentland
2025-05-15 18:39 ` Daniel Stone
2025-05-15 19:59 ` Leandro Ribeiro
2025-05-17 11:51 ` Xaver Hugl
2025-05-21 19:48 ` Harry Wentland
2025-05-22 7:57 ` Pekka Paalanen
2025-05-22 13:28 ` Harry Wentland
2025-05-22 13:49 ` Simon Ser
2025-05-22 13:54 ` Harry Wentland
2025-05-22 15:27 ` Pekka Paalanen
2025-05-22 15:49 ` Harry Wentland
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=20250513104213.1c5d905a@eldfell \
--to=pekka.paalanen@collabora.com \
--cc=Liviu.Dudau@arm.com \
--cc=agoins@nvidia.com \
--cc=aleixpol@kde.org \
--cc=alex.hung@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=chaitanya.kumar.borah@intel.com \
--cc=contact@emersion.fr \
--cc=daniel@ffwll.ch \
--cc=daniels@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=jadahl@redhat.com \
--cc=joshua@froggi.es \
--cc=leo.liu@amd.com \
--cc=louis.chauvet@bootlin.com \
--cc=marcan@marcan.st \
--cc=mdaenzer@redhat.com \
--cc=mwen@igalia.com \
--cc=quic_abhinavk@quicinc.com \
--cc=quic_cbraga@quicinc.com \
--cc=quic_naseer@quicinc.com \
--cc=sashamcintosh@google.com \
--cc=sebastian.wick@redhat.com \
--cc=shashank.sharma@amd.com \
--cc=uma.shankar@intel.com \
--cc=victoria@system76.com \
--cc=ville.syrjala@linux.intel.com \
--cc=wayland-devel@lists.freedesktop.org \
--cc=xaver.hugl@gmail.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