amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.
PATCH 1/1 amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.
--- 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(-)
configure.ac +1 -1
@@ -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
src/gallium/drivers/radeon/r600_pipe_common.c +1 -0
@@ -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 */ };
src/gallium/drivers/radeon/r600_pipe_common.h +1 -0
@@ -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,
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +8 -0
@@ -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 ;
src/gallium/winsys/amdgpu/drm/amdgpu_cs.h +3 -0
@@ -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);
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +1 -0
@@ -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;
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h +1 -0
@@ -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;
Signature · 6 lines
2.7.4 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 29 lines · Andrey Grodzovsky
Signed-off-by Andrey Grodzovsky <[email protected]>--- 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(-)configure.ac +1
-1@@ -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.66src/gallium/drivers/radeon/r600_pipe_common.c +0
-0
src/gallium/drivers/radeon/r600_pipe_common.c static const struct debug_named_value common_debug_options[] = { · line 854
Quoted 4 lines
src/gallium/drivers/radeon/r600_pipe_common.c +1
-0@@ -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!
Quoted 66 lines
src/gallium/drivers/radeon/r600_pipe_common.c +0
-0DEBUG_NAMED_VALUE_END /* must be last */ };src/gallium/drivers/radeon/r600_pipe_common.h +1
-0@@ -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,src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +8
-0@@ -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 ;src/gallium/winsys/amdgpu/drm/amdgpu_cs.h +3
-0@@ -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);src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +1
-0@@ -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;src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h +0
-0
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h struct amdgpu_winsys { · line 87
Quoted 7 lines
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h +1
-0@@ -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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
A message that is not in the archive (sent off-list or not yet received): 078f3ca7-e108-6ce6-4e07-65d8f569eb45-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Quoted 42 lines · Samuel Pitoiset
Quoted 29 lines · Andrey Grodzovsky
Signed-off-by Andrey Grodzovsky <[email protected]>--- 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(-)configure.ac +1
-1@@ -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.66src/gallium/drivers/radeon/r600_pipe_common.c +0
-0src/gallium/drivers/radeon/r600_pipe_common.c static const struct debug_named_value · line 857
Quoted 7 lines
src/gallium/drivers/radeon/r600_pipe_common.c +1
-0@@ -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".
Quoted 1 line
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
Quoted 67 lines
Thanks!
Quoted 64 lines
DEBUG_NAMED_VALUE_END/* must be last */
};src/gallium/drivers/radeon/r600_pipe_common.h +1
-0@@ -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,src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +7
-0@@ -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 ;src/gallium/winsys/amdgpu/drm/amdgpu_cs.h +3
-0@@ -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);src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +1
-0@@ -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.hb/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.hindex 8b62e2d..b4a3422 100644
---a/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h
Quoted 8 lines
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c struct amdgpu_winsys { · line 86
Quoted 8 lines
+++
b/src/gallium/winsys/amdgpu/drm/amdgpu_winsys.hsrc/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +1
-0@@ -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;
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Quoted 1 line · Andrey Grodzovsky
Signed-off-by Andrey Grodzovsky <[email protected]>
[...]
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c static struct radeon_winsys_ctx *amdgpu_ctx_create(struct radeon_winsys *ws) · line 262
Quoted 12 lines
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +4
-0@@ -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".
Signature · 6 lines
Earthling Michel Dänzer | http://www.amd.com Libre software enthusiast | Mesa and X developer _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
A message that is not in the archive (sent off-list or not yet received): b269c18b-5520-2f26-2545-2b742ee34f2f-otUistvHUpPR7s880joybQ@public.gmane.org
I addressed the feedback and pushed the patch.
Marek
Quoted 21 lines · Michel Dänzer
Quoted 1 line · Andrey Grodzovsky
Signed-off-by Andrey Grodzovsky <[email protected]>[...]
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c static struct radeon_winsys_ctx *amdgpu_ctx_create(struct radeon_winsys *ws) · line 262
Quoted 12 lines
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +4
-0@@ -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_vmidfailed. (%i)\n".
Quoted 7 lines
--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): CAAxE2A4SM3ZZTrN+UUw5mncdSx8e7zMiSGvEE7BgssyVrnyNyw-JsoAwUIsXosN+BqQ9rBEUg@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:
Quoted 31 lines
I addressed the feedback and pushed the patch.
Marek
Quoted 26 lines · Michel Dänzer
Quoted 1 line · Andrey Grodzovsky
Signed-off-by Andrey Grodzovsky <[email protected]>[...]
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c static struct radeon_winsys_ctx *amdgpu_ctx_create(struct radeon_winsys *ws) · line 262
Quoted 12 lines
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +4
-0@@ -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_vmidfailed. (%i)\n".--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Yeah, it should be called when the winsys is created.
Marek
Quoted 52 lines · Christian König
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:
Quoted 39 lines
I addressed the feedback and pushed the patch.
Marek
Quoted 33 lines · Michel Dänzer
Quoted 2 lines · Andrey Grodzovsky
Signed-off-by Andrey Grodzovsky <[email protected]>[...]
Quoted 6 lines
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +0
-0src/gallium/winsys/amdgpu/drm/amdgpu_cs.c static struct radeon_winsys_ctx · line 264
Quoted 9 lines
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +4
-0@@ -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_vmidfailed. (%i)\n".--
Earthling Michel Dänzer | http://www.amd.com
Libre software enthusiast | Mesa and X developer
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
Am 31.10.2017 um 16:50 schrieb Michel Dänzer:
Quoted 12 lines · Andrey Grodzovsky
Quoted 1 line
Signed-off-by Andrey Grodzovsky <[email protected]>[...]
Quoted 8 lines
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +0
-0@@ -256,6 +256,14 @@ static struct radeon_winsys_ctx *amdgpu_ctx_create(struct radeon_winsys *ws) goto error_create; }
Quoted 5 lines
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c static struct radeon_winsys_ctx *amdgpu_ctx_create(struct radeon_winsys *ws) · line 262
Quoted 4 lines
src/gallium/winsys/amdgpu/drm/amdgpu_cs.c +4
-0+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_vmidfailed. (%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
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx