panfrost: Use tiled AFBC textures

On GPUs that support AFBC with tiled headers, try to use tiled headers instead
of linear headers. This should be a bit more efficient for the caches.
Additionally, on Mali, tiled headers are tied to solid colour blocks, so this
has the effect of enabling AFBC with solid colour blocks where supported.

Unfortunately, results are disappointing. Mali-G52:

-btexture from 856fps to 859fps
-bdesktop from 292fps to 294fps

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16697>
This commit is contained in:
Alyssa Rosenzweig
2022-05-05 11:05:32 -04:00
committed by Marge Bot
parent 0255f554f3
commit 6450037b32
@@ -350,6 +350,20 @@ panfrost_should_afbc(struct panfrost_device *dev,
return true;
}
/*
* For a resource we want to use AFBC with, should we use AFBC with tiled
* headers? On GPUs that support it, this is believed to be beneficial for
* images that are at least 128x128.
*/
static bool
panfrost_should_tile_afbc(const struct panfrost_device *dev,
const struct panfrost_resource *pres)
{
return panfrost_afbc_can_tile(dev) &&
pres->base.width0 >= 128 &&
pres->base.height0 >= 128;
}
static bool
panfrost_should_tile(struct panfrost_device *dev,
const struct panfrost_resource *pres,
@@ -395,6 +409,9 @@ panfrost_best_modifier(struct panfrost_device *dev,
if (panfrost_afbc_can_ytr(pres->base.format))
afbc |= AFBC_FORMAT_MOD_YTR;
if (panfrost_should_tile_afbc(dev, pres))
afbc |= AFBC_FORMAT_MOD_TILED | AFBC_FORMAT_MOD_SC;
return DRM_FORMAT_MOD_ARM_AFBC(afbc);
} else if (panfrost_should_tile(dev, pres, fmt))
return DRM_FORMAT_MOD_ARM_16X16_BLOCK_U_INTERLEAVED;