Skip to contentSkip to conversation

drm/amdgpu: add bypass mode for vce3.0

PATCH Eric Huang 3 participants 4 messages Jul 22, 2016 – Jul 27, 2016 5 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 1468861197-7620-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

Eric Huang

author
#2 lore raw

Looks good to me. Reviewed-by: Eric Huang <[email protected]>

Regards,
Eric

Quoted 30 lines · Rex Zhu
Change-Id I68aa5431146b21990a998a777e00139f0478407f
---
  drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 15 +++++++++++++++
  1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +12 -0
index 30e8099..962aa5e 100644
@@ -604,6 +604,18 @@ static int vce_v3_0_process_interrupt(struct amdgpu_device *adev,
  	return 0;
  }
 
+static void vce_v3_set_bypass_mode(struct amdgpu_device *adev, bool enable)
+{
+	u32 tmp = RREG32_SMC(ixGCK_DFS_BYPASS_CNTL);
+
+	if (enable)
+		tmp |= GCK_DFS_BYPASS_CNTL__BYPASSECLK_MASK;
+	else
+		tmp &= ~GCK_DFS_BYPASS_CNTL__BYPASSECLK_MASK;
+
+	WREG32_SMC(ixGCK_DFS_BYPASS_CNTL, tmp);
+}
+
  static int vce_v3_0_set_clockgating_state(void *handle,
  					  enum amd_clockgating_state state)
  {

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_set_clockgating_state(void *handle, · line 631

Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3 -0
@@ -611,6 +623,9 @@ static int vce_v3_0_set_clockgating_state(void *handle,
  	bool enable = (state == AMD_CG_STATE_GATE) ? true : false;
  	int i;
 
+	if (adev->asic_type == CHIP_POLARIS10)
+		vce_v3_set_bypass_mode(adev, enable);
+
  	if (!(adev->cg_flags & AMD_CG_SUPPORT_VCE_MGCG))
  		return 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): [email protected]

#4 lore raw

Please, keep a similar syntax to other functions and to the file name.

"vce_v3_set_bypass_mode" should be "vce_v3_0_set_bypass_mode".

Alexandre Demers

Quoted 42 lines · Eric Huang

Looks good to me. Reviewed-by: Eric Huang <[email protected]>

Regards,
Eric

Quoted 36 lines · Rex Zhu
Change-Id I68aa5431146b21990a998a777e00139f0478407f
---
  drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 15 +++++++++++++++
  1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +12 -0
index 30e8099..962aa5e 100644
@@ -604,6 +604,18 @@ static int vce_v3_0_process_interrupt(struct 
 amdgpu_device *adev,
      return 0;
  }
  +static void vce_v3_set_bypass_mode(struct amdgpu_device *adev, 
 bool enable)
+{
+    u32 tmp = RREG32_SMC(ixGCK_DFS_BYPASS_CNTL);
+
+    if (enable)
+        tmp |= GCK_DFS_BYPASS_CNTL__BYPASSECLK_MASK;
+    else
+        tmp &= ~GCK_DFS_BYPASS_CNTL__BYPASSECLK_MASK;
+
+    WREG32_SMC(ixGCK_DFS_BYPASS_CNTL, tmp);
+}
+
  static int vce_v3_0_set_clockgating_state(void *handle,
                        enum amd_clockgating_state state)
  {
@@ -611,6 +623,9 @@ static int vce_v3_0_set_clockgating_state(void 
 *handle,
      bool enable = (state == AMD_CG_STATE_GATE) ? true : false;
      int i;
  +    if (adev->asic_type == CHIP_POLARIS10)
+        vce_v3_set_bypass_mode(adev, enable);
Quoted 8 lines

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_set_clockgating_state(void · line 630

Quoted 3 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1 -0
+
      if (!(adev->cg_flags & AMD_CG_SUPPORT_VCE_MGCG))
          return 0;

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

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

Reviewed-by Alex Deucher
#5 lore raw
In reply to a message not in the archive
Quoted 22 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Rex Zhu
Sent: Monday, July 18, 2016 1:00 PM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH 1/3] drm/amdgpu: add bypass mode for vce3.0

Change-Id I68aa5431146b21990a998a777e00139f0478407f
---
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0 -0
index 30e8099..962aa5e 100644

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c static int vce_v3_0_process_interrupt(struct · line 609

Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1 -0
@@ -604,6 +604,18 @@ static int vce_v3_0_process_interrupt(struct
 amdgpu_device *adev,
 	return 0;
 }
 
+static void vce_v3_set_bypass_mode(struct amdgpu_device *adev, bool
 enable)

For consistency, please change the function name to:
vce_v3_0_set_bypass_mode()

With that fixed:

Quoted 28 lines
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +11 -0
+{
+	u32 tmp = RREG32_SMC(ixGCK_DFS_BYPASS_CNTL);
+
+	if (enable)
+		tmp |= GCK_DFS_BYPASS_CNTL__BYPASSECLK_MASK;
+	else
+		tmp &= ~GCK_DFS_BYPASS_CNTL__BYPASSECLK_MASK;
+
+	WREG32_SMC(ixGCK_DFS_BYPASS_CNTL, tmp);
+}
+
 static int vce_v3_0_set_clockgating_state(void *handle,
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3 -1
 					  enum amd_clockgating_state state)
 {
@@ -611,6 +623,9 @@ static int vce_v3_0_set_clockgating_state(void
 *handle,
 	bool enable = (state == AMD_CG_STATE_GATE) ? true : false;
 	int i;
 
+	if (adev->asic_type == CHIP_POLARIS10)
+		vce_v3_set_bypass_mode(adev, enable);
+
 	if (!(adev->cg_flags & AMD_CG_SUPPORT_VCE_MGCG))
 		return 0;
 
--

1.9.1

Quoted 4 lines

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

_______________________________________________
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): [email protected]

A message that is not in the archive (sent off-list or not yet received): 1468861197-7620-2-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

author
#8 lore raw

Re: [PATCH 2/3] drm/amd/powerplay: fix issue can't enable vce dpm.

Looks good to me. Reviewed-by: Eric Huang <[email protected]>

Regards,
Eric

Quoted 111 lines · Rex Zhu
Change-Id I4e09b1c1685657c68a1b4a73928bcaf0ac025d7d
---
  .../powerplay/hwmgr/polaris10_clockpowergating.c   | 14 +++++++--
  .../gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c  | 34 +++++++---------------
  .../gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h  |  2 +-
  3 files changed, 22 insertions(+), 28 deletions(-)
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_clockpowergating.c +11 -3
index aeec25c..3d324d8 100644
@@ -131,11 +131,19 @@ int polaris10_phm_powergate_vce(struct pp_hwmgr *hwmgr, bool bgate)
 
  	data->vce_power_gated = bgate;
 
-	if (bgate)
+	if (bgate) {
+		cgs_set_clockgating_state(hwmgr->device,
+				AMD_IP_BLOCK_TYPE_VCE,
+				AMD_CG_STATE_GATE);
+		polaris10_update_vce_dpm(hwmgr, true);
  		polaris10_phm_powerdown_vce(hwmgr);
-	else
+	} else {
  		polaris10_phm_powerup_vce(hwmgr);
-
+		polaris10_update_vce_dpm(hwmgr, false);
+		cgs_set_clockgating_state(hwmgr->device,
+				AMD_IP_BLOCK_TYPE_VCE,
+				AMD_CG_STATE_UNGATE);
+	}
  	return 0;
  }
 
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.c +10 -24
index 5370c0f..ab3151a 100644
@@ -4422,25 +4422,20 @@ int polaris10_update_uvd_dpm(struct pp_hwmgr *hwmgr, bool bgate)
  	return polaris10_enable_disable_uvd_dpm(hwmgr, !bgate);
  }
 
-static int polaris10_update_vce_dpm(struct pp_hwmgr *hwmgr, const void *input)
+int polaris10_update_vce_dpm(struct pp_hwmgr *hwmgr, bool bgate)
  {
-	const struct phm_set_power_state_input *states =
-			(const struct phm_set_power_state_input *)input;
  	struct polaris10_hwmgr *data = (struct polaris10_hwmgr *)(hwmgr->backend);
-	const struct polaris10_power_state *polaris10_nps =
-			cast_const_phw_polaris10_power_state(states->pnew_state);
-	const struct polaris10_power_state *polaris10_cps =
-			cast_const_phw_polaris10_power_state(states->pcurrent_state);
-
  	uint32_t mm_boot_level_offset, mm_boot_level_value;
  	struct phm_ppt_v1_information *table_info =
  			(struct phm_ppt_v1_information *)(hwmgr->pptable);
 
-	if (polaris10_nps->vce_clks.evclk > 0 &&
-	(polaris10_cps == NULL || polaris10_cps->vce_clks.evclk == 0)) {
-
-		data->smc_state_table.VceBootLevel =
+	if (!bgate) {
+		if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
+						PHM_PlatformCaps_StablePState))
+			data->smc_state_table.VceBootLevel =
  				(uint8_t) (table_info->mm_dep_table->count - 1);
+		else
+			data->smc_state_table.VceBootLevel = 0;
 
  		mm_boot_level_offset = data->dpm_table_start +
  				offsetof(SMU74_Discrete_DpmTable, VceBootLevel);
@@ -4453,18 +4448,14 @@ static int polaris10_update_vce_dpm(struct pp_hwmgr *hwmgr, const void *input)
  		cgs_write_ind_register(hwmgr->device,
  				CGS_IND_REG__SMC, mm_boot_level_offset, mm_boot_level_value);
 
-		if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_StablePState)) {
+		if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_StablePState))
  			smum_send_msg_to_smc_with_parameter(hwmgr->smumgr,
  					PPSMC_MSG_VCEDPM_SetEnabledMask,
  					(uint32_t)1 << data->smc_state_table.VceBootLevel);
-
-			polaris10_enable_disable_vce_dpm(hwmgr, true);
-		} else if (polaris10_nps->vce_clks.evclk == 0 &&
-				polaris10_cps != NULL &&
-				polaris10_cps->vce_clks.evclk > 0)
-			polaris10_enable_disable_vce_dpm(hwmgr, false);
  	}
 
