From: Nicolai Hähnle <nicolai.haeh...@amd.com>

---
 src/amd/vulkan/radv_device.c                      | 28 ++++++++++++++++++++++-
 src/amd/vulkan/radv_radeon_winsys.h               |  1 -
 src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c | 28 -----------------------
 3 files changed, 27 insertions(+), 30 deletions(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 62052f7..b4f2331 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -180,20 +180,46 @@ is_extension_enabled(const VkExtensionProperties 
*extensions,
        assert(extensions && name);
 
        for (uint32_t i = 0; i < num_ext; i++) {
                if (strcmp(name, extensions[i].extensionName) == 0)
                        return true;
        }
 
        return false;
 }
 
+static const char *
+get_chip_name(enum radeon_family family)
+{
+       switch (family) {
+       case CHIP_TAHITI: return "AMD RADV TAHITI";
+       case CHIP_PITCAIRN: return "AMD RADV PITCAIRN";
+       case CHIP_VERDE: return "AMD RADV CAPE VERDE";
+       case CHIP_OLAND: return "AMD RADV OLAND";
+       case CHIP_HAINAN: return "AMD RADV HAINAN";
+       case CHIP_BONAIRE: return "AMD RADV BONAIRE";
+       case CHIP_KAVERI: return "AMD RADV KAVERI";
+       case CHIP_KABINI: return "AMD RADV KABINI";
+       case CHIP_HAWAII: return "AMD RADV HAWAII";
+       case CHIP_MULLINS: return "AMD RADV MULLINS";
+       case CHIP_TONGA: return "AMD RADV TONGA";
+       case CHIP_ICELAND: return "AMD RADV ICELAND";
+       case CHIP_CARRIZO: return "AMD RADV CARRIZO";
+       case CHIP_FIJI: return "AMD RADV FIJI";
+       case CHIP_POLARIS10: return "AMD RADV POLARIS10";
+       case CHIP_POLARIS11: return "AMD RADV POLARIS11";
+       case CHIP_POLARIS12: return "AMD RADV POLARIS12";
+       case CHIP_STONEY: return "AMD RADV STONEY";
+       default: return "AMD RADV unknown";
+       }
+}
+
 static VkResult
 radv_physical_device_init(struct radv_physical_device *device,
                          struct radv_instance *instance,
                          const char *path)
 {
        VkResult result;
        drmVersionPtr version;
        int fd;
 
        fd = open(path, O_RDWR | O_CLOEXEC);
@@ -242,21 +268,21 @@ radv_physical_device_init(struct radv_physical_device 
*device,
        }
 
        result = radv_extensions_register(instance,
                                        &device->extensions,
                                        common_device_extensions,
                                        ARRAY_SIZE(common_device_extensions));
        if (result != VK_SUCCESS)
                goto fail;
 
        fprintf(stderr, "WARNING: radv is not a conformant vulkan 
implementation, testing use only.\n");
-       device->name = device->rad_info.name;
+       device->name = get_chip_name(device->rad_info.family);
 
        return VK_SUCCESS;
 
 fail:
        close(fd);
        return result;
 }
 
 static void
 radv_physical_device_finish(struct radv_physical_device *device)
diff --git a/src/amd/vulkan/radv_radeon_winsys.h 
b/src/amd/vulkan/radv_radeon_winsys.h
index 8173714..855a2d7 100644
--- a/src/amd/vulkan/radv_radeon_winsys.h
+++ b/src/amd/vulkan/radv_radeon_winsys.h
@@ -77,21 +77,20 @@ struct radeon_winsys_cs {
 struct radeon_info {
        /* PCI info: domain:bus:dev:func */
        uint32_t                    pci_domain;
        uint32_t                    pci_bus;
        uint32_t                    pci_dev;
        uint32_t                    pci_func;
 
        /* Device info. */
        uint32_t                    pci_id;
        enum radeon_family          family;
-       const char                  *name;
        enum chip_class             chip_class;
        uint32_t                    gart_page_size;
        uint64_t                    gart_size;
        uint64_t                    vram_size;
        uint64_t                    visible_vram_size;
        bool                        has_dedicated_vram;
        bool                     has_virtual_memory;
        bool                        gfx_ib_pad_with_type2;
        bool                     has_uvd;
        uint32_t                    sdma_rings;
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c 
b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
index 629da31..d144d03 100644
--- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
+++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_winsys.c
@@ -80,47 +80,20 @@ static unsigned radv_cik_get_num_tile_pipes(struct 
amdgpu_gpu_info *info)
        case CIK__PIPE_CONFIG__ADDR_SURF_P16_32X32_8X16:
        case CIK__PIPE_CONFIG__ADDR_SURF_P16_32X32_16X16:
                return 16;
        default:
                fprintf(stderr, "Invalid CIK pipe configuration, assuming 
P2\n");
                assert(!"this should never occur");
                return 2;
        }
 }
 
-static const char *
-get_chip_name(enum radeon_family family)
-{
-       switch (family) {
-       case CHIP_TAHITI: return "AMD RADV TAHITI";
-       case CHIP_PITCAIRN: return "AMD RADV PITCAIRN";
-       case CHIP_VERDE: return "AMD RADV CAPE VERDE";
-       case CHIP_OLAND: return "AMD RADV OLAND";
-       case CHIP_HAINAN: return "AMD RADV HAINAN";
-       case CHIP_BONAIRE: return "AMD RADV BONAIRE";
-       case CHIP_KAVERI: return "AMD RADV KAVERI";
-       case CHIP_KABINI: return "AMD RADV KABINI";
-       case CHIP_HAWAII: return "AMD RADV HAWAII";
-       case CHIP_MULLINS: return "AMD RADV MULLINS";
-       case CHIP_TONGA: return "AMD RADV TONGA";
-       case CHIP_ICELAND: return "AMD RADV ICELAND";
-       case CHIP_CARRIZO: return "AMD RADV CARRIZO";
-       case CHIP_FIJI: return "AMD RADV FIJI";
-       case CHIP_POLARIS10: return "AMD RADV POLARIS10";
-       case CHIP_POLARIS11: return "AMD RADV POLARIS11";
-       case CHIP_POLARIS12: return "AMD RADV POLARIS12";
-       case CHIP_STONEY: return "AMD RADV STONEY";
-       default: return "AMD RADV unknown";
-       }
-}
-
-
 static bool
 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;
@@ -284,21 +257,20 @@ do_winsys_init(struct radv_amdgpu_winsys *ws, int fd)
        ws->addrlib = radv_amdgpu_addr_create(&ws->amdinfo, ws->family, 
ws->rev_id, ws->info.chip_class);
        if (!ws->addrlib) {
                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;
        ws->info.vram_size = vram.heap_size;
        ws->info.visible_vram_size = visible_vram.heap_size;
        /* convert the shader clock from KHz to MHz */
        ws->info.max_shader_clock = ws->amdinfo.max_engine_clk / 1000;
        ws->info.max_se = ws->amdinfo.num_shader_engines;
        ws->info.max_sh_per_se = ws->amdinfo.num_shader_arrays_per_engine;
        ws->info.has_uvd = 0;
        ws->info.vce_fw_version = 0;
        ws->info.has_userptr = TRUE;
-- 
2.9.3

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to