Skip to contentSkip to conversation

DC Patches Feb 12, 2018

PATCH In review Harry Wentland 2 participants 38 messages Feb 12, 2018 – Feb 13, 2018 4 messages not in the archive

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

cover DC Patches Feb 12, 2018

* Start using gamma, regamma and CTM (Leo)
* Raven eDP boot optimization
* Get FBC to work without fbdev emulation
* Bunch of cleanups and Raven fixes

Anthony Koo (1):
drm/amd/display: provide an interface to query firmware version

Charlene Liu (2):
drm/amd/display: boot up/S4 fix mainlink off before BL. drm/amd/display: add force_trigger even to static screen control

Dmytro Laktyushkin (1):
drm/amd/display: disable seamless vp adjustment for mirrored surface

Eric Yang (2):
drm/amd/display: Tread bad EDID as no EDID drm/amd/display: Add logging for aux DPCD access

Harry Wentland (6):
drm/amd/display: Change blackout time to 0 on CZ/ST drm/amd/display: Remove unused DCE80 compressor drm/amd/display: Re-use DCE100 display_power_gating for DCE80 drm/amd/display: Make couple functions in DCE80 TG static drm/amd/display: Add missing Vega defines to dal_asic_id drm/amd/display: Remove unused dm_pp_ interfaces

Hersen Wu (1):
drm/amd/display: VGA black screen from s3 when attached to hook

John Barberiz (2):
drm/amd/display: Rearchitecture HDMI HPD drm/amd/display: Remove delay on disconnect patch

Ken Chalmers (1):
drm/amd/display: Remove duplicate entries from BIOS function table

Leo (Sunpeng) Li (11):
drm/amd/display: Use hardware max low point when sampling OTF drm/amd/display: Add color module's gamma helpers to Linux build drm/amd/display: Implement color management drm/amd/display: Hookup color management functions drm/amd/display: Refactor max color lut entries into a macro. drm/amd/display: Expose dither setting functionality to Linux drm/amd/display: When enabling CRC, disable dither & enable truncation drm/amd/display: Rework DCE transform bit depth reduction programming. drm/amd/display: Expose DCE110 CRC functions for DCE8 drm/amd/display: Skip 2 frames when first reading CRC drm/amd/display: Fix increment when sampling OTF in DCE

Martin Tsai (1):
drm/amd/display: add monitor patch for delay after DP receive power up

Roman Li (1):
drm/amd/display: Make FBC work without fbdev emulation

Tao (1):
drm/amd/display: Set vsc pack revision when DPCD revision is >= 1.2

Tony Cheng (2):
drm/amd/display: dal 3.1.33
drm/amd/display: dal 3.1.34

Vitaly Prosyak (1):
drm/amd/display: De PQ implementation

Yongqiang Sun (1):
drm/amd/display: Keep eDP stream enabled during boot.

 drivers/gpu/drm/amd/display/Makefile               |    3 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/Makefile     |    2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  |  106 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h  |   10 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_color.c    |  228 ++++
 .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c  |   23 +-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_services.c |   33 -
 drivers/gpu/drm/amd/display/dc/bios/bios_parser.c  |    4 -
 drivers/gpu/drm/amd/display/dc/calcs/dce_calcs.c   |    8 +-
 drivers/gpu/drm/amd/display/dc/core/dc.c           |   59 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      |   65 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c   |    2 +-
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  |   12 +-
 drivers/gpu/drm/amd/display/dc/dc.h                |   18 +-
 drivers/gpu/drm/amd/display/dc/dc_link.h           |    4 +
 drivers/gpu/drm/amd/display/dc/dc_stream.h         |    3 +
 drivers/gpu/drm/amd/display/dc/dc_types.h          |    2 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c      |    2 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.c |  104 +-
 .../amd/display/dc/dce100/dce100_hw_sequencer.c    |    2 +-
 .../amd/display/dc/dce100/dce100_hw_sequencer.h    |    4 +
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |   53 +-
 .../display/dc/dce110/dce110_timing_generator.c    |    8 +-
 .../display/dc/dce110/dce110_timing_generator.h    |    6 +
 drivers/gpu/drm/amd/display/dc/dce80/Makefile      |    2 +-
 .../drm/amd/display/dc/dce80/dce80_compressor.c    |  834 ------------
 .../drm/amd/display/dc/dce80/dce80_compressor.h    |   78 --
 .../drm/amd/display/dc/dce80/dce80_hw_sequencer.c  |   38 +-
 .../amd/display/dc/dce80/dce80_timing_generator.c  |  127 +-
 .../amd/display/dc/dce80/dce80_timing_generator.h  |    6 -
 .../gpu/drm/amd/display/dc/dcn10/dcn10_dpp_cm.c    |   30 +-
 .../drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c  |    2 +
 drivers/gpu/drm/amd/display/dc/dm_services.h       |   31 -
 drivers/gpu/drm/amd/display/dc/i2caux/aux_engine.c |   16 +
 drivers/gpu/drm/amd/display/dc/inc/hw/dmcu.h       |    7 -
 drivers/gpu/drm/amd/display/include/dal_asic_id.h  |    8 +
 drivers/gpu/drm/amd/display/modules/color/Makefile |   31 +
 .../drm/amd/display/modules/color/color_gamma.c    | 1403 ++++++++++++++++++++
 .../drm/amd/display/modules/color/color_gamma.h    |   53 +
 39 files changed, 2135 insertions(+), 1292 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_compressor.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_compressor.h
 create mode 100644 drivers/gpu/drm/amd/display/modules/color/Makefile
 create mode 100644 drivers/gpu/drm/amd/display/modules/color/color_gamma.c
 create mode 100644 drivers/gpu/drm/amd/display/modules/color/color_gamma.h
Signature · 6 lines
2.14.1

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

#2 lore raw

PATCH 1/34 drm/amd/display: Rearchitecture HDMI HPD

From: John Barberiz <[email protected]>

- Disabled HPD filter and used HPD software timer instead
- Allows DM to disable HPD filtering

Change-Id I379d6285ffe85e1a98f560d5428839235928e43b
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 32 +++++++++++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/dc_link.h      |  4 ++++
 2 files changed, 36 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +32 -0
index 50aa9a4521f3..02e1c3b188fd 100644
@@ -127,6 +127,8 @@ static bool program_hpd_filter(
 	int delay_on_connect_in_ms = 0;
 	int delay_on_disconnect_in_ms = 0;
 
+	if (link->is_hpd_filter_disabled)
+		return false;
 	/* Verify feature is supported */
 	switch (link->connector_signal) {
 	case SIGNAL_TYPE_DVI_SINGLE_LINK:
@@ -2346,3 +2348,33 @@ void core_link_set_avmute(struct pipe_ctx *pipe_ctx, bool enable)
 	core_dc->hwss.set_avmute(pipe_ctx, enable);
 }
 
+void dc_link_disable_hpd_filter(struct dc_link *link)
+{
+	struct gpio *hpd;
+
+	if (!link->is_hpd_filter_disabled) {
+		link->is_hpd_filter_disabled = true;
+		/* Obtain HPD handle */
+		hpd = get_hpd_gpio(link->ctx->dc_bios, link->link_id, link->ctx->gpio_service);
+
+		if (!hpd)
+			return;
+
+		/* Setup HPD filtering */
+		if (dal_gpio_open(hpd, GPIO_MODE_INTERRUPT) == GPIO_RESULT_OK) {
+			struct gpio_hpd_config config;
+
+			config.delay_on_connect = 0;
+			config.delay_on_disconnect = 0;
+
+			dal_irq_setup_hpd_filter(hpd, &config);
+
+			dal_gpio_close(hpd);
+		} else {
+			ASSERT_CRITICAL(false);
+		}
+		/* Release HPD handle */
+		dal_gpio_destroy_irq(&hpd);
+	}
+}
+
drivers/gpu/drm/amd/display/dc/dc_link.h +4 -0
index f11a734da1db..ac0f617b43c9 100644
@@ -64,6 +64,8 @@ struct dc_link {
 	enum signal_type connector_signal;
 	enum dc_irq_source irq_source_hpd;
 	enum dc_irq_source irq_source_hpd_rx;/* aka DP Short Pulse  */
+	bool is_hpd_filter_disabled;
+
 	/* caps is the same as reported_link_cap. link_traing use
 	 * reported_link_cap. Will clean up.  TODO
 	 */
@@ -195,6 +197,8 @@ bool dc_link_dp_set_test_pattern(
 	const unsigned char *p_custom_pattern,
 	unsigned int cust_pattern_size);
 
+void dc_link_disable_hpd_filter(struct dc_link *link);
+
 /*
  * DPCD access interfaces
  */
Signature · 6 lines
2.14.1

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

PATCH 2/34 drm/amd/display: VGA black screen from s3 when attached to hook

In reply to a message not in the archive

From: Hersen Wu <[email protected]>

[Description] For MST, DC already notify MST sink for MST mode, DC stll check DP SINK DPCD register to see if MST enabled. DP RX firmware may not handle this properly.

Change-Id I54cd4d4fc4f9baf8a6f44ad0b50209e50cbbdc92
---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -1
index 4ee4c03a6724..604fb0171ee3 100644
@@ -1465,7 +1465,7 @@ void decide_link_settings(struct dc_stream_state *stream,
 	/* MST doesn't perform link training for now
 	 * TODO: add MST specific link training routine
 	 */
-	if (is_mst_supported(link)) {
+	if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST) {
 		*link_setting = link->verified_link_cap;
 		return;
 	}
Signature · 6 lines
2.14.1

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

PATCH 3/34 drm/amd/display: boot up/S4 fix mainlink off before BL.

In reply to a message not in the archive

From: Charlene Liu <[email protected]>

Change-Id I0c7e3422f9ba134ffccd50778789caa6d4b6ae30
---
 drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 -1
index 54c933b94093..53243d5bad9a 100644
@@ -1481,7 +1481,7 @@ void dce110_enable_accelerated_mode(struct dc *dc, struct dc_state *context)
 
 	struct dc_link *edp_link = get_link_for_edp(dc);
 	if (dcb->funcs->get_vga_enabled_displays(dc->ctx->dc_bios) != 0) {
-		if (edp_link_to_turnoff) {
+		if (edp_link) {
 			/*we need turn off backlight before DP_blank and encoder powered down, todo add optimization*/
 			dc->hwss.edp_backlight_control(edp_link, false);
 		}
Signature · 6 lines
2.14.1

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

PATCH 4/34 drm/amd/display: dal 3.1.33

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

Change-Id I559abccee2a41f70731200ec81a4d4b50c6cc739
---
 drivers/gpu/drm/amd/display/dc/dc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
index 03af1a04c6aa..d3ca22fcc166 100644
@@ -38,7 +38,7 @@
 #include "inc/compressor.h"
 #include "dml/display_mode_lib.h"
 
-#define DC_VER "3.1.32"
+#define DC_VER "3.1.33"
 
 #define MAX_SURFACES 3
 #define MAX_STREAMS 6
Signature · 6 lines
2.14.1

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

PATCH 5/34 drm/amd/display: add force_trigger even to static screen control

In reply to a message not in the archive

From: Charlene Liu <[email protected]>

Change-Id I27e1779010662ac63b7b4e9c83aaa4f3ebf1db37
---
 drivers/gpu/drm/amd/display/dc/dc.h                         | 1 +
 drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 2 ++
 drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c   | 2 ++
 3 files changed, 5 insertions(+)
drivers/gpu/drm/amd/display/dc/dc.h +1 -0
index d3ca22fcc166..0c92ddb3d3f5 100644
@@ -95,6 +95,7 @@ struct dc_surface_dcc_cap {
 };
 
 struct dc_static_screen_events {
+	bool force_trigger;
 	bool cursor_update;
 	bool surface_update;
 	bool overlay_update;
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +2 -0
index 53243d5bad9a..5c387e8d58a2 100644
@@ -1625,6 +1625,8 @@ static void set_static_screen_control(struct pipe_ctx **pipe_ctx,
 		value |= 0x80;
 	if (events->cursor_update)
 		value |= 0x2;
+	if (events->force_trigger)
+		value |= 0x1;
 
 #if defined(CONFIG_DRM_AMD_DC_FBC)
 	value |= 0x84;
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_hw_sequencer.c +2 -0
index 5d3dedfbc69e..29dc37fbdb26 100644
@@ -2144,6 +2144,8 @@ static void set_static_screen_control(struct pipe_ctx **pipe_ctx,
 		value |= 0x80;
 	if (events->cursor_update)
 		value |= 0x2;
+	if (events->force_trigger)
+		value |= 0x1;
 
 	for (i = 0; i < num_pipes; i++)
 		pipe_ctx[i]->stream_res.tg->funcs->
Signature · 6 lines
2.14.1

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

PATCH 6/34 drm/amd/display: Change blackout time to 0 on CZ/ST

In reply to a message not in the archive

These should only be non-0 if big hammer w/a is implemented. Currently DC doesn't implement it, so leave them 0.

Change-Id I8bfb01d3bbf02e08628e64e740ef3df5de4ae04a
---
 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 bb03a9c64d5a..6d38b8f43198 100644
@@ -2033,8 +2033,8 @@ void bw_calcs_init(struct bw_calcs_dceip *bw_dceip,
 		vbios.cursor_width = 32;
 		vbios.average_compression_rate = 4;
 		vbios.number_of_request_slots_gmc_reserves_for_dmif_per_channel = 256;
-		vbios.blackout_duration = bw_int_to_fixed(18); /* us */
-		vbios.maximum_blackout_recovery_time = bw_int_to_fixed(20);
+		vbios.blackout_duration = bw_int_to_fixed(0); /* us */
+		vbios.maximum_blackout_recovery_time = bw_int_to_fixed(0);
 
 		dceip.large_cursor = false;
 		dceip.dmif_request_buffer_size = bw_int_to_fixed(768);
@@ -2366,8 +2366,8 @@ void bw_calcs_init(struct bw_calcs_dceip *bw_dceip,
 		vbios.cursor_width = 32;
 		vbios.average_compression_rate = 4;
 		vbios.number_of_request_slots_gmc_reserves_for_dmif_per_channel = 256;
-		vbios.blackout_duration = bw_int_to_fixed(18); /* us */
-		vbios.maximum_blackout_recovery_time = bw_int_to_fixed(20);
+		vbios.blackout_duration = bw_int_to_fixed(0); /* us */
+		vbios.maximum_blackout_recovery_time = bw_int_to_fixed(0);
 
 		dceip.large_cursor = false;
 		dceip.dmif_request_buffer_size = bw_int_to_fixed(768);
Signature · 6 lines
2.14.1

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

PATCH 7/34 drm/amd/display: add monitor patch for delay after DP receive power up

In reply to a message not in the archive

From: Martin Tsai <[email protected]>

Change-Id Ic8ab8775d7a0df9c12ed94ec02da8b257a43a77f
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 6 ++++++
 drivers/gpu/drm/amd/display/dc/dc_types.h     | 1 +
 2 files changed, 7 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +6 -0
index 02e1c3b188fd..9ede0f884f15 100644
@@ -1260,6 +1260,12 @@ static enum dc_status enable_link_dp(
 		pipe_ctx->clock_source->id,
 		&link_settings);
 
+	if (stream->sink->edid_caps.panel_patch.dppowerup_delay > 0) {
+		int delay_dp_power_up_in_ms = stream->sink->edid_caps.panel_patch.dppowerup_delay;
+
+		msleep(delay_dp_power_up_in_ms);
+	}
+
 	panel_mode = dp_get_panel_mode(link);
 	dpcd_configure_panel_mode(link, panel_mode);
 
drivers/gpu/drm/amd/display/dc/dc_types.h +1 -0
index fbbe92f7a33a..aa5b90e6beb7 100644
@@ -195,6 +195,7 @@ union display_content_support {
 
 struct dc_panel_patch {
 	unsigned int disconnect_delay;
+	unsigned int dppowerup_delay;
 };
 
 struct dc_edid_caps {
Signature · 6 lines
2.14.1

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

PATCH 8/34 drm/amd/display: disable seamless vp adjustment for mirrored surface

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

Change-Id I36ccf887310c2d76181ef3cf638ee6af897e5abc
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +4 -4
index a215c5b74cbd..a6f8c1f93693 100644
@@ -696,7 +696,7 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r
 
 
 	/* Adjust for viewport end clip-off */
-	if ((data->viewport.x + data->viewport.width) < (src.x + src.width)) {
+	if ((data->viewport.x + data->viewport.width) < (src.x + src.width) && !flip_horz_scan_dir) {
 		int vp_clip = src.x + src.width - data->viewport.width - data->viewport.x;
 		int int_part = dal_fixed31_32_floor(
 				dal_fixed31_32_sub(data->inits.h, data->ratios.horz));
@@ -704,7 +704,7 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r
 		int_part = int_part > 0 ? int_part : 0;
 		data->viewport.width += int_part < vp_clip ? int_part : vp_clip;
 	}
-	if ((data->viewport.y + data->viewport.height) < (src.y + src.height)) {
+	if ((data->viewport.y + data->viewport.height) < (src.y + src.height) && !flip_vert_scan_dir) {
 		int vp_clip = src.y + src.height - data->viewport.height - data->viewport.y;
 		int int_part = dal_fixed31_32_floor(
 				dal_fixed31_32_sub(data->inits.v, data->ratios.vert));
@@ -712,7 +712,7 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r
 		int_part = int_part > 0 ? int_part : 0;
 		data->viewport.height += int_part < vp_clip ? int_part : vp_clip;
 	}
-	if ((data->viewport_c.x + data->viewport_c.width) < (src.x + src.width) / vpc_div) {
+	if ((data->viewport_c.x + data->viewport_c.width) < (src.x + src.width) / vpc_div && !flip_horz_scan_dir) {
 		int vp_clip = (src.x + src.width) / vpc_div -
 				data->viewport_c.width - data->viewport_c.x;
 		int int_part = dal_fixed31_32_floor(
@@ -721,7 +721,7 @@ static void calculate_inits_and_adj_vp(struct pipe_ctx *pipe_ctx, struct view *r
 		int_part = int_part > 0 ? int_part : 0;
 		data->viewport_c.width += int_part < vp_clip ? int_part : vp_clip;
 	}
-	if ((data->viewport_c.y + data->viewport_c.height) < (src.y + src.height) / vpc_div) {
+	if ((data->viewport_c.y + data->viewport_c.height) < (src.y + src.height) / vpc_div && !flip_vert_scan_dir) {
 		int vp_clip = (src.y + src.height) / vpc_div -
 				data->viewport_c.height - data->viewport_c.y;
 		int int_part = dal_fixed31_32_floor(
Signature · 6 lines
2.14.1

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

PATCH 9/34 drm/amd/display: dal 3.1.34

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

Change-Id Ic417b7ca8089a4f37c4c4c9c426a4d4fdb4d3151
---
 drivers/gpu/drm/amd/display/dc/dc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
index 0c92ddb3d3f5..0be839b152ec 100644
@@ -38,7 +38,7 @@
 #include "inc/compressor.h"
 #include "dml/display_mode_lib.h"
 
-#define DC_VER "3.1.33"
+#define DC_VER "3.1.34"
 
 #define MAX_SURFACES 3
 #define MAX_STREAMS 6
Signature · 6 lines
2.14.1

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

PATCH 10/34 drm/amd/display: Keep eDP stream enabled during boot.

In reply to a message not in the archive

From: Yongqiang Sun <[email protected]>

This path fixed specific eDP panel cold boot black screen due to unnecessary enable link.
Change:
In case of boot up with eDP, if OS is going to set mode
on eDP, keep eDP light up, do not disable and reset corresponding HW.
This change may affect dce asics and S3/S4 Resume with multi-monitor.

Change-Id I658328103edd41aad01757e80defff5a2c116ca4
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      | 11 +++++-
 drivers/gpu/drm/amd/display/dc/dc.h                |  2 +
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 45 +++++++++++-----------
 3 files changed, 34 insertions(+), 24 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +10 -1
index 9ede0f884f15..44b12f0405ee 100644
@@ -2296,7 +2296,16 @@ void core_link_enable_stream(
 {
 	struct dc  *core_dc = pipe_ctx->stream->ctx->dc;
 
-	enum dc_status status = enable_link(state, pipe_ctx);
+	enum dc_status status;
+
+	/* eDP lit up by bios already, no need to enable again. */
+	if (pipe_ctx->stream->signal == SIGNAL_TYPE_EDP &&
+		core_dc->apply_edp_fast_boot_optimization) {
+		core_dc->apply_edp_fast_boot_optimization = false;
+		return;
+	}
+
+	status = enable_link(state, pipe_ctx);
 
 	if (status != DC_OK) {
 			dm_logger_write(pipe_ctx->stream->ctx->logger,
drivers/gpu/drm/amd/display/dc/dc.h +2 -0
index 0be839b152ec..a512b05303e2 100644
@@ -257,6 +257,8 @@ struct dc {
 
 	bool optimized_required;
 
+	bool apply_edp_fast_boot_optimization;
+
 	/* FBC compressor */
 #if defined(CONFIG_DRM_AMD_DC_FBC)
 	struct compressor *fbc_compressor;
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +22 -23

64 lines not on this page · raw message

Signature · 6 lines
2.14.1

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

PATCH 11/34 drm/amd/display: Remove unused DCE80 compressor

In reply to a message not in the archive
Change-Id Ia65abc9c0516b8b64adb36061087c5b35d3eb10a
---
 drivers/gpu/drm/amd/display/dc/dce80/Makefile      |   2 +-
 .../drm/amd/display/dc/dce80/dce80_compressor.c    | 834 ---------------------
 .../drm/amd/display/dc/dce80/dce80_compressor.h    |  78 --
 3 files changed, 1 insertion(+), 913 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_compressor.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_compressor.h
drivers/gpu/drm/amd/display/dc/dce80/Makefile +1 -1
index bc388aa4b2f5..666fcb2bdbba 100644
@@ -23,7 +23,7 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
-DCE80 = dce80_timing_generator.o dce80_compressor.o dce80_hw_sequencer.o \
+DCE80 = dce80_timing_generator.o dce80_hw_sequencer.o \
 	dce80_resource.o
 
 AMD_DAL_DCE80 = $(addprefix $(AMDDALPATH)/dc/dce80/,$(DCE80))
drivers/gpu/drm/amd/display/dc/dce80/dce80_compressor.c deleted +0 -834

834 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce80/dce80_compressor.h deleted +0 -78

78 lines not on this page · raw message

Signature · 6 lines
2.14.1

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

PATCH 12/34 drm/amd/display: Re-use DCE100 display_power_gating for DCE80

In reply to a message not in the archive

Both functions are the same

Change-Id Ic5b3aca8aab8f06531cfbab8acb53ff9c235ffaf
---
 .../amd/display/dc/dce100/dce100_hw_sequencer.c    |  2 +-
 .../amd/display/dc/dce100/dce100_hw_sequencer.h    |  4 +++
 .../drm/amd/display/dc/dce80/dce80_hw_sequencer.c  | 38 +---------------------
 3 files changed, 6 insertions(+), 38 deletions(-)
drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.c +1 -1
index 469af0587604..41f83ecd7469 100644
@@ -69,7 +69,7 @@ static const struct dce100_hw_seq_reg_offsets reg_offsets[] = {
  ******************************************************************************/
 /***************************PIPE_CONTROL***********************************/
 
-static bool dce100_enable_display_power_gating(
+bool dce100_enable_display_power_gating(
 	struct dc *dc,
 	uint8_t controller_id,
 	struct dc_bios *dcb,
drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.h +4 -0
index cb5384ef46c3..c6ec0ed6ec3d 100644
@@ -38,5 +38,9 @@ void dce100_set_bandwidth(
 		struct dc_state *context,
 		bool decrease_allowed);
 
+bool dce100_enable_display_power_gating(struct dc *dc, uint8_t controller_id,
+					struct dc_bios *dcb,
+					enum pipe_gating_control power_gating);
+
 #endif /* __DC_HWSS_DCE100_H__ */
 
drivers/gpu/drm/amd/display/dc/dce80/dce80_hw_sequencer.c +1 -37
index ccfcf1c0eeb3..6c6a1a16af19 100644
@@ -70,47 +70,11 @@ static const struct dce80_hw_seq_reg_offsets reg_offsets[] = {
 
 /***************************PIPE_CONTROL***********************************/
 
-static bool dce80_enable_display_power_gating(
-	struct dc *dc,
-	uint8_t controller_id,
-	struct dc_bios *dcb,
-	enum pipe_gating_control power_gating)
-{
-	enum bp_result bp_result = BP_RESULT_OK;
-	enum bp_pipe_control_action cntl;
-	struct dc_context *ctx = dc->ctx;
-
-	if (power_gating == PIPE_GATING_CONTROL_INIT)
-		cntl = ASIC_PIPE_INIT;
-	else if (power_gating == PIPE_GATING_CONTROL_ENABLE)
-		cntl = ASIC_PIPE_ENABLE;
-	else
-		cntl = ASIC_PIPE_DISABLE;
-
-	if (!(power_gating == PIPE_GATING_CONTROL_INIT && controller_id != 0)){
-
-		bp_result = dcb->funcs->enable_disp_power_gating(
-						dcb, controller_id + 1, cntl);
-
-		/* Revert MASTER_UPDATE_MODE to 0 because bios sets it 2
-		 * by default when command table is called
-		 */
-		dm_write_reg(ctx,
-			HW_REG_CRTC(mmMASTER_UPDATE_MODE, controller_id),
-			0);
-	}
-
-	if (bp_result == BP_RESULT_OK)
-		return true;
-	else
-		return false;
-}
-
 void dce80_hw_sequencer_construct(struct dc *dc)
 {
 	dce110_hw_sequencer_construct(dc);
 
-	dc->hwss.enable_display_power_gating = dce80_enable_display_power_gating;
+	dc->hwss.enable_display_power_gating = dce100_enable_display_power_gating;
 	dc->hwss.pipe_control_lock = dce_pipe_control_lock;
 	dc->hwss.set_bandwidth = dce100_set_bandwidth;
 }
Signature · 6 lines
2.14.1

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

PATCH 13/34 drm/amd/display: Make couple functions in DCE80 TG static

In reply to a message not in the archive
Change-Id Iadd754d57ec8e7bd5ce46bba97664b1c4932e395
---
 .../amd/display/dc/dce80/dce80_timing_generator.c  | 125 +++++++++++----------
 .../amd/display/dc/dce80/dce80_timing_generator.h  |   6 -
 2 files changed, 63 insertions(+), 68 deletions(-)
drivers/gpu/drm/amd/display/dc/dce80/dce80_timing_generator.c +63 -62
index 265894851493..2934650e0434 100644
@@ -84,7 +84,7 @@ static const struct dce110_timing_generator_offsets reg_offsets[] = {
 #define DCP_REG(reg) (reg + tg110->offsets.dcp)
 #define DMIF_REG(reg) (reg + tg110->offsets.dmif)
 
-void program_pix_dur(struct timing_generator *tg, uint32_t pix_clk_khz)
+static void program_pix_dur(struct timing_generator *tg, uint32_t pix_clk_khz)
 {
 	uint64_t pix_dur;
 	uint32_t addr = mmDMIF_PG0_DPG_PIPE_ARBITRATION_CONTROL1
@@ -115,6 +115,68 @@ static void program_timing(struct timing_generator *tg,
 	dce110_tg_program_timing(tg, timing, use_vbios);
 }
 
+static void dce80_timing_generator_enable_advanced_request(
+	struct timing_generator *tg,
+	bool enable,
+	const struct dc_crtc_timing *timing)
+{
+	struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
+	uint32_t addr = CRTC_REG(mmCRTC_START_LINE_CONTROL);
+	uint32_t value = dm_read_reg(tg->ctx, addr);
+
+	if (enable) {
+		set_reg_field_value(
+			value,
+			0,
+			CRTC_START_LINE_CONTROL,
+			CRTC_LEGACY_REQUESTOR_EN);
+	} else {
+		set_reg_field_value(
+			value,
+			1,
+			CRTC_START_LINE_CONTROL,
+			CRTC_LEGACY_REQUESTOR_EN);
+	}
+
+	if ((timing->v_sync_width + timing->v_front_porch) <= 3) {
+		set_reg_field_value(
+			value,
+			3,
+			CRTC_START_LINE_CONTROL,
+			CRTC_ADVANCED_START_LINE_POSITION);
+		set_reg_field_value(
+			value,
+			0,
+			CRTC_START_LINE_CONTROL,
+			CRTC_PREFETCH_EN);
+	} else {
+		set_reg_field_value(
+			value,
+			4,
+			CRTC_START_LINE_CONTROL,
+			CRTC_ADVANCED_START_LINE_POSITION);
+		set_reg_field_value(
+			value,
+			1,
+			CRTC_START_LINE_CONTROL,
+			CRTC_PREFETCH_EN);
+	}
+
+	set_reg_field_value(
+		value,
+		1,
+		CRTC_START_LINE_CONTROL,
+		CRTC_PROGRESSIVE_START_LINE_EARLY);
+
+	set_reg_field_value(
+		value,
+		1,
+		CRTC_START_LINE_CONTROL,
+		CRTC_INTERLACE_START_LINE_EARLY);
+
+	dm_write_reg(tg->ctx, addr, value);
+}
+
 static const struct timing_generator_funcs dce80_tg_funcs = {
 		.validate_timing = dce110_tg_validate_timing,
 		.program_timing = program_timing,
@@ -176,64 +238,3 @@ void dce80_timing_generator_construct(
 	tg110->min_h_back_porch = 4;
 }
 
-void dce80_timing_generator_enable_advanced_request(
-	struct timing_generator *tg,
-	bool enable,
-	const struct dc_crtc_timing *timing)
-{
-	struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
-	uint32_t addr = CRTC_REG(mmCRTC_START_LINE_CONTROL);
-	uint32_t value = dm_read_reg(tg->ctx, addr);
-
-	if (enable) {
-		set_reg_field_value(
-			value,
-			0,
-			CRTC_START_LINE_CONTROL,
-			CRTC_LEGACY_REQUESTOR_EN);
-	} else {
-		set_reg_field_value(
-			value,
-			1,
-			CRTC_START_LINE_CONTROL,
-			CRTC_LEGACY_REQUESTOR_EN);
-	}
-
-	if ((timing->v_sync_width + timing->v_front_porch) <= 3) {
-		set_reg_field_value(
-			value,
-			3,
-			CRTC_START_LINE_CONTROL,
-			CRTC_ADVANCED_START_LINE_POSITION);
-		set_reg_field_value(
-			value,
-			0,
-			CRTC_START_LINE_CONTROL,
-			CRTC_PREFETCH_EN);
-	} else {
-		set_reg_field_value(
-			value,
-			4,
-			CRTC_START_LINE_CONTROL,
-			CRTC_ADVANCED_START_LINE_POSITION);
-		set_reg_field_value(
-			value,
-			1,
-			CRTC_START_LINE_CONTROL,
-			CRTC_PREFETCH_EN);
-	}
-
-	set_reg_field_value(
-		value,
-		1,
-		CRTC_START_LINE_CONTROL,
-		CRTC_PROGRESSIVE_START_LINE_EARLY);
-
-	set_reg_field_value(
-		value,
-		1,
-		CRTC_START_LINE_CONTROL,
-		CRTC_INTERLACE_START_LINE_EARLY);
-
-	dm_write_reg(tg->ctx, addr, value);
-}
drivers/gpu/drm/amd/display/dc/dce80/dce80_timing_generator.h +0 -6
index 9cebb24c94c8..8ff1b06bcd8b 100644
@@ -36,10 +36,4 @@ void dce80_timing_generator_construct(
 	uint32_t instance,
 	const struct dce110_timing_generator_offsets *offsets);
 
-/******** HW programming ************/
-void dce80_timing_generator_enable_advanced_request(
-	struct timing_generator *tg,
-	bool enable,
-	const struct dc_crtc_timing *timing);
-
 #endif /* __DC_TIMING_GENERATOR_DCE80_H__ */
Signature · 6 lines
2.14.1

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

PATCH 14/34 drm/amd/display: Use hardware max low point when sampling OTF

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

The MAX_LOW_POINT macro should reflect the maximum low point within hardware. Otherwise, sampling for the hardware points from the output transfer function (OTF) will be incorrect.

Also, fix usage of MAX_LOW_POINT accordingly.

Change-Id I6affb8e987ac786c2c9ac8fba4bee5384dc54d07
---
 drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +3 -3
index 9e97cd74b0ec..bc698644d42a 100644
@@ -409,7 +409,7 @@ static bool convert_to_custom_float(struct pwl_result_data *rgb_resulted,
 	return true;
 }
 
-#define MAX_LOW_POINT      11
+#define MAX_LOW_POINT      25
 #define NUMBER_REGIONS     16
 #define NUMBER_SW_SEGMENTS 16
 
@@ -443,8 +443,8 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf,
 		/* 16 segments
 		 * segments are from 2^-11 to 2^5
 		 */
-		region_start = -MAX_LOW_POINT;
-		region_end = NUMBER_REGIONS - MAX_LOW_POINT;
+		region_start = -11;
+		region_end = region_start + NUMBER_REGIONS;
 
 		for (i = 0; i < NUMBER_REGIONS; i++)
 			seg_distr[i] = 4;
Signature · 6 lines
2.14.1

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

PATCH 15/34 drm/amd/display: Add color module's gamma helpers to Linux build

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

Also guard includes that we don't need.

Change-Id I75201e80dd991b8a15e7a082332b4b6c920fb17e
---
 drivers/gpu/drm/amd/display/Makefile               |    3 +-
 drivers/gpu/drm/amd/display/modules/color/Makefile |   31 +
 .../drm/amd/display/modules/color/color_gamma.c    | 1070 ++++++++++++++++++++
 .../drm/amd/display/modules/color/color_gamma.h    |   45 +
 4 files changed, 1148 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/display/modules/color/Makefile
 create mode 100644 drivers/gpu/drm/amd/display/modules/color/color_gamma.c
 create mode 100644 drivers/gpu/drm/amd/display/modules/color/color_gamma.h
drivers/gpu/drm/amd/display/Makefile +2 -1
index c27c81cdeed3..3d14478913de 100644
@@ -32,11 +32,12 @@ subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/inc/
 subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/dc/inc/hw
 subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/inc
 subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/freesync
+subdir-ccflags-y += -I$(FULL_AMD_DISPLAY_PATH)/modules/color
 
 #TODO: remove when Timing Sync feature is complete
 subdir-ccflags-y += -DBUILD_FEATURE_TIMING_SYNC=0
 
-DAL_LIBS = amdgpu_dm dc	modules/freesync
+DAL_LIBS = amdgpu_dm dc	modules/freesync modules/color
 
 AMD_DAL = $(addsuffix /Makefile, $(addprefix $(FULL_AMD_DISPLAY_PATH)/,$(DAL_LIBS)))
 
drivers/gpu/drm/amd/display/modules/color/Makefile new file +31 -0
new file mode 100644
index 000000000000..65c33a76951a
@@ -0,0 +1,31 @@
+#
+# Copyright 2018 Advanced Micro Devices, Inc.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a
+# copy of this software and associated documentation files (the "Software"),
+# to deal in the Software without restriction, including without limitation
+# the rights to use, copy, modify, merge, publish, distribute, sublicense,
+# and/or sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+# THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+# OTHER DEALINGS IN THE SOFTWARE.
+#
+#
+# Makefile for the color sub-module of DAL.
+#
+
+MOD_COLOR = color_gamma.o
+
+AMD_DAL_MOD_COLOR = $(addprefix $(AMDDALPATH)/modules/color/,$(MOD_COLOR))
+#$(info ************  DAL COLOR MODULE MAKEFILE ************)
+
+AMD_DISPLAY_FILES += $(AMD_DAL_MOD_COLOR)
drivers/gpu/drm/amd/display/modules/color/color_gamma.c new file +1070 -0

1,070 lines not on this page · raw message

drivers/gpu/drm/amd/display/modules/color/color_gamma.h new file +45 -0

45 lines not on this page · raw message

Signature · 6 lines
2.14.1

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

PATCH 16/34 drm/amd/display: Implement color management

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

Implement color management functionalities within amdgpu_dm_color, and expose functions within amdgpu_dm.h.

Change-Id Ib1b85a42b4f535becf67b5b3f386e81ebf0bcc33
---
 drivers/gpu/drm/amd/display/amdgpu_dm/Makefile     |   2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h  |   5 +
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_color.c    | 218 +++++++++++++++++++++
 3 files changed, 224 insertions(+), 1 deletion(-)
 create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c
drivers/gpu/drm/amd/display/amdgpu_dm/Makefile +1 -1
index d7accc2071c4..af16973f2c41 100644
@@ -25,7 +25,7 @@
 
 
 
-AMDGPUDM = amdgpu_dm.o amdgpu_dm_irq.o amdgpu_dm_mst_types.o
+AMDGPUDM = amdgpu_dm.o amdgpu_dm_irq.o amdgpu_dm_mst_types.o amdgpu_dm_color.o
 
 ifneq ($(CONFIG_DRM_AMD_DC),)
 AMDGPUDM += amdgpu_dm_services.o amdgpu_dm_helpers.o
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +5 -0
index 124203673207..9c556d85dd0e 100644
@@ -269,6 +269,11 @@ void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc);
 #define amdgpu_dm_crtc_handle_crc_irq(x)
 #endif
 
+int amdgpu_dm_set_degamma_lut(struct drm_crtc_state *crtc_state,
+			      struct dc_plane_state *dc_plane_state);
+void amdgpu_dm_set_ctm(struct dm_crtc_state *crtc);
+int amdgpu_dm_set_regamma_lut(struct dm_crtc_state *crtc);
+
 extern const struct drm_encoder_helper_funcs amdgpu_dm_encoder_helper_funcs;
 
 #endif /* __AMDGPU_DM_H__ */
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c new file +218 -0

218 lines not on this page · raw message

Signature · 6 lines
2.14.1

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

PATCH 17/34 drm/amd/display: Hookup color management functions

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

Hookup new color management functions into amdgpu_dm:

- Notify DRM that we support CRTC color management during CRTC init
- Call color management functions within atomic check to update dc states in preparation for a commit

Change-Id I7246a679479c4efbf31fe0d631559b06f64c36ff
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c  | 65 +++++++++++-----------
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h  |  1 +
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_color.c    | 11 ++++
 3 files changed, 44 insertions(+), 33 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +32 -33
index e285147f32d3..9212964a1246 100644
@@ -474,6 +474,8 @@ static int amdgpu_dm_init(struct amdgpu_device *adev)
 		DRM_DEBUG_DRIVER("amdgpu: freesync_module init done %p.\n",
 				adev->dm.freesync_module);
 
+	amdgpu_dm_init_color_mod();
+
 	if (amdgpu_dm_initialize_drm_device(adev)) {
 		DRM_ERROR(
 		"amdgpu: failed to initialize sw for display support.\n");
@@ -1958,32 +1960,6 @@ static int fill_plane_attributes_from_fb(struct amdgpu_device *adev,
 
 }
 
-static void fill_gamma_from_crtc_state(const struct drm_crtc_state *crtc_state,
-				       struct dc_plane_state *plane_state)
-{
-	int i;
-	struct dc_gamma *gamma;
-	struct drm_color_lut *lut =
-			(struct drm_color_lut *) crtc_state->gamma_lut->data;
-
-	gamma = dc_create_gamma();
-
-	if (gamma == NULL) {
-		WARN_ON(1);
-		return;
-	}
-
-	gamma->type = GAMMA_RGB_256;
-	gamma->num_entries = GAMMA_RGB_256_ENTRIES;
-	for (i = 0; i < GAMMA_RGB_256_ENTRIES; i++) {
-		gamma->entries.red[i] = dal_fixed31_32_from_int(lut[i].red);
-		gamma->entries.green[i] = dal_fixed31_32_from_int(lut[i].green);
-		gamma->entries.blue[i] = dal_fixed31_32_from_int(lut[i].blue);
-	}
-
-	plane_state->gamma_correction = gamma;
-}
-
 static int fill_plane_attributes(struct amdgpu_device *adev,
 				 struct dc_plane_state *dc_plane_state,
 				 struct drm_plane_state *plane_state,
@@ -2011,14 +1987,13 @@ static int fill_plane_attributes(struct amdgpu_device *adev,
 	if (input_tf == NULL)
 		return -ENOMEM;
 
-	input_tf->type = TF_TYPE_PREDEFINED;
-	input_tf->tf = TRANSFER_FUNCTION_SRGB;
-
 	dc_plane_state->in_transfer_func = input_tf;
 
-	/* In case of gamma set, update gamma value */
-	if (crtc_state->gamma_lut)
-		fill_gamma_from_crtc_state(crtc_state, dc_plane_state);
+	/*
+	 * Always set input transfer function, since plane state is refreshed
+	 * every time.
+	 */
+	ret = amdgpu_dm_set_degamma_lut(crtc_state, dc_plane_state);
 
 	return ret;
 }
@@ -3258,6 +3233,7 @@ static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
 	acrtc->base.enabled = false;
 
 	dm->adev->mode_info.crtcs[crtc_index] = acrtc;
+	drm_crtc_enable_color_mgmt(&acrtc->base, 256, true, 256);
 	drm_mode_crtc_set_gamma_size(&acrtc->base, 256);
 
 	return 0;
@@ -4679,6 +4655,30 @@ static int dm_update_crtcs_state(struct dc *dc,
 		/* Release extra reference */
 		if (new_stream)
 			 dc_stream_release(new_stream);
+
+		/*
+		 * We want to do dc stream updates that do not require a
+		 * full modeset below.
+		 */
+		if (!enable || !aconnector || modereset_required(new_crtc_state))
+			continue;
+		/*
+		 * Given above conditions, the dc state cannot be NULL because:
+		 * 1. We're attempting to enable a CRTC. Which has a...
+		 * 2. Valid connector attached, and
+		 * 3. User does not want to reset it (disable or mark inactive,
+		 *    which can happen on a CRTC that's already disabled).
+		 * => It currently exists.
+		 */
+		BUG_ON(dm_new_crtc_state->stream == NULL);
+
+		/* Color managment settings */
+		if (dm_new_crtc_state->base.color_mgmt_changed) {
+			ret = amdgpu_dm_set_regamma_lut(dm_new_crtc_state);
+			if (ret)
+				goto fail;
+			amdgpu_dm_set_ctm(dm_new_crtc_state);
+		}
 	}
 
 	return ret;
@@ -4787,7 +4787,6 @@ static int dm_update_planes_state(struct dc *dc,
 			if (ret)
 				return ret;
 
-
 			if (!dc_add_plane_to_context(
 					dc,
 					dm_new_crtc_state->stream,
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -0
index 9c556d85dd0e..7e5d5cd40680 100644
@@ -269,6 +269,7 @@ void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc);
 #define amdgpu_dm_crtc_handle_crc_irq(x)
 #endif
 
+void amdgpu_dm_init_color_mod(void);
 int amdgpu_dm_set_degamma_lut(struct drm_crtc_state *crtc_state,
 			      struct dc_plane_state *dc_plane_state);
 void amdgpu_dm_set_ctm(struct dm_crtc_state *crtc);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +11 -0
index cc3ee0748a70..d7bc1b7dd152 100644
@@ -27,6 +27,17 @@
 #include "amdgpu_dm.h"
 #include "modules/color/color_gamma.h"
 
+/*
+ * Initialize the color module.
+ *
+ * We're not using the full color module, only certain components.
+ * Only call setup functions for components that we need.
+ */
+void amdgpu_dm_init_color_mod(void)
+{
+	setup_x_points_distribution();
+}
+
 
 #define MAX_LUT_ENTRIES 256
 
Signature · 6 lines
2.14.1

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

PATCH 18/34 drm/amd/display: Refactor max color lut entries into a macro.

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

Change-Id If0205a3552cfd74a06511f595e5d1b6be5b655e8
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c       |  5 +++--
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h       |  2 ++
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c | 11 +++++------
 3 files changed, 10 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +3 -2
index 9212964a1246..b632be5203b8 100644
@@ -3233,8 +3233,9 @@ static int amdgpu_dm_crtc_init(struct amdgpu_display_manager *dm,
 	acrtc->base.enabled = false;
 
 	dm->adev->mode_info.crtcs[crtc_index] = acrtc;
-	drm_crtc_enable_color_mgmt(&acrtc->base, 256, true, 256);
-	drm_mode_crtc_set_gamma_size(&acrtc->base, 256);
+	drm_crtc_enable_color_mgmt(&acrtc->base, MAX_COLOR_LUT_ENTRIES,
+				   true, MAX_COLOR_LUT_ENTRIES);
+	drm_mode_crtc_set_gamma_size(&acrtc->base, MAX_COLOR_LUT_ENTRIES);
 
 	return 0;
 
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +2 -0
index 7e5d5cd40680..c40c13a9f614 100644
@@ -269,6 +269,8 @@ void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc);
 #define amdgpu_dm_crtc_handle_crc_irq(x)
 #endif
 
+#define MAX_COLOR_LUT_ENTRIES 256
+
 void amdgpu_dm_init_color_mod(void);
 int amdgpu_dm_set_degamma_lut(struct drm_crtc_state *crtc_state,
 			      struct dc_plane_state *dc_plane_state);
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_color.c +5 -6
index d7bc1b7dd152..62bb72fe9aa5 100644
@@ -39,14 +39,13 @@ void amdgpu_dm_init_color_mod(void)
 }
 
 
-#define MAX_LUT_ENTRIES 256
-
 /*
  * Return true if the given lut is a linear mapping of values, i.e. it acts
  * like a bypass LUT.
  *
  * It is considered linear if the lut represents:
- * f(a) = (0xFF00/MAX_LUT_ENTRIES-1)a; for integer a in [0, MAX_LUT_ENTRIES)
+ * f(a) = (0xFF00/MAX_COLOR_LUT_ENTRIES-1)a; for integer a in
+ *                                           [0, MAX_COLOR_LUT_ENTRIES)
  */
 static bool __is_lut_linear(struct drm_color_lut *lut)
 {
@@ -55,12 +54,12 @@ static bool __is_lut_linear(struct drm_color_lut *lut)
 	uint32_t expected;
 	int delta;
 
-	for (i = 0; i < MAX_LUT_ENTRIES; i++) {
+	for (i = 0; i < MAX_COLOR_LUT_ENTRIES; i++) {
 		/* All color values should equal */
 		if ((lut[i].red != lut[i].green) || (lut[i].green != lut[i].blue))
 			return false;
 
-		expected = i * max_os / (MAX_LUT_ENTRIES-1);
+		expected = i * max_os / (MAX_COLOR_LUT_ENTRIES-1);
 
 		/* Allow a +/-1 error. */
 		delta = lut[i].red - expected;
@@ -113,7 +112,7 @@ int amdgpu_dm_set_regamma_lut(struct dm_crtc_state *crtc)
 	if (!gamma)
 		return -ENOMEM;
 
-	gamma->num_entries = MAX_LUT_ENTRIES;
+	gamma->num_entries = MAX_COLOR_LUT_ENTRIES;
 	gamma->type = GAMMA_RGB_256;
 
 	/* Truncate, and store in dc_gamma for output tf calculation */
Signature · 6 lines
2.14.1

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

PATCH 19/34 drm/amd/display: Expose dither setting functionality to Linux

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

We will need this to disable dither for CRC capture.

Change-Id I3ae4fcd86c74b5ab05ad16559d92e156c6f389bc
---
 drivers/gpu/drm/amd/display/dc/core/dc.c   | 31 ++++++++++++++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/dc_stream.h |  3 +++
 2 files changed, 34 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +31 -0
index a78e0364b1b2..ea5c35166ffa 100644
@@ -300,6 +300,37 @@ bool dc_stream_get_crc(struct dc *dc, struct dc_stream_state *stream,
 	return false;
 }
 
+void dc_stream_set_dither_option(struct dc_stream_state *stream,
+		enum dc_dither_option option)
+{
+	struct bit_depth_reduction_params params;
+	struct dc_link *link = stream->status.link;
+	struct pipe_ctx *pipes = NULL;
+	int i;
+
+	for (i = 0; i < MAX_PIPES; i++) {
+		if (link->dc->current_state->res_ctx.pipe_ctx[i].stream ==
+				stream) {
+			pipes = &link->dc->current_state->res_ctx.pipe_ctx[i];
+			break;
+		}
+	}
+
+	memset(&params, 0, sizeof(params));
+	if (!pipes)
+		return;
+	if (option > DITHER_OPTION_MAX)
+		return;
+
+	stream->dither_option = option;
+
+	resource_build_bit_depth_reduction_params(stream,
+				&params);
+	stream->bit_depth_params = params;
+	pipes->stream_res.opp->funcs->
+		opp_program_bit_depth_reduction(pipes->stream_res.opp, &params);
+}
+
 void dc_stream_set_static_screen_events(struct dc *dc,
 		struct dc_stream_state **streams,
 		int num_streams,
drivers/gpu/drm/amd/display/dc/dc_stream.h +3 -0
index 2d2472ba97bf..78a2bbe0b272 100644
@@ -287,6 +287,9 @@ void dc_stream_set_static_screen_events(struct dc *dc,
 					int num_streams,
 					const struct dc_static_screen_events *events);
 
+void dc_stream_set_dither_option(struct dc_stream_state *stream,
+				 enum dc_dither_option option);
+
 
 bool dc_stream_adjust_vmin_vmax(struct dc *dc,
 				struct dc_stream_state **stream,
Signature · 6 lines
2.14.1

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

PATCH 20/34 drm/amd/display: When enabling CRC, disable dither & enable truncation

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

When user-mode is using 8bpc, the hardware represents it internally using a higher bit depth. This causes problems when comparing CRCs for color managment tests.

We need to disable dithering as well, since it makes CRC values non-deterministic.

It's easy to see why dithering needs to be disabled, The reason why truncation also needs to be enabled is better described with an example. Consider the folowing which tests the color transform matrix (CTM):

Expected CRC = FB_A -> Degamma (Bypassed) -> CTM (Bypassed)
| v
Obtain CRC <- Regamma(Bypassed)

Actual CRC = FB_B -> Degamma (Bypassed) -> CTM (0.5*Identity)
| v
Obtain CRC <- Regamma(Bypassed)

FB_A contains a solid red color at half intensity (127 @ 8bpc) FB_B contains a solid red color at full intensity (255 @ 8bpc)

We expect that Expected CRC = Actual CRC, but that's not the case. When the CTM is applied, the output is at half intensity, but also at a higher bit depth within hardware. i.e. 255/2 = 127.5: not representable in 8bpc, but can be at 10bpc. This causes the two CRC's to be different.

The solution is to truncate the output bit depth to the same as input when enabling CRC capture. Since Linux only supports 8bpc, hard code that for now.

Change-Id Ic9277659ec785d655989ba0c6d170b1691525376
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 11 +++++++++--
 drivers/gpu/drm/amd/display/dc/core/dc.c              | 14 +++++++++++---
 2 files changed, 20 insertions(+), 5 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c +9 -2
index e5fb53a56b73..55aa379cfcbe 100644
@@ -60,18 +60,25 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name,
 		return -EINVAL;
 	}
 
+	/* When enabling CRC, we should also disable dithering. */
 	if (source == AMDGPU_DM_PIPE_CRC_SOURCE_AUTO) {
 		if (dc_stream_configure_crc(stream_state->ctx->dc,
 					    stream_state,
-					    true, true))
+					    true, true)) {
 			crtc_state->crc_enabled = true;
+			dc_stream_set_dither_option(stream_state,
+						    DITHER_OPTION_TRUN8);
+		}
 		else
 			return -EINVAL;
 	} else {
 		if (dc_stream_configure_crc(stream_state->ctx->dc,
 					    stream_state,
-					    false, false))
+					    false, false)) {
 			crtc_state->crc_enabled = false;
+			dc_stream_set_dither_option(stream_state,
+						    DITHER_OPTION_DEFAULT);
+		}
 		else
 			return -EINVAL;
 	}
drivers/gpu/drm/amd/display/dc/core/dc.c +11 -3
index ea5c35166ffa..f4ffbf2e2caf 100644
@@ -316,7 +316,6 @@ void dc_stream_set_dither_option(struct dc_stream_state *stream,
 		}
 	}
 
-	memset(&params, 0, sizeof(params));
 	if (!pipes)
 		return;
 	if (option > DITHER_OPTION_MAX)
@@ -324,9 +323,18 @@ void dc_stream_set_dither_option(struct dc_stream_state *stream,
 
 	stream->dither_option = option;
 
-	resource_build_bit_depth_reduction_params(stream,
-				&params);
+	memset(&params, 0, sizeof(params));
+	resource_build_bit_depth_reduction_params(stream, &params);
 	stream->bit_depth_params = params;
+
+	if (pipes->plane_res.xfm &&
+	    pipes->plane_res.xfm->funcs->transform_set_pixel_storage_depth) {
+		pipes->plane_res.xfm->funcs->transform_set_pixel_storage_depth(
+			pipes->plane_res.xfm,
+			pipes->plane_res.scl_data.lb_params.depth,
+			&stream->bit_depth_params);
+	}
+
 	pipes->stream_res.opp->funcs->
 		opp_program_bit_depth_reduction(pipes->stream_res.opp, &params);
 }
Signature · 6 lines
2.14.1

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

PATCH 21/34 drm/amd/display: Rework DCE transform bit depth reduction programming.

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

Clear up the logic, and enable programming truncation as a bit reduction mode.

Change-Id I72199753222a3f77fb9986a6e36a8bfb1f793e36
---
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.c | 104 +++++++--------------
 1 file changed, 36 insertions(+), 68 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_transform.c +36 -68
index 6357546b49cd..ad411dac5639 100644
@@ -618,80 +618,48 @@ static void program_bit_depth_reduction(
 	enum dc_color_depth depth,
 	const struct bit_depth_reduction_params *bit_depth_params)
 {
-	enum dcp_bit_depth_reduction_mode depth_reduction_mode;
-	enum dcp_spatial_dither_mode spatial_dither_mode;
-	bool frame_random_enable;
-	bool rgb_random_enable;
-	bool highpass_random_enable;
+	enum dcp_out_trunc_round_depth trunc_round_depth;
+	enum dcp_out_trunc_round_mode trunc_mode;
+	bool spatial_dither_enable;
 
 	ASSERT(depth < COLOR_DEPTH_121212); /* Invalid clamp bit depth */
 
-	if (bit_depth_params->flags.SPATIAL_DITHER_ENABLED) {
-		depth_reduction_mode = DCP_BIT_DEPTH_REDUCTION_MODE_DITHER;
-		frame_random_enable = true;
-		rgb_random_enable = true;
-		highpass_random_enable = true;
-
-	} else {
-		depth_reduction_mode = DCP_BIT_DEPTH_REDUCTION_MODE_DISABLED;
-		frame_random_enable = false;
-		rgb_random_enable = false;
-		highpass_random_enable = false;
+	spatial_dither_enable = bit_depth_params->flags.SPATIAL_DITHER_ENABLED;
+	/* Default to 12 bit truncation without rounding */
+	trunc_round_depth = DCP_OUT_TRUNC_ROUND_DEPTH_12BIT;
+	trunc_mode = DCP_OUT_TRUNC_ROUND_MODE_TRUNCATE;
+
+	if (bit_depth_params->flags.TRUNCATE_ENABLED) {
+		/* Don't enable dithering if truncation is enabled */
+		spatial_dither_enable = false;
+		trunc_mode = bit_depth_params->flags.TRUNCATE_MODE ?
+			     DCP_OUT_TRUNC_ROUND_MODE_ROUND :
+			     DCP_OUT_TRUNC_ROUND_MODE_TRUNCATE;
+
+		if (bit_depth_params->flags.TRUNCATE_DEPTH == 0 ||
+		    bit_depth_params->flags.TRUNCATE_DEPTH == 1)
+			trunc_round_depth = DCP_OUT_TRUNC_ROUND_DEPTH_8BIT;
+		else if (bit_depth_params->flags.TRUNCATE_DEPTH == 2)
+			trunc_round_depth = DCP_OUT_TRUNC_ROUND_DEPTH_10BIT;
+		else {
+			/*
+			 * Invalid truncate/round depth. Setting here to 12bit
+			 * to prevent use-before-initialize errors.
+			 */
+			trunc_round_depth = DCP_OUT_TRUNC_ROUND_DEPTH_12BIT;
+			BREAK_TO_DEBUGGER();
+		}
 	}
 
-	spatial_dither_mode = DCP_SPATIAL_DITHER_MODE_A_AA_A;
-
 	set_clamp(xfm_dce, depth);
-
-	switch (depth_reduction_mode) {
-	case DCP_BIT_DEPTH_REDUCTION_MODE_DITHER:
-		/*  Spatial Dither: Set round/truncate to bypass (12bit),
-		 *  enable Dither (30bpp) */
-		set_round(xfm_dce,
-			DCP_OUT_TRUNC_ROUND_MODE_TRUNCATE,
-			DCP_OUT_TRUNC_ROUND_DEPTH_12BIT);
-
-		set_dither(xfm_dce, true, spatial_dither_mode,
-			DCP_SPATIAL_DITHER_DEPTH_30BPP, frame_random_enable,
-			rgb_random_enable, highpass_random_enable);
-		break;
-	case DCP_BIT_DEPTH_REDUCTION_MODE_ROUND:
-		/*  Round: Enable round (10bit), disable Dither */
-		set_round(xfm_dce,
-			DCP_OUT_TRUNC_ROUND_MODE_ROUND,
-			DCP_OUT_TRUNC_ROUND_DEPTH_10BIT);
-
-		set_dither(xfm_dce, false, spatial_dither_mode,
-			DCP_SPATIAL_DITHER_DEPTH_30BPP, frame_random_enable,
-			rgb_random_enable, highpass_random_enable);
-		break;
-	case DCP_BIT_DEPTH_REDUCTION_MODE_TRUNCATE: /*  Truncate */
-		/*  Truncate: Enable truncate (10bit), disable Dither */
-		set_round(xfm_dce,
-			DCP_OUT_TRUNC_ROUND_MODE_TRUNCATE,
-			DCP_OUT_TRUNC_ROUND_DEPTH_10BIT);
-
-		set_dither(xfm_dce, false, spatial_dither_mode,
-			DCP_SPATIAL_DITHER_DEPTH_30BPP, frame_random_enable,
-			rgb_random_enable, highpass_random_enable);
-		break;
-
-	case DCP_BIT_DEPTH_REDUCTION_MODE_DISABLED: /*  Disabled */
-		/*  Truncate: Set round/truncate to bypass (12bit),
-		 * disable Dither */
-		set_round(xfm_dce,
-			DCP_OUT_TRUNC_ROUND_MODE_TRUNCATE,
-			DCP_OUT_TRUNC_ROUND_DEPTH_12BIT);
-
-		set_dither(xfm_dce, false, spatial_dither_mode,
-			DCP_SPATIAL_DITHER_DEPTH_30BPP, frame_random_enable,
-			rgb_random_enable, highpass_random_enable);
-		break;
-	default:
-		/* Invalid DCP Depth reduction mode */
-		BREAK_TO_DEBUGGER();
-		break;
-	}
+	set_round(xfm_dce, trunc_mode, trunc_round_depth);
+	set_dither(xfm_dce,
+		   spatial_dither_enable,
+		   DCP_SPATIAL_DITHER_MODE_A_AA_A,
+		   DCP_SPATIAL_DITHER_DEPTH_30BPP,
+		   bit_depth_params->flags.FRAME_RANDOM,
+		   bit_depth_params->flags.RGB_RANDOM,
+		   bit_depth_params->flags.HIGHPASS_RANDOM);
 }
 
 static int dce_transform_get_max_num_of_supported_lines(
Signature · 6 lines
2.14.1

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

PATCH 22/34 drm/amd/display: Expose DCE110 CRC functions for DCE8

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

Implement CRC for DCE8. Registers remain the same, so call DCE110 code directly.

Change-Id Icddc945b6a216bb96dbc9107696dc08579e6decd
---
 drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c | 8 ++++----
 drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.h | 6 ++++++
 drivers/gpu/drm/amd/display/dc/dce80/dce80_timing_generator.c   | 2 ++
 3 files changed, 12 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c +4 -4
index 078d18c3eee5..be7153924a70 100644
@@ -2091,8 +2091,8 @@ static bool dce110_is_tg_enabled(struct timing_generator *tg)
 	return field == 1;
 }
 
-static bool dce110_configure_crc(struct timing_generator *tg,
-				 const struct crc_params *params)
+bool dce110_configure_crc(struct timing_generator *tg,
+			  const struct crc_params *params)
 {
 	uint32_t cntl_addr = 0;
 	uint32_t addr = 0;
@@ -2168,8 +2168,8 @@ static bool dce110_configure_crc(struct timing_generator *tg,
 	return true;
 }
 
-static bool dce110_get_crc(struct timing_generator *tg,
-			   uint32_t *r_cr, uint32_t *g_y, uint32_t *b_cb)
+bool dce110_get_crc(struct timing_generator *tg,
+		    uint32_t *r_cr, uint32_t *g_y, uint32_t *b_cb)
 {
 	uint32_t addr = 0;
 	uint32_t value = 0;
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.h +6 -0
index 232747c7c60b..734d4965dab1 100644
@@ -276,4 +276,10 @@ void dce110_tg_set_colors(struct timing_generator *tg,
 bool dce110_arm_vert_intr(
 		struct timing_generator *tg, uint8_t width);
 
+bool dce110_configure_crc(struct timing_generator *tg,
+			  const struct crc_params *params);
+
+bool dce110_get_crc(struct timing_generator *tg,
+		    uint32_t *r_cr, uint32_t *g_y, uint32_t *b_cb);
+
 #endif /* __DC_TIMING_GENERATOR_DCE110_H__ */
drivers/gpu/drm/amd/display/dc/dce80/dce80_timing_generator.c +2 -0
index 2934650e0434..3ba4712a35ab 100644
@@ -212,6 +212,8 @@ static const struct timing_generator_funcs dce80_tg_funcs = {
 		/* DCE8.0 overrides */
 		.enable_advanced_request =
 				dce80_timing_generator_enable_advanced_request,
+		.configure_crc = dce110_configure_crc,
+		.get_crc = dce110_get_crc,
 };
 
 void dce80_timing_generator_construct(
Signature · 6 lines
2.14.1

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

PATCH 23/34 drm/amd/display: Skip 2 frames when first reading CRC

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

Skipping the first frame will prevent uncoooked values most of the time. However, in some unlikely cases, the second frame will be uncooked as well.

Change-Id Ie811bd27a732a474b575350decc216b6fffb75d6
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h     |  2 +-
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +1 -1
index c40c13a9f614..5b5fa80916cb 100644
@@ -198,7 +198,7 @@ struct dm_crtc_state {
 	struct drm_crtc_state base;
 	struct dc_stream_state *stream;
 
-	bool crc_first_skipped;
+	int crc_skip_count;
 	bool crc_enabled;
 };
 
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crc.c +6 -6
index 55aa379cfcbe..52f2c01349e3 100644
@@ -84,8 +84,8 @@ int amdgpu_dm_crtc_set_crc_source(struct drm_crtc *crtc, const char *src_name,
 	}
 
 	*values_cnt = 3;
-	/* Reset crc_skipped flag on dm state */
-	crtc_state->crc_first_skipped = false;
+	/* Reset crc_skipped on dm state */
+	crtc_state->crc_skip_count = 0;
 	return 0;
 }
 
@@ -109,11 +109,11 @@ void amdgpu_dm_crtc_handle_crc_irq(struct drm_crtc *crtc)
 	/*
 	 * Since flipping and crc enablement happen asynchronously, we - more
 	 * often than not - will be returning an 'uncooked' crc on first frame.
-	 * Probably because hw isn't ready yet. Simply skip the first crc
-	 * value.
+	 * Probably because hw isn't ready yet. For added security, skip the
+	 * first two CRC values.
 	 */
-	if (!crtc_state->crc_first_skipped) {
-		crtc_state->crc_first_skipped = true;
+	if (crtc_state->crc_skip_count < 2) {
+		crtc_state->crc_skip_count += 1;
 		return;
 	}
 
Signature · 6 lines
2.14.1

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

PATCH 24/34 drm/amd/display: Remove delay on disconnect patch

In reply to a message not in the archive

From: John Barberiz <[email protected]>

HDMI HPD's generic solution makes the monitor patch code unnecessary so anything related has been removed.

Change-Id I302aaeba6ef805b4dfe44cbe4a8ef449c6c5211e
---
 drivers/gpu/drm/amd/display/dc/core/dc_link.c | 16 ++++------------
 drivers/gpu/drm/amd/display/dc/dc_types.h     |  1 -
 2 files changed, 4 insertions(+), 13 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link.c +4 -12
index 44b12f0405ee..95955ade4012 100644
@@ -50,7 +50,6 @@
 	dm_logger_write(dc_ctx->logger, LOG_HW_HOTPLUG, \
 		__VA_ARGS__)
 
-#define DEFAULT_DELAY_DISCONNECT 100
 /*******************************************************************************
  * Private structures
  ******************************************************************************/
@@ -118,7 +117,7 @@ struct gpio *get_hpd_gpio(struct dc_bios *dcb,
  *     true on success, false otherwise
  */
 static bool program_hpd_filter(
-	const struct dc_link *link, int default_disconnect_delay)
+	const struct dc_link *link)
 {
 	bool result = false;
 
@@ -136,7 +135,7 @@ static bool program_hpd_filter(
 	case SIGNAL_TYPE_HDMI_TYPE_A:
 		/* Program hpd filter */
 		delay_on_connect_in_ms = 500;
-		delay_on_disconnect_in_ms = default_disconnect_delay;
+		delay_on_disconnect_in_ms = 100;
 		break;
 	case SIGNAL_TYPE_DISPLAY_PORT:
 	case SIGNAL_TYPE_DISPLAY_PORT_MST:
@@ -700,13 +699,6 @@ bool dc_link_detect(struct dc_link *link, enum dc_detect_reason reason)
 			dp_hbr_verify_link_cap(link, &link->reported_link_cap);
 		}
 
-		/* Add delay for certain monitors */
-		if (sink->edid_caps.panel_patch.disconnect_delay > 0
-				&& sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A)
-			program_hpd_filter(link, sink->edid_caps.panel_patch.disconnect_delay);
-		else
-			program_hpd_filter(link, DEFAULT_DELAY_DISCONNECT);
-
 		/* HDMI-DVI Dongle */
 		if (sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A &&
 				!sink->edid_caps.edid_hdmi)
@@ -1093,7 +1085,7 @@ static bool construct(
 	 * If GPIO isn't programmed correctly HPD might not rise or drain
 	 * fast enough, leading to bounces.
 	 */
-	program_hpd_filter(link, DEFAULT_DELAY_DISCONNECT);
+	program_hpd_filter(link);
 
 	return true;
 device_tag_fail:
@@ -2018,7 +2010,7 @@ const struct dc_link_status *dc_link_get_status(const struct dc_link *link)
 void core_link_resume(struct dc_link *link)
 {
 	if (link->connector_signal != SIGNAL_TYPE_VIRTUAL)
-		program_hpd_filter(link, DEFAULT_DELAY_DISCONNECT);
+		program_hpd_filter(link);
 }
 
 static struct fixed31_32 get_pbn_per_slot(struct dc_stream_state *stream)
drivers/gpu/drm/amd/display/dc/dc_types.h +0 -1
index aa5b90e6beb7..8811b6f86bff 100644
@@ -194,7 +194,6 @@ union display_content_support {
 };
 
 struct dc_panel_patch {
-	unsigned int disconnect_delay;
 	unsigned int dppowerup_delay;
 };
 
Signature · 6 lines
2.14.1

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

PATCH 25/34 drm/amd/display: Make FBC work without fbdev emulation

In reply to a message not in the archive

From: Roman Li <[email protected]>

Previously, FBC dynamic allocation relied on connector modes populated during dm init. This is only the case if DRM_FBDEV_EMULATION config flag is enabled.
Moving fbc allocation from dm_late_init() to amdgpu_dm_connector_get_modes() where actual modes init happens.

Change-Id Ic2251f00454bfcf926c09de1c2a54019da09675b
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 38 +++++++++--------------
 1 file changed, 15 insertions(+), 23 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +15 -23
index b632be5203b8..511cd58c16b9 100644
@@ -348,35 +348,28 @@ static void hotplug_notify_work_func(struct work_struct *work)
 
 #if defined(CONFIG_DRM_AMD_DC_FBC)
 /* Allocate memory for FBC compressed data  */
-static void amdgpu_dm_fbc_init(struct amdgpu_device *adev)
+static void amdgpu_dm_fbc_init(struct drm_connector *connector)
 {
+	struct drm_device *dev = connector->dev;
+	struct amdgpu_device *adev = dev->dev_private;
 	struct dm_comressor_info *compressor = &adev->dm.compressor;
-	struct drm_connector *conn;
-	struct drm_device *dev = adev->ddev;
+	struct amdgpu_dm_connector *aconn = to_amdgpu_dm_connector(connector);
+	struct drm_display_mode *mode;
 	unsigned long max_size = 0;
 
 	if (adev->dm.dc->fbc_compressor == NULL)
 		return;
 
-	if (compressor->bo_ptr)
+	if (aconn->dc_link->connector_signal != SIGNAL_TYPE_EDP)
 		return;
 
-	drm_modeset_lock(&dev->mode_config.connection_mutex, NULL);
-
-	/* For eDP connector find a mode requiring max size */
-	list_for_each_entry(conn,
-		    &dev->mode_config.connector_list, head) {
-		struct amdgpu_dm_connector *aconn;
+	if (compressor->bo_ptr)
+		return;
 
-		aconn = to_amdgpu_dm_connector(conn);
-		if (aconn->dc_link->connector_signal == SIGNAL_TYPE_EDP) {
-			struct drm_display_mode *mode;
 
-			list_for_each_entry(mode, &conn->modes, head) {
-				if (max_size < mode->hdisplay * mode->vdisplay)
-					max_size = mode->htotal * mode->vtotal;
-			}
-		}
+	list_for_each_entry(mode, &connector->modes, head) {
+		if (max_size < mode->htotal * mode->vtotal)
+			max_size = mode->htotal * mode->vtotal;
 	}
 
 	if (max_size) {
@@ -393,7 +386,6 @@ static void amdgpu_dm_fbc_init(struct amdgpu_device *adev)
 
 	}
 
-	drm_modeset_unlock(&dev->mode_config.connection_mutex);
 }
 #endif
 
@@ -571,9 +563,6 @@ static int dm_late_init(void *handle)
 {
 	struct amdgpu_device *adev = (struct amdgpu_device *)handle;
 
-#if defined(CONFIG_DRM_AMD_DC_FBC)
-	amdgpu_dm_fbc_init(adev);
-#endif
 	return detect_mst_link_for_all_connectors(adev->ddev);
 }
 
@@ -3411,9 +3400,12 @@ static int amdgpu_dm_connector_get_modes(struct drm_connector *connector)
 	struct edid *edid = amdgpu_dm_connector->edid;
 
 	encoder = helper->best_encoder(connector);
-
 	amdgpu_dm_connector_ddc_get_modes(connector, edid);
 	amdgpu_dm_connector_add_common_modes(encoder, connector);
+
+#if defined(CONFIG_DRM_AMD_DC_FBC)
+	amdgpu_dm_fbc_init(connector);
+#endif
 	return amdgpu_dm_connector->num_modes;
 }
 
Signature · 6 lines
2.14.1

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

PATCH 26/34 drm/amd/display: Remove duplicate entries from BIOS function table

In reply to a message not in the archive

From: Ken Chalmers <[email protected]>

Identical to the two entries above them.

Change-Id Iebe722944338e42d3bcccaa5243f2fc1fa925793
---
 drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +0 -4
index fb3cceec1a7f..69c59e050a96 100644
@@ -3795,10 +3795,6 @@ static const struct dc_vbios_funcs vbios_funcs = {
 
 	.get_gpio_pin_info = bios_parser_get_gpio_pin_info,
 
-	.get_embedded_panel_info = bios_parser_get_embedded_panel_info,
-
-	.get_gpio_pin_info = bios_parser_get_gpio_pin_info,
-
 	.get_encoder_cap_info = bios_parser_get_encoder_cap_info,
 
 	/* bios scratch register communication */
Signature · 6 lines
2.14.1

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

PATCH 27/34 drm/amd/display: Tread bad EDID as no EDID

In reply to a message not in the archive

From: Eric Yang <[email protected]>

We have an mst dock firmware that will emulate an EDID with bad checksum.

Change-Id Ice8515c929230366ec4ad7da743b448447c6db7e
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +9 -4
index f4ffbf2e2caf..8583d9e05721 100644
@@ -1637,12 +1637,17 @@ struct dc_sink *dc_link_add_remote_sink(
 			&dc_sink->dc_edid,
 			&dc_sink->edid_caps);
 
-	if (edid_status != EDID_OK)
-		goto fail;
+	/*
+	 * Treat device as no EDID device if EDID
+	 * parsing fails
+	 */
+	if (edid_status != EDID_OK) {
+		dc_sink->dc_edid.length = 0;
+		dm_error("Bad EDID, status%d!\n", edid_status);
+	}
 
 	return dc_sink;
-fail:
-	dc_link_remove_remote_sink(link, dc_sink);
+
 fail_add_sink:
 	dc_sink_release(dc_sink);
 	return NULL;
Signature · 6 lines
2.14.1

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

#30 lore raw

PATCH v2 1/1 drm/amd/display: Treat bad EDID as no EDID

From: Eric Yang <[email protected]>

We have an mst dock firmware that will emulate an EDID with bad checksum.

v2: Tread -> Treat

Change-Id Ice8515c929230366ec4ad7da743b448447c6db7e
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +9 -4
index f4ffbf2e2caf..8583d9e05721 100644
@@ -1637,12 +1637,17 @@ struct dc_sink *dc_link_add_remote_sink(
 			&dc_sink->dc_edid,
 			&dc_sink->edid_caps);
 
-	if (edid_status != EDID_OK)
-		goto fail;
+	/*
+	 * Treat device as no EDID device if EDID
+	 * parsing fails
+	 */
+	if (edid_status != EDID_OK) {
+		dc_sink->dc_edid.length = 0;
+		dm_error("Bad EDID, status%d!\n", edid_status);
+	}
 
 	return dc_sink;
-fail:
-	dc_link_remove_remote_sink(link, dc_sink);
+
 fail_add_sink:
 	dc_sink_release(dc_sink);
 	return NULL;
Signature · 6 lines
2.14.1

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

PATCH 28/34 drm/amd/display: Add missing Vega defines to dal_asic_id

In reply to a message not in the archive
Change-Id I587700a29d97fd975dc297bba2104e1db3703a3e
---
 drivers/gpu/drm/amd/display/include/dal_asic_id.h | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/gpu/drm/amd/display/include/dal_asic_id.h +8 -0
index 7abe663ecc6e..9831cb5eaa7c 100644
@@ -109,6 +109,14 @@
 #define ASIC_REV_IS_STONEY(rev) \
 	((rev >= STONEY_A0) && (rev < CZ_UNKNOWN))
 
+/* DCE12 */
+
+#define AI_GREENLAND_P_A0 1
+#define AI_GREENLAND_P_A1 2
+
+#define ASICREV_IS_GREENLAND_M(eChipRev)  (eChipRev < AI_UNKNOWN)
+#define ASICREV_IS_GREENLAND_P(eChipRev)  (eChipRev < AI_UNKNOWN)
+
 /* DCN1_0 */
 #define INTERNAL_REV_RAVEN_A0             0x00    /* First spin of Raven */
 #define RAVEN_A0 0x01
Signature · 6 lines
2.14.1

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

PATCH 29/34 drm/amd/display: provide an interface to query firmware version

In reply to a message not in the archive

From: Anthony Koo <[email protected]>

Change-Id I5c59531ebb145a8860358dbfee2d273adf2f09b6
---
 drivers/gpu/drm/amd/display/dc/core/dc.c      |  7 +++++++
 drivers/gpu/drm/amd/display/dc/dc.h           | 13 +++++++++++++
 drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c |  2 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/dmcu.h  |  7 -------
 4 files changed, 21 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +7 -0
index 8583d9e05721..77a1bf233c3c 100644
@@ -39,6 +39,7 @@
 #include "bios_parser_interface.h"
 #include "include/irq_service_interface.h"
 #include "transform.h"
+#include "dmcu.h"
 #include "dpp.h"
 #include "timing_generator.h"
 #include "virtual/virtual_link_encoder.h"
@@ -609,6 +610,12 @@ struct dc *dc_create(const struct dc_init_data *init_params)
 	dc->caps.max_audios = dc->res_pool->audio_count;
 	dc->caps.linear_pitch_alignment = 64;
 
+	/* Populate versioning information */
+	dc->versions.dc_ver = DC_VER;
+
+	if (dc->res_pool->dmcu != NULL)
+		dc->versions.dmcu_version = dc->res_pool->dmcu->dmcu_version;
+
 	dc->config = init_params->flags;
 
 	dm_logger_write(dc->ctx->logger, LOG_DC,
drivers/gpu/drm/amd/display/dc/dc.h +13 -0
index a512b05303e2..5bb0e5defaf4 100644
@@ -48,6 +48,18 @@
 /*******************************************************************************
  * Display Core Interfaces
  ******************************************************************************/
+struct dmcu_version {
+	unsigned int date;
+	unsigned int month;
+	unsigned int year;
+	unsigned int interface_version;
+};
+
+struct dc_versions {
+	const char *dc_ver;
+	struct dmcu_version dmcu_version;
+};
+
 struct dc_caps {
 	uint32_t max_streams;
 	uint32_t max_links;
@@ -221,6 +233,7 @@ struct dc_state;
 struct resource_pool;
 struct dce_hwseq;
 struct dc {
+	struct dc_versions versions;
 	struct dc_caps caps;
 	struct dc_cap_funcs cap_funcs;
 	struct dc_config config;
drivers/gpu/drm/amd/display/dc/dce/dce_dmcu.c +1 -1
index 48e21ead3142..2ee3d9bf1062 100644
@@ -360,7 +360,7 @@ static void dcn10_get_dmcu_version(struct dmcu *dmcu)
 	dmcu->dmcu_version.year = ((REG_READ(DMCU_IRAM_RD_DATA) << 8) |
 						REG_READ(DMCU_IRAM_RD_DATA));
 	dmcu->dmcu_version.month = REG_READ(DMCU_IRAM_RD_DATA);
-	dmcu->dmcu_version.day = REG_READ(DMCU_IRAM_RD_DATA);
+	dmcu->dmcu_version.date = REG_READ(DMCU_IRAM_RD_DATA);
 
 	/* Disable write access to IRAM to allow dynamic sleep state */
 	REG_UPDATE_2(DMCU_RAM_ACCESS_CTRL,
drivers/gpu/drm/amd/display/dc/inc/hw/dmcu.h +0 -7
index ce206355461b..de60f940030d 100644
@@ -32,13 +32,6 @@ enum dmcu_state {
 	DMCU_RUNNING = 1
 };
 
-struct dmcu_version {
-	unsigned int day;
-	unsigned int month;
-	unsigned int year;
-	unsigned int interface_version;
-};
-
 struct dmcu {
 	struct dc_context *ctx;
 	const struct dmcu_funcs *funcs;
Signature · 6 lines
2.14.1

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

PATCH 30/34 drm/amd/display: Set vsc pack revision when DPCD revision is >= 1.2

In reply to a message not in the archive

From: Tao <[email protected]>

Brightness couldn't change when booting up in DC mode.
It was because "psr_enabled" flag was not set to true before setting vsc packet revision, causing packet rev setup was skipped. Now instead of checking the psr flag, it checks if the DPCD_REV >= 1.2 and set the vsc packet revision.

Change-Id I7a3f1f810e6c8263524356a3751be93e033f9202
---
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +3 -1
index a6f8c1f93693..ce0e9e76eb35 100644
@@ -35,6 +35,7 @@
 #include "core_types.h"
 #include "set_mode_types.h"
 #include "virtual/virtual_stream_encoder.h"
+#include "dpcd_defs.h"
 
 #include "dce80/dce80_resource.h"
 #include "dce100/dce100_resource.h"
@@ -2434,7 +2435,8 @@ static void set_vsc_info_packet(
 	unsigned int vscPacketRevision = 0;
 	unsigned int i;
 
-	if (stream->sink->link->psr_enabled) {
+	/*VSC packet set to 2 when DP revision >= 1.2*/
+	if (stream->sink->link->dpcd_caps.dpcd_rev.raw >= DPCD_REV_12) {
 		vscPacketRevision = 2;
 	}
 
Signature · 6 lines
2.14.1

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

PATCH 31/34 drm/amd/display: Add logging for aux DPCD access

In reply to a message not in the archive

From: Eric Yang <[email protected]>

Add basic logging for DPCD access. Does not print by default.

Currently only prints first byte of the data accessed.

Technical debt: Need to make it so that the entire data block accessed is printed. Also need to log address space that's not DPCD.

Change-Id I10ef7042c14d70508845ef827ebec2432d8d8176
---
 drivers/gpu/drm/amd/display/dc/i2caux/aux_engine.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/gpu/drm/amd/display/dc/i2caux/aux_engine.c +16 -0
index fc7a7d4ebca5..0b1db48fef36 100644
@@ -284,6 +284,14 @@ static bool read_command(
 				msleep(engine->delay);
 	} while (ctx.operation_succeeded && !ctx.transaction_complete);
 
+	if (request->payload.address_space ==
+		I2CAUX_TRANSACTION_ADDRESS_SPACE_DPCD) {
+		dm_logger_write(engine->base.ctx->logger, LOG_I2C_AUX, "READ: addr:0x%x  value:0x%x Result:%d",
+				request->payload.address,
+				request->payload.data[0],
+				ctx.operation_succeeded);
+	}
+
 	return ctx.operation_succeeded;
 }
 
@@ -484,6 +492,14 @@ static bool write_command(
 				msleep(engine->delay);
 	} while (ctx.operation_succeeded && !ctx.transaction_complete);
 
+	if (request->payload.address_space ==
+		I2CAUX_TRANSACTION_ADDRESS_SPACE_DPCD) {
+		dm_logger_write(engine->base.ctx->logger, LOG_I2C_AUX, "WRITE: addr:0x%x  value:0x%x Result:%d",
+				request->payload.address,
+				request->payload.data[0],
+				ctx.operation_succeeded);
+	}
+
 	return ctx.operation_succeeded;
 }
 
Signature · 6 lines
2.14.1

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

#36 lore raw

Re: [PATCH 31/34] drm/amd/display: Add logging for aux DPCD access

With this logger you should probably remove the Linux specific logger in amdgpu_dm_mst_types.c, check log_dpcd function.

Andrey

Quoted 43 lines · Harry Wentland

From: Eric Yang <[email protected]>

Add basic logging for DPCD access. Does not print by default.

Currently only prints first byte of the data accessed.

Technical debt: Need to make it so that the entire data block accessed is printed. Also need to log address space that's not DPCD.

Change-Id I10ef7042c14d70508845ef827ebec2432d8d8176
---
  drivers/gpu/drm/amd/display/dc/i2caux/aux_engine.c | 16 ++++++++++++++++
  1 file changed, 16 insertions(+)
drivers/gpu/drm/amd/display/dc/i2caux/aux_engine.c +9 -0
index fc7a7d4ebca5..0b1db48fef36 100644
@@ -284,6 +284,14 @@ static bool read_command(
  				msleep(engine->delay);
  	} while (ctx.operation_succeeded && !ctx.transaction_complete);
 
+	if (request->payload.address_space ==
+		I2CAUX_TRANSACTION_ADDRESS_SPACE_DPCD) {
+		dm_logger_write(engine->base.ctx->logger, LOG_I2C_AUX, "READ: addr:0x%x  value:0x%x Result:%d",
+				request->payload.address,
+				request->payload.data[0],
+				ctx.operation_succeeded);
+	}
+
  	return ctx.operation_succeeded;
  }
 
@@ -484,6 +492,14 @@ static bool write_command(
  				msleep(engine->delay);
  	} while (ctx.operation_succeeded && !ctx.transaction_complete);
 
+	if (request->payload.address_space ==

drivers/gpu/drm/amd/display/dc/i2caux/aux_engine.c static bool write_command( · line 505

Quoted 10 lines
drivers/gpu/drm/amd/display/dc/i2caux/aux_engine.c +7 -0
+		I2CAUX_TRANSACTION_ADDRESS_SPACE_DPCD) {
+		dm_logger_write(engine->base.ctx->logger, LOG_I2C_AUX, "WRITE: addr:0x%x  value:0x%x Result:%d",
+				request->payload.address,
+				request->payload.data[0],
+				ctx.operation_succeeded);
+	}
+
  	return ctx.operation_succeeded;
  }
 

_______________________________________________
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): b92d42b3-699f-943a-68b2-2d15f8c30e51-5C7GfCeVMHo@public.gmane.org

#38 lore raw

Re: [PATCH 31/34] drm/amd/display: Add logging for aux DPCD access

Quoted 2 lines · Andrey Grodzovsky

With this logger you should probably remove the Linux specific logger in amdgpu_dm_mst_types.c, check log_dpcd function.

This currently only logs the first byte of the response. Once that's fixed you're right, we should rip out the one from amdgpu_dm_mst_types.c.

Harry

Quoted 46 lines

Andrey

Quoted 42 lines · Harry Wentland

From: Eric Yang <[email protected]>

Add basic logging for DPCD access. Does not print by default.

Currently only prints first byte of the data accessed.

Technical debt: Need to make it so that the entire data block accessed is printed. Also need to log address space that's not DPCD.

Change-Id I10ef7042c14d70508845ef827ebec2432d8d8176

---
  drivers/gpu/drm/amd/display/dc/i2caux/aux_engine.c | 16 ++++++++++++++++

  1 file changed, 16 insertions(+)
drivers/gpu/drm/amd/display/dc/i2caux/aux_engine.c +0 -0
index fc7a7d4ebca5..0b1db48fef36 100644
@@ -284,6 +284,14 @@ static bool read_command(
                   msleep(engine->delay);
       } while (ctx.operation_succeeded && !ctx.transaction_complete);

  +    if (request->payload.address_space ==
+        I2CAUX_TRANSACTION_ADDRESS_SPACE_DPCD) {
+        dm_logger_write(engine->base.ctx->logger, LOG_I2C_AUX, "READ: addr:0x%x  value:0x%x Result:%d", +                request->payload.address,
+                request->payload.data[0],
+                ctx.operation_succeeded);
+    }
+
      return ctx.operation_succeeded;
  }
  @@ -484,6 +492,14 @@ static bool write_command(
                  msleep(engine->delay);
      } while (ctx.operation_succeeded && !ctx.transaction_complete);
  +    if (request->payload.address_space ==
+        I2CAUX_TRANSACTION_ADDRESS_SPACE_DPCD) {
+        dm_logger_write(engine->base.ctx->logger, LOG_I2C_AUX, "WRITE: addr:0x%x  value:0x%x Result:%d",

Quoted 9 lines
Quoted 8 lines

+                request->payload.address, +                request->payload.data[0], +                ctx.operation_succeeded); +    }
+
      return ctx.operation_succeeded;
  }

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

#39 lore raw

PATCH 32/34 drm/amd/display: Remove unused dm_pp_ interfaces

In reply to a message not in the archive
Change-Id Iaafba5a3a5fd8fee6838503ce579bdb7dd1c632f
---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_services.c | 33 ----------------------
 drivers/gpu/drm/amd/display/dc/dm_services.h       | 31 --------------------
 2 files changed, 64 deletions(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_services.c +0 -33
index 56e549249134..89342b48be6b 100644
@@ -71,15 +71,6 @@ bool dm_read_persistent_data(struct dc_context *ctx,
 
 /**** power component interfaces ****/
 
-bool dm_pp_pre_dce_clock_change(
-		struct dc_context *ctx,
-		struct dm_pp_gpu_clock_range *requested_state,
-		struct dm_pp_gpu_clock_range *actual_state)
-{
-	/*TODO*/
-	return false;
-}
-
 bool dm_pp_apply_display_requirements(
 		const struct dc_context *ctx,
 		const struct dm_pp_display_configuration *pp_display_cfg)
@@ -151,30 +142,6 @@ bool dm_pp_apply_display_requirements(
 	return true;
 }
 
-bool dc_service_get_system_clocks_range(
-		const struct dc_context *ctx,
-		struct dm_pp_gpu_clock_range *sys_clks)
-{
-	struct amdgpu_device *adev = ctx->driver_context;
-
-	/* Default values, in case PPLib is not compiled-in. */
-	sys_clks->mclk.max_khz = 800000;
-	sys_clks->mclk.min_khz = 800000;
-
-	sys_clks->sclk.max_khz = 600000;
-	sys_clks->sclk.min_khz = 300000;
-
-	if (adev->pm.dpm_enabled) {
-		sys_clks->mclk.max_khz = amdgpu_dpm_get_mclk(adev, false);
-		sys_clks->mclk.min_khz = amdgpu_dpm_get_mclk(adev, true);
-
-		sys_clks->sclk.max_khz = amdgpu_dpm_get_sclk(adev, false);
-		sys_clks->sclk.min_khz = amdgpu_dpm_get_sclk(adev, true);
-	}
-
-	return true;
-}
-
 static void get_default_clock_levels(
 		enum dm_pp_clock_type clk_type,
 		struct dm_pp_clock_levels *clks)
drivers/gpu/drm/amd/display/dc/dm_services.h +0 -31
index 225b7bfb09a9..22e7ee7dcd26 100644
@@ -192,37 +192,6 @@ unsigned int generic_reg_wait(const struct dc_context *ctx,
  * Power Play (PP) interfaces
  **************************************/
 
-/* DAL calls this function to notify PP about clocks it needs for the Mode Set.
- * This is done *before* it changes DCE clock.
- *
- * If required clock is higher than current, then PP will increase the voltage.
- *
- * If required clock is lower than current, then PP will defer reduction of
- * voltage until the call to dc_service_pp_post_dce_clock_change().
- *
- * \input - Contains clocks needed for Mode Set.
- *
- * \output - Contains clocks adjusted by PP which DAL should use for Mode Set.
- *		Valid only if function returns zero.
- *
- * \returns	true - call is successful
- *		false - call failed
- */
-bool dm_pp_pre_dce_clock_change(
-	struct dc_context *ctx,
-	struct dm_pp_gpu_clock_range *requested_state,
-	struct dm_pp_gpu_clock_range *actual_state);
-
-/* The returned clocks range are 'static' system clocks which will be used for
- * mode validation purposes.
- *
- * \returns	true - call is successful
- *		false - call failed
- */
-bool dc_service_get_system_clocks_range(
-	const struct dc_context *ctx,
-	struct dm_pp_gpu_clock_range *sys_clks);
-
 /* Gets valid clocks levels from pplib
  *
  * input: clk_type - display clk / sclk / mem clk
Signature · 6 lines
2.14.1

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

PATCH 33/34 drm/amd/display: De PQ implementation

In reply to a message not in the archive

From: Vitaly Prosyak <[email protected]>

Some refactoring and optimizations in color module. Added de gamma 2.2 & 2.4, also re gamma 2.2. Added interface for diagnostic for de gamma & de pq.

Change-Id If7d9309a8ad27765c342adb80177caae04913cf8
---
 .../gpu/drm/amd/display/dc/dcn10/dcn10_dpp_cm.c    |  30 +-
 .../drm/amd/display/modules/color/color_gamma.c    | 479 +++++++++++++++++----
 .../drm/amd/display/modules/color/color_gamma.h    |   8 +
 3 files changed, 442 insertions(+), 75 deletions(-)
drivers/gpu/drm/amd/display/dc/dcn10/dcn10_dpp_cm.c +28 -2
index 2482390c1557..bd3fcdfb79c5 100644
@@ -298,6 +298,32 @@ static void dpp1_cm_get_reg_field(
 	reg->masks.exp_resion_start_segment = dpp->tf_mask->CM_RGAM_RAMB_EXP_REGION_START_SEGMENT_B;
 }
 
+static void dpp1_cm_get_degamma_reg_field(
+		struct dcn10_dpp *dpp,
+		struct xfer_func_reg *reg)
+{
+	reg->shifts.exp_region0_lut_offset = dpp->tf_shift->CM_DGAM_RAMA_EXP_REGION0_LUT_OFFSET;
+	reg->masks.exp_region0_lut_offset = dpp->tf_mask->CM_DGAM_RAMA_EXP_REGION0_LUT_OFFSET;
+	reg->shifts.exp_region0_num_segments = dpp->tf_shift->CM_DGAM_RAMA_EXP_REGION0_NUM_SEGMENTS;
+	reg->masks.exp_region0_num_segments = dpp->tf_mask->CM_DGAM_RAMA_EXP_REGION0_NUM_SEGMENTS;
+	reg->shifts.exp_region1_lut_offset = dpp->tf_shift->CM_DGAM_RAMA_EXP_REGION1_LUT_OFFSET;
+	reg->masks.exp_region1_lut_offset = dpp->tf_mask->CM_DGAM_RAMA_EXP_REGION1_LUT_OFFSET;
+	reg->shifts.exp_region1_num_segments = dpp->tf_shift->CM_DGAM_RAMA_EXP_REGION1_NUM_SEGMENTS;
+	reg->masks.exp_region1_num_segments = dpp->tf_mask->CM_DGAM_RAMA_EXP_REGION1_NUM_SEGMENTS;
+
+	reg->shifts.field_region_end = dpp->tf_shift->CM_DGAM_RAMB_EXP_REGION_END_B;
+	reg->masks.field_region_end = dpp->tf_mask->CM_DGAM_RAMB_EXP_REGION_END_B;
+	reg->shifts.field_region_end_slope = dpp->tf_shift->CM_DGAM_RAMB_EXP_REGION_END_SLOPE_B;
+	reg->masks.field_region_end_slope = dpp->tf_mask->CM_DGAM_RAMB_EXP_REGION_END_SLOPE_B;
+	reg->shifts.field_region_end_base = dpp->tf_shift->CM_DGAM_RAMB_EXP_REGION_END_BASE_B;
+	reg->masks.field_region_end_base = dpp->tf_mask->CM_DGAM_RAMB_EXP_REGION_END_BASE_B;
+	reg->shifts.field_region_linear_slope = dpp->tf_shift->CM_DGAM_RAMB_EXP_REGION_LINEAR_SLOPE_B;
+	reg->masks.field_region_linear_slope = dpp->tf_mask->CM_DGAM_RAMB_EXP_REGION_LINEAR_SLOPE_B;
+	reg->shifts.exp_region_start = dpp->tf_shift->CM_DGAM_RAMB_EXP_REGION_START_B;
+	reg->masks.exp_region_start = dpp->tf_mask->CM_DGAM_RAMB_EXP_REGION_START_B;
+	reg->shifts.exp_resion_start_segment = dpp->tf_shift->CM_DGAM_RAMB_EXP_REGION_START_SEGMENT_B;
+	reg->masks.exp_resion_start_segment = dpp->tf_mask->CM_DGAM_RAMB_EXP_REGION_START_SEGMENT_B;
+}
 void dpp1_cm_set_output_csc_adjustment(
 		struct dpp *dpp_base,
 		const uint16_t *regval)
@@ -502,7 +528,7 @@ void dpp1_program_degamma_lutb_settings(
 	struct dcn10_dpp *dpp = TO_DCN10_DPP(dpp_base);
 	struct xfer_func_reg gam_regs;
 
-	dpp1_cm_get_reg_field(dpp, &gam_regs);
+	dpp1_cm_get_degamma_reg_field(dpp, &gam_regs);
 
 	gam_regs.start_cntl_b = REG(CM_DGAM_RAMB_START_CNTL_B);
 	gam_regs.start_cntl_g = REG(CM_DGAM_RAMB_START_CNTL_G);
@@ -531,7 +557,7 @@ void dpp1_program_degamma_luta_settings(
 	struct dcn10_dpp *dpp = TO_DCN10_DPP(dpp_base);
 	struct xfer_func_reg gam_regs;
 
-	dpp1_cm_get_reg_field(dpp, &gam_regs);
+	dpp1_cm_get_degamma_reg_field(dpp, &gam_regs);
 
 	gam_regs.start_cntl_b = REG(CM_DGAM_RAMA_START_CNTL_B);
 	gam_regs.start_cntl_g = REG(CM_DGAM_RAMA_START_CNTL_G);
drivers/gpu/drm/amd/display/modules/color/color_gamma.c +406 -73

657 lines not on this page · raw message

drivers/gpu/drm/amd/display/modules/color/color_gamma.h +8 -0
index 774c6daa1689..b7f9bc27d101 100644
@@ -34,12 +34,20 @@ enum dc_transfer_func_predefined;
 
 void setup_x_points_distribution(void);
 void precompute_pq(void);
+void precompute_de_pq(void);
 
 bool mod_color_calculate_regamma_params(struct dc_transfer_func *output_tf,
 		const struct dc_gamma *ramp, bool mapUserRamp);
 
+bool mod_color_calculate_degamma_params(struct dc_transfer_func *output_tf,
+		const struct dc_gamma *ramp, bool mapUserRamp);
+
 bool mod_color_calculate_curve(enum dc_transfer_func_predefined  trans,
 		struct dc_transfer_func_distributed_points *points);
 
+bool  mod_color_calculate_degamma_curve(enum dc_transfer_func_predefined trans,
+				struct dc_transfer_func_distributed_points *points);
+
+
 
 #endif /* COLOR_MOD_COLOR_GAMMA_H_ */
Signature · 6 lines
2.14.1

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

PATCH 34/34 drm/amd/display: Fix increment when sampling OTF in DCE

In reply to a message not in the archive

From: "Leo (Sunpeng) Li" <[email protected]>

Previously, the number of software segmets per region was reduced to 16. This needs to be reflected in the sampling distance (increment) used when translating to the hardware format.

Change-Id Ic1bf86d87ad36d9d4801472a114c45c95db4baf3
---
 drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +1 -1
index bc698644d42a..0422c72a7579 100644
@@ -481,7 +481,7 @@ dce110_translate_regamma_to_hw_format(const struct dc_transfer_func *output_tf,
 
 	j = 0;
 	for (k = 0; k < (region_end - region_start); k++) {
-		increment = 32 / (1 << seg_distr[k]);
+		increment = NUMBER_SW_SEGMENTS / (1 << seg_distr[k]);
 		start_index = (region_start + k + MAX_LOW_POINT) *
 				NUMBER_SW_SEGMENTS;
 		for (i = start_index; i < start_index + NUMBER_SW_SEGMENTS;
Signature · 6 lines
2.14.1

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