Mesa (staging/21.2): panfrost,panvk: Use dev->has_afbc instead of quirks

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Oct 25 19:42:01 UTC 2021


Module: Mesa
Branch: staging/21.2
Commit: 01ce686781e3888079f1694e3182773fadf6f5a9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=01ce686781e3888079f1694e3182773fadf6f5a9

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Tue Oct  5 16:05:56 2021 -0400

panfrost,panvk: Use dev->has_afbc instead of quirks

This uses the new property for AFBC we've added. The AFBC quirk is
applied only to v4, and we only set dev->has_afbc on v5+ so this is not
a regression. It now respects the hardware-specific AFBC disable.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13497>
(cherry picked from commit 68a7fafe2a54ca61700a955bd8d7884e2f750814)

---

 .pick_status.json                           |  2 +-
 src/gallium/drivers/panfrost/pan_resource.c |  4 ++--
 src/gallium/drivers/panfrost/pan_screen.c   | 12 ++++--------
 src/panfrost/vulkan/panvk_image.c           |  2 +-
 4 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 70ef96201c0..95362237764 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -112,7 +112,7 @@
         "description": "panfrost,panvk: Use dev->has_afbc instead of quirks",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": null
     },
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 131699ac8d9..6ed1d8ff2f6 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -355,8 +355,8 @@ panfrost_should_afbc(struct panfrost_device *dev,
         if (pres->base.bind & ~valid_binding)
                 return false;
 
-        /* AFBC introduced with Mali T760 */
-        if (dev->quirks & MIDGARD_NO_AFBC)
+        /* AFBC support is optional */
+        if (!dev->has_afbc)
                 return false;
 
         /* AFBC<-->staging is expensive */
diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c
index 65d5c0818f8..e0ef3ab0b3b 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -560,12 +560,9 @@ panfrost_walk_dmabuf_modifiers(struct pipe_screen *screen,
 {
         /* Query AFBC status */
         struct panfrost_device *dev = pan_device(screen);
-        bool afbc = panfrost_format_supports_afbc(dev, format);
+        bool afbc = dev->has_afbc && panfrost_format_supports_afbc(dev, format);
         bool ytr = panfrost_afbc_can_ytr(format);
 
-        /* Don't advertise AFBC before T760 */
-        afbc &= !(dev->quirks & MIDGARD_NO_AFBC);
-
         unsigned count = 0;
 
         for (unsigned i = 0; i < PAN_MODIFIER_COUNT; ++i) {
@@ -829,15 +826,14 @@ panfrost_create_screen(int fd, struct renderonly *ro)
         panfrost_open_device(screen, fd, dev);
 
         if (dev->debug & PAN_DBG_NO_AFBC)
-                dev->quirks |= MIDGARD_NO_AFBC;
+                dev->has_afbc = false;
 
-        /* XXX: AFBC is currently broken on Bifrost in a few different ways
+        /* XXX: AFBC is currently broken on Bifrost
          *
          *  - Preload is broken if the effective tile size is not 16x16
-         *  - Some systems lack AFBC but we need kernel changes to know that
          */
         if (dev->arch == 7)
-                dev->quirks |= MIDGARD_NO_AFBC;
+                dev->has_afbc = false;
 
         dev->ro = ro;
 
diff --git a/src/panfrost/vulkan/panvk_image.c b/src/panfrost/vulkan/panvk_image.c
index 52a984dfda0..99399a174e6 100644
--- a/src/panfrost/vulkan/panvk_image.c
+++ b/src/panfrost/vulkan/panvk_image.c
@@ -183,7 +183,7 @@ panvk_image_select_mod(VkDevice _device,
    if (pCreateInfo->samples > 1)
       return DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED;
 
-   if (pdev->quirks & MIDGARD_NO_AFBC)
+   if (!pdev->has_afbc)
       return DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED;
 
    /* Only a small selection of formats are AFBC'able */



More information about the mesa-commit mailing list