nouveau: Add support for TERT opcodes in vk_push_print

Those opcodes are vestige of the old command format.

This implement handling of them and fix issues when analysing command
buffers that use thoses.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28277>
This commit is contained in:
Mary Guillemard 2024-03-19 17:49:11 +01:00 committed by Marge Bot
parent d473004576
commit 9e133c4000

View file

@ -4,9 +4,9 @@
#include <inttypes.h>
#include "nvk_cl902d.h"
#include "nvk_cl906f.h"
#include "nvk_cl9097.h"
#include "nvk_cl902d.h"
#include "nvk_cl90b5.h"
#include "nvk_cla097.h"
#include "nvk_cla0b5.h"
@ -70,17 +70,27 @@ vk_push_print(FILE *fp, const struct nv_push *push,
while (cur < push->end) {
uint32_t hdr = *cur;
uint32_t type = hdr >> 29;
bool is_tert = type == 0 || type == 2;
uint32_t inc = 0;
uint32_t count = (hdr >> 16) & 0x1fff;
uint32_t count = is_tert ? (hdr >> 18) & 0x3ff : (hdr >> 16) & 0x1fff;
uint32_t tert_op = (hdr >> 16) & 0x3;
uint32_t subchan = (hdr >> 13) & 0x7;
uint32_t mthd = (hdr & 0xfff) << 2;
uint32_t value = 0;
bool is_immd = false;
fprintf(fp, "[0x%08" PRIxPTR "] HDR %x subch %i",
cur - push->start, hdr, subchan);
if (is_tert && tert_op != 0) {
fprintf(fp, "[0x%08" PRIxPTR "] HDR %x subch N/A",
cur - push->start, hdr);
} else {
fprintf(fp, "[0x%08" PRIxPTR "] HDR %x subch %i",
cur - push->start, hdr, subchan);
}
cur++;
const char *mthd_name = "";
switch (type) {
case 4:
fprintf(fp, " IMMD\n");
@ -93,6 +103,7 @@ vk_push_print(FILE *fp, const struct nv_push *push,
fprintf(fp, " NINC\n");
inc = count;
break;
case 2:
case 3:
fprintf(fp, " 0INC\n");
inc = 0;
@ -101,56 +112,86 @@ vk_push_print(FILE *fp, const struct nv_push *push,
fprintf(fp, " 1INC\n");
inc = 1;
break;
case 0:
switch (tert_op) {
case 0:
fprintf(fp, " NINC\n");
break;
case 1:
fprintf(fp, " SUB_DEVICE_OP\n");
mthd_name = "SET_SUBDEVICE_MASK";
mthd = tert_op;
value = (hdr >> 4) & 0xfff;
count = 1;
is_immd = true;
break;
case 2:
fprintf(fp, " SUB_DEVICE_OP\n");
mthd_name = "STORE_SUBDEVICE_MASK";
mthd = tert_op;
value = (hdr >> 4) & 0xfff;
count = 1;
is_immd = true;
break;
case 3:
fprintf(fp, " SUB_DEVICE_OP\n");
mthd_name = "USE_SUBDEVICE_MASK";
mthd = tert_op;
count = 1;
break;
}
break;
}
while (count--) {
const char *mthd_name = "";
if (mthd < 0x100) {
mthd_name = P_PARSE_NV906F_MTHD(mthd);
} else {
switch (subchan) {
case 0:
if (devinfo->cls_eng3d >= 0xc697)
mthd_name = P_PARSE_NVC697_MTHD(mthd);
else if (devinfo->cls_eng3d >= 0xc597)
mthd_name = P_PARSE_NVC597_MTHD(mthd);
else if (devinfo->cls_eng3d >= 0xc397)
mthd_name = P_PARSE_NVC397_MTHD(mthd);
else if (devinfo->cls_eng3d >= 0xb197)
mthd_name = P_PARSE_NVB197_MTHD(mthd);
else if (devinfo->cls_eng3d >= 0xa097)
mthd_name = P_PARSE_NVA097_MTHD(mthd);
else
mthd_name = P_PARSE_NV9097_MTHD(mthd);
break;
case 1:
if (devinfo->cls_compute >= 0xc7c0)
mthd_name = P_PARSE_NVC7C0_MTHD(mthd);
else if (devinfo->cls_compute >= 0xc6c0)
mthd_name = P_PARSE_NVC6C0_MTHD(mthd);
else if (devinfo->cls_compute >= 0xc5c0)
mthd_name = P_PARSE_NVC5C0_MTHD(mthd);
else if (devinfo->cls_compute >= 0xc3c0)
mthd_name = P_PARSE_NVC3C0_MTHD(mthd);
else if (devinfo->cls_compute >= 0xc0c0)
mthd_name = P_PARSE_NVC0C0_MTHD(mthd);
else
mthd_name = P_PARSE_NVA0C0_MTHD(mthd);
break;
case 3:
mthd_name = P_PARSE_NV902D_MTHD(mthd);
break;
case 4:
if (devinfo->cls_copy >= 0xc1b5)
mthd_name = P_PARSE_NVC1B5_MTHD(mthd);
else if (devinfo->cls_copy >= 0xa0b5)
mthd_name = P_PARSE_NVA0B5_MTHD(mthd);
else
mthd_name = P_PARSE_NV90B5_MTHD(mthd);
break;
default:
mthd_name = "";
break;
if (!is_tert) {
if (mthd < 0x100) {
mthd_name = P_PARSE_NV906F_MTHD(mthd);
} else {
switch (subchan) {
case 0:
if (devinfo->cls_eng3d >= 0xc697)
mthd_name = P_PARSE_NVC697_MTHD(mthd);
else if (devinfo->cls_eng3d >= 0xc597)
mthd_name = P_PARSE_NVC597_MTHD(mthd);
else if (devinfo->cls_eng3d >= 0xc397)
mthd_name = P_PARSE_NVC397_MTHD(mthd);
else if (devinfo->cls_eng3d >= 0xb197)
mthd_name = P_PARSE_NVB197_MTHD(mthd);
else if (devinfo->cls_eng3d >= 0xa097)
mthd_name = P_PARSE_NVA097_MTHD(mthd);
else
mthd_name = P_PARSE_NV9097_MTHD(mthd);
break;
case 1:
if (devinfo->cls_compute >= 0xc7c0)
mthd_name = P_PARSE_NVC7C0_MTHD(mthd);
else if (devinfo->cls_compute >= 0xc6c0)
mthd_name = P_PARSE_NVC6C0_MTHD(mthd);
else if (devinfo->cls_compute >= 0xc5c0)
mthd_name = P_PARSE_NVC5C0_MTHD(mthd);
else if (devinfo->cls_compute >= 0xc3c0)
mthd_name = P_PARSE_NVC3C0_MTHD(mthd);
else if (devinfo->cls_compute >= 0xc0c0)
mthd_name = P_PARSE_NVC0C0_MTHD(mthd);
else
mthd_name = P_PARSE_NVA0C0_MTHD(mthd);
break;
case 3:
mthd_name = P_PARSE_NV902D_MTHD(mthd);
break;
case 4:
if (devinfo->cls_copy >= 0xc1b5)
mthd_name = P_PARSE_NVC1B5_MTHD(mthd);
else if (devinfo->cls_copy >= 0xa0b5)
mthd_name = P_PARSE_NVA0B5_MTHD(mthd);
else
mthd_name = P_PARSE_NV90B5_MTHD(mthd);
break;
default:
mthd_name = "unknown method";
break;
}
}
}
@ -194,7 +235,7 @@ vk_push_print(FILE *fp, const struct nv_push *push,
P_DUMP_NV90B5_MTHD_DATA(fp, mthd, value, "\t\t");
break;
default:
mthd_name = "";
fprintf(fp, "%s.VALUE = 0x%x\n", "\t\t", value);
break;
}
}