AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Lazar, Lijo" <lijo.lazar@amd.com>
To: Alex Deucher <alexander.deucher@amd.com>, amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amdgpu/vcn: fix idle work handler for VCN 2.5
Date: Tue, 4 Mar 2025 20:07:17 +0530	[thread overview]
Message-ID: <8873a34a-4f00-4910-a8f0-6bf103cdf6e2@amd.com> (raw)
In-Reply-To: <20250304142040.3946594-1-alexander.deucher@amd.com>



On 3/4/2025 7:50 PM, Alex Deucher wrote:
> VCN 2.5 uses the PG callback to enable VCN DPM which is
> a global state.  As such, we need to make sure all instances
> are in the same state.  Use amdgpu_device_ip_set_powergating_state()
> rather than the per instance set_pg_state() callback.
> 
> Fixes: 4ce4fe27205c ("drm/amdgpu/vcn: use per instance callbacks for idle work handler")
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
> index 8d8b39e6d197a..b93102e9fb43e 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c
> @@ -437,7 +437,14 @@ static void amdgpu_vcn_idle_work_handler(struct work_struct *work)
>  	fences += fence[i];
>  
>  	if (!fences && !atomic_read(&vcn_inst->total_submission_cnt)) {
> -		vcn_inst->set_pg_state(vcn_inst, AMD_PG_STATE_GATE);
> +		/* VCN 2.5 PG is actually DPM enablement which is global so
> +		 * update all instances
> +		 */
> +		if (amdgpu_ip_version(adev, UVD_HWIP, 0) == IP_VERSION(2, 5, 0))
> +			amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
> +							       AMD_PG_STATE_GATE);

What about moving this logic to vcn_v2_5_set_pg_state? Apart from that,
the number of outstanding fences are counted only for the corresponding
instance. Won't this be problematic when multiple instances are active
and one of them gets to idle? May need a refcount as well.

Thanks,
Lijo


> +		else
> +			vcn_inst->set_pg_state(vcn_inst, AMD_PG_STATE_GATE);
>  		r = amdgpu_dpm_switch_power_profile(adev, PP_SMC_POWER_PROFILE_VIDEO,
>  						    false);
>  		if (r)
> @@ -463,7 +470,14 @@ void amdgpu_vcn_ring_begin_use(struct amdgpu_ring *ring)
>  	}
>  
>  	mutex_lock(&vcn_inst->vcn_pg_lock);
> -	vcn_inst->set_pg_state(vcn_inst, AMD_PG_STATE_UNGATE);
> +	/* VCN 2.5 PG is actually DPM enablement which is global so
> +	 * update all instances
> +	 */
> +	if (amdgpu_ip_version(adev, UVD_HWIP, 0) == IP_VERSION(2, 5, 0))
> +		amdgpu_device_ip_set_powergating_state(adev, AMD_IP_BLOCK_TYPE_VCN,
> +						       AMD_PG_STATE_UNGATE);
> +	else
> +		vcn_inst->set_pg_state(vcn_inst, AMD_PG_STATE_UNGATE);
>  
>  	/* Only set DPG pause for VCN3 or below, VCN4 and above will be handled by FW */
>  	if (adev->pg_flags & AMD_PG_SUPPORT_VCN_DPG &&


  reply	other threads:[~2025-03-04 14:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-04 14:20 [PATCH] drm/amdgpu/vcn: fix idle work handler for VCN 2.5 Alex Deucher
2025-03-04 14:37 ` Lazar, Lijo [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-04 16:22 Alex Deucher
2025-03-04 20:52 ` Boyuan Zhang
2025-03-04 21:05   ` Alex Deucher
2025-03-04 23:12 ` Alex Deucher
2025-03-04 23:01 Alex Deucher
2025-03-05 14:20 ` Boyuan Zhang
2025-03-05 19:17 Alex Deucher
2025-03-06 15:05 ` Alex Deucher
2025-03-07 15:22   ` Alex Deucher
2025-03-07 21:14     ` Zhang, Boyuan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8873a34a-4f00-4910-a8f0-6bf103cdf6e2@amd.com \
    --to=lijo.lazar@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox