radv/vulkan: Move radv_get_driver_version to src/vulkan/util
[mesa.git] / src / amd / vulkan / radv_device.c
index 9d510ea59ea0cad938bd41b8a040c6b03ac9ac4b..5fdb894146cb1d3347248765ea20c7ccaba391dd 100644 (file)
@@ -33,7 +33,7 @@
 #include "radv_cs.h"
 #include "util/disk_cache.h"
 #include "util/strtod.h"
-#include "util/vk_util.h"
+#include "vk_util.h"
 #include <xf86drm.h>
 #include <amdgpu.h>
 #include <amdgpu_drm.h>
@@ -304,6 +304,12 @@ radv_physical_device_init(struct radv_physical_device *device,
 
        radv_get_device_uuid(drm_device, device->device_uuid);
 
+       if (device->rad_info.family == CHIP_STONEY ||
+           device->rad_info.chip_class >= GFX9) {
+               device->has_rbplus = true;
+               device->rbplus_allowed = device->rad_info.family == CHIP_STONEY;
+       }
+
        return VK_SUCCESS;
 
 fail:
@@ -508,8 +514,8 @@ void radv_GetPhysicalDeviceFeatures(
        VkPhysicalDevice                            physicalDevice,
        VkPhysicalDeviceFeatures*                   pFeatures)
 {
-       //   RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice);
-
+       RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice);
+       bool is_gfx9 = pdevice->rad_info.chip_class >= GFX9;
        memset(pFeatures, 0, sizeof(*pFeatures));
 
        *pFeatures = (VkPhysicalDeviceFeatures) {
@@ -517,8 +523,8 @@ void radv_GetPhysicalDeviceFeatures(
                .fullDrawIndexUint32                      = true,
                .imageCubeArray                           = true,
                .independentBlend                         = true,
-               .geometryShader                           = true,
-               .tessellationShader                       = true,
+               .geometryShader                           = !is_gfx9,
+               .tessellationShader                       = !is_gfx9,
                .sampleRateShading                        = false,
                .dualSrcBlend                             = true,
                .logicOp                                  = true,
@@ -568,28 +574,6 @@ void radv_GetPhysicalDeviceFeatures2KHR(
        return radv_GetPhysicalDeviceFeatures(physicalDevice, &pFeatures->features);
 }
 
-static uint32_t radv_get_driver_version()
-{
-       const char *minor_string = strchr(VERSION, '.');
-       const char *patch_string = minor_string ? strchr(minor_string + 1, ','): NULL;
-       int major = atoi(VERSION);
-       int minor = minor_string ? atoi(minor_string + 1) : 0;
-       int patch = patch_string ? atoi(patch_string + 1) : 0;
-       if (strstr(VERSION, "devel")) {
-               if (patch == 0) {
-                       patch = 99;
-                       if (minor == 0) {
-                               minor = 99;
-                               --major;
-                       } else
-                               --minor;
-               } else
-                       --patch;
-       }
-       uint32_t version = VK_MAKE_VERSION(major, minor, patch);
-       return version;
-}
-
 void radv_GetPhysicalDeviceProperties(
        VkPhysicalDevice                            physicalDevice,
        VkPhysicalDeviceProperties*                 pProperties)
@@ -725,10 +709,10 @@ void radv_GetPhysicalDeviceProperties(
 
        *pProperties = (VkPhysicalDeviceProperties) {
                .apiVersion = VK_MAKE_VERSION(1, 0, 42),
-               .driverVersion = radv_get_driver_version(),
+               .driverVersion = vk_get_driver_version(),
                .vendorID = 0x1002,
                .deviceID = pdevice->rad_info.pci_id,
-               .deviceType = VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU,
+               .deviceType = pdevice->rad_info.has_dedicated_vram ? VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU : VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU,
                .limits = limits,
                .sparseProperties = {0},
        };
@@ -1722,6 +1706,10 @@ radv_get_preamble_cs(struct radv_queue *queue,
                                                       S_030938_SIZE(tess_factor_ring_size / 4));
                                radeon_set_uconfig_reg(cs, R_030940_VGT_TF_MEMORY_BASE,
                                                       tf_va >> 8);
+                               if (queue->device->physical_device->rad_info.chip_class >= GFX9) {
+                                       radeon_set_uconfig_reg(cs, R_030944_VGT_TF_MEMORY_BASE_HI,
+                                                              tf_va >> 40);
+                               }
                                radeon_set_uconfig_reg(cs, R_03093C_VGT_HS_OFFCHIP_PARAM, hs_offchip_param);
                        } else {
                                radeon_set_config_reg(cs, R_008988_VGT_TF_RING_SIZE,