summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>2016-12-17 19:20:08 +0100
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>2016-12-18 20:52:08 +0100
commit86cb418bd4e30d3a028dca2da90ef78b9112ded4 (patch)
treecd6ca8d4632c5c3bb94c9e0b50a2802a330a4449
parent2c0dfd48f0f510c757bc7b332d66cfed79125c2b (diff)
radv/winsys: Expose number of compute/dma rings.
Signed-off-by: Bas Nieuwenhuizen <basni@google.com> Reviewed-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--src/amd/vulkan/radv_radeon_winsys.h3
-rw-r--r--src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c14
2 files changed, 15 insertions, 2 deletions
diff --git a/src/amd/vulkan/radv_radeon_winsys.h b/src/amd/vulkan/radv_radeon_winsys.h
index 76363a3552..db7650c9db 100644
--- a/src/amd/vulkan/radv_radeon_winsys.h
+++ b/src/amd/vulkan/radv_radeon_winsys.h
@@ -89,8 +89,9 @@ struct radeon_info {
bool has_dedicated_vram;
bool has_virtual_memory;
bool gfx_ib_pad_with_type2;
- bool has_sdma;
bool has_uvd;
+ uint32_t sdma_rings;
+ uint32_t compute_rings;
uint32_t vce_fw_version;
uint32_t vce_harvest_config;
uint32_t clock_crystal_freq;
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
index b2e171a082..1ae78ac8d1 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
@@ -118,6 +118,7 @@ do_winsys_init(struct radv_amdgpu_winsys *ws, int fd)
struct amdgpu_buffer_size_alignments alignment_info = {};
struct amdgpu_heap_info vram, visible_vram, gtt;
struct drm_amdgpu_info_hw_ip dma = {};
+ struct drm_amdgpu_info_hw_ip compute = {};
drmDevicePtr devinfo;
int r;
int i, j;
@@ -170,6 +171,12 @@ do_winsys_init(struct radv_amdgpu_winsys *ws, int fd)
fprintf(stderr, "amdgpu: amdgpu_query_hw_ip_info(dma) failed.\n");
goto fail;
}
+
+ r = amdgpu_query_hw_ip_info(ws->dev, AMDGPU_HW_IP_COMPUTE, 0, &compute);
+ if (r) {
+ fprintf(stderr, "amdgpu: amdgpu_query_hw_ip_info(compute) failed.\n");
+ goto fail;
+ }
ws->info.pci_id = ws->amdinfo.asic_id; /* TODO: is this correct? */
ws->info.vce_harvest_config = ws->amdinfo.vce_harvest_config;
@@ -273,6 +280,10 @@ do_winsys_init(struct radv_amdgpu_winsys *ws, int fd)
fprintf(stderr, "amdgpu: Cannot create addrlib.\n");
goto fail;
}
+
+ assert(util_is_power_of_two(dma.available_rings + 1));
+ assert(util_is_power_of_two(compute.available_rings + 1));
+
/* Set hardware information. */
ws->info.name = get_chip_name(ws->info.family);
ws->info.gart_size = gtt.heap_size;
@@ -290,7 +301,8 @@ do_winsys_init(struct radv_amdgpu_winsys *ws, int fd)
ws->info.num_tile_pipes = radv_cik_get_num_tile_pipes(&ws->amdinfo);
ws->info.pipe_interleave_bytes = 256 << ((ws->amdinfo.gb_addr_cfg >> 4) & 0x7);
ws->info.has_virtual_memory = TRUE;
- ws->info.has_sdma = dma.available_rings != 0;
+ ws->info.sdma_rings = util_bitcount(dma.available_rings);
+ ws->info.compute_rings = util_bitcount(compute.available_rings);
/* Get the number of good compute units. */
ws->info.num_good_compute_units = 0;