Skip to contentSkip to conversation

DC Patches Jan 11, 2017

PATCH In review Harry Wentland 2 participants 13 messages Jan 11, 2017 3 messages not in the archive

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

cover DC Patches Jan 11, 2017

* bunch of fixes, including for Polaris 12
* some cleanup, in particular to use HDMI header for HDMI defines

Harry

Arindam Nath (1):
drm/amd/display: fix cursor disappearing after resume

Dave Airlie (2):
drm/amd/display: drop min/max wrappers
drm/amd/display: start using linux hdmi header

Ding Wang (1):
drm/amd/display: Use DTO as clock on DP if not

Hersen Wu (1):
drm/amd/display: set blank functionality

Joshua Aberback (3):
drm/amd/display: When signal type of sink is none, use link type for
stream
drm/amd/display: Support 64-bit Polaris11 5k VSR drm/amd/display: Add Polaris12 to bw_calc

Leon Elazar (1):
drm/amd/display: blank mechanism for supporting MPO

Yongqiang Sun (1):
drm/amd/display: Pass visible flag into surface programming

 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 38 ++++++++++++++
 .../gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c | 40 ++++++++++++---
 drivers/gpu/drm/amd/display/dc/core/dc.c           |  6 +--
 .../gpu/drm/amd/display/dc/core/dc_hw_sequencer.c  | 20 ++++++++
 drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 25 +++++++++
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  | 39 +++++++-------
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c    |  4 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c |  3 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.h |  3 +-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 60 +++++++++++++++++-----
 .../drm/amd/display/dc/dce110/dce110_mem_input.h   |  3 +-
 .../drm/amd/display/dc/dce110/dce110_mem_input_v.c |  3 +-
 .../drm/amd/display/dc/dce110/dce110_mem_input_v.h |  3 +-
 .../drm/amd/display/dc/dce110/dce110_resource.c    |  5 +-
 .../display/dc/dce110/dce110_timing_generator.c    | 28 +---------
 .../display/dc/dce110/dce110_timing_generator.h    |  2 +-
 .../display/dc/dce110/dce110_timing_generator_v.c  | 39 ++------------
 .../drm/amd/display/dc/dce112/dce112_resource.c    |  2 +-
 .../gpu/drm/amd/display/dc/inc/bandwidth_calcs.h   |  2 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h  |  3 +-
 .../drm/amd/display/dc/inc/hw/timing_generator.h   |  2 +-
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |  3 ++
 drivers/gpu/drm/amd/display/dc/os_types.h          |  2 -
 .../gpu/drm/amd/display/include/set_mode_types.h   | 22 +-------
 24 files changed, 213 insertions(+), 144 deletions(-)
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): 20170111181125.10537-1-harry.wentland-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/10 drm/amd/display: fix cursor disappearing after resume

From: Arindam Nath <[email protected]>

Since during suspend, the cursor registers are cleared, once the system resumes back, the cursor remains disabled. cursor_set_attributes() only sets the cursor attributes along with cursor size and surface address, but does not enable the cursor back on.

We need to save the current cursor location so that we can resume back to the same location. This is done in dm_crtc_cursor_move(), where we save the current cursor location into cursor_x and cursor_y. Later during resume we use these same values to set the cursor position along with cursor attributes.

Change-Id Iff92138e721fd6e1fa9aa0a58d4d116d4578a3f8
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 38 ++++++++++++++++++++++
 1 file changed, 38 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +38 -0
index 09e705d37084..479c7c4891d5 100644
@@ -80,6 +80,11 @@ static void dm_set_cursor(
 	uint32_t height)
 {
 	struct dc_cursor_attributes attributes;
+	struct dc_cursor_position position;
+	struct drm_crtc *crtc = &amdgpu_crtc->base;
+	int x, y;
+	int xorigin = 0, yorigin = 0;
+
 	amdgpu_crtc->cursor_width = width;
 	amdgpu_crtc->cursor_height = height;
 
@@ -93,11 +98,41 @@ static void dm_set_cursor(
 	attributes.rotation_angle    = 0;
 	attributes.attribute_flags.value = 0;
 
+	x = amdgpu_crtc->cursor_x;
+	y = amdgpu_crtc->cursor_y;
+
+	/* avivo cursor are offset into the total surface */
+	x += crtc->primary->state->src_x >> 16;
+	y += crtc->primary->state->src_y >> 16;
+
+	if (x < 0) {
+		xorigin = min(-x, amdgpu_crtc->max_cursor_width - 1);
+		x = 0;
+	}
+	if (y < 0) {
+		yorigin = min(-y, amdgpu_crtc->max_cursor_height - 1);
+		y = 0;
+	}
+
+	position.enable = true;
+	position.x = x;
+	position.y = y;
+
+	position.hot_spot_enable = true;
+	position.x_hotspot = xorigin;
+	position.y_hotspot = yorigin;
+
 	if (!dc_target_set_cursor_attributes(
 				amdgpu_crtc->target,
 				&attributes)) {
 		DRM_ERROR("DC failed to set cursor attributes\n");
 	}
+
+	if (!dc_target_set_cursor_position(
+				amdgpu_crtc->target,
+				&position)) {
+		DRM_ERROR("DC failed to set cursor position\n");
+	}
 }
 
 static int dm_crtc_unpin_cursor_bo_old(
@@ -276,6 +311,9 @@ static int dm_crtc_cursor_move(struct drm_crtc *crtc,
 	int xorigin = 0, yorigin = 0;
 	struct dc_cursor_position position;
 
+	amdgpu_crtc->cursor_x = x;
+	amdgpu_crtc->cursor_y = y;
+
 	/* avivo cursor are offset into the total surface */
 	x += crtc->primary->state->src_x >> 16;
 	y += crtc->primary->state->src_y >> 16;
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/10 drm/amd/display: blank mechanism for supporting MPO

In reply to a message not in the archive

From: Leon Elazar <[email protected]>

blank/unblanck functionality apply_ctx_for_surface will update planes visibility by manipulating Blender and CRTC HW modules.

Change-Id I0fa0b46cb36de203b07af7a846a740e81fda6233
---
 drivers/gpu/drm/amd/display/dc/core/dc.c           |  4 ---
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 42 +++++++++++++++++++---
 2 files changed, 37 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +0 -4
index 25e7d7bc282b..2277f9bf4bb1 100644
@@ -1246,10 +1246,6 @@ bool dc_pre_update_surfaces_to_target(
 					core_dc,
 					&context->res_ctx.pipe_ctx[j],
 					context);
-
-			if (!new_surfaces[i]->visible)
-				context->res_ctx.pipe_ctx[j].tg->funcs->set_blank(
-						context->res_ctx.pipe_ctx[j].tg, true);
 		}
 
 unexpected_fail:
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +37 -5

71 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/10 drm/amd/display: set blank functionality

In reply to a message not in the archive

From: Hersen Wu <[email protected]>

1. remove the sleep mechanism while set_blank true from the timing generator.
Since Hw sequencer is the one that manages the flow
he will be responsible for wait for blanck in a critical places.

Change-Id Idd2136fced775b5c9012c4034a6ee1306fce0945
---
 .../gpu/drm/amd/display/dc/core/dc_hw_sequencer.c  | 20 +++++++++++
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 12 +++----
 .../display/dc/dce110/dce110_timing_generator.c    | 28 +---------------
 .../display/dc/dce110/dce110_timing_generator.h    |  2 +-
 .../display/dc/dce110/dce110_timing_generator_v.c  | 39 +++-------------------
 .../drm/amd/display/dc/inc/hw/timing_generator.h   |  2 +-
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |  3 ++
 7 files changed, 37 insertions(+), 69 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_hw_sequencer.c +20 -0
index d5cffa51ca96..9f462a299ff3 100644
@@ -91,3 +91,23 @@ void color_space_to_black_color(
 		break;
 	}
 }
+
+bool hwss_wait_for_blank_complete(
+		struct timing_generator *tg)
+{
+	int counter;
+
+	for (counter = 0; counter < 100; counter++) {
+		if (tg->funcs->is_blanked(tg))
+			break;
+
+		msleep(1);
+	}
+
+	if (counter == 100) {
+		dm_error("DC: failed to blank crtc!\n");
+		return false;
+	}
+
+	return true;
+}
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +6 -6
index 7c27a820e5be..965e47a5acfa 100644
@@ -623,7 +623,7 @@ static void program_scaler(const struct core_dc *dc,
 		&pipe_ctx->scl_data);
 }
 
