[Mesa-dev] [PATCH 2/2] radv: move is_local up to the winsys level.

Dave Airlie airlied at gmail.com
Mon Nov 6 04:07:44 UTC 2017


From: Dave Airlie <airlied at redhat.com>

We can avoid adding the buffer in the non-local case, this will
avoid all the overhead of the indirect call.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/amd/vulkan/radv_radeon_winsys.h           | 4 ++++
 src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c | 2 +-
 src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.h | 1 -
 src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c | 2 +-
 4 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/radv_radeon_winsys.h b/src/amd/vulkan/radv_radeon_winsys.h
index bab19a6233d..66a2bcccb4d 100644
--- a/src/amd/vulkan/radv_radeon_winsys.h
+++ b/src/amd/vulkan/radv_radeon_winsys.h
@@ -147,6 +147,7 @@ struct radeon_winsys_fence;
 
 struct radeon_winsys_bo {
 	uint64_t va;
+	bool is_local;
 };
 struct radv_winsys_sem_counts {
 	uint32_t syncobj_count;
@@ -284,6 +285,9 @@ static inline void radv_cs_add_buffer(struct radeon_winsys *ws,
 				      struct radeon_winsys_bo *bo,
 				      uint8_t priority)
 {
+	if (bo->is_local)
+		return;
+
 	ws->cs_add_buffer(cs, bo, priority);
 }
 
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
index dac549a20ad..9ec4b4fb561 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.c
@@ -333,7 +333,7 @@ radv_amdgpu_winsys_bo_create(struct radeon_winsys *_ws,
 	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;
+		bo->base.is_local = true;
 		request.flags |= AMDGPU_GEM_CREATE_VM_ALWAYS_VALID;
 	}
 
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.h b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.h
index f9aac9451c0..f32e4308386 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.h
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_bo.h
@@ -45,7 +45,6 @@ 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 939c221e0c8..c10bdd6c91e 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c
@@ -473,7 +473,7 @@ static void radv_amdgpu_cs_add_buffer(struct radeon_winsys_cs *_cs,
 		return;
 	}
 
-	if (bo->is_local)
+	if (bo->base.is_local)
 		return;
 
 	radv_amdgpu_cs_add_buffer_internal(cs, bo->bo, priority);
-- 
2.14.2



More information about the mesa-dev mailing list