Skip to content

Commit f7352d1

Browse files
Nicholas Kazlauskasalexdeucher
authored andcommitted
drm/amd/display: Add cursor offload abort to the new HWSS path
[HOW] If cursor attributes or position are passed into DC via a stream update and we take the newer HWSS paths then it's possible that the update races with cursor offloading if it's enabled. This can cause the cursor to remain on the screen if no further updates come in if it results in HW cursor support being disabled. [HOW] Add the abort into the HWSS path so that cursor offloading doesn't attempt to reprogram the cursor with outdated params. Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Dillon Varone <dillon.varone@amd.com> Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent a76d6f2 commit f7352d1

3 files changed

Lines changed: 39 additions & 0 deletions

File tree

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,6 +1293,9 @@ void hwss_execute_sequence(struct dc *dc,
12931293
case HUBP_MEM_PROGRAM_VIEWPORT:
12941294
hwss_hubp_mem_program_viewport(params);
12951295
break;
1296+
case ABORT_CURSOR_OFFLOAD_UPDATE:
1297+
hwss_abort_cursor_offload_update(params);
1298+
break;
12961299
case SET_CURSOR_ATTRIBUTE:
12971300
hwss_set_cursor_attribute(params);
12981301
break;
@@ -3076,6 +3079,15 @@ void hwss_hubp_mem_program_viewport(union block_sequence_params *params)
30763079
hubp->funcs->mem_program_viewport(hubp, viewport, viewport_c);
30773080
}
30783081

3082+
void hwss_abort_cursor_offload_update(union block_sequence_params *params)
3083+
{
3084+
struct dc *dc = params->abort_cursor_offload_update_params.dc;
3085+
struct pipe_ctx *pipe_ctx = params->abort_cursor_offload_update_params.pipe_ctx;
3086+
3087+
if (dc && dc->hwss.abort_cursor_offload_update)
3088+
dc->hwss.abort_cursor_offload_update(dc, pipe_ctx);
3089+
}
3090+
30793091
void hwss_set_cursor_attribute(union block_sequence_params *params)
30803092
{
30813093
struct dc *dc = params->set_cursor_attribute_params.dc;
@@ -3934,6 +3946,18 @@ void hwss_add_hubp_mem_program_viewport(struct block_sequence_state *seq_state,
39343946
}
39353947
}
39363948

3949+
void hwss_add_abort_cursor_offload_update(struct block_sequence_state *seq_state,
3950+
struct dc *dc,
3951+
struct pipe_ctx *pipe_ctx)
3952+
{
3953+
if (*seq_state->num_steps < MAX_HWSS_BLOCK_SEQUENCE_SIZE) {
3954+
seq_state->steps[*seq_state->num_steps].func = ABORT_CURSOR_OFFLOAD_UPDATE;
3955+
seq_state->steps[*seq_state->num_steps].params.abort_cursor_offload_update_params.dc = dc;
3956+
seq_state->steps[*seq_state->num_steps].params.abort_cursor_offload_update_params.pipe_ctx = pipe_ctx;
3957+
(*seq_state->num_steps)++;
3958+
}
3959+
}
3960+
39373961
void hwss_add_set_cursor_attribute(struct block_sequence_state *seq_state,
39383962
struct dc *dc,
39393963
struct pipe_ctx *pipe_ctx)

drivers/gpu/drm/amd/display/dc/hwss/dcn401/dcn401_hwseq.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3673,6 +3673,8 @@ void dcn401_update_dchubp_dpp_sequence(struct dc *dc,
36733673
pipe_ctx->update_flags.bits.scaler || viewport_changed == true) &&
36743674
pipe_ctx->stream->cursor_attributes.address.quad_part != 0) {
36753675

3676+
hwss_add_abort_cursor_offload_update(seq_state, dc, pipe_ctx);
3677+
36763678
hwss_add_set_cursor_attribute(seq_state, dc, pipe_ctx);
36773679

36783680
/* Step 15: Cursor position setup */

drivers/gpu/drm/amd/display/dc/hwss/hw_sequencer.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,11 @@ struct hubp_program_mcache_id_and_split_coordinate_params {
696696
struct mcache_regs_struct *mcache_regs;
697697
};
698698

699+
struct abort_cursor_offload_update_params {
700+
struct dc *dc;
701+
struct pipe_ctx *pipe_ctx;
702+
};
703+
699704
struct set_cursor_attribute_params {
700705
struct dc *dc;
701706
struct pipe_ctx *pipe_ctx;
@@ -842,6 +847,7 @@ union block_sequence_params {
842847
struct mpc_insert_plane_params mpc_insert_plane_params;
843848
struct dpp_set_scaler_params dpp_set_scaler_params;
844849
struct hubp_mem_program_viewport_params hubp_mem_program_viewport_params;
850+
struct abort_cursor_offload_update_params abort_cursor_offload_update_params;
845851
struct set_cursor_attribute_params set_cursor_attribute_params;
846852
struct set_cursor_position_params set_cursor_position_params;
847853
struct set_cursor_sdr_white_level_params set_cursor_sdr_white_level_params;
@@ -960,6 +966,7 @@ enum block_sequence_func {
960966
MPC_INSERT_PLANE,
961967
DPP_SET_SCALER,
962968
HUBP_MEM_PROGRAM_VIEWPORT,
969+
ABORT_CURSOR_OFFLOAD_UPDATE,
963970
SET_CURSOR_ATTRIBUTE,
964971
SET_CURSOR_POSITION,
965972
SET_CURSOR_SDR_WHITE_LEVEL,
@@ -1565,6 +1572,8 @@ void hwss_dpp_set_scaler(union block_sequence_params *params);
15651572

15661573
void hwss_hubp_mem_program_viewport(union block_sequence_params *params);
15671574

1575+
void hwss_abort_cursor_offload_update(union block_sequence_params *params);
1576+
15681577
void hwss_set_cursor_attribute(union block_sequence_params *params);
15691578

15701579
void hwss_set_cursor_position(union block_sequence_params *params);
@@ -1961,6 +1970,10 @@ void hwss_add_hubp_mem_program_viewport(struct block_sequence_state *seq_state,
19611970
const struct rect *viewport,
19621971
const struct rect *viewport_c);
19631972

1973+
void hwss_add_abort_cursor_offload_update(struct block_sequence_state *seq_state,
1974+
struct dc *dc,
1975+
struct pipe_ctx *pipe_ctx);
1976+
19641977
void hwss_add_set_cursor_attribute(struct block_sequence_state *seq_state,
19651978
struct dc *dc,
19661979
struct pipe_ctx *pipe_ctx);

0 commit comments

Comments
 (0)