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@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13497>
This commit is contained in:
Alyssa Rosenzweig 2021-10-05 16:05:56 -04:00
parent 3e168b97cc
commit 68a7fafe2a
3 changed files with 7 additions and 11 deletions

View file

@ -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 */

View file

@ -574,12 +574,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) {
@ -842,15 +839,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;

View file

@ -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 */