Commit b16660e8 authored by Tomeu Vizoso's avatar Tomeu Vizoso

Snoop GPU ID and pass it on to pandecode

Signed-off-by: default avatarTomeu Vizoso <tomeu.vizoso@collabora.com>
parent 423fe194
......@@ -30,6 +30,12 @@ union mali_ioctl_mem_alloc {
} out;
} __attribute__((packed));
struct mali_ioctl_get_gpuprops {
u64 buffer;
u32 size;
u32 flags;
};
#define MALI_IOCTL_TYPE_BASE 0x80
#define MALI_IOCTL_TYPE_MAX 0x81
......
......@@ -173,6 +173,7 @@ close(int fd)
/* HW version */
static bool bifrost = false;
static unsigned product_id;
int allocation_number = 0;
/* XXX: Android has a messed up ioctl signature */
......@@ -209,7 +210,7 @@ int ioctl(int fd, int _request, ...)
struct mali_jd_atom_v2 *atoms = js->addr;
for (unsigned i = 0; i < js->nr_atoms; ++i)
pandecode_jc(atoms[i].jc, bifrost);
pandecode_jc(atoms[i].jc, bifrost, product_id);
}
mali_ptr alloc_va_pages = 0;
......@@ -244,13 +245,23 @@ int ioctl(int fd, int _request, ...)
#ifndef dvalin
if (IOCTL_CASE(request) == IOCTL_CASE(MALI_IOCTL_GPU_PROPS_REG_DUMP)) {
const struct mali_ioctl_gpu_props_reg_dump *dump = ptr;
unsigned product_id = dump->core.product_id;
product_id = dump->core.product_id;
/* based on mali_kbase_gpu_id.h and mali_kbase_hw.c */
if (product_id >> 12 == 6 && product_id != 0x6956 /* T60x */)
bifrost = true;
}
#else
bifrost = true;
if (IOCTL_CASE(request) == IOCTL_CASE(MALI_IOCTL_GET_GPUPROPS)) {
const struct mali_ioctl_get_gpuprops *dump = ptr;
if (dump && dump->size) {
u32 *buf = (u32 *)dump->buffer;
product_id = buf[1];
fprintf(stderr, "panwrap: Detected GPU ID %x\n", product_id);
/* based on mali_kbase_gpu_id.h and mali_kbase_hw.c */
if (product_id >> 12 == 6 && product_id != 0x6956 /* T60x */)
bifrost = true;
}
}
#endif
UNLOCK();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment