From fb95e8ada0152084cdbe65842dc8380bd8d54a02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Louis-Francis=20Ratt=C3=A9-Boulianne?= Date: Tue, 31 Oct 2023 15:59:44 -0400 Subject: [PATCH] panfrost: add device querying for AFRC support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As of now, only Mali-G310 supports ARM fixed-rate compression but it should be advertised in bit 25 of TEXTURE_FEATURES_0 Signed-off-by: Louis-Francis Ratté-Boulianne Acked-by: Erik Faye-Lund Part-of: --- src/gallium/drivers/panfrost/pan_device.c | 1 + src/gallium/drivers/panfrost/pan_device.h | 1 + src/panfrost/lib/pan_props.c | 10 ++++++++++ src/panfrost/lib/pan_props.h | 2 ++ 4 files changed, 14 insertions(+) diff --git a/src/gallium/drivers/panfrost/pan_device.c b/src/gallium/drivers/panfrost/pan_device.c index 580ae7ac5af..17397c6a3bf 100644 --- a/src/gallium/drivers/panfrost/pan_device.c +++ b/src/gallium/drivers/panfrost/pan_device.c @@ -100,6 +100,7 @@ panfrost_open_device(void *memctx, int fd, struct panfrost_device *dev) panfrost_query_compressed_formats(&dev->kmod.props); dev->tiler_features = panfrost_query_tiler_features(&dev->kmod.props); dev->has_afbc = panfrost_query_afbc(&dev->kmod.props); + dev->has_afrc = panfrost_query_afrc(&dev->kmod.props); dev->formats = panfrost_format_table(dev->arch); dev->blendable_formats = panfrost_blendable_format_table(dev->arch); diff --git a/src/gallium/drivers/panfrost/pan_device.h b/src/gallium/drivers/panfrost/pan_device.h index 49b5e7350bd..4eb7b4b0dd6 100644 --- a/src/gallium/drivers/panfrost/pan_device.h +++ b/src/gallium/drivers/panfrost/pan_device.h @@ -111,6 +111,7 @@ struct panfrost_device { struct panfrost_tiler_features tiler_features; const struct panfrost_model *model; bool has_afbc; + bool has_afrc; /* Table of formats, indexed by a PIPE format */ const struct panfrost_format *formats; diff --git a/src/panfrost/lib/pan_props.c b/src/panfrost/lib/pan_props.c index bc5eacabd0d..278abfd2661 100644 --- a/src/panfrost/lib/pan_props.c +++ b/src/panfrost/lib/pan_props.c @@ -178,6 +178,16 @@ panfrost_query_afbc(const struct pan_kmod_dev_props *props) return (pan_arch(props->gpu_prod_id) >= 5) && (reg == 0); } +/* Check for AFRC hardware support. AFRC is introduced in v10. Implementations + * may omit it, signaled in bit 25 of TEXTURE_FEATURES_0 property. */ + +bool +panfrost_query_afrc(const struct pan_kmod_dev_props *props) +{ + return (pan_arch(props->gpu_prod_id) >= 10) && + (props->texture_features[0] & (1 << 25)); +} + /* * To pipeline multiple tiles, a given tile may use at most half of the tile * buffer. This function returns the optimal size (assuming pipelining). diff --git a/src/panfrost/lib/pan_props.h b/src/panfrost/lib/pan_props.h index b80d4977622..a6cee6089de 100644 --- a/src/panfrost/lib/pan_props.h +++ b/src/panfrost/lib/pan_props.h @@ -94,6 +94,8 @@ unsigned panfrost_query_core_count(const struct pan_kmod_dev_props *props, bool panfrost_query_afbc(const struct pan_kmod_dev_props *props); +bool panfrost_query_afrc(const struct pan_kmod_dev_props *props); + unsigned panfrost_query_optimal_tib_size(const struct panfrost_model *model); uint64_t panfrost_clamp_to_usable_va_range(const struct pan_kmod_dev *dev,