mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] drm/amd/display: Fix HDMI RGB quantization updates
@ 2026-08-30  3:51 Satyajit Roy
  2026-08-30  3:51 ` [PATCH 1/3] drm/amd/display: Propagate HDMI RGB quantization selectability Satyajit Roy
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Satyajit Roy @ 2026-08-30  3:51 UTC (permalink / raw)
  To: amd-gfx
  Cc: harry.wentland, sunpeng.li, siqueira, alexander.deucher,
	christian.koenig, airlied, simona, jerry.zuo, wayne.lin, yan.li,
	dri-devel, linux-kernel, Satyajit Roy

From: Satyajit Roy <sroy14@alum.utk.edu>

The Broadcast RGB implementation currently has three gaps in the AMD
Display path:

  1. DM does not propagate the sink's RGB quantization-range
     selectability into DC, so the HDMI AVI InfoFrame Q field remains at
     its default value.
  2. BT.2020 RGB output is always selected as full range, so an explicit
     Limited setting has no effect in HDR modes using BT.2020 RGB.
  3. A property-only range transition updates the output CSC but does not
     rebuild and program the InfoFrame, leaving the sink with stale range
     signaling.

Together these can make the transmitted pixel range and the range inferred
by a television's automatic black-level setting disagree.

Patch 1 propagates the EDID QS capability. Patch 2 honors Limited for
BT.2020 RGB and adds KUnit coverage for both BT.2020 connector colorspace
values. Patch 3 rebuilds InfoFrames whenever output_color_space changes.

Validation performed on amd-staging-drm-next at the base commit below:

  - scripts/checkpatch.pl --strict: no errors, warnings, or checks
  - x86_64 AMD Display KUnit configuration built with CONFIG_WERROR=y
  - new EDID-capability and BT.2020 quantization KUnit cases compiled

Equivalent changes were also tested on an HDMI 2.1 television with a
Valve Linux 7.2 kernel. The television's automatic black-level selection
followed Full-to-Limited and Limited-to-Full transitions in SDR, HDR, and
HDR with VRR active. No modeset or visible link blank was observed.

Satyajit Roy (3):
  drm/amd/display: Propagate HDMI RGB quantization selectability
  drm/amd/display: Honor Broadcast RGB for BT.2020 RGB output
  drm/amd/display: Rebuild InfoFrames on output color space changes

 .../display/amdgpu_dm/amdgpu_dm_connector.c   | 10 +++--
 .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c |  1 +
 .../tests/amdgpu_dm_connector_test.c          | 37 +++++++++++++++++++
 .../amdgpu_dm/tests/amdgpu_dm_helpers_test.c  |  2 +
 drivers/gpu/drm/amd/display/dc/core/dc.c      |  3 ++
 5 files changed, 50 insertions(+), 3 deletions(-)


base-commit: 75a5e1b6b3661c3f946885d01eebeb6b031035ef
-- 
2.51.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/3] drm/amd/display: Propagate HDMI RGB quantization selectability
  2026-08-30  3:51 [PATCH 0/3] drm/amd/display: Fix HDMI RGB quantization updates Satyajit Roy
@ 2026-08-30  3:51 ` Satyajit Roy
  2026-08-30  3:52 ` [PATCH 2/3] drm/amd/display: Honor Broadcast RGB for BT.2020 RGB output Satyajit Roy
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Satyajit Roy @ 2026-08-30  3:51 UTC (permalink / raw)
  To: amd-gfx
  Cc: harry.wentland, sunpeng.li, siqueira, alexander.deucher,
	christian.koenig, airlied, simona, jerry.zuo, wayne.lin, yan.li,
	dri-devel, linux-kernel, Satyajit Roy

From: Satyajit Roy <sroy14@alum.utk.edu>

DC uses dc_edid_caps.qs_bit when constructing the HDMI AVI InfoFrame
quantization-range field. Although DRM parses the sink capability into
drm_display_info, DM never copies it into the DC EDID capabilities. The
field therefore remains zero and the AVI quantization range stays at its
default value.

Copy rgb_quant_range_selectable for HDMI sinks and extend the existing
EDID-capability KUnit test to cover it.

Fixes: 6eb4c13a3845 ("drm/amd/display: Support "Broadcast RGB" drm property")
Signed-off-by: Satyajit Roy <sroy14@alum.utk.edu>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c       | 1 +
 .../drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c    | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
index ab15ceec4da..e49a8dda512 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
@@ -218,6 +218,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps(
 	edid_caps->edid_hdmi = connector->display_info.is_hdmi;
 
 	if (edid_caps->edid_hdmi) {
+		edid_caps->qs_bit = connector->display_info.rgb_quant_range_selectable;
 		populate_hdmi_info_from_connector(link->dc->config.enable_frl, &connector->display_info.hdmi, edid_caps);
 		drm_dbg_driver(connector->dev, "%s: HDMI_FRL [%s] max_frl_rate %d\n", __func__, connector->name, edid_caps->max_frl_rate);
 		if (edid_caps->frl_dsc_support)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c
index d4232648d8e..b13f258740c 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_helpers_test.c
@@ -412,12 +412,14 @@ static void dm_test_parse_edid_caps_hdmi_frl(struct kunit *test)
 
 	/* Drive the HDMI/FRL branch */
 	connector->display_info.is_hdmi = true;
+	connector->display_info.rgb_quant_range_selectable = true;
 	connector->display_info.hdmi.scdc.supported = true;
 	connector->display_info.hdmi.max_lanes = 4;
 	connector->display_info.hdmi.max_frl_rate_per_lane = 12;
 
 	KUNIT_EXPECT_EQ(test, dm_helpers_parse_edid_caps(link, dc_edid, edid_caps), EDID_OK);
 	KUNIT_EXPECT_TRUE(test, edid_caps->edid_hdmi);
+	KUNIT_EXPECT_EQ(test, edid_caps->qs_bit, 1);
 	KUNIT_EXPECT_TRUE(test, edid_caps->scdc_present);
 	/* max_lanes 4 + max_frl_rate_per_lane 12 -> rate index 6 */
 	KUNIT_EXPECT_EQ(test, edid_caps->max_frl_rate, 6);
-- 
2.51.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/3] drm/amd/display: Honor Broadcast RGB for BT.2020 RGB output
  2026-08-30  3:51 [PATCH 0/3] drm/amd/display: Fix HDMI RGB quantization updates Satyajit Roy
  2026-08-30  3:51 ` [PATCH 1/3] drm/amd/display: Propagate HDMI RGB quantization selectability Satyajit Roy
