amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.
PATCH 1/1 amdgpu: Add R600_DEBUG flag to reserve VMID per ctx.
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.
--- 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(-)
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.88 LIBDRM_INTEL_REQUIRED=2.4.75 LIBDRM_NVVIEUX_REQUIRED=2.4.66 LIBDRM_NOUVEAU_REQUIRED=2.4.66
meson.build +1 -1
@@ -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')
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.h +1 -0
@@ -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);
src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +12 -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;
@@ -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. */
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
A message that is not in the archive (sent off-list or not yet received): 1509634239-10807-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org
Pushed with a fixed typo and whitespace, thanks.
Marek
Quoted 130 lines · 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 <[email protected]>--- 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(-)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.88 LIBDRM_INTEL_REQUIRED=2.4.75 LIBDRM_NVVIEUX_REQUIRED=2.4.66 LIBDRM_NOUVEAU_REQUIRED=2.4.66meson.build +1
-1@@ -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')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.h +1
-0@@ -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);src/gallium/winsys/amdgpu/drm/amdgpu_winsys.c +12
-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;@@ -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. */ src/gallium/winsys/amdgpu/drm/amdgpu_winsys.h +1
-1@@ -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
Quoted 4 lines
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx