Skip to contentSkip to conversation

DC Patches for Dec 5, 2016

PATCH In review Harry Wentland 2 participants 14 messages Dec 6, 2016 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover DC Patches for Dec 5, 2016

* larger rework of display_clock code to facilitate sharing between ASIC generations
* some small bug fixes

Dmytro Laktyushkin (10):
drm/amd/display: remove dead display clock code drm/amd/display: restyle display clock calls part 1 drm/amd/display: restyle display clock calls part 2 drm/amd/display: remove store clock state drm/amd/display: remove get_min_clocks_state drm/amd/display: remove clocks_state enum drm/amd/display: consolidate dce8-11.2 display clock code drm/amd/display: add newline to generic_reg_wait timeout message drm/amd/display: fix display clock integrated info read drm/amd/display: create scratch_val_ctx as temp w/a

Wenjing Liu (1):
drm/amd/display: use rgb full range as default quantization for non
HDMI

Yongqiang Sun (1):
drm/amd/display: Add missing GRPH register definition

 drivers/gpu/drm/amd/display/dc/core/dc.c           |    9 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      |   13 +-
 drivers/gpu/drm/amd/display/dc/dc_helper.c         |    2 +-
 drivers/gpu/drm/amd/display/dc/dce/Makefile        |    3 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_audio.c     |    4 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c    |  519 ++++++++++
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.h    |  133 +++
 drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.h |    1 +
 .../drm/amd/display/dc/dce100/dce100_resource.c    |   31 +-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |   65 +-
 .../drm/amd/display/dc/dce110/dce110_resource.c    |   74 +-
 .../drm/amd/display/dc/dce110/dce110_resource.h    |    3 -
 .../drm/amd/display/dc/dce112/dce112_resource.c    |   37 +-
 .../gpu/drm/amd/display/dc/dce80/dce80_resource.c  |   76 +-
 drivers/gpu/drm/amd/display/dc/dm_services_types.h |   18 +-
 drivers/gpu/drm/amd/display/dc/gpu/Makefile        |   17 +-
 .../display/dc/gpu/dce110/display_clock_dce110.c   | 1035 --------------------
 .../display/dc/gpu/dce110/display_clock_dce110.h   |   53 -
 .../display/dc/gpu/dce112/display_clock_dce112.c   |  717 +-------------
 .../display/dc/gpu/dce112/display_clock_dce112.h   |   39 +-
 .../amd/display/dc/gpu/dce80/display_clock_dce80.c |  934 ------------------
 .../amd/display/dc/gpu/dce80/display_clock_dce80.h |   57 --
 drivers/gpu/drm/amd/display/dc/gpu/display_clock.c |  217 ----
 drivers/gpu/drm/amd/display/dc/gpu/display_clock.h |   89 --
 drivers/gpu/drm/amd/display/dc/inc/core_dc.h       |    1 +
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |    2 -
 .../amd/display/include/display_clock_interface.h  |  149 +--
 drivers/gpu/drm/amd/display/modules/color/color.c  |   88 +-
 .../gpu/drm/amd/display/modules/inc/mod_color.h    |   12 +-
 29 files changed, 920 insertions(+), 3478 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.h
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpu/dce110/display_clock_dce110.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpu/dce110/display_clock_dce110.h
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.h
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpu/display_clock.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpu/display_clock.h
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 20161206183538.11584-1-harry.wentland-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/12 drm/amd/display: Add missing GRPH register definition

From: Yongqiang Sun <[email protected]>

Change-Id I532294115c6ef0600256f2971d26e7e7668aea47
---
 drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.h | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.h +1 -0
index a366b3a5b79d..022272d30fe4 100644
@@ -193,6 +193,7 @@ struct dce_mem_input_registers {
 	type GRPH_ARRAY_MODE;\
 	type GRPH_COLOR_EXPANSION_MODE;\
 	type GRPH_SW_MODE; \
+	type GRPH_SE_ENABLE; \
 	type GRPH_NUM_SHADER_ENGINES; \
 	type GRPH_NUM_PIPES; \
 	type PIXEL_DURATION; \
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#3 lore raw

PATCH 2/12 drm/amd/display: remove dead display clock code

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I6484f68e32d4ffef4f17984f956b30b1ef91b874
---
 .../display/dc/gpu/dce110/display_clock_dce110.c   | 468 +-------------------
 .../display/dc/gpu/dce110/display_clock_dce110.h   |   1 -
 .../display/dc/gpu/dce112/display_clock_dce112.c   | 477 +--------------------
 .../display/dc/gpu/dce112/display_clock_dce112.h   |  18 -
 .../amd/display/dc/gpu/dce80/display_clock_dce80.c | 476 +-------------------
 .../amd/display/dc/gpu/dce80/display_clock_dce80.h |   1 -
 drivers/gpu/drm/amd/display/dc/gpu/display_clock.c | 122 ------
 drivers/gpu/drm/amd/display/dc/gpu/display_clock.h |  28 --
 .../amd/display/include/display_clock_interface.h  |  85 ----
 9 files changed, 29 insertions(+), 1647 deletions(-)
drivers/gpu/drm/amd/display/dc/gpu/dce110/display_clock_dce110.c +6 -462
index 1bc39f12b6a1..cc13afa326ad 100644
@@ -268,404 +268,6 @@ static void destroy(struct display_clock **base)
 	*base = NULL;
 }
 
