mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-20 20:50:44 +02:00
freedreno/decode: Correctly handle chip_id
gpu_id is not decodable from chip_id in general case, so we should use chip_id to search for fd_dev_info and get GPU generation from that. Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23828>
This commit is contained in:
parent
3111a70a55
commit
8e729a2f57
5 changed files with 28 additions and 13 deletions
|
|
@ -27,6 +27,7 @@
|
|||
#include <stdbool.h>
|
||||
|
||||
#include "freedreno_pm4.h"
|
||||
#include "freedreno_dev_info.h"
|
||||
|
||||
enum query_mode {
|
||||
/* default mode, dump all queried regs on each draw: */
|
||||
|
|
@ -44,6 +45,7 @@ enum query_mode {
|
|||
};
|
||||
|
||||
struct cffdec_options {
|
||||
struct fd_dev_id dev_id;
|
||||
unsigned gpu_id;
|
||||
int draw_filter;
|
||||
int color;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
|
@ -335,16 +336,28 @@ handle_file(const char *filename, int start, int end, int draw)
|
|||
uint32_t gpu_id = parse_gpu_id(ps.buf);
|
||||
if (!gpu_id)
|
||||
break;
|
||||
options.gpu_id = gpu_id;
|
||||
printl(2, "gpu_id: %d\n", options.gpu_id);
|
||||
options.dev_id.gpu_id = gpu_id;
|
||||
printl(2, "gpu_id: %d\n", options.dev_id.gpu_id);
|
||||
|
||||
const struct fd_dev_info *info = fd_dev_info(&options.dev_id);
|
||||
if (!info)
|
||||
break;
|
||||
options.gpu_id = info->chip * 100;
|
||||
|
||||
cffdec_init(&options);
|
||||
got_gpu_id = 1;
|
||||
}
|
||||
break;
|
||||
case RD_CHIP_ID:
|
||||
if (!got_gpu_id) {
|
||||
options.gpu_id = parse_chip_id(ps.buf);
|
||||
printl(2, "gpu_id: %d\n", options.gpu_id);
|
||||
options.dev_id.chip_id = parse_chip_id(ps.buf);
|
||||
printl(2, "chip_id: 0x" PRIx64 "\n", options.dev_id.chip_id);
|
||||
|
||||
const struct fd_dev_info *info = fd_dev_info(&options.dev_id);
|
||||
if (!info)
|
||||
break;
|
||||
options.gpu_id = info->chip * 100;
|
||||
|
||||
cffdec_init(&options);
|
||||
got_gpu_id = 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -506,12 +506,14 @@ handle_file(const char *filename, uint32_t submit_to_decompile)
|
|||
}
|
||||
case RD_GPU_ID: {
|
||||
dev_id.gpu_id = parse_gpu_id(ps.buf);
|
||||
emit_header();
|
||||
if (fd_dev_info(&dev_id))
|
||||
emit_header();
|
||||
break;
|
||||
}
|
||||
case RD_CHIP_ID: {
|
||||
dev_id.chip_id = *(uint64_t *)ps.buf;
|
||||
emit_header();
|
||||
dev_id.chip_id = parse_chip_id(ps.buf);
|
||||
if (fd_dev_info(&dev_id))
|
||||
emit_header();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -25,12 +25,10 @@ parse_gpu_id(void *buf)
|
|||
return *((unsigned int *)buf);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
static uint64_t
|
||||
parse_chip_id(void *buf)
|
||||
{
|
||||
uint64_t chip_id = *((uint64_t *)buf);
|
||||
return 100 * ((chip_id >> 24) & 0xff) + 10 * ((chip_id >> 16) & 0xff) +
|
||||
((chip_id >> 8) & 0xff);
|
||||
return *((uint64_t *)buf);
|
||||
}
|
||||
|
||||
struct rd_parsed_section
|
||||
|
|
|
|||
|
|
@ -631,8 +631,8 @@ handle_file(const char *filename, uint32_t first_submit, uint32_t last_submit,
|
|||
break;
|
||||
}
|
||||
case RD_CHIP_ID: {
|
||||
uint32_t gpu_id = parse_chip_id(ps.buf);
|
||||
printf("gpuid: %d\n", gpu_id);
|
||||
uint64_t chip_id = parse_chip_id(ps.buf);
|
||||
printf("chip_id: 0x%" PRIx64 "\n", chip_id);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue