From 27b8f91c08d99d267ac6096d4733203161274cbb Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Tue, 23 Jan 2024 21:37:45 +0200 Subject: drm/bridge: remove ->get_edid callback There are no more users of the ->get_edid callback left. They've all been converted to ->edid_read. Remove the callback, and the fallback in drm_bridge_edid_read(). Signed-off-by: Jani Nikula Reviewed-by: Neil Armstrong Link: https://patchwork.freedesktop.org/patch/msgid/34407a355ec6848fc44f8c30d245fcbc5687195e.1706038510.git.jani.nikula@intel.com --- include/drm/drm_bridge.h | 30 ------------------------------ 1 file changed, 30 deletions(-) (limited to 'include/drm') diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index ee12f829aaf7..7293c02e17c5 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -588,36 +588,6 @@ struct drm_bridge_funcs { const struct drm_edid *(*edid_read)(struct drm_bridge *bridge, struct drm_connector *connector); - /** - * @get_edid: - * - * Read and parse the EDID data of the connected display. - * - * The @get_edid callback is the preferred way of reporting mode - * information for a display connected to the bridge output. Bridges - * that support reading EDID shall implement this callback and leave - * the @get_modes callback unimplemented. - * - * The caller of this operation shall first verify the output - * connection status and refrain from reading EDID from a disconnected - * output. - * - * This callback is optional. Bridges that implement it shall set the - * DRM_BRIDGE_OP_EDID flag in their &drm_bridge->ops. - * - * The connector parameter shall be used for the sole purpose of EDID - * retrieval and parsing, and shall not be stored internally by bridge - * drivers for future usage. - * - * RETURNS: - * - * An edid structure newly allocated with kmalloc() (or similar) on - * success, or NULL otherwise. The caller is responsible for freeing - * the returned edid structure with kfree(). - */ - struct edid *(*get_edid)(struct drm_bridge *bridge, - struct drm_connector *connector); - /** * @hpd_notify: * -- cgit From 5e0c04c8c40b69ab165d52964433859d8b666376 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Tue, 16 Jan 2024 15:07:26 +0200 Subject: drm/print: make drm_err_printer() device specific by using drm_err() With few users for drm_err_printer(), it's still feasible to convert it to be device specific. Use drm_err() under the hood. While at it, make the prefix optional. Signed-off-by: Jani Nikula Reviewed-by: Luca Coelho Acked-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/2a9cdcfc1df44568078f7c131e2e7e0f7c94e97e.1705410327.git.jani.nikula@intel.com --- include/drm/drm_print.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'include/drm') diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index dd4883df876a..3d899fb0793c 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -35,6 +35,8 @@ #include +struct drm_device; + /* Do *not* use outside of drm_print.[ch]! */ extern unsigned long __drm_debug; @@ -235,16 +237,19 @@ static inline struct drm_printer drm_debug_printer(const char *prefix) } /** - * drm_err_printer - construct a &drm_printer that outputs to pr_err() - * @prefix: debug output prefix + * drm_err_printer - construct a &drm_printer that outputs to drm_err() + * @drm: the &struct drm_device pointer + * @prefix: debug output prefix, or NULL for no prefix * * RETURNS: * The &drm_printer object */ -static inline struct drm_printer drm_err_printer(const char *prefix) +static inline struct drm_printer drm_err_printer(struct drm_device *drm, + const char *prefix) { struct drm_printer p = { .printfn = __drm_printfn_err, + .arg = drm, .prefix = prefix }; return p; -- cgit From 82195d48b77c71b5084a6d6a03d0c574a9fc6749 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Tue, 16 Jan 2024 15:07:27 +0200 Subject: drm/print: move enum drm_debug_category etc. earlier in drm_print.h Avoid forward declarations in subsequent changes, but separate this movement to an independent change. Signed-off-by: Jani Nikula Reviewed-by: Luca Coelho Acked-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/9d105014e3c90af13a874745d768212347f68283.1705410327.git.jani.nikula@intel.com --- include/drm/drm_print.h | 190 ++++++++++++++++++++++++------------------------ 1 file changed, 95 insertions(+), 95 deletions(-) (limited to 'include/drm') diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 3d899fb0793c..2d57939429a9 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -69,6 +69,101 @@ extern unsigned long __drm_debug; * } */ +/** + * enum drm_debug_category - The DRM debug categories + * + * Each of the DRM debug logging macros use a specific category, and the logging + * is filtered by the drm.debug module parameter. This enum specifies the values + * for the interface. + * + * Each DRM_DEBUG_ macro logs to DRM_UT_ category, except + * DRM_DEBUG() logs to DRM_UT_CORE. + * + * Enabling verbose debug messages is done through the drm.debug parameter, each + * category being enabled by a bit: + * + * - drm.debug=0x1 will enable CORE messages + * - drm.debug=0x2 will enable DRIVER messages + * - drm.debug=0x3 will enable CORE and DRIVER messages + * - ... + * - drm.debug=0x1ff will enable all messages + * + * An interesting feature is that it's possible to enable verbose logging at + * run-time by echoing the debug value in its sysfs node:: + * + * # echo 0xf > /sys/module/drm/parameters/debug + * + */ +enum drm_debug_category { + /* These names must match those in DYNAMIC_DEBUG_CLASSBITS */ + /** + * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, + * drm_memory.c, ... + */ + DRM_UT_CORE, + /** + * @DRM_UT_DRIVER: Used in the vendor specific part of the driver: i915, + * radeon, ... macro. + */ + DRM_UT_DRIVER, + /** + * @DRM_UT_KMS: Used in the modesetting code. + */ + DRM_UT_KMS, + /** + * @DRM_UT_PRIME: Used in the prime code. + */ + DRM_UT_PRIME, + /** + * @DRM_UT_ATOMIC: Used in the atomic code. + */ + DRM_UT_ATOMIC, + /** + * @DRM_UT_VBL: Used for verbose debug message in the vblank code. + */ + DRM_UT_VBL, + /** + * @DRM_UT_STATE: Used for verbose atomic state debugging. + */ + DRM_UT_STATE, + /** + * @DRM_UT_LEASE: Used in the lease code. + */ + DRM_UT_LEASE, + /** + * @DRM_UT_DP: Used in the DP code. + */ + DRM_UT_DP, + /** + * @DRM_UT_DRMRES: Used in the drm managed resources code. + */ + DRM_UT_DRMRES +}; + +static inline bool drm_debug_enabled_raw(enum drm_debug_category category) +{ + return unlikely(__drm_debug & BIT(category)); +} + +#define drm_debug_enabled_instrumented(category) \ + ({ \ + pr_debug("todo: is this frequent enough to optimize ?\n"); \ + drm_debug_enabled_raw(category); \ + }) + +#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) +/* + * the drm.debug API uses dyndbg, so each drm_*dbg macro/callsite gets + * a descriptor, and only enabled callsites are reachable. They use + * the private macro to avoid re-testing the enable-bit. + */ +#define __drm_debug_enabled(category) true +#define drm_debug_enabled(category) drm_debug_enabled_instrumented(category) +#else +#define __drm_debug_enabled(category) drm_debug_enabled_raw(category) +#define drm_debug_enabled(category) drm_debug_enabled_raw(category) +#endif + /** * struct drm_printer - drm output "stream" * @@ -255,101 +350,6 @@ static inline struct drm_printer drm_err_printer(struct drm_device *drm, return p; } -/** - * enum drm_debug_category - The DRM debug categories - * - * Each of the DRM debug logging macros use a specific category, and the logging - * is filtered by the drm.debug module parameter. This enum specifies the values - * for the interface. - * - * Each DRM_DEBUG_ macro logs to DRM_UT_ category, except - * DRM_DEBUG() logs to DRM_UT_CORE. - * - * Enabling verbose debug messages is done through the drm.debug parameter, each - * category being enabled by a bit: - * - * - drm.debug=0x1 will enable CORE messages - * - drm.debug=0x2 will enable DRIVER messages - * - drm.debug=0x3 will enable CORE and DRIVER messages - * - ... - * - drm.debug=0x1ff will enable all messages - * - * An interesting feature is that it's possible to enable verbose logging at - * run-time by echoing the debug value in its sysfs node:: - * - * # echo 0xf > /sys/module/drm/parameters/debug - * - */ -enum drm_debug_category { - /* These names must match those in DYNAMIC_DEBUG_CLASSBITS */ - /** - * @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, - * drm_memory.c, ... - */ - DRM_UT_CORE, - /** - * @DRM_UT_DRIVER: Used in the vendor specific part of the driver: i915, - * radeon, ... macro. - */ - DRM_UT_DRIVER, - /** - * @DRM_UT_KMS: Used in the modesetting code. - */ - DRM_UT_KMS, - /** - * @DRM_UT_PRIME: Used in the prime code. - */ - DRM_UT_PRIME, - /** - * @DRM_UT_ATOMIC: Used in the atomic code. - */ - DRM_UT_ATOMIC, - /** - * @DRM_UT_VBL: Used for verbose debug message in the vblank code. - */ - DRM_UT_VBL, - /** - * @DRM_UT_STATE: Used for verbose atomic state debugging. - */ - DRM_UT_STATE, - /** - * @DRM_UT_LEASE: Used in the lease code. - */ - DRM_UT_LEASE, - /** - * @DRM_UT_DP: Used in the DP code. - */ - DRM_UT_DP, - /** - * @DRM_UT_DRMRES: Used in the drm managed resources code. - */ - DRM_UT_DRMRES -}; - -static inline bool drm_debug_enabled_raw(enum drm_debug_category category) -{ - return unlikely(__drm_debug & BIT(category)); -} - -#define drm_debug_enabled_instrumented(category) \ - ({ \ - pr_debug("todo: is this frequent enough to optimize ?\n"); \ - drm_debug_enabled_raw(category); \ - }) - -#if defined(CONFIG_DRM_USE_DYNAMIC_DEBUG) -/* - * the drm.debug API uses dyndbg, so each drm_*dbg macro/callsite gets - * a descriptor, and only enabled callsites are reachable. They use - * the private macro to avoid re-testing the enable-bit. - */ -#define __drm_debug_enabled(category) true -#define drm_debug_enabled(category) drm_debug_enabled_instrumented(category) -#else -#define __drm_debug_enabled(category) drm_debug_enabled_raw(category) -#define drm_debug_enabled(category) drm_debug_enabled_raw(category) -#endif - /* * struct device based logging * -- cgit From 9fd6f61a297e944fa045a1cb6cd53916d0fea454 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Tue, 16 Jan 2024 15:07:28 +0200 Subject: drm/print: add drm_dbg_printer() for drm device specific printer We've lacked a device specific debug printer. Add one. Take category into account too. __builtin_return_address(0) is inaccurate here, so don't use it. If necessary, we can later pass __func__ to drm_dbg_printer() by wrapping it inside a macro. Signed-off-by: Jani Nikula Reviewed-by: Luca Coelho Acked-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/48607d58e5cdf8341ffdd522257542fa2ce41a19.1705410327.git.jani.nikula@intel.com --- include/drm/drm_print.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'include/drm') diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 2d57939429a9..c6a7a7fecccc 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -176,6 +176,7 @@ struct drm_printer { void (*puts)(struct drm_printer *p, const char *str); void *arg; const char *prefix; + enum drm_debug_category category; }; void __drm_printfn_coredump(struct drm_printer *p, struct va_format *vaf); @@ -184,6 +185,7 @@ void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf); void __drm_puts_seq_file(struct drm_printer *p, const char *str); void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf); void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf); +void __drm_printfn_dbg(struct drm_printer *p, struct va_format *vaf); void __drm_printfn_err(struct drm_printer *p, struct va_format *vaf); __printf(2, 3) @@ -331,6 +333,28 @@ static inline struct drm_printer drm_debug_printer(const char *prefix) return p; } +/** + * drm_dbg_printer - construct a &drm_printer for drm device specific output + * @drm: the &struct drm_device pointer, or NULL + * @category: the debug category to use + * @prefix: debug output prefix, or NULL for no prefix + * + * RETURNS: + * The &drm_printer object + */ +static inline struct drm_printer drm_dbg_printer(struct drm_device *drm, + enum drm_debug_category category, + const char *prefix) +{ + struct drm_printer p = { + .printfn = __drm_printfn_dbg, + .arg = drm, + .prefix = prefix, + .category = category, + }; + return p; +} + /** * drm_err_printer - construct a &drm_printer that outputs to drm_err() * @drm: the &struct drm_device pointer -- cgit From 2e61504fd1c36ac87e2127f02f9a61a3586bb1ec Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Tue, 16 Jan 2024 15:07:31 +0200 Subject: drm/dp: switch drm_dp_vsc_sdp_log() to struct drm_printer Use the existing drm printer infrastructure instead of local macros. Signed-off-by: Jani Nikula Reviewed-by: Luca Coelho Acked-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/cdf8faf272d345de215feb6ececba384ecaecdb4.1705410327.git.jani.nikula@intel.com --- include/drm/display/drm_dp_helper.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include/drm') diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h index 863b2e7add29..d02014a87f12 100644 --- a/include/drm/display/drm_dp_helper.h +++ b/include/drm/display/drm_dp_helper.h @@ -98,8 +98,7 @@ struct drm_dp_vsc_sdp { enum dp_content_type content_type; }; -void drm_dp_vsc_sdp_log(const char *level, struct device *dev, - const struct drm_dp_vsc_sdp *vsc); +void drm_dp_vsc_sdp_log(struct drm_printer *p, const struct drm_dp_vsc_sdp *vsc); int drm_dp_psr_setup_time(const u8 psr_cap[EDP_PSR_RECEIVER_CAP_SIZE]); -- cgit From e154c4fc7bf2d5c3f86d07628ab1cb03e8085c25 Mon Sep 17 00:00:00 2001 From: Jani Nikula Date: Tue, 16 Jan 2024 15:07:35 +0200 Subject: drm: remove drm_debug_printer in favor of drm_dbg_printer Convert the remaining drm_debug_printer users over to drm_dbg_printer, as it can handle the cases without struct drm_device pointer, and also provides drm debug category and prefix support. Remove drm_debug_printer altogether. Signed-off-by: Jani Nikula Reviewed-by: Luca Coelho Acked-by: Maxime Ripard Link: https://patchwork.freedesktop.org/patch/msgid/18b5b91e62d071675a651f6f91c58f05ad74134a.1705410327.git.jani.nikula@intel.com --- include/drm/drm_print.h | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'include/drm') diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index c6a7a7fecccc..39ea79b5c0f0 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -184,7 +184,6 @@ void __drm_puts_coredump(struct drm_printer *p, const char *str); void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf); void __drm_puts_seq_file(struct drm_printer *p, const char *str); void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf); -void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf); void __drm_printfn_dbg(struct drm_printer *p, struct va_format *vaf); void __drm_printfn_err(struct drm_printer *p, struct va_format *vaf); @@ -317,22 +316,6 @@ static inline struct drm_printer drm_info_printer(struct device *dev) return p; } -/** - * drm_debug_printer - construct a &drm_printer that outputs to pr_debug() - * @prefix: debug output prefix - * - * RETURNS: - * The &drm_printer object - */ -static inline struct drm_printer drm_debug_printer(const char *prefix) -{ - struct drm_printer p = { - .printfn = __drm_printfn_debug, - .prefix = prefix - }; - return p; -} - /** * drm_dbg_printer - construct a &drm_printer for drm device specific output * @drm: the &struct drm_device pointer, or NULL -- cgit