All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <deathsimple-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
To: "John Brooks" <john-xq/Ko7C6e2Bl57MIdRCFDg@public.gmane.org>,
	"Michel Dänzer" <michel-otUistvHUpPR7s880joybQ@public.gmane.org>
Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	"Marek Olšák" <maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH RFC 1/2] drm/amdgpu: Add AMDGPU_BO_FLAG_CPU_ACCESS
Date: Sat, 1 Jul 2017 17:36:53 +0200	[thread overview]
Message-ID: <33d2358f-b1c8-d774-fe43-19a024c79d24@vodafone.de> (raw)
In-Reply-To: <1498835932-5053-2-git-send-email-john-xq/Ko7C6e2Bl57MIdRCFDg@public.gmane.org>

Am 30.06.2017 um 17:18 schrieb John Brooks:
> For userspace BO allocations, replace AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED
> with a new AMDGPU_BO_FLAG_CPU_ACCESS flag. This flag will be used to
> indicate that a BO should currently be CPU accessible. Unlike the
> CPU_ACCESS_REQUIRED flag, it is meant to be an ephemeral rather than a
> permanent constraint. Currently, however, it is treated no differently.
>
> Signed-off-by: John Brooks <john@fastquake.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu.h        | 3 +++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 9 ++++++++-
>   include/uapi/drm/amdgpu_drm.h              | 1 +
>   3 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index 12d61ed..a724e4f 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -411,6 +411,9 @@ struct amdgpu_bo_va {
>   
>   #define AMDGPU_GEM_DOMAIN_MAX		0x3
>   
> +/* BO internal flags */
> +#define AMDGPU_BO_FLAG_CPU_ACCESS	(AMDGPU_GEM_CREATE_MAX << 1)
Better put this into amdgpu_drm.h to keep all the flags together. We can 
reject kernel internal flags when we create the BO.

But in general I would still say we should stop clearing the flag when 
"bo->tbo.type != ttm_bo_type_device".

This way we are always on the save side and don't modify flags for 
kernel BOs.

Regards,
Christian.

> +
>   struct amdgpu_bo {
>   	/* Protected by tbo.reserved */
>   	u32				prefered_domains;
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> index 8ee6965..fa8aeca 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
> @@ -128,7 +128,8 @@ static void amdgpu_ttm_placement_init(struct amdgpu_device *adev,
>   		places[c].flags = TTM_PL_FLAG_WC | TTM_PL_FLAG_UNCACHED |
>   			TTM_PL_FLAG_VRAM;
>   
> -		if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED)
> +		if (flags & (AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED |
> +			     AMDGPU_BO_FLAG_CPU_ACCESS))
>   			places[c].lpfn = visible_pfn;
>   		else
>   			places[c].flags |= TTM_PL_FLAG_TOPDOWN;
> @@ -361,6 +362,12 @@ int amdgpu_bo_create_restricted(struct amdgpu_device *adev,
>   	if (!kernel && bo->allowed_domains == AMDGPU_GEM_DOMAIN_VRAM)
>   		bo->allowed_domains |= AMDGPU_GEM_DOMAIN_GTT;
>   
> +	if (flags & AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED) {
> +		flags |= AMDGPU_BO_FLAG_CPU_ACCESS;
> +		/* Treat CPU_ACCESS_REQUIRED only as a hint if given by UMD */
> +		if (!kernel)
> +			flags &= ~AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED;
> +	}
>   	bo->flags = flags;
>   
>   #ifdef CONFIG_X86_32
> diff --git a/include/uapi/drm/amdgpu_drm.h b/include/uapi/drm/amdgpu_drm.h
> index d9aa4a3..473076f 100644
> --- a/include/uapi/drm/amdgpu_drm.h
> +++ b/include/uapi/drm/amdgpu_drm.h
> @@ -87,6 +87,7 @@ extern "C" {
>   #define AMDGPU_GEM_CREATE_SHADOW		(1 << 4)
>   /* Flag that allocating the BO should use linear VRAM */
>   #define AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS	(1 << 5)
> +#define AMDGPU_GEM_CREATE_MAX			(1 << 5)
>   
>   struct drm_amdgpu_gem_create_in  {
>   	/** the requested memory size */


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

  parent reply	other threads:[~2017-07-01 15:36 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-29 14:41 Deprecation of AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED Marek Olšák
     [not found] ` <CAAxE2A4x8tkA9DL78EouJqxZ9b2b_PyzN3hg8JJn7AHOpk5b0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-29 14:51   ` Christian König
     [not found]     ` <8f866ee1-78c0-6707-3f92-b71a2f661457-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-06-29 15:03       ` Marek Olšák
     [not found]         ` <CAAxE2A49_j6hO_G0XoWwquFzPsoHVELNhakt5NdmVb8=F0YdSA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-30  1:36           ` Michel Dänzer
     [not found]             ` <50b66561-3843-8b70-913e-5692db657640-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-06-30  6:44               ` Christian König
     [not found]                 ` <b7717c04-604f-24c8-2fc7-a94e520845c8-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-06-30  6:51                   ` Michel Dänzer
     [not found]                     ` <a1c1f000-16b4-220f-70c5-01b2682a632e-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-06-30  6:59                       ` Christian König
     [not found]                         ` <8f60b400-1343-9f7f-d202-f3497fb346ae-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-06-30  7:14                           ` Michel Dänzer
     [not found]                             ` <160855e9-2517-ae04-fd9d-c638507109cd-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-06-30 10:34                               ` Christian König
     [not found]                                 ` <a5afda83-1c47-a8d2-20ab-a5923603e7fb-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-06-30 11:43                                   ` Marek Olšák
     [not found]                                     ` <CAAxE2A6h=0cn_+S9Psw=DkvAqtUdAOZE-kK39LZFpX0xud1gRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-07-03 10:08                                       ` Michel Dänzer
     [not found]                                         ` <1bb94040-5d80-d1e7-33c9-b09e5282b91c-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-07-03 13:03                                           ` Marek Olšák
     [not found]                                             ` <CAAxE2A4dNoEi=D8FM=+5kEZmq_V7DdLrwFPYxSFx4uFjUSeTvg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-07-04  8:09                                               ` Michel Dänzer
     [not found]                                                 ` <cf4352ec-6838-f599-cf5c-b6a123301461-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-07-04 13:39                                                   ` Marek Olšák
2017-06-30 15:18                               ` [PATCH RFC 0/2] " John Brooks
     [not found]                                 ` <1498835932-5053-1-git-send-email-john-xq/Ko7C6e2Bl57MIdRCFDg@public.gmane.org>
2017-06-30 15:18                                   ` [PATCH RFC 1/2] drm/amdgpu: Add AMDGPU_BO_FLAG_CPU_ACCESS John Brooks
     [not found]                                     ` <1498835932-5053-2-git-send-email-john-xq/Ko7C6e2Bl57MIdRCFDg@public.gmane.org>
2017-07-01 15:36                                       ` Christian König [this message]
     [not found]                                         ` <33d2358f-b1c8-d774-fe43-19a024c79d24-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-07-01 16:25                                           ` [PATCH RFC v2 " John Brooks
2017-06-30 15:18                                   ` [PATCH RFC 2/2] drm/amdgpu: Set/clear CPU_ACCESS flag on page fault and move to VRAM John Brooks
     [not found]                                     ` <1498835932-5053-3-git-send-email-john-xq/Ko7C6e2Bl57MIdRCFDg@public.gmane.org>
2017-06-30 15:31                                       ` [PATCH RFC v2] " John Brooks
     [not found]                                         ` <1498836668-5872-1-git-send-email-john-xq/Ko7C6e2Bl57MIdRCFDg@public.gmane.org>
2017-07-03  9:56                                           ` Michel Dänzer
2017-07-02 12:52                                       ` [PATCH RFC 2/2] " Christian König
     [not found]                                         ` <4236c636-8b80-7088-6b55-8b9dee1c2b3f-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-07-03  1:34                                           ` Michel Dänzer
     [not found]                                             ` <3a28996f-2a7c-918c-6c39-65a25d4ea976-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-07-03  7:06                                               ` Christian König
     [not found]                                                 ` <894e892e-3076-9f52-5dba-71ac135b7d61-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-07-03  9:49                                                   ` Michel Dänzer
     [not found]                                                     ` <45ae166f-70f5-d05e-a5bb-99429b3de063-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-07-03 11:47                                                       ` Christian König
     [not found]                                                         ` <bf62998e-0174-f714-9503-d99295213d8f-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org>
2017-07-04  0:56                                                           ` Michel Dänzer
2017-06-30  1:55           ` Deprecation of AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED Mao, David
     [not found]             ` <FE84B835-C930-424E-B380-649F4895274C-5C7GfCeVMHo@public.gmane.org>
2017-06-30  3:36               ` Michel Dänzer
     [not found]                 ` <17988a78-85c4-24c2-961a-b07f7222446f-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-06-30  4:00                   ` Mao, David
     [not found]                     ` <0C38ED78-D50C-4212-AA7A-0DACBFDB5680-5C7GfCeVMHo@public.gmane.org>
2017-06-30  7:02                       ` Michel Dänzer

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=33d2358f-b1c8-d774-fe43-19a024c79d24@vodafone.de \
    --to=deathsimple-antagkrnahcb1svskn2v4q@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=john-xq/Ko7C6e2Bl57MIdRCFDg@public.gmane.org \
    --cc=maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=michel-otUistvHUpPR7s880joybQ@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.