Skip to contentSkip to conversation

DC Linux Patches Mar 22, 2017

PATCH New Harry Wentland 1 participant 18 messages Mar 22, 2017 1 message not in the archive

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

cover DC Linux Patches Mar 22, 2017

* Bunch of small fixes for Vega10/Gfx9
* New dc_update_surfaces_and_stream to apply surfaces and streams together
* Fixed NULL pointer encountered when setting custom timings
* Support for CP2520 DP compliance pattern
* Bunch of other small fixes

Andrey Grodzovsky (5):
drm/amd/display: Fix the NULL pointer. (v2) drm/amd/display: Fix gfx9 parameters reading for DC. drm/amd/display: Unhardcode acrtc->max_cursor_{height,width} drm/amd/display: Unhardcode cursor size reported back to UMD. drm/amd/display: Set cursor pitch to cursor width (in pixels).

Charlene Liu (2):
drm/amd/display: DP is hotplugged, HDMI with 4:2:0 corruption drm/amd/display: remove redundant check

Dmytro Laktyushkin (2):
drm/amd/display: fix bw calc internal initialization error drm/amd/display: remove dc_pre_update_surfaces_to_stream from dc use

Leon Elazar (3):
drm/amd/display: adding new dc_update_surfaces_and_stream drm/amd/display: changing the dc_update_surfaces_and_stream drm/amd/display: Fix applying surface to underlay pipe

Logatharshan Thothiralingam (1):
drm/amd/display: Fixed bandwidth calculation error when converting
fractions

Tony Cheng (3):
drm/amd/display: use extended receiver cap for dpcd ver drm/amd/display: support CP2520 pattern 2 for HBR2 compliance drm/amd/display: support PHY compliance automation for CP2520 pattern

    1/2/3

Yongqiang Sun (1):
drm/amd/display: Use stream_enc to get head pipe.

 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |   4 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    |  12 +-
 drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c   |  12 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c           | 265 ++++++++-------------
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c   |  61 ++---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  |  17 +-
 drivers/gpu/drm/amd/display/dc/dc.h                |  30 +++
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c  | 160 +++++--------
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.h  |  10 +-
 .../drm/amd/display/dc/dce100/dce100_resource.c    |   2 +-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  45 ----
 .../drm/amd/display/dc/dce110/dce110_resource.c    |  48 +++-
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |   2 +-
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |   5 -
 drivers/gpu/drm/amd/display/include/dpcd_defs.h    |   4 +-
 .../drm/amd/display/include/link_service_types.h   |  11 +-
 16 files changed, 314 insertions(+), 374 deletions(-)
Signature · 6 lines
2.11.0

_______________________________________________
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): 20170322170504.31481-1-harry.wentland-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/17 drm/amd/display: adding new dc_update_surfaces_and_stream

From: Leon Elazar <[email protected]>

Change-Id I04c545ad7f20bb0ab380a06fbfde92a79f182ef8
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 21 +++++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/dc.h      | 29 +++++++++++++++++++++++++++++
 2 files changed, 50 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +21 -0
index d6041e842347..228ef6b310e0 100644
@@ -1268,6 +1268,27 @@ enum surface_update_type dc_check_update_surfaces_for_stream(
 	return overall_type;
 }
 
