[PATCH v3 11/16] drm/amd/display: Move stereo timing check to helper

Rodrigo Siqueira Rodrigo.Siqueira at amd.com
Wed Oct 4 21:21:05 UTC 2023


From: Taimur Hassan <syed.hassan at amd.com>

Rework dml2_map_dc_pipes to keep the logic clean.

Reviewed-by: Chaitanya Dhere <chaitanya.dhere at amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo at amd.com>
Signed-off-by: Qingqing Zhuo <Qingqing.Zhuo at amd.com>
Signed-off-by: Taimur Hassan <syed.hassan at amd.com>
---
 .../amd/display/dc/dml2/dml2_dc_resource_mgmt.c |  9 +--------
 .../gpu/drm/amd/display/dc/dml2/dml2_utils.c    | 17 +++++++++++++++++
 .../gpu/drm/amd/display/dc/dml2/dml2_utils.h    |  1 +
 3 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c
index 116b78a5107c..e22b5106df8f 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_dc_resource_mgmt.c
@@ -710,14 +710,7 @@ bool dml2_map_dc_pipes(struct dml2_context *ctx, struct dc_state *state, const s
 					scratch.mpc_info.mpc_factor = DPPPerSurface[plane_disp_cfg_index];
 
 					//For stereo timings, we need to pipe split
-					if ((state->streams[stream_index]->view_format ==
-							VIEW_3D_FORMAT_SIDE_BY_SIDE ||
-							state->streams[stream_index]->view_format ==
-							VIEW_3D_FORMAT_TOP_AND_BOTTOM) &&
-							(state->streams[stream_index]->timing.timing_3d_format ==
-							TIMING_3D_FORMAT_TOP_AND_BOTTOM ||
-							state->streams[stream_index]->timing.timing_3d_format ==
-							TIMING_3D_FORMAT_SIDE_BY_SIDE))
+					if (dml2_is_stereo_timing(state->streams[stream_index]))
 						scratch.mpc_info.mpc_factor = 2;
 				} else {
 					// If ODM combine is enabled, then we use at most 1 pipe per
diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c b/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c
index 4c3661fbecbc..ac6bf776bad0 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c
+++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.c
@@ -461,3 +461,20 @@ bool dml2_verify_det_buffer_configuration(struct dml2_context *in_ctx, struct dc
 
 	return need_recalculation;
 }
+
+bool dml2_is_stereo_timing(struct dc_stream_state *stream)
+{
+	bool is_stereo = false;
+
+	if ((stream->view_format ==
+			VIEW_3D_FORMAT_SIDE_BY_SIDE ||
+			stream->view_format ==
+			VIEW_3D_FORMAT_TOP_AND_BOTTOM) &&
+			(stream->timing.timing_3d_format ==
+			TIMING_3D_FORMAT_TOP_AND_BOTTOM ||
+			stream->timing.timing_3d_format ==
+			TIMING_3D_FORMAT_SIDE_BY_SIDE))
+		is_stereo = true;
+
+	return is_stereo;
+}
diff --git a/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.h b/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.h
index 342d64039f9a..23b9028337d4 100644
--- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.h
+++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_utils.h
@@ -42,6 +42,7 @@ void dml2_copy_clocks_to_dc_state(struct dml2_dcn_clocks *out_clks, struct dc_st
 void dml2_extract_watermark_set(struct dcn_watermarks *watermark, struct display_mode_lib_st *dml_core_ctx);
 int dml2_helper_find_dml_pipe_idx_by_stream_id(struct dml2_context *ctx, unsigned int stream_id);
 bool is_dtbclk_required(const struct dc *dc, struct dc_state *context);
+bool dml2_is_stereo_timing(struct dc_stream_state *stream);
 
 /*
  * dml2_dc_construct_pipes - This function will determine if we need additional pipes based
-- 
2.40.1



More information about the amd-gfx mailing list