-static enum dc_status prog_pixclk_crtc_otg(
+static enum dc_status dce110_prog_pixclk_crtc_otg(
 		struct pipe_ctx *pipe_ctx,
 		struct validate_context *context,
 		struct core_dc *dc)
@@ -641,6 +641,7 @@ static enum dc_status prog_pixclk_crtc_otg(
 		pipe_ctx->tg->funcs->set_blank_color(
 				pipe_ctx->tg,
 				&black_color);
+
 		/*
 		 * Must blank CRTC after disabling power gating and before any
 		 * programming, otherwise CRTC will be hung in bad state
@@ -1047,7 +1048,8 @@ static void reset_single_pipe_hw_ctx(
 		struct validate_context *context)
 {
 	core_link_disable_stream(pipe_ctx);
-	if (!pipe_ctx->tg->funcs->set_blank(pipe_ctx->tg, true)) {
+	pipe_ctx->tg->funcs->set_blank(pipe_ctx->tg, true);
+	if (!hwss_wait_for_blank_complete(pipe_ctx->tg)) {
 		dm_error("DC: failed to blank crtc!\n");
 		BREAK_TO_DEBUGGER();
 	}
@@ -1560,9 +1562,6 @@ static void update_plane_addr(const struct core_dc *dc,
 			surface->public.flip_immediate);
 
 	surface->status.requested_address = surface->public.address;
-
-	if (surface->public.visible)
-		pipe_ctx->tg->funcs->set_blank(pipe_ctx->tg, false);
 }
 
 void dce110_update_pending_status(struct pipe_ctx *pipe_ctx)
@@ -1718,6 +1717,7 @@ static void init_hw(struct core_dc *dc)
 		/* Blank controller using driver code instead of
 		 * command table. */
 		tg->funcs->set_blank(tg, true);
+		hwss_wait_for_blank_complete(tg);
 	}
 
 	for (i = 0; i < dc->res_pool->audio_count; i++) {
@@ -2002,7 +2002,7 @@ static const struct hw_sequencer_funcs dce110_funcs = {
 	.set_drr = set_drr,
 	.set_static_screen_control = set_static_screen_control,
 	.reset_hw_ctx_wrap = reset_hw_ctx_wrap,
-	.prog_pixclk_crtc_otg = prog_pixclk_crtc_otg,
+	.prog_pixclk_crtc_otg = dce110_prog_pixclk_crtc_otg,
 };
 
 bool dce110_hw_sequencer_construct(struct core_dc *dc)
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c +1 -27
index e70704d1ba87..f4b8576a0546 100644
@@ -1808,7 +1808,7 @@ bool dce110_tg_is_blanked(struct timing_generator *tg)
 	return false;
 }
 
-bool dce110_tg_set_blank(struct timing_generator *tg,
+void dce110_tg_set_blank(struct timing_generator *tg,
 		bool enable_blanking)
 {
 	struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
@@ -1824,8 +1824,6 @@ bool dce110_tg_set_blank(struct timing_generator *tg,
 	value = 0;
 
 	if (enable_blanking) {
-		int counter;
-
 		set_reg_field_value(
 			value,
 			1,
@@ -1834,32 +1832,8 @@ bool dce110_tg_set_blank(struct timing_generator *tg,
 
 		dm_write_reg(tg->ctx, CRTC_REG(mmCRTC_BLANK_CONTROL), value);
 
-		for (counter = 0; counter < 100; counter++) {
-			value = dm_read_reg(tg->ctx, CRTC_REG(mmCRTC_BLANK_CONTROL));
-
-			if (get_reg_field_value(
-				value,
-				CRTC_BLANK_CONTROL,
-				CRTC_BLANK_DATA_EN) == 1 &&
-				get_reg_field_value(
-				value,
-				CRTC_BLANK_CONTROL,
-				CRTC_CURRENT_BLANK_STATE) == 1)
-				break;
-
-			msleep(1);
-		}
-
-		if (counter == 100) {
-			dm_logger_write(tg->ctx->logger, LOG_ERROR,
-					"timing generator %d blank timing out.\n",
-					tg110->controller_id);
-			return false;
-		}
 	} else
 		dm_write_reg(tg->ctx, CRTC_REG(mmCRTC_BLANK_CONTROL), 0);
-
-	return true;
 }
 
 bool dce110_tg_validate_timing(struct timing_generator *tg,
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.h +1 -1
index 39906502ad5c..dcb49fe452c5 100644
@@ -257,7 +257,7 @@ void dce110_tg_program_timing(struct timing_generator *tg,
 
 bool dce110_tg_is_blanked(struct timing_generator *tg);
 
-bool dce110_tg_set_blank(struct timing_generator *tg,
+void dce110_tg_set_blank(struct timing_generator *tg,
 		bool enable_blanking);
 
 bool dce110_tg_validate_timing(struct timing_generator *tg,
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator_v.c +5 -34
index 3bf3179e07c5..682a3de7ba48 100644
@@ -72,12 +72,11 @@ static bool dce110_timing_generator_v_disable_crtc(struct timing_generator *tg)
 	return true;
 }
 
-static bool dce110_timing_generator_v_blank_crtc(struct timing_generator *tg)
+static void dce110_timing_generator_v_blank_crtc(struct timing_generator *tg)
 {
 	struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
 	uint32_t addr = mmCRTCV_BLANK_CONTROL;
 	uint32_t value = dm_read_reg(tg->ctx, addr);
-	uint8_t counter = 100;
 
 	set_reg_field_value(
 		value,
@@ -92,35 +91,9 @@ static bool dce110_timing_generator_v_blank_crtc(struct timing_generator *tg)
 		CRTC_BLANK_DE_MODE);
 
 	dm_write_reg(tg->ctx, addr, value);
-
-	while (counter > 0) {
-		value = dm_read_reg(tg->ctx, addr);
-
-		if (get_reg_field_value(
-			value,
-			CRTCV_BLANK_CONTROL,
-			CRTC_BLANK_DATA_EN) == 1 &&
-			get_reg_field_value(
-			value,
-			CRTCV_BLANK_CONTROL,
-			CRTC_CURRENT_BLANK_STATE) == 1)
-			break;
-
-		msleep(1);
-		counter--;
-	}
-
-	if (!counter) {
-		dm_logger_write(tg->ctx->logger, LOG_ERROR,
-				"timing generator %d blank timing out.\n",
-				tg110->controller_id);
-		return false;
-	}
-
-	return true;
 }
 
-static bool dce110_timing_generator_v_unblank_crtc(struct timing_generator *tg)
+static void dce110_timing_generator_v_unblank_crtc(struct timing_generator *tg)
 {
 	uint32_t addr = mmCRTCV_BLANK_CONTROL;
 	uint32_t value = dm_read_reg(tg->ctx, addr);
@@ -138,8 +111,6 @@ static bool dce110_timing_generator_v_unblank_crtc(struct timing_generator *tg)
 		CRTC_BLANK_DE_MODE);
 
 	dm_write_reg(tg->ctx, addr, value);
-
-	return true;
 }
 
 static bool dce110_timing_generator_v_is_in_vertical_blank(
@@ -429,13 +400,13 @@ static void dce110_timing_generator_v_enable_advanced_request(
 	dm_write_reg(tg->ctx, addr, value);
 }
 
-static bool dce110_timing_generator_v_set_blank(struct timing_generator *tg,
+static void dce110_timing_generator_v_set_blank(struct timing_generator *tg,
 		bool enable_blanking)
 {
 	if (enable_blanking)
-		return dce110_timing_generator_v_blank_crtc(tg);
+		dce110_timing_generator_v_blank_crtc(tg);
 	else
-		return dce110_timing_generator_v_unblank_crtc(tg);
+		dce110_timing_generator_v_unblank_crtc(tg);
 }
 
 static void dce110_timing_generator_v_program_timing(struct timing_generator *tg,
drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h +1 -1
index 6ac609f6f89f..baa9445833fb 100644
@@ -129,7 +129,7 @@ struct timing_generator_funcs {
 							   uint32_t early_cntl);
 	void (*wait_for_state)(struct timing_generator *tg,
 							enum crtc_state state);
-	bool (*set_blank)(struct timing_generator *tg,
+	void (*set_blank)(struct timing_generator *tg,
 					bool enable_blanking);
 	bool (*is_blanked)(struct timing_generator *tg);
 	void (*set_overscan_blank_color) (struct timing_generator *tg, const struct tg_color *color);
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +3 -0
index 895c446cebf9..562c8978fe9c 100644
@@ -151,4 +151,7 @@ void color_space_to_black_color(
 	enum dc_color_space colorspace,
 	struct tg_color *black_color);
 
+bool hwss_wait_for_blank_complete(
+		struct timing_generator *tg);
+
 #endif /* __DC_HW_SEQUENCER_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/10 drm/amd/display: When signal type of sink is none, use link type for stream

In reply to a message not in the archive

From: Joshua Aberback <[email protected]>

Change-Id If711bd494fcece078ef9c09eb542b510dcd68885
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +11 -10
index a82f2d6ea80f..59770bc9c8fe 100644
@@ -984,19 +984,20 @@ static void update_stream_signal(struct core_stream *stream)
 {
 	const struct dc_sink *dc_sink = stream->public.sink;
 
-	stream->signal = dc_sink->sink_signal;
-	/* For asic supports dual link DVI, we should adjust signal type
-	 * based on timing pixel clock. If pixel clock more than 165Mhz,
-	 * signal is dual link, otherwise, single link.
-	 */
-	if (dc_sink->sink_signal == SIGNAL_TYPE_DVI_SINGLE_LINK ||
-			dc_sink->sink_signal == SIGNAL_TYPE_DVI_DUAL_LINK) {
-		if (stream->public.timing.pix_clk_khz >
-						TMDS_MAX_PIXEL_CLOCK_IN_KHZ)
+	if (dc_sink->sink_signal == SIGNAL_TYPE_NONE)
+		stream->signal = stream->sink->link->public.connector_signal;
+	else if (dc_sink->sink_signal == SIGNAL_TYPE_DVI_SINGLE_LINK ||
+			dc_sink->sink_signal == SIGNAL_TYPE_DVI_DUAL_LINK)
+		/* For asic supports dual link DVI, we should adjust signal type
+		 * based on timing pixel clock. If pixel clock more than 165Mhz,
+		 * signal is dual link, otherwise, single link.
+		 */
+		if (stream->public.timing.pix_clk_khz > TMDS_MAX_PIXEL_CLOCK_IN_KHZ)
 			stream->signal = SIGNAL_TYPE_DVI_DUAL_LINK;
 		else
 			stream->signal = SIGNAL_TYPE_DVI_SINGLE_LINK;
-	}
+	else
+		stream->signal = dc_sink->sink_signal;
 }
 
 bool resource_is_stream_unchanged(
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/10 drm/amd/display: Support 64-bit Polaris11 5k VSR

In reply to a message not in the archive

From: Joshua Aberback <[email protected]>

- pass full asic_id info into bw_calc_init instead of only version enum
- 64-bit Polaris11 needs an extra microsecond of dmif_urgent_latency
- add helper to convert from asic_id.family to bw_calc version enum

Change-Id Ie675c6cbb42f345d88ed887992eef8ff7fd73801
---
 .../gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c | 40 ++++++++++++++++++----
 .../drm/amd/display/dc/dce110/dce110_resource.c    |  5 +--
 .../drm/amd/display/dc/dce112/dce112_resource.c    |  2 +-
 .../gpu/drm/amd/display/dc/inc/bandwidth_calcs.h   |  2 +-
 4 files changed, 37 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +34 -6
index 3b0710ef4716..aa187736b534 100644
@@ -27,11 +27,34 @@
 #include "bandwidth_calcs.h"
 #include "dc.h"
 #include "core_types.h"
+#include "dal_asic_id.h"
 
 /*******************************************************************************
  * Private Functions
  ******************************************************************************/
 
+static enum bw_calcs_version bw_calcs_version_from_asic_id(struct hw_asic_id asic_id)
+{
+	switch (asic_id.chip_family) {
+
+	case FAMILY_CZ:
+		if (ASIC_REV_IS_STONEY(asic_id.hw_internal_rev))
+			return BW_CALCS_VERSION_STONEY;
+		return BW_CALCS_VERSION_CARRIZO;
+
+	case FAMILY_VI:
+		if (ASIC_REV_IS_POLARIS10_P(asic_id.hw_internal_rev))
+			// || ASIC_REV_IS_POLARIS12_V(asic_id.hw_internal_rev)
+			return BW_CALCS_VERSION_POLARIS10;
+		if (ASIC_REV_IS_POLARIS11_M(asic_id.hw_internal_rev))
+			return BW_CALCS_VERSION_POLARIS11;
+		return BW_CALCS_VERSION_INVALID;
+
+	default:
+		return BW_CALCS_VERSION_INVALID;
+	}
+}
+
 static void calculate_bandwidth(
 	const struct bw_calcs_dceip *dceip,
 	const struct bw_calcs_vbios *vbios,
@@ -1954,18 +1977,20 @@ static void calculate_bandwidth(
  ******************************************************************************/
 void bw_calcs_init(struct bw_calcs_dceip *bw_dceip,
 	struct bw_calcs_vbios *bw_vbios,
-	enum bw_calcs_version version)
+	struct hw_asic_id asic_id)
 {
 	struct bw_calcs_dceip dceip = { 0 };
 	struct bw_calcs_vbios vbios = { 0 };
 
+	enum bw_calcs_version version = bw_calcs_version_from_asic_id(asic_id);
+
 	dceip.version = version;
 
 	switch (version) {
 	case BW_CALCS_VERSION_CARRIZO:
 		vbios.memory_type = bw_def_gddr5;
 		vbios.dram_channel_width_in_bits = 64;
-		vbios.number_of_dram_channels = 2;
+		vbios.number_of_dram_channels = asic_id.vram_width / vbios.dram_channel_width_in_bits;
 		vbios.number_of_dram_banks = 8;
 		vbios.high_yclk = bw_int_to_fixed(1600);
 		vbios.mid_yclk = bw_int_to_fixed(1600);
@@ -2075,7 +2100,7 @@ void bw_calcs_init(struct bw_calcs_dceip *bw_dceip,
 	case BW_CALCS_VERSION_POLARIS10:
 		vbios.memory_type = bw_def_gddr5;
 		vbios.dram_channel_width_in_bits = 32;
-		vbios.number_of_dram_channels = 8;
+		vbios.number_of_dram_channels = asic_id.vram_width / vbios.dram_channel_width_in_bits;
 		vbios.number_of_dram_banks = 8;
 		vbios.high_yclk = bw_int_to_fixed(6000);
 		vbios.mid_yclk = bw_int_to_fixed(3200);
@@ -2185,7 +2210,7 @@ void bw_calcs_init(struct bw_calcs_dceip *bw_dceip,
 	case BW_CALCS_VERSION_POLARIS11:
 		vbios.memory_type = bw_def_gddr5;
 		vbios.dram_channel_width_in_bits = 32;
-		vbios.number_of_dram_channels = 4;
+		vbios.number_of_dram_channels = asic_id.vram_width / vbios.dram_channel_width_in_bits;
 		vbios.number_of_dram_banks = 8;
 		vbios.high_yclk = bw_int_to_fixed(6000);
 		vbios.mid_yclk = bw_int_to_fixed(3200);
@@ -2206,7 +2231,10 @@ void bw_calcs_init(struct bw_calcs_dceip *bw_dceip,
 		vbios.high_voltage_max_phyclk = bw_int_to_fixed(810);
 		vbios.data_return_bus_width = bw_int_to_fixed(32);
 		vbios.trc = bw_int_to_fixed(48);
-		vbios.dmifmc_urgent_latency = bw_int_to_fixed(3);
+		if (vbios.number_of_dram_channels == 2) // 64-bit
+			vbios.dmifmc_urgent_latency = bw_int_to_fixed(4);
+		else
+			vbios.dmifmc_urgent_latency = bw_int_to_fixed(3);
 		vbios.stutter_self_refresh_exit_latency = bw_int_to_fixed(5);
 		vbios.stutter_self_refresh_entry_latency = bw_int_to_fixed(0);
 		vbios.nbp_state_change_latency = bw_int_to_fixed(45);
@@ -2295,7 +2323,7 @@ void bw_calcs_init(struct bw_calcs_dceip *bw_dceip,
 	case BW_CALCS_VERSION_STONEY:
 		vbios.memory_type = bw_def_gddr5;
 		vbios.dram_channel_width_in_bits = 64;
-		vbios.number_of_dram_channels = 1;
+		vbios.number_of_dram_channels = asic_id.vram_width / vbios.dram_channel_width_in_bits;
 		vbios.number_of_dram_banks = 8;
 		vbios.high_yclk = bw_int_to_fixed(1866);
 		vbios.mid_yclk = bw_int_to_fixed(1866);
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +1 -4
index ae90da8c1b8c..968ee99003fc 100644
@@ -1349,10 +1349,7 @@ static bool construct(
 	if (!dce110_hw_sequencer_construct(dc))
 		goto res_create_fail;
 
-	if (ASIC_REV_IS_STONEY(ctx->asic_id.hw_internal_rev))
-		bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, BW_CALCS_VERSION_STONEY);
-	else
-		bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, BW_CALCS_VERSION_CARRIZO);
+	bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id);
 
 	bw_calcs_data_update_from_pplib(dc);
 
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +1 -1
index c63030e9f515..7fca2eb188cf 100644
@@ -1394,7 +1394,7 @@ static bool construct(
 	if (!dce112_hw_sequencer_construct(dc))
 		goto res_create_fail;
 
-	bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, BW_CALCS_VERSION_POLARIS11);
+	bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id);
 
 	bw_calcs_data_update_from_pplib(dc);
 
drivers/gpu/drm/amd/display/dc/inc/bandwidth_calcs.h +1 -1
index f9b871b6199b..16f06fa2d69c 100644
@@ -483,7 +483,7 @@ struct bw_calcs_output {
 void bw_calcs_init(
 	struct bw_calcs_dceip *bw_dceip,
 	struct bw_calcs_vbios *bw_vbios,
-	enum bw_calcs_version version);
+	struct hw_asic_id asic_id);
 
 /**
  * Return:
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): 20170111181125.10537-6-harry.wentland-5C7GfCeVMHo@public.gmane.org

#8 lore raw

RE: [PATCH 05/10] drm/amd/display: Support 64-bit Polaris11 5k VSR

Quoted 58 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Harry Wentland
Sent: Wednesday, January 11, 2017 1:11 PM
To: [email protected]
Cc: Aberback, Joshua
Subject: [PATCH 05/10] drm/amd/display: Support 64-bit Polaris11 5k VSR

From: Joshua Aberback <[email protected]>

- pass full asic_id info into bw_calc_init instead of only version enum
- 64-bit Polaris11 needs an extra microsecond of dmif_urgent_latency
- add helper to convert from asic_id.family to bw_calc version enum

Change-Id Ie675c6cbb42f345d88ed887992eef8ff7fd73801
---
 .../gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c | 40
++++++++++++++++++----
 .../drm/amd/display/dc/dce110/dce110_resource.c    |  5 +--
 .../drm/amd/display/dc/dce112/dce112_resource.c    |  2 +-
 .../gpu/drm/amd/display/dc/inc/bandwidth_calcs.h   |  2 +-
 4 files changed, 37 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +2 -0
index 3b0710ef4716..aa187736b534 100644
@@ -27,11 +27,34 @@
 #include "bandwidth_calcs.h"
 #include "dc.h"
 #include "core_types.h"
+#include "dal_asic_id.h"
 
 
 /**********************************************************
 *********************
  * Private Functions
 
 **********************************************************
 ********************/
 
+static enum bw_calcs_version bw_calcs_version_from_asic_id(struct

hw_asic_id asic_id)

drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +11 -0
+{
+	switch (asic_id.chip_family) {
+
+	case FAMILY_CZ:
+		if (ASIC_REV_IS_STONEY(asic_id.hw_internal_rev))
+			return BW_CALCS_VERSION_STONEY;
+		return BW_CALCS_VERSION_CARRIZO;
+
+	case FAMILY_VI:
+		if (ASIC_REV_IS_POLARIS10_P(asic_id.hw_internal_rev))
+			// ||
Quoted 1 line

ASIC_REV_IS_POLARIS12_V(asic_id.hw_internal_rev)

Polaris 12 code should be enabled at this point.

Alex

Quoted 139 lines
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +14 -2
+			return BW_CALCS_VERSION_POLARIS10;
+		if (ASIC_REV_IS_POLARIS11_M(asic_id.hw_internal_rev))
+			return BW_CALCS_VERSION_POLARIS11;
+		return BW_CALCS_VERSION_INVALID;
+
+	default:
+		return BW_CALCS_VERSION_INVALID;
+	}
+}
+
 static void calculate_bandwidth(
 	const struct bw_calcs_dceip *dceip,
 	const struct bw_calcs_vbios *vbios,
@@ -1954,18 +1977,20 @@ static void calculate_bandwidth(
 
 **********************************************************
 ********************/
 void bw_calcs_init(struct bw_calcs_dceip *bw_dceip,
 	struct bw_calcs_vbios *bw_vbios,
-	enum bw_calcs_version version)
+	struct hw_asic_id asic_id)
 {
 	struct bw_calcs_dceip dceip = { 0 };
 	struct bw_calcs_vbios vbios = { 0 };
 
+	enum bw_calcs_version version =
 bw_calcs_version_from_asic_id(asic_id);
+
 	dceip.version = version;
 
 	switch (version) {
 	case BW_CALCS_VERSION_CARRIZO:
 		vbios.memory_type = bw_def_gddr5;
 		vbios.dram_channel_width_in_bits = 64;
-		vbios.number_of_dram_channels = 2;
+		vbios.number_of_dram_channels = asic_id.vram_width /

vbios.dram_channel_width_in_bits;

drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +1 -1
 		vbios.number_of_dram_banks = 8;
 		vbios.high_yclk = bw_int_to_fixed(1600);
 		vbios.mid_yclk = bw_int_to_fixed(1600);
@@ -2075,7 +2100,7 @@ void bw_calcs_init(struct bw_calcs_dceip
 *bw_dceip,
 	case BW_CALCS_VERSION_POLARIS10:
 		vbios.memory_type = bw_def_gddr5;
 		vbios.dram_channel_width_in_bits = 32;
-		vbios.number_of_dram_channels = 8;
+		vbios.number_of_dram_channels = asic_id.vram_width /
 vbios.dram_channel_width_in_bits;
 		vbios.number_of_dram_banks = 8;
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +1 -1
 		vbios.high_yclk = bw_int_to_fixed(6000);
 		vbios.mid_yclk = bw_int_to_fixed(3200);
@@ -2185,7 +2210,7 @@ void bw_calcs_init(struct bw_calcs_dceip
 *bw_dceip,
 	case BW_CALCS_VERSION_POLARIS11:
 		vbios.memory_type = bw_def_gddr5;
 		vbios.dram_channel_width_in_bits = 32;
-		vbios.number_of_dram_channels = 4;
+		vbios.number_of_dram_channels = asic_id.vram_width /
 vbios.dram_channel_width_in_bits;
 		vbios.number_of_dram_banks = 8;
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +4 -1
 		vbios.high_yclk = bw_int_to_fixed(6000);
 		vbios.mid_yclk = bw_int_to_fixed(3200);
@@ -2206,7 +2231,10 @@ void bw_calcs_init(struct bw_calcs_dceip
 *bw_dceip,
 		vbios.high_voltage_max_phyclk = bw_int_to_fixed(810);
 		vbios.data_return_bus_width = bw_int_to_fixed(32);
 		vbios.trc = bw_int_to_fixed(48);
-		vbios.dmifmc_urgent_latency = bw_int_to_fixed(3);
+		if (vbios.number_of_dram_channels == 2) // 64-bit
+			vbios.dmifmc_urgent_latency = bw_int_to_fixed(4);
+		else
+			vbios.dmifmc_urgent_latency = bw_int_to_fixed(3);
 		vbios.stutter_self_refresh_exit_latency =
 bw_int_to_fixed(5);

vbios.stutter_self_refresh_entry_latency =
bw_int_to_fixed(0);

drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +1 -1
 		vbios.nbp_state_change_latency = bw_int_to_fixed(45);
@@ -2295,7 +2323,7 @@ void bw_calcs_init(struct bw_calcs_dceip
 *bw_dceip,
 	case BW_CALCS_VERSION_STONEY:
 		vbios.memory_type = bw_def_gddr5;
 		vbios.dram_channel_width_in_bits = 64;
-		vbios.number_of_dram_channels = 1;
+		vbios.number_of_dram_channels = asic_id.vram_width /
 vbios.dram_channel_width_in_bits;
 		vbios.number_of_dram_banks = 8;
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +0 -0
 		vbios.high_yclk = bw_int_to_fixed(1866);
 		vbios.mid_yclk = bw_int_to_fixed(1866);
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +1 -4
index ae90da8c1b8c..968ee99003fc 100644
@@ -1349,10 +1349,7 @@ static bool construct(
 	if (!dce110_hw_sequencer_construct(dc))
 		goto res_create_fail;
 
-	if (ASIC_REV_IS_STONEY(ctx->asic_id.hw_internal_rev))
-		bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios,
 BW_CALCS_VERSION_STONEY);
-	else
-		bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios,
 BW_CALCS_VERSION_CARRIZO);
+	bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id);
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +0 -0
 	bw_calcs_data_update_from_pplib(dc);
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +1 -1
index c63030e9f515..7fca2eb188cf 100644
@@ -1394,7 +1394,7 @@ static bool construct(
 	if (!dce112_hw_sequencer_construct(dc))
 		goto res_create_fail;
 
-	bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios,
 BW_CALCS_VERSION_POLARIS11);
+	bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id);
 
 	bw_calcs_data_update_from_pplib(dc);
drivers/gpu/drm/amd/display/dc/inc/bandwidth_calcs.h +1 -2
index f9b871b6199b..16f06fa2d69c 100644
@@ -483,7 +483,7 @@ struct bw_calcs_output {
 void bw_calcs_init(
 	struct bw_calcs_dceip *bw_dceip,
 	struct bw_calcs_vbios *bw_vbios,
-	enum bw_calcs_version version);
+	struct hw_asic_id asic_id);
 
 /**
  * Return:
--

2.9.3

Quoted 4 lines

_______________________________________________
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

A message that is not in the archive (sent off-list or not yet received): BN6PR12MB165291AA82125AE57510AF95F7660-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

#10 lore raw

RE: [PATCH 05/10] drm/amd/display: Support 64-bit Polaris11 5k VSR

Quoted 55 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Deucher, Alexander
Sent: Wednesday, January 11, 2017 2:25 PM
To: Wentland, Harry; [email protected]
Cc: Aberback, Joshua
Subject: RE: [PATCH 05/10] drm/amd/display: Support 64-bit Polaris11 5k VSR

Quoted 32 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Harry Wentland
Sent: Wednesday, January 11, 2017 1:11 PM
To: [email protected]
Cc: Aberback, Joshua
Subject: [PATCH 05/10] drm/amd/display: Support 64-bit Polaris11 5k VSR

From: Joshua Aberback <[email protected]>

- pass full asic_id info into bw_calc_init instead of only version enum
- 64-bit Polaris11 needs an extra microsecond of dmif_urgent_latency
- add helper to convert from asic_id.family to bw_calc version enum

Change-Id Ie675c6cbb42f345d88ed887992eef8ff7fd73801
---
 .../gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c | 40
++++++++++++++++++----
 .../drm/amd/display/dc/dce110/dce110_resource.c    |  5 +--
 .../drm/amd/display/dc/dce112/dce112_resource.c    |  2 +-
 .../gpu/drm/amd/display/dc/inc/bandwidth_calcs.h   |  2 +-
 4 files changed, 37 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +0 -0
index 3b0710ef4716..aa187736b534 100644

drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c line 33

Quoted 7 lines
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +1 -0
@@ -27,11 +27,34 @@
 #include "bandwidth_calcs.h"
 #include "dc.h"
 #include "core_types.h"
+#include "dal_asic_id.h"
 
 
 

/**********************************************************

drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c

Quoted 4 lines
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +0 -0
 *********************
  * Private Functions
 
 

**********************************************************

Quoted 2 lines
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +0 -0
 ********************/
Quoted 16 lines
Quoted 13 lines
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +1 -0
+static enum bw_calcs_version bw_calcs_version_from_asic_id(struct

hw_asic_id asic_id)

drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +11 -0
+{
+	switch (asic_id.chip_family) {
+
+	case FAMILY_CZ:
+		if (ASIC_REV_IS_STONEY(asic_id.hw_internal_rev))
+			return BW_CALCS_VERSION_STONEY;
+		return BW_CALCS_VERSION_CARRIZO;
+
+	case FAMILY_VI:
+		if (ASIC_REV_IS_POLARIS10_P(asic_id.hw_internal_rev))
+			// ||
Quoted 1 line

ASIC_REV_IS_POLARIS12_V(asic_id.hw_internal_rev)

Polaris 12 code should be enabled at this point.

Nevermind, fixed in a later patch.

Alex

Quoted 143 lines

Alex

Quoted 14 lines
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +10 -0
+			return BW_CALCS_VERSION_POLARIS10;
+		if (ASIC_REV_IS_POLARIS11_M(asic_id.hw_internal_rev))
+			return BW_CALCS_VERSION_POLARIS11;
+		return BW_CALCS_VERSION_INVALID;
+
+	default:
+		return BW_CALCS_VERSION_INVALID;
+	}
+}
+
 static void calculate_bandwidth(
 	const struct bw_calcs_dceip *dceip,
 	const struct bw_calcs_vbios *vbios,

drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c static void calculate_bandwidth( · line 1978

Quoted 2 lines
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +0 -0
@@ -1954,18 +1977,20 @@ static void calculate_bandwidth(
 
 

**********************************************************

Quoted 123 lines
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +4 -2
 ********************/
 void bw_calcs_init(struct bw_calcs_dceip *bw_dceip,
 	struct bw_calcs_vbios *bw_vbios,
-	enum bw_calcs_version version)
+	struct hw_asic_id asic_id)
 {
 	struct bw_calcs_dceip dceip = { 0 };
 	struct bw_calcs_vbios vbios = { 0 };
 
+	enum bw_calcs_version version =
 bw_calcs_version_from_asic_id(asic_id);
+
 	dceip.version = version;
 
 	switch (version) {
 	case BW_CALCS_VERSION_CARRIZO:
 		vbios.memory_type = bw_def_gddr5;
 		vbios.dram_channel_width_in_bits = 64;
-		vbios.number_of_dram_channels = 2;
+		vbios.number_of_dram_channels = asic_id.vram_width /

vbios.dram_channel_width_in_bits;

drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +1 -1
 		vbios.number_of_dram_banks = 8;
 		vbios.high_yclk = bw_int_to_fixed(1600);
 		vbios.mid_yclk = bw_int_to_fixed(1600);
@@ -2075,7 +2100,7 @@ void bw_calcs_init(struct bw_calcs_dceip
 *bw_dceip,
 	case BW_CALCS_VERSION_POLARIS10:
 		vbios.memory_type = bw_def_gddr5;
 		vbios.dram_channel_width_in_bits = 32;
-		vbios.number_of_dram_channels = 8;
+		vbios.number_of_dram_channels = asic_id.vram_width /
 vbios.dram_channel_width_in_bits;
 		vbios.number_of_dram_banks = 8;
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +1 -1
 		vbios.high_yclk = bw_int_to_fixed(6000);
 		vbios.mid_yclk = bw_int_to_fixed(3200);
@@ -2185,7 +2210,7 @@ void bw_calcs_init(struct bw_calcs_dceip
 *bw_dceip,
 	case BW_CALCS_VERSION_POLARIS11:
 		vbios.memory_type = bw_def_gddr5;
 		vbios.dram_channel_width_in_bits = 32;
-		vbios.number_of_dram_channels = 4;
+		vbios.number_of_dram_channels = asic_id.vram_width /
 vbios.dram_channel_width_in_bits;
 		vbios.number_of_dram_banks = 8;
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +4 -1
 		vbios.high_yclk = bw_int_to_fixed(6000);
 		vbios.mid_yclk = bw_int_to_fixed(3200);
@@ -2206,7 +2231,10 @@ void bw_calcs_init(struct bw_calcs_dceip
 *bw_dceip,
 		vbios.high_voltage_max_phyclk = bw_int_to_fixed(810);
 		vbios.data_return_bus_width = bw_int_to_fixed(32);
 		vbios.trc = bw_int_to_fixed(48);
-		vbios.dmifmc_urgent_latency = bw_int_to_fixed(3);
+		if (vbios.number_of_dram_channels == 2) // 64-bit
+			vbios.dmifmc_urgent_latency = bw_int_to_fixed(4);
+		else
+			vbios.dmifmc_urgent_latency = bw_int_to_fixed(3);
 		vbios.stutter_self_refresh_exit_latency =
 bw_int_to_fixed(5);

vbios.stutter_self_refresh_entry_latency =
bw_int_to_fixed(0);

drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +1 -1
 		vbios.nbp_state_change_latency = bw_int_to_fixed(45);
@@ -2295,7 +2323,7 @@ void bw_calcs_init(struct bw_calcs_dceip
 *bw_dceip,
 	case BW_CALCS_VERSION_STONEY:
 		vbios.memory_type = bw_def_gddr5;
 		vbios.dram_channel_width_in_bits = 64;
-		vbios.number_of_dram_channels = 1;
+		vbios.number_of_dram_channels = asic_id.vram_width /
 vbios.dram_channel_width_in_bits;
 		vbios.number_of_dram_banks = 8;
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +0 -0
 		vbios.high_yclk = bw_int_to_fixed(1866);
 		vbios.mid_yclk = bw_int_to_fixed(1866);
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +1 -4
index ae90da8c1b8c..968ee99003fc 100644
@@ -1349,10 +1349,7 @@ static bool construct(
 	if (!dce110_hw_sequencer_construct(dc))
 		goto res_create_fail;
 
-	if (ASIC_REV_IS_STONEY(ctx->asic_id.hw_internal_rev))
-		bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios,
 BW_CALCS_VERSION_STONEY);
-	else
-		bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios,
 BW_CALCS_VERSION_CARRIZO);
+	bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id);
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +0 -0
 	bw_calcs_data_update_from_pplib(dc);
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +1 -1
index c63030e9f515..7fca2eb188cf 100644
@@ -1394,7 +1394,7 @@ static bool construct(
 	if (!dce112_hw_sequencer_construct(dc))
 		goto res_create_fail;
 
-	bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios,
 BW_CALCS_VERSION_POLARIS11);
+	bw_calcs_init(&dc->bw_dceip, &dc->bw_vbios, dc->ctx->asic_id);
 
 	bw_calcs_data_update_from_pplib(dc);
drivers/gpu/drm/amd/display/dc/inc/bandwidth_calcs.h +1 -2
index f9b871b6199b..16f06fa2d69c 100644
@@ -483,7 +483,7 @@ struct bw_calcs_output {
 void bw_calcs_init(
 	struct bw_calcs_dceip *bw_dceip,
 	struct bw_calcs_vbios *bw_vbios,
-	enum bw_calcs_version version);
+	struct hw_asic_id asic_id);
 
 /**
  * Return:
--

2.9.3

Quoted 8 lines
Quoted 4 lines

_______________________________________________
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

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

#11 lore raw

PATCH 6/10 drm/amd/display: drop min/max wrappers

In reply to a message not in the archive

From: Dave Airlie <[email protected]>

These aren't needed, and aren't really used in too many places.

Change-Id I1a52c694d6d8a84f5756fed4f60f295173cba6b5
---
 drivers/gpu/drm/amd/display/dc/core/dc.c        | 2 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c | 4 ++--
 drivers/gpu/drm/amd/display/dc/os_types.h       | 2 --
 3 files changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +1 -1
index 2277f9bf4bb1..a7348573ebca 100644
@@ -634,7 +634,7 @@ struct dc *dc_create(const struct dc_init_data *init_params)
 	full_pipe_count = core_dc->res_pool->pipe_count;
 	if (core_dc->res_pool->underlay_pipe_index >= 0)
 		full_pipe_count--;
-	core_dc->public.caps.max_targets = dm_min(
+	core_dc->public.caps.max_targets = min(
 			full_pipe_count,
 			core_dc->res_pool->stream_enc_count);
 
drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c +2 -2
index 262612061c68..dd922bdcc145 100644
@@ -289,7 +289,7 @@ static void dce_set_clock(
 
 	/* Make sure requested clock isn't lower than minimum threshold*/
 	if (requested_clk_khz > 0)
-		requested_clk_khz = dm_max(requested_clk_khz,
+		requested_clk_khz = max(requested_clk_khz,
 				clk_dce->dentist_vco_freq_khz / 64);
 
 	/* Prepare to program display clock*/
@@ -364,7 +364,7 @@ static void dce112_set_clock(
 
 	/* Make sure requested clock isn't lower than minimum threshold*/
 	if (requested_clk_khz > 0)
-		requested_clk_khz = dm_max(requested_clk_khz,
+		requested_clk_khz = max(requested_clk_khz,
 				clk_dce->dentist_vco_freq_khz / 62);
 
 	dce_clk_params.target_clock_frequency = requested_clk_khz;
drivers/gpu/drm/amd/display/dc/os_types.h +0 -2
index 7f0c282a1466..27ed2a61c3c8 100644
@@ -52,8 +52,6 @@
 
 #define dm_vlog(fmt, args) vprintk(fmt, args)
 
-#define dm_min(x, y) min(x, y)
-#define dm_max(x, y) max(x, y)
 #endif
 
 
Signature · 6 lines
2.9.3

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

PATCH 7/10 drm/amd/display: start using linux hdmi header

In reply to a message not in the archive

From: Dave Airlie <[email protected]>

DAL has defines for things, and it doesn't even use them itself.

Change-Id Ic94412df212f8d66b4ad482fcd70de46b7b8c61a
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  | 18 ++++++++----------
 .../gpu/drm/amd/display/include/set_mode_types.h   | 22 +---------------------
 2 files changed, 9 insertions(+), 31 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +8 -10
index 59770bc9c8fe..4bb6b1d9c970 100644
@@ -1334,13 +1334,12 @@ static void set_avi_info_frame(
 
 	/* Initialize header */
 	info_frame.avi_info_packet.info_packet_hdmi.bits.header.
-			info_frame_type = INFO_FRAME_AVI;
+			info_frame_type = HDMI_INFOFRAME_TYPE_AVI;
 	/* InfoFrameVersion_3 is defined by CEA861F (Section 6.4), but shall
 	* not be used in HDMI 2.0 (Section 10.1) */
-	info_frame.avi_info_packet.info_packet_hdmi.bits.header.version =
-			INFO_FRAME_VERSION_2;
+	info_frame.avi_info_packet.info_packet_hdmi.bits.header.version = 2;
 	info_frame.avi_info_packet.info_packet_hdmi.bits.header.length =
-			INFO_FRAME_SIZE_AVI;
+			HDMI_AVI_INFOFRAME_SIZE;
 
 	/*
 	 * IDO-defined (Y2,Y1,Y0 = 1,1,1) shall not be used by devices built
@@ -1473,10 +1472,9 @@ static void set_avi_info_frame(
 	check_sum =
 		&info_frame.
 		avi_info_packet.info_packet_hdmi.packet_raw_data.sb[0];
-	*check_sum = INFO_FRAME_AVI + INFO_FRAME_SIZE_AVI
-			+ INFO_FRAME_VERSION_2;
+	*check_sum = HDMI_INFOFRAME_TYPE_AVI + HDMI_AVI_INFOFRAME_SIZE + 2;
 
-	for (byte_index = 1; byte_index <= INFO_FRAME_SIZE_AVI; byte_index++)
+	for (byte_index = 1; byte_index <= HDMI_AVI_INFOFRAME_SIZE; byte_index++)
 		*check_sum += info_frame.avi_info_packet.info_packet_hdmi.
 				packet_raw_data.sb[byte_index];
 
@@ -1588,7 +1586,7 @@ static void set_vendor_info_packet(struct core_stream *stream,
 		info_packet->sb[5] = stream->public.timing.hdmi_vic;
 
 	/* Header */
-	info_packet->hb0 = 0x81; /* VSIF packet type. */
+	info_packet->hb0 = HDMI_INFOFRAME_TYPE_VENDOR; /* VSIF packet type. */
 	info_packet->hb1 = 0x01; /* Version */
 
 	/* 4 lower bits = Length, 4 higher bits = 0 (reserved) */
@@ -1629,7 +1627,7 @@ static void set_spd_info_packet(struct core_stream *stream,
 		/* HB0  = Packet Type = 0x83 (Source Product
 		 *	  Descriptor InfoFrame)
 		 */
-		info_packet->hb0 = 0x83;
+		info_packet->hb0 = HDMI_INFOFRAME_TYPE_SPD;
 
 		/* HB1  = Version = 0x01 */
 		info_packet->hb1 = 0x01;
@@ -1651,7 +1649,7 @@ static void set_spd_info_packet(struct core_stream *stream,
 		/* HB1  = Packet Type = 0x83 (Source Product
 		 *	  Descriptor InfoFrame)
 		 */
-		info_packet->hb1 = 0x83;
+		info_packet->hb1 = HDMI_INFOFRAME_TYPE_SPD;
 
 		/* HB2  = [Bits 7:0 = Least significant eight bits -
 		 *	  For INFOFRAME, the value must be 1Bh]
drivers/gpu/drm/amd/display/include/set_mode_types.h +1 -21
index d18210ff5b7a..fee2b6ffcfc1 100644
@@ -27,6 +27,7 @@
 #define __DAL_SET_MODE_TYPES_H__
 
 #include "dc_types.h"
+#include <linux/hdmi.h>
 
 /* Info frame packet status */
 enum info_frame_flag {
@@ -36,27 +37,6 @@ enum info_frame_flag {
 	INFO_PACKET_PACKET_UPDATE_SCAN_TYPE = 8
 };
 
-/* Info frame types */
-enum info_frame_type {
-	INFO_FRAME_GAMUT = 0x0A,
-	INFO_FRAME_VENDOR_INFO = 0x81,
-	INFO_FRAME_AVI = 0x82
-};
-
-/* Info frame versions */
-enum info_frame_version {
-	INFO_FRAME_VERSION_1 = 1,
-	INFO_FRAME_VERSION_2 = 2,
-	INFO_FRAME_VERSION_3 = 3
-};
-
-/* Info frame size */
-enum info_frame_size {
-	INFO_FRAME_SIZE_AVI = 13,
-	INFO_FRAME_SIZE_VENDOR = 25,
-	INFO_FRAME_SIZE_AUDIO = 10
-};
-
 struct hdmi_info_frame_header {
 	uint8_t info_frame_type;
 	uint8_t version;
Signature · 6 lines
2.9.3

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

PATCH 8/10 drm/amd/display: Use DTO as clock on DP if not

In reply to a message not in the archive

From: Ding Wang <[email protected]>

Use DVO as pixel clock for DP before enabling link PHY. Otherwise, when switching from HDMI passive dongle to DP on the same connector, the PHY PLL is used as pixel clock, and CRTC would stop working.

Change-Id Iad2e20eaac6675ce53f9fec6781e75151c43666f
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c | 25 ++++++++++++++++++++++
 1 file changed, 25 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link_hwss.c +25 -0
index da49be0672d7..55d96656e54b 100644
@@ -61,6 +61,31 @@ void dp_enable_link_phy(
 {
 	struct link_encoder *link_enc = link->link_enc;
 
+	struct pipe_ctx *pipes =
+			link->dc->current_context->res_ctx.pipe_ctx;
+	struct clock_source *dp_cs =
+			link->dc->res_pool->dp_clock_source;
+	unsigned int i;
+	/* If the current pixel clock source is not DTO(happens after
+	 * switching from HDMI passive dongle to DP on the same connector),
+	 * switch the pixel clock source to DTO.
+	 */
+	for (i = 0; i < MAX_PIPES; i++) {
+		if (pipes[i].stream != NULL &&
+			pipes[i].stream->sink != NULL &&
+			pipes[i].stream->sink->link == link) {
+			if (pipes[i].clock_source->id != CLOCK_SOURCE_ID_DP_DTO) {
+				pipes[i].clock_source = dp_cs;
+				pipes[i].pix_clk_params.requested_pix_clk =
+						pipes[i].stream->public.timing.pix_clk_khz;
+				pipes[i].clock_source->funcs->program_pix_clk(
+							pipes[i].clock_source,
+							&pipes[i].pix_clk_params,
+							&pipes[i].pll_settings);
+			}
+		}
+	}
+
 	if (dc_is_dp_sst_signal(signal)) {
 		if (signal == SIGNAL_TYPE_EDP) {
 			link_enc->funcs->power_control(link_enc, true);
Signature · 6 lines
2.9.3

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

PATCH 9/10 drm/amd/display: Add Polaris12 to bw_calc

In reply to a message not in the archive

From: Joshua Aberback <[email protected]>

Change-Id I77c287c6d6fe2e46f232e707383347f11ade91c0
---
 drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/bandwidth_calcs.c +2 -2
index aa187736b534..54388c0e29e0 100644
@@ -44,9 +44,9 @@ static enum bw_calcs_version bw_calcs_version_from_asic_id(struct hw_asic_id asi
 
 	case FAMILY_VI:
 		if (ASIC_REV_IS_POLARIS10_P(asic_id.hw_internal_rev))
-			// || ASIC_REV_IS_POLARIS12_V(asic_id.hw_internal_rev)
 			return BW_CALCS_VERSION_POLARIS10;
-		if (ASIC_REV_IS_POLARIS11_M(asic_id.hw_internal_rev))
+		if (ASIC_REV_IS_POLARIS11_M(asic_id.hw_internal_rev) ||
+				ASIC_REV_IS_POLARIS12_V(asic_id.hw_internal_rev))
 			return BW_CALCS_VERSION_POLARIS11;
 		return BW_CALCS_VERSION_INVALID;
 
Signature · 6 lines
2.9.3

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

PATCH 10/10 drm/amd/display: Pass visible flag into surface programming

In reply to a message not in the archive

From: Yongqiang Sun <[email protected]>

Change-Id Ic6c140575b5ffb6ce32e75d3a3725312a8be6942
---
 drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c          | 3 ++-
 drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.h          | 3 ++-
 drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 6 ++++--
 drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input.h    | 3 ++-
 drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c  | 3 ++-
 drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.h  | 3 ++-
 drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h           | 3 ++-
 7 files changed, 16 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.c +2 -1
index e9005e0048e6..130935fffba3 100644
@@ -372,7 +372,8 @@ void dce_mem_input_program_surface_config(struct mem_input *mi,
 	union plane_size *plane_size,
 	enum dc_rotation_angle rotation,
 	struct dc_plane_dcc_param *dcc,
-	bool horizontal_mirror)
+	bool horizontal_mirror,
+	bool visible)
 {
 	REG_UPDATE(GRPH_ENABLE, GRPH_ENABLE, 1);
 
drivers/gpu/drm/amd/display/dc/dce/dce_mem_input.h +2 -1
index 022272d30fe4..f90d586656ef 100644
@@ -243,7 +243,8 @@ void dce_mem_input_program_surface_config(struct mem_input *mi,
 	union plane_size *plane_size,
 	enum dc_rotation_angle rotation,
 	struct dc_plane_dcc_param *dcc,
-	bool horizontal_mirror);
+	bool horizontal_mirror,
+	bool visible);
 
 void dce_mem_input_allocate_dmif(struct mem_input *mi,
 	uint32_t h_total,
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +4 -2
index 965e47a5acfa..751dbb88c265 100644
@@ -1538,7 +1538,8 @@ static void set_plane_config(
 			&surface->public.plane_size,
 			surface->public.rotation,
 			NULL,
-			false);
+			false,
+			pipe_ctx->surface->public.visible);
 
 	if (dc->public.config.gpu_vm_support)
 		mi->funcs->mem_input_program_pte_vm(
@@ -1877,8 +1878,9 @@ static void dce110_program_front_end_for_pipe(
 			&surface->public.tiling_info,
 			&surface->public.plane_size,
 			surface->public.rotation,
+			NULL,
 			false,
-			false);
+			pipe_ctx->surface->public.visible);
 
 	if (dc->public.config.gpu_vm_support)
 		mi->funcs->mem_input_program_pte_vm(
drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input.h +2 -1
index a80a20c09da4..4aec18c94c49 100644
@@ -105,7 +105,8 @@ bool  dce110_mem_input_program_surface_config(
 	union plane_size *plane_size,
 	enum dc_rotation_angle rotation,
 	struct dc_plane_dcc_param *dcc,
-	bool horizontal_mirror);
+	bool horizontal_mirror,
+	bool visible);
 
 /*
  * dce110_mem_input_is_flip_pending
drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.c +2 -1
index 757e946d0837..b12506adcba4 100644
@@ -664,7 +664,8 @@ void dce110_mem_input_v_program_surface_config(
 	union plane_size *plane_size,
 	enum dc_rotation_angle rotation,
 	struct dc_plane_dcc_param *dcc,
-	bool horizotal_mirror)
+	bool horizotal_mirror,
+	bool visible)
 {
 	struct dce110_mem_input *mem_input110 = TO_DCE110_MEM_INPUT(mem_input);
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_mem_input_v.h +2 -1
index 5b1796ccefc0..44cf066279c0 100644
@@ -89,6 +89,7 @@ bool  dce110_mem_input_v_program_surface_config(
 	enum surface_pixel_format format,
 	union dc_tiling_info *tiling_info,
 	union plane_size *plane_size,
-	enum dc_rotation_angle rotation);
+	enum dc_rotation_angle rotation,
+	bool visible);
 
 #endif
drivers/gpu/drm/amd/display/dc/inc/hw/mem_input.h +2 -1
index 2c0774f95c1c..ed980aed1677 100644
@@ -95,7 +95,8 @@ struct mem_input_funcs {
 		union plane_size *plane_size,
 		enum dc_rotation_angle rotation,
 		struct dc_plane_dcc_param *dcc,
-		bool horizontal_mirror);
+		bool horizontal_mirror,
+		bool visible);
 
 	bool (*mem_input_is_flip_pending)(struct mem_input *mem_input);
 
Signature · 6 lines
2.9.3

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