From: Harry Wentland <harry.wentland@amd.com>
To: <dri-devel@lists.freedesktop.org>, <amd-gfx@lists.freedesktop.org>
Cc: Harry Wentland <harry.wentland@amd.com>,
Alex Hung <alex.hung@amd.com>,
Robert Mader <robert.mader@collabora.com>
Subject: [PATCH v6 07/10] drm/amd/display: Use GAMCOR for first TF if YUV conversion is needed
Date: Fri, 14 Aug 2026 17:18:13 -0400 [thread overview]
Message-ID: <20260814211816.1219597-8-harry.wentland@amd.com> (raw)
In-Reply-To: <20260814211816.1219597-1-harry.wentland@amd.com>
For subsampled formats we need to use GAMCOR instead of
the DEGAM block. The color module can create a LUT for
that if we set map_user_ramp to true. So do that when
we have subsampled formats.
Assisted-by: Claude:claude-sonnet-4.5
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Alex Hung <alex.hung@amd.com>
Tested-by: Robert Mader <robert.mader@collabora.com>
---
.../drm/amd/display/amdgpu_dm/amdgpu_dm_color.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
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 62791077ceef..8913bc9f0f06 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
@@ -1524,6 +1524,8 @@ __set_colorop_in_tf_1d_curve(struct dc_plane_state *dc_plane_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;
+ struct dc_color_caps *color_caps = NULL;
+ bool is_subsampled_format;
if (colorop->type != DRM_COLOROP_1D_CURVE)
return -EINVAL;
@@ -1537,10 +1539,23 @@ __set_colorop_in_tf_1d_curve(struct dc_plane_state *dc_plane_state,
}
drm_dbg(drm, "Degamma colorop with ID: %d\n", colorop->base.id);
-
tf->type = TF_TYPE_PREDEFINED;
+
+ /* Check if format requires post-scale color processing (subsampled formats) */
+ is_subsampled_format = (dc_plane_state->format >= SURFACE_PIXEL_FORMAT_VIDEO_BEGIN &&
+ dc_plane_state->format < SURFACE_PIXEL_FORMAT_SUBSAMPLE_END);
+
tf->tf = amdgpu_colorop_tf_to_dc_tf(colorop_state->curve_1d_type);
+ if (dc_plane_state->ctx && dc_plane_state->ctx->dc)
+ color_caps = &dc_plane_state->ctx->dc->caps.color;
+
+ if (!mod_color_calculate_degamma_params(color_caps, tf, NULL,
+ is_subsampled_format)) {
+ drm_err(drm, "Failed to calculate degamma params\n");
+ return -EINVAL;
+ }
+
return 0;
}
EXPORT_IF_KUNIT(__set_colorop_in_tf_1d_curve);
--
2.55.0
next prev parent reply other threads:[~2026-08-14 21:18 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 21:18 [PATCH v6 00/10] YUV conversion colorop with amdgpu and VKMS Harry Wentland
2026-08-14 21:18 ` [PATCH v6 01/10] drm/colorop: Add DRM_COLOROP_FIXED_MATRIX Harry Wentland
2026-08-14 21:18 ` [PATCH v6 02/10] drm/vkms: Fix limited-range YCbCr to RGB conversion scaling Harry Wentland
2026-08-21 13:18 ` Robert Mader
2026-08-14 21:18 ` [PATCH v6 03/10] drm/vkms: Add fixed matrix colorop to color pipeline Harry Wentland
2026-08-14 21:18 ` [PATCH v6 04/10] drm/vkms: Add atomic check and matrix handling for fixed matrix colorop Harry Wentland
2026-08-14 21:18 ` [PATCH v6 05/10] drm/amd/display: Add fixed matrix colorop to color pipeline Harry Wentland
2026-08-14 21:18 ` [PATCH v6 06/10] drm/amd/display: Implement fixed matrix colorop color space mapping Harry Wentland
2026-08-14 21:18 ` Harry Wentland [this message]
2026-08-14 21:18 ` [PATCH v6 08/10] drm/amd/display: Check actual state during commit_tail Harry Wentland
2026-08-14 21:18 ` [PATCH v6 09/10] drm/amd/display: Set color_space to plane_infos Harry Wentland
2026-08-14 21:18 ` [PATCH v6 10/10] drm/amd/display: Force GAMCOR for subsampled surfaces with PQ/Gamma22/HLG Harry Wentland
2026-08-17 7:51 ` [PATCH v6 00/10] YUV conversion colorop with amdgpu and VKMS Robert Mader
2026-08-17 15:36 ` Harry Wentland
2026-08-27 19:36 ` 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=20260814211816.1219597-8-harry.wentland@amd.com \
--to=harry.wentland@amd.com \
--cc=alex.hung@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=robert.mader@collabora.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.