[PATCH v4 01/10] drm/xe: Add GT oriented drm_printers

Lucas De Marchi lucas.demarchi at intel.com
Fri Dec 15 21:48:05 UTC 2023


On Fri, Dec 15, 2023 at 05:24:53PM +0100, Michal Wajdeczko wrote:
>Instead of using generic drm_err_printer() that just adds static
>prefix, or drm_info_printer() that outputs only device name, add
>new helpers that create dedicated drm_printers that use our GT
>oriented xe_gt_err() and xe_gt_info() functions.
>
>Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
>Cc: Matt Roper <matthew.d.roper at intel.com>
>Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
>---
> drivers/gpu/drm/xe/xe_gt_printk.h | 44 +++++++++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
>
>diff --git a/drivers/gpu/drm/xe/xe_gt_printk.h b/drivers/gpu/drm/xe/xe_gt_printk.h
>index 5991bcadd47e..195f45b10c41 100644
>--- a/drivers/gpu/drm/xe/xe_gt_printk.h
>+++ b/drivers/gpu/drm/xe/xe_gt_printk.h
>@@ -43,4 +43,48 @@
> #define xe_gt_WARN_ON_ONCE(_gt, _condition) \
> 	xe_gt_WARN_ONCE((_gt), _condition, "%s(%s)", "gt_WARN_ON_ONCE", __stringify(_condition))
>
>+static inline void __drm_printfn_xe_gt_err(struct drm_printer *p, struct va_format *vaf)

we try to follow the header name, __drm_printfn here doesn't look good.

	$ git grep _printfn -- drivers/gpu/drm/
	drivers/gpu/drm/drm_print.c:void __drm_printfn_coredump(struct drm_printer *p, struct va_format *vaf)
	drivers/gpu/drm/drm_print.c:EXPORT_SYMBOL(__drm_printfn_coredump);
	drivers/gpu/drm/drm_print.c:void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf)
	drivers/gpu/drm/drm_print.c:EXPORT_SYMBOL(__drm_printfn_seq_file);
	drivers/gpu/drm/drm_print.c:void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf)
	drivers/gpu/drm/drm_print.c:EXPORT_SYMBOL(__drm_printfn_info);
	drivers/gpu/drm/drm_print.c:void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf)
	drivers/gpu/drm/drm_print.c:EXPORT_SYMBOL(__drm_printfn_debug);
	drivers/gpu/drm/drm_print.c:void __drm_printfn_err(struct drm_printer *p, struct va_format *vaf)
	drivers/gpu/drm/drm_print.c:EXPORT_SYMBOL(__drm_printfn_err);
	drivers/gpu/drm/i915/i915_gpu_error.c:static void __i915_printfn_error(struct drm_printer *p, struct va_format *vaf)
	drivers/gpu/drm/i915/i915_gpu_error.c:          .printfn = __i915_printfn_error,

and the only user outside the drm helpers is i915, that does __i915_printfn_error()

let's name this __xe_gt_printfn_err()?


>+{
>+	struct xe_gt *gt = p->arg;
>+
>+	xe_gt_err(gt, "%pV", vaf);
>+}
>+
>+static inline void __drm_printfn_xe_gt_info(struct drm_printer *p, struct va_format *vaf)

ditto.

other than that, lgtm.

	
	Reviewed-by: Lucas De Marchi <lucas.demarchi at intel.com>

Lucas De Marchi

>+{
>+	struct xe_gt *gt = p->arg;
>+
>+	xe_gt_info(gt, "%pV", vaf);
>+}
>+
>+/**
>+ * xe_gt_err_printer - Construct a &drm_printer that outputs to xe_gt_err()
>+ * @gt: the &xe_gt pointer to use in xe_gt_err()
>+ *
>+ * Return: The &drm_printer object.
>+ */
>+static inline struct drm_printer xe_gt_err_printer(struct xe_gt *gt)
>+{
>+	struct drm_printer p = {
>+		.printfn = __drm_printfn_xe_gt_err,
>+		.arg = gt,
>+	};
>+	return p;
>+}
>+
>+/**
>+ * xe_gt_info_printer - Construct a &drm_printer that outputs to xe_gt_info()
>+ * @gt: the &xe_gt pointer to use in xe_gt_info()
>+ *
>+ * Return: The &drm_printer object.
>+ */
>+static inline struct drm_printer xe_gt_info_printer(struct xe_gt *gt)
>+{
>+	struct drm_printer p = {
>+		.printfn = __drm_printfn_xe_gt_info,
>+		.arg = gt,
>+	};
>+	return p;
>+}
>+
> #endif
>-- 
>2.25.1
>


More information about the Intel-xe mailing list