panfrost: Detect implementations support AFBC
AFBC is an optional feature on Bifrost. If it is missing, a bit will be set in the poorly named AFBC_FEATURES register. Check this so we can act appropriately. 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:
parent
ebe9494b61
commit
3e168b97cc
|
@ -160,6 +160,7 @@ struct panfrost_device {
|
|||
unsigned thread_tls_alloc;
|
||||
struct panfrost_tiler_features tiler_features;
|
||||
unsigned quirks;
|
||||
bool has_afbc;
|
||||
|
||||
/* Table of formats, indexed by a PIPE format */
|
||||
const struct panfrost_format *formats;
|
||||
|
|
|
@ -214,6 +214,19 @@ panfrost_model_name(unsigned gpu_id)
|
|||
}
|
||||
}
|
||||
|
||||
/* Check for AFBC hardware support. AFBC is introduced in v5. Implementations
|
||||
* may omit it, signaled as a nonzero value in the AFBC_FEATURES property. */
|
||||
|
||||
static bool
|
||||
panfrost_query_afbc(int fd, unsigned arch)
|
||||
{
|
||||
unsigned reg = panfrost_query_raw(fd,
|
||||
DRM_PANFROST_PARAM_AFBC_FEATURES,
|
||||
false, 0);
|
||||
|
||||
return (arch >= 5) && (reg == 0);
|
||||
}
|
||||
|
||||
void
|
||||
panfrost_open_device(void *memctx, int fd, struct panfrost_device *dev)
|
||||
{
|
||||
|
@ -228,6 +241,7 @@ panfrost_open_device(void *memctx, int fd, struct panfrost_device *dev)
|
|||
dev->quirks = panfrost_get_quirks(dev->gpu_id, revision);
|
||||
dev->compressed_formats = panfrost_query_compressed_formats(fd);
|
||||
dev->tiler_features = panfrost_query_tiler_features(fd);
|
||||
dev->has_afbc = panfrost_query_afbc(fd, dev->arch);
|
||||
|
||||
if (dev->quirks & HAS_SWIZZLES)
|
||||
dev->formats = panfrost_pipe_format_v6;
|
||||
|
|
Loading…
Reference in New Issue