Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] lib/genxml: Introduce Mesa genxml infrastructure to IGT
@ 2026-04-15 22:07 Jan Maslak
  2026-04-15 22:07 ` [PATCH 01/10] lib/intel/genxml: Add genxml generators, headers, and build integration Jan Maslak
                   ` (9 more replies)
  0 siblings, 10 replies; 21+ messages in thread
From: Jan Maslak @ 2026-04-15 22:07 UTC (permalink / raw)
  To: igt-dev; +Cc: zbigniew.kempczynski, Jan Maslak

Currently IGT uses raw intel_bb_out() calls for setting up the render /
compute pipelines. Fields are set by shifting and OR-ing hand-computed
constants, with field names and bit positions hardcoded and sometimes
explained in comments. A lot of code has branching based on generations,
making pipeline setup more complex as the new generations come in.

Meanwhile Mesa uses a system called genxml in which XML files describe GPU
commands, state objects, enums, and registers - specifying the field layout
down to individual bits. A Python generator then produces C headers with
typed structs, pack functions, and named constants for each command/state.

By bringing genxml to IGT, we can achieve a more maintainable and less
error-prone codebase. Instead of manually calculating bit positions and
creating complex branching logic, we can fill out the structs generated
from XML descriptions, and the packing functions will handle the bit
manipulation automatically.

This series brings Mesa's hardware XML command/state definitions and
gen_pack_header.py code generator into IGT, adds a new IGT-written
batch buffer decoder (gen_decode_header.py), and converts rendercopy_gen9
to use the generated pack headers.

Patches 1-4 import the generators, headers, and XML definitions.
gen_pack_header.py is taken from Mesa with C90 compliance fixes and a
new baseline deduplication mechanism - when a platform's command layout
matches any older generation exactly, the item is omitted entirely.
gen_decode_header.py is a new IGT-only file that generates per-platform
decoders for instructions, structs, and registers. The XML files are
imported from Mesa split by generation: gen4-gen8, gen9-gen12.5, and
Xe2/Xe3/Xe3p.

Patch 5 adds intel_get_wb_mocs() and intel_buf_mocs() helpers that
return the correct 7-bit genxml MOCS field value.

Patches 6-9 convert rendercopy_gen9.c to use the generated pack headers,
replacing hand-written intel_bb_out() calls with igt_genxml_emit and
igt_genxml_pack_state, split by functional section.

Patch 10 adds an opt-in annotated batch dump to intel_bb_dump(): when
IGT_BB_ANNOTATE=1 is set a companion .annotated file is written alongside
the raw hex dump, decoding each command's field names and values.

Tested on LNL and DG2 (xe_render_copy render-square, render-full;
xe_intel_bb render) and TGL (gem_render_copy_redux; api_intel_bb).

v2:
 - Move genxml files to lib/intel/genxml/ (was lib/genxml/ in v1)
 - Split the single "import genxml" commit into infrastructure (patch 1)
   plus three XML import commits split by generation (patches 2-4)
 - Split the single rendercopy conversion into four commits by functional
   section (patches 6-9)
 - Fix MOCS bug: genxml packs a 7-bit field (index << 1 | pxp) but v1
   was passing the raw 6-bit index; add intel_get_wb_mocs() and
   intel_buf_mocs() helpers that return the correct 7-bit value (patch 5)
 - Add "why?" motivation text to patch 1 and this cover letter

Jan Maslak (10):
  lib/intel/genxml: Add genxml generators, headers, and build
    integration
  lib/intel/genxml: Import gen4-gen8 XML hardware definitions from Mesa
  lib/intel/genxml: Import gen9-gen12.5 XML hardware definitions from
    Mesa
  lib/intel/genxml: Import Xe2/Xe3/Xe3p XML hardware definitions from
    Mesa
  lib/mocs: Add intel_get_wb_mocs() and intel_buf_mocs() for genxml MOCS
    fields
  lib/rendercopy: Convert surface state and sampler setup to genxml
  lib/rendercopy: Convert vertex data and CC state to genxml
  lib/rendercopy: Convert pipeline emit commands to genxml
  lib/rendercopy: Convert render op and entry points to genxml
  lib: Add genxml annotated batch buffer decode

 lib/intel/genxml/gen110.xml           | 3358 ++++++++++++++++++++
 lib/intel/genxml/gen120.xml           | 2432 ++++++++++++++
 lib/intel/genxml/gen125.xml           | 2628 ++++++++++++++++
 lib/intel/genxml/gen40.xml            | 1012 ++++++
 lib/intel/genxml/gen45.xml            |  507 +++
 lib/intel/genxml/gen50.xml            |  648 ++++
 lib/intel/genxml/gen60.xml            | 2606 +++++++++++++++
 lib/intel/genxml/gen70.xml            | 3067 ++++++++++++++++++
 lib/intel/genxml/gen75.xml            | 2424 ++++++++++++++
 lib/intel/genxml/gen80.xml            | 2993 ++++++++++++++++++
 lib/intel/genxml/gen90.xml            | 4192 +++++++++++++++++++++++++
 lib/intel/genxml/gen_decode_header.py |  487 +++
 lib/intel/genxml/gen_pack_header.py   |  799 +++++
 lib/intel/genxml/igt_genxml.h         |  112 +
 lib/intel/genxml/igt_genxml_decode.h  |   60 +
 lib/intel/genxml/igt_genxml_defs.h    |  335 ++
 lib/intel/genxml/intel_genxml.py      |  553 ++++
 lib/intel/genxml/util.py              |   39 +
 lib/intel/genxml/xe2.xml              | 1969 ++++++++++++
 lib/intel/genxml/xe3.xml              |  816 +++++
 lib/intel/genxml/xe3p.xml             |    4 +
 lib/intel_batchbuffer.c               |   32 +-
 lib/intel_bufops.h                    |   13 +
 lib/intel_mocs.c                      |   14 +
 lib/intel_mocs.h                      |    1 +
 lib/meson.build                       |   65 +-
 lib/rendercopy_gen9.c                 | 1114 ++++---
 27 files changed, 31712 insertions(+), 568 deletions(-)
 create mode 100644 lib/intel/genxml/gen110.xml
 create mode 100644 lib/intel/genxml/gen120.xml
 create mode 100644 lib/intel/genxml/gen125.xml
 create mode 100644 lib/intel/genxml/gen40.xml
 create mode 100644 lib/intel/genxml/gen45.xml
 create mode 100644 lib/intel/genxml/gen50.xml
 create mode 100644 lib/intel/genxml/gen60.xml
 create mode 100644 lib/intel/genxml/gen70.xml
 create mode 100644 lib/intel/genxml/gen75.xml
 create mode 100644 lib/intel/genxml/gen80.xml
 create mode 100644 lib/intel/genxml/gen90.xml
 create mode 100644 lib/intel/genxml/gen_decode_header.py
 create mode 100644 lib/intel/genxml/gen_pack_header.py
 create mode 100644 lib/intel/genxml/igt_genxml.h
 create mode 100644 lib/intel/genxml/igt_genxml_decode.h
 create mode 100644 lib/intel/genxml/igt_genxml_defs.h
 create mode 100644 lib/intel/genxml/intel_genxml.py
 create mode 100644 lib/intel/genxml/util.py
 create mode 100644 lib/intel/genxml/xe2.xml
 create mode 100644 lib/intel/genxml/xe3.xml
 create mode 100644 lib/intel/genxml/xe3p.xml

-- 
2.34.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2026-04-27 11:16 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [PATCH 10/10] lib: Add genxml annotated batch buffer decode Jan Maslak
2026-04-23 10:56   ` Kamil Konieczny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox