Commit 5c69cc55 authored by Jayendran Ramani's avatar Jayendran Ramani Committed by Alex Deucher
Browse files

drm/amd/display: Return last used DRR VTOTAL from DC



[How]
Add call to get the last used VTOTAL from DC

Signed-off-by: default avatarJayendran Ramani <Jayendran.Ramani@amd.com>
Reviewed-by: default avatarAnthony Koo <Anthony.Koo@amd.com>
Acked-by: default avatarStylon Wang <stylon.wang@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 593397a1
Loading
Loading
Loading
Loading
+42 −0
Original line number Diff line number Diff line
@@ -325,6 +325,48 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc,
	return ret;
}

/**
 *****************************************************************************
 *  Function: dc_stream_get_last_vrr_vtotal
 *
 *  @brief
 *     Looks up the pipe context of dc_stream_state and gets the
 *     last VTOTAL used by DRR (Dynamic Refresh Rate)
 *
 *  @param [in] dc: dc reference
 *  @param [in] stream: Initial dc stream state
 *  @param [in] adjust: Updated parameters for vertical_total_min and
 *  vertical_total_max
 *****************************************************************************
 */
bool dc_stream_get_last_used_drr_vtotal(struct dc *dc,
		struct dc_stream_state *stream,
		uint32_t *refresh_rate)
{
	bool status = false;

	int i = 0;

	for (i = 0; i < MAX_PIPES; i++) {
		struct pipe_ctx *pipe = &dc->current_state->res_ctx.pipe_ctx[i];

		if (pipe->stream == stream && pipe->stream_res.tg) {
			/* Only execute if a function pointer has been defined for
			 * the DC version in question
			 */
			if (pipe->stream_res.tg->funcs->get_last_used_drr_vtotal) {
				pipe->stream_res.tg->funcs->get_last_used_drr_vtotal(pipe->stream_res.tg, refresh_rate);

				status = true;

				break;
			}
		}
	}

	return status;
}

bool dc_stream_get_crtc_position(struct dc *dc,
		struct dc_stream_state **streams, int num_streams,
		unsigned int *v_pos, unsigned int *nom_v_pos)
+4 −0
Original line number Diff line number Diff line
@@ -465,6 +465,10 @@ bool dc_stream_adjust_vmin_vmax(struct dc *dc,
				struct dc_stream_state *stream,
				struct dc_crtc_timing_adjust *adjust);

bool dc_stream_get_last_used_drr_vtotal(struct dc *dc,
		struct dc_stream_state *stream,
		uint32_t *refresh_rate);

bool dc_stream_get_crtc_position(struct dc *dc,
				 struct dc_stream_state **stream,
				 int num_streams,
+1 −0
Original line number Diff line number Diff line
@@ -2231,6 +2231,7 @@ static const struct timing_generator_funcs dce110_tg_funcs = {
				dce110_timing_generator_enable_advanced_request,
		.set_drr =
				dce110_timing_generator_set_drr,
		.get_last_used_drr_vtotal = NULL,
		.set_static_screen_control =
			dce110_timing_generator_set_static_screen_control,
		.set_test_pattern = dce110_timing_generator_set_test_pattern,
+1 −0
Original line number Diff line number Diff line
@@ -1190,6 +1190,7 @@ static const struct timing_generator_funcs dce120_tg_funcs = {
		.tear_down_global_swap_lock = dce120_timing_generator_tear_down_global_swap_lock,
		.enable_advanced_request = dce120_timing_generator_enable_advanced_request,
		.set_drr = dce120_timing_generator_set_drr,
		.get_last_used_drr_vtotal = NULL,
		.set_static_screen_control = dce120_timing_generator_set_static_screen_control,
		.set_test_pattern = dce120_timing_generator_set_test_pattern,
		.arm_vert_intr = dce120_arm_vert_intr,
+1 −0
Original line number Diff line number Diff line
@@ -209,6 +209,7 @@ static const struct timing_generator_funcs dce80_tg_funcs = {
		.tear_down_global_swap_lock =
				dce110_timing_generator_tear_down_global_swap_lock,
		.set_drr = dce110_timing_generator_set_drr,
		.get_last_used_drr_vtotal = NULL,
		.set_static_screen_control =
			dce110_timing_generator_set_static_screen_control,
		.set_test_pattern = dce110_timing_generator_set_test_pattern,
Loading