@ 2026-08-30  3:52 ` Satyajit Roy
  2026-08-30  3:52 ` [PATCH 3/3] drm/amd/display: Rebuild InfoFrames on output color space changes Satyajit Roy
  2026-09-08 19:36 ` [PATCH 0/3] drm/amd/display: Fix HDMI RGB quantization updates Alex Hung
  3 siblings, 0 replies; 5+ messages in thread
From: Satyajit Roy @ 2026-08-30  3:52 UTC (permalink / raw)
  To: amd-gfx
  Cc: harry.wentland, sunpeng.li, siqueira, alexander.deucher,
	christian.koenig, airlied, simona, jerry.zuo, wayne.lin, yan.li,
	dri-devel, linux-kernel, Satyajit Roy

From: Satyajit Roy <sroy14@alum.utk.edu>

amdgpu_dm_get_output_color_space() applies the Broadcast RGB connector
property to default RGB output, but always selects full-range output for
BT.2020 RGB. Consequently, explicitly selecting Limited has no effect on
the output CSC or AVI InfoFrame when HDR uses BT.2020 RGB.

Select COLOR_SPACE_2020_RGB_LIMITEDRANGE when the output encoding is RGB
and Broadcast RGB is Limited. Keep Automatic and Full at full range, and
leave YCbCr output unchanged.

Add KUnit coverage for limited-range RGB output through both BT.2020
connector colorspace values.

Fixes: 6eb4c13a3845 ("drm/amd/display: Support "Broadcast RGB" drm property")
Signed-off-by: Satyajit Roy <sroy14@alum.utk.edu>
---
 .../display/amdgpu_dm/amdgpu_dm_connector.c   | 10 +++--
 .../tests/amdgpu_dm_connector_test.c          | 37 +++++++++++++++++++
 2 files changed, 44 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
index 8a35e4df13c..f2f6a2a0db9 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c
@@ -758,10 +758,14 @@ amdgpu_dm_get_output_color_space(const struct dc_crtc_timing *dc_crtc_timing,
 		break;
 	case DRM_MODE_COLORIMETRY_BT2020_RGB:
 	case DRM_MODE_COLORIMETRY_BT2020_YCC:
-		if (dc_crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB)
-			color_space = COLOR_SPACE_2020_RGB_FULLRANGE;
-		else
+		if (dc_crtc_timing->pixel_encoding == PIXEL_ENCODING_RGB) {
+			if (connector_state->hdmi.broadcast_rgb == DRM_HDMI_BROADCAST_RGB_LIMITED)
+				color_space = COLOR_SPACE_2020_RGB_LIMITEDRANGE;
+			else
+				color_space = COLOR_SPACE_2020_RGB_FULLRANGE;
+		} else {
 			color_space = COLOR_SPACE_2020_YCBCR_LIMITED;
+		}
 		break;
 	case DRM_MODE_COLORIMETRY_DEFAULT: /* ITU601 */
 	default:
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
index 76334fb840d..29bbe9f7826 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/tests/amdgpu_dm_connector_test.c
@@ -570,6 +570,23 @@ static void dm_test_output_color_space_bt2020_rgb(struct kunit *test)
 			(int)COLOR_SPACE_2020_RGB_FULLRANGE);
 }
 
+/**
+ * dm_test_output_color_space_bt2020_rgb_limited - Test limited BT.2020 RGB
+ * @test: The KUnit test context
+ */
+static void dm_test_output_color_space_bt2020_rgb_limited(struct kunit *test)
+{
+	struct dc_crtc_timing timing = {};
+	struct drm_connector_state state = {};
+
+	timing.pixel_encoding = PIXEL_ENCODING_RGB;
+	state.colorspace = DRM_MODE_COLORIMETRY_BT2020_RGB;
+	state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_LIMITED;
+
+	KUNIT_EXPECT_EQ(test, (int)amdgpu_dm_get_output_color_space(&timing, &state),
+			(int)COLOR_SPACE_2020_RGB_LIMITEDRANGE);
+}
+
 /**
  * dm_test_output_color_space_bt2020_ycc - Test Output color space bt2020 ycc
  * @test: The KUnit test context
@@ -641,6 +658,24 @@ static void dm_test_output_color_space_bt2020_ycc_rgb_encoding(struct kunit *tes
 			(int)COLOR_SPACE_2020_RGB_FULLRANGE);
 }
 
+/**
+ * dm_test_output_color_space_bt2020_ycc_rgb_encoding_limited - Test limited
+ * BT.2020 RGB output selected through the BT.2020 YCC connector colorspace
+ * @test: The KUnit test context
+ */
+static void dm_test_output_color_space_bt2020_ycc_rgb_encoding_limited(struct kunit *test)
+{
+	struct dc_crtc_timing timing = {};
+	struct drm_connector_state state = {};
+
+	timing.pixel_encoding = PIXEL_ENCODING_RGB;
+	state.colorspace = DRM_MODE_COLORIMETRY_BT2020_YCC;
+	state.hdmi.broadcast_rgb = DRM_HDMI_BROADCAST_RGB_LIMITED;
+
+	KUNIT_EXPECT_EQ(test, (int)amdgpu_dm_get_output_color_space(&timing, &state),
+			(int)COLOR_SPACE_2020_RGB_LIMITEDRANGE);
+}
+
 /**
  * dm_test_output_color_space_bt2020_rgb_ycc_encoding - Test Output color space
  * bt2020 rgb with non-rgb pixel encoding falls back to limited ycbcr
@@ -8409,10 +8444,12 @@ static struct kunit_case amdgpu_dm_connector_tests[] = {
 	KUNIT_CASE(dm_test_output_color_space_bt709_y_only),
 	KUNIT_CASE(dm_test_output_color_space_oprgb),
 	KUNIT_CASE(dm_test_output_color_space_bt2020_rgb),
+	KUNIT_CASE(dm_test_output_color_space_bt2020_rgb_limited),
 	KUNIT_CASE(dm_test_output_color_space_bt2020_ycc),
 	KUNIT_CASE(dm_test_output_color_space_default_ycbcr709_y_only),
 	KUNIT_CASE(dm_test_output_color_space_default_ycbcr601),
 	KUNIT_CASE(dm_test_output_color_space_bt2020_ycc_rgb_encoding),
+	KUNIT_CASE(dm_test_output_color_space_bt2020_ycc_rgb_encoding_limited),
 	KUNIT_CASE(dm_test_output_color_space_bt2020_rgb_ycc_encoding),
 	/* Tests for amdgpu_dm_convert_dc_color_depth_into_bpc */
 	KUNIT_CASE(dm_test_convert_color_depth_bpc_mappings),
-- 
2.51.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/3] drm/amd/display: Rebuild InfoFrames on output color space changes
  2026-08-30  3:51 [PATCH 0/3] drm/amd/display: Fix HDMI RGB quantization updates Satyajit Roy
  2026-08-30  3:51 ` [PATCH 1/3] drm/amd/display: Propagate HDMI RGB quantization selectability Satyajit Roy
  2026-08-30  3:52 ` [PATCH 2/3] drm/amd/display: Honor Broadcast RGB for BT.2020 RGB output Satyajit Roy
@ 2026-08-30  3:52 ` Satyajit Roy
  2026-09-08 19:36 ` [PATCH 0/3] drm/amd/display: Fix HDMI RGB quantization updates Alex Hung
  3 siblings, 0 replies; 5+ messages in thread
From: Satyajit Roy @ 2026-08-30  3:52 UTC (permalink / raw)
  To: amd-gfx
  Cc: harry.wentland, sunpeng.li, siqueira, alexander.deucher,
	christian.koenig, airlied, simona, jerry.zuo, wayne.lin, yan.li,
	dri-devel, linux-kernel, Satyajit Roy

From: Satyajit Roy <sroy14@alum.utk.edu>

resource_build_info_frame() derives colorimetry and RGB quantization from
stream->output_color_space. A Broadcast RGB-only atomic commit updates
that field and reprograms the output CSC, but none of the InfoFrame update
predicates include output_color_space. The sink can therefore retain the
previous AVI InfoFrame range while the source starts transmitting a
different pixel range.

Treat an output color space change as an InfoFrame change in update
classification and in both stream programming paths.

Hardware testing on an HDMI 2.1 television confirmed that its automatic
black-level selection follows Full to Limited and Limited to Full
transitions in SDR, HDR, and HDR with VRR active, without a modeset or
visible link blank.

Fixes: 6eb4c13a3845 ("drm/amd/display: Support "Broadcast RGB" drm property")
Signed-off-by: Satyajit Roy <sroy14@alum.utk.edu>
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index 1b9bcc3f0d2..8844dbc0415 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -3201,6 +3201,7 @@ static struct dc_update_descriptor check_update_surfaces_for_stream(
 		}
 
 		if ((stream_update->hdr_static_metadata && !stream_update->stream->use_dynamic_meta) ||
+				stream_update->output_color_space ||
 				stream_update->vrr_infopacket ||
 				stream_update->vsc_infopacket ||
 				stream_update->vsp_infopacket ||
@@ -4195,6 +4196,7 @@ static void commit_planes_do_stream_update_sequence(struct dc *dc,
 				hwss_add_setup_periodic_interrupt(&seq_state, dc, pipe_ctx);
 
 			if ((stream_update->hdr_static_metadata && !stream->use_dynamic_meta) ||
+					stream_update->output_color_space ||
 					stream_update->vrr_infopacket ||
 					stream_update->vsc_infopacket ||
 					stream_update->vsp_infopacket ||
@@ -4377,6 +4379,7 @@ static void commit_planes_do_stream_update(struct dc *dc,
 				hwss_setup_periodic_interrupt(dc, pipe_ctx);
 
 			if ((stream_update->hdr_static_metadata && !stream->use_dynamic_meta) ||
+					stream_update->output_color_space ||
 					stream_update->vrr_infopacket ||
 					stream_update->vsc_infopacket ||
 					stream_update->vsp_infopacket ||
-- 
2.51.1



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/3] drm/amd/display: Fix HDMI RGB quantization updates
  2026-08-30  3:51 [PATCH 0/3] drm/amd/display: Fix HDMI RGB quantization updates Satyajit Roy
                   ` (2 preceding siblings ...)
  2026-08-30  3:52 ` [PATCH 3/3] drm/amd/display: Rebuild InfoFrames on output color space changes Satyajit Roy
@ 2026-09-08 19:36 ` Alex Hung
  3 siblings, 0 replies; 5+ messages in thread
