Skip to content

Commit 01130f5

Browse files
AMD-aricalexdeucher
authored andcommitted
drm/amd/display: Add hubp cache reset when powergating
[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>
1 parent 335acfb commit 01130f5

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
@@ -546,6 +546,12 @@ void hubp1_dcc_control(struct hubp *hubp, bool enable,
546546
SECONDARY_SURFACE_DCC_IND_64B_BLK, dcc_ind_64b_blk);
547547
}
548548

549+
void hubp_reset(struct hubp *hubp)
550+
{
551+
memset(&hubp->pos, 0, sizeof(hubp->pos));
552+
memset(&hubp->att, 0, sizeof(hubp->att));
553+
}
554+
549555
void hubp1_program_surface_config(
550556
struct hubp *hubp,
551557
enum surface_pixel_format format,
@@ -1351,8 +1357,9 @@ static void hubp1_wait_pipe_read_start(struct hubp *hubp)
13511357

13521358
void hubp1_init(struct hubp *hubp)
13531359
{
1354-
//do nothing
1360+
hubp_reset(hubp);
13551361
}
1362+
13561363
static const struct hubp_funcs dcn10_hubp_funcs = {
13571364
.hubp_program_surface_flip_and_addr =
13581365
hubp1_program_surface_flip_and_addr,
@@ -1365,6 +1372,7 @@ static const struct hubp_funcs dcn10_hubp_funcs = {
13651372
.hubp_set_vm_context0_settings = hubp1_set_vm_context0_settings,
13661373
.set_blank = hubp1_set_blank,
13671374
.dcc_control = hubp1_dcc_control,
1375+
.hubp_reset = hubp_reset,
13681376
.mem_program_viewport = min_set_viewport,
13691377
.set_hubp_blank_en = hubp1_set_hubp_blank_en,
13701378
.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
@@ -1674,6 +1674,7 @@ static struct hubp_funcs dcn20_hubp_funcs = {
16741674
.set_blank = hubp2_set_blank,
16751675
.set_blank_regs = hubp2_set_blank_regs,
16761676
.dcc_control = hubp2_dcc_control,
1677+
.hubp_reset = hubp_reset,
16771678
.mem_program_viewport = min_set_viewport,
16781679
.set_cursor_attributes = hubp2_cursor_set_attributes,
16791680
.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
@@ -499,6 +499,8 @@ void hubp3_init(struct hubp *hubp)
499499
struct dcn20_hubp *hubp2 = TO_DCN20_HUBP(hubp);
500500
//hubp[i].HUBPREQ_DEBUG.HUBPREQ_DEBUG[26] = 1;
501501
REG_WRITE(HUBPREQ_DEBUG, 1 << 26);
502+
503+
hubp_reset(hubp);
502504
}
503505

504506
static struct hubp_funcs dcn30_hubp_funcs = {
@@ -513,6 +515,7 @@ static struct hubp_funcs dcn30_hubp_funcs = {
513515
.set_blank = hubp2_set_blank,
514516
.set_blank_regs = hubp2_set_blank_regs,
515517
.dcc_control = hubp3_dcc_control,
518+
.hubp_reset = hubp_reset,
516519
.mem_program_viewport = min_set_viewport,
517520
.set_cursor_attributes = hubp2_cursor_set_attributes,
518521
.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)