Module: Mesa Branch: main Commit: f2771245443c4a9367926356cdf72d6eee29d365 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f2771245443c4a9367926356cdf72d6eee29d365
Author: Erik Faye-Lund <erik.faye-l...@collabora.com> Date: Tue Oct 31 09:40:51 2023 +0100 panfrost: store blendable_formats in panfrost_device This way, we don't need to look at the generation to find the right version. It's also less code to update when we're adding new hardware generations. Reviewed-by: Boris Brezillon <boris.brezil...@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25968> --- src/panfrost/lib/pan_device.h | 1 + src/panfrost/lib/pan_props.c | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/panfrost/lib/pan_device.h b/src/panfrost/lib/pan_device.h index 8ad35a9d6b4..f21361aefdc 100644 --- a/src/panfrost/lib/pan_device.h +++ b/src/panfrost/lib/pan_device.h @@ -156,6 +156,7 @@ struct panfrost_device { /* Table of formats, indexed by a PIPE format */ const struct panfrost_format *formats; + const struct pan_blendable_format *blendable_formats; /* Bitmask of supported compressed texture formats */ uint32_t compressed_formats; diff --git a/src/panfrost/lib/pan_props.c b/src/panfrost/lib/pan_props.c index 890f97aee6d..f63f320eadf 100644 --- a/src/panfrost/lib/pan_props.c +++ b/src/panfrost/lib/pan_props.c @@ -270,12 +270,16 @@ panfrost_open_device(void *memctx, int fd, struct panfrost_device *dev) dev->tiler_features = panfrost_query_tiler_features(fd); dev->has_afbc = panfrost_query_afbc(fd, dev->arch); - if (dev->arch <= 6) + if (dev->arch <= 6) { dev->formats = panfrost_pipe_format_v6; - else if (dev->arch <= 7) + dev->blendable_formats = panfrost_blendable_formats_v6; + } else if (dev->arch <= 7) { dev->formats = panfrost_pipe_format_v7; - else + dev->blendable_formats = panfrost_blendable_formats_v7; + } else { dev->formats = panfrost_pipe_format_v9; + dev->blendable_formats = panfrost_blendable_formats_v9; + } util_sparse_array_init(&dev->bo_map, sizeof(struct panfrost_bo), 512);