mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
panfrost: Add panfrost_[blendable]_format_table() helpers
The format tables selection is currently done in pan_props, but we will soon need something similar in panvk if we want to get rid of panfrost_device there. Add panfrost_format_table() and panfrost_blendable_format_table() and use them to populate the panfrost_device format tables. Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Constantine Shablya <constantine.shablya@collabora.com> Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26698>
This commit is contained in:
parent
e0fe9c369a
commit
fba7f38fda
2 changed files with 38 additions and 14 deletions
|
|
@ -66,6 +66,24 @@ extern const struct pan_blendable_format
|
|||
panfrost_blendable_formats_v9[PIPE_FORMAT_COUNT];
|
||||
#define panfrost_blendable_formats_v10 panfrost_blendable_formats_v9
|
||||
|
||||
static inline const struct pan_blendable_format *
|
||||
panfrost_blendable_format_table(unsigned arch)
|
||||
{
|
||||
switch (arch) {
|
||||
#define FMT_TABLE(x) case x: return panfrost_blendable_formats_v ## x
|
||||
FMT_TABLE(4);
|
||||
FMT_TABLE(5);
|
||||
FMT_TABLE(6);
|
||||
FMT_TABLE(7);
|
||||
FMT_TABLE(9);
|
||||
FMT_TABLE(10);
|
||||
#undef FMT_TABLE
|
||||
default:
|
||||
assert(!"Unsupported architecture");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#define panfrost_pipe_format_v4 panfrost_pipe_format_v5
|
||||
extern const struct panfrost_format panfrost_pipe_format_v5[PIPE_FORMAT_COUNT];
|
||||
extern const struct panfrost_format panfrost_pipe_format_v6[PIPE_FORMAT_COUNT];
|
||||
|
|
@ -73,6 +91,24 @@ extern const struct panfrost_format panfrost_pipe_format_v7[PIPE_FORMAT_COUNT];
|
|||
extern const struct panfrost_format panfrost_pipe_format_v9[PIPE_FORMAT_COUNT];
|
||||
#define panfrost_pipe_format_v10 panfrost_pipe_format_v9
|
||||
|
||||
static inline const struct panfrost_format *
|
||||
panfrost_format_table(unsigned arch)
|
||||
{
|
||||
switch (arch) {
|
||||
#define FMT_TABLE(x) case x: return panfrost_pipe_format_v ## x
|
||||
FMT_TABLE(4);
|
||||
FMT_TABLE(5);
|
||||
FMT_TABLE(6);
|
||||
FMT_TABLE(7);
|
||||
FMT_TABLE(9);
|
||||
FMT_TABLE(10);
|
||||
#undef FMT_TABLE
|
||||
default:
|
||||
assert(!"Unsupported architecture");
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Helpers to construct swizzles */
|
||||
|
||||
#define PAN_V6_SWIZZLE(R, G, B, A) \
|
||||
|
|
|
|||
|
|
@ -249,20 +249,8 @@ panfrost_open_device(void *memctx, int fd, struct panfrost_device *dev)
|
|||
dev->compressed_formats = panfrost_query_compressed_formats(dev);
|
||||
dev->tiler_features = panfrost_query_tiler_features(dev);
|
||||
dev->has_afbc = panfrost_query_afbc(dev, dev->arch);
|
||||
|
||||
if (dev->arch <= 5) {
|
||||
dev->formats = panfrost_pipe_format_v5;
|
||||
dev->blendable_formats = panfrost_blendable_formats_v5;
|
||||
} else if (dev->arch == 6) {
|
||||
dev->formats = panfrost_pipe_format_v6;
|
||||
dev->blendable_formats = panfrost_blendable_formats_v6;
|
||||
} else if (dev->arch <= 7) {
|
||||
dev->formats = panfrost_pipe_format_v7;
|
||||
dev->blendable_formats = panfrost_blendable_formats_v7;
|
||||
} else {
|
||||
dev->formats = panfrost_pipe_format_v9;
|
||||
dev->blendable_formats = panfrost_blendable_formats_v9;
|
||||
}
|
||||
dev->formats = panfrost_format_table(dev->arch);
|
||||
dev->blendable_formats = panfrost_blendable_format_table(dev->arch);
|
||||
|
||||
util_sparse_array_init(&dev->bo_map, sizeof(struct panfrost_bo), 512);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue