From: Alex Hung <alex.hung@amd.com>
To: <dri-devel@lists.freedesktop.org>, <amd-gfx@lists.freedesktop.org>
Cc: <wayland-devel@lists.freedesktop.org>, <harry.wentland@amd.com>,
<alex.hung@amd.com>, <leo.liu@amd.com>,
<ville.syrjala@linux.intel.com>, <pekka.paalanen@collabora.com>,
<contact@emersion.fr>, <mwen@igalia.com>, <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>
Subject: [PATCH V8 26/43] drm/amd/display: Add support for sRGB Inverse EOTF in SHAPER block
Date: Wed, 26 Mar 2025 17:47:07 -0600 [thread overview]
Message-ID: <20250326234748.2982010-27-alex.hung@amd.com> (raw)
In-Reply-To: <20250326234748.2982010-1-alex.hung@amd.com>
Expose a 2nd curve colorop with support for
DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF and program HW to
perform the sRGB Inverse EOTF on the shaper block
when the colorop is not in bypass.
With this change the follow IGT tests pass:
kms_colorop --run plane-XR30-XR30-srgb_inv_eotf
kms_colorop --run plane-XR30-XR30-srgb_eotf-srgb_inv_eotf
The color pipeline now consists of the following colorops:
1. 1D curve colorop w/ sRGB EOTF support
2. 1D curve colorop w/ sRGB Inverse EOTF support
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>
---
v6:
- don't pass uninitialized variable into __set_output_tf
.../amd/display/amdgpu_dm/amdgpu_dm_color.c | 74 +++++++++++++++++++
.../amd/display/amdgpu_dm/amdgpu_dm_colorop.c | 19 +++++
.../amd/display/amdgpu_dm/amdgpu_dm_colorop.h | 1 +
3 files changed, 94 insertions(+)
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 0b513ab5050f..4662d88885de 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
@@ -1202,6 +1202,68 @@ __set_dm_plane_colorop_degamma(struct drm_plane_state *plane_state,
return __set_colorop_in_tf_1d_curve(dc_plane_state, colorop_state);
}
+static int
+__set_colorop_in_shaper_1d_curve(struct dc_plane_state *dc_plane_state,
+ struct drm_colorop_state *colorop_state)
+{
+ struct dc_transfer_func *tf = &dc_plane_state->in_shaper_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_INV_EOTF)
+ return -EINVAL;
+
+ if (colorop_state->bypass) {
+ tf->type = TF_TYPE_BYPASS;
+ tf->tf = TRANSFER_FUNCTION_LINEAR;
+ return 0;
+ }
+
+ drm_dbg(drm, "Shaper colorop with ID: %d\n", colorop->base.id);
+
+ if (colorop->type == DRM_COLOROP_1D_CURVE) {
+ tf->type = TF_TYPE_DISTRIBUTED_POINTS;
+ tf->tf = amdgpu_colorop_tf_to_dc_tf(colorop_state->curve_1d_type);
+ tf->sdr_ref_white_level = SDR_WHITE_LEVEL_INIT_VALUE;
+ return __set_output_tf(tf, 0, 0, false);
+ }
+
+ return -EINVAL;
+}
+
+static int
+__set_dm_plane_colorop_shaper(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;
+
+ /* 2nd op: 1d curve - shaper */
+ 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_INV_EOTF) {
+ colorop_state = new_colorop_state;
+ break;
+ }
+
+ if (new_colorop_state->colorop == old_colorop) {
+ colorop_state = new_colorop_state;
+ break;
+ }
+ }
+
+ if (!colorop_state)
+ return -EINVAL;
+
+ return __set_colorop_in_shaper_1d_curve(dc_plane_state, colorop_state);
+}
+
static int
amdgpu_dm_plane_set_color_properties(struct drm_plane_state *plane_state,
struct dc_plane_state *dc_plane_state)
@@ -1257,6 +1319,7 @@ amdgpu_dm_plane_set_colorop_properties(struct drm_plane_state *plane_state,
struct dc_plane_state *dc_plane_state)
{
struct drm_colorop *colorop = plane_state->color_pipeline;
+ struct drm_device *dev = plane_state->plane->dev;
int ret;
/* 1D Curve - DEGAM TF */
@@ -1267,6 +1330,17 @@ amdgpu_dm_plane_set_colorop_properties(struct drm_plane_state *plane_state,
if (ret)
return ret;
+ /* 1D Curve - SHAPER TF */
+ colorop = colorop->next;
+ if (!colorop) {
+ drm_dbg(dev, "no Shaper TF colorop found\n");
+ return -EINVAL;
+ }
+
+ ret = __set_dm_plane_colorop_shaper(plane_state, dc_plane_state, colorop);
+ if (ret)
+ return ret;
+
return 0;
}
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c
index 3be0cb19ebc7..718544b11863 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.c
@@ -34,6 +34,9 @@
const u64 amdgpu_dm_supported_degam_tfs =
BIT(DRM_COLOROP_1D_CURVE_SRGB_EOTF);
+const u64 amdgpu_dm_supported_shaper_tfs =
+ BIT(DRM_COLOROP_1D_CURVE_SRGB_INV_EOTF);
+
#define MAX_COLOR_PIPELINE_OPS 10
int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_prop_enum_list *list)
@@ -60,6 +63,22 @@ int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_pr
list->type = ops[i]->base.id;
list->name = kasprintf(GFP_KERNEL, "Color Pipeline %d", ops[i]->base.id);
+ i++;
+
+ /* 1D curve - SHAPER TF */
+ ops[i] = kzalloc(sizeof(struct drm_colorop), GFP_KERNEL);
+ if (!ops[i]) {
+ DRM_ERROR("KMS: Failed to allocate colorop\n");
+ ret = -ENOMEM;
+ goto cleanup;
+ }
+
+ ret = drm_colorop_curve_1d_init(dev, ops[i], plane, amdgpu_dm_supported_shaper_tfs);
+ if (ret)
+ goto cleanup;
+
+ drm_colorop_set_next_property(ops[i-1], ops[i]);
+
return 0;
cleanup:
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.h
index 3324e2a66079..71cd27994528 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_colorop.h
@@ -28,6 +28,7 @@
#define __AMDGPU_DM_COLOROP_H__
extern const u64 amdgpu_dm_supported_degam_tfs;
+extern const u64 amdgpu_dm_supported_shaper_tfs;
int amdgpu_dm_initialize_default_pipeline(struct drm_plane *plane, struct drm_prop_enum_list *list);
--
2.43.0
next prev parent reply other threads:[~2025-03-26 23:54 UTC|newest]
Thread overview: 128+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-26 23:46 [PATCH V8 00/43] Color Pipeline API w/ VKMS Alex Hung
2025-03-26 23:46 ` [PATCH V8 01/43] drm: Add helper for conversion from signed-magnitude Alex Hung
2025-03-26 23:46 ` [PATCH V8 02/43] drm/vkms: Add kunit tests for VKMS LUT handling Alex Hung
2025-03-26 23:46 ` [PATCH V8 03/43] drm/doc/rfc: Describe why prescriptive color pipeline is needed Alex Hung
2025-03-29 15:26 ` Simon Ser
2025-04-01 0:10 ` Alex Hung
2025-04-01 7:26 ` Simon Ser
2025-03-31 16:24 ` Shengyu Qu
2025-03-31 16:41 ` Alex Hung
2025-03-31 16:54 ` Shengyu Qu
2025-03-26 23:46 ` [PATCH V8 04/43] drm/colorop: Introduce new drm_colorop mode object Alex Hung
2025-03-26 23:46 ` [PATCH V8 05/43] drm/colorop: Add TYPE property Alex Hung
2025-03-26 23:46 ` [PATCH V8 06/43] drm/colorop: Add 1D Curve subtype Alex Hung
2025-04-01 15:14 ` Daniel Stone
2025-04-01 19:53 ` Simon Ser
2025-04-01 21:02 ` Harry Wentland
2025-04-08 16:40 ` Daniel Stone
2025-04-08 17:30 ` Harry Wentland
2025-04-08 18:28 ` Daniel Stone
2025-04-10 7:53 ` Pipeline vs. no pipeline (Re: [PATCH V8 06/43] drm/colorop: Add 1D Curve subtype) Pekka Paalanen
2025-04-15 15:29 ` Harry Wentland
2025-04-16 14:39 ` Xaver Hugl
2025-04-17 8:28 ` Pekka Paalanen
2025-04-10 10:05 ` [PATCH V8 06/43] drm/colorop: Add 1D Curve subtype Simon Ser
2025-04-15 11:12 ` Borah, Chaitanya Kumar
2025-04-17 15:13 ` Simon Ser
2025-03-26 23:46 ` [PATCH V8 07/43] drm/colorop: Add BYPASS property Alex Hung
2025-03-26 23:46 ` [PATCH V8 08/43] drm/colorop: Add NEXT property Alex Hung
2025-03-27 23:26 ` Simon Ser
2025-03-26 23:46 ` [PATCH V8 09/43] drm/colorop: Add atomic state print for drm_colorop Alex Hung
2025-03-27 23:29 ` Simon Ser
2025-03-26 23:46 ` [PATCH V8 10/43] drm/plane: Add COLOR PIPELINE property Alex Hung
2025-03-29 14:33 ` Simon Ser
2025-03-26 23:46 ` [PATCH V8 11/43] drm/colorop: Introduce DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE Alex Hung
2025-03-29 14:37 ` Simon Ser
2025-04-01 1:42 ` Shengyu Qu
2025-03-26 23:46 ` [PATCH V8 12/43] Documentation/gpu: document drm_colorop Alex Hung
2025-03-29 14:40 ` Simon Ser
2025-03-26 23:46 ` [PATCH V8 13/43] drm/vkms: Add enumerated 1D curve colorop Alex Hung
2025-03-26 23:46 ` [PATCH V8 14/43] drm/vkms: Add kunit tests for linear and sRGB LUTs Alex Hung
2025-03-26 23:46 ` [PATCH V8 15/43] drm/colorop: Add 3x4 CTM type Alex Hung
2025-03-26 23:46 ` [PATCH V8 16/43] drm/vkms: Use s32 for internal color pipeline precision Alex Hung
2025-03-26 23:46 ` [PATCH V8 17/43] drm/vkms: add 3x4 matrix in color pipeline Alex Hung
2025-03-26 23:46 ` [PATCH V8 18/43] drm/tests: Add a few tests around drm_fixed.h Alex Hung
2025-03-26 23:47 ` [PATCH V8 19/43] drm/vkms: Add tests for CTM handling Alex Hung
2025-03-26 23:47 ` [PATCH V8 20/43] drm/colorop: pass plane_color_pipeline client cap to atomic check Alex Hung
2025-03-29 15:32 ` Simon Ser
2025-03-26 23:47 ` [PATCH V8 21/43] drm/colorop: define a new macro for_each_new_colorop_in_state Alex Hung
2025-03-26 23:47 ` [PATCH V8 22/43] drm/amd/display: Ignore deprecated props when plane_color_pipeline set Alex Hung
2025-03-26 23:47 ` [PATCH V8 23/43] drm/amd/display: Add bypass COLOR PIPELINE Alex Hung
2025-03-26 23:47 ` [PATCH V8 24/43] drm/amd/display: Skip color pipeline initialization for cursor plane Alex Hung
2025-03-30 9:48 ` Shengyu Qu
2025-03-30 12:59 ` Shengyu Qu
2025-03-31 14:28 ` Alex Hung
2025-03-31 15:43 ` Shengyu Qu
2025-03-31 16:06 ` Alex Hung
2025-03-31 16:12 ` Shengyu Qu
2025-03-31 16:26 ` Alex Hung
2025-03-31 16:31 ` Shengyu Qu
2025-03-31 16:34 ` Alex Hung
2025-03-31 16:50 ` Shengyu Qu
2025-03-31 17:04 ` Shengyu Qu
2025-03-31 17:42 ` Alex Hung
2025-03-31 18:53 ` Xaver Hugl
2025-04-01 0:28 ` Alex Hung
2025-04-01 15:04 ` Xaver Hugl
2025-04-01 15:45 ` Melissa Wen
2025-04-01 19:39 ` Harry Wentland
2025-04-01 1:04 ` Shengyu Qu
2025-04-01 1:24 ` Alex Hung
2025-04-01 9:56 ` Michel Dänzer
2025-04-01 12:32 ` Shengyu Qu
2025-04-01 14:11 ` Michel Dänzer
2025-04-01 15:45 ` Shengyu Qu
2025-04-01 19:45 ` Harry Wentland
2025-04-02 3:47 ` Qu Shengyu
2025-04-01 16:24 ` Shengyu Qu
2025-03-26 23:47 ` [PATCH V8 25/43] drm/amd/display: Add support for sRGB EOTF in DEGAM block Alex Hung
2025-03-26 23:47 ` Alex Hung [this message]
2025-03-26 23:47 ` [PATCH V8 27/43] drm/amd/display: Add support for sRGB EOTF in BLND block Alex Hung
2025-03-26 23:47 ` [PATCH V8 28/43] drm/colorop: Add PQ 125 EOTF and its inverse Alex Hung
2025-03-29 14:48 ` Simon Ser
2025-03-26 23:47 ` [PATCH V8 29/43] drm/amd/display: Enable support for PQ 125 EOTF and Inverse Alex Hung
2025-03-26 23:47 ` [PATCH V8 30/43] drm/colorop: add BT2020/BT709 OETF and Inverse OETF Alex Hung
2025-03-29 14:53 ` Simon Ser
2025-03-26 23:47 ` [PATCH V8 31/43] drm/amd/display: Add support for BT.709 and BT.2020 TFs Alex Hung
2025-03-26 23:47 ` [PATCH V8 32/43] drm/colorop: Add 1D Curve Custom LUT type Alex Hung
2025-03-29 14:55 ` Simon Ser
2025-04-15 6:09 ` Shankar, Uma
2025-04-15 6:16 ` Simon Ser
2025-04-15 6:40 ` Shankar, Uma
2025-04-15 15:05 ` Harry Wentland
2025-04-15 16:25 ` Simon Ser
2025-05-22 11:33 ` Shankar, Uma
2025-05-30 13:58 ` Pekka Paalanen
2025-06-03 8:30 ` Shankar, Uma
2025-06-03 10:51 ` Pekka Paalanen
2025-06-03 20:26 ` Harry Wentland
2025-06-04 18:59 ` Shankar, Uma
2025-06-05 7:30 ` Pekka Paalanen
2025-03-26 23:47 ` [PATCH V8 33/43] drm/amd/display: add shaper and blend colorops for 1D Curve Custom LUT Alex Hung
2025-03-26 23:47 ` [PATCH V8 34/43] drm/amd/display: add 3x4 matrix colorop Alex Hung
2025-03-26 23:47 ` [PATCH V8 35/43] drm/colorop: Add mutliplier type Alex Hung
2025-03-26 23:47 ` [PATCH V8 36/43] drm/amd/display: add multiplier colorop Alex Hung
2025-03-26 23:47 ` [PATCH V8 37/43] drm/amd/display: Swap matrix and multiplier Alex Hung
2025-03-26 23:47 ` [PATCH V8 38/43] drm/colorop: Define LUT_1D interpolation Alex Hung
2025-03-26 23:47 ` [PATCH V8 39/43] drm/colorop: allow non-bypass colorops Alex Hung
2025-03-29 15:41 ` Simon Ser
2025-03-26 23:47 ` [PATCH V8 40/43] drm/colorop: Add 3D LUT support to color pipeline Alex Hung
2025-03-29 14:57 ` Simon Ser
2025-04-25 13:50 ` Leandro Ribeiro
2025-05-13 3:39 ` Alex Hung
2025-05-17 1:22 ` Xaver Hugl
2025-05-17 11:53 ` Simon Ser
2025-05-17 22:32 ` Xaver Hugl
2025-05-19 23:43 ` Simon Ser
2025-05-20 20:13 ` Harry Wentland
2025-05-21 19:18 ` Harry Wentland
2025-05-22 10:14 ` Simon Ser
2025-05-22 11:46 ` Shankar, Uma
2025-05-17 17:36 ` Autumn Ashton
2025-03-26 23:47 ` [PATCH V8 41/43] drm/amd/display: add 3D LUT colorop Alex Hung
2025-03-26 23:47 ` [PATCH V8 42/43] drm/amd/display: Add AMD color pipeline doc Alex Hung
2025-03-26 23:47 ` [PATCH V8 43/43] drm/colorop: Add destroy functions for color pipeline Alex Hung
2025-03-29 15:48 ` Simon Ser
2025-04-01 2:42 ` Alex Hung
2025-04-10 16:18 ` Simon Ser
2025-03-29 15:51 ` [PATCH V8 00/43] Color Pipeline API w/ VKMS Simon Ser
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=20250326234748.2982010-27-alex.hung@amd.com \
--to=alex.hung@amd.com \
--cc=Liviu.Dudau@arm.com \
--cc=agoins@nvidia.com \
--cc=aleixpol@kde.org \
--cc=amd-gfx@lists.freedesktop.org \
--cc=chaitanya.kumar.borah@intel.com \
--cc=contact@emersion.fr \
--cc=daniel@ffwll.ch \
--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=pekka.paalanen@collabora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.