Skip to contentSkip to conversation

DC Linux Patches May 3, 2017

PATCH New Harry Wentland 1 participant 29 messages May 3, 2017 1 message not in the archive

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

cover DC Linux Patches May 3, 2017

* Tony fixed some hang after my previous ctx change with the resource_pool decouple
* Some refactor of HW programming code to bring IPP in line other HW blocks
* Bunch of other small fixes and changes

Amy Zhang (1):
drm/amd/display: always retrieve PSR cap

Charlene Liu (1):
drm/amd/display: USB-c DP-HDMI dongle shows garbage on Sony TV

Ding Wang (2):
drm/amd/display: Define dithering options drm/amd/display: Add function to set dither option

Dmytro Laktyushkin (7):
drm/amd/display: remove unnecessary allocation for regamma_params
inside opp
drm/amd/display: fix memory leak
drm/amd/display: improve cursor programming reliability drm/amd/display: dce120 to dce ipp refactor drm/amd/display: dce80, 100, 110 and 112 to dce ipp refactor drm/amd/display: no need for return value from ipp_program_degamma_pwl drm/amd/display: fix crash caused by incorrect index being used for
array

Eric Cook (3):
drm/amd/display: FreeSync Auto Sweep Support drm/amd/display: Check for Zero Range in FreeSync Calc drm/amd/display: Add support for FreeSync on eDP to module

Harry Wentland (2):
drm/amd/display: Fix memory leak in post_update_surfaces drm/amd/display: Assign stream to map before we need it

Hersen Wu (1):
drm/amd/display: Get dprefclk ss percentage from vbios

Pratik Vishwakarma (1):
drm/amd/display: get_atomic_property missing for drm_connector_funcs

Sylvia Tsai (1):
drm/amd/display: PSR Refactor

Tony Cheng (4):
drm/amd/display: move tg_color to dc_hw_types drm/amd/display: clarify delay param for REG_WAIT drm/amd/display: decouple resource_pool from resource_context drm/amd/display: move drr_params definition to TG

Yongqiang Sun (3):
drm/amd/display: set correct v_total_min and v_total_max for dce. drm/amd/display: Make sure v_total_min and max not less than v_total. drm/amd/display: Disable cursor on video surface.

Zeyu Fan (2):
drm/amd/display: Block YCbCr formats for eDP. Revert previous change. drm/amd/display: Make dc_link param const in set_drive_settings

 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    |  53 +++-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.h    |   6 +
 drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c |  40 +--
 drivers/gpu/drm/amd/display/dc/core/dc.c           | 179 ++++++++-----
 drivers/gpu/drm/amd/display/dc/core/dc_debug.c     |   5 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      |  22 +-
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c   |  81 ++----
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  | 255 +++++++++++++-----
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c    |  59 +++--
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c   |   3 +-
 drivers/gpu/drm/amd/display/dc/dc.h                |  34 ++-
 drivers/gpu/drm/amd/display/dc/dc_dp_types.h       |   8 +-
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h       |  41 ++-
 drivers/gpu/drm/amd/display/dc/dc_types.h          |  44 +--
 drivers/gpu/drm/amd/display/dc/dce/Makefile        |   2 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c    |  46 +++-
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.h    |  13 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_ipp.c       | 260 ++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/dce/dce_ipp.h       | 238 +++++++++++++++++
 .../gpu/drm/amd/display/dc/dce/dce_link_encoder.c  |   8 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_opp.c       |  10 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.h |   2 +-
 .../amd/display/dc/dce100/dce100_hw_sequencer.c    |   4 +-
 .../drm/amd/display/dc/dce100/dce100_resource.c    |  81 +++---
 drivers/gpu/drm/amd/display/dc/dce110/Makefile     |   4 +-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  79 ++++--
 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.c |  63 -----
 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h |  74 ------
 .../drm/amd/display/dc/dce110/dce110_ipp_cursor.c  | 251 ------------------
 .../drm/amd/display/dc/dce110/dce110_ipp_gamma.c   | 161 -----------
 .../gpu/drm/amd/display/dc/dce110/dce110_opp_v.c   |   4 -
 .../drm/amd/display/dc/dce110/dce110_resource.c    | 143 +++-------
 .../drm/amd/display/dc/dce110/dce110_resource.h    |   4 -
 .../display/dc/dce110/dce110_timing_generator.c    |  77 ++----
 .../display/dc/dce110/dce110_timing_generator.h    |   9 +-
 .../display/dc/dce110/dce110_timing_generator_v.c  |  23 +-
 .../drm/amd/display/dc/dce112/dce112_resource.c    | 118 ++++-----
 drivers/gpu/drm/amd/display/dc/dce120/Makefile     |   1 -
 drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.c |  58 ----
 drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.h |  62 -----
 .../drm/amd/display/dc/dce120/dce120_ipp_cursor.c  | 195 --------------
 .../drm/amd/display/dc/dce120/dce120_ipp_gamma.c   | 167 ------------
 .../drm/amd/display/dc/dce120/dce120_resource.c    |  75 +++---
 .../display/dc/dce120/dce120_timing_generator.c    |  73 ++++-
 drivers/gpu/drm/amd/display/dc/dce80/Makefile      |   2 +-
 drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.c   |  65 -----
 drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.h   |  45 ----
 .../gpu/drm/amd/display/dc/dce80/dce80_resource.c  |  92 +++----
 .../amd/display/dc/dce80/dce80_timing_generator.c  |   2 +-
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |   7 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h  |   3 +
 drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h        |  11 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h        |   2 +-
 .../drm/amd/display/dc/inc/hw/timing_generator.h   |  29 +-
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |   5 +-
 drivers/gpu/drm/amd/display/dc/inc/reg_helper.h    |   4 +-
 drivers/gpu/drm/amd/display/dc/inc/resource.h      |  17 +-
 .../drm/amd/display/include/hw_sequencer_types.h   |  11 -
 .../drm/amd/display/modules/freesync/freesync.c    | 294 +++++++++++++++++----
 .../gpu/drm/amd/display/modules/inc/mod_freesync.h |  20 ++
 60 files changed, 1754 insertions(+), 1990 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_ipp.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_ipp.h
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp_cursor.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp_gamma.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.h
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp_cursor.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp_gamma.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.h
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): 20170503211351.3520-1-harry.wentland-5C7GfCeVMHo@public.gmane.org

#2 lore raw

PATCH 1/28 drm/amd/display: get_atomic_property missing for drm_connector_funcs

From: Pratik Vishwakarma <[email protected]>

DRM_IOCTL_MODE_GETCONNECTOR fails with EINVAL on enabling DRIVER_ATOMIC With this DRM_IOCTL_MODE_GETCONNECTOR returns all the connector properties. freesync_property and freesync_capable_property return 0 currently.

TESTS(On Chromium OS on Stoney Only)
* Builds without compilation errors.
* 'atomictest' proceeds after applying patch and fails with vblank event timed out.
* Chromium OS ui comes up.

---
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.c    | 53 +++++++++++++++++++++-
 .../drm/amd/display/amdgpu_dm/amdgpu_dm_types.h    |  6 +++
 2 files changed, 58 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c +52 -1
index d8969bcbeb22..a819e6ba659f 100644
@@ -1366,6 +1366,56 @@ int amdgpu_dm_connector_atomic_set_property(
 	return ret;
 }
 
