All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.
@ 2017-10-31 15:40 Andrey Grodzovsky
  2017-10-31 15:50 ` Samuel Pitoiset
  2017-10-31 15:50 ` Michel Dänzer
  0 siblings, 2 replies; 10+ messages in thread
From: Andrey Grodzovsky @ 2017-10-31 15:40 UTC (permalink / raw)
  To: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w,
	Marek.Olsak-5C7GfCeVMHo, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Andrey Grodzovsky

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
---
 configure.ac                                  | 2 +-
 src/gallium/drivers/radeon/r600_pipe_common.c | 1 +
 src/gallium/drivers/radeon/r600_pipe_common.h | 1 +
 src/gallium/winsys/amdgpu/drm/amdgpu_cs.c     | 8 ++++++++
 src/gallium/winsys/amdgpu/drm/amdgpu_cs.h     | 3 +++
 src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 1 +
 src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h | 1 +
 7 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 9aa02f5..efc653a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,7 +74,7 @@ AC_SUBST([OPENCL_VERSION])
 # in the first entry.
 LIBDRM_REQUIRED=2.4.75
 LIBDRM_RADEON_REQUIRED=2.4.71
-LIBDRM_AMDGPU_REQUIRED=2.4.85
+LIBDRM_AMDGPU_REQUIRED=2.4.86
 LIBDRM_INTEL_REQUIRED=2.4.75
 LIBDRM_NVVIEUX_REQUIRED=2.4.66
 LIBDRM_NOUVEAU_REQUIRED=2.4.66
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index b77d859..3364dac 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -851,6 +851,7 @@ static const struct debug_named_value common_debug_options[] = {
 	{ "dpbb", DBG(DPBB), "Enable DPBB." },
 	{ "dfsm", DBG(DFSM), "Enable DFSM." },
 	{ "nooutoforder", DBG(NO_OUT_OF_ORDER), "Disable out-of-order rasterization" },
+	{ "reserve_vmid", DBG(RESERVE_VMID), "Force VMID resrvation per context." },
 
 	DEBUG_NAMED_VALUE_END /* must be last */
 };
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index a7c91cb..94c8d4f 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -107,6 +107,7 @@ enum {
 	DBG_NO_DISCARD_RANGE,
 	DBG_NO_WC,
 	DBG_CHECK_VM,
+	DBG_RESERVE_VMID,
 
 	/* 3D engine options: */
 	DBG_SWITCH_ON_EOP,
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
index 8f43e93..1155492 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
@@ -256,6 +256,14 @@ static struct radeon_winsys_ctx *amdgpu_ctx_create(struct radeon_winsys *ws)
       goto error_create;
    }
 
+   if (ctx->ws->reserve_vmid) {
+	   r = amdgpu_vm_reserve_vmid(ctx->ctx, 0);
+	   if (r) {
+		fprintf(stderr, "amdgpu: amdgpu_cs_ctx_create failed. (%i)\n", r);
+		goto error_create;
+	   }
+   }
+
    alloc_buffer.alloc_size = ctx->ws->info.gart_page_size;
    alloc_buffer.phys_alignment = ctx->ws->info.gart_page_size;
    alloc_buffer.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
