dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <deathsimple@vodafone.de>
To: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/amdgpu: wait on page directory changes.
Date: Fri, 14 Aug 2015 20:56:27 +0200	[thread overview]
Message-ID: <55CE39DB.1030807@vodafone.de> (raw)
In-Reply-To: <1439575721-876-1-git-send-email-bas@basnieuwenhuizen.nl>

On 14.08.2015 20:08, Bas Nieuwenhuizen wrote:
> Pagetables can be moved and therefore the page directory update can be necessary
> for the current cs even if none of the the bo's are moved. In that scenario
> there is no fence between the sdma0 and gfx ring, so we add one.
>
> Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>

Nice catch, this patch is Reviewed-by: Christian König 
<christian.koenig@amd.com>

The other one we found internally already as well.

Regards,
Christian.

> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu.h    | 1 +
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 4 ++++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 ++++++
>   3 files changed, 11 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 6934f52..c2383bb 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -981,6 +981,7 @@ struct amdgpu_vm {
>   	/* contains the page directory */
>   	struct amdgpu_bo	*page_directory;
>   	unsigned		max_pde_used;
> +	struct fence		*page_directory_fence;
>   
>   	/* array of page tables, one for each page directory entry */
>   	struct amdgpu_vm_pt	*page_tables;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index f428288..01b4a67 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -552,6 +552,10 @@ static int amdgpu_bo_vm_update_pte(struct amdgpu_cs_parser *p,
>   	if (r)
>   		return r;
>   
> +	r = amdgpu_sync_fence(adev, &p->ibs[0].sync, vm->page_directory_fence);
> +	if (r)
> +		return r;
> +
>   	r = amdgpu_vm_clear_freed(adev, vm);
>   	if (r)
>   		return r;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> index b3f5d04..e02e353 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> @@ -495,6 +495,9 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
>   		if (r)
>   			goto error_free;
>   		amdgpu_bo_fence(pd, fence, true);
> +
> +		fence_put(vm->page_directory_fence);
> +		vm->page_directory_fence = fence_get(fence);
>   	}
>   
>   	if (!amdgpu_enable_scheduler || ib->length_dw == 0) {
> @@ -1287,6 +1290,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
>   		return -ENOMEM;
>   	}
>   
> +	vm->page_directory_fence = NULL;
> +
>   	r = amdgpu_bo_create(adev, pd_size, align, true,
>   			     AMDGPU_GEM_DOMAIN_VRAM, 0,
>   			     NULL, &vm->page_directory);
> @@ -1335,6 +1340,7 @@ void amdgpu_vm_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
>   	kfree(vm->page_tables);
>   
>   	amdgpu_bo_unref(&vm->page_directory);
> +	fence_put(vm->page_directory_fence);
>   
>   	for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
>   		amdgpu_fence_unref(&vm->ids[i].flushed_updates);

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

      parent reply	other threads:[~2015-08-14 18:56 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-14 18:08 [PATCH 1/2] drm/amdgpu: wait on page directory changes Bas Nieuwenhuizen
2015-08-14 18:08 ` [PATCH 2/2] drm/amdgpu: do not redundantly update page tables Bas Nieuwenhuizen
2015-08-14 18:56 ` Christian König [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=55CE39DB.1030807@vodafone.de \
    --to=deathsimple@vodafone.de \
    --cc=bas@basnieuwenhuizen.nl \
    --cc=dri-devel@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