[PATCH 48/76] drm/amd/dal: remove dal_adapter_service_get_feature_value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Tony Cheng <tony.cheng@xxxxxxx>

- STUTTER_MODE_NO_DMIF_BUFFER_ALLOCATION always = 0.
-- this is a debug option when dmif first got introduced.  no need to keep it.  always allocate DMIF

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   | 59 ----------------------
 .../dc/asic_capability/carrizo_asic_capability.c   |  1 -
 .../dc/asic_capability/hawaii_asic_capability.c    |  3 --
 .../dc/asic_capability/polaris10_asic_capability.c |  1 -
 .../dal/dc/asic_capability/tonga_asic_capability.c |  1 -
 .../gpu/drm/amd/dal/dc/dce110/dce110_mem_input.c   | 26 ++++------
 .../gpu/drm/amd/dal/dc/dce110/dce110_mem_input.h   | 23 ---------
 .../gpu/drm/amd/dal/dc/dce110/dce110_mem_input_v.c |  5 --
 drivers/gpu/drm/amd/dal/dc/dce80/dce80_mem_input.c | 14 ++---
 drivers/gpu/drm/amd/dal/dc/inc/hw/mem_input.h      |  7 +++
 .../amd/dal/include/adapter_service_interface.h    | 17 +------
 .../drm/amd/dal/include/asic_capability_types.h    |  1 -
 12 files changed, 21 insertions(+), 137 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 a6e0763c21e5..41d9a6125e14 100644
--- a/drivers/gpu/drm/amd/dal/dc/adapter/adapter_service.c
+++ b/drivers/gpu/drm/amd/dal/dc/adapter/adapter_service.c
@@ -100,7 +100,6 @@ static const struct feature_source_entry feature_entry_table[] = {
 	{FEATURE_LB_HIGH_RESOLUTION, false, true},
 	{FEATURE_MAX_CONTROLLER_NUM, 0, false},
 	{FEATURE_DRR_SUPPORT, AS_DRR_SUPPORT_ENABLED, false},
-	{FEATURE_STUTTER_MODE, 15, false},
 	{FEATURE_DP_DISPLAY_FORCE_SS_ENABLE, false, true},
 	{FEATURE_REPORT_CE_MODE_ONLY, false, true},
 	{FEATURE_ALLOW_OPTIMIZED_MODE_AS_DEFAULT, false, true},
@@ -360,10 +359,6 @@ static bool get_feature_value_from_data_sources(
 		*data = as->asic_cap->caps.HPD_CHECK_FOR_EDID;
 		break;
 
-	case FEATURE_STUTTER_MODE:
-		*data = as->asic_cap->data[ASIC_DATA_STUTTERMODE];
-		break;
-
 	case FEATURE_8BPP_SUPPORTED:
 		*data = as->asic_cap->caps.SUPPORT_8BPP;
 		break;
@@ -627,58 +622,4 @@ void dal_adapter_service_destroy(
 	*as = NULL;
 }
 
-/*
- * dal_adapter_service_get_feature_value
- *
- * Get the cached value of a given feature. This value can be a boolean, int,
- * or characters.
- */
-bool dal_adapter_service_get_feature_value(struct adapter_service *as,
-					   const enum adapter_feature_id feature_id,
-					   void *data,
-					   uint32_t size)
-{
-	uint32_t entry_idx = 0;
-	uint32_t set_idx = 0;
-	uint32_t set_internal_idx = 0;
-
-	if (feature_id >= FEATURE_MAXIMUM || feature_id <= FEATURE_UNKNOWN) {
-		ASSERT_CRITICAL(false);
-		return false;
-	}
-
-	if (data == NULL) {
-		ASSERT_CRITICAL(false);
-		return false;
-	}
-
-	entry_idx = lookup_feature_entry(as, feature_id);
-	set_idx = (uint32_t)((feature_id - 1)/32);
-	set_internal_idx = (uint32_t)((feature_id - 1) % 32);
-
-	if (entry_idx >= get_feature_entries_num()) {
-		/* Cannot find this entry */
-		ASSERT_CRITICAL(false);
-		return false;
-	}
-
-	if (feature_entry_table[entry_idx].is_boolean_type) {
-		if (size != sizeof(bool)) {
-			ASSERT_CRITICAL(false);
-			return false;
-		}
-
-		*(bool *)data = get_bool_value(as->adapter_feature_set[set_idx],
-				set_internal_idx);
-	} else {
-		if (size != sizeof(uint32_t)) {
-			ASSERT_CRITICAL(false);
-			return false;
-		}
-
-		*(uint32_t *)data = as->adapter_feature_set[set_idx];
-	}
-
-	return true;
-}
 
diff --git a/drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.c b/drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.c
index 90050e8856dd..7243e51e909f 100644
--- a/drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.c
+++ b/drivers/gpu/drm/amd/dal/dc/asic_capability/carrizo_asic_capability.c
@@ -53,7 +53,6 @@ void carrizo_asic_capability_create(struct asic_capability *cap,
 	cap->data[ASIC_DATA_LINEBUFFER_SIZE] = 1712 * 144;
 	cap->data[ASIC_DATA_DRAM_BANDWIDTH_EFFICIENCY] = 45;
 	cap->data[ASIC_DATA_MC_LATENCY] = 5000;
-	cap->data[ASIC_DATA_STUTTERMODE] = 0x200A;
 	cap->data[ASIC_DATA_VIEWPORT_PIXEL_GRANULARITY] = 2;
 	cap->data[ASIC_DATA_MEMORYTYPE_MULTIPLIER] = 2;
 	cap->data[ASIC_DATA_DOWNSCALE_LIMIT] = 150;
diff --git a/drivers/gpu/drm/amd/dal/dc/asic_capability/hawaii_asic_capability.c b/drivers/gpu/drm/amd/dal/dc/asic_capability/hawaii_asic_capability.c
index f5a3cda8c5b3..e0c9ef4557e7 100644
--- a/drivers/gpu/drm/amd/dal/dc/asic_capability/hawaii_asic_capability.c
+++ b/drivers/gpu/drm/amd/dal/dc/asic_capability/hawaii_asic_capability.c
@@ -63,9 +63,6 @@ void dal_hawaii_asic_capability_create(struct asic_capability *cap,
 	cap->data[ASIC_DATA_LINEBUFFER_SIZE] = 1712 * 144;
 	cap->data[ASIC_DATA_DRAM_BANDWIDTH_EFFICIENCY] = 70;
 	cap->data[ASIC_DATA_MC_LATENCY] = 5000; /* units of ns */
-
-	/* StutterModeEnhanced; Quad DMIF Buffer */
-	cap->data[ASIC_DATA_STUTTERMODE] = 0x2002;
 	cap->data[ASIC_DATA_PATH_NUM_PER_DPMST_CONNECTOR] = 4;
 	cap->data[ASIC_DATA_VIEWPORT_PIXEL_GRANULARITY] = 2;
 
diff --git a/drivers/gpu/drm/amd/dal/dc/asic_capability/polaris10_asic_capability.c b/drivers/gpu/drm/amd/dal/dc/asic_capability/polaris10_asic_capability.c
index 89bb01f436b9..7716d6587793 100644
--- a/drivers/gpu/drm/amd/dal/dc/asic_capability/polaris10_asic_capability.c
+++ b/drivers/gpu/drm/amd/dal/dc/asic_capability/polaris10_asic_capability.c
@@ -54,7 +54,6 @@ void polaris10_asic_capability_create(struct asic_capability *cap,
 	cap->data[ASIC_DATA_DRAM_BANDWIDTH_EFFICIENCY] = 70;
 
 	cap->data[ASIC_DATA_MC_LATENCY] = 3000;
-	cap->data[ASIC_DATA_STUTTERMODE] = 0x200A;
 	cap->data[ASIC_DATA_VIEWPORT_PIXEL_GRANULARITY] = 2;
 
 	cap->data[ASIC_DATA_MEMORYTYPE_MULTIPLIER] = 4;
diff --git a/drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.c b/drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.c
index aa2333f9dc07..6c819ab8fd6e 100644
--- a/drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.c
+++ b/drivers/gpu/drm/amd/dal/dc/asic_capability/tonga_asic_capability.c
@@ -50,7 +50,6 @@ void tonga_asic_capability_create(struct asic_capability *cap,
 	cap->data[ASIC_DATA_LINEBUFFER_SIZE] = 1712 * 144;
 	cap->data[ASIC_DATA_DRAM_BANDWIDTH_EFFICIENCY] = 70;
 	cap->data[ASIC_DATA_MC_LATENCY] = 5000;
-	cap->data[ASIC_DATA_STUTTERMODE] = 0x2002;
 	cap->data[ASIC_DATA_PATH_NUM_PER_DPMST_CONNECTOR] = 4;
 	cap->data[ASIC_DATA_VIEWPORT_PIXEL_GRANULARITY] = 2;
 	cap->data[ASIC_DATA_MIN_DISPCLK_FOR_UNDERSCAN] = 300000;
diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input.c
index 3eb0e73d2eb6..a78ad8ddcaf8 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input.c
@@ -836,10 +836,6 @@ void dce110_allocate_mem_input(
 	uint32_t field;
 	uint32_t pix_dur;
 
-	if (bm110->supported_stutter_mode
-			& STUTTER_MODE_NO_DMIF_BUFFER_ALLOCATION)
-		goto register_underflow_int;
-
 	/*Allocate DMIF buffer*/
 	value = dm_read_reg(mi->ctx, addr);
 	field = get_reg_field_value(
@@ -950,14 +946,10 @@ void dce110_free_mem_input(
 	struct dce110_mem_input *bm_dce110 = TO_DCE110_MEM_INPUT(mi);
 	uint32_t value;
 
-	if (!(bm_dce110->supported_stutter_mode &
-		STUTTER_MODE_NO_DMIF_BUFFER_ALLOCATION)) {
-
-		/* De-allocate DMIF buffer first */
-		if (mmPIPE0_DMIF_BUFFER_CONTROL + bm_dce110->offsets.pipe != 0)
-			deallocate_dmif_buffer_helper(
-					mi->ctx, bm_dce110->offsets.pipe);
-	}
+	/* De-allocate DMIF buffer first */
+	if (mmPIPE0_DMIF_BUFFER_CONTROL + bm_dce110->offsets.pipe != 0)
+		deallocate_dmif_buffer_helper(
+				mi->ctx, bm_dce110->offsets.pipe);
 
 	/* TODO: unregister underflow interrupt
 	unregisterInterrupt();
@@ -1005,6 +997,11 @@ bool dce110_mem_input_construct(
 	uint32_t inst,
 	const struct dce110_mem_input_reg_offsets *offsets)
 {
+	/* supported stutter method
+	 * STUTTER_MODE_ENHANCED
+	 * STUTTER_MODE_QUAD_DMIF_BUFFER
+	 * STUTTER_MODE_WATERMARK_NBP_STATE
+	 */
 	mem_input110->base.funcs = &dce110_mem_input_funcs;
 	mem_input110->base.ctx = ctx;
 
@@ -1012,10 +1009,5 @@ bool dce110_mem_input_construct(
 
 	mem_input110->offsets = *offsets;
 
-	mem_input110->supported_stutter_mode = 0;
-	dal_adapter_service_get_feature_value(as, FEATURE_STUTTER_MODE,
-			&(mem_input110->supported_stutter_mode),
-			sizeof(mem_input110->supported_stutter_mode));
-
 	return true;
 }
diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input.h b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input.h
index 7a521c56e8d9..8edd25ab19a6 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input.h
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input.h
@@ -36,32 +36,9 @@ struct dce110_mem_input_reg_offsets {
 	uint32_t pipe;
 };
 
-enum stutter_mode_type {
-/*	TODO: Clean up these enums, right now only one is being used
- *	STUTTER_MODE_LEGACY = 0X00000001,
- *	STUTTER_MODE_ENHANCED = 0X00000002,
- *	STUTTER_MODE_FID_NBP_STATE = 0X00000004,
- *	STUTTER_MODE_WATERMARK_NBP_STATE = 0X00000008,
- *	STUTTER_MODE_SINGLE_DISPLAY_MODEL = 0X00000010,
- *	STUTTER_MODE_MIXED_DISPLAY_MODEL = 0X00000020,
- *	STUTTER_MODE_DUAL_DMIF_BUFFER = 0X00000040,
- */
-	STUTTER_MODE_NO_DMIF_BUFFER_ALLOCATION = 0X00000080,
-/*
- *	STUTTER_MODE_NO_ADVANCED_REQUEST = 0X00000100,
- *	STUTTER_MODE_NO_LB_RESET = 0X00000200,
- *	STUTTER_MODE_DISABLED = 0X00000400,
- *	STUTTER_MODE_AGGRESSIVE_MARKS = 0X00000800,
- *	STUTTER_MODE_URGENCY = 0X00001000,
- *	STUTTER_MODE_QUAD_DMIF_BUFFER = 0X00002000,
- *	STUTTER_MODE_NOT_USED = 0X00008000
- */
-};
-
 struct dce110_mem_input {
 	struct mem_input base;
 	struct dce110_mem_input_reg_offsets offsets;
-	uint32_t supported_stutter_mode;
 };
 
 bool dce110_mem_input_construct(
diff --git a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input_v.c b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input_v.c
index 0903d3b4913d..78c63680cc0b 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input_v.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce110/dce110_mem_input_v.c
@@ -1071,11 +1071,6 @@ bool dce110_mem_input_v_construct(
 
 	mem_input110->offsets = dce110_mi_v_reg_offsets[0];
 
-	mem_input110->supported_stutter_mode = 0;
-	dal_adapter_service_get_feature_value(as, FEATURE_STUTTER_MODE,
-			&(mem_input110->supported_stutter_mode),
-			sizeof(mem_input110->supported_stutter_mode));
-
 	return true;
 }
 
diff --git a/drivers/gpu/drm/amd/dal/dc/dce80/dce80_mem_input.c b/drivers/gpu/drm/amd/dal/dc/dce80/dce80_mem_input.c
index 5e08a2dfb039..be822d1b5989 100644
--- a/drivers/gpu/drm/amd/dal/dc/dce80/dce80_mem_input.c
+++ b/drivers/gpu/drm/amd/dal/dc/dce80/dce80_mem_input.c
@@ -108,10 +108,6 @@ static void allocate_mem_input(
 	uint32_t value;
 	uint32_t field;
 
-	if (bm80->supported_stutter_mode
-			& STUTTER_MODE_NO_DMIF_BUFFER_ALLOCATION)
-		goto register_underflow_int;
-
 	/*Allocate DMIF buffer*/
 	value = dm_read_reg(mi->ctx, addr);
 	field = get_reg_field_value(
@@ -194,7 +190,10 @@ bool dce80_mem_input_construct(
 	uint32_t inst,
 	const struct dce110_mem_input_reg_offsets *offsets)
 {
-
+	/* supported stutter method
+	 * STUTTER_MODE_ENHANCED
+	 * STUTTER_MODE_QUAD_DMIF_BUFFER
+	 */
 	mem_input80->base.funcs = &dce80_mem_input_funcs;
 	mem_input80->base.ctx = ctx;
 
@@ -202,11 +201,6 @@ bool dce80_mem_input_construct(
 
 	mem_input80->offsets = *offsets;
 
-	mem_input80->supported_stutter_mode = 0;
-	dal_adapter_service_get_feature_value(as, FEATURE_STUTTER_MODE,
-			&(mem_input80->supported_stutter_mode),
-			sizeof(mem_input80->supported_stutter_mode));
-
 	return true;
 }
 
diff --git a/drivers/gpu/drm/amd/dal/dc/inc/hw/mem_input.h b/drivers/gpu/drm/amd/dal/dc/inc/hw/mem_input.h
index c743ae13cdf5..c4a78eefd362 100644
--- a/drivers/gpu/drm/amd/dal/dc/inc/hw/mem_input.h
+++ b/drivers/gpu/drm/amd/dal/dc/inc/hw/mem_input.h
@@ -29,12 +29,19 @@
 #include "include/grph_object_id.h"
 #include "inc/bandwidth_calcs.h"
 
+struct stutter_modes {
+	bool enhanced;
+	bool quad_dmif_buffer;
+	bool watermark_nb_pstate;
+};
+
 struct mem_input {
 	struct mem_input_funcs *funcs;
 	struct dc_context *ctx;
 	struct dc_plane_address request_address;
 	struct dc_plane_address current_address;
 	uint32_t inst;
+	struct stutter_modes stutter_mode;
 };
 
 struct mem_input_funcs {
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 a88c94d0ef45..48484b0de5bb 100644
--- a/drivers/gpu/drm/amd/dal/include/adapter_service_interface.h
+++ b/drivers/gpu/drm/amd/dal/include/adapter_service_interface.h
@@ -149,13 +149,8 @@ enum adapter_feature_id {
 	FEATURE_SET_10_START = FEATURE_DRR_SUPPORT,
 	FEATURE_SET_10_END = FEATURE_SET_10_START + 31,
 
-	/* UInt set, 1 entry: Stutter mode support */
-	FEATURE_STUTTER_MODE = FEATURE_SET_10_END + 1,
-	FEATURE_SET_11_START = FEATURE_STUTTER_MODE,
-	FEATURE_SET_11_END = FEATURE_SET_11_START + 31,
-
 	/* UInt set, 1 entry: Measure PSR setup time */
-	FEATURE_PSR_SETUP_TIME_TEST = FEATURE_SET_11_END + 1,
+	FEATURE_PSR_SETUP_TIME_TEST = FEATURE_SET_10_END + 1,
 	FEATURE_SET_12_START = FEATURE_PSR_SETUP_TIME_TEST,
 	FEATURE_SET_12_END = FEATURE_SET_12_START + 31,
 
@@ -322,14 +317,4 @@ struct adapter_service *dal_adapter_service_create(
 void dal_adapter_service_destroy(
 	struct adapter_service **as);
 
-/* Get the cached value of a given feature */
-bool dal_adapter_service_get_feature_value(struct adapter_service *as,
-	const enum adapter_feature_id feature_id,
-	void *data,
-	uint32_t size);
-
-/* Reports whether driver settings allow requested optimization */
-bool dal_adapter_service_should_optimize(
-		struct adapter_service *as, enum optimization_feature feature);
-
 #endif /* __DAL_ADAPTER_SERVICE_INTERFACE_H__ */
diff --git a/drivers/gpu/drm/amd/dal/include/asic_capability_types.h b/drivers/gpu/drm/amd/dal/include/asic_capability_types.h
index b0915e7f7048..c44dae043599 100644
--- a/drivers/gpu/drm/amd/dal/include/asic_capability_types.h
+++ b/drivers/gpu/drm/amd/dal/include/asic_capability_types.h
@@ -90,7 +90,6 @@ enum asic_data {
 	ASIC_DATA_MC_LATENCY,
 	ASIC_DATA_MC_LATENCY_SLOW,
 	ASIC_DATA_MEMORYTYPE_MULTIPLIER,
-	ASIC_DATA_STUTTERMODE,
 	ASIC_DATA_PATH_NUM_PER_DPMST_CONNECTOR,
 	ASIC_DATA_MAX_UNDERSCAN_PERCENTAGE,
 	ASIC_DATA_VIEWPORT_PIXEL_GRANULARITY,
-- 
2.10.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux