intel/tools: Rename and better detect topic changes

Xe KMD added topics without our notice in the past and that may happen
in future so better rename XE_TOPIC_INVALID to XE_TOPIC_UNKNOWN
and better detect topic changes.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33249>
This commit is contained in:
José Roberto de Souza 2025-01-27 09:12:12 -08:00 committed by Marge Bot
parent 52e9d25aa0
commit a4cf7dde4b
4 changed files with 7 additions and 5 deletions

View file

@ -105,7 +105,7 @@ read_xe_data_file(FILE *file,
struct xe_vm xe_vm;
char *line = NULL;
size_t line_size;
enum xe_topic xe_topic = XE_TOPIC_INVALID;
enum xe_topic xe_topic = XE_TOPIC_UNKNOWN;
error_decode_xe_vm_init(&xe_vm);

View file

@ -18,7 +18,7 @@
void
read_xe_data_file(FILE *dump_file, FILE *hang_dump_file, bool verbose)
{
enum xe_topic xe_topic = XE_TOPIC_INVALID;
enum xe_topic xe_topic = XE_TOPIC_UNKNOWN;
uint32_t *vm_entry_data = NULL;
uint32_t vm_entry_len = 0;
struct xe_vm xe_vm;

View file

@ -81,11 +81,13 @@ error_decode_xe_decode_topic(const char *line, enum xe_topic *new_topic)
"**** VM state ****",
"**** Contexts ****",
};
bool topic_changed = false;
const bool topic_changed = strncmp("**** ", line, strlen("**** ")) == 0;
if (topic_changed)
*new_topic = XE_TOPIC_UNKNOWN;
for (int i = 0; i < ARRAY_SIZE(xe_topic_strings); i++) {
if (strncmp(xe_topic_strings[i], line, strlen(xe_topic_strings[i])) == 0) {
topic_changed = true;
*new_topic = i;
break;
}

View file

@ -15,7 +15,7 @@ enum xe_topic {
XE_TOPIC_HW_ENGINES,
XE_TOPIC_VM,
XE_TOPIC_CONTEXT,
XE_TOPIC_INVALID,
XE_TOPIC_UNKNOWN,
};
enum xe_vm_topic_type {