Skip to contentSkip to conversation

drm/amdgpu: refine vce3.0 initialize.

PATCH In review Rex Zhu 3 participants 5 messages Jan 9, 2017 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Rex Zhu

author
#0 lore raw

PATCH 1/1 drm/amdgpu: refine vce3.0 initialize.

1. disable vce cg when vce hw initialize.
2. initizlize vce clock to 10KHz.
3: no need to set bypass clock to vce.

Change-Id I18d5c2debc6688be201af8bb85022ac25020bd8f
---
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 18 +++---------------
 drivers/gpu/drm/amd/amdgpu/vi.c       | 32 +++++++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3 -15
index 5fb0b7f..eb99ee6 100644
@@ -223,6 +223,9 @@ static int vce_v3_0_start(struct amdgpu_device *adev)
 	struct amdgpu_ring *ring;
 	int idx, r;
 
+	vce_v3_0_override_vce_clock_gating(adev, true); /* force all clocks on */
+	amdgpu_asic_set_vce_clocks(adev, 10000, 10000);
+
 	ring = &adev->vce.ring[0];
 	WREG32(mmVCE_RB_RPTR, ring->wptr);
 	WREG32(mmVCE_RB_WPTR, ring->wptr);
@@ -701,17 +704,7 @@ static int vce_v3_0_process_interrupt(struct amdgpu_device *adev,
 	return 0;
 }
 
-static void vce_v3_0_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)
@@ -720,11 +713,6 @@ 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) ||
-		(adev->asic_type == CHIP_TONGA) ||
-		(adev->asic_type == CHIP_FIJI))
-		vce_v3_0_set_bypass_mode(adev, enable);
-
 	if (!(adev->cg_flags & AMD_CG_SUPPORT_VCE_MGCG))
 		return 0;
 
drivers/gpu/drm/amd/amdgpu/vi.c +31 -1
index 16ba943..b9924e3 100644
@@ -789,7 +789,37 @@ static int vi_set_uvd_clocks(struct amdgpu_device *adev, u32 vclk, u32 dclk)
 
 static int vi_set_vce_clocks(struct amdgpu_device *adev, u32 evclk, u32 ecclk)
 {
-	/* todo */
+	int r, i;
+	struct atom_clock_dividers dividers;
+	u32 tmp;
+
+	r = amdgpu_atombios_get_clock_dividers(adev,
+					       COMPUTE_GPUCLK_INPUT_FLAG_DEFAULT_GPUCLK,
+					       ecclk, false, &dividers);
+	if (r)
+		return r;
+
+	for (i = 0; i < 100; i++) {
+		if (RREG32_SMC(ixCG_ECLK_STATUS) & CG_ECLK_STATUS__ECLK_STATUS_MASK)
+			break;
+		mdelay(10);
+	}
+	if (i == 100)
+		return -ETIMEDOUT;
+
+	tmp = RREG32_SMC(ixCG_ECLK_CNTL);
+	tmp &= ~(CG_ECLK_CNTL__ECLK_DIR_CNTL_EN_MASK |
+		CG_ECLK_CNTL__ECLK_DIVIDER_MASK);
+	tmp |= dividers.post_divider;
+	WREG32_SMC(ixCG_ECLK_CNTL, tmp);
+
+	for (i = 0; i < 100; i++) {
+		if (RREG32_SMC(ixCG_ECLK_STATUS) & CG_ECLK_STATUS__ECLK_STATUS_MASK)
+			break;
+		mdelay(10);
+	}
+	if (i == 100)
+		return -ETIMEDOUT;
 
 	return 0;
 }
Signature · 6 lines
1.9.1

_______________________________________________
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): 1483968878-1370-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org

#2 lore raw

On my Carrizo, I have to NAK since monitoring the clocks I see GFX and VCE pegged high on a setup with a staging kernel .

Doing a test signal encode I see 1000 fences/sec being handled and GFX_POWER throttles (not idle or full) . I don't see VCE load from SRBM_STATUS2 though ...

Something is up for sure.

I haven't tried HEAD~ (I last tried a 4.9 kernel about 15 commits ago) so I'll try that now.

Tom

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Rex Zhu <[email protected]>
Sent: Monday, January 9, 2017 08:34
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu: refine vce3.0 initialize.

