[PATCH 40/76] drm/amd/dal: remove unnessary adapter service functions

Harry Wentland harry.wentland at amd.com
Mon Nov 21 23:01:00 UTC 2016


From: Tony Cheng <tony.cheng at amd.com>

- call bios directly

Signed-off-by: Tony Cheng <tony.cheng at amd.com>
Acked-by: Harry Wentland <harry.wentland at amd.com>
---
 .../gpu/drm/amd/dal/dc/adapter/adapter_service.c   | 168 +--------------------
 .../gpu/drm/amd/dal/dc/dce110/dce110_compressor.c  |   5 +-
 .../gpu/drm/amd/dal/dc/dce112/dce112_compressor.c  |   5 +-
 .../gpu/drm/amd/dal/dc/dce80/dce80_compressor.c    |   5 +-
 .../amd/dal/dc/gpu/dce110/display_clock_dce110.c   |  13 +-
 .../drm/amd/dal/dc/gpu/dce80/display_clock_dce80.c |   9 +-
 .../amd/dal/include/adapter_service_interface.h    |  41 -----
 7 files changed, 21 insertions(+), 225 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/dc/adapter/adapter_service.c b/drivers/gpu/drm/amd/dal/dc/adapter/adapter_service.c
index 435b222c48a4..245438229623 100644
--- a/drivers/gpu/drm/amd/dal/dc/adapter/adapter_service.c
+++ b/drivers/gpu/drm/amd/dal/dc/adapter/adapter_service.c
@@ -608,7 +608,6 @@ static bool adapter_service_construct(
 	struct as_init_data *init_data)
 {
 	struct dc_bios *dcb;
-	enum dce_version dce_version;
 	uint32_t i;
 
 	if (!init_data)
@@ -631,7 +630,7 @@ static bool adapter_service_construct(
 		as->default_values[id] = feature_entry_table[i].default_value;
 	}
 
-	if (dal_adapter_service_get_dce_version(as) == DCE_VERSION_11_0) {
+	if (as->ctx->dce_version == DCE_VERSION_11_0) {
 		uint32_t i;
 
 		for (i = 0; i < ARRAY_SIZE(feature_entry_table); i++) {
@@ -652,7 +651,6 @@ static bool adapter_service_construct(
 	}
 
 	as->dce_environment = init_data->dce_environment;
-	dce_version = dal_adapter_service_get_dce_version(as);
 
 	dcb = as->ctx->dc_bios;
 
@@ -731,87 +729,6 @@ void dal_adapter_service_destroy(
 }
 
 /*
- * dal_adapter_service_get_dce_version
- *
- * Get the DCE version of current ASIC
- */
-enum dce_version dal_adapter_service_get_dce_version(
-	const struct adapter_service *as)
-{
-	uint32_t version = as->asic_cap->data[ASIC_DATA_DCE_VERSION];
-
-	switch (version) {
-	case 0x80:
-		/* CI Bonaire */
-		return DCE_VERSION_8_0;
-	case 0x100:
-		return DCE_VERSION_10_0;
-	case 0x110:
-		return DCE_VERSION_11_0;
-	case 0x112:
-		return DCE_VERSION_11_2;
-	default:
-		ASSERT_CRITICAL(false);
-		return DCE_VERSION_UNKNOWN;
-	}
-}
-
-/**
- * Get the source objects of an object
- *
- * \param [in] id      The graphics object id
- * \param [in] index   Enumerating index which starts at 0
- *
- * \return If enumerating successfully, return the VALID source object id,
- *	otherwise, returns "zeroed out" object id.
- *	Client should call dal_graphics_object_id_is_valid() to check
- *	weather the id is valid.
- */
-struct graphics_object_id dal_adapter_service_get_src_obj(
-	struct adapter_service *as,
-	struct graphics_object_id id,
-	uint32_t index)
-{
-	struct graphics_object_id src_object_id;
-	struct dc_bios *dcb = as->ctx->dc_bios;
-
-	if (BP_RESULT_OK != dcb->funcs->get_src_obj(dcb, id, index,
-			&src_object_id)) {
-		src_object_id =
-			dal_graphics_object_id_init(
-				0,
-				ENUM_ID_UNKNOWN,
-				OBJECT_TYPE_UNKNOWN);
-	}
-
-	return src_object_id;
-}
-
-bool dal_adapter_service_get_device_tag(
-		struct adapter_service *as,
-		struct graphics_object_id connector_object_id,
-		uint32_t device_tag_index,
-		struct connector_device_tag_info *info)
-{
-	struct dc_bios *dcb = as->ctx->dc_bios;
-
-	if (BP_RESULT_OK == dcb->funcs->get_device_tag(dcb,
-			connector_object_id, device_tag_index, info))
-		return true;
-	else
-		return false;
-}
-
-/* Check if DeviceId is supported by ATOM_OBJECT_HEADER support info */
-bool dal_adapter_service_is_device_id_supported(struct adapter_service *as,
-		struct device_id id)
-{
-	struct dc_bios *dcb = as->ctx->dc_bios;
-
-	return dcb->funcs->is_device_id_supported(dcb, id);
-}
-
-/*
  * dal_adapter_service_is_feature_supported
  *
  * Return if a given feature is supported by the ASIC. The feature has to be
@@ -828,39 +745,6 @@ bool dal_adapter_service_is_feature_supported(struct adapter_service *as,
 }
 
 /*
- * dal_adapter_service_get_ss_info_num
- *
- * Get number of spread spectrum entries from BIOS
- */
-uint32_t dal_adapter_service_get_ss_info_num(
-	struct adapter_service *as,
-	enum as_signal_type signal)
-{
-	struct dc_bios *dcb = as->ctx->dc_bios;
-
-	return dcb->funcs->get_ss_entry_number(dcb, signal);
-}
-
-/*
- * dal_adapter_service_get_ss_info
- *
- * Get spread spectrum info from BIOS
- */
-bool dal_adapter_service_get_ss_info(
-	struct adapter_service *as,
-	enum as_signal_type signal,
-	uint32_t idx,
-	struct spread_spectrum_info *info)
-{
-	struct dc_bios *dcb = as->ctx->dc_bios;
-
-	enum bp_result bp_result = dcb->funcs->get_spread_spectrum_info(dcb,
-			signal, idx, info);
-
-	return BP_RESULT_OK == bp_result;
-}
-
-/*
  * dal_adapter_service_is_dfs_bypass_enabled
  *
  * Check if DFS bypass is enabled
@@ -952,22 +836,6 @@ bool dal_adapter_service_get_feature_value(struct adapter_service *as,
 	return true;
 }
 
-bool dal_adapter_service_get_embedded_panel_info(
-	struct adapter_service *as,
-	struct embedded_panel_info *info)
-{
-	enum bp_result result;
-	struct dc_bios *dcb = as->ctx->dc_bios;
-
-	if (info == NULL)
-		/*TODO: add DALASSERT_MSG here*/
-		return false;
-
-	result = dcb->funcs->get_embedded_panel_info(dcb, info);
-
-	return result == BP_RESULT_OK;
-}
-
 /*
  * dal_adapter_service_should_optimize
  *
@@ -1018,37 +886,3 @@ bool dal_adapter_service_should_optimize(
 	return (supported_optimization & feature) != 0;
 }
 
-bool dal_adapter_service_get_encoder_cap_info(
-		struct adapter_service *as,
-		struct graphics_object_id id,
-		struct graphics_object_encoder_cap_info *info)
-{
-	struct bp_encoder_cap_info bp_cap_info = {0};
-	enum bp_result result;
-	struct dc_bios *dcb = as->ctx->dc_bios;
-
-	if (NULL == info) {
-		ASSERT_CRITICAL(false);
-		return false;
-	}
-
-	/*
-	 * Retrieve Encoder Capability Information from VBIOS and store the
-	 * call result (success or fail)
-	 * Info from VBIOS about HBR2 has two fields:
-	 *
-	 * - dpHbr2Cap: indicates supported/not supported by HW Encoder
-	 * - dpHbr2En : indicates DP spec compliant/not compliant
-	 */
-	result = dcb->funcs->get_encoder_cap_info(dcb, id, &bp_cap_info);
-
-	/* Set dp_hbr2_validated flag (it's equal to Enable) */
-	info->dp_hbr2_validated = bp_cap_info.DP_HBR2_EN;
-
-	if (result == BP_RESULT_OK) {
-		info->dp_hbr2_cap = bp_cap_info.DP_HBR2_CAP;
-		return true;
-	}
-
-	return false;
-}
diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_compressor.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_compressor.c
index 7612efb27939..62bf70363b3c 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_compressor.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_compressor.c
@@ -795,6 +795,7 @@ void dce110_compressor_set_fbc_invalidation_triggers(
 bool dce110_compressor_construct(struct dce110_compressor *compressor,
 	struct dc_context *ctx, struct adapter_service *as)
 {
+	struct dc_bios *bp = ctx->dc_bios;
 	struct embedded_panel_info panel_info;
 
 	compressor->base.options.bits.FBC_SUPPORT = true;
@@ -833,8 +834,8 @@ bool dce110_compressor_construct(struct dce110_compressor *compressor,
 	compressor->base.attached_inst = 0;
 	compressor->base.is_enabled = false;
 
-	if (dal_adapter_service_get_embedded_panel_info(as,
-		&panel_info)) {
+	if (BP_RESULT_OK ==
+			bp->funcs->get_embedded_panel_info(bp, &panel_info)) {
 		compressor->base.embedded_panel_h_size =
 			panel_info.lcd_timing.horizontal_addressable;
 		compressor->base.embedded_panel_v_size =
diff --git a/drivers/gpu/drm/amd/dal/dc/dce112/dce112_compressor.c b/drivers/gpu/drm/amd/dal/dc/dce112/dce112_compressor.c
index 1b0792e0219a..aa06777306f8 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce112/dce112_compressor.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce112/dce112_compressor.c
@@ -795,6 +795,7 @@ void dce112_compressor_set_fbc_invalidation_triggers(
 bool dce112_compressor_construct(struct dce112_compressor *compressor,
 	struct dc_context *ctx, struct adapter_service *as)
 {
+	struct dc_bios *bp = ctx->dc_bios;
 	struct embedded_panel_info panel_info;
 
 	compressor->base.options.bits.FBC_SUPPORT = true;
@@ -833,8 +834,8 @@ bool dce112_compressor_construct(struct dce112_compressor *compressor,
 	compressor->base.attached_inst = 0;
 	compressor->base.is_enabled = false;
 
-	if (dal_adapter_service_get_embedded_panel_info(as,
-		&panel_info)) {
+	if (BP_RESULT_OK ==
+			bp->funcs->get_embedded_panel_info(bp, &panel_info)) {
 		compressor->base.embedded_panel_h_size =
 			panel_info.lcd_timing.horizontal_addressable;
 		compressor->base.embedded_panel_v_size =
diff --git a/drivers/gpu/drm/amd/dal/dc/dce80/dce80_compressor.c b/drivers/gpu/drm/amd/dal/dc/dce80/dce80_compressor.c
index 667be43aaa07..8cab5e60bc9b 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce80/dce80_compressor.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce80/dce80_compressor.c
@@ -776,6 +776,7 @@ void dce80_compressor_set_fbc_invalidation_triggers(
 bool dce80_compressor_construct(struct dce80_compressor *compressor,
 	struct dc_context *ctx, struct adapter_service *as)
 {
+	struct dc_bios *bp = ctx->dc_bios;
 	struct embedded_panel_info panel_info;
 
 	compressor->base.options.bits.FBC_SUPPORT = true;
@@ -814,8 +815,8 @@ bool dce80_compressor_construct(struct dce80_compressor *compressor,
 	compressor->base.attached_inst = 0;
 	compressor->base.is_enabled = false;
 
-	if (dal_adapter_service_get_embedded_panel_info(as,
-		&panel_info)) {
+	if (BP_RESULT_OK ==
+			bp->funcs->get_embedded_panel_info(bp, &panel_info)) {
 		compressor->base.embedded_panel_h_size =
 			panel_info.lcd_timing.horizontal_addressable;
 		compressor->base.embedded_panel_v_size =
diff --git a/drivers/gpu/drm/amd/dal/dc/gpu/dce110/display_clock_dce110.c b/drivers/gpu/drm/amd/dal/dc/gpu/dce110/display_clock_dce110.c
index 9aa9b8fc927f..ec0f6ae61542 100644
--- a/drivers/gpu/drm/amd/dal/dc/gpu/dce110/display_clock_dce110.c
+++ b/drivers/gpu/drm/amd/dal/dc/gpu/dce110/display_clock_dce110.c
@@ -926,6 +926,7 @@ static bool dal_display_clock_dce110_construct(
 	struct adapter_service *as)
 {
 	struct display_clock *dc_base = &dc110->disp_clk_base;
+	struct dc_bios *bp = dc110->disp_clk_base.ctx->dc_bios;
 
 	if (NULL == as)
 		return false;
@@ -973,19 +974,16 @@ static bool dal_display_clock_dce110_construct(
 
 	{
 		uint32_t ss_info_num =
-			dal_adapter_service_get_ss_info_num(
-				as,
+				bp->funcs->get_ss_entry_number(bp,
 				AS_SIGNAL_TYPE_GPU_PLL);
 
 		if (ss_info_num) {
 			struct spread_spectrum_info info;
-			bool result;
+			enum bp_result result;
 
 			memset(&info, 0, sizeof(info));
 
-			result =
-				dal_adapter_service_get_ss_info(
-					as,
+			result = bp->funcs->get_spread_spectrum_info(bp,
 					AS_SIGNAL_TYPE_GPU_PLL,
 					0,
 					&info);
@@ -995,7 +993,8 @@ static bool dal_display_clock_dce110_construct(
 			 * SSInfo.spreadSpectrumPercentage !=0 would be sign
 			 * that SS is enabled
 			 */
-			if (result && info.spread_spectrum_percentage != 0) {
+			if (result == BP_RESULT_OK &&
+					info.spread_spectrum_percentage != 0) {
 				dc110->ss_on_gpu_pll = true;
 				dc110->gpu_pll_ss_divider =
 					info.spread_percentage_divider;
diff --git a/drivers/gpu/drm/amd/dal/dc/gpu/dce80/display_clock_dce80.c b/drivers/gpu/drm/amd/dal/dc/gpu/dce80/display_clock_dce80.c
index 0741139db8b5..68134a0e70b4 100644
--- a/drivers/gpu/drm/amd/dal/dc/gpu/dce80/display_clock_dce80.c
+++ b/drivers/gpu/drm/amd/dal/dc/gpu/dce80/display_clock_dce80.c
@@ -719,24 +719,25 @@ static void display_clock_ss_construct(
 	struct display_clock_dce80 *disp_clk,
 	struct adapter_service *as)
 {
-	uint32_t ss_entry_num = dal_adapter_service_get_ss_info_num(as,
+	struct dc_bios *bp = disp_clk->disp_clk.ctx->dc_bios;
+	uint32_t ss_entry_num = bp->funcs->get_ss_entry_number(bp,
 		AS_SIGNAL_TYPE_GPU_PLL);
 
 	/*Read SS Info from VBIOS SS Info table for DP Reference Clock spread.*/
 	if (ss_entry_num > 0) {/* Should be only one entry */
 		struct spread_spectrum_info ss_info;
-		bool res;
+		enum bp_result res;
 
 		memset(&ss_info, 0, sizeof(struct spread_spectrum_info));
 
-		res = dal_adapter_service_get_ss_info(as,
+		res = bp->funcs->get_spread_spectrum_info(bp,
 			AS_SIGNAL_TYPE_GPU_PLL, 0, &ss_info);
 
 		/* Based on VBIOS, VBIOS will keep entry for GPU PLL SS even if
 		 * SS not enabled and in that case
 		 * SSInfo.spreadSpectrumPercentage !=0 would be
 		 * sign that SS is enabled*/
-		if (res && ss_info.spread_spectrum_percentage != 0) {
+		if (res == BP_RESULT_OK && ss_info.spread_spectrum_percentage != 0) {
 			disp_clk->ss_on_gpu_pll = true;
 			disp_clk->gpu_pll_ss_divider =
 				ss_info.spread_percentage_divider;
diff --git a/drivers/gpu/drm/amd/dal/include/adapter_service_interface.h b/drivers/gpu/drm/amd/dal/include/adapter_service_interface.h
index 39adbbf25638..35ca9ca96467 100644
--- a/drivers/gpu/drm/amd/dal/include/adapter_service_interface.h
+++ b/drivers/gpu/drm/amd/dal/include/adapter_service_interface.h
@@ -330,22 +330,6 @@ struct adapter_service *dal_adapter_service_create(
 void dal_adapter_service_destroy(
 	struct adapter_service **as);
 
-/* Get the DCE version of current ASIC */
-enum dce_version dal_adapter_service_get_dce_version(
-	const struct adapter_service *as);
-
-/* Get number of spread spectrum entries from BIOS */
-uint32_t dal_adapter_service_get_ss_info_num(
-	struct adapter_service *as,
-	enum as_signal_type signal);
-
-/* Get spread spectrum info from BIOS */
-bool dal_adapter_service_get_ss_info(
-	struct adapter_service *as,
-	enum as_signal_type signal,
-	uint32_t idx,
-	struct spread_spectrum_info *info);
-
 /* Check if DFS bypass is enabled */
 bool dal_adapter_service_is_dfs_bypass_enabled(struct adapter_service *as);
 
@@ -373,33 +357,8 @@ bool dal_adapter_service_get_i2c_info(
 struct dal_asic_runtime_flags dal_adapter_service_get_asic_runtime_flags(
 	struct adapter_service *as);
 
-bool dal_adapter_service_get_embedded_panel_info(
-	struct adapter_service *as,
-	struct embedded_panel_info *info);
-
-
-bool dal_adapter_service_get_device_tag(
-	struct adapter_service *as,
-	struct graphics_object_id connector_object_id,
-	uint32_t device_tag_index,
-	struct connector_device_tag_info *info);
-
-bool dal_adapter_service_is_device_id_supported(
-	struct adapter_service *as,
-	struct device_id id);
-
-struct graphics_object_id dal_adapter_service_get_src_obj(
-	struct adapter_service *as,
-	struct graphics_object_id id,
-	uint32_t index);
-
 /* Reports whether driver settings allow requested optimization */
 bool dal_adapter_service_should_optimize(
 		struct adapter_service *as, enum optimization_feature feature);
 
-bool dal_adapter_service_get_encoder_cap_info(
-		struct adapter_service *as,
-		struct graphics_object_id id,
-		struct graphics_object_encoder_cap_info *info);
-
 #endif /* __DAL_ADAPTER_SERVICE_INTERFACE_H__ */
-- 
2.10.1



More information about the amd-gfx mailing list