diff --git a/src/gallium/drivers/panfrost/pan_device.c b/src/gallium/drivers/panfrost/pan_device.c index 5b6d9550bea..e264686137f 100644 --- a/src/gallium/drivers/panfrost/pan_device.c +++ b/src/gallium/drivers/panfrost/pan_device.c @@ -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) diff --git a/src/panfrost/lib/kmod/pan_kmod.h b/src/panfrost/lib/kmod/pan_kmod.h index e16461ebc5c..f69abeab7fc 100644 --- a/src/panfrost/lib/kmod/pan_kmod.h +++ b/src/panfrost/lib/kmod/pan_kmod.h @@ -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; diff --git a/src/panfrost/lib/pan_props.c b/src/panfrost/lib/pan_props.c index f4f0f99ec1d..165b577b43c 100644 --- a/src/panfrost/lib/pan_props.c +++ b/src/panfrost/lib/pan_props.c @@ -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]; } diff --git a/src/panfrost/lib/pan_props.h b/src/panfrost/lib/pan_props.h index 927abede47b..b80d4977622 100644 --- a/src/panfrost/lib/pan_props.h +++ b/src/panfrost/lib/pan_props.h @@ -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); diff --git a/src/panfrost/perf/pan_perf.c b/src/panfrost/perf/pan_perf.c index 129d84c5150..d64c27ca4b9 100644 --- a/src/panfrost/perf/pan_perf.c +++ b/src/panfrost/perf/pan_perf.c @@ -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"); diff --git a/src/panfrost/vulkan/panvk_device.c b/src/panfrost/vulkan/panvk_device.c index b5c30a4a109..92927cfe759 100644 --- a/src/panfrost/vulkan/panvk_device.c +++ b/src/panfrost/vulkan/panvk_device.c @@ -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);