1. disable vce cg when vce hw initialize.
2. initizlize vce clock to 10KHz.
3: no need to set bypass clock to vce.

Change-Id I18d5c2debc6688be201af8bb85022ac25020bd8f
---
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 18 +++---------------
 drivers/gpu/drm/amd/amdgpu/vi.c       | 32 +++++++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +3 -15
index 5fb0b7f..eb99ee6 100644
@@ -223,6 +223,9 @@ static int vce_v3_0_start(struct amdgpu_device *adev)
         struct amdgpu_ring *ring;
         int idx, r;
 
+       vce_v3_0_override_vce_clock_gating(adev, true); /* force all clocks on */
+       amdgpu_asic_set_vce_clocks(adev, 10000, 10000);
+
         ring = &adev->vce.ring[0];
         WREG32(mmVCE_RB_RPTR, ring->wptr);
         WREG32(mmVCE_RB_WPTR, ring->wptr);
@@ -701,17 +704,7 @@ static int vce_v3_0_process_interrupt(struct amdgpu_device *adev,
         return 0;
 }
 
-static void vce_v3_0_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)
@@ -720,11 +713,6 @@ 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) ||
-               (adev->asic_type == CHIP_TONGA) ||
-               (adev->asic_type == CHIP_FIJI))
-               vce_v3_0_set_bypass_mode(adev, enable);
-
         if (!(adev->cg_flags & AMD_CG_SUPPORT_VCE_MGCG))
                 return 0;
 
drivers/gpu/drm/amd/amdgpu/vi.c +31 -1
index 16ba943..b9924e3 100644
@@ -789,7 +789,37 @@ static int vi_set_uvd_clocks(struct amdgpu_device *adev, u32 vclk, u32 dclk)
 
 static int vi_set_vce_clocks(struct amdgpu_device *adev, u32 evclk, u32 ecclk)
 {
-       /* todo */
+       int r, i;
+       struct atom_clock_dividers dividers;
+       u32 tmp;
+
+       r = amdgpu_atombios_get_clock_dividers(adev,
+                                              COMPUTE_GPUCLK_INPUT_FLAG_DEFAULT_GPUCLK,
+                                              ecclk, false, &dividers);
+       if (r)
+               return r;
+
+       for (i = 0; i < 100; i++) {
+               if (RREG32_SMC(ixCG_ECLK_STATUS) & CG_ECLK_STATUS__ECLK_STATUS_MASK)
+                       break;
+               mdelay(10);
+       }
+       if (i == 100)
+               return -ETIMEDOUT;
+
+       tmp = RREG32_SMC(ixCG_ECLK_CNTL);
+       tmp &= ~(CG_ECLK_CNTL__ECLK_DIR_CNTL_EN_MASK |
+               CG_ECLK_CNTL__ECLK_DIVIDER_MASK);
+       tmp |= dividers.post_divider;
+       WREG32_SMC(ixCG_ECLK_CNTL, tmp);
+
+       for (i = 0; i < 100; i++) {
+               if (RREG32_SMC(ixCG_ECLK_STATUS) & CG_ECLK_STATUS__ECLK_STATUS_MASK)
+                       break;
+               mdelay(10);
+       }
+       if (i == 100)
+               return -ETIMEDOUT;
 
         return 0;
 }

--
1.9.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
amd-gfx Info Page - lists.freedesktop.org<https://lists.freedesktop.org/mailman/listinfo/amd-gfx>
lists.freedesktop.org
To see the collection of prior postings to the list, visit the amd-gfx Archives. Using amd-gfx: To post a message to all the list members, send email ...

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

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

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Rex Zhu
Sent: Monday, January 09, 2017 8:35 AM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu: refine vce3.0 initialize.

Quoted 6 lines

1. disable vce cg when vce hw initialize.
2. initizlize vce clock to 10KHz.
3: no need to set bypass clock to vce.

Change-Id I18d5c2debc6688be201af8bb85022ac25020bd8f

Does this patch fix this bug by any chance?

https://bugzilla.kernel.org/show_bug.cgi?id=191281

Alex

Quoted 108 lines
---
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 18 +++---------------
 drivers/gpu/drm/amd/amdgpu/vi.c       | 32
