diff options
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/core/dc.c')
-rw-r--r-- | drivers/gpu/drm/amd/display/dc/core/dc.c | 83 |
1 files changed, 33 insertions, 50 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index e5ec359b3830..2c86a6309074 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -792,18 +792,17 @@ static void program_timing_sync( } } -static bool set_changed( +static bool context_changed( struct core_dc *dc, - const struct dc_validation_set set[], - uint8_t set_count) + struct validate_context *context) { uint8_t i; - if (set_count != dc->current_context->stream_count) + if (context->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]->public != set[i].stream) + if (&dc->current_context->streams[i]->public != &context->streams[i]->public) return true; } @@ -829,46 +828,36 @@ static bool streams_changed( } /* TODO operate on validation set (or something like it) */ -bool dc_commit_validation_set( - const struct dc *dc, - const struct dc_validation_set set[], - uint8_t set_count) +bool dc_commit_context(struct dc *dc, struct validate_context *context) { struct core_dc *core_dc = DC_TO_CORE(dc); struct dc_bios *dcb = core_dc->ctx->dc_bios; enum dc_status result = DC_ERROR_UNEXPECTED; - struct validate_context *context; int i, j, k; - /* TODO check validation set changed */ - if (false == set_changed(core_dc, set, set_count)) + if (!context) + dm_logger_write(core_dc->ctx->logger, LOG_ERROR, + "%s: dc_commit_context with no context!\n", + __func__); + + if (false == context_changed(core_dc, context)) return DC_OK; dm_logger_write(core_dc->ctx->logger, LOG_DC, "%s: %d streams\n", - __func__, set_count); + __func__, context->stream_count); - context = dm_alloc(sizeof(struct validate_context)); - if (context == NULL) - goto context_alloc_fail; + for (i = 0; i < context->stream_count; i++) { + const struct dc_stream *stream = &context->streams[i]->public; - /* TODO no need for validation. just rebuild context */ - /* TODO check context is created deterministically */ - result = core_dc->res_pool->funcs->validate_with_context(core_dc, set, set_count, context); - if (result != DC_OK) { - dm_logger_write(core_dc->ctx->logger, LOG_ERROR, - "%s: Context validation failed! dc_status:%d\n", - __func__, - result); - BREAK_TO_DEBUGGER(); - dc_resource_validate_ctx_destruct(context); - goto fail; + dc_stream_log(stream, + core_dc->ctx->logger, + LOG_DC); } if (!dcb->funcs->is_accelerated_mode(dcb)) core_dc->hwss.enable_accelerated_mode(core_dc); - if (result == DC_OK) - result = core_dc->hwss.apply_ctx_to_hw(core_dc, context); + result = core_dc->hwss.apply_ctx_to_hw(core_dc, context); program_timing_sync(core_dc, context); @@ -898,17 +887,8 @@ bool dc_commit_validation_set( context->streams[i]->public.timing.pix_clk_khz); } - dc_resource_validate_ctx_destruct(core_dc->current_context); - dm_free(core_dc->current_context); - - core_dc->current_context = context; - - return (result == DC_OK); - -fail: - dm_free(context); + dc_resource_validate_ctx_copy_construct(context, core_dc->current_context); -context_alloc_fail: return (result == DC_OK); } @@ -1028,24 +1008,27 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc) dc_resource_validate_ctx_copy_construct(core_dc->current_context, context); post_surface_trace(dc); + for (i = 0; i < context->res_ctx.pool->pipe_count; i++) if (context->res_ctx.pipe_ctx[i].stream == NULL) { context->res_ctx.pipe_ctx[i].pipe_idx = i; core_dc->hwss.power_down_front_end( core_dc, &context->res_ctx.pipe_ctx[i]); } - if (!core_dc->res_pool->funcs->validate_bandwidth(core_dc, context)) { BREAK_TO_DEBUGGER(); + dc_resource_validate_ctx_destruct(context); + dm_free(context); return false; } core_dc->hwss.set_bandwidth(core_dc, context, true); - dc_resource_validate_ctx_copy_construct(context, core_dc->current_context); - - dc_resource_validate_ctx_destruct(context); - dm_free(context); + if (core_dc->current_context) { + dc_resource_validate_ctx_destruct(core_dc->current_context); + dm_free(core_dc->current_context); + } + core_dc->current_context = context; return true; } @@ -1494,8 +1477,10 @@ void dc_update_surfaces_and_stream(struct dc *dc, if (cur_pipe_ctx->surface == pipe_ctx->surface) is_new_pipe_surface = false; - if (is_new_pipe_surface || - srf_updates[i].in_transfer_func) + /* TODO find out why check is false */ + /* TODO with this still not programming some color stuff... panel is dark-ish */ + /*if (is_new_pipe_surface || + srf_updates[i].in_transfer_func)*/ core_dc->hwss.set_input_transfer_func( pipe_ctx, pipe_ctx->surface); @@ -1539,10 +1524,8 @@ void dc_update_surfaces_and_stream(struct dc *dc, return; fail: - if (core_dc->current_context != context) { - dc_resource_validate_ctx_destruct(context); - dm_free(context); - } + dc_resource_validate_ctx_destruct(context); + dm_free(context); } uint8_t dc_get_current_stream_count(const struct dc *dc) |