-static uint32_t get_validation_clock(struct display_clock *dc)
-{
-	uint32_t clk = 0;
-	struct display_clock_dce110 *disp_clk = DCLCK110_FROM_BASE(dc);
-
-	switch (disp_clk->max_clks_state) {
-	case CLOCKS_STATE_ULTRA_LOW:
-		/*Currently not supported, it has 0 in table entry*/
-	case CLOCKS_STATE_LOW:
-		clk = max_clks_by_state[CLOCKS_STATE_LOW].
-						display_clk_khz;
-		break;
-
-	case CLOCKS_STATE_NOMINAL:
-		clk = max_clks_by_state[CLOCKS_STATE_NOMINAL].
-						display_clk_khz;
-		break;
-
-	case CLOCKS_STATE_PERFORMANCE:
-		clk = max_clks_by_state[CLOCKS_STATE_PERFORMANCE].
-						display_clk_khz;
-		break;
-
-	case CLOCKS_STATE_INVALID:
-	default:
-		/*Invalid Clocks State*/
-		dm_logger_write(dc->ctx->logger, LOG_WARNING,
-				"Invalid clock state");
-		/* just return the display engine clock for
-		 * lowest supported state*/
-		clk = max_clks_by_state[CLOCKS_STATE_LOW].
-						display_clk_khz;
-		break;
-	}
-	return clk;
-}
-
-static struct fixed32_32 get_deep_color_factor(struct min_clock_params *params)
-{
-	/* DeepColorFactor = IF (HDMI = True, bpp / 24, 1)*/
-	struct fixed32_32 deep_color_factor = dal_fixed32_32_from_int(1);
-
-	if (params->signal_type != SIGNAL_TYPE_HDMI_TYPE_A)
-		return deep_color_factor;
-
-	switch (params->deep_color_depth) {
-	case COLOR_DEPTH_101010:
-		/*deep color ratio for 30bpp is 30/24 = 1.25*/
-		deep_color_factor = dal_fixed32_32_from_fraction(30, 24);
-		break;
-
-	case COLOR_DEPTH_121212:
-		/* deep color ratio for 36bpp is 36/24 = 1.5*/
-		deep_color_factor = dal_fixed32_32_from_fraction(36, 24);
-		break;
-
-	case COLOR_DEPTH_161616:
-		/* deep color ratio for 48bpp is 48/24 = 2.0 */
-		deep_color_factor = dal_fixed32_32_from_fraction(48, 24);
-		break;
-	default:
-		break;
-	}
-	return deep_color_factor;
-}
-
-static struct fixed32_32 get_scaler_efficiency(
-	struct dc_context *ctx,
-	struct min_clock_params *params)
-{
-	struct fixed32_32 scaler_efficiency = dal_fixed32_32_from_int(3);
-
-	if (params->scaler_efficiency == V_SCALER_EFFICIENCY_LB18BPP) {
-		scaler_efficiency =
-			dal_fixed32_32_add(
-				dal_fixed32_32_from_fraction(35555, 10000),
-				dal_fixed32_32_from_fraction(
-					55556,
-					100000 * 10000));
-	} else if (params->scaler_efficiency == V_SCALER_EFFICIENCY_LB24BPP) {
-		scaler_efficiency =
-			dal_fixed32_32_add(
-				dal_fixed32_32_from_fraction(34285, 10000),
-				dal_fixed32_32_from_fraction(
-					71429,
-					100000 * 10000));
-	} else if (params->scaler_efficiency == V_SCALER_EFFICIENCY_LB30BPP)
-		scaler_efficiency = dal_fixed32_32_from_fraction(32, 10);
-
-	return scaler_efficiency;
-}
-
-static struct fixed32_32 get_lb_lines_in_per_line_out(
-		struct min_clock_params *params,
-		struct fixed32_32 v_scale_ratio)
-{
-	struct fixed32_32 two = dal_fixed32_32_from_int(2);
-	struct fixed32_32 four = dal_fixed32_32_from_int(4);
-	struct fixed32_32 f4_to_3 = dal_fixed32_32_from_fraction(4, 3);
-	struct fixed32_32 f6_to_4 = dal_fixed32_32_from_fraction(6, 4);
-
-	if (params->line_buffer_prefetch_enabled)
-		return dal_fixed32_32_max(v_scale_ratio, dal_fixed32_32_one);
-	else if (dal_fixed32_32_le(v_scale_ratio, dal_fixed32_32_one))
-		return dal_fixed32_32_one;
-	else if (dal_fixed32_32_le(v_scale_ratio, f4_to_3))
-		return f4_to_3;
-	else if (dal_fixed32_32_le(v_scale_ratio, f6_to_4))
-		return f6_to_4;
-	else if (dal_fixed32_32_le(v_scale_ratio, two))
-		return two;
-	else if (dal_fixed32_32_le(v_scale_ratio, dal_fixed32_32_from_int(3)))
-		return four;
-	else
-		return dal_fixed32_32_zero;
-}
-
-static uint32_t get_actual_required_display_clk(
-	struct display_clock_dce110 *disp_clk,
-	uint32_t target_clk_khz)
-{
-	uint32_t disp_clk_khz = target_clk_khz;
-	uint32_t div = INVALID_DIVIDER;
-	uint32_t did = INVALID_DID;
-	uint32_t scaled_vco =
-		disp_clk->dentist_vco_freq_khz * DIVIDER_RANGE_SCALE_FACTOR;
-
-	ASSERT_CRITICAL(!!disp_clk_khz);
-
-	if (disp_clk_khz)
-		div = scaled_vco / disp_clk_khz;
-
-	did = dal_divider_range_get_did(divider_ranges, DIVIDER_RANGE_MAX, div);
-
-	if (did != INVALID_DID) {
-		div = dal_divider_range_get_divider(
-			divider_ranges, DIVIDER_RANGE_MAX, did);
-
-		if ((div != INVALID_DIVIDER) &&
-			(did > DIVIDER_RANGE_01_BASE_DIVIDER_ID))
-			if (disp_clk_khz > (scaled_vco / div))
-				div = dal_divider_range_get_divider(
-					divider_ranges, DIVIDER_RANGE_MAX,
-					did - 1);
-
-		if (div != INVALID_DIVIDER)
-			disp_clk_khz = scaled_vco / div;
-
-	}
-	/* We need to add 10KHz to this value because the accuracy in VBIOS is
-	 in 10KHz units. So we need to always round the last digit up in order
-	 to reach the next div level.*/
-	return disp_clk_khz + 10;
-}
-
-static uint32_t calc_single_display_min_clks(
-	struct display_clock *base,
-	struct min_clock_params *params,
-	bool set_clk)
-{
-	struct fixed32_32 h_scale_ratio = dal_fixed32_32_one;
-	struct fixed32_32 v_scale_ratio = dal_fixed32_32_one;
-	uint32_t pix_clk_khz = 0;
-	uint32_t lb_source_width = 0;
-	struct fixed32_32 deep_color_factor;
-	struct fixed32_32 scaler_efficiency;
-	struct fixed32_32 v_filter_init;
-	uint32_t v_filter_init_trunc;
-	uint32_t num_lines_at_frame_start = 3;
-	struct fixed32_32 v_filter_init_ceil;
-	struct fixed32_32 lines_per_lines_out_at_frame_start;
-	struct fixed32_32 lb_lines_in_per_line_out; /* in middle of the frame*/
-	uint32_t src_wdth_rnd_to_chunks;
-	struct fixed32_32 scaling_coeff;
-	struct fixed32_32 h_blank_granularity_factor =
-			dal_fixed32_32_one;
-	struct fixed32_32 fx_disp_clk_mhz;
-	struct fixed32_32 line_time;
-	struct fixed32_32 disp_pipe_pix_throughput;
-	struct fixed32_32 fx_alt_disp_clk_mhz;
-	uint32_t disp_clk_khz;
-	uint32_t alt_disp_clk_khz;
-	struct display_clock_dce110 *disp_clk_110 = DCLCK110_FROM_BASE(base);
-	uint32_t max_clk_khz = get_validation_clock(base);
-	bool panning_allowed = false; /* TODO: receive this value from AS */
-
-	if (params == NULL) {
-		dm_logger_write(base->ctx->logger, LOG_WARNING,
-				"Invalid input parameter in %s",
-				__func__);
-		return 0;
-	}
-
-	deep_color_factor = get_deep_color_factor(params);
-	scaler_efficiency = get_scaler_efficiency(base->ctx, params);
-	pix_clk_khz = params->requested_pixel_clock;
-	lb_source_width = params->source_view.width;
-
-	if (0 != params->dest_view.height && 0 != params->dest_view.width) {
-
-		h_scale_ratio = dal_fixed32_32_from_fraction(
-			params->source_view.width,
-			params->dest_view.width);
-		v_scale_ratio = dal_fixed32_32_from_fraction(
-			params->source_view.height,
-			params->dest_view.height);
-	} else {
-		dm_logger_write(base->ctx->logger, LOG_WARNING,
-				"Destination height or width is 0!\n");
-	}
-
-	v_filter_init =
-		dal_fixed32_32_add(
-			v_scale_ratio,
-			dal_fixed32_32_add_int(
-				dal_fixed32_32_div_int(
-					dal_fixed32_32_mul_int(
-						v_scale_ratio,
-						params->timing_info.INTERLACED),
-					2),
-				params->scaling_info.v_taps + 1));
-	v_filter_init = dal_fixed32_32_div_int(v_filter_init, 2);
-
-	v_filter_init_trunc = dal_fixed32_32_floor(v_filter_init);
-
-	v_filter_init_ceil = dal_fixed32_32_from_fraction(
-						v_filter_init_trunc, 2);
-	v_filter_init_ceil = dal_fixed32_32_from_int(
-		dal_fixed32_32_ceil(v_filter_init_ceil));
-	v_filter_init_ceil = dal_fixed32_32_mul_int(v_filter_init_ceil, 2);
-
-	lines_per_lines_out_at_frame_start =
-			dal_fixed32_32_div_int(v_filter_init_ceil,
-					num_lines_at_frame_start);
-	lb_lines_in_per_line_out =
-			get_lb_lines_in_per_line_out(params, v_scale_ratio);
-
-	if (panning_allowed)
-		src_wdth_rnd_to_chunks =
-			((lb_source_width - 1) / 128) * 128 + 256;
-	else
-		src_wdth_rnd_to_chunks =
-			((lb_source_width + 127) / 128) * 128;
-
-	scaling_coeff =
-		dal_fixed32_32_div(
-			dal_fixed32_32_from_int(params->scaling_info.v_taps),
-			scaler_efficiency);
-
-	if (dal_fixed32_32_le(h_scale_ratio, dal_fixed32_32_one))
-		scaling_coeff = dal_fixed32_32_max(
-			dal_fixed32_32_from_int(
-				dal_fixed32_32_ceil(
-					dal_fixed32_32_from_fraction(
-						params->scaling_info.h_taps,
-						4))),
-			dal_fixed32_32_max(
-				dal_fixed32_32_mul(
-					scaling_coeff,
-					h_scale_ratio),
-				dal_fixed32_32_one));
-
-	if (!params->line_buffer_prefetch_enabled &&
-		dal_fixed32_32_floor(lb_lines_in_per_line_out) != 2 &&
-		dal_fixed32_32_floor(lb_lines_in_per_line_out) != 4) {
-		uint32_t line_total_pixel =
-			params->timing_info.h_total + lb_source_width - 256;
-		h_blank_granularity_factor = dal_fixed32_32_div(
-			dal_fixed32_32_from_int(params->timing_info.h_total),
-			dal_fixed32_32_div(
-			dal_fixed32_32_from_fraction(
-				line_total_pixel, 2),
-				h_scale_ratio));
-	}
-
-	/* Calculate display clock with ramping. Ramping factor is 1.1*/
-	fx_disp_clk_mhz =
-		dal_fixed32_32_div_int(
-			dal_fixed32_32_mul_int(scaling_coeff, 11),
-			10);
-	line_time = dal_fixed32_32_from_fraction(
-			params->timing_info.h_total * 1000, pix_clk_khz);
-
-	disp_pipe_pix_throughput = dal_fixed32_32_mul(
-			lb_lines_in_per_line_out, h_blank_granularity_factor);
-	disp_pipe_pix_throughput = dal_fixed32_32_max(
-			disp_pipe_pix_throughput,
-			lines_per_lines_out_at_frame_start);
-	disp_pipe_pix_throughput = dal_fixed32_32_div(dal_fixed32_32_mul_int(
-			disp_pipe_pix_throughput, src_wdth_rnd_to_chunks),
-			line_time);
-
-	if (0 != params->timing_info.h_total) {
-		fx_disp_clk_mhz =
-			dal_fixed32_32_max(
-				dal_fixed32_32_div_int(
-					dal_fixed32_32_mul_int(
-						scaling_coeff, pix_clk_khz),
-						1000),
-				disp_pipe_pix_throughput);
-		fx_disp_clk_mhz =
-			dal_fixed32_32_mul(
-				fx_disp_clk_mhz,
-				dal_fixed32_32_from_fraction(11, 10));
-	}
-
-	fx_disp_clk_mhz = dal_fixed32_32_max(fx_disp_clk_mhz,
-		dal_fixed32_32_mul(deep_color_factor,
-		dal_fixed32_32_from_fraction(11, 10)));
-
-	/* Calculate display clock without ramping */
-	fx_alt_disp_clk_mhz = scaling_coeff;
-
-	if (0 != params->timing_info.h_total) {
-		fx_alt_disp_clk_mhz = dal_fixed32_32_max(
-				dal_fixed32_32_div_int(dal_fixed32_32_mul_int(
-						scaling_coeff, pix_clk_khz),
-						1000),
-				dal_fixed32_32_div_int(dal_fixed32_32_mul_int(
-						disp_pipe_pix_throughput, 105),
-						100));
-	}
-
-	if (set_clk && disp_clk_110->ss_on_gpu_pll &&
-			disp_clk_110->gpu_pll_ss_divider)
-		fx_alt_disp_clk_mhz = dal_fixed32_32_mul(fx_alt_disp_clk_mhz,
-				dal_fixed32_32_add_int(
-				dal_fixed32_32_div_int(
-				dal_fixed32_32_div_int(
-				dal_fixed32_32_from_fraction(
-				disp_clk_110->gpu_pll_ss_percentage,
-				disp_clk_110->gpu_pll_ss_divider), 100),
-				2),
-				1));
-
-	/* convert to integer */
-	disp_clk_khz = dal_fixed32_32_round(
-			dal_fixed32_32_mul_int(fx_disp_clk_mhz, 1000));
-	alt_disp_clk_khz = dal_fixed32_32_round(
-			dal_fixed32_32_mul_int(fx_alt_disp_clk_mhz, 1000));
-
-	if ((disp_clk_khz > max_clk_khz) && (alt_disp_clk_khz <= max_clk_khz))
-		disp_clk_khz = alt_disp_clk_khz;
-
-	if (set_clk) { /* only compensate clock if we are going to set it.*/
-		disp_clk_khz = get_actual_required_display_clk(
-			disp_clk_110, disp_clk_khz);
-	}
-
-	disp_clk_khz = disp_clk_khz > max_clk_khz ? max_clk_khz : disp_clk_khz;
-
-	return disp_clk_khz;
-}
-
-static uint32_t calculate_min_clock(
-	struct display_clock *base,
-	uint32_t path_num,
-	struct min_clock_params *params)
-{
-	uint32_t i;
-	uint32_t validation_clk_khz =
-			get_validation_clock(base);
-	uint32_t min_clk_khz = validation_clk_khz;
-	uint32_t max_clk_khz = 0;
-	struct display_clock_dce110 *dc = DCLCK110_FROM_BASE(base);
-
-	if (dc->use_max_disp_clk)
-		return min_clk_khz;
-
-	if (params != NULL) {
-		uint32_t disp_clk_khz = 0;
-
-		for (i = 0; i < path_num; ++i) {
-
-			disp_clk_khz = calc_single_display_min_clks(
-							base, params, true);
-
-			/* update the max required clock found*/
-			if (disp_clk_khz > max_clk_khz)
-				max_clk_khz = disp_clk_khz;
-
-			params++;
-		}
-	}
-
-	min_clk_khz = max_clk_khz;
-
-	if (min_clk_khz > validation_clk_khz)
-		min_clk_khz = validation_clk_khz;
-	else if (min_clk_khz < base->min_display_clk_threshold_khz)
-		min_clk_khz = base->min_display_clk_threshold_khz;
-
-	if (dc->use_max_disp_clk)
-		min_clk_khz = get_validation_clock(base);
-
-	return min_clk_khz;
-}
-
 static bool display_clock_integrated_info_construct(
 	struct display_clock_dce110 *disp_clk)
 {
@@ -741,38 +343,6 @@ static bool display_clock_integrated_info_construct(
 	return true;
 }
 
-static uint32_t get_clock(struct display_clock *dc)
-{
-	uint32_t disp_clock = get_validation_clock(dc);
-	uint32_t target_div = INVALID_DIVIDER;
-	uint32_t addr = mmDENTIST_DISPCLK_CNTL;
-	uint32_t value = 0;
-	uint32_t field = 0;
-	struct display_clock_dce110 *disp_clk = DCLCK110_FROM_BASE(dc);
-
-	if (disp_clk->dfs_bypass_enabled && disp_clk->dfs_bypass_disp_clk)
-		return disp_clk->dfs_bypass_disp_clk;
-
-	/* Read the mmDENTIST_DISPCLK_CNTL to get the currently programmed
-	 DID DENTIST_DISPCLK_WDIVIDER.*/
-	value = dm_read_reg(dc->ctx, addr);
-	field = get_reg_field_value(
-			value, DENTIST_DISPCLK_CNTL, DENTIST_DISPCLK_WDIVIDER);
-
-	/* Convert DENTIST_DISPCLK_WDIVIDER to actual divider*/
-	target_div = dal_divider_range_get_divider(
-		divider_ranges,
-		DIVIDER_RANGE_MAX,
-		field);
-
-	if (target_div != INVALID_DIVIDER)
-		/* Calculate the current DFS clock in KHz.
-		 Should be okay up to 42.9 THz before overflowing.*/
-		disp_clock = (DIVIDER_RANGE_SCALE_FACTOR
-			* disp_clk->dentist_vco_freq_khz) / target_div;
-	return disp_clock;
-}
-
 static enum clocks_state get_required_clocks_state(
 		struct display_clock *dc,
 		struct state_dependent_clocks *req_clocks)
@@ -882,44 +452,15 @@ static void set_clock(
 	psr_wait_loop(base->ctx, requested_clk_khz);
 }
 
-static void set_clock_state(
-	struct display_clock *dc,
-	struct display_clock_state clk_state)
-{
-	struct display_clock_dce110 *disp_clk = DCLCK110_FROM_BASE(dc);
-
-	disp_clk->clock_state = clk_state;
-}
-
-static struct display_clock_state get_clock_state(
-	struct display_clock *dc)
-{
-	struct display_clock_dce110 *disp_clk = DCLCK110_FROM_BASE(dc);
-
-	return disp_clk->clock_state;
-}
-
-static uint32_t get_dfs_bypass_threshold(struct display_clock *dc)
-{
-	return DCE110_DFS_BYPASS_THRESHOLD_KHZ;
-}
 
 static const struct display_clock_funcs funcs = {
 	.destroy = destroy,
-	.calculate_min_clock = calculate_min_clock,
-	.get_clock = get_clock,
-	.get_clock_state = get_clock_state,
-	.get_dfs_bypass_threshold = get_dfs_bypass_threshold,
 	.get_dp_ref_clk_frequency = get_dp_ref_clk_frequency,
 	.get_min_clocks_state = get_min_clocks_state,
 	.get_required_clocks_state = get_required_clocks_state,
-	.get_validation_clock = get_validation_clock,
 	.set_clock = set_clock,
-	.set_clock_state = set_clock_state,
-	.set_dp_ref_clock_source = NULL,
 	.set_min_clocks_state = set_min_clocks_state,
-	.store_max_clocks_state = store_max_clocks_state,
-	.validate = NULL,
+	.store_max_clocks_state = store_max_clocks_state
 };
 
 static bool dal_display_clock_dce110_construct(
@@ -929,8 +470,11 @@ static bool dal_display_clock_dce110_construct(
 	struct display_clock *dc_base = &dc110->disp_clk_base;
 	struct dc_bios *bp = ctx->dc_bios;
 
-	if (!dal_display_clock_construct_base(dc_base, ctx))
-		return false;
+	dc_base->ctx = ctx;
+	dc_base->id = CLOCK_SOURCE_ID_DCPLL;
+	dc_base->min_display_clk_threshold_khz = 0;
+
+	dc_base->cur_min_clks_state = CLOCKS_STATE_INVALID;
 
 	dc_base->funcs = &funcs;
 
drivers/gpu/drm/amd/display/dc/gpu/dce110/display_clock_dce110.h +0 -1
index 0cdc7b52a09f..88b4bdd75e56 100644
@@ -44,7 +44,6 @@ struct display_clock_dce110 {
 	/* Cache the display clock returned by VBIOS if DFS-bypass is enabled.
 	 * This is basically "Crystal Frequency In KHz" (XTALIN) frequency */
 	uint32_t dfs_bypass_disp_clk;
-	struct display_clock_state clock_state;
 };
 
 #define DCLCK110_FROM_BASE(dc_base) \
drivers/gpu/drm/amd/display/dc/gpu/dce112/display_clock_dce112.c +5 -472

522 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/dce112/display_clock_dce112.h +0 -18
index 937e17929b7c..5ab31185d29d 100644
@@ -45,7 +45,6 @@ struct display_clock_dce112 {
 	/* Cache the display clock returned by VBIOS if DFS-bypass is enabled.
 	 * This is basically "Crystal Frequency In KHz" (XTALIN) frequency */
 	uint32_t dfs_bypass_disp_clk;
-	struct display_clock_state clock_state;
 	struct state_dependent_clocks *max_clks_by_state;
 
 };
@@ -75,17 +74,6 @@ bool dal_display_clock_dce112_construct(
 
 void dispclk_dce112_destroy(struct display_clock **base);
 
-uint32_t dispclk_dce112_calculate_min_clock(
-	struct display_clock *base,
-	uint32_t path_num,
-	struct min_clock_params *params);
-
-struct display_clock_state dispclk_dce112_get_clock_state(
-	struct display_clock *dc);
-
-uint32_t dispclk_dce112_get_dfs_bypass_threshold(
-	struct display_clock *dc);
-
 enum clocks_state dispclk_dce112_get_min_clocks_state(
 	struct display_clock *base);
 
@@ -93,16 +81,10 @@ enum clocks_state dispclk_dce112_get_required_clocks_state(
 	struct display_clock *dc,
 	struct state_dependent_clocks *req_clocks);
 
-uint32_t dispclk_dce112_get_validation_clock(struct display_clock *dc);
-
 void dispclk_dce112_set_clock(
 	struct display_clock *base,
 	uint32_t requested_clk_khz);
 
-void dispclk_dce112_set_clock_state(
-	struct display_clock *dc,
-	struct display_clock_state clk_state);
-
 bool dispclk_dce112_set_min_clocks_state(
 	struct display_clock *base,
 	enum clocks_state clocks_state);
drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.c +18 -458

516 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.h +0 -1
index 944dd0380413..c675f1e30870 100644
@@ -48,7 +48,6 @@ struct display_clock_dce80 {
 	 * This is basically "Crystal Frequency In KHz" (XTALIN) frequency */
 	uint32_t dfs_bypass_disp_clk;
 	bool use_max_disp_clk;
-	struct display_clock_state clock_state;
 };
 
 struct display_clock *dal_display_clock_dce80_create(
drivers/gpu/drm/amd/display/dc/gpu/display_clock.c +0 -122

149 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/display_clock.h +0 -28
index 663580d18a09..4db8442e717a 100644
@@ -30,14 +30,8 @@
 
 struct display_clock_funcs {
 	void (*destroy)(struct display_clock **to_destroy);
-	bool (*validate)(struct display_clock *disp_clk,
-		struct min_clock_params *params);
-	uint32_t (*calculate_min_clock)(struct display_clock *disp_clk,
-		uint32_t path_num, struct min_clock_params *params);
-	uint32_t (*get_validation_clock)(struct display_clock *disp_clk);
 	void (*set_clock)(struct display_clock *disp_clk,
 		uint32_t requested_clock_khz);
-	uint32_t (*get_clock)(struct display_clock *disp_clk);
 	enum clocks_state (*get_min_clocks_state)(
 		struct display_clock *disp_clk);
 	enum clocks_state (*get_required_clocks_state)(
@@ -46,15 +40,8 @@ struct display_clock_funcs {
 	bool (*set_min_clocks_state)(struct display_clock *disp_clk,
 		enum clocks_state clocks_state);
 	uint32_t (*get_dp_ref_clk_frequency)(struct display_clock *disp_clk);
-	void (*set_dp_ref_clock_source)(struct display_clock *disp_clk,
-		enum clock_source_id clk_src);
 	void (*store_max_clocks_state)(struct display_clock *disp_clk,
 		enum clocks_state max_clocks_state);
-	void (*set_clock_state)(struct display_clock *disp_clk,
-		struct display_clock_state clk_state);
-	struct display_clock_state (*get_clock_state)(
-		struct display_clock *disp_clk);
-	uint32_t (*get_dfs_bypass_threshold)(struct display_clock *disp_clk);
 
 };
 
@@ -66,21 +53,6 @@ struct display_clock {
 
 	enum clocks_state cur_min_clks_state;
 };
-void dal_display_clock_base_set_dp_ref_clock_source(
-	struct display_clock *disp_clk,
-	enum clock_source_id clk_src);
-struct display_clock_state dal_display_clock_base_get_clock_state(
-	struct display_clock *disp_clk);
-uint32_t dal_display_clock_base_get_dfs_bypass_threshold(
-	struct display_clock *disp_clk);
-void dal_display_clock_base_set_clock_state(struct display_clock *disp_clk,
-	struct display_clock_state clk_state);
-bool dal_display_clock_construct_base(
-	struct display_clock *base,
-	struct dc_context *ctx);
-
-uint32_t dal_display_clock_get_validation_clock(struct display_clock *disp_clk);
-
 void dal_display_clock_store_max_clocks_state(
 	struct display_clock *disp_clk,
 	enum clocks_state max_clocks_state);
drivers/gpu/drm/amd/display/include/display_clock_interface.h +0 -85

114 lines not on this page · raw message

Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#4 lore raw

PATCH 3/12 drm/amd/display: restyle display clock calls part 1

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I3e65c94ea4c59ba7bc802995ad2210eeffc552e3
---
 drivers/gpu/drm/amd/display/dc/core/dc.c           |  4 +-
 .../drm/amd/display/dc/dce100/dce100_resource.c    |  2 +-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 48 ++++------------------
 .../drm/amd/display/dc/dce110/dce110_resource.c    |  2 +-
 .../drm/amd/display/dc/dce112/dce112_resource.c    |  2 +-
 .../gpu/drm/amd/display/dc/dce80/dce80_resource.c  |  2 +-
 .../display/dc/gpu/dce112/display_clock_dce112.c   |  1 -
 .../display/dc/gpu/dce112/display_clock_dce112.h   |  1 -
 drivers/gpu/drm/amd/display/dc/gpu/display_clock.c | 20 ---------
 drivers/gpu/drm/amd/display/dc/gpu/display_clock.h | 30 --------------
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |  2 -
 .../amd/display/include/display_clock_interface.h  | 35 ++++++++++++----
 12 files changed, 42 insertions(+), 107 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +3 -1
index 424a7d4b8731..70dc70685471 100644
@@ -1224,7 +1224,9 @@ bool dc_pre_update_surfaces_to_target(
 	if (prev_disp_clk < context->bw_results.dispclk_khz) {
 		pplib_apply_display_requirements(core_dc, context,
 						&context->pp_display_cfg);
-		core_dc->hwss.set_display_clock(context);
+		context->res_ctx.pool->display_clock->funcs->set_clock(
+				context->res_ctx.pool->display_clock,
+				context->bw_results.dispclk_khz * 115 / 100);
 		core_dc->current_context->bw_results.dispclk_khz =
 				context->bw_results.dispclk_khz;
 	}
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +1 -1
index 9ace6d1cca79..8f18a9403525 100644
@@ -984,7 +984,7 @@ static bool construct(
 			dce110_resource_convert_clock_state_pp_to_dc(
 					static_clk_info.max_clocks_state);
 
-		dal_display_clock_store_max_clocks_state(
+		pool->base.display_clock->funcs->store_max_clocks_state(
 				pool->base.display_clock, max_clocks_state);
 	}
 	{
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +9 -39

78 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +1 -1
index cac3dc425039..a63112b2bd36 100644
@@ -1315,7 +1315,7 @@ static bool construct(
 			dce110_resource_convert_clock_state_pp_to_dc(
 					static_clk_info.max_clocks_state);
 
-		dal_display_clock_store_max_clocks_state(
+		pool->base.display_clock->funcs->store_max_clocks_state(
 				pool->base.display_clock, max_clocks_state);
 	}
 
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +1 -1
index 4e3273c0fa91..70616019ae47 100644
@@ -1315,7 +1315,7 @@ static bool construct(
 			dce110_resource_convert_clock_state_pp_to_dc(
 					static_clk_info.max_clocks_state);
 
-		dal_display_clock_store_max_clocks_state(
+		pool->base.display_clock->funcs->store_max_clocks_state(
 				pool->base.display_clock, max_clocks_state);
 	}
 
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +1 -1
index 3b626b7883d4..dfff2bfff13d 100644
@@ -978,7 +978,7 @@ static bool construct(
 				dce80_resource_convert_clock_state_pp_to_dc(
 					static_clk_info.max_clocks_state);
 
-		dal_display_clock_store_max_clocks_state(
+		pool->base.display_clock->funcs->store_max_clocks_state(
 				pool->base.display_clock, max_clocks_state);
 	}
 
drivers/gpu/drm/amd/display/dc/gpu/dce112/display_clock_dce112.c +0 -1
index bf044260c0bb..665832b0718a 100644
@@ -383,7 +383,6 @@ bool dal_display_clock_dce112_construct(
 	struct display_clock *dc_base = &dc112->disp_clk_base;
 
 	dc_base->ctx = ctx;
-	dc_base->id = CLOCK_SOURCE_ID_DCPLL;
 	dc_base->min_display_clk_threshold_khz = 0;
 
 	dc_base->cur_min_clks_state = CLOCKS_STATE_INVALID;
drivers/gpu/drm/amd/display/dc/gpu/dce112/display_clock_dce112.h +0 -1
index 5ab31185d29d..47a149709d91 100644
@@ -32,7 +32,6 @@ struct display_clock_dce112 {
 	/* Max display block clocks state*/
 	enum clocks_state max_clks_state;
 	bool use_max_disp_clk;
-	uint32_t crystal_freq_khz;
 	uint32_t dentist_vco_freq_khz;
 	/* Cache the status of DFS-bypass feature*/
 	bool dfs_bypass_enabled;
drivers/gpu/drm/amd/display/dc/gpu/display_clock.c +0 -20
index 73d982732a67..c70c6b25892e 100644
@@ -38,13 +38,6 @@ void dal_display_clock_destroy(struct display_clock **disp_clk)
 	*disp_clk = NULL;
 }
 
-void dal_display_clock_set_clock(
-	struct display_clock *disp_clk,
-	uint32_t requested_clock_khz)
-{
-	disp_clk->funcs->set_clock(disp_clk, requested_clock_khz);
-}
-
 bool dal_display_clock_get_min_clocks_state(
 	struct display_clock *disp_clk,
 	enum clocks_state *clocks_state)
@@ -80,16 +73,3 @@ bool dal_display_clock_set_min_clocks_state(
 	return true;
 }
 
-uint32_t dal_display_clock_get_dp_ref_clk_frequency(
-	struct display_clock *disp_clk)
-{
-	return disp_clk->funcs->get_dp_ref_clk_frequency(disp_clk);
-}
-
-void dal_display_clock_store_max_clocks_state(
-	struct display_clock *disp_clk,
-	enum clocks_state max_clocks_state)
-{
-	disp_clk->funcs->store_max_clocks_state(disp_clk, max_clocks_state);
-}
-
drivers/gpu/drm/amd/display/dc/gpu/display_clock.h +0 -30
index 4db8442e717a..68d2ab0500a6 100644
@@ -28,34 +28,4 @@
 
 #include "include/display_clock_interface.h"
 
-struct display_clock_funcs {
-	void (*destroy)(struct display_clock **to_destroy);
-	void (*set_clock)(struct display_clock *disp_clk,
-		uint32_t requested_clock_khz);
-	enum clocks_state (*get_min_clocks_state)(
-		struct display_clock *disp_clk);
-	enum clocks_state (*get_required_clocks_state)(
-		struct display_clock *disp_clk,
-		struct state_dependent_clocks *req_clocks);
-	bool (*set_min_clocks_state)(struct display_clock *disp_clk,
-		enum clocks_state clocks_state);
-	uint32_t (*get_dp_ref_clk_frequency)(struct display_clock *disp_clk);
-	void (*store_max_clocks_state)(struct display_clock *disp_clk,
-		enum clocks_state max_clocks_state);
-
-};
-
-struct display_clock {
-	struct dc_context *ctx;
-	const struct display_clock_funcs *funcs;
-	uint32_t min_display_clk_threshold_khz;
-	enum clock_source_id id;
-
-	enum clocks_state cur_min_clks_state;
-};
-void dal_display_clock_store_max_clocks_state(
-	struct display_clock *disp_clk,
-	enum clocks_state max_clocks_state);
-
-
 #endif /* __DAL_DISPLAY_CLOCK_H__*/
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +0 -2
index 35a556dd9054..50d499cc01a4 100644
@@ -132,8 +132,6 @@ struct hw_sequencer_funcs {
 			struct pipe_ctx *pipe_ctx,
 			struct validate_context *context);
 
-	void (*set_display_clock)(struct validate_context *context);
-
 	void (*set_bandwidth)(struct core_dc *dc);
 
 	void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes,
drivers/gpu/drm/amd/display/include/display_clock_interface.h +26 -9
index ef519a284e0f..f49253714b1e 100644
@@ -56,7 +56,31 @@ struct state_dependent_clocks {
 	uint32_t pixel_clk_khz;
 };
 
-struct display_clock;
+struct display_clock {
+	struct dc_context *ctx;
+	const struct display_clock_funcs *funcs;
+	uint32_t min_display_clk_threshold_khz;
+	enum clock_source_id id;
+
+	enum clocks_state cur_min_clks_state;
+};
+
+struct display_clock_funcs {
+	void (*destroy)(struct display_clock **to_destroy);
+	void (*set_clock)(struct display_clock *disp_clk,
+		uint32_t requested_clock_khz);
+	enum clocks_state (*get_min_clocks_state)(
+		struct display_clock *disp_clk);
+	enum clocks_state (*get_required_clocks_state)(
+		struct display_clock *disp_clk,
+		struct state_dependent_clocks *req_clocks);
+	bool (*set_min_clocks_state)(struct display_clock *disp_clk,
+		enum clocks_state clocks_state);
+	uint32_t (*get_dp_ref_clk_frequency)(struct display_clock *disp_clk);
+	void (*store_max_clocks_state)(struct display_clock *disp_clk,
+		enum clocks_state max_clocks_state);
+
+};
 
 struct display_clock *dal_display_clock_dce112_create(
 	struct dc_context *ctx);
@@ -68,9 +92,7 @@ struct display_clock *dal_display_clock_dce80_create(
 	struct dc_context *ctx);
 
 void dal_display_clock_destroy(struct display_clock **to_destroy);
-void dal_display_clock_set_clock(
-	struct display_clock *disp_clk,
-	uint32_t requested_clock_khz);
+
 bool dal_display_clock_get_min_clocks_state(
 	struct display_clock *disp_clk,
 	enum clocks_state *clocks_state);
@@ -81,10 +103,5 @@ bool dal_display_clock_get_required_clocks_state(
 bool dal_display_clock_set_min_clocks_state(
 	struct display_clock *disp_clk,
 	enum clocks_state clocks_state);
-uint32_t dal_display_clock_get_dp_ref_clk_frequency(
-	struct display_clock *disp_clk);
-void dal_display_clock_store_max_clocks_state(
-	struct display_clock *disp_clk,
-	enum clocks_state max_clocks_state);
 
 #endif /* __DISPLAY_CLOCK_INTERFACE_H__ */
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#5 lore raw

PATCH 4/12 drm/amd/display: restyle display clock calls part 2

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I04b1cb799d049abea320b50eff14790772a5565d
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      | 11 ++--
 .../drm/amd/display/dc/dce100/dce100_resource.c    |  4 +-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 13 ++--
 .../drm/amd/display/dc/dce110/dce110_resource.c    |  4 +-
 .../drm/amd/display/dc/dce112/dce112_resource.c    |  4 +-
 .../gpu/drm/amd/display/dc/dce80/dce80_resource.c  |  4 +-
 drivers/gpu/drm/amd/display/dc/gpu/Makefile        |  2 +-
 .../display/dc/gpu/dce110/display_clock_dce110.h   |  2 +-
 .../display/dc/gpu/dce112/display_clock_dce112.h   |  2 +-
 .../amd/display/dc/gpu/dce80/display_clock_dce80.h |  2 +-
 drivers/gpu/drm/amd/display/dc/gpu/display_clock.c | 75 ----------------------
 drivers/gpu/drm/amd/display/dc/gpu/display_clock.h | 31 ---------
 .../amd/display/include/display_clock_interface.h  | 11 ----
 13 files changed, 30 insertions(+), 135 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpu/display_clock.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpu/display_clock.h
drivers/gpu/drm/amd/display/dc/core/dc_link.c +6 -5
index 70a25546de1e..ab4efde2d030 100644
@@ -1223,12 +1223,13 @@ static enum dc_status enable_link_dp(struct pipe_ctx *pipe_ctx)
 	if (link_settings.link_rate == max_link_rate) {
 		cur_min_clock_state = CLOCKS_STATE_INVALID;
 
-		if (dal_display_clock_get_min_clocks_state(
-				pipe_ctx->dis_clk, &cur_min_clock_state)) {
+		if (pipe_ctx->dis_clk->funcs->get_min_clocks_state) {
+			cur_min_clock_state =
+				pipe_ctx->dis_clk->funcs->get_min_clocks_state(
+							pipe_ctx->dis_clk);
 			if (cur_min_clock_state < CLOCKS_STATE_NOMINAL)
-				dal_display_clock_set_min_clocks_state(
-						pipe_ctx->dis_clk,
-						CLOCKS_STATE_NOMINAL);
+				pipe_ctx->dis_clk->funcs->set_min_clocks_state(
+					pipe_ctx->dis_clk, CLOCKS_STATE_NOMINAL);
 		} else {
 		}
 	}
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +3 -1
index 8f18a9403525..fa88eb163ab8 100644
@@ -717,7 +717,9 @@ static void destruct(struct dce110_resource_pool *pool)
 	}
 
 	if (pool->base.display_clock != NULL)
-		dal_display_clock_destroy(&pool->base.display_clock);
+		pool->base.display_clock->funcs->destroy(
+				&pool->base.display_clock);
+		pool->base.display_clock = NULL;
 
 	if (pool->base.irqs != NULL)
 		dal_irq_service_destroy(&pool->base.irqs);
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +8 -5
index 16ee49dba97b..ca71509af74d 100644
@@ -1099,9 +1099,11 @@ static void apply_min_clocks(
 
 	if (!pre_mode_set) {
 		/* set clock_state without verification */
-		if (dal_display_clock_set_min_clocks_state(
-				pipe_ctx->dis_clk, *clocks_state))
+		if (pipe_ctx->dis_clk->funcs->set_min_clocks_state) {
+			pipe_ctx->dis_clk->funcs->set_min_clocks_state(
+						pipe_ctx->dis_clk, *clocks_state);
 			return;
+		}
 
 		/* TODOFPGA */
 	}
@@ -1114,9 +1116,10 @@ static void apply_min_clocks(
 	req_clocks.pixel_clk_khz = get_max_pixel_clock_for_all_paths(
 			dc, context, true);
 
-	if (dal_display_clock_get_required_clocks_state(
-				pipe_ctx->dis_clk, &req_clocks, clocks_state)) {
-		dal_display_clock_set_min_clocks_state(
+	if (pipe_ctx->dis_clk->funcs->get_required_clocks_state) {
+		*clocks_state = pipe_ctx->dis_clk->funcs->get_required_clocks_state(
+				pipe_ctx->dis_clk, &req_clocks);
+		pipe_ctx->dis_clk->funcs->set_min_clocks_state(
 			pipe_ctx->dis_clk, *clocks_state);
 	} else {
 	}
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +3 -1
index a63112b2bd36..6c713396e6ba 100644
@@ -700,7 +700,9 @@ static void destruct(struct dce110_resource_pool *pool)
 	}
 
 	if (pool->base.display_clock != NULL) {
-		dal_display_clock_destroy(&pool->base.display_clock);
+		pool->base.display_clock->funcs->destroy(
+				&pool->base.display_clock);
+		pool->base.display_clock = NULL;
 	}
 
 	if (pool->base.irqs != NULL) {
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +3 -1
index 70616019ae47..8792c4ed6e65 100644
@@ -734,7 +734,9 @@ static void destruct(struct dce110_resource_pool *pool)
 	}
 
 	if (pool->base.display_clock != NULL) {
-		dal_display_clock_destroy(&pool->base.display_clock);
+		pool->base.display_clock->funcs->destroy(
+				&pool->base.display_clock);
+		pool->base.display_clock = NULL;
 	}
 
 	if (pool->base.irqs != NULL) {
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +3 -1
index dfff2bfff13d..1e829f805d42 100644
@@ -657,7 +657,9 @@ static void destruct(struct dce110_resource_pool *pool)
 	}
 
 	if (pool->base.display_clock != NULL) {
-		dal_display_clock_destroy(&pool->base.display_clock);
+		pool->base.display_clock->funcs->destroy(
+				&pool->base.display_clock);
+		pool->base.display_clock = NULL;
 	}
 
 	if (pool->base.irqs != NULL) {
drivers/gpu/drm/amd/display/dc/gpu/Makefile +1 -1
index fd17af1ce88e..0b99a7474950 100644
@@ -3,7 +3,7 @@
 # It provides the control and status of HW adapter resources,
 # that are global for the ASIC and sharable between pipes.
 
-GPU = display_clock.o divider_range.o
+GPU = divider_range.o
 
 AMD_DAL_GPU = $(addprefix $(AMDDALPATH)/dc/gpu/,$(GPU))
 
drivers/gpu/drm/amd/display/dc/gpu/dce110/display_clock_dce110.h +1 -1
index 88b4bdd75e56..703cd656b5b0 100644
@@ -25,7 +25,7 @@
 #ifndef __DAL_DISPLAY_CLOCK_DCE110_H__
 #define __DAL_DISPLAY_CLOCK_DCE110_H__
 
-#include "gpu/display_clock.h"
+#include "display_clock_interface.h"
 
 struct display_clock_dce110 {
 	struct display_clock disp_clk_base;
drivers/gpu/drm/amd/display/dc/gpu/dce112/display_clock_dce112.h +1 -1
index 47a149709d91..34afff9a00bc 100644
@@ -25,7 +25,7 @@
 #ifndef __DAL_DISPLAY_CLOCK_DCE112_H__
 #define __DAL_DISPLAY_CLOCK_DCE112_H__
 
-#include "gpu/display_clock.h"
+#include "display_clock_interface.h"
 
 struct display_clock_dce112 {
 	struct display_clock disp_clk_base;
drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.h +1 -1
index c675f1e30870..273a5d902840 100644
@@ -25,7 +25,7 @@
 #ifndef __DAL_DISPLAY_CLOCK_DCE80_H__
 #define __DAL_DISPLAY_CLOCK_DCE80_H__
 
-#include "gpu/display_clock.h"
+#include "display_clock_interface.h"
 
 struct display_clock_dce80 {
 	struct display_clock disp_clk;
drivers/gpu/drm/amd/display/dc/gpu/display_clock.c deleted +0 -75

75 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/display_clock.h deleted +0 -31
deleted file mode 100644
index 68d2ab0500a6..000000000000
@@ -1,31 +0,0 @@
-/*
- * Copyright 2012-15 Advanced Micro Devices, Inc.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- * Authors: AMD
- *
- */
-
-#ifndef __DAL_DISPLAY_CLOCK_H__
-#define __DAL_DISPLAY_CLOCK_H__
-
-#include "include/display_clock_interface.h"
-
-#endif /* __DAL_DISPLAY_CLOCK_H__*/
drivers/gpu/drm/amd/display/include/display_clock_interface.h +0 -11
index f49253714b1e..a46ceebe2452 100644
@@ -93,15 +93,4 @@ struct display_clock *dal_display_clock_dce80_create(
 
 void dal_display_clock_destroy(struct display_clock **to_destroy);
 
-bool dal_display_clock_get_min_clocks_state(
-	struct display_clock *disp_clk,
-	enum clocks_state *clocks_state);
-bool dal_display_clock_get_required_clocks_state(
-	struct display_clock *disp_clk,
-	struct state_dependent_clocks *req_clocks,
-	enum clocks_state *clocks_state);
-bool dal_display_clock_set_min_clocks_state(
-	struct display_clock *disp_clk,
-	enum clocks_state clocks_state);
-
 #endif /* __DISPLAY_CLOCK_INTERFACE_H__ */
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#6 lore raw

PATCH 5/12 drm/amd/display: remove store clock state

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id Id719232abef18c4e410515c0723118f0f198aef9
---
 .../drm/amd/display/dc/dce100/dce100_resource.c    |  8 +---
 .../drm/amd/display/dc/dce110/dce110_resource.c    |  8 +---
 .../drm/amd/display/dc/dce112/dce112_resource.c    |  8 +---
 .../gpu/drm/amd/display/dc/dce80/dce80_resource.c  |  8 +---
 .../display/dc/gpu/dce110/display_clock_dce110.c   | 47 +++-----------------
 .../display/dc/gpu/dce110/display_clock_dce110.h   |  2 -
 .../display/dc/gpu/dce112/display_clock_dce112.c   | 50 +++-------------------
 .../display/dc/gpu/dce112/display_clock_dce112.h   |  2 -
 .../amd/display/dc/gpu/dce80/display_clock_dce80.c | 50 +++-------------------
 .../amd/display/dc/gpu/dce80/display_clock_dce80.h |  2 -
 .../amd/display/include/display_clock_interface.h  |  5 +--
 11 files changed, 29 insertions(+), 161 deletions(-)
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +2 -6
index fa88eb163ab8..446f50bb4e0a 100644
@@ -981,14 +981,10 @@ static bool construct(
 	/* get static clock information for PPLIB or firmware, save
 	 * max_clock_state
 	 */
-	if (dm_pp_get_static_clocks(ctx, &static_clk_info)) {
-		enum clocks_state max_clocks_state =
+	if (dm_pp_get_static_clocks(ctx, &static_clk_info))
+		pool->base.display_clock->max_clks_state =
 			dce110_resource_convert_clock_state_pp_to_dc(
 					static_clk_info.max_clocks_state);
-
-		pool->base.display_clock->funcs->store_max_clocks_state(
-				pool->base.display_clock, max_clocks_state);
-	}
 	{
 		struct irq_service_init_data init_data;
 		init_data.ctx = dc->ctx;
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +2 -6
index 6c713396e6ba..d5d888bdf882 100644
@@ -1312,15 +1312,11 @@ static bool construct(
 	/* get static clock information for PPLIB or firmware, save
 	 * max_clock_state
 	 */
-	if (dm_pp_get_static_clocks(ctx, &static_clk_info)) {
-		enum clocks_state max_clocks_state =
+	if (dm_pp_get_static_clocks(ctx, &static_clk_info))
+		pool->base.display_clock->max_clks_state =
 			dce110_resource_convert_clock_state_pp_to_dc(
 					static_clk_info.max_clocks_state);
 
-		pool->base.display_clock->funcs->store_max_clocks_state(
-				pool->base.display_clock, max_clocks_state);
-	}
-
 	{
 		struct irq_service_init_data init_data;
 		init_data.ctx = dc->ctx;
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +2 -6
index 8792c4ed6e65..9903c9a4b8a1 100644
@@ -1312,15 +1312,11 @@ static bool construct(
 	/* get static clock information for PPLIB or firmware, save
 	 * max_clock_state
 	 */
-	if (dm_pp_get_static_clocks(ctx, &static_clk_info)) {
-		enum clocks_state max_clocks_state =
+	if (dm_pp_get_static_clocks(ctx, &static_clk_info))
+		pool->base.display_clock->max_clks_state =
 			dce110_resource_convert_clock_state_pp_to_dc(
 					static_clk_info.max_clocks_state);
 
-		pool->base.display_clock->funcs->store_max_clocks_state(
-				pool->base.display_clock, max_clocks_state);
-	}
-
 	{
 		struct irq_service_init_data init_data;
 		init_data.ctx = dc->ctx;
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +2 -6
index 1e829f805d42..51721d10c811 100644
@@ -975,15 +975,11 @@ static bool construct(
 	}
 
 
-	if (dm_pp_get_static_clocks(ctx, &static_clk_info)) {
-		enum clocks_state max_clocks_state =
+	if (dm_pp_get_static_clocks(ctx, &static_clk_info))
+		pool->base.display_clock->max_clks_state =
 				dce80_resource_convert_clock_state_pp_to_dc(
 					static_clk_info.max_clocks_state);
 
-		pool->base.display_clock->funcs->store_max_clocks_state(
-				pool->base.display_clock, max_clocks_state);
-	}
-
 	{
 		struct irq_service_init_data init_data;
 		init_data.ctx = dc->ctx;
drivers/gpu/drm/amd/display/dc/gpu/dce110/display_clock_dce110.c +6 -41

99 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/dce110/display_clock_dce110.h +0 -2
index 703cd656b5b0..50b51c41b0d9 100644
@@ -29,8 +29,6 @@
 
 struct display_clock_dce110 {
 	struct display_clock disp_clk_base;
-	/* Max display block clocks state*/
-	enum clocks_state max_clks_state;
 	bool use_max_disp_clk;
 	uint32_t dentist_vco_freq_khz;
 	/* Cache the status of DFS-bypass feature*/
drivers/gpu/drm/amd/display/dc/gpu/dce112/display_clock_dce112.c +6 -44

102 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/dce112/display_clock_dce112.h +0 -2
index 34afff9a00bc..398af34720f7 100644
@@ -29,8 +29,6 @@
 
 struct display_clock_dce112 {
 	struct display_clock disp_clk_base;
-	/* Max display block clocks state*/
-	enum clocks_state max_clks_state;
 	bool use_max_disp_clk;
 	uint32_t dentist_vco_freq_khz;
 	/* Cache the status of DFS-bypass feature*/
drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.c +7 -43

117 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.h +0 -2
index 273a5d902840..1193398b5cea 100644
@@ -37,8 +37,6 @@ struct display_clock_dce80 {
 	uint32_t gpu_pll_ss_divider;
 	/* Flag for Enabled SS on GPU PLL*/
 	bool ss_on_gpu_pll;
-	/* Max display block clocks state*/
-	enum clocks_state max_clks_state;
 	/* Current minimum display block clocks state*/
 	enum clocks_state cur_min_clks_state;
 	/* DFS-bypass feature variable
drivers/gpu/drm/amd/display/include/display_clock_interface.h +2 -3
index a46ceebe2452..bc678a59a3c1 100644
@@ -60,7 +60,8 @@ struct display_clock {
 	struct dc_context *ctx;
 	const struct display_clock_funcs *funcs;
 	uint32_t min_display_clk_threshold_khz;
-	enum clock_source_id id;
+	/* Max display block clocks state*/
+	enum clocks_state max_clks_state;
 
 	enum clocks_state cur_min_clks_state;
 };
@@ -77,8 +78,6 @@ struct display_clock_funcs {
 	bool (*set_min_clocks_state)(struct display_clock *disp_clk,
 		enum clocks_state clocks_state);
 	uint32_t (*get_dp_ref_clk_frequency)(struct display_clock *disp_clk);
-	void (*store_max_clocks_state)(struct display_clock *disp_clk,
-		enum clocks_state max_clocks_state);
 
 };
 
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#7 lore raw

PATCH 6/12 drm/amd/display: remove get_min_clocks_state

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id Ib2d6f7c159812f6300701d4cfc2de355096d5a57
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      | 10 +----
 .../display/dc/gpu/dce110/display_clock_dce110.c   | 42 +++++++++++---------
 .../display/dc/gpu/dce112/display_clock_dce112.c   | 45 ++++++++++++----------
 .../display/dc/gpu/dce112/display_clock_dce112.h   |  2 +-
 .../amd/display/dc/gpu/dce80/display_clock_dce80.c | 30 ++++++++-------
 .../amd/display/include/display_clock_interface.h  |  2 -
 6 files changed, 67 insertions(+), 64 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +2 -8
index ab4efde2d030..558eeefecbff 100644
@@ -1208,7 +1208,6 @@ static enum dc_status enable_link_dp(struct pipe_ctx *pipe_ctx)
 	struct core_link *link = stream->sink->link;
 	struct dc_link_settings link_settings = {0};
 	enum dp_panel_mode panel_mode;
-	enum clocks_state cur_min_clock_state;
 	enum dc_link_rate max_link_rate = LINK_RATE_HIGH2;
 
 	/* get link settings for video mode timing */
@@ -1221,13 +1220,8 @@ static enum dc_status enable_link_dp(struct pipe_ctx *pipe_ctx)
 		max_link_rate = LINK_RATE_HIGH3;
 
 	if (link_settings.link_rate == max_link_rate) {
-		cur_min_clock_state = CLOCKS_STATE_INVALID;
-
-		if (pipe_ctx->dis_clk->funcs->get_min_clocks_state) {
-			cur_min_clock_state =
-				pipe_ctx->dis_clk->funcs->get_min_clocks_state(
-							pipe_ctx->dis_clk);
-			if (cur_min_clock_state < CLOCKS_STATE_NOMINAL)
+		if (pipe_ctx->dis_clk->funcs->set_min_clocks_state) {
+			if (pipe_ctx->dis_clk->cur_min_clks_state < CLOCKS_STATE_NOMINAL)
 				pipe_ctx->dis_clk->funcs->set_min_clocks_state(
 					pipe_ctx->dis_clk, CLOCKS_STATE_NOMINAL);
 		} else {
drivers/gpu/drm/amd/display/dc/gpu/dce110/display_clock_dce110.c +23 -19

82 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/dce112/display_clock_dce112.c +24 -21

84 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/dce112/display_clock_dce112.h +1 -1
index 398af34720f7..0246f930ac35 100644
@@ -78,7 +78,7 @@ enum clocks_state dispclk_dce112_get_required_clocks_state(
 	struct display_clock *dc,
 	struct state_dependent_clocks *req_clocks);
 
-void dispclk_dce112_set_clock(
+void dce112_set_clock(
 	struct display_clock *base,
 	uint32_t requested_clk_khz);
 
drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.c +17 -13
index b101f7de2d11..6057042739bf 100644
@@ -90,7 +90,7 @@ static struct divider_range divider_ranges[DIVIDER_RANGE_MAX];
 #define FROM_DISPLAY_CLOCK(base) \
 	container_of(base, struct display_clock_dce80, disp_clk)
 
-static void set_clock(
+static void dce80_set_clock(
 	struct display_clock *dc,
 	uint32_t requested_clk_khz)
 {
@@ -111,13 +111,6 @@ static void set_clock(
 		dc->cur_min_clks_state = CLOCKS_STATE_NOMINAL;
 }
 
-static enum clocks_state get_min_clocks_state(struct display_clock *dc)
-{
-	struct display_clock_dce80 *disp_clk = FROM_DISPLAY_CLOCK(dc);
-
-	return disp_clk->cur_min_clks_state;
-}
-
 static enum clocks_state get_required_clocks_state
 	(struct display_clock *dc,
 	struct state_dependent_clocks *req_clocks)
@@ -145,12 +138,12 @@ static enum clocks_state get_required_clocks_state
 	return low_req_clk;
 }
 
-static bool set_min_clocks_state(
+static bool dce80_set_min_clocks_state(
 	struct display_clock *dc,
 	enum clocks_state clocks_state)
 {
 	struct dm_pp_power_level_change_request level_change_req = {
-			DM_PP_POWER_LEVEL_INVALID};
+			DM_PP_POWER_LEVEL_INVALID };
 
 	if (clocks_state > dc->max_clks_state) {
 		/*Requested state exceeds max supported state.*/
@@ -176,6 +169,18 @@ static bool set_min_clocks_state(
 	case CLOCKS_STATE_PERFORMANCE:
 		level_change_req.power_level = DM_PP_POWER_LEVEL_PERFORMANCE;
 		break;
+	case CLOCKS_DPM_STATE_LEVEL_4:
+		level_change_req.power_level = DM_PP_POWER_LEVEL_4;
+		break;
+	case CLOCKS_DPM_STATE_LEVEL_5:
+		level_change_req.power_level = DM_PP_POWER_LEVEL_5;
+		break;
+	case CLOCKS_DPM_STATE_LEVEL_6:
+		level_change_req.power_level = DM_PP_POWER_LEVEL_6;
+		break;
+	case CLOCKS_DPM_STATE_LEVEL_7:
+		level_change_req.power_level = DM_PP_POWER_LEVEL_7;
+		break;
 	case CLOCKS_STATE_INVALID:
 	default:
 		dm_logger_write(dc->ctx->logger, LOG_WARNING,
@@ -375,10 +380,9 @@ static void destroy(struct display_clock **dc)
 static const struct display_clock_funcs funcs = {
 	.destroy = destroy,
 	.get_dp_ref_clk_frequency = get_dp_ref_clk_frequency,
-	.get_min_clocks_state = get_min_clocks_state,
 	.get_required_clocks_state = get_required_clocks_state,
-	.set_clock = set_clock,
-	.set_min_clocks_state = set_min_clocks_state
+	.set_clock = dce80_set_clock,
+	.set_min_clocks_state = dce80_set_min_clocks_state
 };
 
 
drivers/gpu/drm/amd/display/include/display_clock_interface.h +0 -2
index bc678a59a3c1..f2deafbd8b12 100644
@@ -70,8 +70,6 @@ struct display_clock_funcs {
 	void (*destroy)(struct display_clock **to_destroy);
 	void (*set_clock)(struct display_clock *disp_clk,
 		uint32_t requested_clock_khz);
-	enum clocks_state (*get_min_clocks_state)(
-		struct display_clock *disp_clk);
 	enum clocks_state (*get_required_clocks_state)(
 		struct display_clock *disp_clk,
 		struct state_dependent_clocks *req_clocks);
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#8 lore raw

PATCH 7/12 drm/amd/display: remove clocks_state enum

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I2a653a44ed6001d72ae049409e567ad9a3d882b2
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      |  4 +-
 .../drm/amd/display/dc/dce100/dce100_resource.c    |  3 +-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  4 +-
 .../drm/amd/display/dc/dce110/dce110_resource.c    | 44 +--------------
 .../drm/amd/display/dc/dce110/dce110_resource.h    |  3 -
 .../drm/amd/display/dc/dce112/dce112_resource.c    |  3 +-
 .../gpu/drm/amd/display/dc/dce80/dce80_resource.c  | 24 ++++----
 .../display/dc/gpu/dce110/display_clock_dce110.c   | 62 +++++----------------
 .../display/dc/gpu/dce112/display_clock_dce112.c   | 62 +++++----------------
 .../display/dc/gpu/dce112/display_clock_dce112.h   |  8 +--
 .../amd/display/dc/gpu/dce80/display_clock_dce80.c | 64 ++++++----------------
 .../amd/display/dc/gpu/dce80/display_clock_dce80.h |  2 +-
 .../amd/display/include/display_clock_interface.h  | 28 ++--------
 13 files changed, 75 insertions(+), 236 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +2 -2
index 558eeefecbff..47f22d46c0ca 100644
@@ -1221,9 +1221,9 @@ static enum dc_status enable_link_dp(struct pipe_ctx *pipe_ctx)
 
 	if (link_settings.link_rate == max_link_rate) {
 		if (pipe_ctx->dis_clk->funcs->set_min_clocks_state) {
-			if (pipe_ctx->dis_clk->cur_min_clks_state < CLOCKS_STATE_NOMINAL)
+			if (pipe_ctx->dis_clk->cur_min_clks_state < DM_PP_CLOCKS_STATE_NOMINAL)
 				pipe_ctx->dis_clk->funcs->set_min_clocks_state(
-					pipe_ctx->dis_clk, CLOCKS_STATE_NOMINAL);
+					pipe_ctx->dis_clk, DM_PP_CLOCKS_STATE_NOMINAL);
 		} else {
 		}
 	}
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +1 -2
index 446f50bb4e0a..5716ce1e58f4 100644
@@ -983,8 +983,7 @@ static bool construct(
 	 */
 	if (dm_pp_get_static_clocks(ctx, &static_clk_info))
 		pool->base.display_clock->max_clks_state =
-			dce110_resource_convert_clock_state_pp_to_dc(
-					static_clk_info.max_clocks_state);
+					static_clk_info.max_clocks_state;
 	{
 		struct irq_service_init_data init_data;
 		init_data.ctx = dc->ctx;
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +2 -2
index ca71509af74d..6ad23f327631 100644
@@ -1084,7 +1084,7 @@ static uint32_t get_max_pixel_clock_for_all_paths(
 static void apply_min_clocks(
 	struct core_dc *dc,
 	struct validate_context *context,
-	enum clocks_state *clocks_state,
+	enum dm_pp_clocks_state *clocks_state,
 	bool pre_mode_set)
 {
 	struct state_dependent_clocks req_clocks = {0};
@@ -1193,7 +1193,7 @@ enum dc_status dce110_apply_ctx_to_hw(
 	enum dc_status status;
 	int i;
 	bool programmed_audio_dto = false;
-	enum clocks_state clocks_state = CLOCKS_STATE_INVALID;
+	enum dm_pp_clocks_state clocks_state = DM_PP_CLOCKS_STATE_INVALID;
 
 	/* Reset old context */
 	/* look up the targets that have been removed since last commit */
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +1 -43

56 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.h +0 -3
index 535623aa0052..0c357fdfa8bc 100644
@@ -40,9 +40,6 @@ struct dce110_resource_pool {
 
 enum dc_status dce110_resource_build_pipe_hw_param(struct pipe_ctx *pipe_ctx);
 
-enum clocks_state dce110_resource_convert_clock_state_pp_to_dc(
-	enum dm_pp_clocks_state pp_clock_state);
-
 void dce110_resource_build_bit_depth_reduction_params(
 		const struct core_stream *stream,
 		struct bit_depth_reduction_params *fmt_bit_depth);
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +1 -2
index 9903c9a4b8a1..c50a215172b7 100644
@@ -1314,8 +1314,7 @@ static bool construct(
 	 */
 	if (dm_pp_get_static_clocks(ctx, &static_clk_info))
 		pool->base.display_clock->max_clks_state =
-			dce110_resource_convert_clock_state_pp_to_dc(
-					static_clk_info.max_clocks_state);
+				static_clk_info.max_clocks_state;
 
 	{
 		struct irq_service_init_data init_data;
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +12 -12
index 51721d10c811..1d2a31e34617 100644
@@ -857,41 +857,41 @@ static const struct resource_funcs dce80_res_pool_funcs = {
 	.validate_bandwidth = dce80_validate_bandwidth
 };
 
-static enum clocks_state dce80_resource_convert_clock_state_pp_to_dc(
+static enum dm_pp_clocks_state dce80_resource_convert_clock_state_pp_to_dc(
 	enum dm_pp_clocks_state pp_clock_state)
 {
-	enum clocks_state dc_clocks_state = CLOCKS_STATE_INVALID;
+	enum dm_pp_clocks_state dc_clocks_state = DM_PP_CLOCKS_STATE_INVALID;
 
 	switch (pp_clock_state) {
 	case DM_PP_CLOCKS_STATE_INVALID:
-		dc_clocks_state = CLOCKS_STATE_INVALID;
+		dc_clocks_state = DM_PP_CLOCKS_STATE_INVALID;
 		break;
 	case DM_PP_CLOCKS_STATE_ULTRA_LOW:
-		dc_clocks_state = CLOCKS_STATE_ULTRA_LOW;
+		dc_clocks_state = DM_PP_CLOCKS_STATE_ULTRA_LOW;
 		break;
 	case DM_PP_CLOCKS_STATE_LOW:
-		dc_clocks_state = CLOCKS_STATE_LOW;
+		dc_clocks_state = DM_PP_CLOCKS_STATE_LOW;
 		break;
 	case DM_PP_CLOCKS_STATE_NOMINAL:
-		dc_clocks_state = CLOCKS_STATE_NOMINAL;
+		dc_clocks_state = DM_PP_CLOCKS_STATE_NOMINAL;
 		break;
 	case DM_PP_CLOCKS_STATE_PERFORMANCE:
-		dc_clocks_state = CLOCKS_STATE_PERFORMANCE;
+		dc_clocks_state = DM_PP_CLOCKS_STATE_PERFORMANCE;
 		break;
 	case DM_PP_CLOCKS_DPM_STATE_LEVEL_4:
-		dc_clocks_state = CLOCKS_DPM_STATE_LEVEL_4;
+		dc_clocks_state = DM_PP_CLOCKS_DPM_STATE_LEVEL_4;
 		break;
 	case DM_PP_CLOCKS_DPM_STATE_LEVEL_5:
-		dc_clocks_state = CLOCKS_DPM_STATE_LEVEL_5;
+		dc_clocks_state = DM_PP_CLOCKS_DPM_STATE_LEVEL_5;
 		break;
 	case DM_PP_CLOCKS_DPM_STATE_LEVEL_6:
-		dc_clocks_state = CLOCKS_DPM_STATE_LEVEL_6;
+		dc_clocks_state = DM_PP_CLOCKS_DPM_STATE_LEVEL_6;
 		break;
 	case DM_PP_CLOCKS_DPM_STATE_LEVEL_7:
-		dc_clocks_state = CLOCKS_DPM_STATE_LEVEL_7;
+		dc_clocks_state = DM_PP_CLOCKS_DPM_STATE_LEVEL_7;
 		break;
 	default:
-		dc_clocks_state = CLOCKS_STATE_INVALID;
+		dc_clocks_state = DM_PP_CLOCKS_STATE_INVALID;
 		break;
 	}
 
drivers/gpu/drm/amd/display/dc/gpu/dce110/display_clock_dce110.c +15 -47

138 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/dce112/display_clock_dce112.c +15 -47

138 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/dce112/display_clock_dce112.h +4 -4
index 0246f930ac35..b750bb1766bd 100644
@@ -71,10 +71,10 @@ bool dal_display_clock_dce112_construct(
 
 void dispclk_dce112_destroy(struct display_clock **base);
 
-enum clocks_state dispclk_dce112_get_min_clocks_state(
+enum dm_pp_clocks_state dispclk_dce112_get_min_clocks_state(
 	struct display_clock *base);
 
-enum clocks_state dispclk_dce112_get_required_clocks_state(
+enum dm_pp_clocks_state dispclk_dce112_get_required_clocks_state(
 	struct display_clock *dc,
 	struct state_dependent_clocks *req_clocks);
 
@@ -84,10 +84,10 @@ void dce112_set_clock(
 
 bool dispclk_dce112_set_min_clocks_state(
 	struct display_clock *base,
-	enum clocks_state clocks_state);
+	enum dm_pp_clocks_state clocks_state);
 
 void dispclk_dce112_store_max_clocks_state(
 	struct display_clock *base,
-	enum clocks_state max_clocks_state);
+	enum dm_pp_clocks_state max_clocks_state);
 
 #endif /* __DAL_DISPLAY_CLOCK_DCE112_H__ */
drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.c +16 -48

137 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.h +1 -1
index 1193398b5cea..c155bb6a4321 100644
@@ -38,7 +38,7 @@ struct display_clock_dce80 {
 	/* Flag for Enabled SS on GPU PLL*/
 	bool ss_on_gpu_pll;
 	/* Current minimum display block clocks state*/
-	enum clocks_state cur_min_clks_state;
+	enum dm_pp_clocks_state cur_min_clks_state;
 	/* DFS-bypass feature variable
 	 Cache the status of DFS-bypass feature*/
 	bool dfs_bypass_enabled;
drivers/gpu/drm/amd/display/include/display_clock_interface.h +5 -23
index f2deafbd8b12..6ba8c093793d 100644
@@ -26,29 +26,11 @@
 #ifndef __DISPLAY_CLOCK_INTERFACE_H__
 #define __DISPLAY_CLOCK_INTERFACE_H__
 
+#include "dm_services_types.h"
 #include "hw_sequencer_types.h"
 #include "grph_object_defs.h"
 #include "signal_types.h"
 
-/* Enumeration of all clocks states */
-enum clocks_state {
-	CLOCKS_STATE_INVALID = 0,
-	CLOCKS_STATE_ULTRA_LOW,
-	CLOCKS_STATE_LOW,
-	CLOCKS_STATE_NOMINAL,
-	CLOCKS_STATE_PERFORMANCE,
-	/* Starting from DCE11, Max 8 level DPM state supported */
-	CLOCKS_DPM_STATE_LEVEL_INVALID = CLOCKS_STATE_INVALID,
-	CLOCKS_DPM_STATE_LEVEL_0 = CLOCKS_STATE_ULTRA_LOW,
-	CLOCKS_DPM_STATE_LEVEL_1 = CLOCKS_STATE_LOW,
-	CLOCKS_DPM_STATE_LEVEL_2 = CLOCKS_STATE_NOMINAL,
-	CLOCKS_DPM_STATE_LEVEL_3 = CLOCKS_STATE_PERFORMANCE,
-	CLOCKS_DPM_STATE_LEVEL_4 = CLOCKS_DPM_STATE_LEVEL_3 + 1,
-	CLOCKS_DPM_STATE_LEVEL_5 = CLOCKS_DPM_STATE_LEVEL_4 + 1,
-	CLOCKS_DPM_STATE_LEVEL_6 = CLOCKS_DPM_STATE_LEVEL_5 + 1,
-	CLOCKS_DPM_STATE_LEVEL_7 = CLOCKS_DPM_STATE_LEVEL_6 + 1,
-};
-
 /* Structure containing all state-dependent clocks
  * (dependent on "enum clocks_state") */
 struct state_dependent_clocks {
@@ -61,20 +43,20 @@ struct display_clock {
 	const struct display_clock_funcs *funcs;
 	uint32_t min_display_clk_threshold_khz;
 	/* Max display block clocks state*/
-	enum clocks_state max_clks_state;
+	enum dm_pp_clocks_state max_clks_state;
 
-	enum clocks_state cur_min_clks_state;
+	enum dm_pp_clocks_state cur_min_clks_state;
 };
 
 struct display_clock_funcs {
 	void (*destroy)(struct display_clock **to_destroy);
 	void (*set_clock)(struct display_clock *disp_clk,
 		uint32_t requested_clock_khz);
-	enum clocks_state (*get_required_clocks_state)(
+	enum dm_pp_clocks_state (*get_required_clocks_state)(
 		struct display_clock *disp_clk,
 		struct state_dependent_clocks *req_clocks);
 	bool (*set_min_clocks_state)(struct display_clock *disp_clk,
-		enum clocks_state clocks_state);
+		enum dm_pp_clocks_state dm_pp_clocks_state);
 	uint32_t (*get_dp_ref_clk_frequency)(struct display_clock *disp_clk);
 
 };
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#9 lore raw

PATCH 8/12 drm/amd/display: consolidate dce8-11.2 display clock code

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I4d468ab9ee40809587b0ed84795b0d66343eab13
---
 drivers/gpu/drm/amd/display/dc/dce/Makefile        |   3 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_audio.c     |   4 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c    | 519 +++++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.h    | 133 ++++++
 .../drm/amd/display/dc/dce100/dce100_resource.c    |  22 +-
 .../drm/amd/display/dc/dce110/dce110_resource.c    |  24 +-
 .../drm/amd/display/dc/dce112/dce112_resource.c    |  28 +-
 .../gpu/drm/amd/display/dc/dce80/dce80_resource.c  |  70 +--
 drivers/gpu/drm/amd/display/dc/dm_services_types.h |  18 +-
 drivers/gpu/drm/amd/display/dc/gpu/Makefile        |  15 -
 .../display/dc/gpu/dce110/display_clock_dce110.c   | 516 --------------------
 .../display/dc/gpu/dce110/display_clock_dce110.h   |  50 --
 .../display/dc/gpu/dce112/display_clock_dce112.c   | 152 ------
 .../display/dc/gpu/dce112/display_clock_dce112.h   |  14 -
 .../amd/display/dc/gpu/dce80/display_clock_dce80.c | 430 -----------------
 .../amd/display/dc/gpu/dce80/display_clock_dce80.h |  54 ---
 .../amd/display/include/display_clock_interface.h  |  15 +-
 17 files changed, 747 insertions(+), 1320 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.h
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpu/dce110/display_clock_dce110.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpu/dce110/display_clock_dce110.h
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.h
drivers/gpu/drm/amd/display/dc/dce/Makefile +2 -1
index bfca38170329..6add5977fd39 100644
@@ -6,7 +6,8 @@
 #     offset/shift/mask stored in dce_hw struct
 
 DCE = dce_audio.o dce_stream_encoder.o dce_link_encoder.o dce_hwseq.o \
-dce_mem_input.o dce_clock_source.o dce_scl_filters.o dce_transform.o
+dce_mem_input.o dce_clock_source.o dce_scl_filters.o dce_transform.o \
+dce_clocks.o
 
 
 AMD_DAL_DCE = $(addprefix $(AMDDALPATH)/dc/dce/,$(DCE))
drivers/gpu/drm/amd/display/dc/dce/dce_audio.c +3 -1
index dc44053e8575..2749c8fa4f1f 100644
@@ -888,7 +888,9 @@ static const struct audio_funcs funcs = {
 
 void dce_aud_destroy(struct audio **audio)
 {
-	dm_free(*audio);
+	struct dce_audio *aud = DCE_AUD(*audio);
+
+	dm_free(aud);
 	*audio = NULL;
 }
 
drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c new file +519 -0

519 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce/dce_clocks.h new file +133 -0

133 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +18 -4
index 5716ce1e58f4..c97416f7bc93 100644
@@ -40,6 +40,7 @@
 #include "dce110/dce110_ipp.h"
 #include "dce/dce_transform.h"
 #include "dce110/dce110_opp.h"
+#include "dce/dce_clocks.h"
 #include "dce/dce_clock_source.h"
 #include "dce/dce_audio.h"
 #include "dce/dce_hwseq.h"
@@ -200,6 +201,18 @@ static const struct dce110_ipp_reg_offsets dce100_ipp_reg_offsets[] = {
 	.reg_name = mm ## block ## id ## _ ## reg_name
 
 
+static const struct dce_disp_clk_registers disp_clk_regs = {
+		CLK_COMMON_REG_LIST_DCE_BASE()
+};
+
+static const struct dce_disp_clk_shift disp_clk_shift = {
+		CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(__SHIFT)
+};
+
+static const struct dce_disp_clk_mask disp_clk_mask = {
+		CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK)
+};
+
 #define transform_regs(id)\
 [id] = {\
 		XFM_COMMON_REG_LIST_DCE100(id)\
@@ -717,9 +730,7 @@ static void destruct(struct dce110_resource_pool *pool)
 	}
 
 	if (pool->base.display_clock != NULL)
-		pool->base.display_clock->funcs->destroy(
-				&pool->base.display_clock);
-		pool->base.display_clock = NULL;
+		dce_disp_clk_destroy(&pool->base.display_clock);
 
 	if (pool->base.irqs != NULL)
 		dal_irq_service_destroy(&pool->base.irqs);
@@ -970,7 +981,10 @@ static bool construct(
 		}
 	}
 
-	pool->base.display_clock = dal_display_clock_dce110_create(ctx);
+	pool->base.display_clock = dce_disp_clk_create(ctx,
+			&disp_clk_regs,
+			&disp_clk_shift,
+			&disp_clk_mask);
 	if (pool->base.display_clock == NULL) {
 		dm_error("DC: failed to create display clock!\n");
 		BREAK_TO_DEBUGGER();
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +18 -6
index 8682c8b2a547..fa601f7f0b5a 100644
@@ -45,6 +45,7 @@
 #include "dce110/dce110_transform_v.h"
 #include "dce110/dce110_opp.h"
 #include "dce110/dce110_opp_v.h"
+#include "dce/dce_clocks.h"
 #include "dce/dce_clock_source.h"
 #include "dce/dce_hwseq.h"
 #include "dce110/dce110_hw_sequencer.h"
@@ -187,6 +188,17 @@ static const struct dce110_ipp_reg_offsets dce110_ipp_reg_offsets[] = {
 #define SRI(reg_name, block, id)\
 	.reg_name = mm ## block ## id ## _ ## reg_name
 
+static const struct dce_disp_clk_registers disp_clk_regs = {
+		CLK_COMMON_REG_LIST_DCE_BASE()
+};
+
+static const struct dce_disp_clk_shift disp_clk_shift = {
+		CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(__SHIFT)
+};
+
+static const struct dce_disp_clk_mask disp_clk_mask = {
+		CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK)
+};
 
 #define transform_regs(id)\
 [id] = {\
@@ -699,11 +711,8 @@ static void destruct(struct dce110_resource_pool *pool)
 		}
 	}
 
-	if (pool->base.display_clock != NULL) {
-		pool->base.display_clock->funcs->destroy(
-				&pool->base.display_clock);
-		pool->base.display_clock = NULL;
-	}
+	if (pool->base.display_clock != NULL)
+		dce_disp_clk_destroy(&pool->base.display_clock);
 
 	if (pool->base.irqs != NULL) {
 		dal_irq_service_destroy(&pool->base.irqs);
@@ -1261,7 +1270,10 @@ static bool construct(
 		}
 	}
 
-	pool->base.display_clock = dal_display_clock_dce110_create(ctx);
+	pool->base.display_clock = dce110_disp_clk_create(ctx,
+			&disp_clk_regs,
+			&disp_clk_shift,
+			&disp_clk_mask);
 	if (pool->base.display_clock == NULL) {
 		dm_error("DC: failed to create display clock!\n");
 		BREAK_TO_DEBUGGER();
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +20 -8
index c50a215172b7..3a478300b848 100644
@@ -41,6 +41,7 @@
 #include "dce/dce_audio.h"
 #include "dce112/dce112_opp.h"
 #include "dce110/dce110_ipp.h"
+#include "dce/dce_clocks.h"
 #include "dce/dce_clock_source.h"
 
 #include "dce/dce_hwseq.h"
@@ -204,6 +205,19 @@ static const struct dce110_ipp_reg_offsets ipp_reg_offsets[] = {
 #define SRI(reg_name, block, id)\
 	.reg_name = mm ## block ## id ## _ ## reg_name
 
+
+static const struct dce_disp_clk_registers disp_clk_regs = {
+		CLK_COMMON_REG_LIST_DCE_BASE()
+};
+
+static const struct dce_disp_clk_shift disp_clk_shift = {
+		CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(__SHIFT)
+};
+
+static const struct dce_disp_clk_mask disp_clk_mask = {
+		CLK_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(_MASK)
+};
+
 #define transform_regs(id)\
 [id] = {\
 		XFM_COMMON_REG_LIST_DCE110(id)\
@@ -733,11 +747,8 @@ static void destruct(struct dce110_resource_pool *pool)
 		}
 	}
 
-	if (pool->base.display_clock != NULL) {
-		pool->base.display_clock->funcs->destroy(
-				&pool->base.display_clock);
-		pool->base.display_clock = NULL;
-	}
+	if (pool->base.display_clock != NULL)
+		dce_disp_clk_destroy(&pool->base.display_clock);
 
 	if (pool->base.irqs != NULL) {
 		dal_irq_service_destroy(&pool->base.irqs);
@@ -1299,9 +1310,10 @@ static bool construct(
 		}
 	}
 
-	pool->base.display_clock = dal_display_clock_dce112_create(
-			ctx);
-
+	pool->base.display_clock = dce112_disp_clk_create(ctx,
+			&disp_clk_regs,
+			&disp_clk_shift,
+			&disp_clk_mask);
 	if (pool->base.display_clock == NULL) {
 		dm_error("DC: failed to create display clock!\n");
 		BREAK_TO_DEBUGGER();
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +21 -49

106 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dm_services_types.h +10 -8
index 44bad17fa318..460971dc3a70 100644
@@ -43,15 +43,17 @@ enum dm_pp_clocks_state {
 
 	/* Starting from DCE11, Max 8 levels of DPM state supported. */
 	DM_PP_CLOCKS_DPM_STATE_LEVEL_INVALID = DM_PP_CLOCKS_STATE_INVALID,
-	DM_PP_CLOCKS_DPM_STATE_LEVEL_0 = DM_PP_CLOCKS_STATE_ULTRA_LOW,
-	DM_PP_CLOCKS_DPM_STATE_LEVEL_1 = DM_PP_CLOCKS_STATE_LOW,
-	DM_PP_CLOCKS_DPM_STATE_LEVEL_2 = DM_PP_CLOCKS_STATE_NOMINAL,
+	DM_PP_CLOCKS_DPM_STATE_LEVEL_0,
+	DM_PP_CLOCKS_DPM_STATE_LEVEL_1,
+	DM_PP_CLOCKS_DPM_STATE_LEVEL_2,
 	/* to be backward compatible */
-	DM_PP_CLOCKS_DPM_STATE_LEVEL_3 = DM_PP_CLOCKS_STATE_PERFORMANCE,
-	DM_PP_CLOCKS_DPM_STATE_LEVEL_4 = DM_PP_CLOCKS_DPM_STATE_LEVEL_3 + 1,
-	DM_PP_CLOCKS_DPM_STATE_LEVEL_5 = DM_PP_CLOCKS_DPM_STATE_LEVEL_4 + 1,
-	DM_PP_CLOCKS_DPM_STATE_LEVEL_6 = DM_PP_CLOCKS_DPM_STATE_LEVEL_5 + 1,
-	DM_PP_CLOCKS_DPM_STATE_LEVEL_7 = DM_PP_CLOCKS_DPM_STATE_LEVEL_6 + 1,
+	DM_PP_CLOCKS_DPM_STATE_LEVEL_3,
+	DM_PP_CLOCKS_DPM_STATE_LEVEL_4,
+	DM_PP_CLOCKS_DPM_STATE_LEVEL_5,
+	DM_PP_CLOCKS_DPM_STATE_LEVEL_6,
+	DM_PP_CLOCKS_DPM_STATE_LEVEL_7,
+
+	DM_PP_CLOCKS_MAX_STATES
 };
 
 struct dm_pp_gpu_clock_range {
drivers/gpu/drm/amd/display/dc/gpu/Makefile +0 -15
index 0b99a7474950..6ab4078405f2 100644
@@ -10,23 +10,8 @@ AMD_DAL_GPU = $(addprefix $(AMDDALPATH)/dc/gpu/,$(GPU))
 AMD_DISPLAY_FILES += $(AMD_DAL_GPU)
 
 ###############################################################################
-# DCE 80 family
-###############################################################################
-GPU_DCE80 = display_clock_dce80.o
-
-AMD_DAL_GPU_DCE80 = $(addprefix $(AMDDALPATH)/dc/gpu/dce80/,$(GPU_DCE80))
-
-AMD_DISPLAY_FILES += $(AMD_DAL_GPU_DCE80)
-
-
-###############################################################################
 # DCE 110 family
 ###############################################################################
-GPU_DCE110 = display_clock_dce110.o
-
-AMD_DAL_GPU_DCE110 = $(addprefix $(AMDDALPATH)/dc/gpu/dce110/,$(GPU_DCE110))
-
-AMD_DISPLAY_FILES += $(AMD_DAL_GPU_DCE110)
 
 GPU_DCE112 = display_clock_dce112.o
 
drivers/gpu/drm/amd/display/dc/gpu/dce110/display_clock_dce110.c deleted +0 -516

516 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/dce110/display_clock_dce110.h deleted +0 -50

50 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/dce112/display_clock_dce112.c +0 -152

174 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/dce112/display_clock_dce112.h +0 -14
index b750bb1766bd..0743c514a60f 100644
@@ -71,23 +71,9 @@ bool dal_display_clock_dce112_construct(
 
 void dispclk_dce112_destroy(struct display_clock **base);
 
-enum dm_pp_clocks_state dispclk_dce112_get_min_clocks_state(
-	struct display_clock *base);
-
-enum dm_pp_clocks_state dispclk_dce112_get_required_clocks_state(
-	struct display_clock *dc,
-	struct state_dependent_clocks *req_clocks);
-
 void dce112_set_clock(
 	struct display_clock *base,
 	uint32_t requested_clk_khz);
 
-bool dispclk_dce112_set_min_clocks_state(
-	struct display_clock *base,
-	enum dm_pp_clocks_state clocks_state);
-
-void dispclk_dce112_store_max_clocks_state(
-	struct display_clock *base,
-	enum dm_pp_clocks_state max_clocks_state);
 
 #endif /* __DAL_DISPLAY_CLOCK_DCE112_H__ */
drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.c deleted +0 -430

430 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.h deleted +0 -54

54 lines not on this page · raw message

drivers/gpu/drm/amd/display/include/display_clock_interface.h +3 -12
index 6ba8c093793d..53a01381c638 100644
@@ -41,10 +41,9 @@ struct state_dependent_clocks {
 struct display_clock {
 	struct dc_context *ctx;
 	const struct display_clock_funcs *funcs;
-	uint32_t min_display_clk_threshold_khz;
-	/* Max display block clocks state*/
-	enum dm_pp_clocks_state max_clks_state;
 
+	int min_display_clk_threshold_khz;
+	enum dm_pp_clocks_state max_clks_state;
 	enum dm_pp_clocks_state cur_min_clks_state;
 };
 
@@ -61,15 +60,7 @@ struct display_clock_funcs {
 
 };
 
-struct display_clock *dal_display_clock_dce112_create(
-	struct dc_context *ctx);
-
-struct display_clock *dal_display_clock_dce110_create(
-	struct dc_context *ctx);
-
-struct display_clock *dal_display_clock_dce80_create(
-	struct dc_context *ctx);
-
 void dal_display_clock_destroy(struct display_clock **to_destroy);
 
+
 #endif /* __DISPLAY_CLOCK_INTERFACE_H__ */
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#10 lore raw

PATCH 9/12 drm/amd/display: add newline to generic_reg_wait timeout message

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I56acc2a2bf92318835699693bacea2234ed6ba5e
---
 drivers/gpu/drm/amd/display/dc/dc_helper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc_helper.c +1 -1
index 3a80b0c08ae4..c5ff7b6d733d 100644
@@ -138,7 +138,7 @@ uint32_t generic_reg_wait(const struct dc_context *ctx,
 			return reg_val;
 	}
 
-	DC_ERR("REG_WAIT timeout %dus * %d tries - %s",
+	DC_ERR("REG_WAIT timeout %dus * %d tries - %s\n",
 			delay_between_poll_us, time_out_num_tries, func_name);
 	return reg_val;
 }
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#11 lore raw

PATCH 10/12 drm/amd/display: fix display clock integrated info read

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id Ib4776ad5e62f9ab528033b3a493269ad52bd6afd
---
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c +1 -1
index bc1a46b7e373..524aacead8a2 100644
@@ -342,7 +342,7 @@ static void dce_clock_read_integrated_info(struct dce_disp_clk *clk_dce)
 				info.disp_clk_voltage[i].max_supported_clk;
 	}
 
-	if (!debug->disable_dfs_bypass)
+	if (!debug->disable_dfs_bypass && bp->integrated_info)
 		if (bp->integrated_info->gpu_cap_info & DFS_BYPASS_ENABLE)
 			clk_dce->dfs_bypass_enabled = true;
 
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#12 lore raw

PATCH 11/12 drm/amd/display: use rgb full range as default quantization for non HDMI

In reply to a message not in the archive

From: Wenjing Liu <[email protected]>

[Description]
Refactor the quantization decision to color module.
Add the check if non HDMI, default quantization should be rgb full range.

Change-Id Icf2d690ed71e16f0af8128b8a405f530974d48ce
---
 drivers/gpu/drm/amd/display/modules/color/color.c  | 88 ++++++++++++++++++++--
 .../gpu/drm/amd/display/modules/inc/mod_color.h    | 12 ++-
 2 files changed, 94 insertions(+), 6 deletions(-)
drivers/gpu/drm/amd/display/modules/color/color.c +83 -5
index 30d09d358576..0610b82b6d84 100644
@@ -2184,7 +2184,8 @@ bool mod_color_set_saturation(struct mod_color *mod_color,
 	return true;
 }
 
-bool mod_color_set_preferred_quantization_range(struct mod_color *mod_color,
+bool mod_color_persist_user_preferred_quantization_range(
+		struct mod_color *mod_color,
 		const struct dc_sink *sink,
 		enum dc_quantization_range quantization_range)
 {
@@ -2214,13 +2215,90 @@ bool mod_color_set_preferred_quantization_range(struct mod_color *mod_color,
 
 bool mod_color_get_preferred_quantization_range(struct mod_color *mod_color,
 		const struct dc_sink *sink,
+		const struct dc_crtc_timing *timing,
 		enum dc_quantization_range *quantization_range)
 {
 	struct core_color *core_color = MOD_COLOR_TO_CORE(mod_color);
-	unsigned int sink_index;
+	unsigned int sink_index = sink_index_from_sink(core_color, sink);
+	enum dc_quantization_range user_preferred_quantization_range =
+			core_color->state[sink_index].
+				preferred_quantization_range;
+	bool rgb_full_range_supported =
+			mod_color_is_rgb_full_range_supported_for_timing(
+				sink, timing);
+	bool rgb_limited_range_supported =
+			mod_color_is_rgb_limited_range_supported_for_timing(
+				sink, timing);
+
+	if (rgb_full_range_supported && rgb_limited_range_supported)
+		*quantization_range = user_preferred_quantization_range;
+	else if (rgb_full_range_supported && !rgb_limited_range_supported)
+		*quantization_range = QUANTIZATION_RANGE_FULL;
+	else if (!rgb_full_range_supported && rgb_limited_range_supported)
+		*quantization_range = QUANTIZATION_RANGE_LIMITED;
+	else
+		*quantization_range = QUANTIZATION_RANGE_UNKNOWN;
 
-	sink_index = sink_index_from_sink(core_color, sink);
-	*quantization_range = core_color->state[sink_index].
-			preferred_quantization_range;
 	return true;
 }
+
+bool mod_color_is_rgb_full_range_supported_for_timing(
+		const struct dc_sink *sink,
+		const struct dc_crtc_timing *timing)
+{
+	bool result = false;
+
+	if (!sink || !timing)
+		return result;
+
+	if (sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A)
+		if (timing->vic || timing->hdmi_vic)
+			if (timing->h_addressable == 640 &&
+				timing->v_addressable == 480 &&
+				(timing->pix_clk_khz == 25200 ||
+					timing->pix_clk_khz == 25170 ||
+					timing->pix_clk_khz == 25175))
+				result = true;
+			else
+				/* don't support full range rgb */
+				/* for HDMI CEA861 timings except VGA mode */
+				result = false;
+		else
+			result = true;
+	else
+		result = true;
+
+	return result;
+}
+
+bool mod_color_is_rgb_limited_range_supported_for_timing(
+		const struct dc_sink *sink,
+		const struct dc_crtc_timing *timing)
+{
+	bool result = false;
+
+	if (!sink || !timing)
+		return result;
+
+	if (sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A)
+		if (timing->vic || timing->hdmi_vic)
+			if (timing->h_addressable == 640 &&
+				timing->v_addressable == 480 &&
+				(timing->pix_clk_khz == 25200 ||
+						timing->pix_clk_khz == 25170 ||
+						timing->pix_clk_khz == 25175))
+				/* don't support rgb limited for */
+				/* HDMI CEA VGA mode */
+				result = false;
+			else
+				/* support rgb limited for non VGA CEA timing */
+				result = true;
+		else
+			/* support rgb limited for non CEA HDMI timing */
+			result = true;
+	else
+		/* don't support rgb limited for non HDMI signal */
+		result = false;
+
+	return result;
+}
drivers/gpu/drm/amd/display/modules/inc/mod_color.h +11 -1
index e54fe2cb8611..91abc173444a 100644
@@ -168,12 +168,22 @@ bool mod_color_set_saturation(struct mod_color *mod_color,
 		const struct dc_stream **streams, int num_streams,
 		int saturation_value);
 
-bool mod_color_set_preferred_quantization_range(struct mod_color *mod_color,
+bool mod_color_persist_user_preferred_quantization_range(
+		struct mod_color *mod_color,
 		const struct dc_sink *sink,
 		enum dc_quantization_range quantization_range);
 
 bool mod_color_get_preferred_quantization_range(struct mod_color *mod_color,
 		const struct dc_sink *sink,
+		const struct dc_crtc_timing *timing,
 		enum dc_quantization_range *quantization_range);
 
+bool mod_color_is_rgb_full_range_supported_for_timing(
+		const struct dc_sink *sink,
+		const struct dc_crtc_timing *timing);
+
+bool mod_color_is_rgb_limited_range_supported_for_timing(
+		const struct dc_sink *sink,
+		const struct dc_crtc_timing *timing);
+
 #endif /* MOD_COLOR_H_ */
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#13 lore raw

PATCH 12/12 drm/amd/display: create scratch_val_ctx as temp w/a

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I361779eff9f07723308793fcf31e9ddcc528298d
---
 drivers/gpu/drm/amd/display/dc/core/dc.c     | 5 ++++-
 drivers/gpu/drm/amd/display/dc/inc/core_dc.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +4 -1
index 70dc70685471..a3c5def507a9 100644
@@ -452,6 +452,8 @@ static void destruct(struct core_dc *dc)
 
 	dm_free(dc->temp_flip_context);
 	dc->temp_flip_context = NULL;
+	dm_free(dc->scratch_val_ctx);
+	dc->scratch_val_ctx = NULL;
 
 	destroy_links(dc);
 
@@ -490,6 +492,7 @@ static bool construct(struct core_dc *dc,
 
 	dc->current_context = dm_alloc(sizeof(*dc->current_context));
 	dc->temp_flip_context = dm_alloc(sizeof(*dc->temp_flip_context));
+	dc->scratch_val_ctx = dm_alloc(sizeof(*dc->temp_flip_context));
 
 	if (!dc->current_context || !dc->temp_flip_context) {
 		dm_error("%s: failed to create validate ctx\n", __func__);
@@ -1217,7 +1220,7 @@ bool dc_pre_update_surfaces_to_target(
 			goto unexpected_fail;
 		}
 		resource_validate_ctx_destruct(context);
-		dm_free(context);
+		core_dc->scratch_val_ctx = context;
 		context = temp_context;
 	}
 
drivers/gpu/drm/amd/display/dc/inc/core_dc.h +1 -0
index 7d6dc8ea75ab..b5a5207a4df0 100644
@@ -24,6 +24,7 @@ struct core_dc {
 	/* TODO: determine max number of targets*/
 	struct validate_context *current_context;
 	struct validate_context *temp_flip_context;
+	struct validate_context *scratch_val_ctx;
 	struct resource_pool *res_pool;
 
 	/*Power State*/
Signature · 6 lines
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Acked-by Alex Deucher
#14 lore raw
In reply to a message not in the archive
Quoted 11 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Harry Wentland
Sent: Tuesday, December 06, 2016 1:35 PM
To: [email protected]
Cc: Wentland, Harry
Subject: [PATCH 00/12] DC Patches for Dec 5, 2016

* larger rework of display_clock code to facilitate sharing between ASIC generations
* some small bug fixes

Nice cleanup. Patches are:

Quoted 63 lines

Dmytro Laktyushkin (10):
drm/amd/display: remove dead display clock code drm/amd/display: restyle display clock calls part 1 drm/amd/display: restyle display clock calls part 2 drm/amd/display: remove store clock state drm/amd/display: remove get_min_clocks_state drm/amd/display: remove clocks_state enum drm/amd/display: consolidate dce8-11.2 display clock code drm/amd/display: add newline to generic_reg_wait timeout message drm/amd/display: fix display clock integrated info read drm/amd/display: create scratch_val_ctx as temp w/a

Wenjing Liu (1):
drm/amd/display: use rgb full range as default quantization for non
HDMI

Yongqiang Sun (1):
drm/amd/display: Add missing GRPH register definition

 drivers/gpu/drm/amd/display/dc/core/dc.c           |    9 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      |   13 +-
 drivers/gpu/drm/amd/display/dc/dc_helper.c         |    2 +-
 drivers/gpu/drm/amd/display/dc/dce/Makefile        |    3 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_audio.c     |    4 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c    |  519 ++++++++++
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.h    |  133 +++
 drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.h |    1 +
 .../drm/amd/display/dc/dce100/dce100_resource.c    |   31 +-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |   65 +-
 .../drm/amd/display/dc/dce110/dce110_resource.c    |   74 +-
 .../drm/amd/display/dc/dce110/dce110_resource.h    |    3 -
 .../drm/amd/display/dc/dce112/dce112_resource.c    |   37 +-
 .../gpu/drm/amd/display/dc/dce80/dce80_resource.c  |   76 +-
 drivers/gpu/drm/amd/display/dc/dm_services_types.h |   18 +-
 drivers/gpu/drm/amd/display/dc/gpu/Makefile        |   17 +-
 .../display/dc/gpu/dce110/display_clock_dce110.c   | 1035 --------------------
 .../display/dc/gpu/dce110/display_clock_dce110.h   |   53 -
 .../display/dc/gpu/dce112/display_clock_dce112.c   |  717 +-------------
 .../display/dc/gpu/dce112/display_clock_dce112.h   |   39 +-
 .../amd/display/dc/gpu/dce80/display_clock_dce80.c |  934 ------------------
 .../amd/display/dc/gpu/dce80/display_clock_dce80.h |   57 --
 drivers/gpu/drm/amd/display/dc/gpu/display_clock.c |  217 ----
 drivers/gpu/drm/amd/display/dc/gpu/display_clock.h |   89 --
 drivers/gpu/drm/amd/display/dc/inc/core_dc.h       |    1 +
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |    2 -
 .../amd/display/include/display_clock_interface.h  |  149 +--
 drivers/gpu/drm/amd/display/modules/color/color.c  |   88 +-
 .../gpu/drm/amd/display/modules/inc/mod_color.h    |   12 +-
 29 files changed, 920 insertions(+), 3478 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.h
 delete mode 100644
drivers/gpu/drm/amd/display/dc/gpu/dce110/display_clock_dce110.c
 delete mode 100644
drivers/gpu/drm/amd/display/dc/gpu/dce110/display_clock_dce110.h
 delete mode 100644
drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.c
 delete mode 100644
drivers/gpu/drm/amd/display/dc/gpu/dce80/display_clock_dce80.h
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpu/display_clock.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/gpu/display_clock.h
Quoted 7 lines

--
2.9.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx