From patchwork Fri Nov 24 12:43:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13467609 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5014AC61DF4 for ; Fri, 24 Nov 2023 12:44:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4115810E1E3; Fri, 24 Nov 2023 12:44:19 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 507C310E1DF; Fri, 24 Nov 2023 12:44:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700829853; x=1732365853; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xVJ7PYtP4ASIvLpNBzpcMBMGvB3McvMPM5qk8TeDBX0=; b=l5I9sgfbOmEo1HxX5gJV6bTk3V+1zo9SyXlPEE1aCm6XXb5Gc8b6FCCL UV3kSjxiV64knMKAE4Iyv94hZBKb3UOGyMtm/E3g3JK36ENZyhsx5Qqvb 1+1BP5F2aSt9UdZwIQSKCpFeUtYAKhJttWmG7FoaHW68TskmwjIRJVYzo n2ZeD3A/2LYAfFtAIF4WLtoVqAkySqFfGJAATrWcWeSswFdhKWn4DyMs4 /83BcttTdxIV9Go/NX0YaKZGzV4xmYTbdMP2BAV2yNmS5UgrgIxwUN3P6 Fb84aVU0Xx3TR4L2tSkvZO3kAmMs3LXQXR/3tAGqe+CGYiCVEFHDGGZdf Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="478626937" X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="478626937" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:12 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="833687912" X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="833687912" Received: from dashah-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.41.230]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:11 -0800 From: Jani Nikula To: dri-devel@lists.freedesktop.org Subject: [PATCH 1/8] drm/print: make drm_err_printer() device specific by using drm_err() Date: Fri, 24 Nov 2023 14:43:55 +0200 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- drivers/gpu/drm/drm_print.c | 7 ++++++- drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c | 4 ++-- drivers/gpu/drm/i915/selftests/i915_active.c | 4 ++-- include/drm/drm_print.h | 11 ++++++++--- 4 files changed, 18 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 5b93c11895bb..91dbcdeaad3f 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -191,7 +191,12 @@ EXPORT_SYMBOL(__drm_printfn_debug); void __drm_printfn_err(struct drm_printer *p, struct va_format *vaf) { - pr_err("*ERROR* %s %pV", p->prefix, vaf); + struct drm_device *drm = p->arg; + + if (p->prefix) + drm_err(drm, "%s %pV", p->prefix, vaf); + else + drm_err(drm, "%pV", vaf); } EXPORT_SYMBOL(__drm_printfn_err); diff --git a/drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c b/drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c index 273d440a53e3..b4970c1ed572 100644 --- a/drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c +++ b/drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c @@ -122,7 +122,7 @@ static int __live_idle_pulse(struct intel_engine_cs *engine, GEM_BUG_ON(!llist_empty(&engine->barrier_tasks)); if (engine_sync_barrier(engine)) { - struct drm_printer m = drm_err_printer("pulse"); + struct drm_printer m = drm_err_printer(&engine->i915->drm, "pulse"); pr_err("%s: no heartbeat pulse?\n", engine->name); intel_engine_dump(engine, &m, "%s", engine->name); @@ -136,7 +136,7 @@ static int __live_idle_pulse(struct intel_engine_cs *engine, pulse_unlock_wait(p); /* synchronize with the retirement callback */ if (!i915_active_is_idle(&p->active)) { - struct drm_printer m = drm_err_printer("pulse"); + struct drm_printer m = drm_err_printer(&engine->i915->drm, "pulse"); pr_err("%s: heartbeat pulse did not flush idle tasks\n", engine->name); diff --git a/drivers/gpu/drm/i915/selftests/i915_active.c b/drivers/gpu/drm/i915/selftests/i915_active.c index b61fe850e924..8886752ade63 100644 --- a/drivers/gpu/drm/i915/selftests/i915_active.c +++ b/drivers/gpu/drm/i915/selftests/i915_active.c @@ -156,7 +156,7 @@ static int live_active_wait(void *arg) __i915_active_wait(&active->base, TASK_UNINTERRUPTIBLE); if (!READ_ONCE(active->retired)) { - struct drm_printer p = drm_err_printer(__func__); + struct drm_printer p = drm_err_printer(&i915->drm, __func__); pr_err("i915_active not retired after waiting!\n"); i915_active_print(&active->base, &p); @@ -189,7 +189,7 @@ static int live_active_retire(void *arg) err = -EIO; if (!READ_ONCE(active->retired)) { - struct drm_printer p = drm_err_printer(__func__); + struct drm_printer p = drm_err_printer(&i915->drm, __func__); pr_err("i915_active not retired after flushing!\n"); i915_active_print(&active->base, &p); 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; From patchwork Fri Nov 24 12:43:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13467610 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0500DC61D97 for ; Fri, 24 Nov 2023 12:44:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B02810E7D9; Fri, 24 Nov 2023 12:44:26 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8836110E1E3; Fri, 24 Nov 2023 12:44:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700829858; x=1732365858; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yoZ/pLcQXwKab2BZfEW6m+djBny7r2aeIH6LWQGKa6U=; b=lWpwnVqzfT1NkaE9qyJMdJHgJcj5UpOAp5jrm0xZPI+60czrMRRLyvnD wT782mOdxSbpMmZWs5PQwKbqdV8e9VunF2+b5T5KJhProN3foT+Y+GtO5 K5mJ7c09HQ0xqWGp85J5TyJkEPRf1zcpW4uEinKKtgCZorpeM/a5ew7He cqnmCTNufF3VjtNFd+k9lqvjjCUa8xQxfeH4Em9eANLGgiTvS2Ovbucnu TBT8y/buqgQ+oZvm+VhcgvZiPWkU1fFJ23RNufJ4MdBqeWVbxjofoTxtM nACk2AQm2tj0n8hvM82ga1u1pJ0AJHJxX5p6gTm1L/NFVwiYmivm1VTYQ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="396322596" X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="396322596" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="891057735" X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="891057735" Received: from dashah-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.41.230]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:16 -0800 From: Jani Nikula To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/8] drm/print: move enum drm_debug_category etc. earlier in drm_print.h Date: Fri, 24 Nov 2023 14:43:56 +0200 Message-Id: <1da528bb2c4b9b695efff9ddd617be1992acac62.1700829750.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Avoid forward declarations in subsequent changes, but separate this movement to an independent change. Signed-off-by: Jani Nikula --- include/drm/drm_print.h | 190 ++++++++++++++++++++-------------------- 1 file changed, 95 insertions(+), 95 deletions(-) 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 * From patchwork Fri Nov 24 12:43:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13467611 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 48249C61D97 for ; Fri, 24 Nov 2023 12:44:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CB5E810E7D3; Fri, 24 Nov 2023 12:44:26 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3B0D610E7E8; Fri, 24 Nov 2023 12:44:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700829863; x=1732365863; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZH0I2mDfZJAA6EI7gWpQwKj7GUTe9+ey6o2oV3S7QZ0=; b=enMq6dKGzSSz76OHyxxxsWPFw/MW39u/w7xRMnhTdz89qs9wer/KJ5qo JJqZ3UKeD8H1aWImBVEUo754F9Q+yNB1y4eeJoUytxnKlEWDqaciInulv m9CzN5NKxMmQgv/9W97nA4tXjOzlfoYWZ7ujUCELiH/s0zk8p02trc+Nm uwC8g59iRlfcwJJCDFrblomSFXjaqfMFl7kfaLVZksdGmXemMtdXJtEqJ ODOKhDjtDYeCXKOoYvGCcEoZuEmnNaXVXvkGuuKlMB7AXlbKap2nJN8J/ TU2ZCFo2giBNV+qWtZrIfPBHKUFdhxngjNLrvq0qgSxDcC/xtsFlc2AV9 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="478626952" X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="478626952" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:22 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="833687963" X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="833687963" Received: from dashah-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.41.230]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:21 -0800 From: Jani Nikula To: dri-devel@lists.freedesktop.org Subject: [PATCH 3/8] drm/print: add drm_dbg_printer() for drm device specific printer Date: Fri, 24 Nov 2023 14:43:57 +0200 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 --- drivers/gpu/drm/drm_print.c | 21 +++++++++++++++++++++ include/drm/drm_print.h | 24 ++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index 91dbcdeaad3f..673b29c732ea 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -189,6 +189,27 @@ void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf) } EXPORT_SYMBOL(__drm_printfn_debug); +void __drm_printfn_dbg(struct drm_printer *p, struct va_format *vaf) +{ + const struct drm_device *drm = p->arg; + const struct device *dev = drm ? drm->dev : NULL; + enum drm_debug_category category = p->category; + const char *prefix = p->prefix ?: ""; + const char *prefix_pad = p->prefix ? " " : ""; + + if (!__drm_debug_enabled(category)) + return; + + /* Note: __builtin_return_address(0) is useless here. */ + if (dev) + dev_printk(KERN_DEBUG, dev, "[" DRM_NAME "]%s%s %pV", + prefix_pad, prefix, vaf); + else + printk(KERN_DEBUG "[" DRM_NAME "]%s%s %pV", + prefix_pad, prefix, vaf); +} +EXPORT_SYMBOL(__drm_printfn_dbg); + void __drm_printfn_err(struct drm_printer *p, struct va_format *vaf) { struct drm_device *drm = p->arg; 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 From patchwork Fri Nov 24 12:43:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13467612 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E53BFC61DF4 for ; Fri, 24 Nov 2023 12:44:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0F40410E1E8; Fri, 24 Nov 2023 12:44:36 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id ED2DD10E7E3; Fri, 24 Nov 2023 12:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700829866; x=1732365866; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MXufi8yv5EDgszRFIWETWcGZbvK6vkGgyNxOgkONleg=; b=WegjLEar33BXJPhBdoXhwKNKCbCuIpwv3/OdCs0lSxOS/J6pZ0Z56GMs h8PVYJzJCMzPXU9IVxEFLjMwDFooSvEhXKwSMYofwEnNASPa3DLG058Hj GaM9/B/hJxB/1jGwy9sG5vm7wJ8+KXgU1s5iOPYqVwjLSD3aoSZYPJpfU mPiA7NM8UvMzwMGyNsAcrCUlfWf2aC7zLZd0fFFr60L4jnJvTcJdgN0+Z pTk6Vj8mugQVJW/7hSWaxozU1+u5XL5bT4NHg/AX0+iTShSrtCGuYgLd+ +2jJWJt4Nyj9slnFLvaRKn7ZdLThcc0DXUx93TNWA0YbYLKrwNXJr1yGI g==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="478626959" X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="478626959" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:26 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="833688000" X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="833688000" Received: from dashah-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.41.230]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:25 -0800 From: Jani Nikula To: dri-devel@lists.freedesktop.org Subject: [PATCH 4/8] drm/dp_mst: switch from drm_debug_printer() to device specific drm_dbg_printer() Date: Fri, 24 Nov 2023 14:43:58 +0200 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Prefer the device specific debug printer. Signed-off-by: Jani Nikula --- drivers/gpu/drm/display/drm_dp_mst_topology.c | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/display/drm_dp_mst_topology.c b/drivers/gpu/drm/display/drm_dp_mst_topology.c index 8ca01a6bf645..fba6e37b051b 100644 --- a/drivers/gpu/drm/display/drm_dp_mst_topology.c +++ b/drivers/gpu/drm/display/drm_dp_mst_topology.c @@ -1306,7 +1306,8 @@ static int drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb, } out: if (unlikely(ret == -EIO) && drm_debug_enabled(DRM_UT_DP)) { - struct drm_printer p = drm_debug_printer(DBG_PREFIX); + struct drm_printer p = drm_dbg_printer(mgr->dev, DRM_UT_DP, + DBG_PREFIX); drm_dp_mst_dump_sideband_msg_tx(&p, txmsg); } @@ -1593,10 +1594,11 @@ topology_ref_type_to_str(enum drm_dp_mst_topology_ref_type type) } static void -__dump_topology_ref_history(struct drm_dp_mst_topology_ref_history *history, +__dump_topology_ref_history(struct drm_device *drm, + struct drm_dp_mst_topology_ref_history *history, void *ptr, const char *type_str) { - struct drm_printer p = drm_debug_printer(DBG_PREFIX); + struct drm_printer p = drm_dbg_printer(drm, DRM_UT_DP, DBG_PREFIX); char *buf = kzalloc(PAGE_SIZE, GFP_KERNEL); int i; @@ -1638,15 +1640,15 @@ __dump_topology_ref_history(struct drm_dp_mst_topology_ref_history *history, static __always_inline void drm_dp_mst_dump_mstb_topology_history(struct drm_dp_mst_branch *mstb) { - __dump_topology_ref_history(&mstb->topology_ref_history, mstb, - "MSTB"); + __dump_topology_ref_history(mstb->mgr->dev, &mstb->topology_ref_history, + mstb, "MSTB"); } static __always_inline void drm_dp_mst_dump_port_topology_history(struct drm_dp_mst_port *port) { - __dump_topology_ref_history(&port->topology_ref_history, port, - "Port"); + __dump_topology_ref_history(port->mgr->dev, &port->topology_ref_history, + port, "Port"); } static __always_inline void @@ -2824,7 +2826,9 @@ static int process_single_tx_qlock(struct drm_dp_mst_topology_mgr *mgr, ret = drm_dp_send_sideband_msg(mgr, up, chunk, idx); if (ret) { if (drm_debug_enabled(DRM_UT_DP)) { - struct drm_printer p = drm_debug_printer(DBG_PREFIX); + struct drm_printer p = drm_dbg_printer(mgr->dev, + DRM_UT_DP, + DBG_PREFIX); drm_printf(&p, "sideband msg failed to send\n"); drm_dp_mst_dump_sideband_msg_tx(&p, txmsg); @@ -2869,7 +2873,8 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr, list_add_tail(&txmsg->next, &mgr->tx_msg_downq); if (drm_debug_enabled(DRM_UT_DP)) { - struct drm_printer p = drm_debug_printer(DBG_PREFIX); + struct drm_printer p = drm_dbg_printer(mgr->dev, DRM_UT_DP, + DBG_PREFIX); drm_dp_mst_dump_sideband_msg_tx(&p, txmsg); } From patchwork Fri Nov 24 12:43:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13467613 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C0C40C61DF7 for ; Fri, 24 Nov 2023 12:44:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8CD8110E1F2; Fri, 24 Nov 2023 12:44:37 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id C2C3F10E1E8; Fri, 24 Nov 2023 12:44:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700829871; x=1732365871; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=H7NkDBGXQDWjcPyDigGVHeuccBWYT+ZSkzRBCwJOLuQ=; b=lRyJ7VzEU+B7RVHHwdQpzM9meMdWclBBImLq4nNFa6CuLraPVxejHtjr vIclB8jBNcr0LeTja/2WT4C5eD8Nt73/rmeRrtDbUpailqTvpmXne8zhA AwfHVVOE656MlChKTbyV9ux364f5A50Ncd2epkg9K6Mirv/LTJZPZmz2k aw9bHvhblzTHcP2AzzcTQuiNWwqQYr6nvaF6VeBtRmNu40vDVcLsmmKQf QTpH1eyZ0efZEKJkTh6A6CKGIDcAjLhVl0x8oyKYQG7SIJiRvdCSART5b aBIbhq5zLoNKSUm3OcmM2y1VpmxcaFEJOgLy4VywkLXsP59ohwVaYXHip A==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="396322612" X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="396322612" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:31 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="891057752" X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="891057752" Received: from dashah-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.41.230]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:29 -0800 From: Jani Nikula To: dri-devel@lists.freedesktop.org Subject: [PATCH 5/8] drm/mode: switch from drm_debug_printer() to device specific drm_dbg_printer() Date: Fri, 24 Nov 2023 14:43:59 +0200 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Prefer the device specific debug printer. Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_mode_config.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index 8525ef851540..48fd2d67f352 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -544,7 +544,7 @@ void drm_mode_config_cleanup(struct drm_device *dev) */ WARN_ON(!list_empty(&dev->mode_config.fb_list)); list_for_each_entry_safe(fb, fbt, &dev->mode_config.fb_list, head) { - struct drm_printer p = drm_debug_printer("[leaked fb]"); + struct drm_printer p = drm_dbg_printer(dev, DRM_UT_KMS, "[leaked fb]"); drm_printf(&p, "framebuffer[%u]:\n", fb->base.id); drm_framebuffer_print_info(&p, 1, fb); From patchwork Fri Nov 24 12:44:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13467614 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E6BE8C61DF4 for ; Fri, 24 Nov 2023 12:44:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D663410E204; Fri, 24 Nov 2023 12:44:45 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4E98E10E1F2; Fri, 24 Nov 2023 12:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700829876; x=1732365876; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v+jxSZJTFxEyHHnwP2evczv7VRFYUv1gkoBE9+3drEg=; b=L/TJpzZwKCnXmdWib+Vxu5vSGvUgya6yQvQa3AJrdEr6K/tHPso5A/lI pjxj60wkg/rmAwhXvWnRgeE4+p2v1xPOTXEReDnPr4hGgbgnX1924cuet O/J5pO3rANbLzQME+KWI/e4bOLF+WI/AxV103hBXiQAFv0vYaEOaw9D26 D5Tcpz2aExiBYgwIopFC0/JCgvkn/+EO8NCij3IMcbrtEI4HHeQBbiOTo EbP/YFZpxehEqVEn9V/GCjHwhT2INwz0gqi5VrKzZZNp0gehsL1XugvSs EzPIk/L6fbKEzwsmofeiZ9phAMBkgHSh/qTz607nLzRC8miDdoCDz5Cak Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="396322618" X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="396322618" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="891057756" X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="891057756" Received: from dashah-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.41.230]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:34 -0800 From: Jani Nikula To: dri-devel@lists.freedesktop.org Subject: [PATCH 6/8] drm/dp: switch drm_dp_vsc_sdp_log() to struct drm_printer Date: Fri, 24 Nov 2023 14:44:00 +0200 Message-Id: <95f1e3981fa3c5304f3c74e82330f12983d35735.1700829750.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use the existing drm printer infrastructure instead of local macros. Signed-off-by: Jani Nikula --- drivers/gpu/drm/display/drm_dp_helper.c | 17 +++++------- .../drm/i915/display/intel_crtc_state_dump.c | 5 ++-- drivers/gpu/drm/i915/display/intel_display.c | 27 +++++++++---------- include/drm/display/drm_dp_helper.h | 3 +-- 4 files changed, 23 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c index d72b6f9a352c..1cf51a748022 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -2898,22 +2898,19 @@ static const char *dp_content_type_get_name(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) { -#define DP_SDP_LOG(fmt, ...) dev_printk(level, dev, fmt, ##__VA_ARGS__) - DP_SDP_LOG("DP SDP: %s, revision %u, length %u\n", "VSC", + drm_printf(p, "DP SDP: VSC, revision %u, length %u\n", vsc->revision, vsc->length); - DP_SDP_LOG(" pixelformat: %s\n", + drm_printf(p, " pixelformat: %s\n", dp_pixelformat_get_name(vsc->pixelformat)); - DP_SDP_LOG(" colorimetry: %s\n", + drm_printf(p, " colorimetry: %s\n", dp_colorimetry_get_name(vsc->pixelformat, vsc->colorimetry)); - DP_SDP_LOG(" bpc: %u\n", vsc->bpc); - DP_SDP_LOG(" dynamic range: %s\n", + drm_printf(p, " bpc: %u\n", vsc->bpc); + drm_printf(p, " dynamic range: %s\n", dp_dynamic_range_get_name(vsc->dynamic_range)); - DP_SDP_LOG(" content type: %s\n", + drm_printf(p, " content type: %s\n", dp_content_type_get_name(vsc->content_type)); -#undef DP_SDP_LOG } EXPORT_SYMBOL(drm_dp_vsc_sdp_log); diff --git a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c index fbe89b6f038a..a6c55a357b13 100644 --- a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c +++ b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c @@ -55,10 +55,9 @@ static void intel_dump_dp_vsc_sdp(struct drm_i915_private *i915, const struct drm_dp_vsc_sdp *vsc) { - if (!drm_debug_enabled(DRM_UT_KMS)) - return; + struct drm_printer p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL); - drm_dp_vsc_sdp_log(KERN_DEBUG, i915->drm.dev, vsc); + drm_dp_vsc_sdp_log(&p, vsc); } static void diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 5cf162628b95..5f05017570da 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -4799,28 +4799,27 @@ pipe_config_infoframe_mismatch(struct drm_i915_private *dev_priv, } static void -pipe_config_dp_vsc_sdp_mismatch(struct drm_i915_private *dev_priv, +pipe_config_dp_vsc_sdp_mismatch(struct drm_i915_private *i915, bool fastset, const char *name, const struct drm_dp_vsc_sdp *a, const struct drm_dp_vsc_sdp *b) { + struct drm_printer p; + if (fastset) { - if (!drm_debug_enabled(DRM_UT_KMS)) - return; + p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL); - drm_dbg_kms(&dev_priv->drm, - "fastset requirement not met in %s dp sdp\n", name); - drm_dbg_kms(&dev_priv->drm, "expected:\n"); - drm_dp_vsc_sdp_log(KERN_DEBUG, dev_priv->drm.dev, a); - drm_dbg_kms(&dev_priv->drm, "found:\n"); - drm_dp_vsc_sdp_log(KERN_DEBUG, dev_priv->drm.dev, b); + drm_printf(&p, "fastset requirement not met in %s dp sdp\n", name); } else { - drm_err(&dev_priv->drm, "mismatch in %s dp sdp\n", name); - drm_err(&dev_priv->drm, "expected:\n"); - drm_dp_vsc_sdp_log(KERN_ERR, dev_priv->drm.dev, a); - drm_err(&dev_priv->drm, "found:\n"); - drm_dp_vsc_sdp_log(KERN_ERR, dev_priv->drm.dev, b); + p = drm_err_printer(&i915->drm, NULL); + + drm_printf(&p, "mismatch in %s dp sdp\n", name); } + + drm_printf(&p, "expected:\n"); + drm_dp_vsc_sdp_log(&p, a); + drm_printf(&p, "found:\n"); + drm_dp_vsc_sdp_log(&p, b); } /* Returns the length up to and including the last differing byte */ 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]); From patchwork Fri Nov 24 12:44:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13467615 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2A38CC61DF7 for ; Fri, 24 Nov 2023 12:44:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8C76A10E7E0; Fri, 24 Nov 2023 12:44:46 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id DBB3610E7DD; Fri, 24 Nov 2023 12:44:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700829880; x=1732365880; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+VjZ7uZojJvr14RcYGF9jRgvwA/BHTpYzyr1pyIH0B0=; b=TxgOQ/Wb/hf7dJi9Szobg1rxjWtARCnM3AWk8D4oFKQ1eJergvYCDUt5 HW11ydjDuKclagAO+4N1cytd0I2pHnj+BfGMSafMimDzjE1O8INyfM+ba WzH+HGylYEamCzB5dAGEow649JaIVG2b689PYw7xAxjyn42EK1r/xhWUV EcqLJ/CSabWZq7I1eeYfOgOye7wrr12HK1lQZLETttqyy3LPtjLpFevox CQt9q30t01rfvTRVQfvlJSbziEajbF9q6P0ZF3e0gFuEg5kyyXBAt+ar2 ZVO2z/8l2nnovQePxxxiwxJAUp6H4CL34GtmbIM0ahmlxL4DX1jQ5hLtg g==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="478626975" X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="478626975" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="833688066" X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="833688066" Received: from dashah-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.41.230]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:38 -0800 From: Jani Nikula To: dri-devel@lists.freedesktop.org Subject: [PATCH 7/8] drm/i915: switch from drm_debug_printer() to device specific drm_dbg_printer() Date: Fri, 24 Nov 2023 14:44:01 +0200 Message-Id: X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Prefer the device specific debug printer. Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_display_driver.c | 3 ++- drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c | 3 ++- drivers/gpu/drm/i915/gt/intel_reset.c | 3 ++- drivers/gpu/drm/i915/gt/intel_workarounds.c | 3 ++- drivers/gpu/drm/i915/gt/selftest_context.c | 3 ++- drivers/gpu/drm/i915/i915_driver.c | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display_driver.c b/drivers/gpu/drm/i915/display/intel_display_driver.c index 62f7b10484be..b6e7d66f895d 100644 --- a/drivers/gpu/drm/i915/display/intel_display_driver.c +++ b/drivers/gpu/drm/i915/display/intel_display_driver.c @@ -387,7 +387,8 @@ int intel_display_driver_probe(struct drm_i915_private *i915) void intel_display_driver_register(struct drm_i915_private *i915) { - struct drm_printer p = drm_debug_printer("i915 display info:"); + struct drm_printer p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, + "i915 display info:"); if (!HAS_DISPLAY(i915)) return; diff --git a/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c b/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c index 1a8e2b7db013..0f6406f0cca0 100644 --- a/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c +++ b/drivers/gpu/drm/i915/gt/intel_engine_heartbeat.c @@ -96,7 +96,8 @@ static void heartbeat_commit(struct i915_request *rq, static void show_heartbeat(const struct i915_request *rq, struct intel_engine_cs *engine) { - struct drm_printer p = drm_debug_printer("heartbeat"); + struct drm_printer p = drm_dbg_printer(&rq->i915->drm, DRM_UT_DRIVER, + "heartbeat"); if (!rq) { intel_engine_dump(engine, &p, diff --git a/drivers/gpu/drm/i915/gt/intel_reset.c b/drivers/gpu/drm/i915/gt/intel_reset.c index d5ed904f355d..5909d8115eb6 100644 --- a/drivers/gpu/drm/i915/gt/intel_reset.c +++ b/drivers/gpu/drm/i915/gt/intel_reset.c @@ -1015,7 +1015,8 @@ void intel_gt_set_wedged(struct intel_gt *gt) mutex_lock(>->reset.mutex); if (GEM_SHOW_DEBUG()) { - struct drm_printer p = drm_debug_printer(__func__); + struct drm_printer p = drm_dbg_printer(>->i915->drm, + DRM_UT_DRIVER, __func__); struct intel_engine_cs *engine; enum intel_engine_id id; diff --git a/drivers/gpu/drm/i915/gt/intel_workarounds.c b/drivers/gpu/drm/i915/gt/intel_workarounds.c index 9bc0654efdc0..66aea33ed894 100644 --- a/drivers/gpu/drm/i915/gt/intel_workarounds.c +++ b/drivers/gpu/drm/i915/gt/intel_workarounds.c @@ -1230,7 +1230,8 @@ static void __set_mcr_steering(struct i915_wa_list *wal, static void debug_dump_steering(struct intel_gt *gt) { - struct drm_printer p = drm_debug_printer("MCR Steering:"); + struct drm_printer p = drm_dbg_printer(>->i915->drm, DRM_UT_DRIVER, + "MCR Steering:"); if (drm_debug_enabled(DRM_UT_DRIVER)) intel_gt_mcr_report_steering(&p, gt, false); diff --git a/drivers/gpu/drm/i915/gt/selftest_context.c b/drivers/gpu/drm/i915/gt/selftest_context.c index 47070cba7eb1..12eca750f7d0 100644 --- a/drivers/gpu/drm/i915/gt/selftest_context.c +++ b/drivers/gpu/drm/i915/gt/selftest_context.c @@ -285,7 +285,8 @@ static int __live_active_context(struct intel_engine_cs *engine) intel_engine_pm_flush(engine); if (intel_engine_pm_is_awake(engine)) { - struct drm_printer p = drm_debug_printer(__func__); + struct drm_printer p = drm_dbg_printer(&engine->i915->drm, + DRM_UT_DRIVER, __func__); intel_engine_dump(engine, &p, "%s is still awake:%d after idle-barriers\n", diff --git a/drivers/gpu/drm/i915/i915_driver.c b/drivers/gpu/drm/i915/i915_driver.c index 15e58b8ef027..1d99a1fb4093 100644 --- a/drivers/gpu/drm/i915/i915_driver.c +++ b/drivers/gpu/drm/i915/i915_driver.c @@ -681,7 +681,8 @@ i915_print_iommu_status(struct drm_i915_private *i915, struct drm_printer *p) static void i915_welcome_messages(struct drm_i915_private *dev_priv) { if (drm_debug_enabled(DRM_UT_DRIVER)) { - struct drm_printer p = drm_debug_printer("i915 device info:"); + struct drm_printer p = drm_dbg_printer(&dev_priv->drm, DRM_UT_DRIVER, + "device info:"); struct intel_gt *gt; unsigned int i; From patchwork Fri Nov 24 12:44:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 13467616 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E487AC61DF4 for ; Fri, 24 Nov 2023 12:44:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4735810E1E7; Fri, 24 Nov 2023 12:44:51 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id E3DD110E7DC; Fri, 24 Nov 2023 12:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1700829885; x=1732365885; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sdQLJb/HtVjk+S1k83K5iLZTEe3WUoWYSOUvRGpkcYg=; b=B+QqIExspYLfwLfLz6uO6x0wf7O1kp80TSoURPNpjUVm3nM4D2ddaKWO jcE7hhCmEUmDw+j8lkii4Dc1OiioLr4m7jTlseWdh90/Bm+bvRjgXL8ra EUoD6qp60zewn8CgDdSBgmf2EyHslKUavMgoxEIfmbZ590GEAlQi6nEeW eq+6WsCnt78b5AXLtsE1GGYJS84576BuHhwYIF9TGE2PS+ILjYzpR/3d/ IdpHP4phCEqeAPd85MozYsgS+lRP/mQ1HfMiqpm8dav2D5aB4owUfFmZh JD43KGprUeH9Y5k97l6b+u0DDcGAK8i8YfLuvX7NOI6je4Qqww6XMeoxG Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10902"; a="389571282" X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="389571282" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:45 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,224,1695711600"; d="scan'208";a="15621883" Received: from dashah-mobl2.ger.corp.intel.com (HELO localhost) ([10.252.41.230]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2023 04:44:44 -0800 From: Jani Nikula To: dri-devel@lists.freedesktop.org Subject: [PATCH 8/8] drm/i915: use drm_printf() with the drm_err_printer intead of pr_err() Date: Fri, 24 Nov 2023 14:44:02 +0200 Message-Id: <8166948db4535654c1f6cb2ff15cc506f7b6f966.1700829750.git.jani.nikula@intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com, intel-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" There's already a related drm_printer. Use it to preserve the context instead of a separate pr_err(). Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c | 6 +++--- drivers/gpu/drm/i915/selftests/i915_active.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c b/drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c index b4970c1ed572..88fd2ab65f3b 100644 --- a/drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c +++ b/drivers/gpu/drm/i915/gt/selftest_engine_heartbeat.c @@ -124,7 +124,7 @@ static int __live_idle_pulse(struct intel_engine_cs *engine, if (engine_sync_barrier(engine)) { struct drm_printer m = drm_err_printer(&engine->i915->drm, "pulse"); - pr_err("%s: no heartbeat pulse?\n", engine->name); + drm_printf(&m, "%s: no heartbeat pulse?\n", engine->name); intel_engine_dump(engine, &m, "%s", engine->name); err = -ETIME; @@ -138,8 +138,8 @@ static int __live_idle_pulse(struct intel_engine_cs *engine, if (!i915_active_is_idle(&p->active)) { struct drm_printer m = drm_err_printer(&engine->i915->drm, "pulse"); - pr_err("%s: heartbeat pulse did not flush idle tasks\n", - engine->name); + drm_printf(&m, "%s: heartbeat pulse did not flush idle tasks\n", + engine->name); i915_active_print(&p->active, &m); err = -EINVAL; diff --git a/drivers/gpu/drm/i915/selftests/i915_active.c b/drivers/gpu/drm/i915/selftests/i915_active.c index 8886752ade63..0d89d70b9c36 100644 --- a/drivers/gpu/drm/i915/selftests/i915_active.c +++ b/drivers/gpu/drm/i915/selftests/i915_active.c @@ -158,7 +158,7 @@ static int live_active_wait(void *arg) if (!READ_ONCE(active->retired)) { struct drm_printer p = drm_err_printer(&i915->drm, __func__); - pr_err("i915_active not retired after waiting!\n"); + drm_printf(&p, "i915_active not retired after waiting!\n"); i915_active_print(&active->base, &p); err = -EINVAL; @@ -191,7 +191,7 @@ static int live_active_retire(void *arg) if (!READ_ONCE(active->retired)) { struct drm_printer p = drm_err_printer(&i915->drm, __func__); - pr_err("i915_active not retired after flushing!\n"); + drm_printf(&p, "i915_active not retired after flushing!\n"); i915_active_print(&active->base, &p); err = -EINVAL;