+++++++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1 -0
index 5fb0b7f..eb99ee6 100644
@@ -223,6 +223,9 @@ static int vce_v3_0_start(struct amdgpu_device
 *adev)
 	struct amdgpu_ring *ring;
 	int idx, r;
 
+	vce_v3_0_override_vce_clock_gating(adev, true); /* force all clocks

on */

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +2 -10
+	amdgpu_asic_set_vce_clocks(adev, 10000, 10000);
+
 	ring = &adev->vce.ring[0];
 	WREG32(mmVCE_RB_RPTR, ring->wptr);
 	WREG32(mmVCE_RB_WPTR, ring->wptr);
@@ -701,17 +704,7 @@ static int vce_v3_0_process_interrupt(struct
 amdgpu_device *adev,
 	return 0;
 }
 
-static void vce_v3_0_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,

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +0 -5
 					  enum amd_clockgating_state state)
@@ -720,11 +713,6 @@ 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) ||
-		(adev->asic_type == CHIP_TONGA) ||
-		(adev->asic_type == CHIP_FIJI))
-		vce_v3_0_set_bypass_mode(adev, enable);
-
 	if (!(adev->cg_flags & AMD_CG_SUPPORT_VCE_MGCG))
 		return 0;
drivers/gpu/drm/amd/amdgpu/vi.c +12 -1
index 16ba943..b9924e3 100644
@@ -789,7 +789,37 @@ static int vi_set_uvd_clocks(struct amdgpu_device
 *adev, u32 vclk, u32 dclk)
 
 static int vi_set_vce_clocks(struct amdgpu_device *adev, u32 evclk, u32
 ecclk)
 {
-	/* todo */
+	int r, i;
+	struct atom_clock_dividers dividers;
+	u32 tmp;
+
+	r = amdgpu_atombios_get_clock_dividers(adev,
+
 COMPUTE_GPUCLK_INPUT_FLAG_DEFAULT_GPUCLK,
+					       ecclk, false, &dividers);
+	if (r)
+		return r;
+
+	for (i = 0; i < 100; i++) {
+		if (RREG32_SMC(ixCG_ECLK_STATUS) &

CG_ECLK_STATUS__ECLK_STATUS_MASK)

drivers/gpu/drm/amd/amdgpu/vi.c +14 -0
+			break;
+		mdelay(10);
+	}
+	if (i == 100)
+		return -ETIMEDOUT;
+
+	tmp = RREG32_SMC(ixCG_ECLK_CNTL);
+	tmp &= ~(CG_ECLK_CNTL__ECLK_DIR_CNTL_EN_MASK |
+		CG_ECLK_CNTL__ECLK_DIVIDER_MASK);
+	tmp |= dividers.post_divider;
+	WREG32_SMC(ixCG_ECLK_CNTL, tmp);
+
+	for (i = 0; i < 100; i++) {
+		if (RREG32_SMC(ixCG_ECLK_STATUS) &

CG_ECLK_STATUS__ECLK_STATUS_MASK)

drivers/gpu/drm/amd/amdgpu/vi.c +5 -1
+			break;
+		mdelay(10);
+	}
+	if (i == 100)
+		return -ETIMEDOUT;
 
 	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): BN6PR12MB1652DFF695E7EA9413F49C27F7640-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org

Reviewed-by Alex Deucher
#5 lore raw

Just a heads up there is a CG/PG regression. On the tip of 4.7 I can encode with cg/pg disabled but with it enabled it locks up.

I'll try to bisect.

Tom

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Deucher, Alexander <[email protected]>
Sent: Monday, January 9, 2017 09:34
To: Zhu, Rex; [email protected]
Cc: Zhu, Rex
Subject: RE: [PATCH] drm/amdgpu: refine vce3.0 initialize.

Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Rex Zhu
Sent: Monday, January 09, 2017 8:35 AM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu: refine vce3.0 initialize.

Quoted 6 lines

1. disable vce cg when vce hw initialize.
2. initizlize vce clock to 10KHz.
3: no need to set bypass clock to vce.

Change-Id I18d5c2debc6688be201af8bb85022ac25020bd8f

Does this patch fix this bug by any chance?

https://bugzilla.kernel.org/show_bug.cgi?id=191281

Alex

