diff --git a/src/panfrost/clc/pan_compile.c b/src/panfrost/clc/pan_compile.c index 3a34897c21b..593bfe2de07 100644 --- a/src/panfrost/clc/pan_compile.c +++ b/src/panfrost/clc/pan_compile.c @@ -10,6 +10,7 @@ #include "panfrost/compiler/bifrost/bifrost_compile.h" #include "panfrost/compiler/pan_compiler.h" #include "panfrost/compiler/pan_nir.h" +#include "panfrost/model/pan_model.h" #include "nir.h" #include "nir_builder.h" #include "nir_builder_opcodes.h" @@ -353,7 +354,12 @@ main(int argc, const char **argv) libfunc, MESA_SHADER_COMPUTE, v, get_compiler_options(target_arch), &opt, load_kernel_input); - uint64_t target_gpu_id = (target_arch & 0xf) << 28; + uint64_t target_gpu_id; + if (target_arch >= PAN_ID64_COMPAT) + target_gpu_id = + ((uint64_t)(target_arch & 0xff) << 56) | (PAN_ID64_COMPAT << 28); + else + target_gpu_id = (target_arch & 0xf) << 28; struct pan_compile_inputs inputs = { .gpu_id = target_gpu_id, diff --git a/src/panfrost/lib/kmod/panthor_kmod.c b/src/panfrost/lib/kmod/panthor_kmod.c index c2e774eab87..8900ea5ac5e 100644 --- a/src/panfrost/lib/kmod/panthor_kmod.c +++ b/src/panfrost/lib/kmod/panthor_kmod.c @@ -153,8 +153,12 @@ panthor_dev_query_props(struct panthor_kmod_dev *panthor_dev) { struct pan_kmod_dev_props *props = &panthor_dev->base.props; + bool is_gpu_wide = panthor_dev->props.gpu.gpu_id == 0; + assert(!is_gpu_wide || panthor_dev->props.gpu.gpu_wide_id); + *props = (struct pan_kmod_dev_props){ - .gpu_id = panthor_dev->props.gpu.gpu_id, + .gpu_id = is_gpu_wide ? panthor_dev->props.gpu.gpu_wide_id + : panthor_dev->props.gpu.gpu_id, .gpu_variant = panthor_dev->props.gpu.core_features & 0xff, .shader_present = panthor_dev->props.gpu.shader_present, .tiler_features = panthor_dev->props.gpu.tiler_features, diff --git a/src/panfrost/model/pan_model.h b/src/panfrost/model/pan_model.h index 8eb7980b633..d1edf9a7eb6 100644 --- a/src/panfrost/model/pan_model.h +++ b/src/panfrost/model/pan_model.h @@ -31,6 +31,15 @@ struct pan_tiler_features { #define PAN_VERSION_MINOR(x) (((x) & BITFIELD_RANGE(4, 8)) >> 4) #define PAN_VERSION_STATUS(x) ((x) & BITFIELD_RANGE(0, 4)) +#define PAN_ID64_COMPAT 0xFull +#define PAN_ID64_ARCH_MAJOR(x) (((x) & BITFIELD64_RANGE(56, 8)) >> 56) +#define PAN_ID64_ARCH_MINOR(x) (((x) & BITFIELD64_RANGE(48, 8)) >> 48) +#define PAN_ID64_ARCH_REV(x) (((x) & BITFIELD64_RANGE(40, 8)) >> 40) +#define PAN_ID64_PRODUCT_MAJOR(x) (((x) & BITFIELD64_RANGE(32, 8)) >> 32) +#define PAN_ID64_VERSION_MAJOR(x) (((x) & BITFIELD64_RANGE(16, 8)) >> 16) +#define PAN_ID64_VERSION_MINOR(x) (((x) & BITFIELD64_RANGE(8, 8)) >> 8) +#define PAN_ID64_VERSION_STATUS(x) ((x) & BITFIELD64_RANGE(0, 8)) + /* GPU product id for Midgard */ #define MIDGARD_PROD_ID(x) (((x) & BITFIELD_RANGE(16, 16)) >> 16) @@ -108,8 +117,12 @@ pan_arch(uint64_t gpu_id) case 0x860: case 0x880: return 5; - default: - return PAN_ARCH_MAJOR(gpu_id); + default: { + unsigned gpu_arch = PAN_ARCH_MAJOR(gpu_id); + if (gpu_arch == PAN_ID64_COMPAT) + return PAN_ID64_ARCH_MAJOR(gpu_id); + return gpu_arch; + } } } @@ -119,14 +132,21 @@ pan_prod_id(uint64_t gpu_id) unsigned arch = pan_arch(gpu_id); if (arch < 6) return MIDGARD_PROD_ID(gpu_id); - return PAN_PROD_ID(PAN_ARCH_MAJOR(gpu_id), PAN_ARCH_MINOR(gpu_id), - PAN_PRODUCT_MAJOR(gpu_id)); + else if (arch < PAN_ID64_COMPAT) + return PAN_PROD_ID(PAN_ARCH_MAJOR(gpu_id), PAN_ARCH_MINOR(gpu_id), + PAN_PRODUCT_MAJOR(gpu_id)); + return PAN_PROD_ID(PAN_ID64_ARCH_MAJOR(gpu_id), PAN_ID64_ARCH_MINOR(gpu_id), + PAN_ID64_PRODUCT_MAJOR(gpu_id)); } static inline uint32_t pan_rev(uint64_t gpu_id) { - return PAN_REV(PAN_VERSION_MAJOR(gpu_id), PAN_VERSION_MINOR(gpu_id)); + unsigned arch = pan_arch(gpu_id); + if (arch < PAN_ID64_COMPAT) + return PAN_REV(PAN_VERSION_MAJOR(gpu_id), PAN_VERSION_MINOR(gpu_id)); + return PAN_REV(PAN_ID64_VERSION_MAJOR(gpu_id), + PAN_ID64_VERSION_MINOR(gpu_id)); } #endif diff --git a/src/panfrost/vulkan/panvk_vX_physical_device.c b/src/panfrost/vulkan/panvk_vX_physical_device.c index a0845b6987e..0db46da50f6 100644 --- a/src/panfrost/vulkan/panvk_vX_physical_device.c +++ b/src/panfrost/vulkan/panvk_vX_physical_device.c @@ -698,6 +698,18 @@ get_conformance_version() return (VkConformanceVersion){0, 0, 0, 0}; } +static uint32_t +get_device_id(uint64_t gpu_id) +{ + if (PAN_ARCH >= PAN_ID64_COMPAT) + return ((PAN_ID64_COMPAT << 28) | (PAN_ID64_ARCH_MAJOR(gpu_id) << 20) | + (PAN_ID64_ARCH_MINOR(gpu_id) << 12) | + ((PAN_ID64_PRODUCT_MAJOR(gpu_id) & 0xF) << 8) | + ((PAN_ID64_VERSION_MAJOR(gpu_id) & 0xF) << 4) | + (PAN_ID64_VERSION_MINOR(gpu_id) & 0xF)); + return (gpu_id & 0xFFFFFFFF); +} + void panvk_per_arch(get_physical_device_properties)( const struct panvk_instance *instance, @@ -736,7 +748,7 @@ panvk_per_arch(get_physical_device_properties)( .driverVersion = vk_get_driver_version(), .vendorID = instance->force_vk_vendor ? instance->force_vk_vendor : ARM_VENDOR_ID, - .deviceID = device->kmod.dev->props.gpu_id, + .deviceID = get_device_id(device->kmod.dev->props.gpu_id), .deviceType = VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU, /* Vulkan 1.0 limits */