turnip: Get storage_16bit from fd_dev_info
authorRob Clark <robdclark@chromium.org>
Thu, 8 Jul 2021 16:01:12 +0000 (09:01 -0700)
committerMarge Bot <eric+marge@anholt.net>
Wed, 14 Jul 2021 01:58:00 +0000 (01:58 +0000)
Removing more gpu_id checks that will become bogus as we add more a6xx.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11790>

src/freedreno/common/freedreno_dev_info.h
src/freedreno/common/freedreno_devices.py
src/freedreno/vulkan/tu_descriptor_set.c
src/freedreno/vulkan/tu_device.c
src/freedreno/vulkan/tu_shader.c

index bed3c2c..6bfef29 100644 (file)
@@ -68,6 +68,11 @@ struct fd_dev_info {
 
          bool tess_use_shared;
 
+         /* newer a6xx allows using 16-bit descriptor for both 16-bit
+          * and 32-bit access
+          */
+         bool storage_16bit;
+
          struct {
             uint32_t RB_UNKNOWN_8E04_blit;
             uint32_t PC_UNKNOWN_9805;
index 4de74d6..29e98b0 100644 (file)
@@ -193,6 +193,7 @@ a6xx_gen3 = dict(
         supports_multiview_mask = True,
         has_z24uint_s8uint = True,
         tess_use_shared = True,
+        storage_16bit = True,
     )
 
 add_gpus([
index 8081075..508d9b3 100644 (file)
@@ -726,7 +726,7 @@ write_buffer_descriptor(const struct tu_device *device,
    uint64_t va = tu_buffer_iova(buffer) + buffer_info->offset;
    uint32_t range = get_range(buffer, buffer_info->offset, buffer_info->range);
    /* newer a6xx allows using 16-bit descriptor for both 16-bit and 32-bit access */
-   if (device->physical_device->gpu_id >= 650) {
+   if (device->physical_device->info->a6xx.storage_16bit) {
       dst[0] = A6XX_IBO_0_TILE_MODE(TILE6_LINEAR) | A6XX_IBO_0_FMT(FMT6_16_UINT);
       dst[1] = DIV_ROUND_UP(range, 2);
    } else {
index cb571c7..e1f58cf 100644 (file)
@@ -113,7 +113,7 @@ get_device_extensions(const struct tu_physical_device *device,
                       struct vk_device_extension_table *ext)
 {
    *ext = (struct vk_device_extension_table) {
-      .KHR_16bit_storage = device->gpu_id >= 650,
+      .KHR_16bit_storage = device->info->a6xx.storage_16bit,
       .KHR_bind_memory2 = true,
       .KHR_create_renderpass2 = true,
       .KHR_dedicated_allocation = true,
@@ -480,7 +480,7 @@ tu_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
       switch (ext->sType) {
       case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES: {
          VkPhysicalDeviceVulkan11Features *features = (void *) ext;
-         features->storageBuffer16BitAccess            = pdevice->gpu_id >= 650;
+         features->storageBuffer16BitAccess            = pdevice->info->a6xx.storage_16bit;
          features->uniformAndStorageBuffer16BitAccess  = false;
          features->storagePushConstant16               = false;
          features->storageInputOutput16                = false;
@@ -576,7 +576,7 @@ tu_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
       case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: {
          VkPhysicalDevice16BitStorageFeatures *features =
             (VkPhysicalDevice16BitStorageFeatures *) ext;
-         features->storageBuffer16BitAccess = pdevice->gpu_id >= 650;
+         features->storageBuffer16BitAccess = pdevice->info->a6xx.storage_16bit;
          features->uniformAndStorageBuffer16BitAccess = false;
          features->storagePushConstant16 = false;
          features->storageInputOutput16 = false;
index 31fe825..25d720b 100644 (file)
@@ -76,7 +76,7 @@ tu_spirv_to_nir(struct tu_device *dev,
          .float_controls = true,
          .float16 = true,
          .int16 = true,
-         .storage_16bit = dev->physical_device->gpu_id >= 650,
+         .storage_16bit = dev->physical_device->info->a6xx.storage_16bit,
          .demote_to_helper_invocation = true,
          .vk_memory_model = true,
          .vk_memory_model_device_scope = true,