index 1c3d0f0..d023841 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
@@ -162,6 +162,9 @@ static inline bool amdgpu_fence_is_syncobj(struct amdgpu_fence *fence)
 static inline void amdgpu_ctx_unref(struct amdgpu_ctx *ctx)
 {
    if (p_atomic_dec_zero(&ctx->refcount)) {
+      if (ctx->ws->reserve_vmid)
+         amdgpu_vm_unreserve_vmid(ctx->ctx, 0);
+
       amdgpu_cs_ctx_free(ctx->ctx);
       amdgpu_bo_free(ctx->user_fence_bo);
       FREE(ctx);
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
index a210a27..b80a988 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
@@ -73,6 +73,7 @@ static bool do_winsys_init(struct amdgpu_winsys *ws, int fd)
 
    ws->check_vm = strstr(debug_get_option("R600_DEBUG", ""), "check_vm") != NULL;
    ws->debug_all_bos = debug_get_option_all_bos();
+   ws->reserve_vmid = strstr(debug_get_option("R600_DEBUG", ""), "reserve_vmid") != NULL;
 
    return true;
 
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
index 8b62e2d..b4a3422 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
@@ -81,6 +81,7 @@ struct amdgpu_winsys {
 
    bool check_vm;
    bool debug_all_bos;
+   bool reserve_vmid;
 
    /* List of all allocated buffers */
    mtx_t global_bo_list_lock;
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.
  2017-10-31 15:40 [PATCH] amdgpu: Add R600_DEBUG flag to reserve VMID per ctx Andrey Grodzovsky
@ 2017-10-31 15:50 ` Samuel Pitoiset
       [not found]   ` <078f3ca7-e108-6ce6-4e07-65d8f569eb45-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2017-10-31 15:50 ` Michel Dänzer
  1 sibling, 1 reply; 10+ messages in thread
From: Samuel Pitoiset @ 2017-10-31 15:50 UTC (permalink / raw)
  To: Andrey Grodzovsky, mesa-dev; +Cc: ckoenig.leichtzumerken, Marek.Olsak, amd-gfx



On 10/31/2017 04:40 PM, Andrey Grodzovsky wrote:
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> ---
>   configure.ac                                  | 2 +-
>   src/gallium/drivers/radeon/r600_pipe_common.c | 1 +
>   src/gallium/drivers/radeon/r600_pipe_common.h | 1 +
>   src/gallium/winsys/amdgpu/drm/amdgpu_cs.c     | 8 ++++++++
>   src/gallium/winsys/amdgpu/drm/amdgpu_cs.h     | 3 +++
>   src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 1 +
>   src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h | 1 +
>   7 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 9aa02f5..efc653a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -74,7 +74,7 @@ AC_SUBST([OPENCL_VERSION])
>   # in the first entry.
>   LIBDRM_REQUIRED=2.4.75
>   LIBDRM_RADEON_REQUIRED=2.4.71
> -LIBDRM_AMDGPU_REQUIRED=2.4.85
> +LIBDRM_AMDGPU_REQUIRED=2.4.86
>   LIBDRM_INTEL_REQUIRED=2.4.75
>   LIBDRM_NVVIEUX_REQUIRED=2.4.66
>   LIBDRM_NOUVEAU_REQUIRED=2.4.66
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> index b77d859..3364dac 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> @@ -851,6 +851,7 @@ static const struct debug_named_value common_debug_options[] = {
>   	{ "dpbb", DBG(DPBB), "Enable DPBB." },
>   	{ "dfsm", DBG(DFSM), "Enable DFSM." },
>   	{ "nooutoforder", DBG(NO_OUT_OF_ORDER), "Disable out-of-order rasterization" },
> +	{ "reserve_vmid", DBG(RESERVE_VMID), "Force VMID resrvation per context." },

"reservation".

Can you also explain a bit what that stuff is? :)

Thanks!

>   
>   	DEBUG_NAMED_VALUE_END /* must be last */
>   };
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
> index a7c91cb..94c8d4f 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.h
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.h
> @@ -107,6 +107,7 @@ enum {
>   	DBG_NO_DISCARD_RANGE,
>   	DBG_NO_WC,
>   	DBG_CHECK_VM,
> +	DBG_RESERVE_VMID,
>   
>   	/* 3D engine options: */
>   	DBG_SWITCH_ON_EOP,
> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
> index 8f43e93..1155492 100644
> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
> @@ -256,6 +256,14 @@ static struct radeon_winsys_ctx *amdgpu_ctx_create(struct radeon_winsys *ws)
>         goto error_create;
>      }
>   
> +   if (ctx->ws->reserve_vmid) {
> +	   r = amdgpu_vm_reserve_vmid(ctx->ctx, 0);
> +	   if (r) {
> +		fprintf(stderr, "amdgpu: amdgpu_cs_ctx_create failed. (%i)\n", r);
> +		goto error_create;
> +	   }
> +   }
> +
>      alloc_buffer.alloc_size = ctx->ws->info.gart_page_size;
>      alloc_buffer.phys_alignment = ctx->ws->info.gart_page_size;
>      alloc_buffer.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
> index 1c3d0f0..d023841 100644
> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
> @@ -162,6 +162,9 @@ static inline bool amdgpu_fence_is_syncobj(struct amdgpu_fence *fence)
>   static inline void amdgpu_ctx_unref(struct amdgpu_ctx *ctx)
>   {
>      if (p_atomic_dec_zero(&ctx->refcount)) {
> +      if (ctx->ws->reserve_vmid)
> +         amdgpu_vm_unreserve_vmid(ctx->ctx, 0);
> +
>         amdgpu_cs_ctx_free(ctx->ctx);
>         amdgpu_bo_free(ctx->user_fence_bo);
>         FREE(ctx);
> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> index a210a27..b80a988 100644
> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> @@ -73,6 +73,7 @@ static bool do_winsys_init(struct amdgpu_winsys *ws, int fd)
>   
>      ws->check_vm = strstr(debug_get_option("R600_DEBUG", ""), "check_vm") != NULL;
>      ws->debug_all_bos = debug_get_option_all_bos();
> +   ws->reserve_vmid = strstr(debug_get_option("R600_DEBUG", ""), "reserve_vmid") != NULL;
>   
>      return true;
>   
> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
> index 8b62e2d..b4a3422 100644
> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
> @@ -81,6 +81,7 @@ struct amdgpu_winsys {
>   
>      bool check_vm;
>      bool debug_all_bos;
> +   bool reserve_vmid;
>   
>      /* List of all allocated buffers */
>      mtx_t global_bo_list_lock;
> 
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.
  2017-10-31 15:40 [PATCH] amdgpu: Add R600_DEBUG flag to reserve VMID per ctx Andrey Grodzovsky
  2017-10-31 15:50 ` Samuel Pitoiset
@ 2017-10-31 15:50 ` Michel Dänzer
       [not found]   ` <b269c18b-5520-2f26-2545-2b742ee34f2f-otUistvHUpPR7s880joybQ@public.gmane.org>
  1 sibling, 1 reply; 10+ messages in thread
From: Michel Dänzer @ 2017-10-31 15:50 UTC (permalink / raw)
  To: Andrey Grodzovsky; +Cc: mesa-dev, Marek.Olsak, amd-gfx, ckoenig.leichtzumerken

On 31/10/17 04:40 PM, Andrey Grodzovsky wrote:
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>

[...]

> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
> index 8f43e93..1155492 100644
> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
> @@ -256,6 +256,14 @@ static struct radeon_winsys_ctx *amdgpu_ctx_create(struct radeon_winsys *ws)
>        goto error_create;
>     }
>  
> +   if (ctx->ws->reserve_vmid) {
> +	   r = amdgpu_vm_reserve_vmid(ctx->ctx, 0);
> +	   if (r) {
> +		fprintf(stderr, "amdgpu: amdgpu_cs_ctx_create failed. (%i)\n", r);

This should say "amdgpu: amdgpu_vm_reserve_vmid failed. (%i)\n".


-- 
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.
       [not found]   ` <078f3ca7-e108-6ce6-4e07-65d8f569eb45-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-10-31 15:56     ` Andrey Grodzovsky
  0 siblings, 0 replies; 10+ messages in thread
From: Andrey Grodzovsky @ 2017-10-31 15:56 UTC (permalink / raw)
  To: Samuel Pitoiset, mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w,
	Marek.Olsak-5C7GfCeVMHo, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 5094 bytes --]



On 2017-10-31 11:50 AM, Samuel Pitoiset wrote:
>
>
> On 10/31/2017 04:40 PM, Andrey Grodzovsky wrote:
>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
>> ---
>>   configure.ac                                  | 2 +-
>>   src/gallium/drivers/radeon/r600_pipe_common.c | 1 +
>>   src/gallium/drivers/radeon/r600_pipe_common.h | 1 +
>>   src/gallium/winsys/amdgpu/drm/amdgpu_cs.c     | 8 ++++++++
>>   src/gallium/winsys/amdgpu/drm/amdgpu_cs.h     | 3 +++
>>   src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 1 +
>>   src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h | 1 +
>>   7 files changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/configure.ac b/configure.ac
>> index 9aa02f5..efc653a 100644
>> --- a/configure.ac
>> +++ b/configure.ac
>> @@ -74,7 +74,7 @@ AC_SUBST([OPENCL_VERSION])
>>   # in the first entry.
>>   LIBDRM_REQUIRED=2.4.75
>>   LIBDRM_RADEON_REQUIRED=2.4.71
>> -LIBDRM_AMDGPU_REQUIRED=2.4.85
>> +LIBDRM_AMDGPU_REQUIRED=2.4.86
>>   LIBDRM_INTEL_REQUIRED=2.4.75
>>   LIBDRM_NVVIEUX_REQUIRED=2.4.66
>>   LIBDRM_NOUVEAU_REQUIRED=2.4.66
>> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c 
>> b/src/gallium/drivers/radeon/r600_pipe_common.c
>> index b77d859..3364dac 100644
>> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
>> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
>> @@ -851,6 +851,7 @@ static const struct debug_named_value 
>> common_debug_options[] = {
>>       { "dpbb", DBG(DPBB), "Enable DPBB." },
>>       { "dfsm", DBG(DFSM), "Enable DFSM." },
>>       { "nooutoforder", DBG(NO_OUT_OF_ORDER), "Disable out-of-order 
>> rasterization" },
>> +    { "reserve_vmid", DBG(RESERVE_VMID), "Force VMID resrvation per 
>> context." },
>
> "reservation".
>
> Can you also explain a bit what that stuff is? :)

It allows to have fixed VMID assigned to a process, otherwise each time 
a command is processed the next available VMID is assigned
according to a policy in KMD (amdgpu_vm_grab_id).

Thanks,
Andrey

>
> Thanks!
>
>>         DEBUG_NAMED_VALUE_END /* must be last */
>>   };
>> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
>> b/src/gallium/drivers/radeon/r600_pipe_common.h
>> index a7c91cb..94c8d4f 100644
>> --- a/src/gallium/drivers/radeon/r600_pipe_common.h
>> +++ b/src/gallium/drivers/radeon/r600_pipe_common.h
>> @@ -107,6 +107,7 @@ enum {
>>       DBG_NO_DISCARD_RANGE,
>>       DBG_NO_WC,
>>       DBG_CHECK_VM,
>> +    DBG_RESERVE_VMID,
>>         /* 3D engine options: */
>>       DBG_SWITCH_ON_EOP,
>> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c 
>> b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>> index 8f43e93..1155492 100644
>> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>> @@ -256,6 +256,14 @@ static struct radeon_winsys_ctx 
>> *amdgpu_ctx_create(struct radeon_winsys *ws)
>>         goto error_create;
>>      }
>>   +   if (ctx->ws->reserve_vmid) {
>> +       r = amdgpu_vm_reserve_vmid(ctx->ctx, 0);
>> +       if (r) {
>> +        fprintf(stderr, "amdgpu: amdgpu_cs_ctx_create failed. 
>> (%i)\n", r);
>> +        goto error_create;
>> +       }
>> +   }
>> +
>>      alloc_buffer.alloc_size = ctx->ws->info.gart_page_size;
>>      alloc_buffer.phys_alignment = ctx->ws->info.gart_page_size;
>>      alloc_buffer.preferred_heap = AMDGPU_GEM_DOMAIN_GTT;
>> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h 
>> b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
>> index 1c3d0f0..d023841 100644
>> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
>> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
>> @@ -162,6 +162,9 @@ static inline bool amdgpu_fence_is_syncobj(struct 
>> amdgpu_fence *fence)
>>   static inline void amdgpu_ctx_unref(struct amdgpu_ctx *ctx)
>>   {
>>      if (p_atomic_dec_zero(&ctx->refcount)) {
>> +      if (ctx->ws->reserve_vmid)
>> +         amdgpu_vm_unreserve_vmid(ctx->ctx, 0);
>> +
>>         amdgpu_cs_ctx_free(ctx->ctx);
>>         amdgpu_bo_free(ctx->user_fence_bo);
>>         FREE(ctx);
>> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c 
>> b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
>> index a210a27..b80a988 100644
>> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
>> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
>> @@ -73,6 +73,7 @@ static bool do_winsys_init(struct amdgpu_winsys 
>> *ws, int fd)
>>        ws->check_vm = strstr(debug_get_option("R600_DEBUG", ""), 
>> "check_vm") != NULL;
>>      ws->debug_all_bos = debug_get_option_all_bos();
>> +   ws->reserve_vmid = strstr(debug_get_option("R600_DEBUG", ""), 
>> "reserve_vmid") != NULL;
>>        return true;
>>   diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h 
>> b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
>> index 8b62e2d..b4a3422 100644
>> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
>> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
>> @@ -81,6 +81,7 @@ struct amdgpu_winsys {
>>        bool check_vm;
>>      bool debug_all_bos;
>> +   bool reserve_vmid;
>>        /* List of all allocated buffers */
>>      mtx_t global_bo_list_lock;
>>


[-- Attachment #1.2: Type: text/html, Size: 8679 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Mesa-dev] [PATCH] amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.
       [not found]   ` <b269c18b-5520-2f26-2545-2b742ee34f2f-otUistvHUpPR7s880joybQ@public.gmane.org>
@ 2017-10-31 15:57     ` Marek Olšák
       [not found]       ` <CAAxE2A4SM3ZZTrN+UUw5mncdSx8e7zMiSGvEE7BgssyVrnyNyw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2017-11-01  8:43     ` Christian König
  1 sibling, 1 reply; 10+ messages in thread
From: Marek Olšák @ 2017-10-31 15:57 UTC (permalink / raw)
  To: Michel Dänzer
  Cc: ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w, Andrey Grodzovsky,
	Marek Olšák, amd-gfx mailing list,
	mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

I addressed the feedback and pushed the patch.

Marek

On Tue, Oct 31, 2017 at 4:50 PM, Michel Dänzer <michel@daenzer.net> wrote:
> On 31/10/17 04:40 PM, Andrey Grodzovsky wrote:
>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
>
> [...]
>
>> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>> index 8f43e93..1155492 100644
>> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>> @@ -256,6 +256,14 @@ static struct radeon_winsys_ctx *amdgpu_ctx_create(struct radeon_winsys *ws)
>>        goto error_create;
>>     }
>>
>> +   if (ctx->ws->reserve_vmid) {
>> +        r = amdgpu_vm_reserve_vmid(ctx->ctx, 0);
>> +        if (r) {
>> +             fprintf(stderr, "amdgpu: amdgpu_cs_ctx_create failed. (%i)\n", r);
>
> This should say "amdgpu: amdgpu_vm_reserve_vmid failed. (%i)\n".
>
>
> --
> Earthling Michel Dänzer               |               http://www.amd.com
> Libre software enthusiast             |             Mesa and X developer
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.
       [not found]   ` <b269c18b-5520-2f26-2545-2b742ee34f2f-otUistvHUpPR7s880joybQ@public.gmane.org>
  2017-10-31 15:57     ` [Mesa-dev] " Marek Olšák
@ 2017-11-01  8:43     ` Christian König
  1 sibling, 0 replies; 10+ messages in thread
From: Christian König @ 2017-11-01  8:43 UTC (permalink / raw)
  To: Michel Dänzer, Andrey Grodzovsky
  Cc: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Marek.Olsak-5C7GfCeVMHo, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Am 31.10.2017 um 16:50 schrieb Michel Dänzer:
> On 31/10/17 04:40 PM, Andrey Grodzovsky wrote:
>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> [...]
>
>> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>> index 8f43e93..1155492 100644
>> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>> @@ -256,6 +256,14 @@ static struct radeon_winsys_ctx *amdgpu_ctx_create(struct radeon_winsys *ws)
>>         goto error_create;
>>      }
>>   
>> +   if (ctx->ws->reserve_vmid) {
>> +	   r = amdgpu_vm_reserve_vmid(ctx->ctx, 0);
>> +	   if (r) {
>> +		fprintf(stderr, "amdgpu: amdgpu_cs_ctx_create failed. (%i)\n", r);
> This should say "amdgpu: amdgpu_vm_reserve_vmid failed. (%i)\n".


Not sure when amdgpu_ctx_create() is called, but the VMID is reserved 
per process not per context.

Christian.

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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [Mesa-dev] [PATCH] amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.
       [not found]       ` <CAAxE2A4SM3ZZTrN+UUw5mncdSx8e7zMiSGvEE7BgssyVrnyNyw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2017-11-01  8:49         ` Christian König
  2017-11-01 13:39           ` Marek Olšák
  0 siblings, 1 reply; 10+ messages in thread
From: Christian König @ 2017-11-01  8:49 UTC (permalink / raw)
  To: Marek Olšák, Michel Dänzer
  Cc: Andrey Grodzovsky, Marek Olšák, amd-gfx mailing list,
	mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org

I'm not 100% sure that patch was correct.

When is amdgpu_ctx_create() called? The VMID is reserved for the whole 
process, not just a context.

Regards,
Christian.

Am 31.10.2017 um 16:57 schrieb Marek Olšák:
> I addressed the feedback and pushed the patch.
>
> Marek
>
> On Tue, Oct 31, 2017 at 4:50 PM, Michel Dänzer <michel@daenzer.net> wrote:
>> On 31/10/17 04:40 PM, Andrey Grodzovsky wrote:
>>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
>> [...]
>>
>>> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>>> index 8f43e93..1155492 100644
>>> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>>> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>>> @@ -256,6 +256,14 @@ static struct radeon_winsys_ctx *amdgpu_ctx_create(struct radeon_winsys *ws)
>>>         goto error_create;
>>>      }
>>>
>>> +   if (ctx->ws->reserve_vmid) {
>>> +        r = amdgpu_vm_reserve_vmid(ctx->ctx, 0);
>>> +        if (r) {
>>> +             fprintf(stderr, "amdgpu: amdgpu_cs_ctx_create failed. (%i)\n", r);
>> This should say "amdgpu: amdgpu_vm_reserve_vmid failed. (%i)\n".
>>
>>
>> --
>> Earthling Michel Dänzer               |               http://www.amd.com
>> Libre software enthusiast             |             Mesa and X developer
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.
  2017-11-01  8:49         ` Christian König
@ 2017-11-01 13:39           ` Marek Olšák
  0 siblings, 0 replies; 10+ messages in thread
From: Marek Olšák @ 2017-11-01 13:39 UTC (permalink / raw)
  To: Christian König
  Cc: Andrey Grodzovsky, Michel Dänzer, amd-gfx mailing list,
	mesa-dev@lists.freedesktop.org

Yeah, it should be called when the winsys is created.

Marek

On Wed, Nov 1, 2017 at 9:49 AM, Christian König
<ckoenig.leichtzumerken@gmail.com> wrote:
> I'm not 100% sure that patch was correct.
>
> When is amdgpu_ctx_create() called? The VMID is reserved for the whole
> process, not just a context.
>
> Regards,
> Christian.
>
>
> Am 31.10.2017 um 16:57 schrieb Marek Olšák:
>>
>> I addressed the feedback and pushed the patch.
>>
>> Marek
>>
>> On Tue, Oct 31, 2017 at 4:50 PM, Michel Dänzer <michel@daenzer.net> wrote:
>>>
>>> On 31/10/17 04:40 PM, Andrey Grodzovsky wrote:
>>>>
>>>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
>>>
>>> [...]
>>>
>>>> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>>>> b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>>>> index 8f43e93..1155492 100644
>>>> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>>>> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.c
>>>> @@ -256,6 +256,14 @@ static struct radeon_winsys_ctx
>>>> *amdgpu_ctx_create(struct radeon_winsys *ws)
>>>>         goto error_create;
>>>>      }
>>>>
>>>> +   if (ctx->ws->reserve_vmid) {
>>>> +        r = amdgpu_vm_reserve_vmid(ctx->ctx, 0);
>>>> +        if (r) {
>>>> +             fprintf(stderr, "amdgpu: amdgpu_cs_ctx_create failed.
>>>> (%i)\n", r);
>>>
>>> This should say "amdgpu: amdgpu_vm_reserve_vmid failed. (%i)\n".
>>>
>>>
>>> --
>>> Earthling Michel Dänzer               |               http://www.amd.com
>>> Libre software enthusiast             |             Mesa and X developer
>>> _______________________________________________
>>> mesa-dev mailing list
>>> mesa-dev@lists.freedesktop.org
>>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
>
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH] amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.
@ 2017-11-02 14:50 Andrey Grodzovsky
       [not found] ` <1509634239-10807-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Andrey Grodzovsky @ 2017-11-02 14:50 UTC (permalink / raw)
  To: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w,
	Marek.Olsak-5C7GfCeVMHo, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	Andrey Grodzovsky

Fixes reverted patch f03b7c9 by doing VMID reservation per
process and not per context.
Also updates required amdgpu libdrm version since the change
involved interface updates in amdgpu libdrm.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
---
 configure.ac                                  |  2 +-
 meson.build                                   |  2 +-
 src/gallium/drivers/radeon/r600_pipe_common.c |  1 +
 src/gallium/drivers/radeon/r600_pipe_common.h |  1 +
 src/gallium/winsys/amdgpu/drm/amdgpu_cs.h     |  1 +
 src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 12 ++++++++++++
 src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h |  1 +
 7 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 9aa02f5..0116b90 100644
--- a/configure.ac
+++ b/configure.ac
@@ -74,7 +74,7 @@ AC_SUBST([OPENCL_VERSION])
 # in the first entry.
 LIBDRM_REQUIRED=2.4.75
 LIBDRM_RADEON_REQUIRED=2.4.71
-LIBDRM_AMDGPU_REQUIRED=2.4.85
+LIBDRM_AMDGPU_REQUIRED=2.4.88
 LIBDRM_INTEL_REQUIRED=2.4.75
 LIBDRM_NVVIEUX_REQUIRED=2.4.66
 LIBDRM_NOUVEAU_REQUIRED=2.4.66
diff --git a/meson.build b/meson.build
index 6ad8c8b..3ceaec4 100644
--- a/meson.build
+++ b/meson.build
@@ -638,7 +638,7 @@ dep_libdrm_nouveau = []
 dep_libdrm_etnaviv = []
 dep_libdrm_freedreno = []
 if with_amd_vk or with_gallium_radeonsi
-  dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.86')
+  dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.88')
 endif
 if with_gallium_radeonsi or with_dri_r100 or with_dri_r200
   dep_libdrm_radeon = dependency('libdrm_radeon', version : '>= 2.4.71')
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
index b77d859..3364dac 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.c
+++ b/src/gallium/drivers/radeon/r600_pipe_common.c
@@ -851,6 +851,7 @@ static const struct debug_named_value common_debug_options[] = {
 	{ "dpbb", DBG(DPBB), "Enable DPBB." },
 	{ "dfsm", DBG(DFSM), "Enable DFSM." },
 	{ "nooutoforder", DBG(NO_OUT_OF_ORDER), "Disable out-of-order rasterization" },
+	{ "reserve_vmid", DBG(RESERVE_VMID), "Force VMID resrvation per context." },
 
 	DEBUG_NAMED_VALUE_END /* must be last */
 };
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index a7c91cb..94c8d4f 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -107,6 +107,7 @@ enum {
 	DBG_NO_DISCARD_RANGE,
 	DBG_NO_WC,
 	DBG_CHECK_VM,
+	DBG_RESERVE_VMID,
 
 	/* 3D engine options: */
 	DBG_SWITCH_ON_EOP,
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
index 1c3d0f0..5fe3592 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
@@ -162,6 +162,7 @@ static inline bool amdgpu_fence_is_syncobj(struct amdgpu_fence *fence)
 static inline void amdgpu_ctx_unref(struct amdgpu_ctx *ctx)
 {
    if (p_atomic_dec_zero(&ctx->refcount)) {
+
       amdgpu_cs_ctx_free(ctx->ctx);
       amdgpu_bo_free(ctx->user_fence_bo);
       FREE(ctx);
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
index a210a27..7b261bb 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
@@ -73,6 +73,7 @@ static bool do_winsys_init(struct amdgpu_winsys *ws, int fd)
 
    ws->check_vm = strstr(debug_get_option("R600_DEBUG", ""), "check_vm") != NULL;
    ws->debug_all_bos = debug_get_option_all_bos();
+   ws->reserve_vmid = strstr(debug_get_option("R600_DEBUG", ""), "reserve_vmid") != NULL;
 
    return true;
 
@@ -92,6 +93,9 @@ static void amdgpu_winsys_destroy(struct radeon_winsys *rws)
 {
    struct amdgpu_winsys *ws = (struct amdgpu_winsys*)rws;
 
+   if (ws->reserve_vmid)
+      amdgpu_vm_unreserve_vmid(ws->dev, 0);
+
    if (util_queue_is_initialized(&ws->cs_queue))
       util_queue_destroy(&ws->cs_queue);
 
@@ -342,6 +346,14 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config,
 
    util_hash_table_set(dev_tab, dev, ws);
 
+   if (ws->reserve_vmid) {
+	   r = amdgpu_vm_reserve_vmid(dev, 0);
+	   if (r) {
+		fprintf(stderr, "amdgpu: amdgpu_vm_reserve_vmid failed. (%i)\n", r);
+		goto fail_cache;
+	   }
+   }
+
    /* We must unlock the mutex once the winsys is fully initialized, so that
     * other threads attempting to create the winsys from the same fd will
     * get a fully initialized winsys and not just half-way initialized. */
diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
index 8b62e2d..b4a3422 100644
--- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
+++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
@@ -81,6 +81,7 @@ struct amdgpu_winsys {
 
    bool check_vm;
    bool debug_all_bos;
+   bool reserve_vmid;
 
    /* List of all allocated buffers */
    mtx_t global_bo_list_lock;
-- 
2.7.4

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

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.
       [not found] ` <1509634239-10807-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
@ 2017-11-03 17:26   ` Marek Olšák
  0 siblings, 0 replies; 10+ messages in thread
From: Marek Olšák @ 2017-11-03 17:26 UTC (permalink / raw)
  To: Andrey Grodzovsky
  Cc: mesa-dev-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	amd-gfx mailing list,
	ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w

Pushed with a fixed typo and whitespace, thanks.

Marek

On Thu, Nov 2, 2017 at 3:50 PM, Andrey Grodzovsky
<andrey.grodzovsky@amd.com> wrote:
> Fixes reverted patch f03b7c9 by doing VMID reservation per
> process and not per context.
> Also updates required amdgpu libdrm version since the change
> involved interface updates in amdgpu libdrm.
>
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> ---
>  configure.ac                                  |  2 +-
>  meson.build                                   |  2 +-
>  src/gallium/drivers/radeon/r600_pipe_common.c |  1 +
>  src/gallium/drivers/radeon/r600_pipe_common.h |  1 +
>  src/gallium/winsys/amdgpu/drm/amdgpu_cs.h     |  1 +
>  src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c | 12 ++++++++++++
>  src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h |  1 +
>  7 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index 9aa02f5..0116b90 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -74,7 +74,7 @@ AC_SUBST([OPENCL_VERSION])
>  # in the first entry.
>  LIBDRM_REQUIRED=2.4.75
>  LIBDRM_RADEON_REQUIRED=2.4.71
> -LIBDRM_AMDGPU_REQUIRED=2.4.85
> +LIBDRM_AMDGPU_REQUIRED=2.4.88
>  LIBDRM_INTEL_REQUIRED=2.4.75
>  LIBDRM_NVVIEUX_REQUIRED=2.4.66
>  LIBDRM_NOUVEAU_REQUIRED=2.4.66
> diff --git a/meson.build b/meson.build
> index 6ad8c8b..3ceaec4 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -638,7 +638,7 @@ dep_libdrm_nouveau = []
>  dep_libdrm_etnaviv = []
>  dep_libdrm_freedreno = []
>  if with_amd_vk or with_gallium_radeonsi
> -  dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.86')
> +  dep_libdrm_amdgpu = dependency('libdrm_amdgpu', version : '>= 2.4.88')
>  endif
>  if with_gallium_radeonsi or with_dri_r100 or with_dri_r200
>    dep_libdrm_radeon = dependency('libdrm_radeon', version : '>= 2.4.71')
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c
> index b77d859..3364dac 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.c
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.c
> @@ -851,6 +851,7 @@ static const struct debug_named_value common_debug_options[] = {
>         { "dpbb", DBG(DPBB), "Enable DPBB." },
>         { "dfsm", DBG(DFSM), "Enable DFSM." },
>         { "nooutoforder", DBG(NO_OUT_OF_ORDER), "Disable out-of-order rasterization" },
> +       { "reserve_vmid", DBG(RESERVE_VMID), "Force VMID resrvation per context." },
>
>         DEBUG_NAMED_VALUE_END /* must be last */
>  };
> diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
> index a7c91cb..94c8d4f 100644
> --- a/src/gallium/drivers/radeon/r600_pipe_common.h
> +++ b/src/gallium/drivers/radeon/r600_pipe_common.h
> @@ -107,6 +107,7 @@ enum {
>         DBG_NO_DISCARD_RANGE,
>         DBG_NO_WC,
>         DBG_CHECK_VM,
> +       DBG_RESERVE_VMID,
>
>         /* 3D engine options: */
>         DBG_SWITCH_ON_EOP,
> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
> index 1c3d0f0..5fe3592 100644
> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_cs.h
> @@ -162,6 +162,7 @@ static inline bool amdgpu_fence_is_syncobj(struct amdgpu_fence *fence)
>  static inline void amdgpu_ctx_unref(struct amdgpu_ctx *ctx)
>  {
>     if (p_atomic_dec_zero(&ctx->refcount)) {
> +
>        amdgpu_cs_ctx_free(ctx->ctx);
>        amdgpu_bo_free(ctx->user_fence_bo);
>        FREE(ctx);
> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> index a210a27..7b261bb 100644
> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c
> @@ -73,6 +73,7 @@ static bool do_winsys_init(struct amdgpu_winsys *ws, int fd)
>
>     ws->check_vm = strstr(debug_get_option("R600_DEBUG", ""), "check_vm") != NULL;
>     ws->debug_all_bos = debug_get_option_all_bos();
> +   ws->reserve_vmid = strstr(debug_get_option("R600_DEBUG", ""), "reserve_vmid") != NULL;
>
>     return true;
>
> @@ -92,6 +93,9 @@ static void amdgpu_winsys_destroy(struct radeon_winsys *rws)
>  {
>     struct amdgpu_winsys *ws = (struct amdgpu_winsys*)rws;
>
> +   if (ws->reserve_vmid)
> +      amdgpu_vm_unreserve_vmid(ws->dev, 0);
> +
>     if (util_queue_is_initialized(&ws->cs_queue))
>        util_queue_destroy(&ws->cs_queue);
>
> @@ -342,6 +346,14 @@ amdgpu_winsys_create(int fd, const struct pipe_screen_config *config,
>
>     util_hash_table_set(dev_tab, dev, ws);
>
> +   if (ws->reserve_vmid) {
> +          r = amdgpu_vm_reserve_vmid(dev, 0);
> +          if (r) {
> +               fprintf(stderr, "amdgpu: amdgpu_vm_reserve_vmid failed. (%i)\n", r);
> +               goto fail_cache;
> +          }
> +   }
> +
>     /* We must unlock the mutex once the winsys is fully initialized, so that
>      * other threads attempting to create the winsys from the same fd will
>      * get a fully initialized winsys and not just half-way initialized. */
> diff --git a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
> index 8b62e2d..b4a3422 100644
> --- a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
> +++ b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
> @@ -81,6 +81,7 @@ struct amdgpu_winsys {
>
>     bool check_vm;
>     bool debug_all_bos;
> +   bool reserve_vmid;
>
>     /* List of all allocated buffers */
>     mtx_t global_bo_list_lock;
> --
> 2.7.4
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-11-03 17:26 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-31 15:40 [PATCH] amdgpu: Add R600_DEBUG flag to reserve VMID per ctx Andrey Grodzovsky
2017-10-31 15:50 ` Samuel Pitoiset
     [not found]   ` <078f3ca7-e108-6ce6-4e07-65d8f569eb45-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-31 15:56     ` Andrey Grodzovsky
2017-10-31 15:50 ` Michel Dänzer
     [not found]   ` <b269c18b-5520-2f26-2545-2b742ee34f2f-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-10-31 15:57     ` [Mesa-dev] " Marek Olšák
     [not found]       ` <CAAxE2A4SM3ZZTrN+UUw5mncdSx8e7zMiSGvEE7BgssyVrnyNyw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-11-01  8:49         ` Christian König
2017-11-01 13:39           ` Marek Olšák
2017-11-01  8:43     ` Christian König
  -- strict thread matches above, loose matches on Subject: below --
2017-11-02 14:50 Andrey Grodzovsky
     [not found] ` <1509634239-10807-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2017-11-03 17:26   ` Marek Olšák

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.