From 09cdffb1ae9944c0ea080091e474346508d76d90 Mon Sep 17 00:00:00 2001 From: Harry Wentland Date: Sun, 30 Jul 2017 14:36:12 -0400 Subject: [PATCH 0718/4131] drm/amd/display: Move stream_enc to stream_res find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \ -o -name "*.cpp" -o -name "*.hpp" | \ xargs sed -i 's/pipes->stream_enc/pipes->stream_res\.stream_enc/g' find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \ -o -name "*.cpp" -o -name "*.hpp" | \ xargs sed -i 's/ctx->stream_enc->/ctx->stream_res\.stream_enc->/g' find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \ -o -name "*.cpp" -o -name "*.hpp" | \ xargs sed -i 's/pipe->stream_enc/pipe->stream_res\.stream_enc/g' find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \ -o -name "*.cpp" -o -name "*.hpp" | \ xargs sed -i 's/pipe_ctx->stream_enc/pipe_ctx->stream_res\.stream_enc/g' find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \ -o -name "*.cpp" -o -name "*.hpp" | \ xargs sed -i \ 's/pipe_ctx\[pipe_offset\]\.stream_enc/pipe_ctx\[pipe_offset\]\.stream_res\.stream_enc/g' find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \ -o -name "*.cpp" -o -name "*.hpp" | \ xargs sed -i \ 's/grouped_pipes\[i\]->stream_enc/grouped_pipes\[i\]->stream_^Cs\.stream_enc/g' find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \ -o -name "*.cpp" -o -name "*.hpp" | \ xargs sed -i \ 's/grouped_pipes\[0\]->stream_enc/grouped_pipes\[0\]->stream_res\.stream_enc/g' find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \ -o -name "*.cpp" -o -name "*.hpp" | \ xargs sed -i \ 's/grouped_pipes\[1\]->stream_enc/grouped_pipes\[1\]->stream_res\.stream_enc/g' find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \ -o -name "*.cpp" -o -name "*.hpp" | \ xargs sed -i \ 's/pipe_ctx\[i\]->stream_enc/pipe_ctx\[i\]->stream_res\.stream_enc/g' find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \ -o -name "*.cpp" -o -name "*.hpp" | \ xargs sed -i \ 's/pipe_ctx_old->stream_enc/pipe_ctx_old->stream_res\.stream_enc/g' find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \ -o -name "*.cpp" -o -name "*.hpp" | \ xargs sed -i \ 's/pipe_set\[j\]->stream_enc/pipe_set\[j\]->stream_res\.stream_enc/g' find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \ -o -name "*.cpp" -o -name "*.hpp" | \ xargs sed -i \ 's/pipe_ctx\[i\]\.stream_enc/pipe_ctx\[i\]\.stream_res\.stream_enc/g' find -name Makefile -o -name Kconfig -o -name "*.c" -o -name "*.h" \ -o -name "*.cpp" -o -name "*.hpp" | \ xargs sed -i \ 's/pipes\[i\]\.stream_enc/pipes\[i\]\.stream_res\.stream_enc/g' Signed-off-by: Harry Wentland Reviewed-by: Tony Cheng Acked-by: Harry Wentland Signed-off-by: Alex Deucher --- drivers/gpu/drm/amd/display/dc/core/dc.c | 4 +- drivers/gpu/drm/amd/display/dc/core/dc_link.c | 12 ++-- drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +- drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 6 +- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 16 ++--- .../amd/display/dc/dce110/dce110_hw_sequencer.c | 72 +++++++++++----------- .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c | 2 +- drivers/gpu/drm/amd/display/dc/inc/core_types.h | 2 +- 8 files changed, 58 insertions(+), 58 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index 61c2a21..748e709 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -161,7 +161,7 @@ static bool stream_adjust_vmin_vmax(struct dc *dc, for (i = 0; i < MAX_PIPES; i++) { struct pipe_ctx *pipe = &core_dc->current_context->res_ctx.pipe_ctx[i]; - if (pipe->stream == stream && pipe->stream_enc) { + if (pipe->stream == stream && pipe->stream_res.stream_enc) { core_dc->hwss.set_drr(&pipe, 1, vmin, vmax); /* build and update the info frame */ @@ -189,7 +189,7 @@ static bool stream_get_crtc_position(struct dc *dc, struct pipe_ctx *pipe = &core_dc->current_context->res_ctx.pipe_ctx[i]; - if (pipe->stream == stream && pipe->stream_enc) { + if (pipe->stream == stream && pipe->stream_res.stream_enc) { core_dc->hwss.get_position(&pipe, 1, &position); *v_pos = position.vertical_count; diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link.c b/drivers/gpu/drm/amd/display/dc/core/dc_link.c index 2c43edf..6a3d2ad 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link.c @@ -1311,8 +1311,8 @@ static enum dc_status enable_link(struct pipe_ctx *pipe_ctx) /* un-mute audio */ /* TODO: audio should be per stream rather than per link */ - pipe_ctx->stream_enc->funcs->audio_mute_control( - pipe_ctx->stream_enc, false); + pipe_ctx->stream_res.stream_enc->funcs->audio_mute_control( + pipe_ctx->stream_res.stream_enc, false); } return status; @@ -1699,7 +1699,7 @@ static enum dc_status allocate_mst_payload(struct pipe_ctx *pipe_ctx) struct dc_stream_state *stream = pipe_ctx->stream; struct dc_link *link = stream->sink->link; struct link_encoder *link_encoder = link->link_enc; - struct stream_encoder *stream_encoder = pipe_ctx->stream_enc; + struct stream_encoder *stream_encoder = pipe_ctx->stream_res.stream_enc; struct dp_mst_stream_allocation_table proposed_table = {0}; struct fixed31_32 avg_time_slots_per_mtp; struct fixed31_32 pbn; @@ -1718,7 +1718,7 @@ static enum dc_status allocate_mst_payload(struct pipe_ctx *pipe_ctx) &proposed_table, true)) { update_mst_stream_alloc_table( - link, pipe_ctx->stream_enc, &proposed_table); + link, pipe_ctx->stream_res.stream_enc, &proposed_table); } else dm_logger_write(link->ctx->logger, LOG_WARNING, @@ -1781,7 +1781,7 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx) struct dc_stream_state *stream = pipe_ctx->stream; struct dc_link *link = stream->sink->link; struct link_encoder *link_encoder = link->link_enc; - struct stream_encoder *stream_encoder = pipe_ctx->stream_enc; + struct stream_encoder *stream_encoder = pipe_ctx->stream_res.stream_enc; struct dp_mst_stream_allocation_table proposed_table = {0}; struct fixed31_32 avg_time_slots_per_mtp = dal_fixed31_32_from_int(0); uint8_t i; @@ -1808,7 +1808,7 @@ static enum dc_status deallocate_mst_payload(struct pipe_ctx *pipe_ctx) false)) { update_mst_stream_alloc_table( - link, pipe_ctx->stream_enc, &proposed_table); + link, pipe_ctx->stream_res.stream_enc, &proposed_table); } else { dm_logger_write(link->ctx->logger, LOG_WARNING, diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c index eda2594..3d296b1 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c @@ -2464,7 +2464,7 @@ bool dc_link_dp_set_test_pattern( * MuteAudioEndpoint(pPathMode->pDisplayPath, true); */ /* Blank stream */ - pipes->stream_enc->funcs->dp_blank(pipe_ctx->stream_enc); + pipes->stream_res.stream_enc->funcs->dp_blank(pipe_ctx->stream_res.stream_enc); } dp_set_hw_test_pattern(link, test_pattern, diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c b/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c index f2f57a7..7d52c6c 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c @@ -243,12 +243,12 @@ void dp_retrain_link_dp_test(struct dc_link *link, if (pipes[i].stream != NULL && pipes[i].stream->sink != NULL && pipes[i].stream->sink->link != NULL && - pipes[i].stream_enc != NULL && + pipes[i].stream_res.stream_enc != NULL && pipes[i].stream->sink->link == link) { dm_delay_in_microseconds(link->ctx, 100); - pipes[i].stream_enc->funcs->dp_blank( - pipes[i].stream_enc); + pipes[i].stream_res.stream_enc->funcs->dp_blank( + pipes[i].stream_res.stream_enc); /* disable any test pattern that might be active */ dp_set_hw_test_pattern(link, diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c index fcfd080..31a3535 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -925,7 +925,7 @@ struct pipe_ctx *resource_get_head_pipe_for_stream( int i; for (i = 0; i < MAX_PIPES; i++) { if (res_ctx->pipe_ctx[i].stream == stream && - res_ctx->pipe_ctx[i].stream_enc) { + res_ctx->pipe_ctx[i].stream_res.stream_enc) { return &res_ctx->pipe_ctx[i]; break; } @@ -1096,7 +1096,7 @@ bool resource_attach_surfaces_to_context( if (tail_pipe) { free_pipe->stream_res.tg = tail_pipe->stream_res.tg; free_pipe->stream_res.opp = tail_pipe->stream_res.opp; - free_pipe->stream_enc = tail_pipe->stream_enc; + free_pipe->stream_res.stream_enc = tail_pipe->stream_res.stream_enc; free_pipe->audio = tail_pipe->audio; free_pipe->clock_source = tail_pipe->clock_source; free_pipe->top_pipe = tail_pipe; @@ -1461,12 +1461,12 @@ enum dc_status resource_map_pool_resources( copy_pipe_ctx(old_pipe_ctx, pipe_ctx); /* Split pipe resource, do not acquire back end */ - if (!pipe_ctx->stream_enc) + if (!pipe_ctx->stream_res.stream_enc) continue; set_stream_engine_in_use( &context->res_ctx, pool, - pipe_ctx->stream_enc); + pipe_ctx->stream_res.stream_enc); /* Switch to dp clock source only if there is * no non dp stream that shares the same timing @@ -1503,16 +1503,16 @@ enum dc_status resource_map_pool_resources( pipe_ctx = &context->res_ctx.pipe_ctx[pipe_idx]; - pipe_ctx->stream_enc = + pipe_ctx->stream_res.stream_enc = find_first_free_match_stream_enc_for_link( &context->res_ctx, pool, stream); - if (!pipe_ctx->stream_enc) + if (!pipe_ctx->stream_res.stream_enc) return DC_NO_STREAM_ENG_RESOURCE; set_stream_engine_in_use( &context->res_ctx, pool, - pipe_ctx->stream_enc); + pipe_ctx->stream_res.stream_enc); /* TODO: Add check if ASIC support and EDID audio */ if (!stream->sink->converter_disable_audio && @@ -2382,7 +2382,7 @@ bool pipe_need_reprogram( && pipe_ctx_old->stream != pipe_ctx->stream) return true; - if (pipe_ctx_old->stream_enc != pipe_ctx->stream_enc) + if (pipe_ctx_old->stream_res.stream_enc != pipe_ctx->stream_res.stream_enc) return true; if (is_timing_changed(pipe_ctx_old->stream, pipe_ctx->stream)) 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 1d7c7fb..48d1510 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 @@ -659,7 +659,7 @@ static enum dc_status bios_parser_crtc_source_select( struct bp_crtc_source_select crtc_source_select = {0}; const struct dc_sink *sink = pipe_ctx->stream->sink; - crtc_source_select.engine_id = pipe_ctx->stream_enc->id; + crtc_source_select.engine_id = pipe_ctx->stream_res.stream_enc->id; crtc_source_select.controller_id = pipe_ctx->pipe_idx + 1; /*TODO: Need to un-hardcode color depth, dp_audio and account for * the case where signal and sink signal is different (translator @@ -684,16 +684,16 @@ void dce110_update_info_frame(struct pipe_ctx *pipe_ctx) { ASSERT(pipe_ctx->stream); - if (pipe_ctx->stream_enc == NULL) + if (pipe_ctx->stream_res.stream_enc == NULL) return; /* this is not root pipe */ if (dc_is_hdmi_signal(pipe_ctx->stream->signal)) - pipe_ctx->stream_enc->funcs->update_hdmi_info_packets( - pipe_ctx->stream_enc, + pipe_ctx->stream_res.stream_enc->funcs->update_hdmi_info_packets( + pipe_ctx->stream_res.stream_enc, &pipe_ctx->encoder_info_frame); else if (dc_is_dp_signal(pipe_ctx->stream->signal)) - pipe_ctx->stream_enc->funcs->update_dp_info_packets( - pipe_ctx->stream_enc, + pipe_ctx->stream_res.stream_enc->funcs->update_dp_info_packets( + pipe_ctx->stream_res.stream_enc, &pipe_ctx->encoder_info_frame); } @@ -731,7 +731,7 @@ void dce110_enable_stream(struct pipe_ctx *pipe_ctx) /* enable audio only within mode set */ if (pipe_ctx->audio != NULL) { if (dc_is_dp_signal(pipe_ctx->stream->signal)) - pipe_ctx->stream_enc->funcs->dp_audio_enable(pipe_ctx->stream_enc); + pipe_ctx->stream_res.stream_enc->funcs->dp_audio_enable(pipe_ctx->stream_res.stream_enc); } /* For MST, there are multiply stream go to only one link. @@ -739,7 +739,7 @@ void dce110_enable_stream(struct pipe_ctx *pipe_ctx) * disconnect them during disable_stream * BY this, it is logic clean to separate stream and link */ link->link_enc->funcs->connect_dig_be_to_fe(link->link_enc, - pipe_ctx->stream_enc->id, true); + pipe_ctx->stream_res.stream_enc->id, true); } @@ -752,11 +752,11 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx) pipe_ctx->audio->funcs->az_disable(pipe_ctx->audio); if (dc_is_dp_signal(pipe_ctx->stream->signal)) - pipe_ctx->stream_enc->funcs->dp_audio_disable( - pipe_ctx->stream_enc); + pipe_ctx->stream_res.stream_enc->funcs->dp_audio_disable( + pipe_ctx->stream_res.stream_enc); else - pipe_ctx->stream_enc->funcs->hdmi_audio_disable( - pipe_ctx->stream_enc); + pipe_ctx->stream_res.stream_enc->funcs->hdmi_audio_disable( + pipe_ctx->stream_res.stream_enc); pipe_ctx->audio = NULL; @@ -768,24 +768,24 @@ void dce110_disable_stream(struct pipe_ctx *pipe_ctx) } if (dc_is_hdmi_signal(pipe_ctx->stream->signal)) - pipe_ctx->stream_enc->funcs->stop_hdmi_info_packets( - pipe_ctx->stream_enc); + pipe_ctx->stream_res.stream_enc->funcs->stop_hdmi_info_packets( + pipe_ctx->stream_res.stream_enc); if (dc_is_dp_signal(pipe_ctx->stream->signal)) - pipe_ctx->stream_enc->funcs->stop_dp_info_packets( - pipe_ctx->stream_enc); + pipe_ctx->stream_res.stream_enc->funcs->stop_dp_info_packets( + pipe_ctx->stream_res.stream_enc); - pipe_ctx->stream_enc->funcs->audio_mute_control( - pipe_ctx->stream_enc, true); + pipe_ctx->stream_res.stream_enc->funcs->audio_mute_control( + pipe_ctx->stream_res.stream_enc, true); /* blank at encoder level */ if (dc_is_dp_signal(pipe_ctx->stream->signal)) - pipe_ctx->stream_enc->funcs->dp_blank(pipe_ctx->stream_enc); + pipe_ctx->stream_res.stream_enc->funcs->dp_blank(pipe_ctx->stream_res.stream_enc); link->link_enc->funcs->connect_dig_be_to_fe( link->link_enc, - pipe_ctx->stream_enc->id, + pipe_ctx->stream_res.stream_enc->id, false); } @@ -799,14 +799,14 @@ void dce110_unblank_stream(struct pipe_ctx *pipe_ctx, params.pixel_clk_khz = pipe_ctx->stream->timing.pix_clk_khz; params.link_settings.link_rate = link_settings->link_rate; - pipe_ctx->stream_enc->funcs->dp_unblank(pipe_ctx->stream_enc, ¶ms); + pipe_ctx->stream_res.stream_enc->funcs->dp_unblank(pipe_ctx->stream_res.stream_enc, ¶ms); } void dce110_set_avmute(struct pipe_ctx *pipe_ctx, bool enable) { - if (pipe_ctx != NULL && pipe_ctx->stream_enc != NULL) - pipe_ctx->stream_enc->funcs->set_avmute(pipe_ctx->stream_enc, enable); + if (pipe_ctx != NULL && pipe_ctx->stream_res.stream_enc != NULL) + pipe_ctx->stream_res.stream_enc->funcs->set_avmute(pipe_ctx->stream_res.stream_enc, enable); } static enum audio_dto_source translate_to_dto_source(enum controller_id crtc_id) @@ -834,7 +834,7 @@ static void build_audio_output( struct audio_output *audio_output) { const struct dc_stream_state *stream = pipe_ctx->stream; - audio_output->engine_id = pipe_ctx->stream_enc->id; + audio_output->engine_id = pipe_ctx->stream_res.stream_enc->id; audio_output->signal = pipe_ctx->stream->signal; @@ -1071,8 +1071,8 @@ static enum dc_status apply_single_controller_ctx_to_hw( pipe_ctx->stream->signal); if (pipe_ctx->stream->signal != SIGNAL_TYPE_VIRTUAL) - pipe_ctx->stream_enc->funcs->setup_stereo_sync( - pipe_ctx->stream_enc, + pipe_ctx->stream_res.stream_enc->funcs->setup_stereo_sync( + pipe_ctx->stream_res.stream_enc, pipe_ctx->stream_res.tg->inst, stream->timing.timing_3d_format != TIMING_3D_FORMAT_NONE); @@ -1084,21 +1084,21 @@ static enum dc_status apply_single_controller_ctx_to_hw( &stream->clamping); if (dc_is_dp_signal(pipe_ctx->stream->signal)) - pipe_ctx->stream_enc->funcs->dp_set_stream_attribute( - pipe_ctx->stream_enc, + pipe_ctx->stream_res.stream_enc->funcs->dp_set_stream_attribute( + pipe_ctx->stream_res.stream_enc, &stream->timing, stream->output_color_space); if (dc_is_hdmi_signal(pipe_ctx->stream->signal)) - pipe_ctx->stream_enc->funcs->hdmi_set_stream_attribute( - pipe_ctx->stream_enc, + pipe_ctx->stream_res.stream_enc->funcs->hdmi_set_stream_attribute( + pipe_ctx->stream_res.stream_enc, &stream->timing, stream->phy_pix_clk, pipe_ctx->audio != NULL); if (dc_is_dvi_signal(pipe_ctx->stream->signal)) - pipe_ctx->stream_enc->funcs->dvi_set_stream_attribute( - pipe_ctx->stream_enc, + pipe_ctx->stream_res.stream_enc->funcs->dvi_set_stream_attribute( + pipe_ctx->stream_res.stream_enc, &stream->timing, (pipe_ctx->stream->signal == SIGNAL_TYPE_DVI_DUAL_LINK) ? true : false); @@ -1860,13 +1860,13 @@ enum dc_status dce110_apply_ctx_to_hw( build_audio_output(pipe_ctx, &audio_output); if (dc_is_dp_signal(pipe_ctx->stream->signal)) - pipe_ctx->stream_enc->funcs->dp_audio_setup( - pipe_ctx->stream_enc, + pipe_ctx->stream_res.stream_enc->funcs->dp_audio_setup( + pipe_ctx->stream_res.stream_enc, pipe_ctx->audio->inst, &pipe_ctx->stream->audio_info); else - pipe_ctx->stream_enc->funcs->hdmi_audio_setup( - pipe_ctx->stream_enc, + pipe_ctx->stream_res.stream_enc->funcs->hdmi_audio_setup( + pipe_ctx->stream_res.stream_enc, pipe_ctx->audio->inst, &pipe_ctx->stream->audio_info, &audio_output.crtc_info); diff --git a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c index 99ef0f2..16ac963 100644 --- a/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c @@ -770,7 +770,7 @@ static void reset_back_end_for_pipe( { int i; - if (pipe_ctx->stream_enc == NULL) { + if (pipe_ctx->stream_res.stream_enc == NULL) { pipe_ctx->stream = NULL; return; } diff --git a/drivers/gpu/drm/amd/display/dc/inc/core_types.h b/drivers/gpu/drm/amd/display/dc/inc/core_types.h index 488ade3..4d35c6d 100644 --- a/drivers/gpu/drm/amd/display/dc/inc/core_types.h +++ b/drivers/gpu/drm/amd/display/dc/inc/core_types.h @@ -155,6 +155,7 @@ struct resource_pool { struct stream_resource { struct output_pixel_processor *opp; struct timing_generator *tg; + struct stream_encoder *stream_enc; }; struct plane_resource { @@ -172,7 +173,6 @@ struct pipe_ctx { struct plane_resource plane_res; struct stream_resource stream_res; - struct stream_encoder *stream_enc; struct display_clock *dis_clk; struct clock_source *clock_source; -- 2.7.4