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 08/10] drm/amd/display: Check actual state during commit_tail
Date: Fri, 14 Aug 2026 17:18:14 -0400 [thread overview]
Message-ID: <20260814211816.1219597-9-harry.wentland@amd.com> (raw)
In-Reply-To: <20260814211816.1219597-1-harry.wentland@amd.com>
Previously we checked the plane_state->state's plane_color_pipeline
client config when determining whether fill_plane_color_attributes
should run, i.e., whether we had a plane color pipeline and should
use that code for handling fixed matrix properties, or whether we
should look at legacy plane encoding and range.
The problem is that we also call this during commit_tail, during
which plane_state doesn't have the state backpointer. This meant
that during commit_tail we'd look at the legacy plane COLOR_RANGE
and COLOR_ENCODING values and overwrite what we pulled from the
fixed matrix colorop in atomic_check previously.
Instead pass the drm_atomic_state in explicitly and check that.
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>
---
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 12 +++++++-----
.../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 7 ++++---
.../amd/display/amdgpu_dm/tests/amdgpu_dm_test.c | 16 ++++++++--------
3 files changed, 19 insertions(+), 16 deletions(-)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index 38cffe127989..48d2d5dc9eb5 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2983,7 +2983,8 @@ STATIC_IFN_KUNIT bool modereset_required(struct drm_crtc_state *crtc_state)
EXPORT_IF_KUNIT(modereset_required);
STATIC_IFN_KUNIT int
-fill_plane_color_attributes(const struct drm_plane_state *plane_state,
+fill_plane_color_attributes(struct drm_atomic_commit *state,
+ const struct drm_plane_state *plane_state,
const enum surface_pixel_format format,
enum dc_color_space *color_space)
{
@@ -2992,7 +2993,7 @@ fill_plane_color_attributes(const struct drm_plane_state *plane_state,
*color_space = COLOR_SPACE_SRGB;
/* Ignore properties when DRM_CLIENT_CAP_PLANE_COLOR_PIPELINE is set */
- if (plane_state->state && plane_state->state->plane_color_pipeline)
+ if (state && state->plane_color_pipeline)
return 0;
/* DRM color properties only affect non-RGB formats. */
@@ -3033,6 +3034,7 @@ EXPORT_IF_KUNIT(fill_plane_color_attributes);
static int
fill_dc_plane_info_and_addr(struct amdgpu_device *adev,
+ struct drm_atomic_commit *state,
const struct drm_plane_state *plane_state,
const u64 tiling_flags,
struct dc_plane_info *plane_info,
@@ -3126,7 +3128,7 @@ fill_dc_plane_info_and_addr(struct amdgpu_device *adev,
plane_info->layer_index = plane_state->normalized_zpos;
- ret = fill_plane_color_attributes(plane_state, plane_info->format,
+ ret = fill_plane_color_attributes(state, plane_state, plane_info->format,
&plane_info->color_space);
if (ret)
return ret;
@@ -3167,7 +3169,7 @@ static int fill_dc_plane_attributes(struct amdgpu_device *adev,
dc_plane_state->clip_rect = scaling_info.clip_rect;
dc_plane_state->scaling_quality = scaling_info.scaling_quality;
- ret = fill_dc_plane_info_and_addr(adev, plane_state,
+ ret = fill_dc_plane_info_and_addr(adev, plane_state->state, plane_state,
afb->tiling_flags,
&plane_info,
&dc_plane_state->address,
@@ -4225,7 +4227,7 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_commit *state,
}
fill_dc_plane_info_and_addr(
- dm->adev, new_plane_state,
+ dm->adev, state, new_plane_state,
afb->tiling_flags,
&bundle->plane_infos[planes_count],
&bundle->flip_addrs[planes_count].address,
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
index 91affbdb2d6c..67c5b4bdf715 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h
@@ -1130,9 +1130,10 @@ void amdgpu_dm_apply_delay_after_dpcd_poweroff(struct amdgpu_device *adev,
#if IS_ENABLED(CONFIG_DRM_AMD_DC_KUNIT_TEST)
int dm_plane_layer_index_cmp(const void *a, const void *b);
-int fill_plane_color_attributes(const struct drm_plane_state *plane_state,
- const enum surface_pixel_format format,
- enum dc_color_space *color_space);
+int fill_plane_color_attributes(struct drm_atomic_commit *state,
+ const struct drm_plane_state *plane_state,
+ const enum surface_pixel_format format,
+ enum dc_color_space *color_space);
bool modereset_required(struct drm_crtc_state *crtc_state);
void dm_get_oriented_plane_size(struct drm_plane_state *plane_state,
int *src_w, int *src_h);
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c
index 0b29bf0a7d04..670a88da4424 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_test.c
@@ -100,7 +100,7 @@ static void dm_test_fill_color_attr_rgb_format(struct kunit *test)
plane_state.color_encoding = DRM_COLOR_YCBCR_BT709;
plane_state.color_range = DRM_COLOR_YCBCR_FULL_RANGE;
- ret = fill_plane_color_attributes(&plane_state,
+ ret = fill_plane_color_attributes(NULL, &plane_state,
SURFACE_PIXEL_FORMAT_GRPH_ARGB8888,
&color_space);
KUNIT_EXPECT_EQ(test, ret, 0);
@@ -120,7 +120,7 @@ static void dm_test_fill_color_attr_bt601_full(struct kunit *test)
plane_state.color_encoding = DRM_COLOR_YCBCR_BT601;
plane_state.color_range = DRM_COLOR_YCBCR_FULL_RANGE;
- ret = fill_plane_color_attributes(&plane_state,
+ ret = fill_plane_color_attributes(NULL, &plane_state,
SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr,
&color_space);
KUNIT_EXPECT_EQ(test, ret, 0);
@@ -140,7 +140,7 @@ static void dm_test_fill_color_attr_bt601_limited(struct kunit *test)
plane_state.color_encoding = DRM_COLOR_YCBCR_BT601;
plane_state.color_range = DRM_COLOR_YCBCR_LIMITED_RANGE;
- ret = fill_plane_color_attributes(&plane_state,
+ ret = fill_plane_color_attributes(NULL, &plane_state,
SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr,
&color_space);
KUNIT_EXPECT_EQ(test, ret, 0);
@@ -161,7 +161,7 @@ static void dm_test_fill_color_attr_bt709_full(struct kunit *test)
plane_state.color_encoding = DRM_COLOR_YCBCR_BT709;
plane_state.color_range = DRM_COLOR_YCBCR_FULL_RANGE;
- ret = fill_plane_color_attributes(&plane_state,
+ ret = fill_plane_color_attributes(NULL, &plane_state,
SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr,
&color_space);
KUNIT_EXPECT_EQ(test, ret, 0);
@@ -181,7 +181,7 @@ static void dm_test_fill_color_attr_bt709_limited(struct kunit *test)
plane_state.color_encoding = DRM_COLOR_YCBCR_BT709;
plane_state.color_range = DRM_COLOR_YCBCR_LIMITED_RANGE;
- ret = fill_plane_color_attributes(&plane_state,
+ ret = fill_plane_color_attributes(NULL, &plane_state,
SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr,
&color_space);
KUNIT_EXPECT_EQ(test, ret, 0);
@@ -202,7 +202,7 @@ static void dm_test_fill_color_attr_bt2020_full(struct kunit *test)
plane_state.color_encoding = DRM_COLOR_YCBCR_BT2020;
plane_state.color_range = DRM_COLOR_YCBCR_FULL_RANGE;
- ret = fill_plane_color_attributes(&plane_state,
+ ret = fill_plane_color_attributes(NULL, &plane_state,
SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr,
&color_space);
KUNIT_EXPECT_EQ(test, ret, 0);
@@ -223,7 +223,7 @@ static void dm_test_fill_color_attr_bt2020_limited(struct kunit *test)
plane_state.color_encoding = DRM_COLOR_YCBCR_BT2020;
plane_state.color_range = DRM_COLOR_YCBCR_LIMITED_RANGE;
- ret = fill_plane_color_attributes(&plane_state,
+ ret = fill_plane_color_attributes(NULL, &plane_state,
SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr,
&color_space);
KUNIT_EXPECT_EQ(test, ret, 0);
@@ -244,7 +244,7 @@ static void dm_test_fill_color_attr_invalid_encoding(struct kunit *test)
plane_state.color_encoding = 99;
plane_state.color_range = DRM_COLOR_YCBCR_FULL_RANGE;
- ret = fill_plane_color_attributes(&plane_state,
+ ret = fill_plane_color_attributes(NULL, &plane_state,
SURFACE_PIXEL_FORMAT_VIDEO_420_YCbCr,
&color_space);
KUNIT_EXPECT_EQ(test, ret, -EINVAL);
--
2.55.0
next prev parent reply other threads:[~2026-08-14 21:18 UTC|newest]
Thread overview: 14+ 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 ` [PATCH v6 07/10] drm/amd/display: Use GAMCOR for first TF if YUV conversion is needed Harry Wentland
2026-08-14 21:18 ` Harry Wentland [this message]
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
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-9-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.