Quoted 108 lines
---
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 18 +++---------------
 drivers/gpu/drm/amd/amdgpu/vi.c       | 32
+++++++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1 -0
index 5fb0b7f..eb99ee6 100644
@@ -223,6 +223,9 @@ static int vce_v3_0_start(struct amdgpu_device
 *adev)
       struct amdgpu_ring *ring;
       int idx, r;
 
+     vce_v3_0_override_vce_clock_gating(adev, true); /* force all clocks

on */

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +2 -10
+     amdgpu_asic_set_vce_clocks(adev, 10000, 10000);
+
       ring = &adev->vce.ring[0];
       WREG32(mmVCE_RB_RPTR, ring->wptr);
       WREG32(mmVCE_RB_WPTR, ring->wptr);
@@ -701,17 +704,7 @@ static int vce_v3_0_process_interrupt(struct
 amdgpu_device *adev,
       return 0;
 }
 
-static void vce_v3_0_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 +0 -5
@@ -720,11 +713,6 @@ 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) ||
-             (adev->asic_type == CHIP_TONGA) ||
-             (adev->asic_type == CHIP_FIJI))
-             vce_v3_0_set_bypass_mode(adev, enable);
-
       if (!(adev->cg_flags & AMD_CG_SUPPORT_VCE_MGCG))
               return 0;
drivers/gpu/drm/amd/amdgpu/vi.c +12 -1
index 16ba943..b9924e3 100644
@@ -789,7 +789,37 @@ static int vi_set_uvd_clocks(struct amdgpu_device
 *adev, u32 vclk, u32 dclk)
 
 static int vi_set_vce_clocks(struct amdgpu_device *adev, u32 evclk, u32
 ecclk)
 {
-     /* todo */
+     int r, i;
+     struct atom_clock_dividers dividers;
+     u32 tmp;
+
+     r = amdgpu_atombios_get_clock_dividers(adev,
+
 COMPUTE_GPUCLK_INPUT_FLAG_DEFAULT_GPUCLK,
+                                            ecclk, false, &dividers);
+     if (r)
+             return r;
+
+     for (i = 0; i < 100; i++) {
+             if (RREG32_SMC(ixCG_ECLK_STATUS) &

CG_ECLK_STATUS__ECLK_STATUS_MASK)

drivers/gpu/drm/amd/amdgpu/vi.c +14 -0
+                     break;
+             mdelay(10);
+     }
+     if (i == 100)
+             return -ETIMEDOUT;
+
+     tmp = RREG32_SMC(ixCG_ECLK_CNTL);
+     tmp &= ~(CG_ECLK_CNTL__ECLK_DIR_CNTL_EN_MASK |
+             CG_ECLK_CNTL__ECLK_DIVIDER_MASK);
+     tmp |= dividers.post_divider;
+     WREG32_SMC(ixCG_ECLK_CNTL, tmp);
+
+     for (i = 0; i < 100; i++) {
+             if (RREG32_SMC(ixCG_ECLK_STATUS) &

CG_ECLK_STATUS__ECLK_STATUS_MASK)

drivers/gpu/drm/amd/amdgpu/vi.c +5 -1
+                     break;
+             mdelay(10);
+     }
+     if (i == 100)
+             return -ETIMEDOUT;
 
       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

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

Reviewed-by Alex Deucher
#7 lore raw

I suspect the patch I NAK'ed on 4.9 "worked but with odd clocks" because it never engaged PG properly. I'm finding on 4.9 and 4.7 if PG is enabled VCE doesn't wake properly.

I've found a "good commit" on 4.7 so I'll continue bisecting.

Tom

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of StDenis, Tom <[email protected]>
Sent: Monday, January 9, 2017 11:58
To: Deucher, Alexander; Zhu, Rex; [email protected]
Subject: Re: [PATCH] drm/amdgpu: refine vce3.0 initialize.

Just a heads up there is a CG/PG regression. On the tip of 4.7 I can encode with cg/pg disabled but with it enabled it locks up.

I'll try to bisect.

Tom

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Deucher, Alexander <[email protected]>
Sent: Monday, January 9, 2017 09:34
To: Zhu, Rex; [email protected]
Cc: Zhu, Rex
Subject: RE: [PATCH] drm/amdgpu: refine vce3.0 initialize.

Quoted 8 lines

-----Original Message-----
From: amd-gfx [mailto:amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org] On Behalf Of Rex Zhu
Sent: Monday, January 09, 2017 8:35 AM
To: [email protected]
Cc: Zhu, Rex
Subject: [PATCH] drm/amdgpu: refine vce3.0 initialize.

Quoted 6 lines

1. disable vce cg when vce hw initialize.
2. initizlize vce clock to 10KHz.
3: no need to set bypass clock to vce.

Change-Id I18d5c2debc6688be201af8bb85022ac25020bd8f

Does this patch fix this bug by any chance?

https://bugzilla.kernel.org/show_bug.cgi?id=191281

Alex

Quoted 108 lines
---
 drivers/gpu/drm/amd/amdgpu/vce_v3_0.c | 18 +++---------------
 drivers/gpu/drm/amd/amdgpu/vi.c       | 32
+++++++++++++++++++++++++++++++-
 2 files changed, 34 insertions(+), 16 deletions(-)
drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +1 -0
index 5fb0b7f..eb99ee6 100644
@@ -223,6 +223,9 @@ static int vce_v3_0_start(struct amdgpu_device
 *adev)
       struct amdgpu_ring *ring;
       int idx, r;
 
+     vce_v3_0_override_vce_clock_gating(adev, true); /* force all clocks

on */

drivers/gpu/drm/amd/amdgpu/vce_v3_0.c +2 -10
+     amdgpu_asic_set_vce_clocks(adev, 10000, 10000);
+
       ring = &adev->vce.ring[0];
       WREG32(mmVCE_RB_RPTR, ring->wptr);
       WREG32(mmVCE_RB_WPTR, ring->wptr);
@@ -701,17 +704,7 @@ static int vce_v3_0_process_interrupt(struct
 amdgpu_device *adev,
       return 0;
 }
 
-static void vce_v3_0_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 +0 -5
@@ -720,11 +713,6 @@ 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) ||
-             (adev->asic_type == CHIP_TONGA) ||
-             (adev->asic_type == CHIP_FIJI))
-             vce_v3_0_set_bypass_mode(adev, enable);
-
       if (!(adev->cg_flags & AMD_CG_SUPPORT_VCE_MGCG))
               return 0;
