panfrost: Query tiler features
We need the maximum levels to configure the hierarchy mask correctly. We should also respect the bin size... Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11733>
This commit is contained in:
parent
329cb28d65
commit
fc69635516
|
@ -140,6 +140,16 @@ struct panfrost_format {
|
||||||
unsigned bind;
|
unsigned bind;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Implementation-defined tiler features */
|
||||||
|
struct panfrost_tiler_features {
|
||||||
|
/** Number of bytes per tiler bin */
|
||||||
|
unsigned bin_size;
|
||||||
|
|
||||||
|
/** Maximum number of levels that may be simultaneously enabled.
|
||||||
|
* Invariant: bitcount(hierarchy_mask) <= max_levels */
|
||||||
|
unsigned max_levels;
|
||||||
|
};
|
||||||
|
|
||||||
struct panfrost_device {
|
struct panfrost_device {
|
||||||
/* For ralloc */
|
/* For ralloc */
|
||||||
void *memctx;
|
void *memctx;
|
||||||
|
@ -151,6 +161,7 @@ struct panfrost_device {
|
||||||
unsigned gpu_id;
|
unsigned gpu_id;
|
||||||
unsigned core_count;
|
unsigned core_count;
|
||||||
unsigned thread_tls_alloc;
|
unsigned thread_tls_alloc;
|
||||||
|
struct panfrost_tiler_features tiler_features;
|
||||||
unsigned quirks;
|
unsigned quirks;
|
||||||
|
|
||||||
/* Table of formats, indexed by a PIPE format */
|
/* Table of formats, indexed by a PIPE format */
|
||||||
|
|
|
@ -85,6 +85,20 @@ panfrost_query_gpu_revision(int fd)
|
||||||
return panfrost_query_raw(fd, DRM_PANFROST_PARAM_GPU_REVISION, true, 0);
|
return panfrost_query_raw(fd, DRM_PANFROST_PARAM_GPU_REVISION, true, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static struct panfrost_tiler_features
|
||||||
|
panfrost_query_tiler_features(int fd)
|
||||||
|
{
|
||||||
|
/* Default value (2^9 bytes and 8 levels) to match old behaviour */
|
||||||
|
uint32_t raw = panfrost_query_raw(fd, DRM_PANFROST_PARAM_TILER_FEATURES,
|
||||||
|
false, 0x809);
|
||||||
|
|
||||||
|
/* Bin size is log2 in the first byte, max levels in the second byte */
|
||||||
|
return (struct panfrost_tiler_features) {
|
||||||
|
.bin_size = (1 << (raw & BITFIELD_MASK(5))),
|
||||||
|
.max_levels = (raw >> 8) & BITFIELD_MASK(4)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
static unsigned
|
static unsigned
|
||||||
panfrost_query_core_count(int fd)
|
panfrost_query_core_count(int fd)
|
||||||
{
|
{
|
||||||
|
@ -236,6 +250,7 @@ panfrost_open_device(void *memctx, int fd, struct panfrost_device *dev)
|
||||||
unsigned revision = panfrost_query_gpu_revision(fd);
|
unsigned revision = panfrost_query_gpu_revision(fd);
|
||||||
dev->quirks = panfrost_get_quirks(dev->gpu_id, revision);
|
dev->quirks = panfrost_get_quirks(dev->gpu_id, revision);
|
||||||
dev->compressed_formats = panfrost_query_compressed_formats(fd);
|
dev->compressed_formats = panfrost_query_compressed_formats(fd);
|
||||||
|
dev->tiler_features = panfrost_query_tiler_features(fd);
|
||||||
|
|
||||||
if (dev->quirks & HAS_SWIZZLES)
|
if (dev->quirks & HAS_SWIZZLES)
|
||||||
dev->formats = panfrost_pipe_format_v6;
|
dev->formats = panfrost_pipe_format_v6;
|
||||||
|
|
Loading…
Reference in New Issue