Mesa (main): turnip: Get storage_16bit from fd_dev_info

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jul 14 02:20:02 UTC 2021


Module: Mesa
Branch: main
Commit: 06000f42ede8efef4225b6d1a27756c629c75787
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=06000f42ede8efef4225b6d1a27756c629c75787

Author: Rob Clark <robdclark at chromium.org>
Date:   Thu Jul  8 09:01:12 2021 -0700

turnip: Get storage_16bit from fd_dev_info

Removing more gpu_id checks that will become bogus as we add more a6xx.

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

---

 src/freedreno/common/freedreno_dev_info.h | 5 +++++
 src/freedreno/common/freedreno_devices.py | 1 +
 src/freedreno/vulkan/tu_descriptor_set.c  | 2 +-
 src/freedreno/vulkan/tu_device.c          | 6 +++---
 src/freedreno/vulkan/tu_shader.c          | 2 +-
 5 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/freedreno/common/freedreno_dev_info.h b/src/freedreno/common/freedreno_dev_info.h
index bed3c2c60d1..6bfef2934e7 100644
--- a/src/freedreno/common/freedreno_dev_info.h
+++ b/src/freedreno/common/freedreno_dev_info.h
@@ -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;
diff --git a/src/freedreno/common/freedreno_devices.py b/src/freedreno/common/freedreno_devices.py
index 4de74d65ec0..29e98b0bde9 100644
--- a/src/freedreno/common/freedreno_devices.py
+++ b/src/freedreno/common/freedreno_devices.py
@@ -193,6 +193,7 @@ a6xx_gen3 = dict(
         supports_multiview_mask = True,
         has_z24uint_s8uint = True,
         tess_use_shared = True,
+        storage_16bit = True,
     )
 
 add_gpus([
diff --git a/src/freedreno/vulkan/tu_descriptor_set.c b/src/freedreno/vulkan/tu_descriptor_set.c
index 8081075e446..508d9b355a0 100644
--- a/src/freedreno/vulkan/tu_descriptor_set.c
+++ b/src/freedreno/vulkan/tu_descriptor_set.c
@@ -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 {
diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c
index cb571c70cdb..e1f58cf442e 100644
--- a/src/freedreno/vulkan/tu_device.c
+++ b/src/freedreno/vulkan/tu_device.c
@@ -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;
diff --git a/src/freedreno/vulkan/tu_shader.c b/src/freedreno/vulkan/tu_shader.c
index 31fe825050f..25d720b3574 100644
--- a/src/freedreno/vulkan/tu_shader.c
+++ b/src/freedreno/vulkan/tu_shader.c
@@ -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,



More information about the mesa-commit mailing list