[Mesa-dev] [PATCH 2/2] winsys/amdgpu: set AMDGPU_GEM_CREATE_LOCAL if possible

Marek Olšák maraeo at gmail.com
Tue Aug 29 20:41:03 UTC 2017


On Tue, Aug 29, 2017 at 4:47 PM, Christian König
<deathsimple at vodafone.de> wrote:
> From: Christian König <christian.koenig at amd.com>
>
> When the kernel supports it set the local flag and
> stop adding those BOs to the BO list.
>
> Can probably be optimized much more.
>
> Signed-off-by: Christian König <christian.koenig at amd.com>
> ---
>  src/gallium/winsys/amdgpu/drm/amdgpu_bo.c |  8 ++++++++
>  src/gallium/winsys/amdgpu/drm/amdgpu_bo.h |  2 ++
>  src/gallium/winsys/amdgpu/drm/amdgpu_cs.c | 22 +++++++++++++++++-----
>  3 files changed, 27 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
> index 08348ed..1238d58 100644
> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_bo.c
> @@ -38,6 +38,10 @@
>  #include <stdio.h>
>  #include <inttypes.h>
>
> +#ifndef AMDGPU_GEM_CREATE_LOCAL
> +#define AMDGPU_GEM_CREATE_LOCAL (1 << 6)
> +#endif
> +
>  /* Set to 1 for verbose output showing committed sparse buffer ranges. */
>  #define DEBUG_SPARSE_COMMITS 0
>
> @@ -402,6 +406,9 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
>        request.flags |= AMDGPU_GEM_CREATE_NO_CPU_ACCESS;
>     if (flags & RADEON_FLAG_GTT_WC)
>        request.flags |= AMDGPU_GEM_CREATE_CPU_GTT_USWC;
> +   if (flags & RADEON_FLAG_NO_INTERPROCESS_SHARING &&
> +       ws->info.drm_minor >= 20)
> +      request.flags |= AMDGPU_GEM_CREATE_LOCAL;
>
>     r = amdgpu_bo_alloc(ws->dev, &request, &buf_handle);
>     if (r) {
> @@ -435,6 +442,7 @@ static struct amdgpu_winsys_bo *amdgpu_create_bo(struct amdgpu_winsys *ws,
>     bo->u.real.va_handle = va_handle;
>     bo->initial_domain = initial_domain;
>     bo->unique_id = __sync_fetch_and_add(&ws->next_bo_unique_id, 1);
> +   bo->is_local = !!(request.flags & AMDGPU_GEM_CREATE_LOCAL);

I think that "bool" doesn't need "!!" and automatically converts the
value to true/false, but I'm not 100% sure. Anyway, the series is:

Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek


More information about the mesa-dev mailing list