amd-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/amd/amdgpu: specify the power strategy for vcn use
@ 2020-11-03  8:07 Kenneth Feng
  2020-11-03  8:19 ` Wang, Kevin(Yang)
  0 siblings, 1 reply; 2+ messages in thread
From: Kenneth Feng @ 2020-11-03  8:07 UTC (permalink / raw)
  To: amd-gfx; +Cc: Kenneth Feng

The power/performance control strategy is specific for vcn use case.
Then this can optimize the power/performance when the workload is on vcn.

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
index 0145504e408b..2c3e111bab43 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
@@ -361,6 +361,8 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
 		amdgpu_gfx_off_ctrl(adev, true);
 		amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
 		       AMD_PG_STATE_GATE);
+		amdgpu_dpm_switch_power_profile(adev, PP_SMC_POWER_PROFILE_VIDEO,
+				false);
 	} else {
 		schedule_delayed_work(&adev->vcn.idle_work, VCN_IDLE_TIMEOUT);
 	}
@@ -372,8 +374,11 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)
 
 	atomic_inc(&adev->vcn.total_submission_cnt);
 
-	if (!cancel_delayed_work_sync(&adev->vcn.idle_work))
+	if (!cancel_delayed_work_sync(&adev->vcn.idle_work)) {
 		amdgpu_gfx_off_ctrl(adev, false);
+		amdgpu_dpm_switch_power_profile(adev, PP_SMC_POWER_PROFILE_VIDEO,
+				true);
+	}
 
 	mutex_lock(&adev->vcn.vcn_pg_lock);
 	amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drm/amd/amdgpu: specify the power strategy for vcn use
  2020-11-03  8:07 [PATCH] drm/amd/amdgpu: specify the power strategy for vcn use Kenneth Feng
@ 2020-11-03  8:19 ` Wang, Kevin(Yang)
  0 siblings, 0 replies; 2+ messages in thread
From: Wang, Kevin(Yang) @ 2020-11-03  8:19 UTC (permalink / raw)
  To: Feng, Kenneth, amd-gfx


[-- Attachment #1.1: Type: text/plain, Size: 2755 bytes --]

comment inline.

________________________________
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Kenneth Feng <kenneth.feng@amd.com>
Sent: Tuesday, November 3, 2020 4:07 PM
To: amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
Cc: Feng, Kenneth <Kenneth.Feng@amd.com>
Subject: [PATCH] drm/amd/amdgpu: specify the power strategy for vcn use

The power/performance control strategy is specific for vcn use case.
Then this can optimize the power/performance when the workload is on vcn.

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
index 0145504e408b..2c3e111bab43 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
@@ -361,6 +361,8 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
                 amdgpu_gfx_off_ctrl(adev, true);
                 amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
                        AMD_PG_STATE_GATE);
+               amdgpu_dpm_switch_power_profile(adev, PP_SMC_POWER_PROFILE_VIDEO,
+                               false);
[kevin]:
we'd better to check the return value here, if we really don't care the result, we can print a warning log for debug later.

the patch is:
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>

         } else {
                 schedule_delayed_work(&adev->vcn.idle_work, VCN_IDLE_TIMEOUT);
         }
@@ -372,8 +374,11 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)

         atomic_inc(&adev->vcn.total_submission_cnt);

-       if (!cancel_delayed_work_sync(&adev->vcn.idle_work))
+       if (!cancel_delayed_work_sync(&adev->vcn.idle_work)) {
                 amdgpu_gfx_off_ctrl(adev, false);
+               amdgpu_dpm_switch_power_profile(adev, PP_SMC_POWER_PROFILE_VIDEO,
+                               true);
+       }

         mutex_lock(&adev->vcn.vcn_pg_lock);
         amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
--
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7CKevin1.Wang%40amd.com%7C72db727fcede4117919008d87fcf9c39%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637399876957953297%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=FRDabYo1xJiS3agbO5a478%2FPO0cDrfcYMfLDS%2BudrX8%3D&amp;reserved=0

[-- Attachment #1.2: Type: text/html, Size: 7188 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-03  8:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03  8:07 [PATCH] drm/amd/amdgpu: specify the power strategy for vcn use Kenneth Feng
2020-11-03  8:19 ` Wang, Kevin(Yang)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).