Skip to content

Commit 098c9b5

Browse files
Rodrigo Siqueiraalexdeucher
authored andcommitted
drm/amd/display: Add DCC/Tiling reset helper for DCN and DCE
This commit introduces a function helper for resetting DCN/DCE DCC and tiling. Those functions are generic for their respective DCN/DCE, so they were added to the oldest version of each architecture. Reviewed-by: Alvin Lee <[email protected]> Signed-off-by: Rodrigo Siqueira <[email protected]> Signed-off-by: Roman Li <[email protected]> Tested-by: Daniel Wheeler <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 8ae6dfc commit 098c9b5

File tree

4 files changed

+66
-0
lines changed

4 files changed

+66
-0
lines changed

drivers/gpu/drm/amd/display/dc/hwss/dce100/dce100_hwseq.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,3 +140,32 @@ void dce100_hw_sequencer_construct(struct dc *dc)
140140
dc->hwss.optimize_bandwidth = dce100_optimize_bandwidth;
141141
}
142142

143+
/**
144+
* dce100_reset_surface_dcc_and_tiling - Set DCC and tiling in DCE to their disable mode.
145+
*
146+
* @pipe_ctx: Pointer to the pipe context structure.
147+
* @plane_state: Surface state
148+
* @clear_tiling: If true set tiling to Linear, otherwise does not change tiling
149+
*
150+
* This function is responsible for call the HUBP block to disable DCC and set
151+
* tiling to the linear mode.
152+
*/
153+
void dce100_reset_surface_dcc_and_tiling(struct pipe_ctx *pipe_ctx,
154+
struct dc_plane_state *plane_state,
155+
bool clear_tiling)
156+
{
157+
struct mem_input *mi = pipe_ctx->plane_res.mi;
158+
159+
if (!mi)
160+
return;
161+
162+
/* if framebuffer is tiled, disable tiling */
163+
if (clear_tiling && mi->funcs->mem_input_clear_tiling)
164+
mi->funcs->mem_input_clear_tiling(mi);
165+
166+
/* force page flip to see the new content of the framebuffer */
167+
mi->funcs->mem_input_program_surface_flip_and_addr(mi,
168+
&plane_state->address,
169+
true);
170+
}
171+

drivers/gpu/drm/amd/display/dc/hwss/dce100/dce100_hwseq.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,9 @@ bool dce100_enable_display_power_gating(struct dc *dc, uint8_t controller_id,
4646
struct dc_bios *dcb,
4747
enum pipe_gating_control power_gating);
4848

49+
void dce100_reset_surface_dcc_and_tiling(struct pipe_ctx *pipe_ctx,
50+
struct dc_plane_state *plane_state,
51+
bool clear_tiling);
52+
4953
#endif /* __DC_HWSS_DCE100_H__ */
5054

drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.c

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3920,3 +3920,32 @@ void dcn10_get_dcc_en_bits(struct dc *dc, int *dcc_en_bits)
39203920
dcc_en_bits[i] = s->dcc_en ? 1 : 0;
39213921
}
39223922
}
3923+
3924+
/**
3925+
* dcn10_reset_surface_dcc_and_tiling - Set DCC and tiling in DCN to their disable mode.
3926+
*
3927+
* @pipe_ctx: Pointer to the pipe context structure.
3928+
* @plane_state: Surface state
3929+
* @clear_tiling: If true set tiling to Linear, otherwise does not change tiling
3930+
*
3931+
* This function is responsible for call the HUBP block to disable DCC and set
3932+
* tiling to the linear mode.
3933+
*/
3934+
void dcn10_reset_surface_dcc_and_tiling(struct pipe_ctx *pipe_ctx,
3935+
struct dc_plane_state *plane_state,
3936+
bool clear_tiling)
3937+
{
3938+
struct hubp *hubp = pipe_ctx->plane_res.hubp;
3939+
3940+
if (!hubp)
3941+
return;
3942+
3943+
/* if framebuffer is tiled, disable tiling */
3944+
if (clear_tiling && hubp->funcs->hubp_clear_tiling)
3945+
hubp->funcs->hubp_clear_tiling(hubp);
3946+
3947+
/* force page flip to see the new content of the framebuffer */
3948+
hubp->funcs->hubp_program_surface_flip_and_addr(hubp,
3949+
&plane_state->address,
3950+
true);
3951+
}

drivers/gpu/drm/amd/display/dc/hwss/dcn10/dcn10_hwseq.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,4 +207,8 @@ void dcn10_update_visual_confirm_color(
207207
struct pipe_ctx *pipe_ctx,
208208
int mpcc_id);
209209

210+
void dcn10_reset_surface_dcc_and_tiling(struct pipe_ctx *pipe_ctx,
211+
struct dc_plane_state *plane_state,
212+
bool clear_tiling);
213+
210214
#endif /* __DC_HWSS_DCN10_H__ */

0 commit comments

Comments
 (0)