AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Agner <stefan-XLVq0VzYD2Y@public.gmane.org>
To: James Zhu <jzhums-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH] drm/amdgpu:All UVD instances share one idle_work handle
Date: Tue, 19 Jun 2018 11:04:53 +0200	[thread overview]
Message-ID: <85d94deb2f7c0b81b2083321e737efd5@agner.ch> (raw)
In-Reply-To: <1529344804-7929-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>

On 18.06.2018 20:00, James Zhu wrote:
> All UVD instanses have only one dpm control, so it is better
> to share one idle_work handle.

Compiles fine with clang here.

Tested-by: Stefan Agner <stefan@agner.ch>

> 
> Signed-off-by: James Zhu <James.Zhu@amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 14 +++++++-------
>  drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h |  2 +-
>  2 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> index 04d77f1..cc15d32 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c
> @@ -130,7 +130,7 @@ int amdgpu_uvd_sw_init(struct amdgpu_device *adev)
>  	unsigned family_id;
>  	int i, j, r;
>  
> -	INIT_DELAYED_WORK(&adev->uvd.inst->idle_work, amdgpu_uvd_idle_work_handler);
> +	INIT_DELAYED_WORK(&adev->uvd.idle_work, amdgpu_uvd_idle_work_handler);
>  
>  	switch (adev->asic_type) {
>  #ifdef CONFIG_DRM_AMDGPU_CIK
> @@ -331,12 +331,12 @@ int amdgpu_uvd_suspend(struct amdgpu_device *adev)
>  	void *ptr;
>  	int i, j;
>  
> +	cancel_delayed_work_sync(&adev->uvd.idle_work);
> +
>  	for (j = 0; j < adev->uvd.num_uvd_inst; ++j) {
>  		if (adev->uvd.inst[j].vcpu_bo == NULL)
>  			continue;
>  
> -		cancel_delayed_work_sync(&adev->uvd.inst[j].idle_work);
> -
>  		/* only valid for physical mode */
>  		if (adev->asic_type < CHIP_POLARIS10) {
>  			for (i = 0; i < adev->uvd.max_handles; ++i)
> @@ -1162,7 +1162,7 @@ int amdgpu_uvd_get_destroy_msg(struct
> amdgpu_ring *ring, uint32_t handle,
>  static void amdgpu_uvd_idle_work_handler(struct work_struct *work)
>  {
>  	struct amdgpu_device *adev =
> -		container_of(work, struct amdgpu_device, uvd.inst->idle_work.work);
> +		container_of(work, struct amdgpu_device, uvd.idle_work.work);
>  	unsigned fences = 0, i, j;
>  
>  	for (i = 0; i < adev->uvd.num_uvd_inst; ++i) {
> @@ -1184,7 +1184,7 @@ static void amdgpu_uvd_idle_work_handler(struct
> work_struct *work)
>  							       AMD_CG_STATE_GATE);
>  		}
>  	} else {
> -		schedule_delayed_work(&adev->uvd.inst->idle_work, UVD_IDLE_TIMEOUT);
> +		schedule_delayed_work(&adev->uvd.idle_work, UVD_IDLE_TIMEOUT);
>  	}
>  }
>  
> @@ -1196,7 +1196,7 @@ void amdgpu_uvd_ring_begin_use(struct amdgpu_ring *ring)
>  	if (amdgpu_sriov_vf(adev))
>  		return;
>  
> -	set_clocks = !cancel_delayed_work_sync(&adev->uvd.inst->idle_work);
> +	set_clocks = !cancel_delayed_work_sync(&adev->uvd.idle_work);
>  	if (set_clocks) {
>  		if (adev->pm.dpm_enabled) {
>  			amdgpu_dpm_enable_uvd(adev, true);
> @@ -1213,7 +1213,7 @@ void amdgpu_uvd_ring_begin_use(struct amdgpu_ring *ring)
>  void amdgpu_uvd_ring_end_use(struct amdgpu_ring *ring)
>  {
>  	if (!amdgpu_sriov_vf(ring->adev))
> -		schedule_delayed_work(&ring->adev->uvd.inst->idle_work, UVD_IDLE_TIMEOUT);
> +		schedule_delayed_work(&ring->adev->uvd.idle_work, UVD_IDLE_TIMEOUT);
>  }
>  
>  /**
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
> b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
> index b1579fb..8b23a1b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.h
> @@ -44,7 +44,6 @@ struct amdgpu_uvd_inst {
>  	void			*saved_bo;
>  	atomic_t		handles[AMDGPU_MAX_UVD_HANDLES];
>  	struct drm_file		*filp[AMDGPU_MAX_UVD_HANDLES];
> -	struct delayed_work	idle_work;
>  	struct amdgpu_ring	ring;
>  	struct amdgpu_ring	ring_enc[AMDGPU_MAX_UVD_ENC_RINGS];
>  	struct amdgpu_irq_src	irq;
> @@ -62,6 +61,7 @@ struct amdgpu_uvd {
>  	bool			address_64_bit;
>  	bool			use_ctx_buf;
>  	struct amdgpu_uvd_inst		inst[AMDGPU_MAX_UVD_INSTANCES];
> +	struct delayed_work	idle_work;
>  };
>  
>  int amdgpu_uvd_sw_init(struct amdgpu_device *adev);
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

      parent reply	other threads:[~2018-06-19  9:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18 18:00 [PATCH] drm/amdgpu:All UVD instances share one idle_work handle James Zhu
     [not found] ` <1529344804-7929-1-git-send-email-James.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-06-18 19:41   ` Alex Deucher
2018-06-19  7:00   ` Christian König
2018-06-19  9:04   ` Stefan Agner [this message]

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=85d94deb2f7c0b81b2083321e737efd5@agner.ch \
    --to=stefan-xlvq0vzyd2y@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=jzhums-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.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