Skip to contentSkip to conversation

drm/amd/display: Follow-up patches to analog support

PATCH In review Timur Kristóf 4 participants 9 messages Nov 13, 2025 – Nov 19, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover drm/amd/display: Follow-up patches to analog support

This series addresses some feedback that I received after the DC analog series support landed. Harry already gave a review to the patches. Please feel free to let me know if you have any other feedback that I should address regarding the analog connector support.

Timur Kristóf (4):
drm/amd/display: Fix warning for analog stream encoders drm/amd/display: Cleanup uses of the analog flag drm/amd/display: Cleanup early return in construct_phy drm/amd/display: Move analog check to dce110_hwseq

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 15 ++++++++++++---
 .../drm/amd/display/dc/dce/dce_stream_encoder.c   |  2 +-
 .../drm/amd/display/dc/hwss/dce110/dce110_hwseq.c |  6 ++++--
 .../gpu/drm/amd/display/dc/link/link_detection.c  |  2 --
 drivers/gpu/drm/amd/display/dc/link/link_dpms.c   |  3 +--
 .../gpu/drm/amd/display/dc/link/link_factory.c    | 13 +++++++------
 6 files changed, 25 insertions(+), 16 deletions(-)
Signature · 1 line
2.51.1
#1 lore raw

PATCH 1/4 drm/amd/display: Fix warning for analog stream encoders

Fixes the following warning that some users are reporting with some kernel configurations:

"positional initialization of field in 'struct' declared with 'designated_init' attribute"

---
 drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce/dce_stream_encoder.c +1 -1
index f8996ee2856b..574618d5d4a4 100644
@@ -1568,7 +1568,7 @@ void dce110_stream_encoder_construct(
 	enc110->se_mask = se_mask;
 }
 
-static const struct stream_encoder_funcs dce110_an_str_enc_funcs = {0};
+static const struct stream_encoder_funcs dce110_an_str_enc_funcs = {};
 
 void dce110_analog_stream_encoder_construct(
 	struct dce110_stream_encoder *enc110,
Signature · 1 line
2.51.1
Acked-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] drm/amd/display: Fix warning for analog stream encoders

Quoted 5 lines · Timur Kristóf

Fixes the following warning that some users are reporting with some kernel configurations:

"positional initialization of field in 'struct' declared with 'designated_init' attribute"

Yes, seen with CONFIG_RANDSTRUCT=y

Thanks for the fix!

Quoted 2 lines
Signature · 1 line
Kees Cook
#3 lore raw

Re: [PATCH 1/4] drm/amd/display: Fix warning for analog stream encoders

Quoted 9 lines · Kees Cook
Quoted 5 lines · Timur Kristóf

Fixes the following warning that some users are reporting with some kernel configurations:

"positional initialization of field in 'struct' declared with 'designated_init' attribute"

Yes, seen with CONFIG_RANDSTRUCT=y

Quoted 8 lines

Thanks for the fix!

Quoted 2 lines

Thanks and this patch is now merged to amd-staging-drm-next, but I found it causes *some* compiler to fail.

I'd like to test whether the below change is able to fix both issues.

-static const struct stream_encoder_funcs dce110_an_str_enc_funcs = {}; +static const struct stream_encoder_funcs dce110_an_str_enc_funcs = {
+ .dp_set_stream_attribute = NULL,
+};

However, I could not reproduce ""positional initialization of field in 'struct' declared 'designated_init' attribute" in my local setup, with either gcc or clang and "CONFIG_RANDSTRUCT=y"

Can someone try the above changes for me? really appreciate it. I will create a patch if it works.

Alex Hung

#4 lore raw

PATCH 2/4 drm/amd/display: Cleanup uses of the analog flag

In reply to Timur Kristóf

In the detect_link_and_local_sink() function, do not modify the EDID capabilities of the display based on the connector. Instead, respect the analog flag better and when the analog flag is set, check that the connector indeed supports analog displays.

---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 15 ++++++++++++---
 .../gpu/drm/amd/display/dc/link/link_detection.c  |  2 --
 2 files changed, 12 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +12 -3
index aa31e969b39d..9703f7fc957d 100644
@@ -8665,8 +8665,14 @@ static void amdgpu_dm_connector_add_freesync_modes(struct drm_connector *connect
 	if (!(amdgpu_freesync_vid_mode && drm_edid))
 		return;
 
-	if (!amdgpu_dm_connector->dc_sink || amdgpu_dm_connector->dc_sink->edid_caps.analog ||
-		!dc_supports_vrr(amdgpu_dm_connector->dc_sink->ctx->dce_version))
+	if (!amdgpu_dm_connector->dc_sink || !amdgpu_dm_connector->dc_link)
+		return;
+
+	if (!dc_supports_vrr(amdgpu_dm_connector->dc_sink->ctx->dce_version))
+		return;
+
+	if (dc_connector_supports_analog(amdgpu_dm_connector->dc_link->link_id.id) &&
+	    amdgpu_dm_connector->dc_sink->edid_caps.analog)
 		return;
 
 	if (amdgpu_dm_connector->max_vfreq - amdgpu_dm_connector->min_vfreq > 10)
@@ -8693,7 +8699,10 @@ static int amdgpu_dm_connector_get_modes(struct drm_connector *connector)
 			amdgpu_dm_connector->num_modes +=
 				drm_add_modes_noedid(connector, 1920, 1080);
 
-		if (amdgpu_dm_connector->dc_sink && amdgpu_dm_connector->dc_sink->edid_caps.analog) {
+		if (amdgpu_dm_connector->dc_sink &&
+		    amdgpu_dm_connector->dc_link &&
+		    amdgpu_dm_connector->dc_sink->edid_caps.analog &&
+		    dc_connector_supports_analog(amdgpu_dm_connector->dc_link->link_id.id)) {
 			/* Analog monitor connected by DAC load detection.
 			 * Add common modes. It will be up to the user to select one that works.
 			 */
drivers/gpu/drm/amd/display/dc/link/link_detection.c +0 -2
index d163360a2bf6..6d31f4967f1a 100644
@@ -1224,8 +1224,6 @@ static bool detect_link_and_local_sink(struct dc_link *link,
 			break;
 		}
 
-		sink->edid_caps.analog &= dc_connector_supports_analog(link->link_id.id);
-
 		// Check if edid is the same
 		if ((prev_sink) &&
 		    (edid_status == EDID_THE_SAME || edid_status == EDID_OK))
Signature · 1 line
2.51.1
#5 lore raw

PATCH 3/4 drm/amd/display: Cleanup early return in construct_phy

In reply to Timur Kristóf

Match pre-existing patterns in the DC code base. Instead of returning early from the construct_phy() function, add a label at the end and use goto to jump there. Additionally, respect the DC logger and let it log the function even when it returns early.

---
 drivers/gpu/drm/amd/display/dc/link/link_factory.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/dc/link/link_factory.c +7 -6
index 7989baf3843c..b177069e4807 100644
@@ -529,16 +529,16 @@ static bool construct_phy(struct dc_link *link,
 	enc_init_data.transmitter = translate_encoder_to_transmitter(enc_init_data.encoder);
 	enc_init_data.analog_engine = find_analog_engine(link);
 
-	if (!transmitter_supported(enc_init_data.transmitter) &&
-		!analog_engine_supported(enc_init_data.analog_engine)) {
-		DC_LOG_WARNING("link_id %d has unsupported encoder\n", link->link_id.id);
-		return false;
-	}
-
 	link->ep_type = DISPLAY_ENDPOINT_PHY;
 
 	DC_LOG_DC("BIOS object table - link_id: %d", link->link_id.id);
 
+	if (!transmitter_supported(enc_init_data.transmitter) &&
+	    !analog_engine_supported(enc_init_data.analog_engine)) {
+		DC_LOG_WARNING("link_id %d has unsupported encoder\n", link->link_id.id);
+		goto unsupported_fail;
+	}
+
 	if (bios->funcs->get_disp_connector_caps_info) {
 		bios->funcs->get_disp_connector_caps_info(bios, link->link_id, &disp_connect_caps_info);
 		link->is_internal_display = disp_connect_caps_info.INTERNAL_DISPLAY;
@@ -805,6 +805,7 @@ static bool construct_phy(struct dc_link *link,
 		link->hpd_gpio = NULL;
 	}
 
+unsupported_fail:
 	DC_LOG_DC("BIOS object table - %s failed.\n", __func__);
 	return false;
 }
Signature · 1 line
2.51.1
#6 lore raw

PATCH 4/4 drm/amd/display: Move analog check to dce110_hwseq

In reply to Timur Kristóf

Instead of checking that the signal is analog before calling the HWSS disable_audio_stream() function to disable audio, move the check inside the HWSS function.

---
 drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c | 6 ++++--
 drivers/gpu/drm/amd/display/dc/link/link_dpms.c           | 3 +--
 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/hwss/dce110/dce110_hwseq.c +4 -2
index 3005115c8505..94e66d96c403 100644
@@ -1139,6 +1139,9 @@ void dce110_disable_audio_stream(struct pipe_ctx *pipe_ctx)
 	if (!pipe_ctx || !pipe_ctx->stream)
 		return;
 
+	if (dc_is_rgb_signal(pipe_ctx->stream->signal))
+		return;
+
 	dc = pipe_ctx->stream->ctx->dc;
 	clk_mgr = dc->clk_mgr;
 	link_hwss = get_link_hwss(pipe_ctx->stream->link, &pipe_ctx->link_res);
@@ -1193,8 +1196,7 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx)
 		pipe_ctx->stream_res.stream_enc->funcs->stop_dp_info_packets(
 			pipe_ctx->stream_res.stream_enc);
 
-	if (!dc_is_rgb_signal(pipe_ctx->stream->signal))
-		dc->hwss.disable_audio_stream(pipe_ctx);
+	dc->hwss.disable_audio_stream(pipe_ctx);
 
 	link_hwss->reset_stream_encoder(pipe_ctx);
 
drivers/gpu/drm/amd/display/dc/link/link_dpms.c +1 -2
index 4ddcdc222913..f7ac26598c39 100644
@@ -2374,8 +2374,7 @@ void link_set_dpms_off(struct pipe_ctx *pipe_ctx)
 			set_avmute(pipe_ctx, true);
 	}
 
-	if (!dc_is_rgb_signal(pipe_ctx->stream->signal))
-		dc->hwss.disable_audio_stream(pipe_ctx);
+	dc->hwss.disable_audio_stream(pipe_ctx);
 
 	update_psp_stream_config(pipe_ctx, true);
 	dc->hwss.blank_stream(pipe_ctx);
Signature · 1 line
2.51.1
#7 lore raw
In reply to Timur Kristóf
Quoted 11 lines · Timur Kristóf

This series addresses some feedback that I received after the DC analog series support landed. Harry already gave a review to the patches. Please feel free to let me know if you have any other feedback that I should address regarding the analog connector support.

Timur Kristóf (4):
drm/amd/display: Fix warning for analog stream encoders drm/amd/display: Cleanup uses of the analog flag drm/amd/display: Cleanup early return in construct_phy drm/amd/display: Move analog check to dce110_hwseq

Quoted 8 lines
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 15 ++++++++++++---
  .../drm/amd/display/dc/dce/dce_stream_encoder.c   |  2 +-
  .../drm/amd/display/dc/hwss/dce110/dce110_hwseq.c |  6 ++++--
  .../gpu/drm/amd/display/dc/link/link_detection.c  |  2 --
  drivers/gpu/drm/amd/display/dc/link/link_dpms.c   |  3 +--
  .../gpu/drm/amd/display/dc/link/link_factory.c    | 13 +++++++------
  6 files changed, 25 insertions(+), 16 deletions(-)

As these are reviewed by Harry and display promotion testing wouldn't catch issues with analog I've queued them up for the internal CI to run on and merge.

Will let you know if anything crops up in that, and if any future promotion tests fail and it bisects to these the promoter will respond accordingly.

#8 lore raw
Quoted 30 lines · Mario Limonciello
Quoted 21 lines · Timur Kristóf

This series addresses some feedback that I received after the DC analog
series support landed. Harry already gave a review to the patches. Please feel free to let me know if you have any other feedback that I
should address regarding the analog connector support.

Timur Kristóf (4):
   drm/amd/display: Fix warning for analog stream encoders drm/amd/display: Cleanup uses of the analog flag drm/amd/display: Cleanup early return in construct_phy drm/amd/display: Move analog check to dce110_hwseq

  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 15
++++++++++++---
  .../drm/amd/display/dc/dce/dce_stream_encoder.c   |  2 +- .../drm/amd/display/dc/hwss/dce110/dce110_hwseq.c |  6 ++++-- .../gpu/drm/amd/display/dc/link/link_detection.c  |  2 -- drivers/gpu/drm/amd/display/dc/link/link_dpms.c   |  3 +-- .../gpu/drm/amd/display/dc/link/link_factory.c    | 13 +++++++---
---

Quoted 2 lines
  6 files changed, 25 insertions(+), 16 deletions(-)

As these are reviewed by Harry and display promotion testing wouldn't catch issues with analog I've queued them up for the internal CI to run
on and merge.

Quoted 4 lines

Will let you know if anything crops up in that, and if any future promotion tests fail and it bisects to these the promoter will respond
accordingly.

That sounds reasonable. Thank you!

Timur