diff options
author | Jake Wang <haonan.wang2@amd.com> | 2021-02-05 14:46:20 -0500 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2021-03-02 14:06:45 -0500 |
commit | 45a1261b393bd3dc24d1ae8a55249c0897df0c88 (patch) | |
tree | bd4f73b8269e06ade4bd2e33ad1422b98503cee0 /drivers/gpu/drm/amd/display/dc/dce110 | |
parent | cca912e0a6b49f45c588e7cc50d3ad13bb859ca5 (diff) |
drm/amd/display: Refactored DC interfaces to support multiple eDP
[Why & How]
Some existing DC interfaces are optimized to return a single eDP
link/stream. Refactored those DC interfaces to support multiple eDP.
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Jake Wang <haonan.wang2@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/dce110')
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 72 |
1 files changed, 46 insertions, 26 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c index caee1c9f54bd..ddabc205bcfc 100644 --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c @@ -1629,34 +1629,39 @@ static void disable_vga_and_power_gate_all_controllers( } -static struct dc_stream_state *get_edp_stream(struct dc_state *context) +static void get_edp_streams(struct dc_state *context, + struct dc_stream_state **edp_streams, + int *edp_stream_num) { int i; + *edp_stream_num = 0; for (i = 0; i < context->stream_count; i++) { - if (context->streams[i]->signal == SIGNAL_TYPE_EDP) - return context->streams[i]; + if (context->streams[i]->signal == SIGNAL_TYPE_EDP) { + edp_streams[*edp_stream_num] = context->streams[i]; + if (++(*edp_stream_num) == MAX_NUM_EDP) + return; + } } - return NULL; } -static struct dc_link *get_edp_link_with_sink( +static void get_edp_links_with_sink( struct dc *dc, - struct dc_state *context) + struct dc_link **edp_links_with_sink, + int *edp_with_sink_num) { int i; - struct dc_link *link = NULL; /* check if there is an eDP panel not in use */ + *edp_with_sink_num = 0; for (i = 0; i < dc->link_count; i++) { if (dc->links[i]->local_sink && dc->links[i]->local_sink->sink_signal == SIGNAL_TYPE_EDP) { - link = dc->links[i]; - break; + edp_links_with_sink[*edp_with_sink_num] = dc->links[i]; + if (++(*edp_with_sink_num) == MAX_NUM_EDP) + return; } } - - return link; } /* @@ -1668,36 +1673,48 @@ static struct dc_link *get_edp_link_with_sink( */ void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context) { - int i; - struct dc_link *edp_link_with_sink = get_edp_link_with_sink(dc, context); - struct dc_link *edp_link = get_edp_link(dc); + struct dc_link *edp_links_with_sink[MAX_NUM_EDP]; + struct dc_link *edp_links[MAX_NUM_EDP]; + struct dc_stream_state *edp_streams[MAX_NUM_EDP]; + struct dc_link *edp_link_with_sink = NULL; + struct dc_link *edp_link = NULL; struct dc_stream_state *edp_stream = NULL; + struct dce_hwseq *hws = dc->hwseq; + int edp_with_sink_num; + int edp_num; + int edp_stream_num; + int i; bool can_apply_edp_fast_boot = false; bool can_apply_seamless_boot = false; bool keep_edp_vdd_on = false; - struct dce_hwseq *hws = dc->hwseq; + + get_edp_links_with_sink(dc, edp_links_with_sink, &edp_with_sink_num); + get_edp_links(dc, edp_links, &edp_num); if (hws->funcs.init_pipes) hws->funcs.init_pipes(dc, context); - edp_stream = get_edp_stream(context); + get_edp_streams(context, edp_streams, &edp_stream_num); // Check fastboot support, disable on DCE8 because of blank screens - if (edp_link && dc->ctx->dce_version != DCE_VERSION_8_0 && + if (edp_num && dc->ctx->dce_version != DCE_VERSION_8_0 && dc->ctx->dce_version != DCE_VERSION_8_1 && dc->ctx->dce_version != DCE_VERSION_8_3) { - - // enable fastboot if backend is enabled on eDP - if (edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc)) { - /* Set optimization flag on eDP stream*/ - if (edp_stream && edp_link->link_status.link_active) { - edp_stream->apply_edp_fast_boot_optimization = true; - can_apply_edp_fast_boot = true; + for (i = 0; i < edp_num; i++) { + edp_link = edp_links[i]; + // enable fastboot if backend is enabled on eDP + if (edp_link->link_enc->funcs->is_dig_enabled(edp_link->link_enc)) { + /* Set optimization flag on eDP stream*/ + if (edp_stream_num && edp_link->link_status.link_active) { + edp_stream = edp_streams[0]; + edp_stream->apply_edp_fast_boot_optimization = true; + can_apply_edp_fast_boot = true; + break; + } } } - // We are trying to enable eDP, don't power down VDD - if (edp_stream) + if (edp_stream_num) keep_edp_vdd_on = true; } @@ -1712,6 +1729,9 @@ void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context) /* eDP should not have stream in resume from S4 and so even with VBios post * it should get turned off */ + if (edp_with_sink_num) + edp_link_with_sink = edp_links_with_sink[0]; + if (!can_apply_edp_fast_boot && !can_apply_seamless_boot) { if (edp_link_with_sink && !keep_edp_vdd_on) { /*turn off backlight before DP_blank and encoder powered down*/ |