From: Jan Maslak <jan.maslak@intel.com>
To: igt-dev@lists.freedesktop.org
Cc: zbigniew.kempczynski@intel.com, Jan Maslak <jan.maslak@intel.com>
Subject: [PATCH 10/10] lib: Add genxml annotated batch buffer decode
Date: Thu, 16 Apr 2026 00:07:20 +0200 [thread overview]
Message-ID: <20260415220720.1594414-11-jan.maslak@intel.com> (raw)
In-Reply-To: <20260415220720.1594414-1-jan.maslak@intel.com>
When IGT_BB_ANNOTATE=1 is set, intel_bb_dump() writes a companion
<filename>.annotated file alongside the raw hex dump. The annotated file
identifies each command and prints its field names and values, decoded via
the genxml *_decode.h headers.
The opt-in environment variable avoids file I/O overhead in normal test runs.
A disclaimer in the file header notes that the decode is best-effort and may
lag hardware on newer platforms.
Signed-off-by: Jan Maslak <jan.maslak@intel.com>
---
lib/intel_batchbuffer.c | 32 +++++++++++++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)
diff --git a/lib/intel_batchbuffer.c b/lib/intel_batchbuffer.c
index b09506574..5b3c3da48 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -49,6 +49,7 @@
#include "veboxcopy.h"
#include "xe/xe_ioctl.h"
#include "xe/xe_query.h"
+#include "intel/genxml/igt_genxml_decode.h"
#define BCS_SWCTRL 0x22200
#define BCS_SRC_Y (1 << 0)
@@ -1579,7 +1580,9 @@ void intel_bb_print(struct intel_bb *ibb)
* @filename: name to which write bb
* @in_hex: dump bb in hex form
*
- * Dump batch bo to file.
+ * Dump batch bo to file. When IGT_BB_ANNOTATE=1 is set, also writes
+ * a companion annotated file (filename + ".annotated") with
+ * genxml-decoded field names and values.
*/
void intel_bb_dump(struct intel_bb *ibb, const char *filename, bool in_hex)
{
@@ -1609,6 +1612,33 @@ void intel_bb_dump(struct intel_bb *ibb, const char *filename, bool in_hex)
}
fclose(out);
+ /* Write a companion annotated decode alongside the raw dump,
+ * but only when explicitly requested via IGT_BB_ANNOTATE=1.
+ */
+ if (getenv("IGT_BB_ANNOTATE")) {
+ char *ann_filename;
+ unsigned batch_dwords;
+
+ igt_assert(asprintf(&ann_filename, "%s.annotated", filename) > 0);
+ batch_dwords = intel_bb_offset(ibb) / sizeof(uint32_t);
+
+ out = fopen(ann_filename, "w");
+ if (out) {
+ fprintf(out,
+ "# Batch buffer annotated decode\n"
+ "# Decoded using IGT's genxml definitions.\n"
+ "# This is a best-effort annotation and may be inaccurate,\n"
+ "# especially on newer platforms where the XML definitions\n"
+ "# may not yet reflect the latest hardware changes.\n"
+ "\n");
+ igt_genxml_decode_batch(out, ibb->devid,
+ (const uint32_t *)ptr,
+ batch_dwords);
+ fclose(out);
+ }
+ free(ann_filename);
+ }
+
if (ptr != ibb->batch)
munmap(ptr, ibb->size);
}
--
2.34.1
next prev parent reply other threads:[~2026-04-15 22:08 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 22:07 [PATCH 00/10] lib/genxml: Introduce Mesa genxml infrastructure to IGT Jan Maslak
2026-04-15 22:07 ` [PATCH 01/10] lib/intel/genxml: Add genxml generators, headers, and build integration Jan Maslak
2026-04-23 9:32 ` Zbigniew Kempczyński
2026-04-23 11:04 ` Kamil Konieczny
2026-04-24 6:54 ` Zbigniew Kempczyński
2026-04-15 22:07 ` [PATCH 02/10] lib/intel/genxml: Import gen4-gen8 XML hardware definitions from Mesa Jan Maslak
2026-04-23 9:33 ` Zbigniew Kempczyński
2026-04-15 22:07 ` [PATCH 03/10] lib/intel/genxml: Import gen9-gen12.5 " Jan Maslak
2026-04-23 9:34 ` Zbigniew Kempczyński
2026-04-15 22:07 ` [PATCH 04/10] lib/intel/genxml: Import Xe2/Xe3/Xe3p " Jan Maslak
2026-04-23 9:35 ` Zbigniew Kempczyński
2026-04-15 22:07 ` [PATCH 05/10] lib/mocs: Add intel_get_wb_mocs() and intel_buf_mocs() for genxml MOCS fields Jan Maslak
2026-04-23 15:24 ` Zbigniew Kempczyński
2026-04-15 22:07 ` [PATCH 06/10] lib/rendercopy: Convert surface state and sampler setup to genxml Jan Maslak
2026-04-27 8:54 ` Zbigniew Kempczyński
2026-04-15 22:07 ` [PATCH 07/10] lib/rendercopy: Convert vertex data and CC state " Jan Maslak
2026-04-27 11:15 ` Zbigniew Kempczyński
2026-04-15 22:07 ` [PATCH 08/10] lib/rendercopy: Convert pipeline emit commands " Jan Maslak
2026-04-15 22:07 ` [PATCH 09/10] lib/rendercopy: Convert render op and entry points " Jan Maslak
2026-04-15 22:07 ` Jan Maslak [this message]
2026-04-23 10:56 ` [PATCH 10/10] lib: Add genxml annotated batch buffer decode Kamil Konieczny
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260415220720.1594414-11-jan.maslak@intel.com \
--to=jan.maslak@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=zbigniew.kempczynski@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox