[Mesa-dev] [PATCH] radv: add support for local bos.
Dave Airlie
airlied at gmail.com
Wed Oct 25 06:14:22 UTC 2017
From: Dave Airlie <airlied at redhat.com>
This uses the new kernel interfaces for reduced cs overhead,
We only set the local flag for memory allocations that don't have
a dedicated allocation and ones that aren't imports.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/amd/vulkan/radv_device.c | 3 +++
src/amd/vulkan/radv_radeon_winsys.h | 1 +
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c | 4 ++++
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.h | 1 +
src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c | 3 +++
5 files changed, 12 insertions(+)
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index ebc74fbadef..e529a5f194f 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -2119,6 +2119,9 @@ VkResult radv_alloc_memory(VkDevice _device,
if (mem_flags & RADV_MEM_IMPLICIT_SYNC)
flags |= RADEON_FLAG_IMPLICIT_SYNC;
+ if (!dedicate_info && !import_info)
+ flags |= RADEON_FLAG_NO_INTERPROCESS_SHARING;
+
mem->bo = device->ws->buffer_create(device->ws, alloc_size, device->physical_device->rad_info.max_alignment,
domain, flags);
diff --git a/src/amd/vulkan/radv_radeon_winsys.h b/src/amd/vulkan/radv_radeon_winsys.h
index cf5a9e8f069..395c8499b3d 100644
--- a/src/amd/vulkan/radv_radeon_winsys.h
+++ b/src/amd/vulkan/radv_radeon_winsys.h
@@ -54,6 +54,7 @@ enum radeon_bo_flag { /* bitfield */
RADEON_FLAG_VIRTUAL = (1 << 3),
RADEON_FLAG_VA_UNCACHED = (1 << 4),
RADEON_FLAG_IMPLICIT_SYNC = (1 << 5),
+ RADEON_FLAG_NO_INTERPROCESS_SHARING = (1 << 6),
};
enum radeon_bo_usage { /* bitfield */
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
index 15099b318e7..dac549a20ad 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
@@ -332,6 +332,10 @@ radv_amdgpu_winsys_bo_create(struct radeon_winsys *_ws,
request.flags |= AMDGPU_GEM_CREATE_CPU_GTT_USWC;
if (!(flags & RADEON_FLAG_IMPLICIT_SYNC) && ws->info.drm_minor >= 22)
request.flags |= AMDGPU_GEM_CREATE_EXPLICIT_SYNC;
+ if (flags & RADEON_FLAG_NO_INTERPROCESS_SHARING && ws->info.drm_minor >= 20) {
+ bo->is_local = true;
+ request.flags |= AMDGPU_GEM_CREATE_VM_ALWAYS_VALID;
+ }
/* this won't do anything on pre 4.9 kernels */
if (ws->zero_all_vram_allocs && (initial_domain & RADEON_DOMAIN_VRAM))
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.h b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.h
index f32e4308386..f9aac9451c0 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.h
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.h
@@ -45,6 +45,7 @@ struct radv_amdgpu_winsys_bo {
uint64_t size;
struct radv_amdgpu_winsys *ws;
bool is_virtual;
+ bool is_local;
int ref_count;
union {
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
index 46e5b767033..a4c63f92261 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
@@ -471,6 +471,9 @@ static void radv_amdgpu_cs_add_buffer(struct radeon_winsys_cs *_cs,
return;
}
+ if (bo->is_local)
+ return;
+
radv_amdgpu_cs_add_buffer_internal(cs, bo->bo, priority);
}
--
2.14.2
More information about the mesa-dev
mailing list