aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRex Zhu <Rex.Zhu@amd.com>2016-10-12 03:13:29 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-10-25 14:38:39 -0400
commit0d8de7ca0b01332c404d3b5877db89727618c3d0 (patch)
treecc59a975a2e41ad8dee9a651dee7cbb016acdd4c /drivers
parentcf0978819cf78cef8d36ca39cb242dde4731d338 (diff)
drm/amdgpu: use same vce state definition in dpm and powerplay
Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h28
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/ci_dpm.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/kv_dpm.c2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/si_dpm.c2
-rw-r--r--drivers/gpu/drm/amd/include/amd_shared.h23
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c4
-rw-r--r--drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c2
-rw-r--r--drivers/gpu/drm/amd/powerplay/inc/hwmgr.h16
-rw-r--r--drivers/gpu/drm/amd/powerplay/inc/power_state.h9
11 files changed, 36 insertions, 56 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
index 14f57d9915e3..4f8d3a5a682f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.c
@@ -554,7 +554,7 @@ int amdgpu_parse_extended_power_table(struct amdgpu_device *adev)
554 ((u8 *)entry + sizeof(ATOM_PPLIB_VCE_Clock_Voltage_Limit_Record)); 554 ((u8 *)entry + sizeof(ATOM_PPLIB_VCE_Clock_Voltage_Limit_Record));
555 } 555 }
556 for (i = 0; i < states->numEntries; i++) { 556 for (i = 0; i < states->numEntries; i++) {
557 if (i >= AMDGPU_MAX_VCE_LEVELS) 557 if (i >= AMD_MAX_VCE_LEVELS)
558 break; 558 break;
559 vce_clk = (VCEClockInfo *) 559 vce_clk = (VCEClockInfo *)
560 ((u8 *)&array->entries[0] + 560 ((u8 *)&array->entries[0] +
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h
index d06496d3e08e..68dac0c569fd 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_dpm.h
@@ -52,17 +52,6 @@ enum amdgpu_dpm_event_src {
52 AMDGPU_DPM_EVENT_SRC_DIGIAL_OR_EXTERNAL = 4 52 AMDGPU_DPM_EVENT_SRC_DIGIAL_OR_EXTERNAL = 4
53}; 53};
54 54
55#define AMDGPU_MAX_VCE_LEVELS 6
56
57enum amdgpu_vce_level {
58 AMDGPU_VCE_LEVEL_AC_ALL = 0, /* AC, All cases */
59 AMDGPU_VCE_LEVEL_DC_EE = 1, /* DC, entropy encoding */
60 AMDGPU_VCE_LEVEL_DC_LL_LOW = 2, /* DC, low latency queue, res <= 720 */
61 AMDGPU_VCE_LEVEL_DC_LL_HIGH = 3, /* DC, low latency queue, 1080 >= res > 720 */
62 AMDGPU_VCE_LEVEL_DC_GP_LOW = 4, /* DC, general purpose queue, res <= 720 */
63 AMDGPU_VCE_LEVEL_DC_GP_HIGH = 5, /* DC, general purpose queue, 1080 >= res > 720 */
64};
65
66struct amdgpu_ps { 55struct amdgpu_ps {
67 u32 caps; /* vbios flags */ 56 u32 caps; /* vbios flags */
68 u32 class; /* vbios flags */ 57 u32 class; /* vbios flags */
@@ -74,7 +63,7 @@ struct amdgpu_ps {
74 u32 evclk; 63 u32 evclk;
75 u32 ecclk; 64 u32 ecclk;
76 bool vce_active; 65 bool vce_active;
77 enum amdgpu_vce_level vce_level; 66 enum amd_vce_level vce_level;
78 /* asic priv */ 67 /* asic priv */
79 void *ps_priv; 68 void *ps_priv;
80}; 69};
@@ -257,17 +246,6 @@ enum amdgpu_dpm_forced_level {
257 AMDGPU_DPM_FORCED_LEVEL_MANUAL = 3, 246 AMDGPU_DPM_FORCED_LEVEL_MANUAL = 3,
258}; 247};
259 248
260struct amdgpu_vce_state {
261 /* vce clocks */
262 u32 evclk;
263 u32 ecclk;
264 /* gpu clocks */
265 u32 sclk;
266 u32 mclk;
267 u8 clk_idx;
268 u8 pstate;
269};
270
271struct amdgpu_dpm_funcs { 249struct amdgpu_dpm_funcs {
272 int (*get_temperature)(struct amdgpu_device *adev); 250 int (*get_temperature)(struct amdgpu_device *adev);
273 int (*pre_set_power_state)(struct amdgpu_device *adev); 251 int (*pre_set_power_state)(struct amdgpu_device *adev);
@@ -409,8 +387,8 @@ struct amdgpu_dpm {
409 /* default uvd power state */ 387 /* default uvd power state */
410 struct amdgpu_ps *uvd_ps; 388 struct amdgpu_ps *uvd_ps;
411 /* vce requirements */ 389 /* vce requirements */
412 struct amdgpu_vce_state vce_states[AMDGPU_MAX_VCE_LEVELS]; 390 struct amd_vce_state vce_states[AMD_MAX_VCE_LEVELS];
413 enum amdgpu_vce_level vce_level; 391 enum amd_vce_level vce_level;
414 enum amd_pm_state_type state; 392 enum amd_pm_state_type state;
415 enum amd_pm_state_type user_state; 393 enum amd_pm_state_type user_state;
416 u32 platform_caps; 394 u32 platform_caps;
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index accc908bdc88..4656ad697154 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -1135,7 +1135,7 @@ void amdgpu_dpm_enable_vce(struct amdgpu_device *adev, bool enable)
1135 mutex_lock(&adev->pm.mutex); 1135 mutex_lock(&adev->pm.mutex);
1136 adev->pm.dpm.vce_active = true; 1136 adev->pm.dpm.vce_active = true;
1137 /* XXX select vce level based on ring/task */ 1137 /* XXX select vce level based on ring/task */
1138 adev->pm.dpm.vce_level = AMDGPU_VCE_LEVEL_AC_ALL; 1138 adev->pm.dpm.vce_level = AMD_VCE_LEVEL_AC_ALL;
1139 mutex_unlock(&adev->pm.mutex); 1139 mutex_unlock(&adev->pm.mutex);
1140 } else { 1140 } else {
1141 mutex_lock(&adev->pm.mutex); 1141 mutex_lock(&adev->pm.mutex);
diff --git a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
index 1d8c375a3561..dc3196e13256 100644
--- a/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/ci_dpm.c
@@ -5689,7 +5689,7 @@ static int ci_parse_power_table(struct amdgpu_device *adev)
5689 adev->pm.dpm.num_ps = state_array->ucNumEntries; 5689 adev->pm.dpm.num_ps = state_array->ucNumEntries;
5690 5690
5691 /* fill in the vce power states */ 5691 /* fill in the vce power states */
5692 for (i = 0; i < AMDGPU_MAX_VCE_LEVELS; i++) { 5692 for (i = 0; i < AMD_MAX_VCE_LEVELS; i++) {
5693 u32 sclk, mclk; 5693 u32 sclk, mclk;
5694 clock_array_index = adev->pm.dpm.vce_states[i].clk_idx; 5694 clock_array_index = adev->pm.dpm.vce_states[i].clk_idx;
5695 clock_info = (union pplib_clock_info *) 5695 clock_info = (union pplib_clock_info *)
diff --git a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
index f8618a3881a8..a03690abe38d 100644
--- a/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/kv_dpm.c
@@ -2796,7 +2796,7 @@ static int kv_parse_power_table(struct amdgpu_device *adev)
2796 adev->pm.dpm.num_ps = state_array->ucNumEntries; 2796 adev->pm.dpm.num_ps = state_array->ucNumEntries;
2797 2797
2798 /* fill in the vce power states */ 2798 /* fill in the vce power states */
2799 for (i = 0; i < AMDGPU_MAX_VCE_LEVELS; i++) { 2799 for (i = 0; i < AMD_MAX_VCE_LEVELS; i++) {
2800 u32 sclk; 2800 u32 sclk;
2801 clock_array_index = adev->pm.dpm.vce_states[i].clk_idx; 2801 clock_array_index = adev->pm.dpm.vce_states[i].clk_idx;
2802 clock_info = (union pplib_clock_info *) 2802 clock_info = (union pplib_clock_info *)
diff --git a/drivers/gpu/drm/amd/amdgpu/si_dpm.c b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
index 3de7bca5854b..15f9ca55bba9 100644
--- a/drivers/gpu/drm/amd/amdgpu/si_dpm.c
+++ b/drivers/gpu/drm/amd/amdgpu/si_dpm.c
@@ -7320,7 +7320,7 @@ static int si_parse_power_table(struct amdgpu_device *adev)
7320 adev->pm.dpm.num_ps = state_array->ucNumEntries; 7320 adev->pm.dpm.num_ps = state_array->ucNumEntries;
7321 7321
7322 /* fill in the vce power states */ 7322 /* fill in the vce power states */
7323 for (i = 0; i < AMDGPU_MAX_VCE_LEVELS; i++) { 7323 for (i = 0; i < AMD_MAX_VCE_LEVELS; i++) {
7324 u32 sclk, mclk; 7324 u32 sclk, mclk;
7325 clock_array_index = adev->pm.dpm.vce_states[i].clk_idx; 7325 clock_array_index = adev->pm.dpm.vce_states[i].clk_idx;
7326 clock_info = (union pplib_clock_info *) 7326 clock_info = (union pplib_clock_info *)
diff --git a/drivers/gpu/drm/amd/include/amd_shared.h b/drivers/gpu/drm/amd/include/amd_shared.h
index bec8125bceb0..d1986276dbbd 100644
--- a/drivers/gpu/drm/amd/include/amd_shared.h
+++ b/drivers/gpu/drm/amd/include/amd_shared.h
@@ -84,6 +84,29 @@ enum amd_powergating_state {
84 AMD_PG_STATE_UNGATE, 84 AMD_PG_STATE_UNGATE,
85}; 85};
86 86
87struct amd_vce_state {
88 /* vce clocks */
89 u32 evclk;
90 u32 ecclk;
91 /* gpu clocks */
92 u32 sclk;
93 u32 mclk;
94 u8 clk_idx;
95 u8 pstate;
96};
97
98
99#define AMD_MAX_VCE_LEVELS 6
100
101enum amd_vce_level {
102 AMD_VCE_LEVEL_AC_ALL = 0, /* AC, All cases */
103 AMD_VCE_LEVEL_DC_EE = 1, /* DC, entropy encoding */
104 AMD_VCE_LEVEL_DC_LL_LOW = 2, /* DC, low latency queue, res <= 720 */
105 AMD_VCE_LEVEL_DC_LL_HIGH = 3, /* DC, low latency queue, 1080 >= res > 720 */
106 AMD_VCE_LEVEL_DC_GP_LOW = 4, /* DC, general purpose queue, res <= 720 */
107 AMD_VCE_LEVEL_DC_GP_HIGH = 5, /* DC, general purpose queue, 1080 >= res > 720 */
108};
109
87/* CG flags */ 110/* CG flags */
88#define AMD_CG_SUPPORT_GFX_MGCG (1 << 0) 111#define AMD_CG_SUPPORT_GFX_MGCG (1 << 0)
89#define AMD_CG_SUPPORT_GFX_MGLS (1 << 1) 112#define AMD_CG_SUPPORT_GFX_MGLS (1 << 1)
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c b/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c
index 155cd0dfe0c5..baf0f3d4c2f0 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c
@@ -1211,7 +1211,7 @@ static int ppt_get_num_of_vce_state_table_entries_v1_0(struct pp_hwmgr *hwmgr)
1211} 1211}
1212 1212
1213static int ppt_get_vce_state_table_entry_v1_0(struct pp_hwmgr *hwmgr, uint32_t i, 1213static int ppt_get_vce_state_table_entry_v1_0(struct pp_hwmgr *hwmgr, uint32_t i,
1214 struct pp_vce_state *vce_state, void **clock_info, uint32_t *flag) 1214 struct amd_vce_state *vce_state, void **clock_info, uint32_t *flag)
1215{ 1215{
1216 const ATOM_Tonga_VCE_State_Record *vce_state_record; 1216 const ATOM_Tonga_VCE_State_Record *vce_state_record;
1217 ATOM_Tonga_SCLK_Dependency_Record *sclk_dep_record; 1217 ATOM_Tonga_SCLK_Dependency_Record *sclk_dep_record;
@@ -1315,7 +1315,7 @@ int get_powerplay_table_entry_v1_0(struct pp_hwmgr *hwmgr,
1315 1315
1316 hwmgr->num_vce_state_tables = i = ppt_get_num_of_vce_state_table_entries_v1_0(hwmgr); 1316 hwmgr->num_vce_state_tables = i = ppt_get_num_of_vce_state_table_entries_v1_0(hwmgr);
1317 1317
1318 if ((i != 0) && (i <= PP_MAX_VCE_LEVELS)) { 1318 if ((i != 0) && (i <= AMD_MAX_VCE_LEVELS)) {
1319 for (j = 0; j < i; j++) 1319 for (j = 0; j < i; j++)
1320 ppt_get_vce_state_table_entry_v1_0(hwmgr, j, &(hwmgr->vce_states[j]), NULL, &flags); 1320 ppt_get_vce_state_table_entry_v1_0(hwmgr, j, &(hwmgr->vce_states[j]), NULL, &flags);
1321 } 1321 }
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c b/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c
index bd1f19010315..a4e9cf429e62 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/processpptables.c
@@ -1523,7 +1523,7 @@ static int get_number_of_vce_state_table_entries(
1523 1523
1524static int get_vce_state_table_entry(struct pp_hwmgr *hwmgr, 1524static int get_vce_state_table_entry(struct pp_hwmgr *hwmgr,
1525 unsigned long i, 1525 unsigned long i,
1526 struct pp_vce_state *vce_state, 1526 struct amd_vce_state *vce_state,
1527 void **clock_info, 1527 void **clock_info,
1528 unsigned long *flag) 1528 unsigned long *flag)
1529{ 1529{
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
index 4f0fedd1e9d3..e38b999e3235 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
@@ -367,7 +367,7 @@ struct pp_table_func {
367 int (*pptable_get_vce_state_table_entry)( 367 int (*pptable_get_vce_state_table_entry)(
368 struct pp_hwmgr *hwmgr, 368 struct pp_hwmgr *hwmgr,
369 unsigned long i, 369 unsigned long i,
370 struct pp_vce_state *vce_state, 370 struct amd_vce_state *vce_state,
371 void **clock_info, 371 void **clock_info,
372 unsigned long *flag); 372 unsigned long *flag);
373}; 373};
@@ -586,18 +586,6 @@ struct phm_microcode_version_info {
586 uint32_t NB; 586 uint32_t NB;
587}; 587};
588 588
589#define PP_MAX_VCE_LEVELS 6
590
591enum PP_VCE_LEVEL {
592 PP_VCE_LEVEL_AC_ALL = 0, /* AC, All cases */
593 PP_VCE_LEVEL_DC_EE = 1, /* DC, entropy encoding */
594 PP_VCE_LEVEL_DC_LL_LOW = 2, /* DC, low latency queue, res <= 720 */
595 PP_VCE_LEVEL_DC_LL_HIGH = 3, /* DC, low latency queue, 1080 >= res > 720 */
596 PP_VCE_LEVEL_DC_GP_LOW = 4, /* DC, general purpose queue, res <= 720 */
597 PP_VCE_LEVEL_DC_GP_HIGH = 5, /* DC, general purpose queue, 1080 >= res > 720 */
598};
599
600
601enum PP_TABLE_VERSION { 589enum PP_TABLE_VERSION {
602 PP_TABLE_V0 = 0, 590 PP_TABLE_V0 = 0,
603 PP_TABLE_V1, 591 PP_TABLE_V1,
@@ -620,7 +608,7 @@ struct pp_hwmgr {
620 void *hardcode_pp_table; 608 void *hardcode_pp_table;
621 bool need_pp_table_upload; 609 bool need_pp_table_upload;
622 610
623 struct pp_vce_state vce_states[PP_MAX_VCE_LEVELS]; 611 struct amd_vce_state vce_states[AMD_MAX_VCE_LEVELS];
624 uint32_t num_vce_state_tables; 612 uint32_t num_vce_state_tables;
625 613
626 enum amd_dpm_forced_level dpm_level; 614 enum amd_dpm_forced_level dpm_level;
diff --git a/drivers/gpu/drm/amd/powerplay/inc/power_state.h b/drivers/gpu/drm/amd/powerplay/inc/power_state.h
index 9ceaed9ac52a..827860fffe78 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/power_state.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/power_state.h
@@ -156,15 +156,6 @@ struct pp_power_state {
156 struct pp_hw_power_state hardware; 156 struct pp_hw_power_state hardware;
157}; 157};
158 158
159
160/*Structure to hold a VCE state entry*/
161struct pp_vce_state {
162 uint32_t evclk;
163 uint32_t ecclk;
164 uint32_t sclk;
165 uint32_t mclk;
166};
167
168enum PP_MMProfilingState { 159enum PP_MMProfilingState {
169 PP_MMProfilingState_NA = 0, 160 PP_MMProfilingState_NA = 0,
170 PP_MMProfilingState_Started, 161 PP_MMProfilingState_Started,