mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 09:08:10 +02:00
pan: Add handling for v15+ uapi gpu_id
Since v15, gpu_ids are 64 bit, so they need to be handled differently. To ease this, a compat value of 0xF is found in what previously used to be ARCH_MAJOR, which we can use to decide whether to read information from the full 64 bits. Since we now cannot pass gpu_id directly as deviceID, align with the DDK on what fields to expose.
This commit is contained in:
parent
df8f2d8896
commit
003becf081
4 changed files with 50 additions and 8 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue