Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/xe: Introduce xe_gt_dbg_printer()

We didn't have GT-oriented debug level printer as it was hard to
correctly show actual callsite annotation. But this is now doable
from commit c2ef66e9ad88 ("drm/print: Improve drm_dbg_printer").

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241209232739.147417-3-lucas.demarchi@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

authored by

Michal Wajdeczko and committed by
Lucas De Marchi
26582fc6 e5283bd4

+31
+31
drivers/gpu/drm/xe/xe_gt_printk.h
··· 60 60 xe_gt_info(gt, "%pV", vaf); 61 61 } 62 62 63 + static inline void __xe_gt_printfn_dbg(struct drm_printer *p, struct va_format *vaf) 64 + { 65 + struct xe_gt *gt = p->arg; 66 + struct drm_printer dbg; 67 + 68 + /* 69 + * The original xe_gt_dbg() callsite annotations are useless here, 70 + * redirect to the tweaked drm_dbg_printer() instead. 71 + */ 72 + dbg = drm_dbg_printer(&gt_to_xe(gt)->drm, DRM_UT_DRIVER, NULL); 73 + dbg.origin = p->origin; 74 + 75 + drm_printf(&dbg, "GT%u: %pV", gt->info.id, vaf); 76 + } 77 + 63 78 /** 64 79 * xe_gt_err_printer - Construct a &drm_printer that outputs to xe_gt_err() 65 80 * @gt: the &xe_gt pointer to use in xe_gt_err() ··· 101 86 struct drm_printer p = { 102 87 .printfn = __xe_gt_printfn_info, 103 88 .arg = gt, 89 + }; 90 + return p; 91 + } 92 + 93 + /** 94 + * xe_gt_dbg_printer - Construct a &drm_printer that outputs like xe_gt_dbg() 95 + * @gt: the &xe_gt pointer to use in xe_gt_dbg() 96 + * 97 + * Return: The &drm_printer object. 98 + */ 99 + static inline struct drm_printer xe_gt_dbg_printer(struct xe_gt *gt) 100 + { 101 + struct drm_printer p = { 102 + .printfn = __xe_gt_printfn_dbg, 103 + .arg = gt, 104 + .origin = (const void *)_THIS_IP_, 104 105 }; 105 106 return p; 106 107 }