+	polaris10_enable_disable_vce_dpm(hwmgr, !bgate);
+
  	return 0;
  }
 
@@ -4651,11 +4642,6 @@ static int polaris10_set_power_state_tasks(struct pp_hwmgr *hwmgr, const void *i
  			"Failed to generate DPM level enabled mask!",
  			result = tmp_result);
 
-	tmp_result = polaris10_update_vce_dpm(hwmgr, input);
-	PP_ASSERT_WITH_CODE((0 == tmp_result),
-			"Failed to update VCE DPM!",
-			result = tmp_result);
-
  	tmp_result = polaris10_update_sclk_threshold(hwmgr);
  	PP_ASSERT_WITH_CODE((0 == tmp_result),
  			"Failed to update SCLK threshold!",
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h +0 -0
index 402f5c0..dabbb5d 100644

drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h int polaris10_hwmgr_init(struct pp_hwmgr *hwmgr); · line 358

Quoted 7 lines
drivers/gpu/drm/amd/powerplay/hwmgr/polaris10_hwmgr.h +1 -1
@@ -353,6 +353,6 @@ int polaris10_hwmgr_init(struct pp_hwmgr *hwmgr);
  int polaris10_update_uvd_dpm(struct pp_hwmgr *hwmgr, bool bgate);
  int polaris10_update_samu_dpm(struct pp_hwmgr *hwmgr, bool bgate);
  int polaris10_enable_disable_vce_dpm(struct pp_hwmgr *hwmgr, bool enable);
-
+int polaris10_update_vce_dpm(struct pp_hwmgr *hwmgr, bool bgate);
  #endif
 

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