drm/amd/display: Follow-up patches to analog support
Subsystems (3)
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
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
@@ -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
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
Signed-off-by Timur Kristóf <[email protected]>Reviewed-by Harry Wentland <[email protected]>
Signature · 1 line
Kees Cook
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
Signed-off-by Timur Kristóf <[email protected]>Reviewed-by Harry Wentland <[email protected]>Acked-by Kees Cook <[email protected]>
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
PATCH 2/4 drm/amd/display: Cleanup uses of the analog flag
In reply to Timur KristófIn 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
@@ -8665,8 +8665,14 @@ static void amdgpu_dm_connector_add_freesync_modes(struct drm_connector *connectif (!(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
@@ -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
PATCH 3/4 drm/amd/display: Cleanup early return in construct_phy
In reply to Timur KristófMatch 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
@@ -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
PATCH 4/4 drm/amd/display: Move analog check to dce110_hwseq
In reply to Timur KristófInstead 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
@@ -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
@@ -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
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 inconstruct_phydrm/amd/display: Move analog check todce110_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.
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 inconstruct_phydrm/amd/display: Move analog check todce110_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