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 v6 11/11] lib: Add genxml annotated batch buffer decode
Date: Mon, 13 Jul 2026 15:37:46 +0200 [thread overview]
Message-ID: <20260713133746.453051-12-jan.maslak@intel.com> (raw)
In-Reply-To: <20260713133746.453051-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>
Reviewed-by: Zbigniew Kempczyński <zbigniew.kempczynski@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 912b936e0c..1dacfdc6c7 100644
--- a/lib/intel_batchbuffer.c
+++ b/lib/intel_batchbuffer.c
@@ -42,6 +42,7 @@
#include "intel_batchbuffer.h"
#include "intel_bufops.h"
#include "intel_chipset.h"
+#include "intel/genxml/igt_genxml_decode.h"
#include "intel_pat.h"
#include "media_fill.h"
#include "media_spin.h"
@@ -1611,7 +1612,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)
{
@@ -1641,6 +1644,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.43.0
next prev parent reply other threads:[~2026-07-13 13:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-13 13:37 [PATCH v6 00/11] lib/genxml: Introduce Mesa genxml infrastructure to IGT Jan Maslak
2026-07-13 13:37 ` [PATCH v6 01/11] lib/intel/genxml: Add genxml generators, headers, and build integration Jan Maslak
2026-07-13 13:37 ` [PATCH v6 04/11] lib/intel/genxml: Import Xe2/Xe3/Xe3p XML hardware definitions from Mesa Jan Maslak
2026-07-13 13:37 ` [PATCH v6 05/11] lib/intel_bufops: Add intel_buf_mocs() helper Jan Maslak
2026-07-13 13:37 ` [PATCH v6 06/11] lib/mocs: Add packed MOCS helpers Jan Maslak
2026-07-13 13:37 ` [PATCH v6 07/11] lib/rendercopy: Convert surface state and sampler setup to genxml Jan Maslak
2026-07-13 13:37 ` [PATCH v6 08/11] lib/rendercopy: Convert vertex data and CC state " Jan Maslak
2026-07-13 13:37 ` [PATCH v6 09/11] lib/rendercopy: Convert pipeline emit commands " Jan Maslak
2026-07-16 9:50 ` Zbigniew Kempczyński
2026-07-13 13:37 ` [PATCH v6 10/11] lib/rendercopy: Convert render op and entry points " Jan Maslak
2026-07-13 13:37 ` Jan Maslak [this message]
2026-07-16 10:54 ` [PATCH v6 11/11] lib: Add genxml annotated batch buffer decode Kamil Konieczny
2026-07-13 19:14 ` ✓ Xe.CI.BAT: success for lib/genxml: Introduce Mesa genxml infrastructure to IGT (rev7) Patchwork
2026-07-13 19:31 ` ✓ i915.CI.BAT: " Patchwork
2026-07-13 22:59 ` ✗ Xe.CI.FULL: failure " Patchwork
2026-07-14 4:08 ` ✓ i915.CI.Full: success " Patchwork
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=20260713133746.453051-12-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