Skip to content

Commit 26582fc

Browse files
mwajdeczlucasdemarchi
authored andcommitted
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 c2ef66e ("drm/print: Improve drm_dbg_printer"). Signed-off-by: Michal Wajdeczko <[email protected]> Reviewed-by: Lucas De Marchi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Lucas De Marchi <[email protected]>
1 parent e5283bd commit 26582fc

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

drivers/gpu/drm/xe/xe_gt_printk.h

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,21 @@ static inline void __xe_gt_printfn_info(struct drm_printer *p, struct va_format
6060
xe_gt_info(gt, "%pV", vaf);
6161
}
6262

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+
6378
/**
6479
* xe_gt_err_printer - Construct a &drm_printer that outputs to xe_gt_err()
6580
* @gt: the &xe_gt pointer to use in xe_gt_err()
@@ -90,4 +105,20 @@ static inline struct drm_printer xe_gt_info_printer(struct xe_gt *gt)
90105
return p;
91106
}
92107

108+
/**
109+
* xe_gt_dbg_printer - Construct a &drm_printer that outputs like xe_gt_dbg()
110+
* @gt: the &xe_gt pointer to use in xe_gt_dbg()
111+
*
112+
* Return: The &drm_printer object.
113+
*/
114+
static inline struct drm_printer xe_gt_dbg_printer(struct xe_gt *gt)
115+
{
116+
struct drm_printer p = {
117+
.printfn = __xe_gt_printfn_dbg,
118+
.arg = gt,
119+
.origin = (const void *)_THIS_IP_,
120+
};
121+
return p;
122+
}
123+
93124
#endif

0 commit comments

Comments
 (0)