Commit 430ef426 authored by Dmytro Laktyushkin's avatar Dmytro Laktyushkin Committed by Alex Deucher

drm/amd/display: make dc_get_validate_context re-entrant

Signed-off-by: default avatarDmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: default avatarTony Cheng <Tony.Cheng@amd.com>
Acked-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ccaf31ec
...@@ -653,40 +653,6 @@ void dc_destroy(struct dc **dc) ...@@ -653,40 +653,6 @@ void dc_destroy(struct dc **dc)
*dc = NULL; *dc = NULL;
} }
static bool is_validation_required(
const struct core_dc *dc,
const struct dc_validation_set set[],
int set_count)
{
const struct validate_context *context = dc->current_context;
int i, j;
if (context->stream_count != set_count)
return true;
for (i = 0; i < set_count; i++) {
if (set[i].surface_count != context->stream_status[i].surface_count)
return true;
if (!is_stream_unchanged(DC_STREAM_TO_CORE(set[i].stream), context->streams[i]))
return true;
for (j = 0; j < set[i].surface_count; j++) {
struct dc_surface temp_surf = { 0 };
temp_surf = *context->stream_status[i].surfaces[j];
temp_surf.clip_rect = set[i].surfaces[j]->clip_rect;
temp_surf.dst_rect.x = set[i].surfaces[j]->dst_rect.x;
temp_surf.dst_rect.y = set[i].surfaces[j]->dst_rect.y;
if (memcmp(&temp_surf, set[i].surfaces[j], sizeof(temp_surf)) != 0)
return true;
}
}
return false;
}
struct validate_context *dc_get_validate_context( struct validate_context *dc_get_validate_context(
const struct dc *dc, const struct dc *dc,
const struct dc_validation_set set[], const struct dc_validation_set set[],
...@@ -700,13 +666,8 @@ struct validate_context *dc_get_validate_context( ...@@ -700,13 +666,8 @@ struct validate_context *dc_get_validate_context(
if(context == NULL) if(context == NULL)
goto context_alloc_fail; goto context_alloc_fail;
if (!is_validation_required(core_dc, set, set_count)) {
dc_resource_validate_ctx_copy_construct(core_dc->current_context, context);
return context;
}
result = core_dc->res_pool->funcs->validate_with_context( result = core_dc->res_pool->funcs->validate_with_context(
core_dc, set, set_count, context); core_dc, set, set_count, context, NULL);
context_alloc_fail: context_alloc_fail:
if (result != DC_OK) { if (result != DC_OK) {
...@@ -903,7 +864,8 @@ bool dc_commit_streams( ...@@ -903,7 +864,8 @@ bool dc_commit_streams(
if (context == NULL) if (context == NULL)
goto context_alloc_fail; goto context_alloc_fail;
result = core_dc->res_pool->funcs->validate_with_context(core_dc, set, stream_count, context); result = core_dc->res_pool->funcs->validate_with_context(
core_dc, set, stream_count, context, core_dc->current_context);
if (result != DC_OK){ if (result != DC_OK){
dm_logger_write(core_dc->ctx->logger, LOG_ERROR, dm_logger_write(core_dc->ctx->logger, LOG_ERROR,
"%s: Context validation failed! dc_status:%d\n", "%s: Context validation failed! dc_status:%d\n",
......
...@@ -1148,7 +1148,7 @@ bool resource_validate_attach_surfaces( ...@@ -1148,7 +1148,7 @@ bool resource_validate_attach_surfaces(
int i, j; int i, j;
for (i = 0; i < set_count; i++) { for (i = 0; i < set_count; i++) {
for (j = 0; j < old_context->stream_count; j++) for (j = 0; old_context && j < old_context->stream_count; j++)
if (is_stream_unchanged( if (is_stream_unchanged(
old_context->streams[j], old_context->streams[j],
context->streams[i])) { context->streams[i])) {
...@@ -1387,9 +1387,7 @@ static int get_norm_pix_clk(const struct dc_crtc_timing *timing) ...@@ -1387,9 +1387,7 @@ static int get_norm_pix_clk(const struct dc_crtc_timing *timing)
return normalized_pix_clk; return normalized_pix_clk;
} }
static void calculate_phy_pix_clks( static void calculate_phy_pix_clks(struct validate_context *context)
const struct core_dc *dc,
struct validate_context *context)
{ {
int i; int i;
...@@ -1410,21 +1408,22 @@ static void calculate_phy_pix_clks( ...@@ -1410,21 +1408,22 @@ static void calculate_phy_pix_clks(
enum dc_status resource_map_pool_resources( enum dc_status resource_map_pool_resources(
const struct core_dc *dc, const struct core_dc *dc,
struct validate_context *context) struct validate_context *context,
struct validate_context *old_context)
{ {
const struct resource_pool *pool = dc->res_pool; const struct resource_pool *pool = dc->res_pool;
int i, j; int i, j;
calculate_phy_pix_clks(dc, context); calculate_phy_pix_clks(context);
for (i = 0; i < context->stream_count; i++) { for (i = 0; old_context && i < context->stream_count; i++) {
struct core_stream *stream = context->streams[i]; struct core_stream *stream = context->streams[i];
if (!resource_is_stream_unchanged(dc->current_context, stream)) { if (!resource_is_stream_unchanged(old_context, stream)) {
if (stream != NULL && dc->current_context->streams[i] != NULL) { if (stream != NULL && old_context->streams[i] != NULL) {
stream->bit_depth_params = stream->bit_depth_params =
dc->current_context->streams[i]->bit_depth_params; old_context->streams[i]->bit_depth_params;
stream->clamping = dc->current_context->streams[i]->clamping; stream->clamping = old_context->streams[i]->clamping;
continue; continue;
} }
} }
...@@ -1434,7 +1433,7 @@ enum dc_status resource_map_pool_resources( ...@@ -1434,7 +1433,7 @@ enum dc_status resource_map_pool_resources(
struct pipe_ctx *pipe_ctx = struct pipe_ctx *pipe_ctx =
&context->res_ctx.pipe_ctx[j]; &context->res_ctx.pipe_ctx[j];
const struct pipe_ctx *old_pipe_ctx = const struct pipe_ctx *old_pipe_ctx =
&dc->current_context->res_ctx.pipe_ctx[j]; &old_context->res_ctx.pipe_ctx[j];
if (!are_stream_backends_same(old_pipe_ctx->stream, stream)) if (!are_stream_backends_same(old_pipe_ctx->stream, stream))
continue; continue;
...@@ -1475,7 +1474,7 @@ enum dc_status resource_map_pool_resources( ...@@ -1475,7 +1474,7 @@ enum dc_status resource_map_pool_resources(
struct pipe_ctx *pipe_ctx = NULL; struct pipe_ctx *pipe_ctx = NULL;
int pipe_idx = -1; int pipe_idx = -1;
if (resource_is_stream_unchanged(dc->current_context, stream)) if (old_context && resource_is_stream_unchanged(old_context, stream))
continue; continue;
/* acquire new resources */ /* acquire new resources */
pipe_idx = acquire_first_free_pipe( pipe_idx = acquire_first_free_pipe(
...@@ -2203,7 +2202,8 @@ void resource_build_info_frame(struct pipe_ctx *pipe_ctx) ...@@ -2203,7 +2202,8 @@ void resource_build_info_frame(struct pipe_ctx *pipe_ctx)
enum dc_status resource_map_clock_resources( enum dc_status resource_map_clock_resources(
const struct core_dc *dc, const struct core_dc *dc,
struct validate_context *context) struct validate_context *context,
struct validate_context *old_context)
{ {
int i, j; int i, j;
const struct resource_pool *pool = dc->res_pool; const struct resource_pool *pool = dc->res_pool;
...@@ -2212,7 +2212,7 @@ enum dc_status resource_map_clock_resources( ...@@ -2212,7 +2212,7 @@ enum dc_status resource_map_clock_resources(
for (i = 0; i < context->stream_count; i++) { for (i = 0; i < context->stream_count; i++) {
const struct core_stream *stream = context->streams[i]; const struct core_stream *stream = context->streams[i];
if (resource_is_stream_unchanged(dc->current_context, stream)) if (old_context && resource_is_stream_unchanged(old_context, stream))
continue; continue;
for (j = 0; j < MAX_PIPES; j++) { for (j = 0; j < MAX_PIPES; j++) {
......
...@@ -653,7 +653,8 @@ static void destruct(struct dce110_resource_pool *pool) ...@@ -653,7 +653,8 @@ static void destruct(struct dce110_resource_pool *pool)
static enum dc_status validate_mapped_resource( static enum dc_status validate_mapped_resource(
const struct core_dc *dc, const struct core_dc *dc,
struct validate_context *context) struct validate_context *context,
struct validate_context *old_context)
{ {
enum dc_status status = DC_OK; enum dc_status status = DC_OK;
uint8_t i, j; uint8_t i, j;
...@@ -662,7 +663,7 @@ static enum dc_status validate_mapped_resource( ...@@ -662,7 +663,7 @@ static enum dc_status validate_mapped_resource(
struct core_stream *stream = context->streams[i]; struct core_stream *stream = context->streams[i];
struct core_link *link = stream->sink->link; struct core_link *link = stream->sink->link;
if (resource_is_stream_unchanged(dc->current_context, stream)) if (old_context && resource_is_stream_unchanged(old_context, stream))
continue; continue;
for (j = 0; j < MAX_PIPES; j++) { for (j = 0; j < MAX_PIPES; j++) {
...@@ -740,7 +741,8 @@ enum dc_status dce100_validate_with_context( ...@@ -740,7 +741,8 @@ enum dc_status dce100_validate_with_context(
const struct core_dc *dc, const struct core_dc *dc,
const struct dc_validation_set set[], const struct dc_validation_set set[],
int set_count, int set_count,
struct validate_context *context) struct validate_context *context,
struct validate_context *old_context)
{ {
struct dc_context *dc_ctx = dc->ctx; struct dc_context *dc_ctx = dc->ctx;
enum dc_status result = DC_ERROR_UNEXPECTED; enum dc_status result = DC_ERROR_UNEXPECTED;
...@@ -755,19 +757,19 @@ enum dc_status dce100_validate_with_context( ...@@ -755,19 +757,19 @@ enum dc_status dce100_validate_with_context(
context->stream_count++; context->stream_count++;
} }
result = resource_map_pool_resources(dc, context); result = resource_map_pool_resources(dc, context, old_context);
if (result == DC_OK) if (result == DC_OK)
result = resource_map_clock_resources(dc, context); result = resource_map_clock_resources(dc, context, old_context);
if (!resource_validate_attach_surfaces(set, set_count, if (!resource_validate_attach_surfaces(set, set_count,
dc->current_context, context, dc->res_pool)) { old_context, context, dc->res_pool)) {
DC_ERROR("Failed to attach surface to stream!\n"); DC_ERROR("Failed to attach surface to stream!\n");
return DC_FAIL_ATTACH_SURFACES; return DC_FAIL_ATTACH_SURFACES;
} }
if (result == DC_OK) if (result == DC_OK)
result = validate_mapped_resource(dc, context); result = validate_mapped_resource(dc, context, old_context);
if (result == DC_OK) if (result == DC_OK)
result = resource_build_scaling_params_for_context(dc, context); result = resource_build_scaling_params_for_context(dc, context);
...@@ -790,13 +792,13 @@ enum dc_status dce100_validate_guaranteed( ...@@ -790,13 +792,13 @@ enum dc_status dce100_validate_guaranteed(
dc_stream_retain(&context->streams[0]->public); dc_stream_retain(&context->streams[0]->public);
context->stream_count++; context->stream_count++;
result = resource_map_pool_resources(dc, context); result = resource_map_pool_resources(dc, context, NULL);
if (result == DC_OK) if (result == DC_OK)
result = resource_map_clock_resources(dc, context); result = resource_map_clock_resources(dc, context, NULL);
if (result == DC_OK) if (result == DC_OK)
result = validate_mapped_resource(dc, context); result = validate_mapped_resource(dc, context, NULL);
if (result == DC_OK) { if (result == DC_OK) {
validate_guaranteed_copy_streams( validate_guaranteed_copy_streams(
......
...@@ -769,7 +769,8 @@ static bool is_surface_pixel_format_supported(struct pipe_ctx *pipe_ctx, unsigne ...@@ -769,7 +769,8 @@ static bool is_surface_pixel_format_supported(struct pipe_ctx *pipe_ctx, unsigne
static enum dc_status validate_mapped_resource( static enum dc_status validate_mapped_resource(
const struct core_dc *dc, const struct core_dc *dc,
struct validate_context *context) struct validate_context *context,
struct validate_context *old_context)
{ {
enum dc_status status = DC_OK; enum dc_status status = DC_OK;
uint8_t i, j; uint8_t i, j;
...@@ -778,7 +779,7 @@ static enum dc_status validate_mapped_resource( ...@@ -778,7 +779,7 @@ static enum dc_status validate_mapped_resource(
struct core_stream *stream = context->streams[i]; struct core_stream *stream = context->streams[i];
struct core_link *link = stream->sink->link; struct core_link *link = stream->sink->link;
if (resource_is_stream_unchanged(dc->current_context, stream)) if (old_context && resource_is_stream_unchanged(old_context, stream))
continue; continue;
for (j = 0; j < MAX_PIPES; j++) { for (j = 0; j < MAX_PIPES; j++) {
...@@ -943,7 +944,8 @@ enum dc_status dce110_validate_with_context( ...@@ -943,7 +944,8 @@ enum dc_status dce110_validate_with_context(
const struct core_dc *dc, const struct core_dc *dc,
const struct dc_validation_set set[], const struct dc_validation_set set[],
int set_count, int set_count,
struct validate_context *context) struct validate_context *context,
struct validate_context *old_context)
{ {
struct dc_context *dc_ctx = dc->ctx; struct dc_context *dc_ctx = dc->ctx;
enum dc_status result = DC_ERROR_UNEXPECTED; enum dc_status result = DC_ERROR_UNEXPECTED;
...@@ -958,19 +960,19 @@ enum dc_status dce110_validate_with_context( ...@@ -958,19 +960,19 @@ enum dc_status dce110_validate_with_context(
context->stream_count++; context->stream_count++;
} }
result = resource_map_pool_resources(dc, context); result = resource_map_pool_resources(dc, context, old_context);
if (result == DC_OK) if (result == DC_OK)
result = resource_map_clock_resources(dc, context); result = resource_map_clock_resources(dc, context, old_context);
if (!resource_validate_attach_surfaces(set, set_count, if (!resource_validate_attach_surfaces(set, set_count,
dc->current_context, context, dc->res_pool)) { old_context, context, dc->res_pool)) {
DC_ERROR("Failed to attach surface to stream!\n"); DC_ERROR("Failed to attach surface to stream!\n");
return DC_FAIL_ATTACH_SURFACES; return DC_FAIL_ATTACH_SURFACES;
} }
if (result == DC_OK) if (result == DC_OK)
result = validate_mapped_resource(dc, context); result = validate_mapped_resource(dc, context, old_context);
if (result == DC_OK) if (result == DC_OK)
result = resource_build_scaling_params_for_context(dc, context); result = resource_build_scaling_params_for_context(dc, context);
...@@ -993,13 +995,13 @@ enum dc_status dce110_validate_guaranteed( ...@@ -993,13 +995,13 @@ enum dc_status dce110_validate_guaranteed(
dc_stream_retain(&context->streams[0]->public); dc_stream_retain(&context->streams[0]->public);
context->stream_count++; context->stream_count++;
result = resource_map_pool_resources(dc, context); result = resource_map_pool_resources(dc, context, NULL);
if (result == DC_OK) if (result == DC_OK)
result = resource_map_clock_resources(dc, context); result = resource_map_clock_resources(dc, context, NULL);
if (result == DC_OK) if (result == DC_OK)
result = validate_mapped_resource(dc, context); result = validate_mapped_resource(dc, context, NULL);
if (result == DC_OK) { if (result == DC_OK) {
validate_guaranteed_copy_streams( validate_guaranteed_copy_streams(
......
...@@ -722,7 +722,8 @@ static struct clock_source *find_matching_pll( ...@@ -722,7 +722,8 @@ static struct clock_source *find_matching_pll(
static enum dc_status validate_mapped_resource( static enum dc_status validate_mapped_resource(
const struct core_dc *dc, const struct core_dc *dc,
struct validate_context *context) struct validate_context *context,
struct validate_context *old_context)
{ {
enum dc_status status = DC_OK; enum dc_status status = DC_OK;
uint8_t i, j; uint8_t i, j;
...@@ -731,7 +732,7 @@ static enum dc_status validate_mapped_resource( ...@@ -731,7 +732,7 @@ static enum dc_status validate_mapped_resource(
struct core_stream *stream = context->streams[i]; struct core_stream *stream = context->streams[i];
struct core_link *link = stream->sink->link; struct core_link *link = stream->sink->link;
if (resource_is_stream_unchanged(dc->current_context, stream)) if (old_context && resource_is_stream_unchanged(old_context, stream))
continue; continue;
for (j = 0; j < MAX_PIPES; j++) { for (j = 0; j < MAX_PIPES; j++) {
...@@ -854,7 +855,8 @@ bool dce112_validate_bandwidth( ...@@ -854,7 +855,8 @@ bool dce112_validate_bandwidth(
enum dc_status resource_map_phy_clock_resources( enum dc_status resource_map_phy_clock_resources(
const struct core_dc *dc, const struct core_dc *dc,
struct validate_context *context) struct validate_context *context,
struct validate_context *old_context)
{ {
uint8_t i, j; uint8_t i, j;
...@@ -862,7 +864,7 @@ enum dc_status resource_map_phy_clock_resources( ...@@ -862,7 +864,7 @@ enum dc_status resource_map_phy_clock_resources(
for (i = 0; i < context->stream_count; i++) { for (i = 0; i < context->stream_count; i++) {
struct core_stream *stream = context->streams[i]; struct core_stream *stream = context->streams[i];
if (resource_is_stream_unchanged(dc->current_context, stream)) if (old_context && resource_is_stream_unchanged(old_context, stream))
continue; continue;
for (j = 0; j < MAX_PIPES; j++) { for (j = 0; j < MAX_PIPES; j++) {
...@@ -922,7 +924,8 @@ enum dc_status dce112_validate_with_context( ...@@ -922,7 +924,8 @@ enum dc_status dce112_validate_with_context(
const struct core_dc *dc, const struct core_dc *dc,
const struct dc_validation_set set[], const struct dc_validation_set set[],
int set_count, int set_count,
struct validate_context *context) struct validate_context *context,
struct validate_context *old_context)
{ {
struct dc_context *dc_ctx = dc->ctx; struct dc_context *dc_ctx = dc->ctx;
enum dc_status result = DC_ERROR_UNEXPECTED; enum dc_status result = DC_ERROR_UNEXPECTED;
...@@ -937,19 +940,19 @@ enum dc_status dce112_validate_with_context( ...@@ -937,19 +940,19 @@ enum dc_status dce112_validate_with_context(
context->stream_count++; context->stream_count++;
} }
result = resource_map_pool_resources(dc, context); result = resource_map_pool_resources(dc, context, old_context);
if (result == DC_OK) if (result == DC_OK)
result = resource_map_phy_clock_resources(dc, context); result = resource_map_phy_clock_resources(dc, context, old_context);
if (!resource_validate_attach_surfaces(set, set_count, if (!resource_validate_attach_surfaces(set, set_count,
dc->current_context, context, dc->res_pool)) { old_context, context, dc->res_pool)) {
DC_ERROR("Failed to attach surface to stream!\n"); DC_ERROR("Failed to attach surface to stream!\n");
return DC_FAIL_ATTACH_SURFACES; return DC_FAIL_ATTACH_SURFACES;
} }
if (result == DC_OK) if (result == DC_OK)
result = validate_mapped_resource(dc, context); result = validate_mapped_resource(dc, context, old_context);
if (result == DC_OK) if (result == DC_OK)
result = resource_build_scaling_params_for_context(dc, context); result = resource_build_scaling_params_for_context(dc, context);
...@@ -972,13 +975,13 @@ enum dc_status dce112_validate_guaranteed( ...@@ -972,13 +975,13 @@ enum dc_status dce112_validate_guaranteed(
dc_stream_retain(&context->streams[0]->public); dc_stream_retain(&context->streams[0]->public);
context->stream_count++; context->stream_count++;
result = resource_map_pool_resources(dc, context); result = resource_map_pool_resources(dc, context, NULL);
if (result == DC_OK) if (result == DC_OK)
result = resource_map_phy_clock_resources(dc, context); result = resource_map_phy_clock_resources(dc, context, NULL);
if (result == DC_OK) if (result == DC_OK)
result = validate_mapped_resource(dc, context); result = validate_mapped_resource(dc, context, NULL);
if (result == DC_OK) { if (result == DC_OK) {
validate_guaranteed_copy_streams( validate_guaranteed_copy_streams(
......
...@@ -39,7 +39,8 @@ enum dc_status dce112_validate_with_context( ...@@ -39,7 +39,8 @@ enum dc_status dce112_validate_with_context(
const struct core_dc *dc, const struct core_dc *dc,
const struct dc_validation_set set[], const struct dc_validation_set set[],
int set_count, int set_count,
struct validate_context *context); struct validate_context *context,
struct validate_context *old_context);
enum dc_status dce112_validate_guaranteed( enum dc_status dce112_validate_guaranteed(
const struct core_dc *dc, const struct core_dc *dc,
......
...@@ -669,7 +669,8 @@ static void destruct(struct dce110_resource_pool *pool) ...@@ -669,7 +669,8 @@ static void destruct(struct dce110_resource_pool *pool)
static enum dc_status validate_mapped_resource( static enum dc_status validate_mapped_resource(
const struct core_dc *dc, const struct core_dc *dc,
struct validate_context *context) struct validate_context *context,
struct validate_context *old_context)
{ {
enum dc_status status = DC_OK; enum dc_status status = DC_OK;
uint8_t i, j; uint8_t i, j;
...@@ -678,7 +679,7 @@ static enum dc_status validate_mapped_resource( ...@@ -678,7 +679,7 @@ static enum dc_status validate_mapped_resource(
struct core_stream *stream = context->streams[i]; struct core_stream *stream = context->streams[i];
struct core_link *link = stream->sink->link; struct core_link *link = stream->sink->link;
if (resource_is_stream_unchanged(dc->current_context, stream)) if (old_context && resource_is_stream_unchanged(old_context, stream))
continue; continue;
for (j = 0; j < MAX_PIPES; j++) { for (j = 0; j < MAX_PIPES; j++) {
...@@ -757,7 +758,8 @@ enum dc_status dce80_validate_with_context( ...@@ -757,7 +758,8 @@ enum dc_status dce80_validate_with_context(
const struct core_dc *dc, const struct core_dc *dc,
const struct dc_validation_set set[], const struct dc_validation_set set[],
int set_count, int set_count,
struct validate_context *context) struct validate_context *context,
struct validate_context *old_context)
{ {
struct dc_context *dc_ctx = dc->ctx; struct dc_context *dc_ctx = dc->ctx;
enum dc_status result = DC_ERROR_UNEXPECTED; enum dc_status result = DC_ERROR_UNEXPECTED;
...@@ -772,19 +774,19 @@ enum dc_status dce80_validate_with_context( ...@@ -772,19 +774,19 @@ enum dc_status dce80_validate_with_context(
context->stream_count++; context->stream_count++;
} }
result = resource_map_pool_resources(dc, context); result = resource_map_pool_resources(dc, context, old_context);
if (result == DC_OK) if (result == DC_OK)
result = resource_map_clock_resources(dc, context); result = resource_map_clock_resources(dc, context, old_context);
if (!resource_validate_attach_surfaces(set, set_count, if (!resource_validate_attach_surfaces(set, set_count,
dc->current_context, context, dc->res_pool)) { old_context, context, dc->res_pool)) {
DC_ERROR("Failed to attach surface to stream!\n"); DC_ERROR("Failed to attach surface to stream!\n");
return DC_FAIL_ATTACH_SURFACES; return DC_FAIL_ATTACH_SURFACES;
} }
if (result == DC_OK) if (result == DC_OK)
result = validate_mapped_resource(dc, context); result = validate_mapped_resource(dc, context, old_context);
if (result == DC_OK) if (result == DC_OK)
result = resource_build_scaling_params_for_context(dc, context); result = resource_build_scaling_params_for_context(dc, context);
...@@ -806,13 +808,13 @@ enum dc_status dce80_validate_guaranteed( ...@@ -806,13 +808,13 @@ enum dc_status dce80_validate_guaranteed(
dc_stream_retain(&context->streams[0]->public); dc_stream_retain(&context->streams[0]->public);
context->stream_count++; context->stream_count++;
result = resource_map_pool_resources(dc, context); result = resource_map_pool_resources(dc, context, NULL);
if (result == DC_OK) if (result == DC_OK)
result = resource_map_clock_resources(dc, context); result = resource_map_clock_resources(dc, context, NULL);
if (result == DC_OK) if (result == DC_OK)
result = validate_mapped_resource(dc, context); result = validate_mapped_resource(dc, context, NULL);
if (result == DC_OK) { if (result == DC_OK) {
validate_guaranteed_copy_streams( validate_guaranteed_copy_streams(
......
...@@ -853,7 +853,8 @@ static enum dc_status build_pipe_hw_param(struct pipe_ctx *pipe_ctx) ...@@ -853,7 +853,8 @@ static enum dc_status build_pipe_hw_param(struct pipe_ctx *pipe_ctx)
static enum dc_status validate_mapped_resource( static enum dc_status validate_mapped_resource(
const struct core_dc *dc, const struct core_dc *dc,
struct validate_context *context) struct validate_context *context,
struct validate_context *old_context)
{ {
enum dc_status status = DC_OK; enum dc_status status = DC_OK;
uint8_t i, j; uint8_t i, j;
...@@ -862,8 +863,8 @@ static enum dc_status validate_mapped_resource( ...@@ -862,8 +863,8 @@ static enum dc_status validate_mapped_resource(
struct core_stream *stream = context->streams[i]; struct core_stream *stream = context->streams[i];
struct core_link *link = stream->sink->link; struct core_link *link = stream->sink->link;
if (resource_is_stream_unchanged(dc->current_context, stream)) { if (old_context && resource_is_stream_unchanged(old_context, stream)) {
if (stream != NULL && dc->current_context->streams[i] != NULL) { if (stream != NULL && old_context->streams[i] != NULL) {
/* todo: shouldn't have to copy missing parameter here */ /* todo: shouldn't have to copy missing parameter here */
resource_build_bit_depth_reduction_params(stream, resource_build_bit_depth_reduction_params(stream,
&stream->bit_depth_params); &stream->bit_depth_params);
...@@ -920,7 +921,8 @@ enum dc_status dcn10_validate_with_context( ...@@ -920,7 +921,8 @@ enum dc_status dcn10_validate_with_context(
const struct core_dc *dc, const struct core_dc *dc,
const struct dc_validation_set set[], const struct dc_validation_set set[],
int set_count, int set_count,
struct validate_context *context) struct validate_context *context,
struct validate_context *old_context)
{ {
enum dc_status result = DC_OK; enum dc_status result = DC_OK;
int i; int i;
...@@ -934,20 +936,20 @@ enum dc_status dcn10_validate_with_context( ...@@ -934,20 +936,20 @@ enum dc_status dcn10_validate_with_context(
context->stream_count++; context->stream_count++;
} }
result = resource_map_pool_resources(dc, context); result = resource_map_pool_resources(dc, context, old_context);
if (result != DC_OK) if (result != DC_OK)
return result; return result;
result = resource_map_phy_clock_resources(dc, context); result = resource_map_phy_clock_resources(dc, context, old_context);
if (result != DC_OK) if (result != DC_OK)
return result; return result;
result = validate_mapped_resource(dc, context); result = validate_mapped_resource(dc, context, old_context);
if (result != DC_OK) if (result != DC_OK)
return result; return result;
if (!resource_validate_attach_surfaces(set, set_count, if (!resource_validate_attach_surfaces(set, set_count,
dc->current_context, context, dc->res_pool)) old_context, context, dc->res_pool))
return DC_FAIL_ATTACH_SURFACES; return DC_FAIL_ATTACH_SURFACES;
result = resource_build_scaling_params_for_context(dc, context); result = resource_build_scaling_params_for_context(dc, context);
...@@ -971,13 +973,13 @@ enum dc_status dcn10_validate_guaranteed( ...@@ -971,13 +973,13 @@ enum dc_status dcn10_validate_guaranteed(
dc_stream_retain(&context->streams[0]->public); dc_stream_retain(&context->streams[0]->public);
context->stream_count++; context->stream_count++;
result = resource_map_pool_resources(dc, context); result = resource_map_pool_resources(dc, context, NULL);
if (result == DC_OK) if (result == DC_OK)
result = resource_map_phy_clock_resources(dc, context); result = resource_map_phy_clock_resources(dc, context, NULL);
if (result == DC_OK) if (result == DC_OK)
result = validate_mapped_resource(dc, context); result = validate_mapped_resource(dc, context, NULL);
if (result == DC_OK) { if (result == DC_OK) {
validate_guaranteed_copy_streams( validate_guaranteed_copy_streams(
......
...@@ -203,7 +203,8 @@ struct resource_funcs { ...@@ -203,7 +203,8 @@ struct resource_funcs {
const struct core_dc *dc, const struct core_dc *dc,
const struct dc_validation_set set[], const struct dc_validation_set set[],
int set_count, int set_count,
struct validate_context *context); struct validate_context *context,
struct validate_context *old_context);
enum dc_status (*validate_guaranteed)( enum dc_status (*validate_guaranteed)(
const struct core_dc *dc, const struct core_dc *dc,
......
...@@ -80,7 +80,8 @@ void dc_destroy_resource_pool(struct core_dc *dc); ...@@ -80,7 +80,8 @@ void dc_destroy_resource_pool(struct core_dc *dc);
enum dc_status resource_map_pool_resources( enum dc_status resource_map_pool_resources(
const struct core_dc *dc, const struct core_dc *dc,
struct validate_context *context); struct validate_context *context,
struct validate_context *old_context);
bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx); bool resource_build_scaling_params(struct pipe_ctx *pipe_ctx);
...@@ -150,11 +151,13 @@ void resource_validate_ctx_update_pointer_after_copy( ...@@ -150,11 +151,13 @@ void resource_validate_ctx_update_pointer_after_copy(
enum dc_status resource_map_clock_resources( enum dc_status resource_map_clock_resources(
const struct core_dc *dc, const struct core_dc *dc,
struct validate_context *context); struct validate_context *context,
struct validate_context *old_context);
enum dc_status resource_map_phy_clock_resources( enum dc_status resource_map_phy_clock_resources(
const struct core_dc *dc, const struct core_dc *dc,
struct validate_context *context); struct validate_context *context,
struct validate_context *old_context);
bool pipe_need_reprogram( bool pipe_need_reprogram(
struct pipe_ctx *pipe_ctx_old, struct pipe_ctx *pipe_ctx_old,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment