All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
To: Leo Liu <leo.liu-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 2/3] drm/amdgpu: use existing function amdgpu_bo_create_kernel
Date: Thu, 1 Jun 2017 12:55:48 +0200	[thread overview]
Message-ID: <852ceaa1-a899-40ab-a6a2-fb33001885b0@vodafone.de> (raw)
In-Reply-To: <20170531192826.17571-2-leo.liu-5C7GfCeVMHo@public.gmane.org>

Am 31.05.2017 um 21:28 schrieb Leo Liu:
> To simplify vce bo create
>
> Signed-off-by: Leo Liu <leo.liu@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 27 +++------------------------
>   1 file changed, 3 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
> index 735c38d..b9b0906 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c
> @@ -165,35 +165,14 @@ int amdgpu_vce_sw_init(struct amdgpu_device *adev, unsigned long size)
>   	adev->vce.fw_version = ((version_major << 24) | (version_minor << 16) |
>   				(binary_id << 8));
>   
> -	/* allocate firmware, stack and heap BO */
> -
> -	r = amdgpu_bo_create(adev, size, PAGE_SIZE, true,
> -			     AMDGPU_GEM_DOMAIN_VRAM,
> -			     AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
> -			     AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS,
> -			     NULL, NULL, &adev->vce.vcpu_bo);
> +	r = amdgpu_bo_create_kernel(adev, size, PAGE_SIZE,
> +				    AMDGPU_GEM_DOMAIN_VRAM, &adev->vce.vcpu_bo,
> +				    &adev->vce.gpu_addr, &adev->vce.cpu_addr);

When you now CPU map the BO you also need to make sure that this mapping 
is properly destroyed in amdgpu_vce_sw_fini().

In other words use amdgpu_bo_free_kernel() in amdgpu_vce_sw_fini() as 
well :)

Apart from that the set looks good to me,
Christian.

>   	if (r) {
>   		dev_err(adev->dev, "(%d) failed to allocate VCE bo\n", r);
>   		return r;
>   	}
>   
> -	r = amdgpu_bo_reserve(adev->vce.vcpu_bo, false);
> -	if (r) {
> -		amdgpu_bo_unref(&adev->vce.vcpu_bo);
> -		dev_err(adev->dev, "(%d) failed to reserve VCE bo\n", r);
> -		return r;
> -	}
> -
> -	r = amdgpu_bo_pin(adev->vce.vcpu_bo, AMDGPU_GEM_DOMAIN_VRAM,
> -			  &adev->vce.gpu_addr);
> -	amdgpu_bo_unreserve(adev->vce.vcpu_bo);
> -	if (r) {
> -		amdgpu_bo_unref(&adev->vce.vcpu_bo);
> -		dev_err(adev->dev, "(%d) VCE bo pin failed\n", r);
> -		return r;
> -	}
> -
> -
>   	ring = &adev->vce.ring[0];
>   	rq = &ring->sched.sched_rq[AMD_SCHED_PRIORITY_NORMAL];
>   	r = amd_sched_entity_init(&ring->sched, &adev->vce.entity,


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

  parent reply	other threads:[~2017-06-01 10:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-31 19:28 [PATCH 1/3] drm/amdgpu: add vcpu_bo cpu address Leo Liu
     [not found] ` <20170531192826.17571-1-leo.liu-5C7GfCeVMHo@public.gmane.org>
2017-05-31 19:28   ` [PATCH 2/3] drm/amdgpu: use existing function amdgpu_bo_create_kernel Leo Liu
     [not found]     ` <20170531192826.17571-2-leo.liu-5C7GfCeVMHo@public.gmane.org>
2017-06-01 10:55       ` Christian König [this message]
     [not found]         ` <852ceaa1-a899-40ab-a6a2-fb33001885b0-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-06-01 13:11           ` Leo Liu
2017-05-31 19:28   ` [PATCH 3/3] drm/amdgpu: add saved_bo to save vce 4.0 context when suspend Leo Liu
     [not found]     ` <20170531192826.17571-3-leo.liu-5C7GfCeVMHo@public.gmane.org>
2017-05-31 19:54       ` Deucher, Alexander
     [not found]         ` <BN6PR12MB1652D083E4A3123CFE3B3628F7F10-/b2+HYfkarQqUD6E6FAiowdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-05-31 20:06           ` Leo Liu
2017-05-31 21:00   ` Leo Liu
     [not found]     ` <20170531210040.20919-1-leo.liu-5C7GfCeVMHo@public.gmane.org>
2017-05-31 21:18       ` Deucher, Alexander

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=852ceaa1-a899-40ab-a6a2-fb33001885b0@vodafone.de \
    --to=deathsimple-antagkrnahcb1svskn2v4q@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=leo.liu-5C7GfCeVMHo@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.