+void dc_update_surfaces_and_stream(struct dc *dc,
+		struct dc_surface_update *surface_updates, int surface_count,
+		const struct dc_stream *dc_stream,
+		struct dc_stream_update *stream_update)
+{
+	const struct dc_stream_status *stream_status;
+
+	stream_status = dc_stream_get_status(dc_stream);
+	ASSERT(stream_status);
+	if (!stream_status)
+		return; /* Cannot update stream that is not committed */
+
+	if (stream_update) {
+		dc->stream_funcs.stream_update_scaling(dc, dc_stream,
+				&stream_update->src, &stream_update->dst);
+	}
+
+	dc_update_surfaces_for_stream(dc, surface_updates,
+			surface_count, dc_stream);
+}
+
 enum surface_update_type update_surface_trace_level = UPDATE_TYPE_FULL;
 
 void dc_update_surfaces_for_stream(struct dc *dc,
drivers/gpu/drm/amd/display/dc/dc.h +29 -0
index 106addc937ca..b1bff597c0f7 100644
@@ -433,6 +433,35 @@ struct dc_stream {
 	/* TODO: CEA VIC */
 };
 
+struct dc_stream_update {
+
+	struct rect src;
+
+	struct rect dst;
+
+};
+
+
+/*
+ * Setup stream attributes if no stream updates are provided
+ * there will be no impact on the stream parameters
+ *
+ * Set up surface attributes and associate to a stream
+ * The surfaces parameter is an absolute set of all surface active for the stream.
+ * If no surfaces are provided, the stream will be blanked; no memory read.
+ * Any flip related attribute changes must be done through this interface.
+ *
+ * After this call:
+ *   Surfaces attributes are programmed and configured to be composed into stream.
+ *   This does not trigger a flip.  No surface address is programmed.
+ *
+ */
+
+void dc_update_surfaces_and_stream(struct dc *dc,
+		struct dc_surface_update *surface_updates, int surface_count,
+		const struct dc_stream *dc_stream,
+		struct dc_stream_update *stream_update);
+
 /*
  * Log the current stream state.
  */
Signature · 6 lines
2.11.0

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

PATCH 2/17 drm/amd/display: Fixed bandwidth calculation error when converting fractions

In reply to a message not in the archive

From: Logatharshan Thothiralingam <[email protected]>

[Problem]
VSR greyed out

[Root cause]
When converting fractions, we were using the integer function, which let to a large display clock and the view was not supported

[Solution]
Change the integer to fraction functions

Change-Id I28d7d236462774f43dce2f30b8b6056e17bf802f
---
 drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +4 -4
index c855e49eb116..e47794398942 100644
@@ -796,11 +796,11 @@ static void calculate_bandwidth(
 			}
 			else if (bw_leq(data->vsr[i], bw_int_to_fixed(1))) {
 				data->lb_lines_in_per_line_out_in_middle_of_frame[i] = bw_int_to_fixed(1);
-			}
-			else if (bw_leq(data->vsr[i], bw_int_to_fixed(4 / 3))) {
+			} else if (bw_leq(data->vsr[i],
+					bw_frc_to_fixed(4, 3))) {
 				data->lb_lines_in_per_line_out_in_middle_of_frame[i] = bw_div(bw_int_to_fixed(4), bw_int_to_fixed(3));
-			}
-			else if (bw_leq(data->vsr[i], bw_int_to_fixed(6 / 4))) {
+			} else if (bw_leq(data->vsr[i],
+					bw_frc_to_fixed(6, 4))) {
 				data->lb_lines_in_per_line_out_in_middle_of_frame[i] = bw_div(bw_int_to_fixed(6), bw_int_to_fixed(4));
 			}
 			else if (bw_leq(data->vsr[i], bw_int_to_fixed(2))) {
Signature · 6 lines
2.11.0

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

PATCH 3/17 drm/amd/display: fix bw calc internal initialization error

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I25fe157356aa177a4272d7dfc8e48cb451f25df2
---
 drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c +2 -2
index e47794398942..4820660f51d6 100644
@@ -1341,12 +1341,12 @@ static void calculate_bandwidth(
 	/*initialize variables*/
 	number_of_displays_enabled = 0;
 	number_of_displays_enabled_with_margin = 0;
-	for (k = 0; k < maximum_number_of_surfaces; k++) {
+	for (k = 0; k <= maximum_number_of_surfaces - 1; k++) {
 		if (data->enable[k]) {
 			number_of_displays_enabled = number_of_displays_enabled + 1;
 		}
+		data->display_pstate_change_enable[k] = 0;
 	}
-	data->display_pstate_change_enable[maximum_number_of_surfaces - 1] = 0;
 	for (i = 0; i <= 2; i++) {
 		for (j = 0; j <= 7; j++) {
 			data->min_dram_speed_change_margin[i][j] = bw_int_to_fixed(9999);
Signature · 6 lines
2.11.0

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

PATCH 4/17 drm/amd/display: changing the dc_update_surfaces_and_stream

In reply to a message not in the archive

From: Leon Elazar <[email protected]>

1. Adding the ability to update the stream parameters during FULL_UPDATE type

Change-Id I0ac40a858bdd0d03df7011d8bd9c110226a44945
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 129 +++++++++++++++----------------
 drivers/gpu/drm/amd/display/dc/dc.h      |   1 +
 2 files changed, 65 insertions(+), 65 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +64 -65
index 228ef6b310e0..26f227ddd025 100644
@@ -1245,6 +1245,7 @@ enum surface_update_type dc_check_update_surfaces_for_stream(
 		struct dc *dc,
 		struct dc_surface_update *updates,
 		int surface_count,
+		struct dc_stream_update *stream_update,
 		const struct dc_stream_status *stream_status)
 {
 	struct core_dc *core_dc = DC_TO_CORE(dc);
@@ -1254,6 +1255,9 @@ enum surface_update_type dc_check_update_surfaces_for_stream(
 	if (stream_status->surface_count != surface_count)
 		return UPDATE_TYPE_FULL;
 
+	if (stream_update)
+		return UPDATE_TYPE_FULL;
+
 	for (i = 0 ; i < surface_count; i++) {
 		enum surface_update_type type =
 				det_surface_update(core_dc, &updates[i]);
@@ -1268,39 +1272,27 @@ enum surface_update_type dc_check_update_surfaces_for_stream(
 	return overall_type;
 }
 
-void dc_update_surfaces_and_stream(struct dc *dc,
+void dc_update_surfaces_for_stream(struct dc *dc,
 		struct dc_surface_update *surface_updates, int surface_count,
-		const struct dc_stream *dc_stream,
-		struct dc_stream_update *stream_update)
+		const struct dc_stream *dc_stream)
 {
-	const struct dc_stream_status *stream_status;
-
-	stream_status = dc_stream_get_status(dc_stream);
-	ASSERT(stream_status);
-	if (!stream_status)
-		return; /* Cannot update stream that is not committed */
-
-	if (stream_update) {
-		dc->stream_funcs.stream_update_scaling(dc, dc_stream,
-				&stream_update->src, &stream_update->dst);
-	}
-
-	dc_update_surfaces_for_stream(dc, surface_updates,
-			surface_count, dc_stream);
+	dc_update_surfaces_and_stream(dc, surface_updates, surface_count,
+			dc_stream, NULL);
 }
 
 enum surface_update_type update_surface_trace_level = UPDATE_TYPE_FULL;
 
-void dc_update_surfaces_for_stream(struct dc *dc,
-		struct dc_surface_update *updates, int surface_count,
-		const struct dc_stream *dc_stream)
+void dc_update_surfaces_and_stream(struct dc *dc,
+		struct dc_surface_update *srf_updates, int surface_count,
+		const struct dc_stream *dc_stream,
+		struct dc_stream_update *stream_update)
 {
 	struct core_dc *core_dc = DC_TO_CORE(dc);
 	struct validate_context *context;
 	int i, j;
-
 	enum surface_update_type update_type;
 	const struct dc_stream_status *stream_status;
+	struct core_stream *stream = DC_STREAM_TO_CORE(dc_stream);
 
 	stream_status = dc_stream_get_status(dc_stream);
 	ASSERT(stream_status);
@@ -1308,16 +1300,16 @@ void dc_update_surfaces_for_stream(struct dc *dc,
 		return; /* Cannot commit surface to stream that is not committed */
 
 	update_type = dc_check_update_surfaces_for_stream(
-			dc, updates, surface_count, stream_status);
+			dc, srf_updates, surface_count, stream_update, stream_status);
 
 	if (update_type >= update_surface_trace_level)
-		update_surface_trace(dc, updates, surface_count);
+		update_surface_trace(dc, srf_updates, surface_count);
 
 	if (update_type >= UPDATE_TYPE_FULL) {
 		const struct dc_surface *new_surfaces[MAX_SURFACES] = { 0 };
 
 		for (i = 0; i < surface_count; i++)
-			new_surfaces[i] = updates[i].surface;
+			new_surfaces[i] = srf_updates[i].surface;
 
 		/* initialize scratch memory for building context */
 		context = core_dc->temp_flip_context;
@@ -1333,47 +1325,54 @@ void dc_update_surfaces_for_stream(struct dc *dc,
 	} else {
 		context = core_dc->current_context;
 	}
+
+	/* update current stream with the new updates */
+	if (stream_update) {
+		stream->public.src = stream_update->src;
+		stream->public.dst = stream_update->dst;
+	}
+
+	/* save update parameters into surface */
 	for (i = 0; i < surface_count; i++) {
-		/* save update param into surface */
-		struct core_surface *surface = DC_SURFACE_TO_CORE(updates[i].surface);
-		struct core_stream *stream = DC_STREAM_TO_CORE(dc_stream);
+		struct core_surface *surface =
+				DC_SURFACE_TO_CORE(srf_updates[i].surface);
 
-		if (updates[i].flip_addr) {
-			surface->public.address = updates[i].flip_addr->address;
+		if (srf_updates[i].flip_addr) {
+			surface->public.address = srf_updates[i].flip_addr->address;
 			surface->public.flip_immediate =
-					updates[i].flip_addr->flip_immediate;
+					srf_updates[i].flip_addr->flip_immediate;
 		}
 
-		if (updates[i].scaling_info) {
+		if (srf_updates[i].scaling_info) {
 			surface->public.scaling_quality =
-					updates[i].scaling_info->scaling_quality;
+					srf_updates[i].scaling_info->scaling_quality;
 			surface->public.dst_rect =
-					updates[i].scaling_info->dst_rect;
+					srf_updates[i].scaling_info->dst_rect;
 			surface->public.src_rect =
-					updates[i].scaling_info->src_rect;
+					srf_updates[i].scaling_info->src_rect;
 			surface->public.clip_rect =
-					updates[i].scaling_info->clip_rect;
+					srf_updates[i].scaling_info->clip_rect;
 		}
 
-		if (updates[i].plane_info) {
+		if (srf_updates[i].plane_info) {
 			surface->public.color_space =
-					updates[i].plane_info->color_space;
+					srf_updates[i].plane_info->color_space;
 			surface->public.format =
-					updates[i].plane_info->format;
+					srf_updates[i].plane_info->format;
 			surface->public.plane_size =
-					updates[i].plane_info->plane_size;
+					srf_updates[i].plane_info->plane_size;
 			surface->public.rotation =
-					updates[i].plane_info->rotation;
+					srf_updates[i].plane_info->rotation;
 			surface->public.horizontal_mirror =
-					updates[i].plane_info->horizontal_mirror;
+					srf_updates[i].plane_info->horizontal_mirror;
 			surface->public.stereo_format =
-					updates[i].plane_info->stereo_format;
+					srf_updates[i].plane_info->stereo_format;
 			surface->public.tiling_info =
-					updates[i].plane_info->tiling_info;
+					srf_updates[i].plane_info->tiling_info;
 			surface->public.visible =
-					updates[i].plane_info->visible;
+					srf_updates[i].plane_info->visible;
 			surface->public.dcc =
-					updates[i].plane_info->dcc;
+					srf_updates[i].plane_info->dcc;
 		}
 
 		/* not sure if we still need this */
@@ -1388,40 +1387,40 @@ void dc_update_surfaces_for_stream(struct dc *dc,
 			}
 		}
 
-		if (updates[i].gamma &&
-			updates[i].gamma != surface->public.gamma_correction) {
+		if (srf_updates[i].gamma &&
+			srf_updates[i].gamma != surface->public.gamma_correction) {
 			if (surface->public.gamma_correction != NULL)
 				dc_gamma_release(&surface->public.
 						gamma_correction);
 
-			dc_gamma_retain(updates[i].gamma);
+			dc_gamma_retain(srf_updates[i].gamma);
 			surface->public.gamma_correction =
-						updates[i].gamma;
+						srf_updates[i].gamma;
 		}
 
-		if (updates[i].in_transfer_func &&
-			updates[i].in_transfer_func != surface->public.in_transfer_func) {
+		if (srf_updates[i].in_transfer_func &&
+			srf_updates[i].in_transfer_func != surface->public.in_transfer_func) {
 			if (surface->public.in_transfer_func != NULL)
 				dc_transfer_func_release(
 						surface->public.
 						in_transfer_func);
 
 			dc_transfer_func_retain(
-					updates[i].in_transfer_func);
+					srf_updates[i].in_transfer_func);
 			surface->public.in_transfer_func =
-					updates[i].in_transfer_func;
+					srf_updates[i].in_transfer_func;
 		}
 
-		if (updates[i].out_transfer_func &&
-			updates[i].out_transfer_func != dc_stream->out_transfer_func) {
+		if (srf_updates[i].out_transfer_func &&
+			srf_updates[i].out_transfer_func != dc_stream->out_transfer_func) {
 			if (dc_stream->out_transfer_func != NULL)
 				dc_transfer_func_release(dc_stream->out_transfer_func);
-			dc_transfer_func_retain(updates[i].out_transfer_func);
-			stream->public.out_transfer_func = updates[i].out_transfer_func;
+			dc_transfer_func_retain(srf_updates[i].out_transfer_func);
+			stream->public.out_transfer_func = srf_updates[i].out_transfer_func;
 		}
-		if (updates[i].hdr_static_metadata)
+		if (srf_updates[i].hdr_static_metadata)
 			surface->public.hdr_static_ctx =
-				*(updates[i].hdr_static_metadata);
+				*(srf_updates[i].hdr_static_metadata);
 	}
 
 	if (update_type == UPDATE_TYPE_FULL &&
@@ -1434,7 +1433,7 @@ void dc_update_surfaces_for_stream(struct dc *dc,
 		core_dc->hwss.apply_ctx_for_surface(core_dc, NULL, context);
 
 	for (i = 0; i < surface_count; i++) {
-		struct core_surface *surface = DC_SURFACE_TO_CORE(updates[i].surface);
+		struct core_surface *surface = DC_SURFACE_TO_CORE(srf_updates[i].surface);
 
 		for (j = 0; j < context->res_ctx.pool->pipe_count; j++) {
 			struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
@@ -1460,7 +1459,7 @@ void dc_update_surfaces_for_stream(struct dc *dc,
 						true);
 			}
 
-			if (updates[i].flip_addr)
+			if (srf_updates[i].flip_addr)
 				core_dc->hwss.update_plane_addr(core_dc, pipe_ctx);
 
 			if (update_type == UPDATE_TYPE_FAST)
@@ -1471,18 +1470,18 @@ void dc_update_surfaces_for_stream(struct dc *dc,
 				is_new_pipe_surface = false;
 
 			if (is_new_pipe_surface ||
-					updates[i].in_transfer_func)
+					srf_updates[i].in_transfer_func)
 				core_dc->hwss.set_input_transfer_func(
 						pipe_ctx, pipe_ctx->surface);
 
 			if (is_new_pipe_surface ||
-					updates[i].out_transfer_func)
+					srf_updates[i].out_transfer_func)
 				core_dc->hwss.set_output_transfer_func(
 						pipe_ctx,
 						pipe_ctx->surface,
 						pipe_ctx->stream);
 
-			if (updates[i].hdr_static_metadata) {
+			if (srf_updates[i].hdr_static_metadata) {
 				resource_build_info_frame(pipe_ctx);
 				core_dc->hwss.update_info_frame(pipe_ctx);
 			}
@@ -1493,7 +1492,7 @@ void dc_update_surfaces_for_stream(struct dc *dc,
 		struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
 
 		for (j = 0; j < surface_count; j++) {
-			if (updates[j].surface == &pipe_ctx->surface->public) {
+			if (srf_updates[j].surface == &pipe_ctx->surface->public) {
 				if (!pipe_ctx->tg->funcs->is_blanked(pipe_ctx->tg)) {
 					core_dc->hwss.pipe_control_lock(
 							core_dc,
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index b1bff597c0f7..8b033ba5df6e 100644
@@ -556,6 +556,7 @@ enum surface_update_type dc_check_update_surfaces_for_stream(
 		struct dc *dc,
 		struct dc_surface_update *updates,
 		int surface_count,
+		struct dc_stream_update *stream_update,
 		const struct dc_stream_status *stream_status);
 
 /*******************************************************************************
Signature · 6 lines
2.11.0

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

PATCH 5/17 drm/amd/display: use extended receiver cap for dpcd ver

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

Change-Id I08409ad1df5b17612546db914b5840791c520717
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +3 -3
index 5c6978eed8da..ef80473135c4 100644
@@ -2081,9 +2081,6 @@ static void retrieve_link_cap(struct core_link *link)
 		dpcd_data,
 		sizeof(dpcd_data));
 
-	link->dpcd_caps.dpcd_rev.raw =
-		dpcd_data[DP_DPCD_REV - DP_DPCD_REV];
-
 	{
 		union training_aux_rd_interval aux_rd_interval;
 
@@ -2099,6 +2096,9 @@ static void retrieve_link_cap(struct core_link *link)
 		}
 	}
 
+	link->dpcd_caps.dpcd_rev.raw =
+		dpcd_data[DP_DPCD_REV - DP_DPCD_REV];
+
 	ds_port.byte = dpcd_data[DP_DOWNSTREAMPORT_PRESENT -
 				 DP_DPCD_REV];
 
Signature · 6 lines
2.11.0

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

PATCH 6/17 drm/amd/display: remove dc_pre_update_surfaces_to_stream from dc use

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I74b6cc4e1313c2c1d89cc48e68f482b3803a6628
---
 drivers/gpu/drm/amd/display/dc/core/dc.c           | 115 ++-------------------
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  |   8 +-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  45 --------
 .../drm/amd/display/dc/dce110/dce110_resource.c    |  48 +++++++--
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |   2 +-
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |   5 -
 6 files changed, 54 insertions(+), 169 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +7 -108
index 26f227ddd025..6409d4d1d7f8 100644
@@ -900,106 +900,7 @@ bool dc_pre_update_surfaces_to_stream(
 		uint8_t new_surface_count,
 		const struct dc_stream *dc_stream)
 {
-	int i, j;
-	struct core_dc *core_dc = DC_TO_CORE(dc);
-	struct dc_stream_status *stream_status = NULL;
-	struct validate_context *context;
-	bool ret = true;
-
-	pre_surface_trace(dc, new_surfaces, new_surface_count);
-
-	if (core_dc->current_context->stream_count == 0)
-		return false;
-
-	/* Cannot commit surface to a stream that is not commited */
-	for (i = 0; i < core_dc->current_context->stream_count; i++)
-		if (dc_stream == &core_dc->current_context->streams[i]->public)
-			break;
-
-	if (i == core_dc->current_context->stream_count)
-		return false;
-
-	stream_status = &core_dc->current_context->stream_status[i];
-
-	if (new_surface_count == stream_status->surface_count) {
-		bool skip_pre = true;
-
-		for (i = 0; i < stream_status->surface_count; i++) {
-			struct dc_surface temp_surf = { 0 };
-
-			temp_surf = *stream_status->surfaces[i];
-			temp_surf.clip_rect = new_surfaces[i]->clip_rect;
-			temp_surf.dst_rect.x = new_surfaces[i]->dst_rect.x;
-			temp_surf.dst_rect.y = new_surfaces[i]->dst_rect.y;
-
-			if (memcmp(&temp_surf, new_surfaces[i], sizeof(temp_surf)) != 0) {
-				skip_pre = false;
-				break;
-			}
-		}
-
-		if (skip_pre)
-			return true;
-	}
-
-	context = dm_alloc(sizeof(struct validate_context));
-
-	if (!context) {
-		dm_error("%s: failed to create validate ctx\n", __func__);
-		ret = false;
-		goto val_ctx_fail;
-	}
-
-	resource_validate_ctx_copy_construct(core_dc->current_context, context);
-
-	dm_logger_write(core_dc->ctx->logger, LOG_DC,
-				"%s: commit %d surfaces to stream 0x%x\n",
-				__func__,
-				new_surface_count,
-				dc_stream);
-
-	if (!resource_attach_surfaces_to_context(
-			new_surfaces, new_surface_count, dc_stream, context)) {
-		BREAK_TO_DEBUGGER();
-		ret = false;
-		goto unexpected_fail;
-	}
-
-	for (i = 0; i < new_surface_count; i++)
-		for (j = 0; j < context->res_ctx.pool->pipe_count; j++) {
-			if (context->res_ctx.pipe_ctx[j].surface !=
-					DC_SURFACE_TO_CORE(new_surfaces[i]))
-				continue;
-
-			resource_build_scaling_params(&context->res_ctx.pipe_ctx[j]);
-		}
-
-	if (!core_dc->res_pool->funcs->validate_bandwidth(core_dc, context)) {
-		BREAK_TO_DEBUGGER();
-		ret = false;
-		goto unexpected_fail;
-	}
-
-	core_dc->hwss.set_bandwidth(core_dc, context, false);
-
-	for (i = 0; i < new_surface_count; i++)
-		for (j = 0; j < context->res_ctx.pool->pipe_count; j++) {
-			if (context->res_ctx.pipe_ctx[j].surface !=
-					DC_SURFACE_TO_CORE(new_surfaces[i]))
-				continue;
-
-			core_dc->hwss.prepare_pipe_for_context(
-					core_dc,
-					&context->res_ctx.pipe_ctx[j],
-					context);
-		}
-
-unexpected_fail:
-	resource_validate_ctx_destruct(context);
-	dm_free(context);
-val_ctx_fail:
-
-	return ret;
+	return true;
 }
 
 bool dc_post_update_surfaces_to_stream(struct dc *dc)
@@ -1050,10 +951,6 @@ bool dc_commit_surfaces_to_stream(
 	struct dc_scaling_info scaling_info[MAX_SURFACES];
 	int i;
 
-	if (!dc_pre_update_surfaces_to_stream(
-			dc, new_surfaces, new_surface_count, dc_stream))
-		return false;
-
 	memset(updates, 0, sizeof(updates));
 	memset(flip_addr, 0, sizeof(flip_addr));
 	memset(plane_info, 0, sizeof(plane_info));
@@ -1423,10 +1320,12 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 				*(srf_updates[i].hdr_static_metadata);
 	}
 
-	if (update_type == UPDATE_TYPE_FULL &&
-			!core_dc->res_pool->funcs->validate_bandwidth(core_dc, context)) {
-		BREAK_TO_DEBUGGER();
-		return;
+	if (update_type == UPDATE_TYPE_FULL) {
+		if (!core_dc->res_pool->funcs->validate_bandwidth(core_dc, context)) {
+			BREAK_TO_DEBUGGER();
+			return;
+		} else
+			core_dc->hwss.set_bandwidth(core_dc, context, false);
 	}
 
 	if (!surface_count)  /* reset */
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +4 -4
index ad37d0efca2e..6700d6b27a8a 100644
@@ -900,10 +900,11 @@ struct pipe_ctx *resource_get_head_pipe_for_stream(
  * that has no surface attached yet
  */
 static struct pipe_ctx *acquire_free_pipe_for_stream(
-		struct resource_context *res_ctx,
+		struct validate_context *context,
 		const struct dc_stream *dc_stream)
 {
 	int i;
+	struct resource_context *res_ctx = &context->res_ctx;
 	struct core_stream *stream = DC_STREAM_TO_CORE(dc_stream);
 
 	struct pipe_ctx *head_pipe = NULL;
@@ -934,7 +935,7 @@ static struct pipe_ctx *acquire_free_pipe_for_stream(
 	if(!res_ctx->pool->funcs->acquire_idle_pipe_for_layer)
 		return NULL;
 
-	return res_ctx->pool->funcs->acquire_idle_pipe_for_layer(res_ctx, stream);
+	return res_ctx->pool->funcs->acquire_idle_pipe_for_layer(context, stream);
 
 }
 
@@ -1001,8 +1002,7 @@ bool resource_attach_surfaces_to_context(
 	tail_pipe = NULL;
 	for (i = 0; i < surface_count; i++) {
 		struct core_surface *surface = DC_SURFACE_TO_CORE(surfaces[i]);
-		struct pipe_ctx *free_pipe = acquire_free_pipe_for_stream(
-				&context->res_ctx, dc_stream);
+		struct pipe_ctx *free_pipe = acquire_free_pipe_for_stream(context, dc_stream);
 
 		if (!free_pipe) {
 			stream_status->surfaces[i] = NULL;
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +0 -45

57 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +42 -6

73 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/inc/core_types.h +1 -1
index faec2292cc27..7f3c6da1ebd7 100644
@@ -210,7 +210,7 @@ struct resource_funcs {
 					struct validate_context *context);
 
 	struct pipe_ctx *(*acquire_idle_pipe_for_layer)(
-			struct resource_context *res_ctx,
+			struct validate_context *context,
 			struct core_stream *stream);
 
 	void (*build_bit_depth_reduction_params)(
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +0 -5
index 98a04cd46178..bcb267295cb9 100644
@@ -57,11 +57,6 @@ struct hw_sequencer_funcs {
 	void (*reset_hw_ctx_wrap)(
 			struct core_dc *dc, struct validate_context *context);
 
-	void (*prepare_pipe_for_context)(
-			struct core_dc *dc,
-			struct pipe_ctx *pipe_ctx,
-			struct validate_context *context);
-
 	void (*apply_ctx_for_surface)(
 			struct core_dc *dc,
 			struct core_surface *surface,
Signature · 6 lines
2.11.0

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

PATCH 7/17 drm/amd/display: Use stream_enc to get head pipe.

In reply to a message not in the archive

From: Yongqiang Sun <[email protected]>

Change-Id I19bf7861e102d836cd9adcc17b3b422b0a3d7a74
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
index 6700d6b27a8a..9f624e84f59b 100644
@@ -887,7 +887,7 @@ struct pipe_ctx *resource_get_head_pipe_for_stream(
 	int i;
 	for (i = 0; i < res_ctx->pool->pipe_count; i++) {
 		if (res_ctx->pipe_ctx[i].stream == stream &&
-				!res_ctx->pipe_ctx[i].top_pipe) {
+				res_ctx->pipe_ctx[i].stream_enc) {
 			return &res_ctx->pipe_ctx[i];
 			break;
 		}
Signature · 6 lines
2.11.0

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

PATCH 8/17 drm/amd/display: support CP2520 pattern 2 for HBR2 compliance

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

- also some clean up

Change-Id Ie18a8b4d2912d45bc20179edbf6ca8fb5b4f77d2
---
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c  | 149 ++++++++-------------
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.h  |  10 +-
 .../drm/amd/display/dc/dce100/dce100_resource.c    |   2 +-
 3 files changed, 66 insertions(+), 95 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +56 -93
index a1d35ad85605..65cc64a17f41 100644
@@ -169,9 +169,6 @@ static void disable_prbs_symbols(
 static void disable_prbs_mode(
 	struct dce110_link_encoder *enc110)
 {
-	/* This register resides in DP back end block;
-	 * transmitter is used for the offset */
-
 	REG_UPDATE(DP_DPHY_PRBS_CNTL, DPHY_PRBS_EN, 0);
 }
 
@@ -216,9 +213,7 @@ static void set_dp_phy_pattern_d102(
 
 	disable_prbs_symbols(enc110, true);
 
-	/* Disable PRBS mode,
-	 * make sure DPHY_PRBS_CNTL.DPHY_PRBS_EN=0 */
-
+	/* Disable PRBS mode */
 	disable_prbs_mode(enc110);
 
 	/* Program debug symbols to be output */
@@ -264,43 +259,54 @@ void dce110_link_encoder_set_dp_phy_pattern_training_pattern(
 
 	enable_phy_bypass_mode(enc110, false);
 
-	/* Disable PRBS mode,
-	 * make sure DPHY_PRBS_CNTL.DPHY_PRBS_EN=0 */
-
+	/* Disable PRBS mode */
 	disable_prbs_mode(enc110);
 }
 
+static void setup_panel_mode(
+	struct dce110_link_encoder *enc110,
+	enum dp_panel_mode panel_mode)
+{
+	uint32_t value;
+
+	ASSERT(REG(DP_DPHY_INTERNAL_CTRL));
+	value = REG_READ(DP_DPHY_INTERNAL_CTRL);
+
+	switch (panel_mode) {
+	case DP_PANEL_MODE_EDP:
+		value = 0x1;
+		break;
+	case DP_PANEL_MODE_SPECIAL:
+		value = 0x11;
+		break;
+	default:
+		value = 0x0;
+		break;
+	}
+
+	REG_WRITE(DP_DPHY_INTERNAL_CTRL, value);
+}
+
 static void set_dp_phy_pattern_symbol_error(
 	struct dce110_link_encoder *enc110)
 {
 	/* Disable PHY Bypass mode to setup the test pattern */
-	uint32_t value = 0x0;
-
 	enable_phy_bypass_mode(enc110, false);
 
 	/* program correct panel mode*/
-	{
-		ASSERT(REG(DP_DPHY_INTERNAL_CTRL));
-		/*DCE 120 does not have this reg*/
-
-		REG_WRITE(DP_DPHY_INTERNAL_CTRL, value);
-	}
+	setup_panel_mode(enc110, DP_PANEL_MODE_DEFAULT);
 
 	/* A PRBS23 pattern is used for most DP electrical measurements. */
 
 	/* Enable PRBS symbols on the lanes */
-
 	disable_prbs_symbols(enc110, false);
 
 	/* For PRBS23 Set bit DPHY_PRBS_SEL=1 and Set bit DPHY_PRBS_EN=1 */
-	{
-		REG_UPDATE_2(DP_DPHY_PRBS_CNTL,
-					DPHY_PRBS_SEL, 1,
-					DPHY_PRBS_EN, 1);
-	}
+	REG_UPDATE_2(DP_DPHY_PRBS_CNTL,
+			DPHY_PRBS_SEL, 1,
+			DPHY_PRBS_EN, 1);
 
 	/* Enable phy bypass mode to enable the test pattern */
-
 	enable_phy_bypass_mode(enc110, true);
 }
 
@@ -308,24 +314,19 @@ static void set_dp_phy_pattern_prbs7(
 	struct dce110_link_encoder *enc110)
 {
 	/* Disable PHY Bypass mode to setup the test pattern */
-
 	enable_phy_bypass_mode(enc110, false);
 
 	/* A PRBS7 pattern is used for most DP electrical measurements. */
 
 	/* Enable PRBS symbols on the lanes */
-
 	disable_prbs_symbols(enc110, false);
 
 	/* For PRBS7 Set bit DPHY_PRBS_SEL=0 and Set bit DPHY_PRBS_EN=1 */
-	{
-		REG_UPDATE_2(DP_DPHY_PRBS_CNTL,
-					DPHY_PRBS_SEL, 0,
-					DPHY_PRBS_EN, 1);
-	}
+	REG_UPDATE_2(DP_DPHY_PRBS_CNTL,
+			DPHY_PRBS_SEL, 0,
+			DPHY_PRBS_EN, 1);
 
 	/* Enable phy bypass mode to enable the test pattern */
-
 	enable_phy_bypass_mode(enc110, true);
 }
 
@@ -374,7 +375,7 @@ static void set_dp_phy_pattern_80bit_custom(
 	enable_phy_bypass_mode(enc110, true);
 }
 
-static void set_dp_phy_pattern_hbr2_compliance(
+static void set_dp_phy_pattern_hbr2_compliance_cp2520_2(
 	struct dce110_link_encoder *enc110)
 {
 
@@ -391,56 +392,34 @@ static void set_dp_phy_pattern_hbr2_compliance(
 	enable_phy_bypass_mode(enc110, false);
 
 	/* Setup DIG encoder in DP SST mode */
-
 	enc110->base.funcs->setup(&enc110->base, SIGNAL_TYPE_DISPLAY_PORT);
 
-	/* program correct panel mode*/
-	{
-		ASSERT(REG(DP_DPHY_INTERNAL_CTRL));
-
-		REG_WRITE(DP_DPHY_INTERNAL_CTRL, 0x0);
-	}
+	/* ensure normal panel mode. */
+	setup_panel_mode(enc110, DP_PANEL_MODE_DEFAULT);
 
 	/* no vbid after BS (SR)
 	 * DP_LINK_FRAMING_CNTL changed history Sandra Liu
 	 * 11000260 / 11000104 / 110000FC */
+	REG_UPDATE_3(DP_LINK_FRAMING_CNTL,
+			DP_IDLE_BS_INTERVAL, 0xFC,
+			DP_VBID_DISABLE, 1,
+			DP_VID_ENHANCED_FRAME_MODE, 1);
 
-	/* TODO DP_LINK_FRAMING_CNTL should always use hardware default value
-	 * output  except output hbr2_compliance pattern for physical PHY
-	 * measurement. This is not normal usage case. SW should reset this
-	 * register to hardware default value after end use of HBR2 eye
-	 */
-	BREAK_TO_DEBUGGER();
-	/* TODO: do we still need this, find out at compliance test
-	addr = mmDP_LINK_FRAMING_CNTL + fe_addr_offset;
-
-	value = dal_read_reg(ctx, addr);
-
-	set_reg_field_value(value, 0xFC,
-			DP_LINK_FRAMING_CNTL, DP_IDLE_BS_INTERVAL);
-	set_reg_field_value(value, 1,
-			DP_LINK_FRAMING_CNTL, DP_VBID_DISABLE);
-	set_reg_field_value(value, 1,
-			DP_LINK_FRAMING_CNTL, DP_VID_ENHANCED_FRAME_MODE);
-
-	dal_write_reg(ctx, addr, value);
-	 */
 	/* swap every BS with SR */
-
 	REG_UPDATE(DP_DPHY_SCRAM_CNTL, DPHY_SCRAMBLER_BS_COUNT, 0);
 
-	/*TODO add support for this test pattern
-	 * support_dp_hbr2_eye_pattern
-	 */
+	/* select cp2520 pattern 2 */
+	if (REG(DP_DPHY_HBR2_PATTERN_CONTROL))
+		REG_UPDATE(DP_DPHY_HBR2_PATTERN_CONTROL,
+				DP_DPHY_HBR2_PATTERN_CONTROL, 0x2);
 
 	/* set link training complete */
 	set_link_training_complete(enc110, true);
-	/* do not enable video stream */
 
+	/* disable video stream */
 	REG_UPDATE(DP_VID_STREAM_CNTL, DP_VID_STREAM_ENABLE, 0);
 
 	/* Disable PHY Bypass mode to setup the test pattern */
-
 	enable_phy_bypass_mode(enc110, false);
 }
 
@@ -448,41 +427,26 @@ static void set_dp_phy_pattern_passthrough_mode(
 	struct dce110_link_encoder *enc110,
 	enum dp_panel_mode panel_mode)
 {
-	uint32_t value;
-
 	/* program correct panel mode */
-	{
-		ASSERT(REG(DP_DPHY_INTERNAL_CTRL));
-		value = REG_READ(DP_DPHY_INTERNAL_CTRL);
+	setup_panel_mode(enc110, panel_mode);
 
-		switch (panel_mode) {
-		case DP_PANEL_MODE_EDP:
-			value = 0x1;
-		break;
-		case DP_PANEL_MODE_SPECIAL:
-			value = 0x11;
-		break;
-		default:
-			value = 0x0;
-			break;
-		}
-
-		REG_WRITE(DP_DPHY_INTERNAL_CTRL, value);
-	}
+	/* restore LINK_FRAMING_CNTL and DPHY_SCRAMBLER_BS_COUNT
+	 * in case we were doing HBR2 compliance pattern before
+	 */
+	REG_UPDATE_3(DP_LINK_FRAMING_CNTL,
+			DP_IDLE_BS_INTERVAL, 0x2000,
+			DP_VBID_DISABLE, 0,
+			DP_VID_ENHANCED_FRAME_MODE, 1);
 
 	REG_UPDATE(DP_DPHY_SCRAM_CNTL, DPHY_SCRAMBLER_BS_COUNT, 0x1FF);
 
 	/* set link training complete */
-
 	set_link_training_complete(enc110, true);
 
 	/* Disable PHY Bypass mode to setup the test pattern */
-
 	enable_phy_bypass_mode(enc110, false);
 
-	/* Disable PRBS mode,
-	 * make sure DPHY_PRBS_CNTL.DPHY_PRBS_EN=0 */
-
+	/* Disable PRBS mode */
 	disable_prbs_mode(enc110);
 }
 
@@ -828,8 +792,7 @@ static void link_encoder_disable(struct dce110_link_encoder *enc110)
 	REG_UPDATE(DP_LINK_CNTL, DP_LINK_TRAINING_COMPLETE, 0);
 
 	/* reset panel mode */
-	ASSERT(REG(DP_DPHY_INTERNAL_CTRL));
-	REG_WRITE(DP_DPHY_INTERNAL_CTRL, 0);
+	setup_panel_mode(enc110, DP_PANEL_MODE_DEFAULT);
 }
 
 static void hpd_initialize(
@@ -1433,7 +1396,7 @@ void dce110_link_encoder_dp_set_phy_pattern(
 			enc110, param->custom_pattern);
 		break;
 	case DP_TEST_PATTERN_HBR2_COMPLIANCE_EYE:
-		set_dp_phy_pattern_hbr2_compliance(enc110);
+		set_dp_phy_pattern_hbr2_compliance_cp2520_2(enc110);
 		break;
 	case DP_TEST_PATTERN_VIDEO_MODE: {
 		set_dp_phy_pattern_passthrough_mode(
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.h +9 -1
index 25ba583dbb8f..4e0b5d965355 100644
@@ -78,22 +78,29 @@
 	SRI(DP_DPHY_INTERNAL_CTRL, DP, id), \
 	SR(DCI_MEM_PWR_STATUS)
 
+#define LE_DCE100_REG_LIST(id)\
+	LE_COMMON_REG_LIST_BASE(id), \
+	SRI(DP_DPHY_BS_SR_SWAP_CNTL, DP, id), \
+	SRI(DP_DPHY_INTERNAL_CTRL, DP, id), \
+	SR(DCI_MEM_PWR_STATUS)
+
 #define LE_DCE110_REG_LIST(id)\
 	LE_COMMON_REG_LIST_BASE(id), \
 	SRI(DP_DPHY_BS_SR_SWAP_CNTL, DP, id), \
 	SRI(DP_DPHY_INTERNAL_CTRL, DP, id), \
+	SRI(DP_DPHY_HBR2_PATTERN_CONTROL, DP, id), \
 	SR(DCI_MEM_PWR_STATUS)
 
 #define LE_DCE120_REG_LIST(id)\
 	LE_COMMON_REG_LIST_BASE(id), \
 	SRI(DP_DPHY_BS_SR_SWAP_CNTL, DP, id), \
+	SRI(DP_DPHY_HBR2_PATTERN_CONTROL, DP, id), \
 	SR(DCI_MEM_PWR_STATUS)
 
 #define LE_DCE80_REG_LIST(id)\
 	SRI(DP_DPHY_INTERNAL_CTRL, DP, id), \
 	LE_COMMON_REG_LIST_BASE(id)
 
-
 struct dce110_link_enc_aux_registers {
 	uint32_t AUX_CONTROL;
 	uint32_t AUX_DPHY_RX_CONTROL0;
@@ -144,6 +151,7 @@ struct dce110_link_enc_registers {
 	uint32_t DP_VID_STREAM_CNTL;
 	uint32_t DP_DPHY_FAST_TRAINING;
 	uint32_t DP_DPHY_BS_SR_SWAP_CNTL;
+	uint32_t DP_DPHY_HBR2_PATTERN_CONTROL;
 	uint32_t DP_SEC_CNTL1;
 };
 
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +1 -1
index c72858a1452f..b6f77f88be9c 100644
@@ -265,7 +265,7 @@ static const struct dce110_link_enc_hpd_registers link_enc_hpd_regs[] = {
 
 #define link_regs(id)\
 [id] = {\
-	LE_DCE110_REG_LIST(id)\
+	LE_DCE100_REG_LIST(id)\
 }
 
 static const struct dce110_link_enc_registers link_enc_regs[] = {
Signature · 6 lines
2.11.0

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

PATCH 9/17 drm/amd/display: support PHY compliance automation for CP2520 pattern 1/2/3

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

Change-Id Ie547a8f58734dfa4e4f84ff610c8601c3936d46e
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c   | 55 ++++++++++++----------
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c  | 17 +++++--
 drivers/gpu/drm/amd/display/include/dpcd_defs.h    |  4 +-
 .../drm/amd/display/include/link_service_types.h   | 11 +++--
 4 files changed, 53 insertions(+), 34 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +30 -25
index ef80473135c4..d04cad27cfa6 100644
@@ -1599,19 +1599,25 @@ static void dp_test_send_phy_test_pattern(struct core_link *link)
 	switch (dpcd_test_pattern.bits.PATTERN) {
 	case PHY_TEST_PATTERN_D10_2:
 		test_pattern = DP_TEST_PATTERN_D102;
-	break;
+		break;
 	case PHY_TEST_PATTERN_SYMBOL_ERROR:
 		test_pattern = DP_TEST_PATTERN_SYMBOL_ERROR;
-	break;
+		break;
 	case PHY_TEST_PATTERN_PRBS7:
 		test_pattern = DP_TEST_PATTERN_PRBS7;
-	break;
+		break;
 	case PHY_TEST_PATTERN_80BIT_CUSTOM:
 		test_pattern = DP_TEST_PATTERN_80BIT_CUSTOM;
-	break;
-	case PHY_TEST_PATTERN_HBR2_COMPLIANCE_EYE:
-		test_pattern = DP_TEST_PATTERN_HBR2_COMPLIANCE_EYE;
-	break;
+		break;
+	case PHY_TEST_PATTERN_CP2520_1:
+		test_pattern = DP_TEST_PATTERN_CP2520_1;
+		break;
+	case PHY_TEST_PATTERN_CP2520_2:
+		test_pattern = DP_TEST_PATTERN_CP2520_2;
+		break;
+	case PHY_TEST_PATTERN_CP2520_3:
+		test_pattern = DP_TEST_PATTERN_CP2520_3;
+		break;
 	default:
 		test_pattern = DP_TEST_PATTERN_VIDEO_MODE;
 	break;
@@ -2202,16 +2208,9 @@ void dc_link_dp_disable_hpd(const struct dc_link *link)
 
 static bool is_dp_phy_pattern(enum dp_test_pattern test_pattern)
 {
-	if (test_pattern == DP_TEST_PATTERN_D102 ||
-	test_pattern == DP_TEST_PATTERN_SYMBOL_ERROR ||
-	test_pattern == DP_TEST_PATTERN_PRBS7 ||
-	test_pattern == DP_TEST_PATTERN_80BIT_CUSTOM ||
-	test_pattern == DP_TEST_PATTERN_HBR2_COMPLIANCE_EYE ||
-	test_pattern == DP_TEST_PATTERN_TRAINING_PATTERN1 ||
-	test_pattern == DP_TEST_PATTERN_TRAINING_PATTERN2 ||
-	test_pattern == DP_TEST_PATTERN_TRAINING_PATTERN3 ||
-	test_pattern == DP_TEST_PATTERN_TRAINING_PATTERN4 ||
-	test_pattern == DP_TEST_PATTERN_VIDEO_MODE)
+	if ((DP_TEST_PATTERN_PHY_PATTERN_BEGIN <= test_pattern &&
+			test_pattern <= DP_TEST_PATTERN_PHY_PATTERN_END) ||
+			test_pattern == DP_TEST_PATTERN_VIDEO_MODE)
 		return true;
 	else
 		return false;
@@ -2377,22 +2376,28 @@ bool dc_link_dp_set_test_pattern(
 		switch (test_pattern) {
 		case DP_TEST_PATTERN_VIDEO_MODE:
 			pattern = PHY_TEST_PATTERN_NONE;
-		break;
+			break;
 		case DP_TEST_PATTERN_D102:
 			pattern = PHY_TEST_PATTERN_D10_2;
-		break;
+			break;
 		case DP_TEST_PATTERN_SYMBOL_ERROR:
 			pattern = PHY_TEST_PATTERN_SYMBOL_ERROR;
-		break;
+			break;
 		case DP_TEST_PATTERN_PRBS7:
 			pattern = PHY_TEST_PATTERN_PRBS7;
-		break;
+			break;
 		case DP_TEST_PATTERN_80BIT_CUSTOM:
 			pattern = PHY_TEST_PATTERN_80BIT_CUSTOM;
-		break;
-		case DP_TEST_PATTERN_HBR2_COMPLIANCE_EYE:
-			pattern = PHY_TEST_PATTERN_HBR2_COMPLIANCE_EYE;
-		break;
+			break;
+		case DP_TEST_PATTERN_CP2520_1:
+			pattern = PHY_TEST_PATTERN_CP2520_1;
+			break;
+		case DP_TEST_PATTERN_CP2520_2:
+			pattern = PHY_TEST_PATTERN_CP2520_2;
+			break;
+		case DP_TEST_PATTERN_CP2520_3:
+			pattern = PHY_TEST_PATTERN_CP2520_3;
+			break;
 		default:
 			return false;
 		}
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +12 -5
index 65cc64a17f41..ed46e9aaf357 100644
@@ -376,7 +376,8 @@ static void set_dp_phy_pattern_80bit_custom(
 }
 
 static void set_dp_phy_pattern_hbr2_compliance_cp2520_2(
-	struct dce110_link_encoder *enc110)
+	struct dce110_link_encoder *enc110,
+	unsigned int cp2520_pattern)
 {
 
 	/* previously there is a register DP_HBR2_EYE_PATTERN
@@ -408,10 +409,13 @@ static void set_dp_phy_pattern_hbr2_compliance_cp2520_2(
 	/* swap every BS with SR */
 	REG_UPDATE(DP_DPHY_SCRAM_CNTL, DPHY_SCRAMBLER_BS_COUNT, 0);
 
-	/* select cp2520 pattern 2 */
+	/* select cp2520 patterns */
 	if (REG(DP_DPHY_HBR2_PATTERN_CONTROL))
 		REG_UPDATE(DP_DPHY_HBR2_PATTERN_CONTROL,
-				DP_DPHY_HBR2_PATTERN_CONTROL, 0x2);
+				DP_DPHY_HBR2_PATTERN_CONTROL, cp2520_pattern);
+	else
+		/* pre-DCE11 can only generate CP2520 pattern 2 */
+		ASSERT(cp2520_pattern == 2);
 
 	/* set link training complete */
 	set_link_training_complete(enc110, true);
@@ -1395,8 +1399,11 @@ void dce110_link_encoder_dp_set_phy_pattern(
 		set_dp_phy_pattern_80bit_custom(
 			enc110, param->custom_pattern);
 		break;
-	case DP_TEST_PATTERN_HBR2_COMPLIANCE_EYE:
-		set_dp_phy_pattern_hbr2_compliance_cp2520_2(enc110);
+	case DP_TEST_PATTERN_CP2520_1:
+		set_dp_phy_pattern_hbr2_compliance_cp2520_2(enc110, 1);
+		break;
+	case DP_TEST_PATTERN_CP2520_2:
+		set_dp_phy_pattern_hbr2_compliance_cp2520_2(enc110, 2);
 		break;
 	case DP_TEST_PATTERN_VIDEO_MODE: {
 		set_dp_phy_pattern_passthrough_mode(
drivers/gpu/drm/amd/display/include/dpcd_defs.h +3 -1
index 2dca4a41d3cc..482f8b21c772 100644
@@ -74,7 +74,9 @@ enum dpcd_phy_test_patterns {
 	PHY_TEST_PATTERN_SYMBOL_ERROR,
 	PHY_TEST_PATTERN_PRBS7,
 	PHY_TEST_PATTERN_80BIT_CUSTOM,/* For DP1.2 only */
-	PHY_TEST_PATTERN_HBR2_COMPLIANCE_EYE/* For DP1.2 only */
+	PHY_TEST_PATTERN_CP2520_1,
+	PHY_TEST_PATTERN_CP2520_2,
+	PHY_TEST_PATTERN_CP2520_3, /* same as TPS4 */
 };
 
 enum dpcd_test_dyn_range {
drivers/gpu/drm/amd/display/include/link_service_types.h +8 -3
index 479e5fff8a00..b2326017e4c7 100644
@@ -75,19 +75,24 @@ enum dp_test_pattern {
 	/* Input data is pass through Scrambler
 	 * and 8b10b Encoder straight to output*/
 	DP_TEST_PATTERN_VIDEO_MODE = 0,
+
 	/* phy test patterns*/
-	DP_TEST_PATTERN_D102,
+	DP_TEST_PATTERN_PHY_PATTERN_BEGIN,
+	DP_TEST_PATTERN_D102 = DP_TEST_PATTERN_PHY_PATTERN_BEGIN,
 	DP_TEST_PATTERN_SYMBOL_ERROR,
 	DP_TEST_PATTERN_PRBS7,
-
 	DP_TEST_PATTERN_80BIT_CUSTOM,
-	DP_TEST_PATTERN_HBR2_COMPLIANCE_EYE,
+	DP_TEST_PATTERN_CP2520_1,
+	DP_TEST_PATTERN_CP2520_2,
+	DP_TEST_PATTERN_HBR2_COMPLIANCE_EYE = DP_TEST_PATTERN_CP2520_2,
 
 	/* Link Training Patterns */
 	DP_TEST_PATTERN_TRAINING_PATTERN1,
 	DP_TEST_PATTERN_TRAINING_PATTERN2,
 	DP_TEST_PATTERN_TRAINING_PATTERN3,
 	DP_TEST_PATTERN_TRAINING_PATTERN4,
+	DP_TEST_PATTERN_CP2520_3 = DP_TEST_PATTERN_TRAINING_PATTERN4,
+	DP_TEST_PATTERN_PHY_PATTERN_END = DP_TEST_PATTERN_TRAINING_PATTERN4,
 
 	/* link test patterns*/
 	DP_TEST_PATTERN_COLOR_SQUARES,
Signature · 6 lines
2.11.0

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

PATCH 10/17 drm/amd/display: Fix the NULL pointer. (v2)

In reply to a message not in the archive

From: Andrey Grodzovsky <[email protected]>

ret value in amdgpu_dm_atomic_check was not rest to EINVAL after drm_atomic_add_affected_planes and by this making any subsequent validation failure pass when returning to atomic_check.

v2: Add WARN_ON print for dc_commit_streams in amdgpu_dm_atomic_commit_tail since this should never fail.

Change-Id Ib12655cf88aa3e56c3f1f11456cc6ca11daaa26a
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +3 -1
index ede895515801..34ddbe331df2 100644
@@ -2563,7 +2563,7 @@ void amdgpu_dm_atomic_commit_tail(
 	}
 
 	/* DC is optimized not to do anything if 'streams' didn't change. */
-	dc_commit_streams(dm->dc, commit_streams, commit_streams_count);
+	WARN_ON(!dc_commit_streams(dm->dc, commit_streams, commit_streams_count));
 
 	list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
 		struct amdgpu_crtc *acrtc = to_amdgpu_crtc(crtc);
@@ -3029,6 +3029,8 @@ int amdgpu_dm_atomic_check(struct drm_device *dev,
 		ret = drm_atomic_add_affected_planes(state, crtc);
 		if (ret)
 			return ret;
+
+		ret = -EINVAL;
 	}
 
 	for (i = 0; i < set_count; i++) {
Signature · 6 lines
2.11.0

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

PATCH 11/17 drm/amd/display: Fix gfx9 parameters reading for DC.

In reply to a message not in the archive

From: Andrey Grodzovsky <[email protected]>

Change-Id If46b2e2edacd3976d7dea4bf220aed8c0d6be07c
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +2 -0
index 34ddbe331df2..803459cdb52b 100644
@@ -534,6 +534,8 @@ static void fill_plane_attributes_from_fb(
 			adev->gfx.config.gb_addr_config_fields.num_se;
 		surface->tiling_info.gfx9.max_compressed_frags =
 			adev->gfx.config.gb_addr_config_fields.max_compress_frags;
+		surface->tiling_info.gfx9.num_rb_per_se =
+			adev->gfx.config.gb_addr_config_fields.num_rb_per_se;
 		surface->tiling_info.gfx9.swizzle =
 			AMDGPU_TILING_GET(tiling_flags, SWIZZLE_MODE);
 		surface->tiling_info.gfx9.shaderEnable = 1;
Signature · 6 lines
2.11.0

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

PATCH 12/17 drm/amd/display: Unhardcode acrtc->max_cursor_{height, width}

In reply to a message not in the archive

From: Andrey Grodzovsky <[email protected]>

Change-Id I977e896e9555af0a6a8d8557ca25455ff0db4e02
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +2 -2
index 803459cdb52b..d2e2485bdf7a 100644
@@ -1778,8 +1778,8 @@ int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
 
 	drm_crtc_helper_add(&acrtc->base, &amdgpu_dm_crtc_helper_funcs);
 
-	acrtc->max_cursor_width = 128;
-	acrtc->max_cursor_height = 128;
+	acrtc->max_cursor_width = dm->adev->dm.dc->caps.max_cursor_size;
+	acrtc->max_cursor_height = dm->adev->dm.dc->caps.max_cursor_size;
 
 	acrtc->crtc_id = crtc_index;
 	acrtc->base.enabled = false;
Signature · 6 lines
2.11.0

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

PATCH 13/17 drm/amd/display: Unhardcode cursor size reported back to UMD.

In reply to a message not in the archive

From: Andrey Grodzovsky <[email protected]>

This will return back MAX cursor size for given ASIC.

Change-Id Id3bb24f67db9c08ade4083bb8e5baa976de924e0
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +2 -2
index 59aafba041ee..df7f08b46123 100644
@@ -317,8 +317,8 @@ int amdgpu_dm_init(struct amdgpu_device *adev)
 	/* TODO: Add_display_info? */
 
 	/* TODO use dynamic cursor width */
-	adev->ddev->mode_config.cursor_width = 128;
-	adev->ddev->mode_config.cursor_height = 128;
+	adev->ddev->mode_config.cursor_width = adev->dm.dc->caps.max_cursor_size;
+	adev->ddev->mode_config.cursor_height = adev->dm.dc->caps.max_cursor_size;
 
 	if (drm_vblank_init(adev->ddev, adev->dm.display_indexes_num)) {
 		DRM_ERROR(
Signature · 6 lines
2.11.0

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

PATCH 14/17 drm/amd/display: Set cursor pitch to cursor width (in pixels).

In reply to a message not in the archive

From: Andrey Grodzovsky <[email protected]>

Change-Id I2e37b03c38c07d448169ed534784ce38b2541d74
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +2 -0
index d2e2485bdf7a..929a4c8ea62d 100644
@@ -97,6 +97,8 @@ static void dm_set_cursor(
 	attributes.rotation_angle    = 0;
 	attributes.attribute_flags.value = 0;
 
+	attributes.pitch = attributes.width;
+
 	x = amdgpu_crtc->cursor_x;
 	y = amdgpu_crtc->cursor_y;
 
Signature · 6 lines
2.11.0

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

PATCH 15/17 drm/amd/display: Fix applying surface to underlay pipe

In reply to a message not in the archive

From: Leon Elazar <[email protected]>

1. Locking all pipes before doing any changes
2. Applying surface for both top and bottom pipes

Change-Id Id631dcfcd41bc33e7f9df1128591b5bedf18ecad
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 34 +++++++++++++++++++++-----------
 1 file changed, 22 insertions(+), 12 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +22 -12
index 6409d4d1d7f8..c0889ad8357e 100644
@@ -1331,32 +1331,41 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 	if (!surface_count)  /* reset */
 		core_dc->hwss.apply_ctx_for_surface(core_dc, NULL, context);
 
+	/* Lock pipes for provided surfaces */
 	for (i = 0; i < surface_count; i++) {
 		struct core_surface *surface = DC_SURFACE_TO_CORE(srf_updates[i].surface);
 
 		for (j = 0; j < context->res_ctx.pool->pipe_count; j++) {
 			struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
-			struct pipe_ctx *cur_pipe_ctx;
-			bool is_new_pipe_surface = true;
 
 			if (pipe_ctx->surface != surface)
 				continue;
-
-			if (update_type >= UPDATE_TYPE_MED) {
-				/* only apply for top pipe */
-				if (!pipe_ctx->top_pipe) {
-					core_dc->hwss.apply_ctx_for_surface(core_dc,
-							 surface, context);
-					context_timing_trace(dc, &context->res_ctx);
-				}
-			}
-
 			if (!pipe_ctx->tg->funcs->is_blanked(pipe_ctx->tg)) {
 				core_dc->hwss.pipe_control_lock(
 						core_dc,
 						pipe_ctx,
 						true);
 			}
+		}
+	}
+
+	/* Perform requested Updates */
+	for (i = 0; i < surface_count; i++) {
+		struct core_surface *surface = DC_SURFACE_TO_CORE(srf_updates[i].surface);
+
+		if (update_type >= UPDATE_TYPE_MED) {
+				core_dc->hwss.apply_ctx_for_surface(
+						core_dc, surface, context);
+				context_timing_trace(dc, &context->res_ctx);
+		}
+
+		for (j = 0; j < context->res_ctx.pool->pipe_count; j++) {
+			struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
+			struct pipe_ctx *cur_pipe_ctx;
+			bool is_new_pipe_surface = true;
+
+			if (pipe_ctx->surface != surface)
+				continue;
 
 			if (srf_updates[i].flip_addr)
 				core_dc->hwss.update_plane_addr(core_dc, pipe_ctx);
@@ -1387,6 +1396,7 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 		}
 	}
 
+	/* Unlock pipes */
 	for (i = context->res_ctx.pool->pipe_count - 1; i >= 0; i--) {
 		struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
 
Signature · 6 lines
2.11.0

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

PATCH 16/17 drm/amd/display: DP is hotplugged, HDMI with 4:2:0 corruption

In reply to a message not in the archive

From: Charlene Liu <[email protected]>

Change-Id I11725143b39e44e989750a1cf52e02ea8bcfdc42
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +7 -4
index 9f624e84f59b..875d1a63fcea 100644
@@ -297,8 +297,8 @@ bool resource_are_streams_timing_synchronizable(
 		return false;
 
 	if (stream1->phy_pix_clk != stream2->phy_pix_clk
-			&& !dc_is_dp_signal(stream1->signal)
-			&& !dc_is_dp_signal(stream2->signal))
+			&& (!dc_is_dp_signal(stream1->signal)
+			|| !dc_is_dp_signal(stream2->signal)))
 		return false;
 
 	return true;
@@ -1063,6 +1063,8 @@ static bool are_stream_backends_same(
 	if (stream_a == NULL || stream_b == NULL)
 		return false;
 
+	if (stream_a->public.timing.pixel_encoding != stream_b->public.timing.pixel_encoding)
+		return false;
 	if (is_timing_changed(stream_a, stream_b))
 		return false;
 
@@ -1072,8 +1074,8 @@ static bool are_stream_backends_same(
 bool is_stream_unchanged(
 	const struct core_stream *old_stream, const struct core_stream *stream)
 {
-	if (old_stream == stream)
-		return true;
+	if (old_stream != stream)
+		return false;
 
 	if (!are_stream_backends_same(old_stream, stream))
 		return false;
@@ -1357,6 +1359,7 @@ enum dc_status resource_map_pool_resources(
 			continue;
 		}
 	}
+
 		/* mark resources used for stream that is already active */
 		for (j = 0; j < MAX_PIPES; j++) {
 			struct pipe_ctx *pipe_ctx =
Signature · 6 lines
2.11.0

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

PATCH 17/17 drm/amd/display: remove redundant check

In reply to a message not in the archive

From: Charlene Liu <[email protected]>

Change-Id Ifa3394d9c57d4744195c044f78dbddb3679c082a
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +0 -4
index 875d1a63fcea..61ca1e21ae66 100644
@@ -1063,8 +1063,6 @@ static bool are_stream_backends_same(
 	if (stream_a == NULL || stream_b == NULL)
 		return false;
 
-	if (stream_a->public.timing.pixel_encoding != stream_b->public.timing.pixel_encoding)
-		return false;
 	if (is_timing_changed(stream_a, stream_b))
 		return false;
 
@@ -1074,8 +1072,6 @@ static bool are_stream_backends_same(
 bool is_stream_unchanged(
 	const struct core_stream *old_stream, const struct core_stream *stream)
 {
-	if (old_stream != stream)
-		return false;
 
 	if (!are_stream_backends_same(old_stream, stream))
 		return false;
Signature · 6 lines
2.11.0

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