Skip to content

Commit 73ac634

Browse files
AMD-aricgregkh
authored andcommitted
drm/amd/display: Add hubp cache reset when powergating
commit 01130f5 upstream. [Why] When HUBP is power gated, the SW state can get out of sync with the hardware state causing cursor to not be programmed correctly. [How] Similar to DPP, add a HUBP reset function which is called wherever HUBP is initialized or powergated. This function will clear the cursor position and attribute cache allowing for proper programming when the HUBP is brought back up. Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org Reviewed-by: Sung Lee <sung.lee@amd.com> Signed-off-by: Aric Cyr <Aric.Cyr@amd.com> Signed-off-by: Wayne Lin <wayne.lin@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5936f2f commit 73ac634

File tree

14 files changed

+33
-2
lines changed

14 files changed

+33
-2
lines changed

drivers/gpu/drm/amd/display/dc/dpp/dcn10/dcn10_dpp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ void dpp_reset(struct dpp *dpp_base)
194194
dpp->filter_h = NULL;
195195
dpp->filter_v = NULL;
196196

197+
memset(&dpp_base->pos, 0, sizeof(dpp_base->pos));
198+
memset(&dpp_base->att, 0, sizeof(dpp_base->att));
199+
197200
memset(&dpp->scl_data, 0, sizeof(dpp->scl_data));
198201
memset(&dpp->pwl_data, 0, sizeof(dpp->pwl_data));
199202
}

drivers/gpu/drm/amd/display/dc/hubp/dcn10/dcn10_hubp.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,12 @@ void hubp1_dcc_control(struct hubp *hubp, bool enable,
532532
SECONDARY_SURFACE_DCC_IND_64B_BLK, dcc_ind_64b_blk);
533533
}
534534