drivers/gpu/drm/amd/amdgpu/vi.c +12 -1
index 16ba943..b9924e3 100644
@@ -789,7 +789,37 @@ static int vi_set_uvd_clocks(struct amdgpu_device
 *adev, u32 vclk, u32 dclk)
 
 static int vi_set_vce_clocks(struct amdgpu_device *adev, u32 evclk, u32
 ecclk)
 {
-     /* todo */
+     int r, i;
+     struct atom_clock_dividers dividers;
+     u32 tmp;
+
+     r = amdgpu_atombios_get_clock_dividers(adev,
+
 COMPUTE_GPUCLK_INPUT_FLAG_DEFAULT_GPUCLK,
+                                            ecclk, false, &dividers);
+     if (r)
+             return r;
+
+     for (i = 0; i < 100; i++) {
+             if (RREG32_SMC(ixCG_ECLK_STATUS) &

CG_ECLK_STATUS__ECLK_STATUS_MASK)

drivers/gpu/drm/amd/amdgpu/vi.c +14 -0
+                     break;
+             mdelay(10);
+     }
+     if (i == 100)
+             return -ETIMEDOUT;
+
+     tmp = RREG32_SMC(ixCG_ECLK_CNTL);
+     tmp &= ~(CG_ECLK_CNTL__ECLK_DIR_CNTL_EN_MASK |
+             CG_ECLK_CNTL__ECLK_DIVIDER_MASK);
+     tmp |= dividers.post_divider;
+     WREG32_SMC(ixCG_ECLK_CNTL, tmp);
+
+     for (i = 0; i < 100; i++) {
+             if (RREG32_SMC(ixCG_ECLK_STATUS) &

CG_ECLK_STATUS__ECLK_STATUS_MASK)

drivers/gpu/drm/amd/amdgpu/vi.c +5 -1
+                     break;
+             mdelay(10);
+     }
+     if (i == 100)
+             return -ETIMEDOUT;
 
       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

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