panfrost: Prepare support for GPU variants

Some GPU gens have variants impacting the GPU capabilities. Let the
kmod backend report a variant ID through a new
pan_kmod_dev_props::gpu_variant field, and patch the panfrost_model
logic to match both the gpu_id and the gpu_variant.

All existing entries are assumed to have no variant, hence the
gpu_variant field assigned to zero.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Antonino Maniscalco <antonino.maniscalco@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26358>
This commit is contained in:
Boris Brezillon
2024-01-17 08:53:41 +01:00
committed by Marge Bot
parent 4477daf957
commit 1519d613c8
6 changed files with 37 additions and 25 deletions
+2 -1
View File
@@ -71,7 +71,8 @@ panfrost_open_device(void *memctx, int fd, struct panfrost_device *dev)
pan_kmod_dev_query_props(dev->kmod.dev, &dev->kmod.props);
dev->arch = pan_arch(dev->kmod.props.gpu_prod_id);
dev->model = panfrost_get_model(dev->kmod.props.gpu_prod_id);
dev->model = panfrost_get_model(dev->kmod.props.gpu_prod_id,
dev->kmod.props.gpu_variant);
/* If we don't recognize the model, bail early */
if (!dev->model)
+3
View File
@@ -137,6 +137,9 @@ struct pan_kmod_dev_props {
/* GPU revision. */
uint32_t gpu_revision;
/* GPU variant. */
uint32_t gpu_variant;
/* Bitmask encoding the number of shader cores exposed by the GPU. */
uint64_t shader_present;
+23 -21
View File
@@ -36,10 +36,11 @@
#define NO_ANISO (~0)
#define HAS_ANISO (0)
#define MODEL(gpu_id_, shortname, counters_, min_rev_anisotropic_, tib_size_, \
quirks_) \
#define MODEL(gpu_id_, gpu_variant_, shortname, counters_, \
min_rev_anisotropic_, tib_size_, quirks_) \
{ \
.gpu_id = gpu_id_, .name = "Mali-" shortname " (Panfrost)", \
.gpu_id = gpu_id_, .gpu_variant = gpu_variant_, \
.name = "Mali-" shortname " (Panfrost)", \
.performance_counters = counters_, \
.min_rev_anisotropic = min_rev_anisotropic_, \
.tilebuffer_size = tib_size_, .quirks = quirks_, \
@@ -48,23 +49,23 @@
/* Table of supported Mali GPUs */
/* clang-format off */
const struct panfrost_model panfrost_model_list[] = {
MODEL(0x620, "T620", "T62x", NO_ANISO, 8192, {}),
MODEL(0x720, "T720", "T72x", NO_ANISO, 8192, { .no_hierarchical_tiling = true }),
MODEL(0x750, "T760", "T76x", NO_ANISO, 8192, {}),
MODEL(0x820, "T820", "T82x", NO_ANISO, 8192, { .no_hierarchical_tiling = true }),
MODEL(0x830, "T830", "T83x", NO_ANISO, 8192, { .no_hierarchical_tiling = true }),
MODEL(0x860, "T860", "T86x", NO_ANISO, 8192, {}),
MODEL(0x880, "T880", "T88x", NO_ANISO, 8192, {}),
MODEL(0x620, 0, "T620", "T62x", NO_ANISO, 8192, {}),
MODEL(0x720, 0, "T720", "T72x", NO_ANISO, 8192, { .no_hierarchical_tiling = true }),
MODEL(0x750, 0, "T760", "T76x", NO_ANISO, 8192, {}),
MODEL(0x820, 0, "T820", "T82x", NO_ANISO, 8192, { .no_hierarchical_tiling = true }),
MODEL(0x830, 0, "T830", "T83x", NO_ANISO, 8192, { .no_hierarchical_tiling = true }),
MODEL(0x860, 0, "T860", "T86x", NO_ANISO, 8192, {}),
MODEL(0x880, 0, "T880", "T88x", NO_ANISO, 8192, {}),
MODEL(0x6000, "G71", "TMIx", NO_ANISO, 8192, {}),
MODEL(0x6221, "G72", "THEx", 0x0030 /* r0p3 */, 16384, {}),
MODEL(0x7090, "G51", "TSIx", 0x1010 /* r1p1 */, 16384, {}),
MODEL(0x7093, "G31", "TDVx", HAS_ANISO, 16384, {}),
MODEL(0x7211, "G76", "TNOx", HAS_ANISO, 16384, {}),
MODEL(0x7212, "G52", "TGOx", HAS_ANISO, 16384, {}),
MODEL(0x7402, "G52 r1", "TGOx", HAS_ANISO, 16384, {}),
MODEL(0x9091, "G57", "TNAx", HAS_ANISO, 16384, {}),
MODEL(0x9093, "G57", "TNAx", HAS_ANISO, 16384, {}),
MODEL(0x6000, 0, "G71", "TMIx", NO_ANISO, 8192, {}),
MODEL(0x6221, 0, "G72", "THEx", 0x0030 /* r0p3 */, 16384, {}),
MODEL(0x7090, 0, "G51", "TSIx", 0x1010 /* r1p1 */, 16384, {}),
MODEL(0x7093, 0, "G31", "TDVx", HAS_ANISO, 16384, {}),
MODEL(0x7211, 0, "G76", "TNOx", HAS_ANISO, 16384, {}),
MODEL(0x7212, 0, "G52", "TGOx", HAS_ANISO, 16384, {}),
MODEL(0x7402, 0, "G52 r1", "TGOx", HAS_ANISO, 16384, {}),
MODEL(0x9091, 0, "G57", "TNAx", HAS_ANISO, 16384, {}),
MODEL(0x9093, 0, "G57", "TNAx", HAS_ANISO, 16384, {}),
};
/* clang-format on */
@@ -77,10 +78,11 @@ const struct panfrost_model panfrost_model_list[] = {
* supported at this time.
*/
const struct panfrost_model *
panfrost_get_model(uint32_t gpu_id)
panfrost_get_model(uint32_t gpu_id, uint32_t gpu_variant)
{
for (unsigned i = 0; i < ARRAY_SIZE(panfrost_model_list); ++i) {
if (panfrost_model_list[i].gpu_id == gpu_id)
if (panfrost_model_list[i].gpu_id == gpu_id &&
panfrost_model_list[i].gpu_variant == gpu_variant)
return &panfrost_model_list[i];
}
+5 -1
View File
@@ -47,6 +47,9 @@ struct panfrost_model {
/* GPU ID */
uint32_t gpu_id;
/* GPU variant. */
uint32_t gpu_variant;
/* Marketing name for the GPU, used as the GL_RENDERER */
const char *name;
@@ -72,7 +75,8 @@ struct panfrost_model {
} quirks;
};
const struct panfrost_model *panfrost_get_model(uint32_t gpu_id);
const struct panfrost_model *panfrost_get_model(uint32_t gpu_id,
uint32_t gpu_variant);
unsigned panfrost_query_l2_slices(const struct pan_kmod_dev_props *props);
+2 -1
View File
@@ -78,7 +78,8 @@ panfrost_perf_init(struct panfrost_perf *perf, int fd)
struct pan_kmod_dev_props props = {};
pan_kmod_dev_query_props(perf->dev, &props);
const struct panfrost_model *model = panfrost_get_model(props.gpu_prod_id);
const struct panfrost_model *model =
panfrost_get_model(props.gpu_prod_id, props.gpu_variant);
if (model == NULL)
unreachable("Invalid GPU ID");
+2 -1
View File
@@ -489,7 +489,8 @@ panvk_physical_device_init(struct panvk_physical_device *device,
unsigned arch = pan_arch(device->kmod.props.gpu_prod_id);
device->model = panfrost_get_model(device->kmod.props.gpu_prod_id);
device->model = panfrost_get_model(device->kmod.props.gpu_prod_id,
device->kmod.props.gpu_variant);
device->formats.all = panfrost_format_table(arch);
device->formats.blendable = panfrost_blendable_format_table(arch);