drm/amd/display: Reduce redundant minimal transitions due to SubVP
authorDillon Varone <dillon.varone@amd.com>
Mon, 29 Jul 2024 22:17:55 +0000 (18:17 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 13 Aug 2024 14:44:32 +0000 (10:44 -0400)
[WHY]
Stream ID's associated with phantom pipes can change often as they
are reconstructed on full updates, however they can remain identical
depending on the required update.

[HOW]
In the case phantom streams and pipe topologies remain the same
between updates, mark the transition as seamless.

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Signed-off-by: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Tom Chung <chiahsuan.chung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c

index c3bbbfd1be9412f6675ca835a2583177b70042e4..d75a811c90d9524179596f200064a523820860cc 100644 (file)
@@ -1719,6 +1719,28 @@ void dcn32_blank_phantom(struct dc *dc,
                hws->funcs.wait_for_blank_complete(opp);
 }
 
+/* phantom stream id's can change often, but can be identical between contexts.
+*  This function checks for the condition the streams are identical to avoid
+*  redundant pipe transitions.
+*/
+static bool is_subvp_phantom_topology_transition_seamless(
+       const struct dc_state *cur_ctx,
+       const struct dc_state *new_ctx,
+       const struct pipe_ctx *cur_pipe,
+       const struct pipe_ctx *new_pipe)
+{
+       enum mall_stream_type cur_pipe_type = dc_state_get_pipe_subvp_type(cur_ctx, cur_pipe);
+       enum mall_stream_type new_pipe_type = dc_state_get_pipe_subvp_type(new_ctx, new_pipe);
+
+       const struct dc_stream_state *cur_paired_stream = dc_state_get_paired_subvp_stream(cur_ctx, cur_pipe->stream);
+       const struct dc_stream_state *new_paired_stream = dc_state_get_paired_subvp_stream(new_ctx, new_pipe->stream);
+
+       return cur_pipe_type == SUBVP_PHANTOM &&
+                       cur_pipe_type == new_pipe_type &&
+                       cur_paired_stream && new_paired_stream &&
+                       cur_paired_stream->stream_id == new_paired_stream->stream_id;
+}
+
 bool dcn32_is_pipe_topology_transition_seamless(struct dc *dc,
                const struct dc_state *cur_ctx,
                const struct dc_state *new_ctx)
@@ -1737,7 +1759,8 @@ bool dcn32_is_pipe_topology_transition_seamless(struct dc *dc,
                        continue;
                else if (resource_is_pipe_type(cur_pipe, OTG_MASTER)) {
                        if (resource_is_pipe_type(new_pipe, OTG_MASTER))
-                               if (cur_pipe->stream->stream_id == new_pipe->stream->stream_id)
+                               if (cur_pipe->stream->stream_id == new_pipe->stream->stream_id ||
+                                               is_subvp_phantom_topology_transition_seamless(cur_ctx, new_ctx, cur_pipe, new_pipe))
                                /* OTG master with the same stream is seamless */
                                        continue;
                } else if (resource_is_pipe_type(cur_pipe, OPP_HEAD)) {