From: Alex Hung @ 2026-09-08 19:36 UTC (permalink / raw)
  To: Satyajit Roy, amd-gfx
  Cc: harry.wentland, sunpeng.li, siqueira, alexander.deucher,
	christian.koenig, airlied, simona, jerry.zuo, wayne.lin, yan.li,
	dri-devel, linux-kernel, Satyajit Roy

Reviewed-by: Alex Hung <alex.hung@amd.com>

On 8/29/26 21:51, Satyajit Roy wrote:
> [Some people who received this message don't often get email from edu042sjroy@proton.me. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> From: Satyajit Roy <sroy14@alum.utk.edu>
> 
> The Broadcast RGB implementation currently has three gaps in the AMD
> Display path:
> 
>    1. DM does not propagate the sink's RGB quantization-range
>       selectability into DC, so the HDMI AVI InfoFrame Q field remains at
>       its default value.
>    2. BT.2020 RGB output is always selected as full range, so an explicit
>       Limited setting has no effect in HDR modes using BT.2020 RGB.
>    3. A property-only range transition updates the output CSC but does not
>       rebuild and program the InfoFrame, leaving the sink with stale range
>       signaling.
> 
> Together these can make the transmitted pixel range and the range inferred
> by a television's automatic black-level setting disagree.
> 
> Patch 1 propagates the EDID QS capability. Patch 2 honors Limited for
> BT.2020 RGB and adds KUnit coverage for both BT.2020 connector colorspace
> values. Patch 3 rebuilds InfoFrames whenever output_color_space changes.
> 
> Validation performed on amd-staging-drm-next at the base commit below:
> 
>    - scripts/checkpatch.pl --strict: no errors, warnings, or checks
>    - x86_64 AMD Display KUnit configuration built with CONFIG_WERROR=y
>    - new EDID-capability and BT.2020 quantization KUnit cases compiled
> 
> Equivalent changes were also tested on an HDMI 2.1 television with a
> Valve Linux 7.2 kernel. The television's automatic black-level selection
> followed Full-to-Limited and Limited-to-Full transitions in SDR, HDR, and
> HDR with VRR active. No modeset or visible link blank was observed.
> 
> Satyajit Roy (3):
>    drm/amd/display: Propagate HDMI RGB quantization selectability
>    drm/amd/display: Honor Broadcast RGB for BT.2020 RGB output
>    drm/amd/display: Rebuild InfoFrames on output color space changes
> 
>   .../display/amdgpu_dm/amdgpu_dm_connector.c   | 10 +++--
>   .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c |  1 +
>   .../tests/amdgpu_dm_connector_test.c          | 37 +++++++++++++++++++
>   .../amdgpu_dm/tests/amdgpu_dm_helpers_test.c  |  2 +
>   drivers/gpu/drm/amd/display/dc/core/dc.c      |  3 ++
>   5 files changed, 50 insertions(+), 3 deletions(-)
> 
> 
> base-commit: 75a5e1b6b3661c3f946885d01eebeb6b031035ef
> --
> 2.51.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-08 19:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-30  3:51 [PATCH 0/3] drm/amd/display: Fix HDMI RGB quantization updates Satyajit Roy
2026-08-30  3:51 ` [PATCH 1/3] drm/amd/display: Propagate HDMI RGB quantization selectability Satyajit Roy
2026-08-30  3:52 ` [PATCH 2/3] drm/amd/display: Honor Broadcast RGB for BT.2020 RGB output Satyajit Roy
2026-08-30  3:52 ` [PATCH 3/3] drm/amd/display: Rebuild InfoFrames on output color space changes Satyajit Roy
2026-09-08 19:36 ` [PATCH 0/3] drm/amd/display: Fix HDMI RGB quantization updates Alex Hung

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®