XE ASSERTS(9)
π Xe Asserts π
okay so bestie, welcome to the Kernel API Manual page for Xe Asserts(9) β and yes, this is the whole vibe, explained. β¨
The Xe driver is lowkey trying to be simpler than the legacy i915 driver, but itβs still complex enough that some changes introduced while adding new functionality could break the existing code. periodt, thatβs the risk π
Adding drm_WARN or drm_err to catch unwanted programming usage could lead to undesired increased driver footprint and may impact production driver performance, because this additional code will be always present. not ideal, ngl π
To allow annotating functions with additional detailed debug checks to assert that all prerequisites are satisfied β without worrying about footprint or performance penalty on production builds, where all potential misuses introduced during code integration were already fixed β we introduce a family of Xe assert macros that try to follow the classic assert utility:
xe_assertβ assert macro bestie #1 πxe_tile_assertβ assert macro bestie #2 πxe_gt_assertβ assert macro bestie #3 π¦
These macros are implemented on top of drm_WARN, but unlike the origin, the warning is triggered when the provided condition is false. Additionally, all of the above assert macros cannot be used in expressions or as a condition, since the underlying code will be compiled out on non-debug builds. iykyk π
Note: these macros are not intended for use to cover known gaps in the implementation. For such cases, use regulardrm_WARNordrm_errand provide a valid safe fallback. fr fr π«Ά
Also, in cases where performance or footprint is not an issue, developers should continue to use the regular drm_WARN or drm_err to ensure that bug reports from production builds will contain meaningful diagnostics data. π
Below code shows how asserts could help in debug to catch unplanned use:
static void one_igfx(struct xe_device *xe)
{
xe_assert(xe, xe->info.is_dgfx == false);
xe_assert(xe, xe->info.tile_count == 1);
}
static void two_dgfx(struct xe_device *xe)
{
xe_assert(xe, xe->info.is_dgfx);
xe_assert(xe, xe->info.tile_count == 2);
}
void foo(struct xe_device *xe)
{
if (xe->info.dgfx)
return two_dgfx(xe);
return one_igfx(xe);
}
void bar(struct xe_device *xe)
{
if (drm_WARN_ON(xe->drm, xe->info.tile_count > 2))
return;
if (xe->info.tile_count == 2)
return two_dgfx(xe);
return one_igfx(xe);
}
π SEE ALSO π
Kernel file ./drivers/gpu/drm/xe/xe_assert.h β also peep xe_assert(9), xe_tile_assert(9), and xe_gt_assert(9). πΈ
this cutie lives under ./drivers/gpu/drm/xe, is dated October 2026, and is the Xe Asserts(9) page β mwah, bye bestie ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms