summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/display/dc/hwss
diff options
context:
space:
mode:
authorAlvin Lee <alvin.lee2@amd.com>2024-04-26 17:28:46 -0400
committerAlex Deucher <alexander.deucher@amd.com>2024-06-05 11:06:36 -0400
commite69d43356ffdfb968c0c515bd42a8ad9a7399fcb (patch)
tree586c6725e8d7bbfa00fe1061d93016c20fab9ec1 /drivers/gpu/drm/amd/display/dc/hwss
parent4621e10e0158941d44223fd5f7451312473f73da (diff)
downloadlinux-e69d43356ffdfb968c0c515bd42a8ad9a7399fcb.tar.gz
linux-e69d43356ffdfb968c0c515bd42a8ad9a7399fcb.tar.bz2
linux-e69d43356ffdfb968c0c515bd42a8ad9a7399fcb.zip
drm/amd/display: Move fpo_in_use to stream_status
[Description] Refactor code and move fpo_in_use into stream_status to avoid unexpected changes to previous dc_state (i.e., current_state). Since stream pointers are shared between current and new dc_states, updating parameters of one stream will update the other as well which causes unexpected behaviors (i.e., checking that fpo_in_use isn't set in previous state and set in the new state is invalid). To avoid incorrect updates to current_state, move the fpo_in_use flag into dc_stream_status since stream_status is owned by dc and are not shared between different dc_states. Reviewed-by: Samson Tam <samson.tam@amd.com> Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com> Signed-off-by: Alvin Lee <alvin.lee2@amd.com> Tested-by: Daniel Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/display/dc/hwss')
-rw-r--r--drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
index 2626ef8f3292..25c9a407779b 100644
--- a/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
+++ b/drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
@@ -601,9 +601,13 @@ void dcn32_update_force_pstate(struct dc *dc, struct dc_state *context)
for (i = 0; i < dc->res_pool->pipe_count; i++) {
struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
struct hubp *hubp = pipe->plane_res.hubp;
+ struct dc_stream_status *stream_status = NULL;
+
+ if (pipe->stream)
+ stream_status = dc_state_get_stream_status(context, pipe->stream);
if (!pipe->stream || !(dc_state_get_pipe_subvp_type(context, pipe) == SUBVP_MAIN ||
- pipe->stream->fpo_in_use)) {
+ (stream_status && stream_status->fpo_in_use))) {
if (hubp && hubp->funcs->hubp_update_force_pstate_disallow)
hubp->funcs->hubp_update_force_pstate_disallow(hubp, false);
if (hubp && hubp->funcs->hubp_update_force_cursor_pstate_disallow)
@@ -617,6 +621,8 @@ void dcn32_update_force_pstate(struct dc *dc, struct dc_state *context)
struct pipe_ctx *pipe = &context->res_ctx.pipe_ctx[i];
struct pipe_ctx *old_pipe = &dc->current_state->res_ctx.pipe_ctx[i];
struct hubp *hubp = pipe->plane_res.hubp;
+ struct dc_stream_status *stream_status = NULL;
+ struct dc_stream_status *old_stream_status = NULL;
/* Today for MED update type we do not call update clocks. However, for FPO
* the assumption is that update clocks should be called to disable P-State
@@ -630,11 +636,15 @@ void dcn32_update_force_pstate(struct dc *dc, struct dc_state *context)
* time SubVP / FPO was enabled, so there's no need to update / reset it if the
* pipe config has never exited SubVP / FPO.
*/
+ if (pipe->stream)
+ stream_status = dc_state_get_stream_status(context, pipe->stream);
+ if (old_pipe->stream)
+ old_stream_status = dc_state_get_stream_status(dc->current_state, old_pipe->stream);
+
if (pipe->stream && (dc_state_get_pipe_subvp_type(context, pipe) == SUBVP_MAIN ||
- pipe->stream->fpo_in_use) &&
- (!old_pipe->stream ||
- (dc_state_get_pipe_subvp_type(context, old_pipe) != SUBVP_MAIN &&
- !old_pipe->stream->fpo_in_use))) {
+ (stream_status && stream_status->fpo_in_use)) &&
+ (!old_pipe->stream || (dc_state_get_pipe_subvp_type(context, old_pipe) != SUBVP_MAIN &&
+ (old_stream_status && !old_stream_status->fpo_in_use)))) {
if (hubp && hubp->funcs->hubp_update_force_pstate_disallow)
hubp->funcs->hubp_update_force_pstate_disallow(hubp, true);
if (hubp && hubp->funcs->hubp_update_force_cursor_pstate_disallow)