535+
void hubp_reset(struct hubp *hubp)
536+
{
537+
memset(&hubp->pos, 0, sizeof(hubp->pos));
538+
memset(&hubp->att, 0, sizeof(hubp->att));
539+
}
540+
535541
void hubp1_program_surface_config(
536542
struct hubp *hubp,
537543
enum surface_pixel_format format,
@@ -1337,8 +1343,9 @@ static void hubp1_wait_pipe_read_start(struct hubp *hubp)
13371343

13381344
void hubp1_init(struct hubp *hubp)
13391345
{
1340-
//do nothing
1346+
hubp_reset(hubp);
13411347
}
1348+
13421349
static const struct hubp_funcs dcn10_hubp_funcs = {
13431350
.hubp_program_surface_flip_and_addr =
13441351
hubp1_program_surface_flip_and_addr,
@@ -1351,6 +1358,7 @@ static const struct hubp_funcs dcn10_hubp_funcs = {
13511358
.hubp_set_vm_context0_settings = hubp1_set_vm_context0_settings,
13521359
.set_blank = hubp1_set_blank,
13531360
.dcc_control = hubp1_dcc_control,
1361+
.hubp_reset = hubp_reset,
13541362
.mem_program_viewport = min_set_viewport,
13551363
.set_hubp_blank_en = hubp1_set_hubp_blank_en,
13561364
.set_cursor_attributes = hubp1_cursor_set_attributes,

drivers/gpu/drm/amd/display/dc/hubp/dcn10/dcn10_hubp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,8 @@ void hubp1_dcc_control(struct hubp *hubp,
746746
bool enable,
747747
enum hubp_ind_block_size independent_64b_blks);
748748

749+
void hubp_reset(struct hubp *hubp);
750+
749751
bool hubp1_program_surface_flip_and_addr(
750752
struct hubp *hubp,
751753
const struct dc_plane_address *address,

drivers/gpu/drm/amd/display/dc/hubp/dcn20/dcn20_hubp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1660,6 +1660,7 @@ static struct hubp_funcs dcn20_hubp_funcs = {
16601660
.set_blank = hubp2_set_blank,
16611661
.set_blank_regs = hubp2_set_blank_regs,
16621662
.dcc_control = hubp2_dcc_control,
1663+
.hubp_reset = hubp_reset,
16631664
.mem_program_viewport = min_set_viewport,
16641665
.set_cursor_attributes = hubp2_cursor_set_attributes,
16651666
.set_cursor_position = hubp2_cursor_set_position,

drivers/gpu/drm/amd/display/dc/hubp/dcn201/dcn201_hubp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ static struct hubp_funcs dcn201_hubp_funcs = {
121121
.set_cursor_position = hubp1_cursor_set_position,
122122
.set_blank = hubp1_set_blank,
123123
.dcc_control = hubp1_dcc_control,
124+
.hubp_reset = hubp_reset,
124125
.mem_program_viewport = min_set_viewport,
125126
.hubp_clk_cntl = hubp1_clk_cntl,
126127
.hubp_vtg_sel = hubp1_vtg_sel,

drivers/gpu/drm/amd/display/dc/hubp/dcn21/dcn21_hubp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -811,6 +811,8 @@ static void hubp21_init(struct hubp *hubp)
811811
struct dcn21_hubp *hubp21 = TO_DCN21_HUBP(hubp);
812812
//hubp[i].HUBPREQ_DEBUG.HUBPREQ_DEBUG[26] = 1;
813813
REG_WRITE(HUBPREQ_DEBUG, 1 << 26);
814+
815+
hubp_reset(hubp);
814816
}
815817
static struct hubp_funcs dcn21_hubp_funcs = {
816818
.hubp_enable_tripleBuffer = hubp2_enable_triplebuffer,
@@ -823,6 +825,7 @@ static struct hubp_funcs dcn21_hubp_funcs = {
823825
.hubp_set_vm_system_aperture_settings = hubp21_set_vm_system_aperture_settings,
824826
.set_blank = hubp1_set_blank,
825827
.dcc_control = hubp1_dcc_control,
828+
.hubp_reset = hubp_reset,
826829
.mem_program_viewport = hubp21_set_viewport,
827830
.set_cursor_attributes = hubp2_cursor_set_attributes,
828831
.set_cursor_position = hubp1_cursor_set_position,

drivers/gpu/drm/amd/display/dc/hubp/dcn30/dcn30_hubp.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,8 @@ void hubp3_init(struct hubp *hubp)
483483
struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
484484
//hubp[i].HUBPREQ_DEBUG.HUBPREQ_DEBUG[26] = 1;
485485
REG_WRITE(HUBPREQ_DEBUG, 1 << 26);
486+
487+
hubp_reset(hubp);
486488
}
487489

488490
static struct hubp_funcs dcn30_hubp_funcs = {
@@ -497,6 +499,7 @@ static struct hubp_funcs dcn30_hubp_funcs = {
497499
.set_blank = hubp2_set_blank,
498500
.set_blank_regs = hubp2_set_blank_regs,
499501
.dcc_control = hubp3_dcc_control,
502+
.hubp_reset = hubp_reset,
500503
.mem_program_viewport = min_set_viewport,
501504
.set_cursor_attributes = hubp2_cursor_set_attributes,
502505
.set_cursor_position = hubp2_cursor_set_position,

drivers/gpu/drm/amd/display/dc/hubp/dcn31/dcn31_hubp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ static struct hubp_funcs dcn31_hubp_funcs = {
7979
.hubp_set_vm_system_aperture_settings = hubp3_set_vm_system_aperture_settings,
8080
.set_blank = hubp2_set_blank,
8181
.dcc_control = hubp3_dcc_control,
82+
.hubp_reset = hubp_reset,
8283
.mem_program_viewport = min_set_viewport,
8384
.set_cursor_attributes = hubp2_cursor_set_attributes,
8485
.set_cursor_position = hubp2_cursor_set_position,

drivers/gpu/drm/amd/display/dc/hubp/dcn32/dcn32_hubp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ static struct hubp_funcs dcn32_hubp_funcs = {
181181
.set_blank = hubp2_set_blank,
182182
.set_blank_regs = hubp2_set_blank_regs,
183183
.dcc_control = hubp3_dcc_control,
184+
.hubp_reset = hubp_reset,
184185
.mem_program_viewport = min_set_viewport,
185186
.set_cursor_attributes = hubp32_cursor_set_attributes,
186187
.set_cursor_position = hubp2_cursor_set_position,

drivers/gpu/drm/amd/display/dc/hubp/dcn35/dcn35_hubp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ static struct hubp_funcs dcn35_hubp_funcs = {
199199
.hubp_set_vm_system_aperture_settings = hubp3_set_vm_system_aperture_settings,
200200
.set_blank = hubp2_set_blank,
201201
.dcc_control = hubp3_dcc_control,
202+
.hubp_reset = hubp_reset,
202203
.mem_program_viewport = min_set_viewport,
203204
.set_cursor_attributes = hubp2_cursor_set_attributes,
204205
.set_cursor_position = hubp2_cursor_set_position,

0 commit comments

Comments
 (0)