ac: add radeon_info::num_{sdma,compute}_rings
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 11 May 2017 23:04:56 +0000 (01:04 +0200)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 18 May 2017 09:48:53 +0000 (11:48 +0200)
Vulkan needs them.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/amd/common/ac_gpu_info.c
src/amd/common/ac_gpu_info.h
src/gallium/drivers/radeon/r600_pipe_common.c
src/gallium/winsys/radeon/drm/radeon_drm_winsys.c

index d1cd0c15572ab1ed6a6a363f6cde1013deb224f8..cf5d6e1d8ca603578e7772688c39c93c96931f3a 100644 (file)
@@ -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;
index 0dd7dc7b16dc2d05273cdf915e656bd4603300dd..9bf2b84d85183ea4aec9a5d8d9f04976c5d1521b 100644 (file)
@@ -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;
index ccf90bc3a6ce7b9319a0e3394fee515eb299d5c3..38a92190f0e67bcce72753f814c340154b22fc19 100644 (file)
@@ -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);
index 2e7bfe904236bc5e022d34c41253aa69fd1f35ad..ff22b6559ab84c382d727525bbf650f7ec342b7a 100644 (file)
@@ -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 */