[Intel-xe] [PATCH v2 0/3] Emit SVG 3DSTATE during LRC init

Matt Roper matthew.d.roper at intel.com
Wed Oct 25 15:17:33 UTC 2023


DG2, MTL, and Xe2 do not write the 3DSTATE instruction headers to the
SVG ("State Variable - Global") section of the LRC image during the
first context switch if no explicit state has been programmed yet.  When
we record the default context, that portion of the LRC is effectively
filled with noops.  If a userspace driver later forgets to initialize
some part of the SVG state, the result is that that state will not be
saved/restored on context switch and the settings from one GPU client
(which does initialize the state) can leak into another client (which
does not initialize the state) on context switch.  While failure to ever
initialize a proper setting for part of the state is a mistake on the
UMD side, any bugs arising from such mistakes are often erractic in
nature and hard to track down because the behavior will vary according
to what other clients are running on the system and the specific order
they get scheduled to the hardware engine.

If we explicitly emit a copy of each SVG state instruction while
recording the default LRC (i.e., at the same time we emit our
register-based LRC workarounds), it will ensure that the context image
always has a real SVG state in the LRC image, and save/restore on
context switch will work as expected.  Now if userspace fails to emit
the proper state they want, they'll get reproducible behavior
corresponding to known (zeroed out) state, making it much easier to
debug and track down the problem.

More detailed explanation provided on patch #2 of the series.

We've been told that some future platforms will also require us to emit
some other specific non-register state during driver init, so even
though this SVG initialization/sanitization in this series is just a
"nice to have" change for the time being, the infrastructure added will
become necessary for other purposes on future platforms.

v2:
 - Minor checkpatch whitespace fix
 - Add an extra assertion to ensure the num_dw is properly set in the
   state table.  (Bala)


Matt Roper (3):
  drm/xe: Prepare to emit non-register state while recording default LRC
  drm/xe: Emit SVG state on RCS during driver load on DG2 and MTL
  drm/xe/xe2: Update SVG state handling

 .../drm/xe/instructions/xe_gfxpipe_commands.h |  52 ++++++
 drivers/gpu/drm/xe/xe_gt.c                    |  11 +-
 drivers/gpu/drm/xe/xe_lrc.c                   | 165 ++++++++++++++++++
 drivers/gpu/drm/xe/xe_lrc.h                   |   3 +
 4 files changed, 230 insertions(+), 1 deletion(-)

-- 
2.41.0



More information about the Intel-xe mailing list