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