+int amdgpu_dm_connector_atomic_get_property(
+	struct drm_connector *connector,
+	const struct drm_connector_state *state,
+	struct drm_property *property,
+	uint64_t *val)
+{
+	struct drm_device *dev = connector->dev;
+	struct amdgpu_device *adev = dev->dev_private;
+	struct dm_connector_state *dm_state =
+		to_dm_connector_state(state);
+	int ret = -EINVAL;
+
+	if (property == dev->mode_config.scaling_mode_property) {
+		switch (dm_state->scaling) {
+		case RMX_CENTER:
+			*val = DRM_MODE_SCALE_CENTER;
+			break;
+		case RMX_ASPECT:
+			*val = DRM_MODE_SCALE_ASPECT;
+			break;
+		case RMX_FULL:
+			*val = DRM_MODE_SCALE_FULLSCREEN;
+			break;
+		case RMX_OFF:
+		default:
+			*val = DRM_MODE_SCALE_NONE;
+			break;
+		}
+		ret = 0;
+	} else if (property == adev->mode_info.underscan_hborder_property) {
+		*val = dm_state->underscan_hborder;
+		ret = 0;
+	} else if (property == adev->mode_info.underscan_vborder_property) {
+		*val = dm_state->underscan_vborder;
+		ret = 0;
+	} else if (property == adev->mode_info.underscan_property) {
+		*val = dm_state->underscan_enable;
+		ret = 0;
+	} else if (property == adev->mode_info.freesync_property) {
+		//TODO
+		*val = 0;
+		ret = 0;
+	} else if (property == adev->mode_info.freesync_capable_property) {
+		//TODO
+		*val = 0;
+		ret = 0;
+	}
+	return ret;
+}
+
 void amdgpu_dm_connector_destroy(struct drm_connector *connector)
 {
 	struct amdgpu_connector *aconnector = to_amdgpu_connector(connector);
@@ -1437,7 +1487,8 @@ static const struct drm_connector_funcs amdgpu_dm_connector_funcs = {
 	.destroy = amdgpu_dm_connector_destroy,
 	.atomic_duplicate_state = amdgpu_dm_connector_atomic_duplicate_state,
 	.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
-	.atomic_set_property = amdgpu_dm_connector_atomic_set_property
+	.atomic_set_property = amdgpu_dm_connector_atomic_set_property,
+	.atomic_get_property = amdgpu_dm_connector_atomic_get_property
 };
 
 static struct drm_encoder *best_encoder(struct drm_connector *connector)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.h +6 -0
index ab6d51dbbf4b..b69c86826b1a 100644
@@ -71,6 +71,12 @@ int amdgpu_dm_connector_atomic_set_property(
 	struct drm_property *property,
 	uint64_t val);
 
+int amdgpu_dm_connector_atomic_get_property(
+	struct drm_connector *connector,
+	const struct drm_connector_state *state,
+	struct drm_property *property,
+	uint64_t *val);
+
 int amdgpu_dm_get_encoder_crtc_mask(struct amdgpu_device *adev);
 
 void amdgpu_dm_connector_init_helper(
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/28 drm/amd/display: Block YCbCr formats for eDP. Revert previous change.

In reply to a message not in the archive

From: Zeyu Fan <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_link_encoder.c +6 -2
index 1a84ee0105da..812c29982a2e 100644
@@ -1026,9 +1026,13 @@ bool dce110_link_encoder_validate_output_with_stream(
 	break;
 	case SIGNAL_TYPE_DISPLAY_PORT:
 	case SIGNAL_TYPE_DISPLAY_PORT_MST:
-	case SIGNAL_TYPE_EDP:
 		is_valid = dce110_link_encoder_validate_dp_output(
-			enc110, &stream->public.timing);
+					enc110, &stream->public.timing);
+	break;
+	case SIGNAL_TYPE_EDP:
+		is_valid =
+			(stream->public.timing.
+				pixel_encoding == PIXEL_ENCODING_RGB) ? true : false;
 	break;
 	case SIGNAL_TYPE_VIRTUAL:
 		is_valid = true;
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/28 drm/amd/display: Fix memory leak in post_update_surfaces

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +5 -2
index 64b5216fb920..b1f0a50171af 100644
@@ -918,6 +918,7 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
 	int i;
 	struct core_dc *core_dc = DC_TO_CORE(dc);
 	struct validate_context *context = dm_alloc(sizeof(struct validate_context));
+	bool result = true;
 
 	if (!context) {
 		dm_error("%s: failed to create validate ctx\n", __func__);
@@ -935,17 +936,19 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
 
 	if (!core_dc->res_pool->funcs->validate_bandwidth(core_dc, context)) {
 		BREAK_TO_DEBUGGER();
-		return false;
+		result = false;
+		goto cleanup;
 	}
 
 	core_dc->hwss.set_bandwidth(core_dc, context, true);
 
 	dc_resource_validate_ctx_copy_construct(context, core_dc->current_context);
 
+cleanup:
 	dc_resource_validate_ctx_destruct(context);
 	dm_free(context);
 
-	return true;
+	return result;
 }
 
 bool dc_commit_surfaces_to_stream(
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/28 drm/amd/display: remove unnecessary allocation for regamma_params inside opp

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/dce/dce_opp.c                | 10 +---------
 drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c |  6 +++---
 drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_v.c        |  4 ----
 drivers/gpu/drm/amd/display/dc/inc/hw/opp.h                 |  2 +-
 4 files changed, 5 insertions(+), 17 deletions(-)
drivers/gpu/drm/amd/display/dc/dce/dce_opp.c +1 -9
index 121ccbb1ad2d..f716a9e8784e 100644
@@ -987,10 +987,6 @@ bool dce110_opp_construct(struct dce110_opp *opp110,
 
 	opp110->base.inst = inst;
 
-	opp110->base.regamma_params = dm_alloc(sizeof(struct pwl_params));
-	if (opp110->base.regamma_params == NULL)
-		return false;
-
 	opp110->regs = regs;
 	opp110->opp_shift = opp_shift;
 	opp110->opp_mask = opp_mask;
@@ -1000,12 +996,8 @@ bool dce110_opp_construct(struct dce110_opp *opp110,
 
 void dce110_opp_destroy(struct output_pixel_processor **opp)
 {
-	if (*opp) {
-		if ((*opp)->regamma_params)
-			dm_free((*opp)->regamma_params);
-		(*opp)->regamma_params = NULL;
+	if (*opp)
 		dm_free(FROM_DCE11_OPP(*opp));
-	}
 	*opp = NULL;
 }
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +3 -3
index 2fbf6ddcf3be..6b249f5bf1da 100644
@@ -637,7 +637,7 @@ static bool dce110_set_output_transfer_func(
 	struct output_pixel_processor *opp = pipe_ctx->opp;
 
 	opp->funcs->opp_power_on_regamma_lut(opp, true);
-	opp->regamma_params->hw_points_num = GAMMA_HW_POINTS_NUM;
+	opp->regamma_params.hw_points_num = GAMMA_HW_POINTS_NUM;
 
 	if (stream->public.out_transfer_func &&
 		stream->public.out_transfer_func->type ==
@@ -646,8 +646,8 @@ static bool dce110_set_output_transfer_func(
 			TRANSFER_FUNCTION_SRGB) {
 		opp->funcs->opp_set_regamma_mode(opp, OPP_REGAMMA_SRGB);
 	} else if (dce110_translate_regamma_to_hw_format(
-				stream->public.out_transfer_func, opp->regamma_params)) {
-			opp->funcs->opp_program_regamma_pwl(opp, opp->regamma_params);
+				stream->public.out_transfer_func, &opp->regamma_params)) {
+			opp->funcs->opp_program_regamma_pwl(opp, &opp->regamma_params);
 			opp->funcs->opp_set_regamma_mode(opp, OPP_REGAMMA_USER);
 	} else {
 		opp->funcs->opp_set_regamma_mode(opp, OPP_REGAMMA_BYPASS);
drivers/gpu/drm/amd/display/dc/dce110/dce110_opp_v.c +0 -4
index 95b3d2eb8428..6f8b414cabbc 100644
@@ -56,10 +56,6 @@ bool dce110_opp_v_construct(struct dce110_opp *opp110,
 
 	opp110->base.ctx = ctx;
 
-	opp110->base.regamma_params = dm_alloc(sizeof(struct pwl_params));
-	if (opp110->base.regamma_params == NULL)
-		return false;
-
 	return true;
 }
 
drivers/gpu/drm/amd/display/dc/inc/hw/opp.h +1 -1
index 521bd21eb5df..92c99c3b9002 100644
@@ -203,7 +203,7 @@ enum opp_regamma {
 struct output_pixel_processor {
 	struct dc_context *ctx;
 	uint32_t inst;
-	struct pwl_params *regamma_params;
+	struct pwl_params regamma_params;
 	const struct opp_funcs *funcs;
 };
 
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/28 drm/amd/display: set correct v_total_min and v_total_max for dce.

In reply to a message not in the archive

From: Yongqiang Sun <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c | 4 ++--
 drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c +2 -2
index 7070aaf9e433..69ae3a83d2fe 100644
@@ -393,12 +393,12 @@ void dce110_timing_generator_set_drr(
 		params->vertical_total_min > 0) {
 
 		set_reg_field_value(v_total_max,
-				params->vertical_total_max - 1,
+				params->vertical_total_max,
 				CRTC_V_TOTAL_MAX,
 				CRTC_V_TOTAL_MAX);
 
 		set_reg_field_value(v_total_min,
-				params->vertical_total_min - 1,
+				params->vertical_total_min,
 				CRTC_V_TOTAL_MIN,
 				CRTC_V_TOTAL_MIN);
 
drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c +2 -2
index 1318df7ed47e..6e3e7b6bc58c 100644
@@ -540,10 +540,10 @@ void dce120_timing_generator_set_drr(
 
 		CRTC_REG_UPDATE(
 				CRTC0_CRTC_V_TOTAL_MIN,
-				CRTC_V_TOTAL_MIN, params->vertical_total_min - 1);
+				CRTC_V_TOTAL_MIN, params->vertical_total_min);
 		CRTC_REG_UPDATE(
 				CRTC0_CRTC_V_TOTAL_MAX,
-				CRTC_V_TOTAL_MAX, params->vertical_total_max - 1);
+				CRTC_V_TOTAL_MAX, params->vertical_total_max);
 		CRTC_REG_SET_N(CRTC0_CRTC_V_TOTAL_CONTROL, 6,
 				FD(CRTC0_CRTC_V_TOTAL_CONTROL__CRTC_V_TOTAL_MIN_SEL), 1,
 				FD(CRTC0_CRTC_V_TOTAL_CONTROL__CRTC_V_TOTAL_MAX_SEL), 1,
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/28 drm/amd/display: fix memory leak

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/core/dc.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +12 -14
index b1f0a50171af..1dd9c736aedc 100644
@@ -918,7 +918,6 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
 	int i;
 	struct core_dc *core_dc = DC_TO_CORE(dc);
 	struct validate_context *context = dm_alloc(sizeof(struct validate_context));
-	bool result = true;
 
 	if (!context) {
 		dm_error("%s: failed to create validate ctx\n", __func__);
@@ -927,28 +926,29 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
 	dc_resource_validate_ctx_copy_construct(core_dc->current_context, context);
 
 	post_surface_trace(dc);
+
 	for (i = 0; i < context->res_ctx.pool->pipe_count; i++)
 		if (context->res_ctx.pipe_ctx[i].stream == NULL) {
 			context->res_ctx.pipe_ctx[i].pipe_idx = i;
 			core_dc->hwss.power_down_front_end(
 					core_dc, &context->res_ctx.pipe_ctx[i]);
 		}
-
 	if (!core_dc->res_pool->funcs->validate_bandwidth(core_dc, context)) {
 		BREAK_TO_DEBUGGER();
-		result = false;
-		goto cleanup;
+		dc_resource_validate_ctx_destruct(context);
+		dm_free(context);
+		return false;
 	}
 
 	core_dc->hwss.set_bandwidth(core_dc, context, true);
 
-	dc_resource_validate_ctx_copy_construct(context, core_dc->current_context);
-
-cleanup:
-	dc_resource_validate_ctx_destruct(context);
-	dm_free(context);
+	if (core_dc->current_context) {
+		dc_resource_validate_ctx_destruct(core_dc->current_context);
+		dm_free(core_dc->current_context);
+	}
+	core_dc->current_context = context;
 
-	return result;
+	return true;
 }
 
 bool dc_commit_surfaces_to_stream(
@@ -1440,10 +1440,8 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 	return;
 
 fail:
-	if (core_dc->current_context != context) {
-		dc_resource_validate_ctx_destruct(context);
-		dm_free(context);
-	}
+	dc_resource_validate_ctx_destruct(context);
+	dm_free(context);
 }
 
 uint8_t dc_get_current_stream_count(const struct dc *dc)
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/28 drm/amd/display: always retrieve PSR cap

In reply to a message not in the archive

From: Amy Zhang <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -2
index 913b01cd7159..4ef3fec44d2d 100644
@@ -2169,8 +2169,7 @@ static void retrieve_link_cap(struct core_link *link)
 	CONN_DATA_DETECT(link, dpcd_data, sizeof(dpcd_data), "Rx Caps: ");
 
 	/* TODO: Confirm if need retrieve_psr_link_cap */
-	if (link->public.reported_link_cap.link_rate < LINK_RATE_HIGH2)
-		retrieve_psr_link_cap(link, link->edp_revision);
+	retrieve_psr_link_cap(link, link->edp_revision);
 }
 
 void detect_dp_sink_caps(struct core_link *link)
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/28 drm/amd/display: Make sure v_total_min and max not less than v_total.

In reply to a message not in the archive

From: Yongqiang Sun <[email protected]>

---
 .../gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c  |  4 ++--
 .../gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c  |  4 ++--
 drivers/gpu/drm/amd/display/modules/freesync/freesync.c      | 12 ++++++++++++
 3 files changed, 16 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c +2 -2
index 69ae3a83d2fe..7070aaf9e433 100644
@@ -393,12 +393,12 @@ void dce110_timing_generator_set_drr(
 		params->vertical_total_min > 0) {
 
 		set_reg_field_value(v_total_max,
-				params->vertical_total_max,
+				params->vertical_total_max - 1,
 				CRTC_V_TOTAL_MAX,
 				CRTC_V_TOTAL_MAX);
 
 		set_reg_field_value(v_total_min,
-				params->vertical_total_min,
+				params->vertical_total_min - 1,
 				CRTC_V_TOTAL_MIN,
 				CRTC_V_TOTAL_MIN);
 
drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c +2 -2
index 6e3e7b6bc58c..1318df7ed47e 100644
@@ -540,10 +540,10 @@ void dce120_timing_generator_set_drr(
 
 		CRTC_REG_UPDATE(
 				CRTC0_CRTC_V_TOTAL_MIN,
-				CRTC_V_TOTAL_MIN, params->vertical_total_min);
+				CRTC_V_TOTAL_MIN, params->vertical_total_min - 1);
 		CRTC_REG_UPDATE(
 				CRTC0_CRTC_V_TOTAL_MAX,
-				CRTC_V_TOTAL_MAX, params->vertical_total_max);
+				CRTC_V_TOTAL_MAX, params->vertical_total_max - 1);
 		CRTC_REG_SET_N(CRTC0_CRTC_V_TOTAL_CONTROL, 6,
 				FD(CRTC0_CRTC_V_TOTAL_CONTROL__CRTC_V_TOTAL_MIN_SEL), 1,
 				FD(CRTC0_CRTC_V_TOTAL_CONTROL__CRTC_V_TOTAL_MAX_SEL), 1,
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +12 -0
index 94566c0a0e62..5c6de723da5d 100644
@@ -347,6 +347,7 @@ static void calc_vmin_vmax(struct core_freesync *core_freesync,
 {
 	unsigned int min_frame_duration_in_ns = 0, max_frame_duration_in_ns = 0;
 	unsigned int index = map_index_from_stream(core_freesync, stream);
+	uint32_t vtotal = stream->timing.v_total;
 
 	min_frame_duration_in_ns = ((unsigned int) (div64_u64(
 					(1000000000ULL * 1000000),
@@ -362,6 +363,17 @@ static void calc_vmin_vmax(struct core_freesync *core_freesync,
 	*vmin = div64_u64(div64_u64(((unsigned long long)(
 			min_frame_duration_in_ns) * stream->timing.pix_clk_khz),
 			stream->timing.h_total), 1000000);
+
+	/* In case of 4k free sync monitor, vmin or vmax cannot be less than vtotal */
+	if (*vmin < vtotal) {
+		ASSERT(false);
+		*vmin = vtotal;
+	}
+
+	if (*vmax < vtotal) {
+		ASSERT(false);
+		*vmax = vtotal;
+	}
 }
 
 static void calc_v_total_from_duration(const struct dc_stream *stream,
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/28 drm/amd/display: USB-c DP-HDMI dongle shows garbage on Sony TV

In reply to a message not in the archive

From: Charlene Liu <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 21 ++++++++++++++++++++-
 drivers/gpu/drm/amd/display/dc/dc.h              |  2 +-
 drivers/gpu/drm/amd/display/dc/dc_dp_types.h     |  8 ++++++--
 drivers/gpu/drm/amd/display/dc/dc_types.h        | 20 ++++++++++++++++++++
 4 files changed, 47 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +20 -1
index 4ef3fec44d2d..953e201dc6bc 100644
@@ -1951,14 +1951,33 @@ static void get_active_converter_info(
 			link->dpcd_caps.dongle_type =
 				DISPLAY_DONGLE_DP_HDMI_CONVERTER;
 
+			link->dpcd_caps.dongle_caps.dongle_type = link->dpcd_caps.dongle_type;
 			if (ds_port.fields.DETAILED_CAPS) {
 
 				union dwnstream_port_caps_byte3_hdmi
 					hdmi_caps = {.raw = det_caps[3] };
+				union dwnstream_port_caps_byte1
+					hdmi_color_caps = {.raw = det_caps[2] };
+				link->dpcd_caps.dongle_caps.dp_hdmi_max_pixel_clk =
+					det_caps[1] * 25000;
 
-				link->dpcd_caps.is_dp_hdmi_s3d_converter =
+				link->dpcd_caps.dongle_caps.is_dp_hdmi_s3d_converter =
 					hdmi_caps.bits.FRAME_SEQ_TO_FRAME_PACK;
+				link->dpcd_caps.dongle_caps.is_dp_hdmi_ycbcr422_pass_through =
+					hdmi_caps.bits.YCrCr422_PASS_THROUGH;
+				link->dpcd_caps.dongle_caps.is_dp_hdmi_ycbcr420_pass_through =
+					hdmi_caps.bits.YCrCr420_PASS_THROUGH;
+				link->dpcd_caps.dongle_caps.is_dp_hdmi_ycbcr422_converter =
+					hdmi_caps.bits.YCrCr422_CONVERSION;
+				link->dpcd_caps.dongle_caps.is_dp_hdmi_ycbcr420_converter =
+					hdmi_caps.bits.YCrCr420_CONVERSION;
+
+				link->dpcd_caps.dongle_caps.dp_hdmi_max_bpc =
+					hdmi_color_caps.bits.MAX_BITS_PER_COLOR_COMPONENT;
+
+				link->dpcd_caps.dongle_caps.extendedCapValid = true;
 			}
+
 			break;
 		}
 	}
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
index 1b3fd79ce624..d35fa01024f8 100644
@@ -623,7 +623,7 @@ struct dpcd_caps {
 	union sink_count sink_count;
 	/* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
 	indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
-	bool is_dp_hdmi_s3d_converter;
+	struct dc_dongle_caps dongle_caps;
 
 	bool allow_invalid_MSA_timing_param;
 	bool panel_mode_edp;
drivers/gpu/drm/amd/display/dc/dc_dp_types.h +6 -2
index cd2323a71760..77e2de69cca3 100644
@@ -255,7 +255,7 @@ enum dpcd_downstream_port_detailed_type {
 	DOWN_STREAM_DETAILED_DP_PLUS_PLUS
 };
 
-union dwnstream_port_caps_byte2 {
+union dwnstream_port_caps_byte1 {
 	struct {
 		uint8_t MAX_BITS_PER_COLOR_COMPONENT:2;
 		uint8_t RESERVED:6;
@@ -287,7 +287,11 @@ union dwnstream_port_caps_byte3_dvi {
 union dwnstream_port_caps_byte3_hdmi {
 	struct {
 		uint8_t FRAME_SEQ_TO_FRAME_PACK:1;
-		uint8_t RESERVED:7;
+		uint8_t YCrCr422_PASS_THROUGH:1;
+		uint8_t YCrCr420_PASS_THROUGH:1;
+		uint8_t YCrCr422_CONVERSION:1;
+		uint8_t YCrCr420_CONVERSION:1;
+		uint8_t RESERVED:3;
 	} bits;
 	uint8_t raw;
 };
drivers/gpu/drm/amd/display/dc/dc_types.h +20 -0
index e0436e317341..2ba02b50bc18 100644
@@ -338,6 +338,26 @@ enum {
 	LAYER_INDEX_PRIMARY = -1,
 };
 
+enum dpcd_downstream_port_max_bpc {
+	DOWN_STREAM_MAX_8BPC = 0,
+	DOWN_STREAM_MAX_10BPC,
+	DOWN_STREAM_MAX_12BPC,
+	DOWN_STREAM_MAX_16BPC
+};
+struct dc_dongle_caps {
+	/* dongle type (DP converter, CV smart dongle) */
+	enum display_dongle_type dongle_type;
+	bool extendedCapValid;
+	/* If dongle_type == DISPLAY_DONGLE_DP_HDMI_CONVERTER,
+	indicates 'Frame Sequential-to-lllFrame Pack' conversion capability.*/
+	bool is_dp_hdmi_s3d_converter;
+	bool is_dp_hdmi_ycbcr422_pass_through;
+	bool is_dp_hdmi_ycbcr420_pass_through;
+	bool is_dp_hdmi_ycbcr422_converter;
+	bool is_dp_hdmi_ycbcr420_converter;
+	uint32_t dp_hdmi_max_bpc;
+	uint32_t dp_hdmi_max_pixel_clk;
+};
 /* Scaling format */
 enum scaling_transformation {
 	SCALING_TRANSFORMATION_UNINITIALIZED,
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/28 drm/amd/display: improve cursor programming reliability

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

This change will cache cursor attributes and reprogram them when enabling cursor after power gating if the attributes were not yet reprogrammed

---
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c    | 55 ++++++++++------------
 drivers/gpu/drm/amd/display/dc/dc.h                |  2 +-
 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h |  2 +-
 .../drm/amd/display/dc/dce110/dce110_ipp_cursor.c  |  4 +-
 drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.h |  2 +-
 .../drm/amd/display/dc/dce120/dce120_ipp_cursor.c  |  4 +-
 drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h        |  4 +-
 7 files changed, 32 insertions(+), 41 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +26 -29
index 3dbd6c0885d8..23627b14c16c 100644
@@ -182,7 +182,6 @@ bool dc_stream_set_cursor_attributes(
 	struct core_stream *stream;
 	struct core_dc *core_dc;
 	struct resource_context *res_ctx;
-	bool ret = false;
 
 	if (NULL == dc_stream) {
 		dm_error("DC: dc_stream is NULL!\n");
@@ -200,28 +199,26 @@ bool dc_stream_set_cursor_attributes(
 	for (i = 0; i < MAX_PIPES; i++) {
 		struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
 
-		if ((pipe_ctx->stream == stream) &&
-			(pipe_ctx->ipp != NULL)) {
-			struct input_pixel_processor *ipp = pipe_ctx->ipp;
+		if (pipe_ctx->stream != stream || !pipe_ctx->ipp)
+			continue;
+		if (pipe_ctx->top_pipe && pipe_ctx->surface != pipe_ctx->top_pipe->surface)
+			continue;
 
-			if (ipp->funcs->ipp_cursor_set_attributes(
-				ipp, attributes))
-				ret = true;
-		}
+		pipe_ctx->ipp->funcs->ipp_cursor_set_attributes(
+				pipe_ctx->ipp, attributes);
 	}
 
-	return ret;
+	return true;
 }
 
 bool dc_stream_set_cursor_position(
 	const struct dc_stream *dc_stream,
-	struct dc_cursor_position *position)
+	const struct dc_cursor_position *position)
 {
 	int i;
 	struct core_stream *stream;
 	struct core_dc *core_dc;
 	struct resource_context *res_ctx;
-	bool ret = false;
 
 	if (NULL == dc_stream) {
 		dm_error("DC: dc_stream is NULL!\n");
@@ -239,27 +236,27 @@ bool dc_stream_set_cursor_position(
 
 	for (i = 0; i < MAX_PIPES; i++) {
 		struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
+		struct input_pixel_processor *ipp = pipe_ctx->ipp;
+		struct dc_cursor_position pos_cpy = *position;
+		struct dc_cursor_mi_param param = {
+			.pixel_clk_khz = dc_stream->timing.pix_clk_khz,
+			.ref_clk_khz = res_ctx->pool->ref_clock_inKhz,
+			.viewport_x_start = pipe_ctx->scl_data.viewport.x,
+			.viewport_width = pipe_ctx->scl_data.viewport.width,
+			.h_scale_ratio = pipe_ctx->scl_data.ratios.horz
+		};
+
+		if (pipe_ctx->stream != stream ||
+				!pipe_ctx->ipp || !pipe_ctx->surface)
+			continue;
 
-		if (pipe_ctx->stream == stream &&
-				pipe_ctx->ipp && pipe_ctx->surface) {
-			struct input_pixel_processor *ipp = pipe_ctx->ipp;
-			struct dc_cursor_mi_param param = {
-				.pixel_clk_khz = dc_stream->timing.pix_clk_khz,
-				.ref_clk_khz = res_ctx->pool->ref_clock_inKhz,
-				.viewport_x_start = pipe_ctx->scl_data.viewport.x,
-				.viewport_width = pipe_ctx->scl_data.viewport.width,
-				.h_scale_ratio = pipe_ctx->scl_data.ratios.horz,
-			};
-
-			if (pipe_ctx->top_pipe && pipe_ctx->surface != pipe_ctx->top_pipe->surface)
-				position->enable = false;
-
-			ipp->funcs->ipp_cursor_set_position(ipp, position, &param);
-			ret = true;
-		}
+		if (pipe_ctx->top_pipe && pipe_ctx->surface != pipe_ctx->top_pipe->surface)
+			pos_cpy.enable = false;
+
+		ipp->funcs->ipp_cursor_set_position(ipp, &pos_cpy, &param);
 	}
 
-	return ret;
+	return true;
 }
 
 uint32_t dc_stream_get_vblank_counter(const struct dc_stream *dc_stream)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
index d35fa01024f8..5629e3ca6336 100644
@@ -764,7 +764,7 @@ bool dc_stream_set_cursor_attributes(
 
 bool dc_stream_set_cursor_position(
 	const struct dc_stream *stream,
-	struct dc_cursor_position *position);
+	const struct dc_cursor_position *position);
 
 /* Newer interfaces  */
 struct dc_cursor {
drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h +1 -1
index a374ef2c9d0b..434fe2f5a9d7 100644
@@ -54,7 +54,7 @@ void dce110_ipp_cursor_set_position(
 	const struct dc_cursor_position *position,
 	const struct dc_cursor_mi_param *param);
 
-bool dce110_ipp_cursor_set_attributes(
+void dce110_ipp_cursor_set_attributes(
 	struct input_pixel_processor *ipp,
 	const struct dc_cursor_attributes *attributes);
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp_cursor.c +1 -3
index 5b230b17fc5c..f712916563b9 100644
@@ -95,7 +95,7 @@ void dce110_ipp_cursor_set_position(
 	lock(ipp110, false);
 }
 
-bool dce110_ipp_cursor_set_attributes(
+void dce110_ipp_cursor_set_attributes(
 	struct input_pixel_processor *ipp,
 	const struct dc_cursor_attributes *attributes)
 {
@@ -122,8 +122,6 @@ bool dce110_ipp_cursor_set_attributes(
 
 	/* Unlock Cursor registers. */
 	lock(ipp110, false);
-
-	return true;
 }
 
 static void enable(
drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.h +1 -1
index 4b326bcb4600..7f645fde7064 100644
@@ -42,7 +42,7 @@ void dce120_ipp_cursor_set_position(
 	const struct dc_cursor_position *position,
 	const struct dc_cursor_mi_param *param);
 
-bool dce120_ipp_cursor_set_attributes(
+void dce120_ipp_cursor_set_attributes(
 	struct input_pixel_processor *ipp,
 	const struct dc_cursor_attributes *attributes);
 
drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp_cursor.c +1 -3
index 15671fd2cb9c..dc81d320f6e5 100644
@@ -160,7 +160,7 @@ void dce120_ipp_cursor_set_position(
 	lock(ipp110, false);
 }
 
-bool dce120_ipp_cursor_set_attributes(
+void dce120_ipp_cursor_set_attributes(
 	struct input_pixel_processor *ipp,
 	const struct dc_cursor_attributes *attributes)
 {
@@ -189,7 +189,5 @@ bool dce120_ipp_cursor_set_attributes(
 
 	/* Unlock Cursor registers. */
 	lock(ipp110, false);
-
-	return true;
 }
 
drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h +1 -3
index 0457bc7a44d4..7928e230eefb 100644
@@ -37,8 +37,6 @@ struct input_pixel_processor {
 	struct  dc_context *ctx;
 	unsigned int inst;
 	const struct ipp_funcs *funcs;
-
-	unsigned int cusor_width;
 };
 
 enum ipp_prescale_mode {
@@ -88,7 +86,7 @@ struct ipp_funcs {
 		const struct dc_cursor_position *position,
 		const struct dc_cursor_mi_param *param);
 
-	bool (*ipp_cursor_set_attributes)(
+	void (*ipp_cursor_set_attributes)(
 		struct input_pixel_processor *ipp,
 		const struct dc_cursor_attributes *attributes);
 
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/28 drm/amd/display: Make dc_link param const in set_drive_settings

In reply to a message not in the archive

From: Zeyu Fan <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c | 2 +-
 drivers/gpu/drm/amd/display/dc/dc.h              | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -1
index 953e201dc6bc..17286465e850 100644
@@ -605,7 +605,7 @@ static bool is_max_vs_reached(
 }
 
 void dc_link_dp_set_drive_settings(
-	struct dc_link *link,
+	const struct dc_link *link,
 	struct link_training_settings *lt_settings)
 {
 	struct core_link *core_link = DC_LINK_TO_CORE(link);
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
index 5629e3ca6336..a2a9e4ed393c 100644
@@ -691,7 +691,7 @@ void dc_link_remove_remote_sink(
 void dc_link_set_sink(const struct dc_link *link, struct dc_sink *sink);
 
 void dc_link_dp_set_drive_settings(
-	struct dc_link *link,
+	const struct dc_link *link,
 	struct link_training_settings *lt_settings);
 
 bool dc_link_dp_perform_link_training(
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/28 drm/amd/display: PSR Refactor

In reply to a message not in the archive

From: Sylvia Tsai <[email protected]>

- Refacotr PSR to follow correct module pattern
- fix eDP only working on sink index 0.

---
 drivers/gpu/drm/amd/display/dc/core/dc.c           | 74 +++++++++-------------
 drivers/gpu/drm/amd/display/dc/core/dc_link.c      | 22 +++----
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c   | 53 +---------------
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  |  2 +-
 drivers/gpu/drm/amd/display/dc/dc.h                | 17 +++--
 drivers/gpu/drm/amd/display/dc/dc_types.h          | 24 +++----
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    | 18 +++++-
 .../display/dc/dce110/dce110_timing_generator.c    | 16 -----
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |  1 +
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |  2 +-
 .../drm/amd/display/modules/freesync/freesync.c    | 14 +++-
 11 files changed, 93 insertions(+), 150 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +29 -45
index 1dd9c736aedc..93c936d92f5a 100644
@@ -199,6 +199,32 @@ static bool set_gamut_remap(struct dc *dc,
 	return ret;
 }
 
+static void set_static_screen_events(struct dc *dc,
+		const struct dc_stream **stream,
+		int num_streams,
+		const struct dc_static_screen_events *events)
+{
+	struct core_dc *core_dc = DC_TO_CORE(dc);
+	int i = 0;
+	int j = 0;
+	struct pipe_ctx *pipes_affected[MAX_PIPES];
+	int num_pipes_affected = 0;
+
+	for (i = 0; i < num_streams; i++) {
+		struct core_stream *core_stream = DC_STREAM_TO_CORE(stream[i]);
+
+		for (j = 0; j < MAX_PIPES; j++) {
+			if (core_dc->current_context->res_ctx.pipe_ctx[j].stream
+					== core_stream) {
+				pipes_affected[num_pipes_affected++] =
+						&core_dc->current_context->res_ctx.pipe_ctx[j];
+			}
+		}
+	}
+
+	core_dc->hwss.set_static_screen_control(pipes_affected, num_pipes_affected, events);
+}
+
 /* This function is not expected to fail, proper implementation of
  * validation will prevent this from ever being called for unsupported
  * configurations.
@@ -240,45 +266,6 @@ static void stream_update_scaling(
 	}
 }
 
-static bool set_psr_enable(struct dc *dc, bool enable)
-{
-	struct core_dc *core_dc = DC_TO_CORE(dc);
-	int i;
-
-	for (i = 0; i < core_dc->link_count; i++)
-		dc_link_set_psr_enable(&core_dc->links[i]->public,
-				enable);
-
-	return true;
-}
-
-
-static bool setup_psr(struct dc *dc, const struct dc_stream *stream)
-{
-	struct core_dc *core_dc = DC_TO_CORE(dc);
-	struct core_stream *core_stream = DC_STREAM_TO_CORE(stream);
-	struct pipe_ctx *pipes;
-	int i;
-	unsigned int underlay_idx = core_dc->res_pool->underlay_pipe_index;
-
-	for (i = 0; i < core_dc->link_count; i++) {
-		if (core_stream->sink->link == core_dc->links[i])
-			dc_link_setup_psr(&core_dc->links[i]->public,
-					stream);
-	}
-
-	for (i = 0; i < MAX_PIPES; i++) {
-		if (core_dc->current_context->res_ctx.pipe_ctx[i].stream
-				== core_stream && i != underlay_idx) {
-			pipes = &core_dc->current_context->res_ctx.pipe_ctx[i];
-			core_dc->hwss.set_static_screen_control(&pipes, 1,
-					0x182);
-		}
-	}
-
-	return true;
-}
-
 static void set_drive_settings(struct dc *dc,
 		struct link_training_settings *lt_settings,
 		const struct dc_link *link)
@@ -359,15 +346,12 @@ static void allocate_dc_stream_funcs(struct core_dc *core_dc)
 				stream_adjust_vmin_vmax;
 	}
 
+	core_dc->public.stream_funcs.set_static_screen_events =
+			set_static_screen_events;
+
 	core_dc->public.stream_funcs.set_gamut_remap =
 			set_gamut_remap;
 
-	core_dc->public.stream_funcs.set_psr_enable =
-			set_psr_enable;
-
-	core_dc->public.stream_funcs.setup_psr =
-			setup_psr;
-
 	core_dc->public.link_funcs.set_drive_settings =
 			set_drive_settings;
 
drivers/gpu/drm/amd/display/dc/core/dc_link.c +10 -12
index 426f7f8187a6..6f78403e2d64 100644
@@ -1430,14 +1430,14 @@ bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable)
 	struct core_dc *core_dc = DC_TO_CORE(ctx->dc);
 	struct dmcu *dmcu = core_dc->res_pool->dmcu;
 
-	if (dmcu != NULL && dc_link->psr_caps.psr_version > 0)
+	if (dmcu != NULL && link->psr_enabled)
 		dmcu->funcs->set_psr_enable(dmcu, enable);
 
 	return true;
 }
 
 bool dc_link_setup_psr(const struct dc_link *dc_link,
-		const struct dc_stream *stream)
+		const struct dc_stream *stream, struct psr_config *psr_config)
 {
 	struct core_link *link = DC_LINK_TO_CORE(dc_link);
 	struct dc_context *ctx = link->ctx;
@@ -1449,10 +1449,8 @@ bool dc_link_setup_psr(const struct dc_link *dc_link,
 
 	psr_context.controllerId = CONTROLLER_ID_UNDEFINED;
 
-
 	if (dc_link != NULL &&
-		dmcu != NULL &&
-		dc_link->psr_caps.psr_version > 0) {
+		dmcu != NULL) {
 		/* updateSinkPsrDpcdConfig*/
 		union dpcd_psr_configuration psr_configuration;
 
@@ -1461,10 +1459,10 @@ bool dc_link_setup_psr(const struct dc_link *dc_link,
 		psr_configuration.bits.ENABLE                    = 1;
 		psr_configuration.bits.CRC_VERIFICATION          = 1;
 		psr_configuration.bits.FRAME_CAPTURE_INDICATION  =
-			dc_link->psr_caps.psr_frame_capture_indication_req;
+				psr_config->psr_frame_capture_indication_req;
 
 		/* Check for PSR v2*/
-		if (dc_link->psr_caps.psr_version == 0x2) {
+		if (psr_config->psr_version == 0x2) {
 			/* For PSR v2 selective update.
 			 * Indicates whether sink should start capturing
 			 * immediately following active scan line,
@@ -1512,14 +1510,13 @@ bool dc_link_setup_psr(const struct dc_link *dc_link,
 						stream->timing.v_total),
 						stream->timing.h_total);
 
-		psr_context.psrSupportedDisplayConfig =
-			(dc_link->psr_caps.psr_version > 0) ? true : false;
+		psr_context.psrSupportedDisplayConfig = true;
 		psr_context.psrExitLinkTrainingRequired =
-			dc_link->psr_caps.psr_exit_link_training_required;
+			psr_config->psr_exit_link_training_required;
 		psr_context.sdpTransmitLineNumDeadline =
-			dc_link->psr_caps.psr_sdp_transmit_line_num_deadline;
+			psr_config->psr_sdp_transmit_line_num_deadline;
 		psr_context.psrFrameCaptureIndicationReq =
-			dc_link->psr_caps.psr_frame_capture_indication_req;
+			psr_config->psr_frame_capture_indication_req;
 
 		psr_context.skipPsrWaitForPllLock = 0; /* only = 1 in KV */
 
@@ -1550,6 +1547,7 @@ bool dc_link_setup_psr(const struct dc_link *dc_link,
 		 */
 		psr_context.frame_delay = 0;
 
+		link->psr_enabled = true;
 		dmcu->funcs->setup_psr(dmcu, link, &psr_context);
 		return true;
 	} else
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -52

82 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_resource.c +1 -1
index 2e12a0ba5ddf..cdb98d5f7caa 100644
@@ -2015,7 +2015,7 @@ static void set_vsc_info_packet(
 	unsigned int vscPacketRevision = 0;
 	unsigned int i;
 
-	if (stream->sink->link->public.psr_caps.psr_version != 0) {
+	if (stream->sink->link->psr_enabled) {
 		vscPacketRevision = 2;
 	}
 
drivers/gpu/drm/amd/display/dc/dc.h +13 -4
index a2a9e4ed393c..d12aa726164e 100644
@@ -82,6 +82,12 @@ struct dc_surface_dcc_cap {
 	};
 };
 
+struct dc_static_screen_events {
+	bool cursor_update;
+	bool surface_update;
+	bool overlay_update;
+};
+
 /* Forward declaration*/
 struct dc;
 struct dc_surface;
@@ -102,10 +108,14 @@ struct dc_stream_funcs {
 			const struct dc_stream *dc_stream,
 			const struct rect *src,
 			const struct rect *dst);
+
 	bool (*set_gamut_remap)(struct dc *dc,
 			const struct dc_stream **stream, int num_streams);
-	bool (*set_psr_enable)(struct dc *dc, bool enable);
-	bool (*setup_psr)(struct dc *dc, const struct dc_stream *stream);
+
+	void (*set_static_screen_events)(struct dc *dc,
+			const struct dc_stream **stream,
+			int num_streams,
+			const struct dc_static_screen_events *events);
 };
 
 struct link_training_settings;
@@ -604,7 +614,6 @@ struct dc_link {
 	uint8_t ddc_hw_inst;
 	uint8_t link_enc_hw_inst;
 
-	struct psr_caps psr_caps;
 	bool test_pattern_enabled;
 	union compliance_test_state compliance_test_state;
 
@@ -657,7 +666,7 @@ bool dc_link_set_backlight_level(const struct dc_link *dc_link, uint32_t level,
 bool dc_link_set_psr_enable(const struct dc_link *dc_link, bool enable);
 
 bool dc_link_setup_psr(const struct dc_link *dc_link,
-		const struct dc_stream *stream);
+		const struct dc_stream *stream, struct psr_config *psr_config);
 
 /* Request DC to detect if there is a Panel connected.
  * boot - If this call is during initial boot.
drivers/gpu/drm/amd/display/dc/dc_types.h +9 -15
index 2ba02b50bc18..d2f3b9fd7a30 100644
@@ -484,6 +484,15 @@ struct freesync_context {
 	unsigned int nominal_refresh_in_micro_hz;
 };
 
+struct psr_config {
+	unsigned char psr_version;
+	unsigned int psr_rfb_setup_time;
+	bool psr_exit_link_training_required;
+
+	bool psr_frame_capture_indication_req;
+	unsigned int psr_sdp_transmit_line_num_deadline;
+};
+
 struct colorspace_transform {
 	struct fixed31_32 matrix[12];
 	bool enable_remap;
@@ -494,21 +503,6 @@ struct csc_transform {
 	bool enable_adjustment;
 };
 
-struct psr_caps {
-	/* These parameters are from PSR capabilities reported by Sink DPCD */
-	unsigned char psr_version;
-	unsigned int psr_rfb_setup_time;
-	bool psr_exit_link_training_required;
-
-	/* These parameters are calculated in Driver,
-	 * based on display timing and Sink capabilities.
-	 * If VBLANK region is too small and Sink takes a long time
-	 * to set up RFB, it may take an extra frame to enter PSR state.
-	 */
-	bool psr_frame_capture_indication_req;
-	unsigned int psr_sdp_transmit_line_num_deadline;
-};
-
 enum i2c_mot_mode {
 	I2C_MOT_UNDEF,
 	I2C_MOT_TRUE,
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +17 -1
index 6b249f5bf1da..6a93c96b9b26 100644
@@ -1005,6 +1005,10 @@ static enum dc_status dce110_prog_pixclk_crtc_otg(
 				pipe_ctx->tg,
 				&stream->public.timing,
 				true);
+
+		pipe_ctx->tg->funcs->set_static_screen_control(
+				pipe_ctx->tg,
+				0x182);
 	}
 
 	if (!pipe_ctx_old->stream) {
@@ -1015,6 +1019,8 @@ static enum dc_status dce110_prog_pixclk_crtc_otg(
 		}
 	}
 
+
+
 	return DC_OK;
 }
 
@@ -1114,6 +1120,8 @@ static enum dc_status apply_single_controller_ctx_to_hw(
 					stream->public.timing.pix_clk_khz,
 					context->stream_count);
 
+	pipe_ctx->stream->sink->link->psr_enabled = false;
+
 	return DC_OK;
 }
 
@@ -1355,9 +1363,17 @@ static void set_drr(struct pipe_ctx **pipe_ctx,
 }
 
 static void set_static_screen_control(struct pipe_ctx **pipe_ctx,
-		int num_pipes, int value)
+		int num_pipes, const struct dc_static_screen_events *events)
 {
 	unsigned int i;
+	unsigned int value = 0;
+
+	if (events->overlay_update)
+		value |= 0x100;
+	if (events->surface_update)
+		value |= 0x80;
+	if (events->cursor_update)
+		value |= 0x2;
 
 	for (i = 0; i < num_pipes; i++)
 		pipe_ctx[i]->tg->funcs->
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c +0 -16
index 7070aaf9e433..23760727f000 100644
@@ -371,7 +371,6 @@ void dce110_timing_generator_set_drr(
 	uint32_t v_total_min = 0;
 	uint32_t v_total_max = 0;
 	uint32_t v_total_cntl = 0;
-	uint32_t static_screen_cntl = 0;
 	struct dce110_timing_generator *tg110 = DCE110TG_FROM_TG(tg);
 
 	uint32_t addr = 0;
@@ -385,9 +384,6 @@ void dce110_timing_generator_set_drr(
 	addr = CRTC_REG(mmCRTC_V_TOTAL_CONTROL);
 	v_total_cntl = dm_read_reg(tg->ctx, addr);
 
-	addr = CRTC_REG(mmCRTC_STATIC_SCREEN_CONTROL);
-	static_screen_cntl = dm_read_reg(tg->ctx, addr);
-
 	if (params != NULL &&
 		params->vertical_total_max > 0 &&
 		params->vertical_total_min > 0) {
@@ -430,20 +426,11 @@ void dce110_timing_generator_set_drr(
 				0,
 				CRTC_V_TOTAL_CONTROL,
 				CRTC_SET_V_TOTAL_MIN_MASK);
-
-		set_reg_field_value(static_screen_cntl,
-				0x180,
-			CRTC_STATIC_SCREEN_CONTROL,
-			CRTC_STATIC_SCREEN_EVENT_MASK);
 	} else {
 		set_reg_field_value(v_total_cntl,
 			0,
 			CRTC_V_TOTAL_CONTROL,
 			CRTC_SET_V_TOTAL_MIN_MASK);
-		set_reg_field_value(static_screen_cntl,
-			0,
-			CRTC_STATIC_SCREEN_CONTROL,
-			CRTC_STATIC_SCREEN_EVENT_MASK);
 		set_reg_field_value(v_total_min,
 				0,
 				CRTC_V_TOTAL_MIN,
@@ -478,9 +465,6 @@ void dce110_timing_generator_set_drr(
 
 	addr = CRTC_REG(mmCRTC_V_TOTAL_CONTROL);
 	dm_write_reg(tg->ctx, addr, v_total_cntl);
-
-	addr = CRTC_REG(mmCRTC_STATIC_SCREEN_CONTROL);
-	dm_write_reg(tg->ctx, addr, static_screen_cntl);
 }
 
 void dce110_timing_generator_set_static_screen_control(
drivers/gpu/drm/amd/display/dc/inc/core_types.h +1 -0
index 405608318ccc..2b43e18c65f5 100644
@@ -156,6 +156,7 @@ struct core_link {
 	unsigned int dpcd_sink_count;
 
 	enum edp_revision edp_revision;
+	bool psr_enabled;
 
 	/* MST record stream using this link */
 	struct link_flags {
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +1 -1
index 9bfaaad09bea..b42e4a0ef18a 100644
@@ -132,7 +132,7 @@ struct hw_sequencer_funcs {
 			int vmin, int vmax);
 
 	void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx,
-			int num_pipes, int value);
+			int num_pipes, const struct dc_static_screen_events *events);
 
 	enum dc_status (*prog_pixclk_crtc_otg)(
 			struct pipe_ctx *pipe_ctx,
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +11 -3
index 5c6de723da5d..78b4f28d862c 100644
@@ -264,10 +264,10 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
 					enable_for_video = false;
 		}
 
-		temp = core_stream->public.timing.pix_clk_khz;
+		temp = stream->timing.pix_clk_khz;
 		temp *= 1000ULL * 1000ULL * 1000ULL;
-		temp = div_u64(temp, core_stream->public.timing.h_total);
-		temp = div_u64(temp, core_stream->public.timing.v_total);
+		temp = div_u64(temp, stream->timing.h_total);
+		temp = div_u64(temp, stream->timing.v_total);
 
 		nom_refresh_rate_micro_hz = (unsigned int) temp;
 
@@ -657,6 +657,7 @@ void mod_freesync_handle_v_update(struct mod_freesync *mod_freesync,
 	unsigned int min_frame_duration_in_ns, vmax, vmin = 0;
 	struct freesync_state *state;
 	struct core_freesync *core_freesync = NULL;
+	struct dc_static_screen_events triggers = {0};
 
 	if (mod_freesync == NULL)
 		return;
@@ -749,6 +750,13 @@ void mod_freesync_handle_v_update(struct mod_freesync *mod_freesync,
 					core_freesync->dc, streams,
 					num_streams, v_total,
 					v_total);
+
+		triggers.overlay_update = true;
+		triggers.surface_update = true;
+
+		core_freesync->dc->stream_funcs.set_static_screen_events(
+					core_freesync->dc, streams,	num_streams,
+					&triggers);
 	}
 }
 
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/28 drm/amd/display: move tg_color to dc_hw_types

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h             | 12 ++++++------
 drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h | 12 ------------
 2 files changed, 6 insertions(+), 18 deletions(-)
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +6 -6
index b785dd7b3a97..64d43dba8fd6 100644
@@ -641,12 +641,12 @@ struct dc_crtc_timing {
 	struct dc_crtc_timing_flags flags;
 };
 
-struct _dlg_otg_param {
-	int vstartup_start;
-	int vupdate_offset;
-	int vupdate_width;
-	int vready_offset;
-	enum signal_type signal;
+#define MAX_TG_COLOR_VALUE 0x3FF
+struct tg_color {
+	/* Maximum 10 bits color value */
+	uint16_t color_r_cr;
+	uint16_t color_g_y;
+	uint16_t color_b_cb;
 };
 
 #endif /* DC_HW_TYPES_H */
drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h +0 -12
index b3deaf2d8173..235cfe8d1ad4 100644
@@ -28,18 +28,6 @@
 
 struct dc_bios;
 
-/**
- *  These parameters are required as input when doing blanking/Unblanking
-*/
-#define MAX_TG_COLOR_VALUE 0x3FF
-
-struct tg_color {
-	/* Maximum 10 bits color value */
-	uint16_t color_r_cr;
-	uint16_t color_g_y;
-	uint16_t color_b_cb;
-};
-
 /* Contains CRTC vertical/horizontal pixel counters */
 struct crtc_position {
 	uint32_t vertical_count;
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/28 drm/amd/display: clarify delay param for REG_WAIT

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/inc/reg_helper.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/inc/reg_helper.h +2 -2
index b595b94d2b69..96fba1fb7697 100644
@@ -185,10 +185,10 @@
 
 /* macro to poll and wait for a register field to read back given value */
 
-#define REG_WAIT(reg_name, field, val, delay, max_try)	\
+#define REG_WAIT(reg_name, field, val, delay_between_poll_us, max_try)	\
 		generic_reg_wait(CTX, \
 				REG(reg_name), FN(reg_name, field), val,\
-				delay, max_try, __func__)
+				delay_between_poll_us, max_try, __func__)
 
 /* macro to update (read, modify, write) register fields
  */
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/28 drm/amd/display: dce120 to dce ipp refactor

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/dce/Makefile        |   2 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_ipp.c       | 252 +++++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/dce/dce_ipp.h       | 226 ++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/dce/dce_transform.h |   2 +-
 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h |   2 +-
 .../drm/amd/display/dc/dce110/dce110_ipp_gamma.c   |   4 +-
 drivers/gpu/drm/amd/display/dc/dce120/Makefile     |   1 -
 drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.c |  58 -----
 drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.h |  62 -----
 .../drm/amd/display/dc/dce120/dce120_ipp_cursor.c  | 193 ----------------
 .../drm/amd/display/dc/dce120/dce120_ipp_gamma.c   | 167 --------------
 .../drm/amd/display/dc/dce120/dce120_resource.c    |  69 +++---
 drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h  |   3 +
 drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h        |   5 +-
 14 files changed, 521 insertions(+), 525 deletions(-)
 create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_ipp.c
 create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dce_ipp.h
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.h
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp_cursor.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp_gamma.c
drivers/gpu/drm/amd/display/dc/dce/Makefile +1 -1
index 05562553b656..8abec0bed379 100644
@@ -7,7 +7,7 @@
 
 DCE = dce_audio.o dce_stream_encoder.o dce_link_encoder.o dce_hwseq.o \
 dce_mem_input.o dce_clock_source.o dce_scl_filters.o dce_transform.o \
-dce_clocks.o dce_opp.o dce_dmcu.o dce_abm.o
+dce_clocks.o dce_opp.o dce_dmcu.o dce_abm.o dce_ipp.o
 
 
 AMD_DAL_DCE = $(addprefix $(AMDDALPATH)/dc/dce/,$(DCE))
drivers/gpu/drm/amd/display/dc/dce/dce_ipp.c new file +252 -0

252 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce/dce_ipp.h new file +226 -0

226 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce/dce_transform.h +1 -1
index da2a02434665..ca6c621151b2 100644
@@ -369,7 +369,7 @@ struct dce_transform {
 	bool prescaler_on;
 };
 
-bool dce_transform_construct(struct dce_transform *xfm110,
+bool dce_transform_construct(struct dce_transform *xfm_dce,
 	struct dc_context *ctx,
 	uint32_t inst,
 	const struct dce_transform_registers *regs,
drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h +1 -1
index 434fe2f5a9d7..8684e6a0ef4b 100644
@@ -59,7 +59,7 @@ void dce110_ipp_cursor_set_attributes(
 	const struct dc_cursor_attributes *attributes);
 
 /* DEGAMMA RELATED */
-bool dce110_ipp_set_degamma(
+void dce110_ipp_set_degamma(
 	struct input_pixel_processor *ipp,
 	enum ipp_degamma_mode mode);
 
drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp_gamma.c +1 -3
index f05cc9e981f3..0bcd8a68d5e5 100644
@@ -66,7 +66,7 @@
 
 
 
-bool dce110_ipp_set_degamma(
+void dce110_ipp_set_degamma(
 	struct input_pixel_processor *ipp,
 	enum ipp_degamma_mode mode)
 {
@@ -82,8 +82,6 @@ bool dce110_ipp_set_degamma(
 		GRPH_DEGAMMA_MODE, degamma_type,
 		CURSOR_DEGAMMA_MODE, degamma_type,
 		CURSOR2_DEGAMMA_MODE, degamma_type);
-
-	return true;
 }
 
 void dce110_ipp_program_prescale(
drivers/gpu/drm/amd/display/dc/dce120/Makefile +0 -1
index 3c6b3fa98ddc..826c12ee368c 100644
@@ -4,7 +4,6 @@
 
 
 DCE120 = dce120_resource.o dce120_timing_generator.o \
-dce120_ipp.o dce120_ipp_cursor.o dce120_ipp_gamma.o \
 dce120_mem_input.o dce120_hw_sequencer.o
 
 AMD_DAL_DCE120 = $(addprefix $(AMDDALPATH)/dc/dce120/,$(DCE120))
drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.c deleted +0 -58

58 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp.h deleted +0 -62

62 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp_cursor.c deleted +0 -193

193 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce120/dce120_ipp_gamma.c deleted +0 -167

167 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +33 -36

109 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/inc/hw/hw_shared.h +3 -0
index dfe590198a33..907e0a9a8474 100644
@@ -26,6 +26,9 @@
 #ifndef __DAL_HW_SHARED_H__
 #define __DAL_HW_SHARED_H__
 
+#include "os_types.h"
+#include "fixed31_32.h"
+
 /******************************************************************************
  * Data types shared between different Virtual HW blocks
  ******************************************************************************/
drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h +3 -2
index 7928e230eefb..2f3dc2e7f17a 100644
@@ -1,5 +1,5 @@
 /*
- * Copyright 2015 Advanced Micro Devices, Inc.
+ * Copyright 2017 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"),
@@ -27,6 +27,7 @@
 #define __DAL_IPP_H__
 
 #include "hw_shared.h"
+#include "dc_hw_types.h"
 
 #define MAXTRIX_COEFFICIENTS_NUMBER 12
 #define MAXTRIX_COEFFICIENTS_WRAP_NUMBER (MAXTRIX_COEFFICIENTS_NUMBER + 4)
@@ -113,7 +114,7 @@ struct ipp_funcs {
 			const struct dc_gamma *gamma);
 
 	/*** DEGAMMA RELATED ***/
-	bool (*ipp_set_degamma)(
+	void (*ipp_set_degamma)(
 		struct input_pixel_processor *ipp,
 		enum ipp_degamma_mode mode);
 
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/28 drm/amd/display: dce80, 100, 110 and 112 to dce ipp refactor

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/dce/dce_ipp.c       |  12 +-
 drivers/gpu/drm/amd/display/dc/dce/dce_ipp.h       |  24 +-
 .../drm/amd/display/dc/dce100/dce100_resource.c    |  73 +++---
 drivers/gpu/drm/amd/display/dc/dce110/Makefile     |   4 +-
 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.c |  63 ------
 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h |  74 ------
 .../drm/amd/display/dc/dce110/dce110_ipp_cursor.c  | 249 ---------------------
 .../drm/amd/display/dc/dce110/dce110_ipp_gamma.c   | 159 -------------
 .../drm/amd/display/dc/dce110/dce110_resource.c    |  70 +++---
 .../drm/amd/display/dc/dce112/dce112_resource.c    |  81 +++----
 .../drm/amd/display/dc/dce120/dce120_resource.c    |  14 +-
 drivers/gpu/drm/amd/display/dc/dce80/Makefile      |   2 +-
 drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.c   |  65 ------
 drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.h   |  45 ----
 .../gpu/drm/amd/display/dc/dce80/dce80_resource.c  |  84 ++++---
 15 files changed, 171 insertions(+), 848 deletions(-)
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp_cursor.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp_gamma.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.c
 delete mode 100644 drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.h
drivers/gpu/drm/amd/display/dc/dce/dce_ipp.c +10 -2
index d6bf6067a309..9e8f0a3593a2 100644
@@ -174,7 +174,8 @@ static void dce_ipp_program_input_lut(
 	struct dce_ipp *ipp_dce = TO_DCE_IPP(ipp);
 
 	/* power on LUT memory */
-	REG_SET(DCFE_MEM_PWR_CTRL, 0, DCP_LUT_MEM_PWR_DIS, 1);
+	if (REG(DCFE_MEM_PWR_CTRL))
+		REG_SET(DCFE_MEM_PWR_CTRL, 0, DCP_LUT_MEM_PWR_DIS, 1);
 
 	/* enable all */
 	REG_SET(DC_LUT_WRITE_EN_MASK, 0, DC_LUT_WRITE_EN_MASK, 0x7);
@@ -199,7 +200,8 @@ static void dce_ipp_program_input_lut(
 	}
 
 	/* power off LUT memory */
-	REG_SET(DCFE_MEM_PWR_CTRL, 0, DCP_LUT_MEM_PWR_DIS, 0);
+	if (REG(DCFE_MEM_PWR_CTRL))
+		REG_SET(DCFE_MEM_PWR_CTRL, 0, DCP_LUT_MEM_PWR_DIS, 0);
 
 	/* bypass prescale, enable legacy LUT */
 	REG_UPDATE(PRESCALE_GRPH_CONTROL, GRPH_PRESCALE_BYPASS, 1);
@@ -250,3 +252,9 @@ void dce_ipp_construct(
 	ipp_dce->ipp_shift = ipp_shift;
 	ipp_dce->ipp_mask = ipp_mask;
 }
+
+void dce_ipp_destroy(struct input_pixel_processor **ipp)
+{
+	dm_free(TO_DCE_IPP(*ipp));
+	*ipp = NULL;
+}
drivers/gpu/drm/amd/display/dc/dce/dce_ipp.h +18 -6
index 23f25b1b0e64..ca04e97d44c3 100644
@@ -23,8 +23,8 @@
  *
  */
 
-#ifndef _DCE_DCE_IPP_H_
-#define _DCE_DCE_IPP_H_
+#ifndef _DCE_IPP_H_
+#define _DCE_IPP_H_
 
 #include "ipp.h"
 
@@ -46,7 +46,6 @@
 	SRI(PRESCALE_VALUES_GRPH_G, DCP, id), \
 	SRI(PRESCALE_VALUES_GRPH_B, DCP, id), \
 	SRI(INPUT_GAMMA_CONTROL, DCP, id), \
-	SRI(DCFE_MEM_PWR_CTRL, DCFE, id), \
 	SRI(DC_LUT_WRITE_EN_MASK, DCP, id), \
 	SRI(DC_LUT_RW_MODE, DCP, id), \
 	SRI(DC_LUT_CONTROL, DCP, id), \
@@ -54,6 +53,14 @@
 	SRI(DC_LUT_SEQ_COLOR, DCP, id), \
 	SRI(DEGAMMA_CONTROL, DCP, id)
 
+#define IPP_DCE100_REG_LIST_DCE_BASE(id) \
+	IPP_COMMON_REG_LIST_DCE_BASE(id), \
+	SRI(DCFE_MEM_PWR_CTRL, CRTC, id)
+
+#define IPP_DCE110_REG_LIST_DCE_BASE(id) \
+	IPP_COMMON_REG_LIST_DCE_BASE(id), \
+	SRI(DCFE_MEM_PWR_CTRL, DCFE, id)
+
 #define IPP_SF(reg_name, field_name, post_fix)\
 	.field_name = reg_name ## __ ## field_name ## post_fix
 
@@ -85,7 +92,6 @@
 	IPP_SF(PRESCALE_VALUES_GRPH_B, GRPH_PRESCALE_SCALE_B, mask_sh), \
 	IPP_SF(PRESCALE_VALUES_GRPH_B, GRPH_PRESCALE_BIAS_B, mask_sh), \
 	IPP_SF(INPUT_GAMMA_CONTROL, GRPH_INPUT_GAMMA_MODE, mask_sh), \
-	IPP_SF(DCFE_MEM_PWR_CTRL, DCP_LUT_MEM_PWR_DIS, mask_sh), \
 	IPP_SF(DC_LUT_WRITE_EN_MASK, DC_LUT_WRITE_EN_MASK, mask_sh), \
 	IPP_SF(DC_LUT_RW_MODE, DC_LUT_RW_MODE, mask_sh), \
 	IPP_SF(DC_LUT_CONTROL, DC_LUT_DATA_R_FORMAT, mask_sh), \
@@ -97,7 +103,11 @@
 	IPP_SF(DEGAMMA_CONTROL, CURSOR_DEGAMMA_MODE, mask_sh), \
 	IPP_SF(DEGAMMA_CONTROL, CURSOR2_DEGAMMA_MODE, mask_sh)
 
-#define IPP_COMMON_MASK_SH_LIST_SOC_BASE(mask_sh) \
+#define IPP_DCE100_MASK_SH_LIST_DCE_COMMON_BASE(mask_sh) \
+	IPP_COMMON_MASK_SH_LIST_DCE_COMMON_BASE(mask_sh), \
+	IPP_SF(DCFE_MEM_PWR_CTRL, DCP_LUT_MEM_PWR_DIS, mask_sh)
+
+#define IPP_DCE120_MASK_SH_LIST_SOC_BASE(mask_sh) \
 	IPP_SF(DCP0_CUR_UPDATE, CURSOR_UPDATE_LOCK, mask_sh), \
 	IPP_SF(DCP0_CUR_CONTROL, CURSOR_EN, mask_sh), \
 	IPP_SF(DCP0_CUR_CONTROL, CURSOR_MODE, mask_sh), \
@@ -223,4 +233,6 @@ void dce_ipp_construct(struct dce_ipp *ipp_dce,
 	const struct dce_ipp_shift *ipp_shift,
 	const struct dce_ipp_mask *ipp_mask);
 
-#endif /* _DCE_DCE_IPP_H_ */
+void dce_ipp_destroy(struct input_pixel_processor **ipp);
+
+#endif /* _DCE_IPP_H_ */
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +33 -40

113 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/Makefile +1 -3
index 9c42afcac325..c54bf0330701 100644
@@ -2,9 +2,7 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
-DCE110 = dce110_ipp.o dce110_ipp_cursor.o \
-dce110_ipp_gamma.o \
-dce110_timing_generator.o \
+DCE110 = dce110_timing_generator.o \
 dce110_compressor.o dce110_mem_input.o dce110_hw_sequencer.o \
 dce110_resource.o \
 dce110_opp_regamma_v.o dce110_opp_csc_v.o dce110_timing_generator_v.o \
drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.c deleted +0 -63

63 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp.h deleted +0 -74

74 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp_cursor.c deleted +0 -249

249 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_ipp_gamma.c deleted +0 -159

159 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +30 -40

110 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +34 -47

121 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce120/dce120_resource.c +4 -10
index 207d07b29e81..b6bdd1d52922 100644
@@ -176,7 +176,7 @@ static const struct dce_abm_mask abm_mask = {
 
 #define ipp_regs(id)\
 [id] = {\
-		IPP_COMMON_REG_LIST_DCE_BASE(id)\
+		IPP_DCE110_REG_LIST_DCE_BASE(id)\
 }
 
 static const struct dce_ipp_registers ipp_regs[] = {
@@ -189,11 +189,11 @@ static const struct dce_ipp_registers ipp_regs[] = {
 };
 
 static const struct dce_ipp_shift ipp_shift = {
-		IPP_COMMON_MASK_SH_LIST_SOC_BASE(__SHIFT)
+		IPP_DCE120_MASK_SH_LIST_SOC_BASE(__SHIFT)
 };
 
 static const struct dce_ipp_mask ipp_mask = {
-		IPP_COMMON_MASK_SH_LIST_SOC_BASE(_MASK)
+		IPP_DCE120_MASK_SH_LIST_SOC_BASE(_MASK)
 };
 
 #define transform_regs(id)\
@@ -497,12 +497,6 @@ static struct timing_generator *dce120_timing_generator_create(
 	return NULL;
 }
 
-static void dce120_ipp_destroy(struct input_pixel_processor **ipp)
-{
-	dm_free(TO_DCE_IPP(*ipp));
-	*ipp = NULL;
-}
-
 static void dce120_transform_destroy(struct transform **xfm)
 {
 	dm_free(TO_DCE_TRANSFORM(*xfm));
@@ -521,7 +515,7 @@ static void destruct(struct dce110_resource_pool *pool)
 			dce120_transform_destroy(&pool->base.transforms[i]);
 
 		if (pool->base.ipps[i] != NULL)
-			dce120_ipp_destroy(&pool->base.ipps[i]);
+			dce_ipp_destroy(&pool->base.ipps[i]);
 
 		if (pool->base.mis[i] != NULL) {
 			dm_free(TO_DCE110_MEM_INPUT(pool->base.mis[i]));
drivers/gpu/drm/amd/display/dc/dce80/Makefile +1 -1
index 8d2c3dbfced1..1d54d5fa0fd2 100644
@@ -2,7 +2,7 @@
 # Makefile for the 'controller' sub-component of DAL.
 # It provides the control and status of HW CRTC block.
 
-DCE80 = dce80_ipp.o dce80_timing_generator.o \
+DCE80 = dce80_timing_generator.o \
 	dce80_compressor.o dce80_mem_input.o dce80_hw_sequencer.o \
 	dce80_resource.o
 
drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.c deleted +0 -65

65 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce80/dce80_ipp.h deleted +0 -45

45 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +40 -44

128 lines not on this page · raw message

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/28 drm/amd/display: no need for return value from ipp_program_degamma_pwl

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/inc/hw/ipp.h +1 -1
index 2f3dc2e7f17a..2d472d8ef555 100644
@@ -118,7 +118,7 @@ struct ipp_funcs {
 		struct input_pixel_processor *ipp,
 		enum ipp_degamma_mode mode);
 
-	bool (*ipp_program_degamma_pwl)(
+	void (*ipp_program_degamma_pwl)(
 		struct input_pixel_processor *ipp,
 		const struct pwl_params *params);
 
Signature · 6 lines
2.11.0

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

PATCH 18/28 drm/amd/display: FreeSync Auto Sweep Support

In reply to a message not in the archive

From: Eric Cook <[email protected]>

Implement core support to allow for FreeSync Auto Sweep to work

---
 drivers/gpu/drm/amd/display/dc/core/dc.c           |  28 +++
 drivers/gpu/drm/amd/display/dc/core/dc_debug.c     |   5 +-
 drivers/gpu/drm/amd/display/dc/dc.h                |   6 +
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  13 ++
 .../display/dc/dce110/dce110_timing_generator.c    |  61 +++---
 .../display/dc/dce110/dce110_timing_generator.h    |   9 +-
 .../display/dc/dce110/dce110_timing_generator_v.c  |  23 +--
 .../display/dc/dce120/dce120_timing_generator.c    |  73 ++++++-
 .../amd/display/dc/dce80/dce80_timing_generator.c  |   2 +-
 .../drm/amd/display/dc/inc/hw/timing_generator.h   |  10 +-
 drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h  |   3 +
 .../drm/amd/display/modules/freesync/freesync.c    | 227 ++++++++++++++++-----
 .../gpu/drm/amd/display/modules/inc/mod_freesync.h |  20 ++
 13 files changed, 357 insertions(+), 123 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +28 -0
index 93c936d92f5a..2e74faef68e7 100644
@@ -175,6 +175,31 @@ static bool stream_adjust_vmin_vmax(struct dc *dc,
 	return ret;
 }
 
+static bool stream_get_crtc_position(struct dc *dc,
+		const struct dc_stream **stream, int num_streams,
+		unsigned int *v_pos, unsigned int *nom_v_pos)
+{
+	/* TODO: Support multiple streams */
+	struct core_dc *core_dc = DC_TO_CORE(dc);
+	struct core_stream *core_stream = DC_STREAM_TO_CORE(stream[0]);
+	int i = 0;
+	bool ret = false;
+	struct crtc_position position;
+
+	for (i = 0; i < MAX_PIPES; i++) {
+		struct pipe_ctx *pipe =
+				&core_dc->current_context->res_ctx.pipe_ctx[i];
+
+		if (pipe->stream == core_stream && pipe->stream_enc) {
+			core_dc->hwss.get_position(&pipe, 1, &position);
+
+			*v_pos = position.vertical_count;
+			*nom_v_pos = position.nominal_vcount;
+			ret = true;
+		}
+	}
+	return ret;
+}
 
 static bool set_gamut_remap(struct dc *dc,
 			const struct dc_stream **stream, int num_streams)
@@ -349,6 +374,9 @@ static void allocate_dc_stream_funcs(struct core_dc *core_dc)
 	core_dc->public.stream_funcs.set_static_screen_events =
 			set_static_screen_events;
 
+	core_dc->public.stream_funcs.get_crtc_position =
+			stream_get_crtc_position;
+
 	core_dc->public.stream_funcs.set_gamut_remap =
 			set_gamut_remap;
 
drivers/gpu/drm/amd/display/dc/core/dc_debug.c +4 -1
index fb48b8909e7f..ee840e75ee1f 100644
@@ -287,6 +287,7 @@ void context_timing_trace(
 	struct core_dc *core_dc = DC_TO_CORE(dc);
 	struct dal_logger *logger =  core_dc->ctx->logger;
 	int h_pos[MAX_PIPES], v_pos[MAX_PIPES];
+	struct crtc_position position;
 
 	for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
 		struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
@@ -294,7 +295,9 @@ void context_timing_trace(
 		if (pipe_ctx->stream == NULL)
 			continue;
 
-		pipe_ctx->tg->funcs->get_position(pipe_ctx->tg, &h_pos[i], &v_pos[i]);
+		pipe_ctx->tg->funcs->get_position(pipe_ctx->tg, &position);
+		h_pos[i] = position.horizontal_count;
+		v_pos[i] = position.vertical_count;
 	}
 	for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
 		struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[i];
drivers/gpu/drm/amd/display/dc/dc.h +6 -0
index d12aa726164e..647c095e0ae9 100644
@@ -103,6 +103,12 @@ struct dc_stream_funcs {
 			int num_streams,
 			int vmin,
 			int vmax);
+	bool (*get_crtc_position)(struct dc *dc,
+			const struct dc_stream **stream,
+			int num_streams,
+			unsigned int *v_pos,
+			unsigned int *nom_v_pos);
+
 
 	void (*stream_update_scaling)(const struct dc *dc,
 			const struct dc_stream *dc_stream,
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +13 -0
index 6a93c96b9b26..0e69aceb0bad 100644
@@ -1362,6 +1362,18 @@ static void set_drr(struct pipe_ctx **pipe_ctx,
 	}
 }
 
+static void get_position(struct pipe_ctx **pipe_ctx,
+		int num_pipes,
+		struct crtc_position *position)
+{
+	int i = 0;
+
+	/* TODO: handle pipes > 1
+	 */
+	for (i = 0; i < num_pipes; i++)
+		pipe_ctx[i]->tg->funcs->get_position(pipe_ctx[i]->tg, position);
+}
+
 static void set_static_screen_control(struct pipe_ctx **pipe_ctx,
 		int num_pipes, const struct dc_static_screen_events *events)
 {
@@ -2486,6 +2498,7 @@ static const struct hw_sequencer_funcs dce110_funcs = {
 	.pipe_control_lock = dce_pipe_control_lock,
 	.set_bandwidth = dce110_set_bandwidth,
 	.set_drr = set_drr,
+	.get_position = get_position,
 	.set_static_screen_control = set_static_screen_control,
 	.reset_hw_ctx_wrap = reset_hw_ctx_wrap,
 	.prog_pixclk_crtc_otg = dce110_prog_pixclk_crtc_otg,
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.c +28 -33

120 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator.h +2 -7
index f14a4d91cd8e..a5d63c626ada 100644
@@ -151,11 +151,9 @@ void dce110_timing_generator_set_early_control(
 uint32_t dce110_timing_generator_get_vblank_counter(
 		struct timing_generator *tg);
 
-/* Get current H and V position */
-void dce110_timing_generator_get_crtc_positions(
+void dce110_timing_generator_get_position(
 	struct timing_generator *tg,
-	int32_t *h_position,
-	int32_t *v_position);
+	struct crtc_position *position);
 
 /* return true if TG counter is moving. false if TG is stopped */
 bool dce110_timing_generator_is_counter_moving(struct timing_generator *tg);
@@ -251,9 +249,6 @@ void dce110_tg_program_blank_color(struct timing_generator *tg,
 void dce110_tg_set_overscan_color(struct timing_generator *tg,
 	const struct tg_color *overscan_color);
 
-void dce110_tg_get_position(struct timing_generator *tg,
-	struct crtc_position *position);
-
 void dce110_tg_program_timing(struct timing_generator *tg,
 	const struct dc_crtc_timing *timing,
 	bool use_vbios);
drivers/gpu/drm/amd/display/dc/dce110/dce110_timing_generator_v.c +5 -18
index c95b69446ced..759c55bb4d15 100644
@@ -570,24 +570,11 @@ static void dce110_timing_generator_v_set_early_control(
 	dm_write_reg(tg->ctx, address, regval);
 }
 
-static void dce110_timing_generator_v_get_crtc_positions(
-	struct timing_generator *tg,
-	int32_t *h_position,
-	int32_t *v_position)
+static void dce110_timing_generator_get_underlay_position(struct timing_generator *tg,
+	struct crtc_position *position)
 {
-	uint32_t value;
-
-	value = dm_read_reg(tg->ctx, mmCRTCV_STATUS_POSITION);
-
-	*h_position = get_reg_field_value(
-			value,
-			CRTCV_STATUS_POSITION,
-			CRTC_HORZ_COUNT);
-
-	*v_position = get_reg_field_value(
-			value,
-			CRTCV_STATUS_POSITION,
-			CRTC_VERT_COUNT);
+	//Should never hit this case
+	ASSERT(false);
 }
 
 static uint32_t dce110_timing_generator_v_get_vblank_counter(struct timing_generator *tg)
@@ -665,7 +652,7 @@ static const struct timing_generator_funcs dce110_tg_v_funcs = {
 		.enable_crtc = dce110_timing_generator_v_enable_crtc,
 		.disable_crtc = dce110_timing_generator_v_disable_crtc,
 		.is_counter_moving = dce110_timing_generator_v_is_counter_moving,
-		.get_position = dce110_timing_generator_v_get_crtc_positions,
+		.get_position = dce110_timing_generator_get_underlay_position,
 		.get_frame_count = dce110_timing_generator_v_get_vblank_counter,
 		.set_early_control = dce110_timing_generator_v_set_early_control,
 		.wait_for_state = dce110_timing_generator_v_wait_for_state,
drivers/gpu/drm/amd/display/dc/dce120/dce120_timing_generator.c +64 -9

111 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce80/dce80_timing_generator.c +1 -1
index 1198f2fbf9c7..179a6d604838 100644
@@ -121,7 +121,7 @@ static const struct timing_generator_funcs dce80_tg_funcs = {
 		.enable_crtc = dce110_timing_generator_enable_crtc,
 		.disable_crtc = dce110_timing_generator_disable_crtc,
 		.is_counter_moving = dce110_timing_generator_is_counter_moving,
-		.get_position = dce110_timing_generator_get_crtc_positions,
+		.get_position = dce110_timing_generator_get_position,
 		.get_frame_count = dce110_timing_generator_get_vblank_counter,
 		.get_scanoutpos = dce110_timing_generator_get_crtc_scanoutpos,
 		.set_early_control = dce110_timing_generator_set_early_control,
drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h +5 -5
index 235cfe8d1ad4..2c4a9d02b3c1 100644
@@ -30,9 +30,9 @@ struct dc_bios;
 
 /* Contains CRTC vertical/horizontal pixel counters */
 struct crtc_position {
-	uint32_t vertical_count;
-	uint32_t horizontal_count;
-	uint32_t nominal_vcount;
+	int32_t vertical_count;
+	int32_t horizontal_count;
+	int32_t nominal_vcount;
 };
 
 struct dcp_gsl_params {
@@ -105,8 +105,8 @@ struct timing_generator_funcs {
 	bool (*disable_crtc)(struct timing_generator *tg);
 	bool (*is_counter_moving)(struct timing_generator *tg);
 	void (*get_position)(struct timing_generator *tg,
-								int32_t *h_position,
-								int32_t *v_position);
+				struct crtc_position *position);
+
 	uint32_t (*get_frame_count)(struct timing_generator *tg);
 	void (*get_scanoutpos)(
 		struct timing_generator *tg,
drivers/gpu/drm/amd/display/dc/inc/hw_sequencer.h +3 -0
index b42e4a0ef18a..afdb8605a30f 100644
@@ -131,6 +131,9 @@ struct hw_sequencer_funcs {
 	void (*set_drr)(struct pipe_ctx **pipe_ctx, int num_pipes,
 			int vmin, int vmax);
 
+	void (*get_position)(struct pipe_ctx **pipe_ctx, int num_pipes,
+			struct crtc_position *position);
+
 	void (*set_static_screen_control)(struct pipe_ctx **pipe_ctx,
 			int num_pipes, const struct dc_static_screen_events *events);
 
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +178 -49

298 lines not on this page · raw message

drivers/gpu/drm/amd/display/modules/inc/mod_freesync.h +20 -0
index 783ff2ef3bee..3947cc412ad7 100644
@@ -129,6 +129,26 @@ bool mod_freesync_get_user_enable(struct mod_freesync *mod_freesync,
 		const struct dc_stream *stream,
 		struct mod_freesync_user_enable *user_enable);
 
+bool mod_freesync_override_min_max(struct mod_freesync *mod_freesync,
+		const struct dc_stream *streams,
+		unsigned int min_refresh,
+		unsigned int max_refresh);
+
+bool mod_freesync_get_min_max(struct mod_freesync *mod_freesync,
+		const struct dc_stream *stream,
+		unsigned int *min_refresh,
+		unsigned int *max_refresh);
+
+bool mod_freesync_get_vmin_vmax(struct mod_freesync *mod_freesync,
+		const struct dc_stream *stream,
+		unsigned int *vmin,
+		unsigned int *vmax);
+
+bool mod_freesync_get_v_position(struct mod_freesync *mod_freesync,
+		const struct dc_stream *stream,
+		unsigned int *nom_v_pos,
+		unsigned int *v_pos);
+
 void mod_freesync_handle_v_update(struct mod_freesync *mod_freesync,
 		const struct dc_stream **streams, int num_streams);
 
Signature · 6 lines
2.11.0

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

PATCH 19/28 drm/amd/display: decouple resource_pool from resource_context

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

to avoid null access in case res_ctx is used to access res_pool before it's fully constructed

also make it clear which function has dependency on resource_pool

---
 drivers/gpu/drm/amd/display/dc/core/dc.c           |  19 ++-
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c   |   2 +-
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  | 143 ++++++++++++---------
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c    |   2 +-
 drivers/gpu/drm/amd/display/dc/core/dc_surface.c   |   3 +-
 .../amd/display/dc/dce100/dce100_hw_sequencer.c    |   4 +-
 .../drm/amd/display/dc/dce100/dce100_resource.c    |   8 +-
 .../amd/display/dc/dce110/dce110_hw_sequencer.c    |  42 +++---
 .../drm/amd/display/dc/dce110/dce110_resource.c    |  25 ++--
 .../drm/amd/display/dc/dce112/dce112_resource.c    |  35 +++--
 .../gpu/drm/amd/display/dc/dce80/dce80_resource.c  |   8 +-
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |   2 +-
 drivers/gpu/drm/amd/display/dc/inc/resource.h      |  15 ++-
 13 files changed, 161 insertions(+), 147 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +9 -10
index 2e74faef68e7..37986632f025 100644
@@ -736,7 +736,7 @@ static void program_timing_sync(
 {
 	int i, j;
 	int group_index = 0;
-	int pipe_count = ctx->res_ctx.pool->pipe_count;
+	int pipe_count = core_dc->res_pool->pipe_count;
 	struct pipe_ctx *unsynced_pipes[MAX_PIPES] = { NULL };
 
 	for (i = 0; i < pipe_count; i++) {
@@ -939,7 +939,7 @@ bool dc_post_update_surfaces_to_stream(struct dc *dc)
 
 	post_surface_trace(dc);
 
-	for (i = 0; i < context->res_ctx.pool->pipe_count; i++)
+	for (i = 0; i < core_dc->res_pool->pipe_count; i++)
 		if (context->res_ctx.pipe_ctx[i].stream == NULL) {
 			context->res_ctx.pipe_ctx[i].pipe_idx = i;
 			core_dc->hwss.power_down_front_end(
@@ -1015,7 +1015,7 @@ static bool is_surface_in_context(
 {
 	int j;
 
-	for (j = 0; j < context->res_ctx.pool->pipe_count; j++) {
+	for (j = 0; j < MAX_PIPES; j++) {
 		const struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
 
 		if (surface == &pipe_ctx->surface->public) {
@@ -1245,7 +1245,8 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 
 		/* add surface to context */
 		if (!resource_attach_surfaces_to_context(
-				new_surfaces, surface_count, dc_stream, context)) {
+				new_surfaces, surface_count, dc_stream,
+				context, core_dc->res_pool)) {
 			BREAK_TO_DEBUGGER();
 			goto fail;
 		}
@@ -1304,7 +1305,7 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 
 		/* not sure if we still need this */
 		if (update_type == UPDATE_TYPE_FULL) {
-			for (j = 0; j < context->res_ctx.pool->pipe_count; j++) {
+			for (j = 0; j < core_dc->res_pool->pipe_count; j++) {
 				struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
 
 				if (pipe_ctx->surface != surface)
@@ -1365,7 +1366,7 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 	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++) {
+		for (j = 0; j < core_dc->res_pool->pipe_count; j++) {
 			struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[j];
 
 			if (pipe_ctx->surface != surface)
@@ -1389,7 +1390,7 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 				context_timing_trace(dc, &context->res_ctx);
 		}
 
-		for (j = 0; j < context->res_ctx.pool->pipe_count; j++) {
+		for (j = 0; j < core_dc->res_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;
@@ -1427,7 +1428,7 @@ void dc_update_surfaces_and_stream(struct dc *dc,
 	}
 
 	/* Unlock pipes */
-	for (i = context->res_ctx.pool->pipe_count - 1; i >= 0; i--) {
+	for (i = core_dc->res_pool->pipe_count - 1; i >= 0; i--) {
 		struct pipe_ctx *pipe_ctx = &context->res_ctx.pipe_ctx[i];
 
 		for (j = 0; j < surface_count; j++) {
@@ -1571,8 +1572,6 @@ void dc_set_power_state(
 		memset(core_dc->current_context, 0,
 				sizeof(*core_dc->current_context));
 
-		core_dc->current_context->res_ctx.pool = core_dc->res_pool;
-
 		break;
 	}
 
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +1 -1
index f883fdb820c8..4b9d3f12406f 100644
@@ -2245,7 +2245,7 @@ static void set_crtc_test_pattern(struct core_link *link,
 	case DP_TEST_PATTERN_VIDEO_MODE:
 	{
 		/* restore bitdepth reduction */
-		link->dc->current_context->res_ctx.pool->funcs->
+		link->dc->res_pool->funcs->
 			build_bit_depth_reduction_params(pipe_ctx->stream,
 					&params);
 		pipe_ctx->stream->bit_depth_params = params;
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +80 -63

427 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/core/dc_stream.c +1 -1
index 23627b14c16c..99b6a1695f26 100644
@@ -240,7 +240,7 @@ bool dc_stream_set_cursor_position(
 		struct dc_cursor_position pos_cpy = *position;
 		struct dc_cursor_mi_param param = {
 			.pixel_clk_khz = dc_stream->timing.pix_clk_khz,
-			.ref_clk_khz = res_ctx->pool->ref_clock_inKhz,
+			.ref_clk_khz = core_dc->res_pool->ref_clock_inKhz,
 			.viewport_x_start = pipe_ctx->scl_data.viewport.x,
 			.viewport_width = pipe_ctx->scl_data.viewport.width,
 			.h_scale_ratio = pipe_ctx->scl_data.ratios.horz
drivers/gpu/drm/amd/display/dc/core/dc_surface.c +1 -2
index 943895faee49..aa6ac9596235 100644
@@ -138,8 +138,7 @@ const struct dc_surface_status *dc_surface_get_status(
 	if (core_dc->current_context == NULL)
 		return NULL;
 
-	for (i = 0; i < core_dc->current_context->res_ctx.pool->pipe_count;
-			i++) {
+	for (i = 0; i < core_dc->res_pool->pipe_count; i++) {
 		struct pipe_ctx *pipe_ctx =
 				&core_dc->current_context->res_ctx.pipe_ctx[i];
 
drivers/gpu/drm/amd/display/dc/dce100/dce100_hw_sequencer.c +2 -2
index dd6f0b1bd8ae..30c197f378dc 100644
@@ -132,8 +132,8 @@ void dce100_set_bandwidth(
 		bool decrease_allowed)
 {
 	if (decrease_allowed || context->dispclk_khz > dc->current_context->dispclk_khz) {
-		context->res_ctx.pool->display_clock->funcs->set_clock(
-				context->res_ctx.pool->display_clock,
+		dc->res_pool->display_clock->funcs->set_clock(
+				dc->res_pool->display_clock,
 				context->dispclk_khz * 115 / 100);
 		dc->current_context->bw_results.dispclk_khz = context->dispclk_khz;
 		dc->current_context->dispclk_khz = context->dispclk_khz;
drivers/gpu/drm/amd/display/dc/dce100/dce100_resource.c +2 -6
index f65b785220e2..f0700706d7c9 100644
@@ -804,8 +804,6 @@ enum dc_status dce100_validate_with_context(
 	if (!dce100_validate_surface_sets(set, set_count))
 		return DC_FAIL_SURFACE_VALIDATE;
 
-	context->res_ctx.pool = dc->res_pool;
-
 	for (i = 0; i < set_count; i++) {
 		context->streams[i] = DC_STREAM_TO_CORE(set[i].stream);
 		dc_stream_retain(&context->streams[i]->public);
@@ -817,8 +815,8 @@ enum dc_status dce100_validate_with_context(
 	if (result == DC_OK)
 		result = resource_map_clock_resources(dc, context);
 
-	if (!resource_validate_attach_surfaces(
-			set, set_count, dc->current_context, context)) {
+	if (!resource_validate_attach_surfaces(set, set_count,
+			dc->current_context, context, dc->res_pool)) {
 		DC_ERROR("Failed to attach surface to stream!\n");
 		return DC_FAIL_ATTACH_SURFACES;
 	}
@@ -843,8 +841,6 @@ enum dc_status dce100_validate_guaranteed(
 {
 	enum dc_status result = DC_ERROR_UNEXPECTED;
 
-	context->res_ctx.pool = dc->res_pool;
-
 	context->streams[0] = DC_STREAM_TO_CORE(dc_stream);
 	dc_stream_retain(&context->streams[0]->public);
 	context->stream_count++;
drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +23 -19

122 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +11 -14
index 8dec9a5602a9..122f2d03afc0 100644
@@ -866,7 +866,7 @@ static enum dc_status validate_mapped_resource(
 				continue;
 
 			if (!is_surface_pixel_format_supported(pipe_ctx,
-							       context->res_ctx.pool->underlay_pipe_index))
+					dc->res_pool->underlay_pipe_index))
 				return DC_SURFACE_PIXEL_FORMAT_UNSUPPORTED;
 
 			if (!pipe_ctx->tg->funcs->validate_timing(
@@ -918,7 +918,7 @@ bool dce110_validate_bandwidth(
 			&dc->bw_dceip,
 			&dc->bw_vbios,
 			context->res_ctx.pipe_ctx,
-			context->res_ctx.pool->pipe_count,
+			dc->res_pool->pipe_count,
 			&context->bw_results))
 		result =  true;
 	context->dispclk_khz = context->bw_results.dispclk_khz;
@@ -1030,8 +1030,6 @@ enum dc_status dce110_validate_with_context(
 	if (!dce110_validate_surface_sets(set, set_count))
 		return DC_FAIL_SURFACE_VALIDATE;
 
-	context->res_ctx.pool = dc->res_pool;
-
 	for (i = 0; i < set_count; i++) {
 		context->streams[i] = DC_STREAM_TO_CORE(set[i].stream);
 		dc_stream_retain(&context->streams[i]->public);
@@ -1043,8 +1041,8 @@ enum dc_status dce110_validate_with_context(
 	if (result == DC_OK)
 		result = resource_map_clock_resources(dc, context);
 
-	if (!resource_validate_attach_surfaces(
-			set, set_count, dc->current_context, context)) {
+	if (!resource_validate_attach_surfaces(set, set_count,
+			dc->current_context, context, dc->res_pool)) {
 		DC_ERROR("Failed to attach surface to stream!\n");
 		return DC_FAIL_ATTACH_SURFACES;
 	}
@@ -1069,8 +1067,6 @@ enum dc_status dce110_validate_guaranteed(
 {
 	enum dc_status result = DC_ERROR_UNEXPECTED;
 
-	context->res_ctx.pool = dc->res_pool;
-
 	context->streams[0] = DC_STREAM_TO_CORE(dc_stream);
 	dc_stream_retain(&context->streams[0]->public);
 	context->stream_count++;
@@ -1098,22 +1094,23 @@ enum dc_status dce110_validate_guaranteed(
 
 static struct pipe_ctx *dce110_acquire_underlay(
 		struct validate_context *context,
+		const struct resource_pool *pool,
 		struct core_stream *stream)
 {
 	struct core_dc *dc = DC_TO_CORE(stream->ctx->dc);
 	struct resource_context *res_ctx = &context->res_ctx;
-	unsigned int underlay_idx = res_ctx->pool->underlay_pipe_index;
+	unsigned int underlay_idx = pool->underlay_pipe_index;
 	struct pipe_ctx *pipe_ctx = &res_ctx->pipe_ctx[underlay_idx];
 
 	if (res_ctx->pipe_ctx[underlay_idx].stream)
 		return NULL;
 
-	pipe_ctx->tg = res_ctx->pool->timing_generators[underlay_idx];
-	pipe_ctx->mi = res_ctx->pool->mis[underlay_idx];
+	pipe_ctx->tg = pool->timing_generators[underlay_idx];
+	pipe_ctx->mi = pool->mis[underlay_idx];
 	/*pipe_ctx->ipp = res_ctx->pool->ipps[underlay_idx];*/
-	pipe_ctx->xfm = res_ctx->pool->transforms[underlay_idx];
-	pipe_ctx->opp = res_ctx->pool->opps[underlay_idx];
-	pipe_ctx->dis_clk = res_ctx->pool->display_clock;
+	pipe_ctx->xfm = pool->transforms[underlay_idx];
+	pipe_ctx->opp = pool->opps[underlay_idx];
+	pipe_ctx->dis_clk = pool->display_clock;
 	pipe_ctx->pipe_idx = underlay_idx;
 
 	pipe_ctx->stream = stream;
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +17 -18
index 4bf75afd5721..4de51a86c9ea 100644
@@ -749,22 +749,24 @@ static void destruct(struct dce110_resource_pool *pool)
 	}
 }
 
-static struct clock_source *find_matching_pll(struct resource_context *res_ctx,
+static struct clock_source *find_matching_pll(
+		struct resource_context *res_ctx,
+		const struct resource_pool *pool,
 		const struct core_stream *const stream)
 {
 	switch (stream->sink->link->link_enc->transmitter) {
 	case TRANSMITTER_UNIPHY_A:
-		return res_ctx->pool->clock_sources[DCE112_CLK_SRC_PLL0];
+		return pool->clock_sources[DCE112_CLK_SRC_PLL0];
 	case TRANSMITTER_UNIPHY_B:
-		return res_ctx->pool->clock_sources[DCE112_CLK_SRC_PLL1];
+		return pool->clock_sources[DCE112_CLK_SRC_PLL1];
 	case TRANSMITTER_UNIPHY_C:
-		return res_ctx->pool->clock_sources[DCE112_CLK_SRC_PLL2];
+		return pool->clock_sources[DCE112_CLK_SRC_PLL2];
 	case TRANSMITTER_UNIPHY_D:
-		return res_ctx->pool->clock_sources[DCE112_CLK_SRC_PLL3];
+		return pool->clock_sources[DCE112_CLK_SRC_PLL3];
 	case TRANSMITTER_UNIPHY_E:
-		return res_ctx->pool->clock_sources[DCE112_CLK_SRC_PLL4];
+		return pool->clock_sources[DCE112_CLK_SRC_PLL4];
 	case TRANSMITTER_UNIPHY_F:
-		return res_ctx->pool->clock_sources[DCE112_CLK_SRC_PLL5];
+		return pool->clock_sources[DCE112_CLK_SRC_PLL5];
 	default:
 		return NULL;
 	};
@@ -842,7 +844,7 @@ bool dce112_validate_bandwidth(
 			&dc->bw_dceip,
 			&dc->bw_vbios,
 			context->res_ctx.pipe_ctx,
-			context->res_ctx.pool->pipe_count,
+			dc->res_pool->pipe_count,
 			&context->bw_results))
 		result = true;
 	context->dispclk_khz = context->bw_results.dispclk_khz;
@@ -928,17 +930,18 @@ enum dc_status resource_map_phy_clock_resources(
 			if (dc_is_dp_signal(pipe_ctx->stream->signal)
 				|| pipe_ctx->stream->signal == SIGNAL_TYPE_VIRTUAL)
 				pipe_ctx->clock_source =
-					context->res_ctx.pool->dp_clock_source;
+						dc->res_pool->dp_clock_source;
 			else
-				pipe_ctx->clock_source =
-					find_matching_pll(&context->res_ctx,
-							  stream);
+				pipe_ctx->clock_source = find_matching_pll(
+					&context->res_ctx, dc->res_pool,
+					stream);
 
 			if (pipe_ctx->clock_source == NULL)
 				return DC_NO_CLOCK_SOURCE_RESOURCE;
 
 			resource_reference_clock_source(
 				&context->res_ctx,
+				dc->res_pool,
 				pipe_ctx->clock_source);
 
 			/* only one cs per stream regardless of mpo */
@@ -983,8 +986,6 @@ enum dc_status dce112_validate_with_context(
 	if (!dce112_validate_surface_sets(set, set_count))
 		return DC_FAIL_SURFACE_VALIDATE;
 
-	context->res_ctx.pool = dc->res_pool;
-
 	for (i = 0; i < set_count; i++) {
 		context->streams[i] = DC_STREAM_TO_CORE(set[i].stream);
 		dc_stream_retain(&context->streams[i]->public);
@@ -996,8 +997,8 @@ enum dc_status dce112_validate_with_context(
 	if (result == DC_OK)
 		result = resource_map_phy_clock_resources(dc, context);
 
-	if (!resource_validate_attach_surfaces(
-			set, set_count, dc->current_context, context)) {
+	if (!resource_validate_attach_surfaces(set, set_count,
+			dc->current_context, context, dc->res_pool)) {
 		DC_ERROR("Failed to attach surface to stream!\n");
 		return DC_FAIL_ATTACH_SURFACES;
 	}
@@ -1022,8 +1023,6 @@ enum dc_status dce112_validate_guaranteed(
 {
 	enum dc_status result = DC_ERROR_UNEXPECTED;
 
-	context->res_ctx.pool = dc->res_pool;
-
 	context->streams[0] = DC_STREAM_TO_CORE(dc_stream);
 	dc_stream_retain(&context->streams[0]->public);
 	context->stream_count++;
drivers/gpu/drm/amd/display/dc/dce80/dce80_resource.c +2 -6
index d49092986d54..0aa128e5ed84 100644
@@ -821,8 +821,6 @@ enum dc_status dce80_validate_with_context(
 	if (!dce80_validate_surface_sets(set, set_count))
 		return DC_FAIL_SURFACE_VALIDATE;
 
-	context->res_ctx.pool = dc->res_pool;
-
 	for (i = 0; i < set_count; i++) {
 		context->streams[i] = DC_STREAM_TO_CORE(set[i].stream);
 		dc_stream_retain(&context->streams[i]->public);
@@ -834,8 +832,8 @@ enum dc_status dce80_validate_with_context(
 	if (result == DC_OK)
 		result = resource_map_clock_resources(dc, context);
 
-	if (!resource_validate_attach_surfaces(
-			set, set_count, dc->current_context, context)) {
+	if (!resource_validate_attach_surfaces(set, set_count,
+			dc->current_context, context, dc->res_pool)) {
 		DC_ERROR("Failed to attach surface to stream!\n");
 		return DC_FAIL_ATTACH_SURFACES;
 	}
@@ -859,8 +857,6 @@ enum dc_status dce80_validate_guaranteed(
 {
 	enum dc_status result = DC_ERROR_UNEXPECTED;
 
-	context->res_ctx.pool = dc->res_pool;
-
 	context->streams[0] = DC_STREAM_TO_CORE(dc_stream);
 	dc_stream_retain(&context->streams[0]->public);
 	context->stream_count++;
drivers/gpu/drm/amd/display/dc/inc/core_types.h +1 -1
index 2b43e18c65f5..f3fe850ffa13 100644
@@ -212,6 +212,7 @@ struct resource_funcs {
 
 	struct pipe_ctx *(*acquire_idle_pipe_for_layer)(
 			struct validate_context *context,
+			const struct resource_pool *pool,
 			struct core_stream *stream);
 
 	void (*build_bit_depth_reduction_params)(
@@ -293,7 +294,6 @@ struct pipe_ctx {
 };
 
 struct resource_context {
-	const struct resource_pool *pool;
 	struct pipe_ctx pipe_ctx[MAX_PIPES];
 	bool is_stream_enc_acquired[MAX_PIPES * 2];
 	bool is_audio_acquired[MAX_PIPES];
drivers/gpu/drm/amd/display/dc/inc/resource.h +11 -4
index b1987cab9751..89d34bed131b 100644
@@ -92,10 +92,12 @@ void resource_build_info_frame(struct pipe_ctx *pipe_ctx);
 
 void resource_unreference_clock_source(
 		struct resource_context *res_ctx,
+		const struct resource_pool *pool,
 		struct clock_source **clock_source);
 
 void resource_reference_clock_source(
 		struct resource_context *res_ctx,
+		const struct resource_pool *pool,
 		struct clock_source *clock_source);
 
 bool resource_are_streams_timing_synchronizable(
@@ -107,7 +109,8 @@ struct clock_source *resource_find_used_clk_src_for_sharing(
 		struct pipe_ctx *pipe_ctx);
 
 struct clock_source *dc_resource_find_first_free_pll(
-		struct resource_context *res_ctx);
+		struct resource_context *res_ctx,
+		const struct resource_pool *pool);
 
 struct pipe_ctx *resource_get_head_pipe_for_stream(
 		struct resource_context *res_ctx,
@@ -117,9 +120,12 @@ bool resource_attach_surfaces_to_context(
 		const struct dc_surface *const *surfaces,
 		int surface_count,
 		const struct dc_stream *dc_stream,
-		struct validate_context *context);
+		struct validate_context *context,
+		const struct resource_pool *pool);
 
-struct pipe_ctx *find_idle_secondary_pipe(struct resource_context *res_ctx);
+struct pipe_ctx *find_idle_secondary_pipe(
+		struct resource_context *res_ctx,
+		const struct resource_pool *pool);
 
 bool resource_is_stream_unchanged(
 	const struct validate_context *old_context, const struct core_stream *stream);
@@ -131,7 +137,8 @@ bool resource_validate_attach_surfaces(
 		const struct dc_validation_set set[],
 		int set_count,
 		const struct validate_context *old_context,
-		struct validate_context *context);
+		struct validate_context *context,
+		const struct resource_pool *pool);
 
 void validate_guaranteed_copy_streams(
 		struct validate_context *context,
Signature · 6 lines
2.11.0

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

PATCH 20/28 drm/amd/display: Define dithering options

In reply to a message not in the archive

From: Ding Wang <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/dc.h          |  2 +-
 drivers/gpu/drm/amd/display/dc/dc_hw_types.h | 29 ++++++++++++++++++++++++++++
 2 files changed, 30 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/display/dc/dc.h +1 -1
index 647c095e0ae9..dd8902d28ee1 100644
@@ -430,6 +430,7 @@ struct dc_stream {
 	enum signal_type output_signal;
 
 	enum dc_color_space output_color_space;
+	enum dc_dither_option dither_option;
 
 	struct rect src; /* composition area */
 	struct rect dst; /* stream addressable area */
@@ -444,7 +445,6 @@ struct dc_stream {
 	struct colorspace_transform gamut_remap_matrix;
 	struct csc_transform csc_color_matrix;
 
-	/* TODO: dithering */
 	/* TODO: custom INFO packets */
 	/* TODO: ABM info (DMCU) */
 	/* TODO: PSR info */
drivers/gpu/drm/amd/display/dc/dc_hw_types.h +29 -0
index 64d43dba8fd6..1a7ce061258f 100644
@@ -484,6 +484,35 @@ enum dc_color_space {
 	COLOR_SPACE_ADOBERGB,
 };
 
+enum dc_dither_option {
+	DITHER_OPTION_DEFAULT,
+	DITHER_OPTION_DISABLE,
+	DITHER_OPTION_FM6,
+	DITHER_OPTION_FM8,
+	DITHER_OPTION_FM10,
+	DITHER_OPTION_SPATIAL6_FRAME_RANDOM,
+	DITHER_OPTION_SPATIAL8_FRAME_RANDOM,
+	DITHER_OPTION_SPATIAL10_FRAME_RANDOM,
+	DITHER_OPTION_SPATIAL6,
+	DITHER_OPTION_SPATIAL8,
+	DITHER_OPTION_SPATIAL10,
+	DITHER_OPTION_TRUN6,
+	DITHER_OPTION_TRUN8,
+	DITHER_OPTION_TRUN10,
+	DITHER_OPTION_TRUN10_SPATIAL8,
+	DITHER_OPTION_TRUN10_SPATIAL6,
+	DITHER_OPTION_TRUN10_FM8,
+	DITHER_OPTION_TRUN10_FM6,
+	DITHER_OPTION_TRUN10_SPATIAL8_FM6,
+	DITHER_OPTION_SPATIAL10_FM8,
+	DITHER_OPTION_SPATIAL10_FM6,
+	DITHER_OPTION_TRUN8_SPATIAL6,
+	DITHER_OPTION_TRUN8_FM6,
+	DITHER_OPTION_SPATIAL8_FM6,
+	DITHER_OPTION_MAX = DITHER_OPTION_SPATIAL8_FM6,
+	DITHER_OPTION_INVALID
+};
+
 enum dc_quantization_range {
 	QUANTIZATION_RANGE_UNKNOWN,
 	QUANTIZATION_RANGE_FULL,
Signature · 6 lines
2.11.0

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

PATCH 21/28 drm/amd/display: fix crash caused by incorrect index being used for array

In reply to a message not in the archive

From: Dmytro Laktyushkin <[email protected]>

---
 drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +1 -1
index f6223e6b3536..d3d57008271b 100644
@@ -1122,7 +1122,7 @@ void mod_freesync_notify_mode_change(struct mod_freesync *mod_freesync,
 			 * current mode
 			 */
 			calc_freesync_range(core_freesync, *streams, state,
-				core_freesync->map[stream_index].caps->
+				core_freesync->map[map_index].caps->
 				min_refresh_in_micro_hz,
 				state->nominal_refresh_rate_in_micro_hz);
 		}
Signature · 6 lines
2.11.0

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

PATCH 22/28 drm/amd/display: Check for Zero Range in FreeSync Calc

In reply to a message not in the archive

From: Eric Cook <[email protected]>

-check for min/max range in freesync calculation and handle it accordingly

---
 drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +15 -0
index d3d57008271b..009cb797bcfa 100644
@@ -363,6 +363,21 @@ static void calc_freesync_range(struct core_freesync *core_freesync,
 	unsigned int index = map_index_from_stream(core_freesync, stream);
 	uint32_t vtotal = stream->timing.v_total;
 
+	if ((min_refresh_in_uhz == 0) || (max_refresh_in_uhz == 0)) {
+		state->freesync_range.min_refresh =
+				state->nominal_refresh_rate_in_micro_hz;
+		state->freesync_range.max_refresh =
+				state->nominal_refresh_rate_in_micro_hz;
+
+		state->freesync_range.max_frame_duration = 0;
+		state->freesync_range.min_frame_duration = 0;
+
+		state->freesync_range.vmax = vtotal;
+		state->freesync_range.vmin = vtotal;
+
+		return;
+	}
+
 	min_frame_duration_in_ns = ((unsigned int) (div64_u64(
 					(1000000000ULL * 1000000),
 					max_refresh_in_uhz)));
Signature · 6 lines
2.11.0

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

PATCH 23/28 drm/amd/display: Add function to set dither option

In reply to a message not in the archive

From: Ding Wang <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/core/dc.c           |  41 ++++++++
 drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c   |   4 +-
 drivers/gpu/drm/amd/display/dc/core/dc_resource.c  | 110 +++++++++++++++++++++
 drivers/gpu/drm/amd/display/dc/dc.h                |   3 +
 .../drm/amd/display/dc/dce110/dce110_resource.c    |  48 +--------
 .../drm/amd/display/dc/dce110/dce110_resource.h    |   4 -
 .../drm/amd/display/dc/dce112/dce112_resource.c    |   2 +-
 drivers/gpu/drm/amd/display/dc/inc/core_types.h    |   4 -
 drivers/gpu/drm/amd/display/dc/inc/resource.h      |   2 +
 9 files changed, 160 insertions(+), 58 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +41 -0
index 37986632f025..738acf0cc7db 100644
@@ -363,6 +363,44 @@ static void set_test_pattern(
 			cust_pattern_size);
 }
 
+void set_dither_option(const struct dc_stream *dc_stream,
+		enum dc_dither_option option)
+{
+	struct core_stream *stream = DC_STREAM_TO_CORE(dc_stream);
+	struct bit_depth_reduction_params params;
+	struct core_link *core_link = DC_LINK_TO_CORE(stream->status.link);
+	struct pipe_ctx *pipes =
+			core_link->dc->current_context->res_ctx.pipe_ctx;
+
+	memset(&params, 0, sizeof(params));
+	if (!stream)
+		return;
+	if (option > DITHER_OPTION_MAX)
+		return;
+	if (option == DITHER_OPTION_DEFAULT) {
+		switch (stream->public.timing.display_color_depth) {
+		case COLOR_DEPTH_666:
+			stream->public.dither_option = DITHER_OPTION_SPATIAL6;
+			break;
+		case COLOR_DEPTH_888:
+			stream->public.dither_option = DITHER_OPTION_SPATIAL8;
+			break;
+		case COLOR_DEPTH_101010:
+			stream->public.dither_option = DITHER_OPTION_SPATIAL10;
+			break;
+		default:
+			option = DITHER_OPTION_DISABLE;
+		}
+	} else {
+		stream->public.dither_option = option;
+	}
+	resource_build_bit_depth_reduction_params(stream,
+				&params);
+	stream->bit_depth_params = params;
+	pipes->opp->funcs->
+		opp_program_bit_depth_reduction(pipes->opp, &params);
+}
+
 static void allocate_dc_stream_funcs(struct core_dc *core_dc)
 {
 	core_dc->public.stream_funcs.stream_update_scaling = stream_update_scaling;
@@ -380,6 +418,9 @@ static void allocate_dc_stream_funcs(struct core_dc *core_dc)
 	core_dc->public.stream_funcs.set_gamut_remap =
 			set_gamut_remap;
 
+	core_dc->public.stream_funcs.set_dither_option =
+			set_dither_option;
+
 	core_dc->public.link_funcs.set_drive_settings =
 			set_drive_settings;
 
drivers/gpu/drm/amd/display/dc/core/dc_link_dp.c +2 -2
index 4b9d3f12406f..a0d192774a22 100644
@@ -11,6 +11,7 @@
 #include "dpcd_defs.h"
 
 #include "core_dc.h"
+#include "resource.h"
 
 /* maximum pre emphasis level allowed for each voltage swing level*/
 static const enum dc_pre_emphasis voltage_swing_to_pre_emphasis[] = {
@@ -2245,8 +2246,7 @@ static void set_crtc_test_pattern(struct core_link *link,
 	case DP_TEST_PATTERN_VIDEO_MODE:
 	{
 		/* restore bitdepth reduction */
-		link->dc->res_pool->funcs->
-			build_bit_depth_reduction_params(pipe_ctx->stream,
+		resource_build_bit_depth_reduction_params(pipe_ctx->stream,
 					&params);
 		pipe_ctx->stream->bit_depth_params = params;
 		pipe_ctx->opp->funcs->
drivers/gpu/drm/amd/display/dc/core/dc_resource.c +110 -0

113 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dc.h +3 -0
index dd8902d28ee1..87675f032949 100644
@@ -122,6 +122,9 @@ struct dc_stream_funcs {
 			const struct dc_stream **stream,
 			int num_streams,
 			const struct dc_static_screen_events *events);
+
+	void (*set_dither_option)(const struct dc_stream *stream,
+			enum dc_dither_option option);
 };
 
 struct link_training_settings;
drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.c +1 -47

66 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce110/dce110_resource.h +0 -4
index 0c357fdfa8bc..8e2e85dd30b9 100644
@@ -40,10 +40,6 @@ struct dce110_resource_pool {
 
 enum dc_status dce110_resource_build_pipe_hw_param(struct pipe_ctx *pipe_ctx);
 
-void dce110_resource_build_bit_depth_reduction_params(
-		const struct core_stream *stream,
-		struct bit_depth_reduction_params *fmt_bit_depth);
-
 struct resource_pool *dce110_create_resource_pool(
 	uint8_t num_virtual_links,
 	struct core_dc *dc,
drivers/gpu/drm/amd/display/dc/dce112/dce112_resource.c +1 -1
index 4de51a86c9ea..18c1b89a52be 100644
@@ -1062,7 +1062,7 @@ static const struct resource_funcs dce112_res_pool_funcs = {
 	.link_enc_create = dce112_link_encoder_create,
 	.validate_with_context = dce112_validate_with_context,
 	.validate_guaranteed = dce112_validate_guaranteed,
-	.validate_bandwidth = dce112_validate_bandwidth
+	.validate_bandwidth = dce112_validate_bandwidth,
 };
 
 static void bw_calcs_data_update_from_pplib(struct core_dc *dc)
drivers/gpu/drm/amd/display/dc/inc/core_types.h +0 -4
index f3fe850ffa13..9e5e0ba5b10b 100644
@@ -214,10 +214,6 @@ struct resource_funcs {
 			struct validate_context *context,
 			const struct resource_pool *pool,
 			struct core_stream *stream);
-
-	void (*build_bit_depth_reduction_params)(
-			const struct core_stream *stream,
-			struct bit_depth_reduction_params *fmt_bit_depth);
 };
 
 struct audio_support{
drivers/gpu/drm/amd/display/dc/inc/resource.h +2 -0
index 89d34bed131b..4e07b9fea669 100644
@@ -160,5 +160,7 @@ bool pipe_need_reprogram(
 		struct pipe_ctx *pipe_ctx_old,
 		struct pipe_ctx *pipe_ctx);
 
+void resource_build_bit_depth_reduction_params(const struct core_stream *stream,
+		struct bit_depth_reduction_params *fmt_bit_depth);
 
 #endif /* DRIVERS_GPU_DRM_AMD_DC_DEV_DC_INC_RESOURCE_H_ */
Signature · 6 lines
2.11.0

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

PATCH 24/28 drm/amd/display: Add support for FreeSync on eDP to module

In reply to a message not in the archive

From: Eric Cook <[email protected]>

---
 .../drm/amd/display/modules/freesync/freesync.c    | 42 +++++++++++++++++-----
 1 file changed, 33 insertions(+), 9 deletions(-)
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +33 -9
index 009cb797bcfa..82086a129a3b 100644
@@ -109,11 +109,16 @@ struct freesync_entity {
 	struct mod_freesync_user_enable user_enable;
 };
 
+struct freesync_registry_options {
+	unsigned int min_refresh_from_edid;
+};
+
 struct core_freesync {
 	struct mod_freesync public;
 	struct dc *dc;
 	struct freesync_entity *map;
 	int num_entities;
+	struct freesync_registry_options opts;
 };
 
 #define MOD_FREESYNC_TO_CORE(mod_freesync)\
@@ -136,7 +141,7 @@ struct mod_freesync *mod_freesync_create(struct dc *dc)
 
 	struct persistent_data_flag flag;
 
-	int i = 0;
+	int i, data = 0;
 
 	if (core_freesync == NULL)
 		goto fail_alloc_context;
@@ -165,6 +170,12 @@ struct mod_freesync *mod_freesync_create(struct dc *dc)
 	flag.save_per_link = false;
 	dm_write_persistent_data(core_dc->ctx, NULL, FREESYNC_REGISTRY_NAME, NULL, NULL,
 					0, &flag);
+	flag.save_per_edid = false;
+	flag.save_per_link = false;
+	if (dm_read_persistent_data(core_dc->ctx, NULL, NULL,
+			"DalDrrSupport", &data, sizeof(data), &flag)) {
+		core_freesync->opts.min_refresh_from_edid = data;
+	}
 
 	return &core_freesync->public;
 
@@ -219,7 +230,7 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
 	struct core_stream *core_stream = NULL;
 	struct core_dc *core_dc = NULL;
 	struct core_freesync *core_freesync = NULL;
-	int persistent_freesync_enable = 0;
+	int persistent_freesync_enable, stream_index = 0;
 	struct persistent_data_flag flag;
 	unsigned int nom_refresh_rate_micro_hz;
 	unsigned long long temp;
@@ -238,6 +249,26 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
 
 		dc_stream_retain(stream);
 
+		stream_index = map_index_from_stream(core_freesync, stream);
+
+		temp = stream->timing.pix_clk_khz;
+		temp *= 1000ULL * 1000ULL * 1000ULL;
+		temp = div_u64(temp, stream->timing.h_total);
+		temp = div_u64(temp, stream->timing.v_total);
+
+		nom_refresh_rate_micro_hz = (unsigned int) temp;
+
+		if (core_freesync->opts.min_refresh_from_edid != 0 &&
+				dc_is_embedded_signal(
+					stream[stream_index].sink->sink_signal)) {
+			caps->supported = true;
+			caps->min_refresh_in_micro_hz =
+				core_freesync->opts.min_refresh_from_edid *
+					1000000;
+			caps->max_refresh_in_micro_hz =
+					nom_refresh_rate_micro_hz;
+		}
+
 		core_freesync->map[core_freesync->num_entities].stream = stream;
 		core_freesync->map[core_freesync->num_entities].caps = caps;
 
@@ -275,13 +306,6 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
 					enable_for_video = false;
 		}
 
-		temp = stream->timing.pix_clk_khz;
-		temp *= 1000ULL * 1000ULL * 1000ULL;
-		temp = div_u64(temp, stream->timing.h_total);
-		temp = div_u64(temp, stream->timing.v_total);
-
-		nom_refresh_rate_micro_hz = (unsigned int) temp;
-
 		if (caps->supported &&
 		    nom_refresh_rate_micro_hz >= caps->min_refresh_in_micro_hz &&
 		    nom_refresh_rate_micro_hz <= caps->max_refresh_in_micro_hz)
Signature · 6 lines
2.11.0

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

PATCH 25/28 drm/amd/display: Disable cursor on video surface.

In reply to a message not in the archive

From: Yongqiang Sun <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/core/dc_stream.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc_stream.c +4 -0
index 99b6a1695f26..4ba446de4d00 100644
@@ -250,6 +250,10 @@ bool dc_stream_set_cursor_position(
 				!pipe_ctx->ipp || !pipe_ctx->surface)
 			continue;
 
+		if (pipe_ctx->surface->public.address.type
+				== PLN_ADDR_TYPE_VIDEO_PROGRESSIVE)
+			pos_cpy.enable = false;
+
 		if (pipe_ctx->top_pipe && pipe_ctx->surface != pipe_ctx->top_pipe->surface)
 			pos_cpy.enable = false;
 
Signature · 6 lines
2.11.0

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

PATCH 26/28 drm/amd/display: move drr_params definition to TG

In reply to a message not in the archive

From: Tony Cheng <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h |  7 +++++++
 drivers/gpu/drm/amd/display/include/hw_sequencer_types.h | 11 -----------
 2 files changed, 7 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/display/dc/inc/hw/timing_generator.h +7 -0
index 2c4a9d02b3c1..00cdaaae455c 100644
@@ -40,6 +40,13 @@ struct dcp_gsl_params {
 	int gsl_master;
 };
 
+/* define the structure of Dynamic Refresh Mode */
+struct drr_params {
+	uint32_t vertical_total_min;
+	uint32_t vertical_total_max;
+	bool immediate_flip;
+};
+
 #define LEFT_EYE_3D_PRIMARY_SURFACE 1
 #define RIGHT_EYE_3D_PRIMARY_SURFACE 0
 
drivers/gpu/drm/amd/display/include/hw_sequencer_types.h +0 -11
index 065a91a7002f..8ba9f65276f5 100644
@@ -30,15 +30,4 @@
 #include "grph_object_defs.h"
 #include "link_service_types.h"
 
-/* define the structure of Dynamic Refresh Mode */
-struct drr_params {
-	/* defines the minimum possible vertical dimension of display timing
-	 * for CRTC as supported by the panel */
-	uint32_t vertical_total_min;
-	/* defines the maximum possible vertical dimension of display timing
-	 * for CRTC as supported by the panel */
-	uint32_t vertical_total_max;
-    bool immediate_flip;
-};
-
 #endif
Signature · 6 lines
2.11.0

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

PATCH 27/28 drm/amd/display: Get dprefclk ss percentage from vbios

In reply to a message not in the archive

From: Hersen Wu <[email protected]>

---
 drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c | 40 +++++--------------
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c    | 46 ++++++++++++++++------
 drivers/gpu/drm/amd/display/dc/dce/dce_clocks.h    | 13 +++---
 3 files changed, 51 insertions(+), 48 deletions(-)
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c +10 -30
index 123942f4cbde..682fc9b9b3f2 100644
@@ -1070,7 +1070,6 @@ static enum bp_result get_ss_info_v4_1(
 {
 	enum bp_result result = BP_RESULT_OK;
 	struct atom_display_controller_info_v4_1 *disp_cntl_tbl = NULL;
-	struct atom_smu_info_v3_1 *smu_tbl = NULL;
 
 	if (!ss_info)
 		return BP_RESULT_BADINPUT;
@@ -1078,19 +1077,11 @@ static enum bp_result get_ss_info_v4_1(
 	if (!DATA_TABLES(dce_info))
 		return BP_RESULT_BADBIOSTABLE;
 
-	if (!DATA_TABLES(smu_info))
-		return BP_RESULT_BADBIOSTABLE;
-
 	disp_cntl_tbl =  GET_IMAGE(struct atom_display_controller_info_v4_1,
 							DATA_TABLES(dce_info));
 	if (!disp_cntl_tbl)
 		return BP_RESULT_BADBIOSTABLE;
 
-	smu_tbl =  GET_IMAGE(struct atom_smu_info_v3_1, DATA_TABLES(smu_info));
-	if (!smu_tbl)
-		return BP_RESULT_BADBIOSTABLE;
-
-
 	ss_info->type.STEP_AND_DELAY_INFO = false;
 	ss_info->spread_percentage_divider = 1000;
 	/* BIOS no longer uses target clock.  Always enable for now */
@@ -1123,12 +1114,11 @@ static enum bp_result get_ss_info_v4_1(
 			ss_info->type.CENTER_MODE = true;
 		break;
 	case AS_SIGNAL_TYPE_GPU_PLL:
-		ss_info->spread_spectrum_percentage =
-				smu_tbl->gpuclk_ss_percentage;
-		ss_info->spread_spectrum_range =
-				smu_tbl->gpuclk_ss_rate_10hz * 10;
-		if (smu_tbl->gpuclk_ss_mode & ATOM_SS_CENTRE_SPREAD_MODE)
-			ss_info->type.CENTER_MODE = true;
+		/* atom_firmware: DAL only get data from dce_info table.
+		 * if data within smu_info is needed for DAL, VBIOS should
+		 * copy it into dce_info
+		 */
+		result = BP_RESULT_UNSUPPORTED;
 		break;
 	default:
 		result = BP_RESULT_UNSUPPORTED;
@@ -1145,7 +1135,6 @@ static enum bp_result get_ss_info_v4_2(
 {
 	enum bp_result result = BP_RESULT_OK;
 	struct atom_display_controller_info_v4_2 *disp_cntl_tbl = NULL;
-	struct atom_smu_info_v3_1 *smu_tbl = NULL;
 
 	if (!ss_info)
 		return BP_RESULT_BADINPUT;
@@ -1153,19 +1142,11 @@ static enum bp_result get_ss_info_v4_2(
 	if (!DATA_TABLES(dce_info))
 		return BP_RESULT_BADBIOSTABLE;
 
-	if (!DATA_TABLES(smu_info))
-		return BP_RESULT_BADBIOSTABLE;
-
 	disp_cntl_tbl =  GET_IMAGE(struct atom_display_controller_info_v4_2,
 							DATA_TABLES(dce_info));
 	if (!disp_cntl_tbl)
 		return BP_RESULT_BADBIOSTABLE;
 
-	smu_tbl =  GET_IMAGE(struct atom_smu_info_v3_1, DATA_TABLES(smu_info));
-	if (!smu_tbl)
-		return BP_RESULT_BADBIOSTABLE;
-
-
 	ss_info->type.STEP_AND_DELAY_INFO = false;
 	ss_info->spread_percentage_divider = 1000;
 	/* BIOS no longer uses target clock.  Always enable for now */
@@ -1198,12 +1179,11 @@ static enum bp_result get_ss_info_v4_2(
 			ss_info->type.CENTER_MODE = true;
 		break;
 	case AS_SIGNAL_TYPE_GPU_PLL:
-		ss_info->spread_spectrum_percentage =
-				smu_tbl->gpuclk_ss_percentage;
-		ss_info->spread_spectrum_range =
-				smu_tbl->gpuclk_ss_rate_10hz * 10;
-		if (smu_tbl->gpuclk_ss_mode & ATOM_SS_CENTRE_SPREAD_MODE)
-			ss_info->type.CENTER_MODE = true;
+		/* atom_firmware: DAL only get data from dce_info table.
+		 * if data within smu_info is needed for DAL, VBIOS should
+		 * copy it into dce_info
+		 */
+		result = BP_RESULT_UNSUPPORTED;
 		break;
 	default:
 		result = BP_RESULT_UNSUPPORTED;
drivers/gpu/drm/amd/display/dc/dce/dce_clocks.c +35 -11

77 lines not on this page · raw message

drivers/gpu/drm/amd/display/dc/dce/dce_clocks.h +6 -7
index 2fd00e45395c..29ff470086e5 100644
@@ -116,13 +116,12 @@ struct dce_disp_clk {
 	 * This is basically "Crystal Frequency In KHz" (XTALIN) frequency */
 	int dfs_bypass_disp_clk;
 
-	/* Flag for Enabled SS on GPU PLL */
-	bool ss_on_gpu_pll;
-	/* GPU PLL SS percentage (if down-spread enabled) */
-	int gpu_pll_ss_percentage;
-	/* GPU PLL SS percentage Divider (100 or 1000) */
-	int gpu_pll_ss_divider;
-
+	/* Flag for Enabled SS on DPREFCLK */
+	bool ss_on_dprefclk;
+	/* DPREFCLK SS percentage (if down-spread enabled) */
+	int dprefclk_ss_percentage;
+	/* DPREFCLK SS percentage Divider (100 or 1000) */
+	int dprefclk_ss_divider;
 
 	/* max disp_clk from PPLIB for max validation display clock*/
 	int max_displ_clk_in_khz;
Signature · 6 lines
2.11.0

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

PATCH 28/28 drm/amd/display: Assign stream to map before we need it

In reply to a message not in the archive
---
 drivers/gpu/drm/amd/display/modules/freesync/freesync.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/modules/freesync/freesync.c +2 -4
index 82086a129a3b..c5330f3cc1de 100644
@@ -230,7 +230,7 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
 	struct core_stream *core_stream = NULL;
 	struct core_dc *core_dc = NULL;
 	struct core_freesync *core_freesync = NULL;
-	int persistent_freesync_enable, stream_index = 0;
+	int persistent_freesync_enable = 0;
 	struct persistent_data_flag flag;
 	unsigned int nom_refresh_rate_micro_hz;
 	unsigned long long temp;
@@ -249,8 +249,6 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
 
 		dc_stream_retain(stream);
 
-		stream_index = map_index_from_stream(core_freesync, stream);
-
 		temp = stream->timing.pix_clk_khz;
 		temp *= 1000ULL * 1000ULL * 1000ULL;
 		temp = div_u64(temp, stream->timing.h_total);
@@ -260,7 +258,7 @@ bool mod_freesync_add_stream(struct mod_freesync *mod_freesync,
 
 		if (core_freesync->opts.min_refresh_from_edid != 0 &&
 				dc_is_embedded_signal(
-					stream[stream_index].sink->sink_signal)) {
+					stream->sink->sink_signal)) {
 			caps->supported = true;
 			caps->min_refresh_in_micro_hz =
 				core_freesync->opts.min_refresh_from_edid *
Signature · 6 lines
2.11.0

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