From: Bhawanpreet Lakha <Bhawanpreet.Lakha@xxxxxxx> Change-Id: I1735203833573473200e19bf0324aecd92663535 Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha at amd.com> Reviewed-by: Harry Wentland <Harry.Wentland at amd.com> --- drivers/gpu/drm/amd/display/dc/core/dc.c | 145 ---------------------- drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 73 ----------- drivers/gpu/drm/amd/display/dc/dc.h | 71 ----------- 3 files changed, 289 deletions(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index ad3b35209f55..00637a5d0324 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -672,67 +672,6 @@ void dc_destroy(struct dc **dc) *dc = NULL; } -static bool validate_streams ( - struct dc *dc, - const struct dc_validation_set set[], - int set_count) -{ - int i; - - for (i = 0; i < set_count; i++) - if (!dc_validate_stream(dc, set[i].stream)) - return false; - - return true; -} - -static bool validate_surfaces( - struct dc *dc, - const struct dc_validation_set set[], - int set_count) -{ - int i, j; - - for (i = 0; i < set_count; i++) - for (j = 0; j < set[i].plane_count; j++) - if (!dc_validate_plane(dc, set[i].plane_states[j])) - return false; - - return true; -} - -bool dc_validate_resources( - struct dc *dc, - const struct dc_validation_set set[], - uint8_t set_count) -{ - bool result = false; - struct validate_context *context; - - if (!validate_streams(dc, set, set_count)) - return false; - - if (!validate_surfaces(dc, set, set_count)) - return false; - - context = dm_alloc(sizeof(struct validate_context)); - if (context == NULL) - goto context_alloc_fail; - - atomic_inc(&context->ref_count); - - dc_resource_validate_ctx_copy_construct_current(dc, context); - - result = dc_validate_with_context( - dc, set, set_count, context); - -context_alloc_fail: - dc_release_validate_context(context); - context = NULL; - - return result; -} - bool dc_validate_guaranteed( struct dc *dc, struct dc_stream_state *stream) @@ -857,24 +796,6 @@ static bool context_changed( return false; } -static bool streams_changed( - struct dc *dc, - struct dc_stream_state *streams[], - uint8_t stream_count) -{ - uint8_t i; - - if (stream_count != dc->current_context->stream_count) - return true; - - for (i = 0; i < dc->current_context->stream_count; i++) { - if (dc->current_context->streams[i] != streams[i]) - return true; - } - - return false; -} - bool dc_enable_stereo( struct dc *dc, struct validate_context *context, @@ -999,72 +920,6 @@ bool dc_commit_context(struct dc *dc, struct validate_context *context) } -bool dc_commit_streams( - struct dc *dc, - struct dc_stream_state *streams[], - uint8_t stream_count) -{ - struct dc *core_dc = dc; - bool result = false; - struct validate_context *context; - struct dc_validation_set set[MAX_STREAMS] = { {0, {0} } }; - int i; - - if (false == streams_changed(core_dc, streams, stream_count)) - return DC_OK; - - dm_logger_write(core_dc->ctx->logger, LOG_DC, "%s: %d streams\n", - __func__, stream_count); - - for (i = 0; i < stream_count; i++) { - struct dc_stream_state *stream = streams[i]; - struct dc_stream_status *status = dc_stream_get_status(stream); - int j; - - dc_stream_log(stream, - core_dc->ctx->logger, - LOG_DC); - - set[i].stream = stream; - - if (status) { - set[i].plane_count = status->plane_count; - for (j = 0; j < status->plane_count; j++) - set[i].plane_states[j] = status->plane_states[j]; - } - - } - - if (!validate_streams(dc, set, stream_count)) - return false; - - if (!validate_surfaces(dc, set, stream_count)) - return false; - - context = dm_alloc(sizeof(struct validate_context)); - if (context == NULL) - goto context_alloc_fail; - - atomic_inc(&context->ref_count); - - dc_resource_validate_ctx_copy_construct_current(dc, context); - - result = dc_validate_with_context( - dc, set, stream_count, context); - if (!result) { - BREAK_TO_DEBUGGER(); - goto fail; - } - - result = dc_commit_context_no_check(dc, context); - -fail: - dc_release_validate_context(context); - -context_alloc_fail: - return result; -} - bool dc_post_update_surfaces_to_stream(struct dc *dc) { int i; 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 6b4eb4c3a3fd..90bf367a023b 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_resource.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_resource.c @@ -1633,79 +1633,6 @@ void dc_resource_validate_ctx_copy_construct_current( dc_resource_validate_ctx_copy_construct(dc->current_context, dst_ctx); } -bool dc_validate_with_context( - struct dc *dc, - const struct dc_validation_set set[], - int set_count, - struct validate_context *context) -{ - int i, j; - enum dc_status res = DC_ERROR_UNEXPECTED; - bool found = false; - int old_stream_count = context->stream_count; - struct dc_stream_state *del_streams[MAX_PIPES] = { 0 }; - struct dc_stream_state *add_streams[MAX_PIPES] = { 0 }; - int del_streams_count = 0; - int add_streams_count = 0; - - - /* First remove from context all deleted streams */ - for (i = 0; i < old_stream_count; i++) { - struct dc_stream_state *stream = context->streams[i]; - - for (j = 0; j < set_count; j++) { - if (stream == set[j].stream) { - found = true; - break; - } - } - - if (!found) - del_streams[del_streams_count++] = stream; - - found = false; - } - - /* Now add new ones */ - for (i = 0; i < set_count; i++) { - struct dc_stream_state *stream = set[i].stream; - - for (j = 0; j < old_stream_count; j++) { - if (stream == context->streams[j]) { - found = true; - break; - } - } - - if (!found) - add_streams[add_streams_count++] = stream; - - found = false; - } - - for (i = 0; i < del_streams_count; i++) - if (!dc_remove_stream_from_ctx(dc, context, del_streams[i])) - goto fail; - - for (i = 0; i < add_streams_count; i++) - if (!dc_add_stream_to_ctx(dc, context, add_streams[i])) - goto fail; - - if (!dc_validate_global_state(dc, set, set_count, context)) - goto fail; - - res = DC_OK; - -fail: - if (res != DC_OK) { - dm_logger_write(dc->ctx->logger, LOG_WARNING, - "%s:resource validation failed, dc_status:%d\n", - __func__, - res); -} - return res == DC_OK; -} - bool dc_validate_global_state( struct dc *dc, const struct dc_validation_set set[], diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h index 935f4432570b..42aa332dfd46 100644 --- a/drivers/gpu/drm/amd/display/dc/dc.h +++ b/drivers/gpu/drm/amd/display/dc/dc.h @@ -641,23 +641,12 @@ bool dc_validate_stream(struct dc *dc, struct dc_stream_state *stream); bool dc_validate_plane(struct dc *dc, const struct dc_plane_state *plane_state); -bool dc_validate_with_context( - struct dc *dc, - const struct dc_validation_set set[], - int set_count, - struct validate_context *context); - bool dc_validate_global_state( struct dc *dc, const struct dc_validation_set set[], int set_count, struct validate_context *new_ctx); -bool dc_validate_resources( - struct dc *dc, - const struct dc_validation_set set[], - uint8_t set_count); - /* * This function takes a stream and checks if it is guaranteed to be supported. * Guaranteed means that MAX_COFUNC similar streams are supported. @@ -666,10 +655,6 @@ bool dc_validate_resources( * No hardware is programmed for call. Only validation is done. */ -bool dc_validate_guaranteed( - struct dc *dc, - struct dc_stream_state *stream); - void dc_resource_validate_ctx_copy_construct( const struct validate_context *src_ctx, struct validate_context *dst_ctx); @@ -699,10 +684,6 @@ bool dc_commit_context(struct dc *dc, struct validate_context *context); * Phy, Encoder, Timing Generator are programmed and enabled. * New streams are enabled with blank stream; no memory read. */ -bool dc_commit_streams( - struct dc *dc, - struct dc_stream_state *streams[], - uint8_t stream_count); /* * Enable stereo when commit_streams is not required, * for example, frame alternate. @@ -856,18 +837,10 @@ const struct dc_link_status *dc_link_get_status(const struct dc_link *dc_link); */ struct dc_link *dc_get_link_at_index(struct dc *dc, uint32_t link_index); -struct dwbc *dc_get_dwb_at_pipe(struct dc *dc, uint32_t pipe); - -/* Return id of physical connector represented by a dc_link at link_index.*/ -const struct graphics_object_id dc_get_link_id_at_index( - struct dc *dc, uint32_t link_index); - /* Set backlight level of an embedded panel (eDP, LVDS). */ bool dc_link_set_backlight_level(const struct dc_link *dc_link, uint32_t level, uint32_t frame_ramp, const struct dc_stream_state *stream); -bool dc_link_set_abm_disable(const struct dc_link *dc_link); - bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable); bool dc_link_get_psr_state(const struct dc_link *dc_link, uint32_t *psr_state); @@ -906,7 +879,6 @@ void dc_link_remove_remote_sink( struct dc_sink *sink); /* Used by diagnostics for virtual link at the moment */ -void dc_link_set_sink(struct dc_link *link, struct dc_sink *sink); void dc_link_dp_set_drive_settings( struct dc_link *link, @@ -969,8 +941,6 @@ struct dc_sink { void dc_sink_retain(struct dc_sink *sink); void dc_sink_release(struct dc_sink *sink); -const struct audio **dc_get_audios(struct dc *dc); - struct dc_sink_init_data { enum signal_type sink_signal; struct dc_link *link; @@ -979,8 +949,6 @@ struct dc_sink_init_data { }; struct dc_sink *dc_sink_create(const struct dc_sink_init_data *init_params); -bool dc_sink_get_container_id(struct dc_sink *dc_sink, struct dc_container_id *container_id); -bool dc_sink_set_container_id(struct dc_sink *dc_sink, const struct dc_container_id *container_id); /******************************************************************************* * Cursor interfaces - To manages the cursor within a stream @@ -1025,45 +993,6 @@ void dc_resume(struct dc *dc); * DPCD access interfaces */ -bool dc_read_aux_dpcd( - struct dc *dc, - uint32_t link_index, - uint32_t address, - uint8_t *data, - uint32_t size); - -bool dc_write_aux_dpcd( - struct dc *dc, - uint32_t link_index, - uint32_t address, - const uint8_t *data, - uint32_t size); - -bool dc_read_aux_i2c( - struct dc *dc, - uint32_t link_index, - enum i2c_mot_mode mot, - uint32_t address, - uint8_t *data, - uint32_t size); - -bool dc_write_aux_i2c( - struct dc *dc, - uint32_t link_index, - enum i2c_mot_mode mot, - uint32_t address, - const uint8_t *data, - uint32_t size); - -bool dc_query_ddc_data( - struct dc *dc, - uint32_t link_index, - uint32_t address, - uint8_t *write_buf, - uint32_t write_size, - uint8_t *read_buf, - uint32_t read_size); - bool dc_submit_i2c( struct dc *dc, uint32_t link_index, -- 2.11.0