Module: Mesa Branch: master Commit: 6c01c4b907fa43daaca6d0c0e23db4787611a165 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=6c01c4b907fa43daaca6d0c0e23db4787611a165
Author: Nicolai Hähnle <nicolai.haeh...@amd.com> Date: Fri May 12 01:04:56 2017 +0200 ac: add radeon_info::num_{sdma,compute}_rings Vulkan needs them. Reviewed-by: Marek Olšák <marek.ol...@amd.com> --- src/amd/common/ac_gpu_info.c | 15 +++++++++++++-- src/amd/common/ac_gpu_info.h | 3 ++- src/gallium/drivers/radeon/r600_pipe_common.c | 4 ++-- src/gallium/winsys/radeon/drm/radeon_drm_winsys.c | 4 ++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/amd/common/ac_gpu_info.c b/src/amd/common/ac_gpu_info.c index d1cd0c1557..cf5d6e1d8c 100644 --- a/src/amd/common/ac_gpu_info.c +++ b/src/amd/common/ac_gpu_info.c @@ -88,7 +88,7 @@ bool ac_query_gpu_info(int fd, amdgpu_device_handle dev, { struct amdgpu_buffer_size_alignments alignment_info = {}; struct amdgpu_heap_info vram, vram_vis, gtt; - struct drm_amdgpu_info_hw_ip dma = {}, uvd = {}, vce = {}; + struct drm_amdgpu_info_hw_ip dma = {}, compute = {}, uvd = {}, vce = {}; uint32_t vce_version = 0, vce_feature = 0, uvd_version = 0, uvd_feature = 0; uint32_t unused_feature; int r, i, j; @@ -145,6 +145,12 @@ bool ac_query_gpu_info(int fd, amdgpu_device_handle dev, return false; } + r = amdgpu_query_hw_ip_info(dev, AMDGPU_HW_IP_COMPUTE, 0, &compute); + if (r) { + fprintf(stderr, "amdgpu: amdgpu_query_hw_ip_info(compute) failed.\n"); + return false; + } + r = amdgpu_query_hw_ip_info(dev, AMDGPU_HW_IP_UVD, 0, &uvd); if (r) { fprintf(stderr, "amdgpu: amdgpu_query_hw_ip_info(uvd) failed.\n"); @@ -254,7 +260,12 @@ bool ac_query_gpu_info(int fd, amdgpu_device_handle dev, 256 << G_0098F8_PIPE_INTERLEAVE_SIZE_GFX6(amdinfo->gb_addr_cfg); } info->has_virtual_memory = true; - info->has_sdma = dma.available_rings != 0; + + assert(util_is_power_of_two(dma.available_rings + 1)); + assert(util_is_power_of_two(compute.available_rings + 1)); + + info->num_sdma_rings = util_bitcount(dma.available_rings); + info->num_compute_rings = util_bitcount(compute.available_rings); /* Get the number of good compute units. */ info->num_good_compute_units = 0; diff --git a/src/amd/common/ac_gpu_info.h b/src/amd/common/ac_gpu_info.h index 0dd7dc7b16..9bf2b84d85 100644 --- a/src/amd/common/ac_gpu_info.h +++ b/src/amd/common/ac_gpu_info.h @@ -50,8 +50,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 num_sdma_rings; + uint32_t num_compute_rings; uint32_t uvd_fw_version; uint32_t vce_fw_version; uint32_t me_fw_version; diff --git a/src/gallium/drivers/radeon/r600_pipe_common.c b/src/gallium/drivers/radeon/r600_pipe_common.c index ccf90bc3a6..38a92190f0 100644 --- a/src/gallium/drivers/radeon/r600_pipe_common.c +++ b/src/gallium/drivers/radeon/r600_pipe_common.c @@ -672,7 +672,7 @@ bool r600_common_context_init(struct r600_common_context *rctx, if (!rctx->ctx) return false; - if (rscreen->info.has_sdma && !(rscreen->debug_flags & DBG_NO_ASYNC_DMA)) { + if (rscreen->info.num_sdma_rings && !(rscreen->debug_flags & DBG_NO_ASYNC_DMA)) { rctx->dma.cs = rctx->ws->cs_create(rctx->ctx, RING_DMA, r600_flush_dma_ring, rctx); @@ -1395,7 +1395,7 @@ bool r600_common_screen_init(struct r600_common_screen *rscreen, (int)DIV_ROUND_UP(rscreen->info.max_alloc_size, 1024*1024)); printf("has_virtual_memory = %i\n", rscreen->info.has_virtual_memory); printf("gfx_ib_pad_with_type2 = %i\n", rscreen->info.gfx_ib_pad_with_type2); - printf("has_sdma = %i\n", rscreen->info.has_sdma); + printf("num_sdma_rings = %i\n", rscreen->info.num_sdma_rings); printf("has_uvd = %i\n", rscreen->info.has_uvd); printf("me_fw_version = %i\n", rscreen->info.me_fw_version); printf("pfp_fw_version = %i\n", rscreen->info.pfp_fw_version); diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c index 2e7bfe9042..ff22b6559a 100644 --- a/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c +++ b/src/gallium/winsys/radeon/drm/radeon_drm_winsys.c @@ -305,10 +305,10 @@ static bool do_winsys_init(struct radeon_drm_winsys *ws) } /* Check for dma */ - ws->info.has_sdma = false; + ws->info.num_sdma_rings = 0; /* DMA is disabled on R700. There is IB corruption and hangs. */ if (ws->info.chip_class >= EVERGREEN && ws->info.drm_minor >= 27) { - ws->info.has_sdma = true; + ws->info.num_sdma_rings = 1; } /* Check for UVD and VCE */ _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-commit