Skip to content

Commit f2c5852

Browse files
Alvin Leealexdeucher
authored andcommitted
drm/amd/display: For new fast update path, loop through each surface
[Description] - Previous implementation didn't consider multiple surfaces in a flip - Loop through each surface in each flip to ensure the update path is correct Reviewed-by: Samson Tam <[email protected]> Acked-by: Rodrigo Siqueira <[email protected]> Signed-off-by: Alvin Lee <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 1966bbf commit f2c5852

File tree

1 file changed

+52
-34
lines changed
  • drivers/gpu/drm/amd/display/dc/core

1 file changed

+52
-34
lines changed

drivers/gpu/drm/amd/display/dc/core/dc.c

Lines changed: 52 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4245,48 +4245,64 @@ static void update_seamless_boot_flags(struct dc *dc,
42454245

42464246
static void populate_fast_updates(struct dc_fast_update *fast_update,
42474247
struct dc_surface_update *srf_updates,
4248+
int surface_count,
42484249
struct dc_stream_update *stream_update)
42494250
{
4250-
if (srf_updates) {
4251-
fast_update->flip_addr = srf_updates->flip_addr;
4252-
fast_update->gamma = srf_updates->gamma;
4253-
fast_update->gamut_remap_matrix = srf_updates->gamut_remap_matrix;
4254-
fast_update->input_csc_color_matrix = srf_updates->input_csc_color_matrix;
4255-
fast_update->coeff_reduction_factor = srf_updates->coeff_reduction_factor;
4256-
}
4251+
int i = 0;
4252+
42574253
if (stream_update) {
4258-
fast_update->out_transfer_func = stream_update->out_transfer_func;
4259-
fast_update->output_csc_transform = stream_update->output_csc_transform;
4254+
fast_update[0].out_transfer_func = stream_update->out_transfer_func;
4255+
fast_update[0].output_csc_transform = stream_update->output_csc_transform;
4256+
}
4257+
4258+
for (i = 0; i < surface_count; i++) {
4259+
fast_update[i].flip_addr = srf_updates[i].flip_addr;
4260+
fast_update[i].gamma = srf_updates[i].gamma;
4261+
fast_update[i].gamut_remap_matrix = srf_updates[i].gamut_remap_matrix;
4262+
fast_update[i].input_csc_color_matrix = srf_updates[i].input_csc_color_matrix;
4263+
fast_update[i].coeff_reduction_factor = srf_updates[i].coeff_reduction_factor;
42604264
}
42614265
}
42624266

4263-
static bool fast_updates_exist(struct dc_fast_update *fast_update)
4267+
static bool fast_updates_exist(struct dc_fast_update *fast_update, int surface_count)
42644268
{
4265-
if (fast_update->flip_addr ||
4266-
fast_update->gamma ||
4267-
fast_update->gamut_remap_matrix ||
4268-
fast_update->input_csc_color_matrix ||
4269-
fast_update->coeff_reduction_factor ||
4270-
fast_update->out_transfer_func ||
4271-
fast_update->output_csc_transform)
4269+
int i;
4270+
4271+
if (fast_update[0].out_transfer_func ||
4272+
fast_update[0].output_csc_transform)
42724273
return true;
42734274

4275+
for (i = 0; i < surface_count; i++) {
4276+
if (fast_update[i].flip_addr ||
4277+
fast_update[i].gamma ||
4278+
fast_update[i].gamut_remap_matrix ||
4279+
fast_update[i].input_csc_color_matrix ||
4280+
fast_update[i].coeff_reduction_factor)
4281+
return true;
4282+
}
4283+
42744284
return false;
42754285
}
42764286

42774287
static bool full_update_required(struct dc_surface_update *srf_updates,
4288+
int surface_count,
42784289
struct dc_stream_update *stream_update)
42794290
{
4280-
if (srf_updates &&
4281-
(srf_updates->plane_info ||
4282-
srf_updates->scaling_info ||
4283-
(srf_updates->hdr_mult.value &&
4284-
srf_updates->hdr_mult.value != srf_updates->surface->hdr_mult.value) ||
4285-
srf_updates->in_transfer_func ||
4286-
srf_updates->func_shaper ||
4287-
srf_updates->lut3d_func ||
4288-
srf_updates->blend_tf))
4289-
return true;
4291+
4292+
int i;
4293+
4294+
for (i = 0; i < surface_count; i++) {
4295+
if (srf_updates &&
4296+
(srf_updates[i].plane_info ||
4297+
srf_updates[i].scaling_info ||
4298+
(srf_updates[i].hdr_mult.value &&
4299+
srf_updates[i].hdr_mult.value != srf_updates->surface->hdr_mult.value) ||
4300+
srf_updates[i].in_transfer_func ||
4301+
srf_updates[i].func_shaper ||
4302+
srf_updates[i].lut3d_func ||
4303+
srf_updates[i].blend_tf))
4304+
return true;
4305+
}
42904306

42914307
if (stream_update &&
42924308
(((stream_update->src.height != 0 && stream_update->src.width != 0) ||
@@ -4322,9 +4338,11 @@ static bool full_update_required(struct dc_surface_update *srf_updates,
43224338

43234339
static bool fast_update_only(struct dc_fast_update *fast_update,
43244340
struct dc_surface_update *srf_updates,
4341+
int surface_count,
43254342
struct dc_stream_update *stream_update)
43264343
{
4327-
return fast_updates_exist(fast_update) && !full_update_required(srf_updates, stream_update);
4344+
return fast_updates_exist(fast_update, surface_count)
4345+
&& !full_update_required(srf_updates, surface_count, stream_update);
43284346
}
43294347

43304348
bool dc_update_planes_and_stream(struct dc *dc,
@@ -4336,7 +4354,7 @@ bool dc_update_planes_and_stream(struct dc *dc,
43364354
enum surface_update_type update_type;
43374355
int i;
43384356
struct mall_temp_config mall_temp_config;
4339-
struct dc_fast_update fast_update = {0};
4357+
struct dc_fast_update fast_update[MAX_SURFACES] = {0};
43404358

43414359
/* In cases where MPO and split or ODM are used transitions can
43424360
* cause underflow. Apply stream configuration with minimal pipe
@@ -4345,7 +4363,7 @@ bool dc_update_planes_and_stream(struct dc *dc,
43454363
bool force_minimal_pipe_splitting;
43464364
bool is_plane_addition;
43474365

4348-
populate_fast_updates(&fast_update, srf_updates, stream_update);
4366+
populate_fast_updates(fast_update, srf_updates, surface_count, stream_update);
43494367
force_minimal_pipe_splitting = could_mpcc_tree_change_for_active_pipes(
43504368
dc,
43514369
stream,
@@ -4396,7 +4414,7 @@ bool dc_update_planes_and_stream(struct dc *dc,
43964414
}
43974415

43984416
update_seamless_boot_flags(dc, context, surface_count, stream);
4399-
if (fast_update_only(&fast_update, srf_updates, stream_update) &&
4417+
if (fast_update_only(fast_update, srf_updates, surface_count, stream_update) &&
44004418
!dc->debug.enable_legacy_fast_update) {
44014419
commit_planes_for_stream_fast(dc,
44024420
srf_updates,
@@ -4454,9 +4472,9 @@ void dc_commit_updates_for_stream(struct dc *dc,
44544472
struct dc_state *context;
44554473
struct dc_context *dc_ctx = dc->ctx;
44564474
int i, j;
4457-
struct dc_fast_update fast_update = {0};
4475+
struct dc_fast_update fast_update[MAX_SURFACES] = {0};
44584476

4459-
populate_fast_updates(&fast_update, srf_updates, stream_update);
4477+
populate_fast_updates(fast_update, srf_updates, surface_count, stream_update);
44604478
stream_status = dc_stream_get_status(stream);
44614479
context = dc->current_state;
44624480

@@ -4542,7 +4560,7 @@ void dc_commit_updates_for_stream(struct dc *dc,
45424560
TRACE_DC_PIPE_STATE(pipe_ctx, i, MAX_PIPES);
45434561

45444562
update_seamless_boot_flags(dc, context, surface_count, stream);
4545-
if (fast_update_only(&fast_update, srf_updates, stream_update) &&
4563+
if (fast_update_only(fast_update, srf_updates, surface_count, stream_update) &&
45464564
!dc->debug.enable_legacy_fast_update) {
45474565
commit_planes_for_stream_fast(dc,
45484566
srf_updates,

0 commit comments

Comments
 (0)