From patchwork Thu Feb 29 18:40:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13577556 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 D8DA9C54E49 for ; Thu, 29 Feb 2024 18:40:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2321110E201; Thu, 29 Feb 2024 18:40:56 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="mdChmaUp"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by gabe.freedesktop.org (Postfix) with ESMTPS id 617AF10E59D for ; Thu, 29 Feb 2024 18:40:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709232054; x=1740768054; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lOVQOIy/HuI/FJ6tc8DOQU/IAuiJvMXhhoQ1fuOfwq8=; b=mdChmaUpmE7bbh8ECNGCmqn/T/xlAt+n4RAQlmjHk69mqNf4C6J38yVm rZOhHWJ0RMSmxaBaR235VxTxyPJgzhD1bMzH9EIADKfOded9JN0vWoQEz B4m88cxatmzS7nsiEX65OfLSwAR0Kd1JUbYoV3Nf0Soc7i/2coi9vUX8k podrrsONp3Xv3xNcn2LaVXAKMH8yRIJecBpvSgywCOskrjVQ8t6BdKgyt 3J4dbX7LhsShn1VuO/u28vzLxIt9QOH7B6CD40EkyAhOrAHiRsnKYKYwk eZCwf/C+PnDEiIWJjVjNt/Nis49Sk0wi2ieakHwylvJwiM5nwvyjxl+eB A==; X-IronPort-AV: E=McAfee;i="6600,9927,10999"; a="3585066" X-IronPort-AV: E=Sophos;i="6.06,194,1705392000"; d="scan'208";a="3585066" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Feb 2024 10:40:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10999"; a="827771621" X-IronPort-AV: E=Sophos;i="6.06,194,1705392000"; d="scan'208";a="827771621" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by orsmga001.jf.intel.com with SMTP; 29 Feb 2024 10:40:50 -0800 Received: by stinkbox (sSMTP sendmail emulation); Thu, 29 Feb 2024 20:40:49 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Cc: Rodrigo Vivi , Jani Nikula Subject: [PATCH v2 06/12] drm/i915: Convert intel_dpll_dump_hw_state() to drm_printer Date: Thu, 29 Feb 2024 20:40:49 +0200 Message-ID: <20240229184049.31165-1-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240215164055.30585-7-ville.syrjala@linux.intel.com> References: <20240215164055.30585-7-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Ville Syrjälä Utilize drm_printer in pipe_config_pll_mismatch() to avoid a bit of code duplication. To achieve this we need to plumb the printer all way to the dpll_mgr .dump_hw_state() functions. Those are also used by intel_crtc_state_dump() which needs to be adjusted as well. v2: Convert a few misplaecd drm_dbg_kms() calls (Rodrigo) Drop the redundant drm_debug_enabled() check here instead of later (Jani) Cc: Rodrigo Vivi Cc: Jani Nikula Signed-off-by: Ville Syrjälä Reviewed-by: Jani Nikula --- .../drm/i915/display/intel_crtc_state_dump.c | 5 +- drivers/gpu/drm/i915/display/intel_display.c | 28 +++-- drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 105 ++++++++---------- drivers/gpu/drm/i915/display/intel_dpll_mgr.h | 2 + 4 files changed, 66 insertions(+), 74 deletions(-) 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 4bcf446c75f4..59d2b3d39951 100644 --- a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c +++ b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c @@ -205,9 +205,12 @@ void intel_crtc_state_dump(const struct intel_crtc_state *pipe_config, struct drm_i915_private *i915 = to_i915(crtc->base.dev); const struct intel_plane_state *plane_state; struct intel_plane *plane; + struct drm_printer p; char buf[64]; int i; + p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL); + drm_dbg_kms(&i915->drm, "[CRTC:%d:%s] enable: %s [%s]\n", crtc->base.base.id, crtc->base.name, str_yes_no(pipe_config->hw.enable), context); @@ -356,7 +359,7 @@ void intel_crtc_state_dump(const struct intel_crtc_state *pipe_config, pipe_config->ips_enabled, pipe_config->double_wide, pipe_config->has_drrs); - intel_dpll_dump_hw_state(i915, &pipe_config->dpll_hw_state); + intel_dpll_dump_hw_state(i915, &p, &pipe_config->dpll_hw_state); if (IS_CHERRYVIEW(i915)) drm_dbg_kms(&i915->drm, diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index e5010049d52e..962b640e7c74 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -4927,26 +4927,24 @@ pipe_config_pll_mismatch(bool fastset, const struct intel_dpll_hw_state *b) { struct drm_i915_private *i915 = to_i915(crtc->base.dev); + 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(&i915->drm, - "[CRTC:%d:%s] fastset requirement not met in %s\n", - crtc->base.base.id, crtc->base.name, name); - drm_dbg_kms(&i915->drm, "expected:\n"); - intel_dpll_dump_hw_state(i915, a); - drm_dbg_kms(&i915->drm, "found:\n"); - intel_dpll_dump_hw_state(i915, b); + drm_printf(&p, "[CRTC:%d:%s] fastset requirement not met in %s\n", + crtc->base.base.id, crtc->base.name, name); } else { - drm_err(&i915->drm, "[CRTC:%d:%s] mismatch in %s buffer\n", - crtc->base.base.id, crtc->base.name, name); - drm_err(&i915->drm, "expected:\n"); - intel_dpll_dump_hw_state(i915, a); - drm_err(&i915->drm, "found:\n"); - intel_dpll_dump_hw_state(i915, b); + p = drm_err_printer(&i915->drm, NULL); + + drm_printf(&p, "[CRTC:%d:%s] mismatch in %s\n", + crtc->base.base.id, crtc->base.name, name); } + + drm_printf(&p, "expected:\n"); + intel_dpll_dump_hw_state(i915, &p, a); + drm_printf(&p, "found:\n"); + intel_dpll_dump_hw_state(i915, &p, b); } bool diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c index ff480f171f75..9542e62186e2 100644 --- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c +++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c @@ -107,7 +107,7 @@ struct intel_dpll_mgr { struct intel_crtc *crtc, struct intel_encoder *encoder); void (*update_ref_clks)(struct drm_i915_private *i915); - void (*dump_hw_state)(struct drm_i915_private *i915, + void (*dump_hw_state)(struct drm_printer *p, const struct intel_dpll_hw_state *hw_state); bool (*compare_hw_state)(const struct intel_dpll_hw_state *a, const struct intel_dpll_hw_state *b); @@ -634,16 +634,15 @@ static int ibx_get_dpll(struct intel_atomic_state *state, return 0; } -static void ibx_dump_hw_state(struct drm_i915_private *i915, +static void ibx_dump_hw_state(struct drm_printer *p, const struct intel_dpll_hw_state *hw_state) { - drm_dbg_kms(&i915->drm, - "dpll_hw_state: dpll: 0x%x, dpll_md: 0x%x, " - "fp0: 0x%x, fp1: 0x%x\n", - hw_state->dpll, - hw_state->dpll_md, - hw_state->fp0, - hw_state->fp1); + drm_printf(p, "dpll_hw_state: dpll: 0x%x, dpll_md: 0x%x, " + "fp0: 0x%x, fp1: 0x%x\n", + hw_state->dpll, + hw_state->dpll_md, + hw_state->fp0, + hw_state->fp1); } static bool ibx_compare_hw_state(const struct intel_dpll_hw_state *a, @@ -1225,11 +1224,11 @@ static void hsw_update_dpll_ref_clks(struct drm_i915_private *i915) i915->display.dpll.ref_clks.nssc = 135000; } -static void hsw_dump_hw_state(struct drm_i915_private *i915, +static void hsw_dump_hw_state(struct drm_printer *p, const struct intel_dpll_hw_state *hw_state) { - drm_dbg_kms(&i915->drm, "dpll_hw_state: wrpll: 0x%x spll: 0x%x\n", - hw_state->wrpll, hw_state->spll); + drm_printf(p, "dpll_hw_state: wrpll: 0x%x spll: 0x%x\n", + hw_state->wrpll, hw_state->spll); } static bool hsw_compare_hw_state(const struct intel_dpll_hw_state *a, @@ -1939,14 +1938,11 @@ static void skl_update_dpll_ref_clks(struct drm_i915_private *i915) i915->display.dpll.ref_clks.nssc = i915->display.cdclk.hw.ref; } -static void skl_dump_hw_state(struct drm_i915_private *i915, +static void skl_dump_hw_state(struct drm_printer *p, const struct intel_dpll_hw_state *hw_state) { - drm_dbg_kms(&i915->drm, "dpll_hw_state: " - "ctrl1: 0x%x, cfgcr1: 0x%x, cfgcr2: 0x%x\n", - hw_state->ctrl1, - hw_state->cfgcr1, - hw_state->cfgcr2); + drm_printf(p, "dpll_hw_state: ctrl1: 0x%x, cfgcr1: 0x%x, cfgcr2: 0x%x\n", + hw_state->ctrl1, hw_state->cfgcr1, hw_state->cfgcr2); } static bool skl_compare_hw_state(const struct intel_dpll_hw_state *a, @@ -2402,23 +2398,16 @@ static void bxt_update_dpll_ref_clks(struct drm_i915_private *i915) /* DSI non-SSC ref 19.2MHz */ } -static void bxt_dump_hw_state(struct drm_i915_private *i915, +static void bxt_dump_hw_state(struct drm_printer *p, const struct intel_dpll_hw_state *hw_state) { - drm_dbg_kms(&i915->drm, "dpll_hw_state: ebb0: 0x%x, ebb4: 0x%x," - "pll0: 0x%x, pll1: 0x%x, pll2: 0x%x, pll3: 0x%x, " - "pll6: 0x%x, pll8: 0x%x, pll9: 0x%x, pll10: 0x%x, pcsdw12: 0x%x\n", - hw_state->ebb0, - hw_state->ebb4, - hw_state->pll0, - hw_state->pll1, - hw_state->pll2, - hw_state->pll3, - hw_state->pll6, - hw_state->pll8, - hw_state->pll9, - hw_state->pll10, - hw_state->pcsdw12); + drm_printf(p, "dpll_hw_state: ebb0: 0x%x, ebb4: 0x%x," + "pll0: 0x%x, pll1: 0x%x, pll2: 0x%x, pll3: 0x%x, " + "pll6: 0x%x, pll8: 0x%x, pll9: 0x%x, pll10: 0x%x, pcsdw12: 0x%x\n", + hw_state->ebb0, hw_state->ebb4, + hw_state->pll0, hw_state->pll1, hw_state->pll2, hw_state->pll3, + hw_state->pll6, hw_state->pll8, hw_state->pll9, hw_state->pll10, + hw_state->pcsdw12); } static bool bxt_compare_hw_state(const struct intel_dpll_hw_state *a, @@ -4026,28 +4015,26 @@ static void icl_update_dpll_ref_clks(struct drm_i915_private *i915) i915->display.dpll.ref_clks.nssc = i915->display.cdclk.hw.ref; } -static void icl_dump_hw_state(struct drm_i915_private *i915, +static void icl_dump_hw_state(struct drm_printer *p, const struct intel_dpll_hw_state *hw_state) { - drm_dbg_kms(&i915->drm, - "dpll_hw_state: cfgcr0: 0x%x, cfgcr1: 0x%x, div0: 0x%x, " - "mg_refclkin_ctl: 0x%x, hg_clktop2_coreclkctl1: 0x%x, " - "mg_clktop2_hsclkctl: 0x%x, mg_pll_div0: 0x%x, " - "mg_pll_div2: 0x%x, mg_pll_lf: 0x%x, " - "mg_pll_frac_lock: 0x%x, mg_pll_ssc: 0x%x, " - "mg_pll_bias: 0x%x, mg_pll_tdc_coldst_bias: 0x%x\n", - hw_state->cfgcr0, hw_state->cfgcr1, - hw_state->div0, - hw_state->mg_refclkin_ctl, - hw_state->mg_clktop2_coreclkctl1, - hw_state->mg_clktop2_hsclkctl, - hw_state->mg_pll_div0, - hw_state->mg_pll_div1, - hw_state->mg_pll_lf, - hw_state->mg_pll_frac_lock, - hw_state->mg_pll_ssc, - hw_state->mg_pll_bias, - hw_state->mg_pll_tdc_coldst_bias); + drm_printf(p, "dpll_hw_state: cfgcr0: 0x%x, cfgcr1: 0x%x, div0: 0x%x, " + "mg_refclkin_ctl: 0x%x, hg_clktop2_coreclkctl1: 0x%x, " + "mg_clktop2_hsclkctl: 0x%x, mg_pll_div0: 0x%x, " + "mg_pll_div2: 0x%x, mg_pll_lf: 0x%x, " + "mg_pll_frac_lock: 0x%x, mg_pll_ssc: 0x%x, " + "mg_pll_bias: 0x%x, mg_pll_tdc_coldst_bias: 0x%x\n", + hw_state->cfgcr0, hw_state->cfgcr1, hw_state->div0, + hw_state->mg_refclkin_ctl, + hw_state->mg_clktop2_coreclkctl1, + hw_state->mg_clktop2_hsclkctl, + hw_state->mg_pll_div0, + hw_state->mg_pll_div1, + hw_state->mg_pll_lf, + hw_state->mg_pll_frac_lock, + hw_state->mg_pll_ssc, + hw_state->mg_pll_bias, + hw_state->mg_pll_tdc_coldst_bias); } static bool icl_compare_hw_state(const struct intel_dpll_hw_state *a, @@ -4514,22 +4501,24 @@ void intel_dpll_sanitize_state(struct drm_i915_private *i915) } /** - * intel_dpll_dump_hw_state - write hw_state to dmesg + * intel_dpll_dump_hw_state - dump hw_state * @i915: i915 drm device - * @hw_state: hw state to be written to the log + * @p: where to print the state to + * @hw_state: hw state to be dumped * - * Write the relevant values in @hw_state to dmesg using drm_dbg_kms. + * Dumo out the relevant values in @hw_state. */ void intel_dpll_dump_hw_state(struct drm_i915_private *i915, + struct drm_printer *p, const struct intel_dpll_hw_state *hw_state) { if (i915->display.dpll.mgr) { - i915->display.dpll.mgr->dump_hw_state(i915, hw_state); + i915->display.dpll.mgr->dump_hw_state(p, hw_state); } else { /* fallback for platforms that don't use the shared dpll * infrastructure */ - ibx_dump_hw_state(i915, hw_state); + ibx_dump_hw_state(p, hw_state); } } diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.h b/drivers/gpu/drm/i915/display/intel_dpll_mgr.h index cc0e1386309d..d4d97e40440a 100644 --- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.h +++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.h @@ -36,6 +36,7 @@ enum tc_port; struct drm_i915_private; +struct drm_printer; struct intel_atomic_state; struct intel_crtc; struct intel_crtc_state; @@ -377,6 +378,7 @@ void intel_dpll_readout_hw_state(struct drm_i915_private *i915); void intel_dpll_sanitize_state(struct drm_i915_private *i915); void intel_dpll_dump_hw_state(struct drm_i915_private *i915, + struct drm_printer *p, const struct intel_dpll_hw_state *hw_state); bool intel_dpll_compare_hw_state(struct drm_i915_private *i915, const struct intel_dpll_hw_state *a, From patchwork Thu Feb 29 18:42:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13577557 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 A5DF6C48BF6 for ; Thu, 29 Feb 2024 18:42:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3BE4C10E4A3; Thu, 29 Feb 2024 18:42:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="J07ei62I"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5918210E4A3 for ; Thu, 29 Feb 2024 18:42:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709232131; x=1740768131; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=nu1OSSRGOCHnLGZy+z9C1gBm/oXKzl6QjuGXGTxKs6I=; b=J07ei62ILlccxgPVDBB1NuWeJxZt/DPOT6SRgTq/9verEjxD+FtYHvJe +LoFXsSTGMQgLPGkgHxd6/TjoVLv16l+Q3TR5vAX2021Ce6HlQrqPHHx+ WK3g+uyooL4//hC+ZSqbHrCP2C/zPmlq0/D8LTlht77n0g2jklFNU0pGR sXo9Hsa13MBk+ixcE0C3NqUiRB6ZU2rL7HOwbJXoFmYVGwaOCFdYloSud 58YY8YW450vLuEW5YaQZhknobTz8npxI0efnwnIkXdzI5XlBOOkCCsrM7 SwgxRMo6mzTBoglXNH3EoWO/IsNB2DBQHRhyxG8rodnzkuTgz61MnY06F Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10999"; a="3585249" X-IronPort-AV: E=Sophos;i="6.06,194,1705392000"; d="scan'208";a="3585249" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Feb 2024 10:42:11 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10999"; a="827771624" X-IronPort-AV: E=Sophos;i="6.06,194,1705392000"; d="scan'208";a="827771624" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by orsmga001.jf.intel.com with SMTP; 29 Feb 2024 10:42:08 -0800 Received: by stinkbox (sSMTP sendmail emulation); Thu, 29 Feb 2024 20:42:07 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Cc: Jani Nikula Subject: [PATCH v2 11/12] drm/i915: Reuse pipe_config_mismatch() more Date: Thu, 29 Feb 2024 20:42:07 +0200 Message-ID: <20240229184207.31233-1-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240215164055.30585-12-ville.syrjala@linux.intel.com> References: <20240215164055.30585-12-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Ville Syrjälä Just call pipe_config_mismatch() from all the more specialized mismatch() functions instead of hand rolling the same printfs all over. v2: Eliminate the dpll drm_debug_enabled() in an earlier patch (Jani) Reviewed-by: Jani Nikula Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_display.c | 42 +++++--------------- 1 file changed, 10 insertions(+), 32 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 68522fcfd3e4..4d5ef823c5fe 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -4826,17 +4826,13 @@ pipe_config_infoframe_mismatch(bool fastset, const struct intel_crtc *crtc, p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL); loglevel = KERN_DEBUG; - - drm_printf(&p, "[CRTC:%d:%s] fastset requirement not met in %s infoframe\n", - crtc->base.base.id, crtc->base.name, name); } else { p = drm_err_printer(&i915->drm, NULL); loglevel = KERN_ERR; - - drm_printf(&p, "[CRTC:%d:%s] mismatch in %s infoframe\n", - crtc->base.base.id, crtc->base.name, name); } + pipe_config_mismatch(fastset, crtc, name, "infoframe"); + drm_printf(&p, "expected:\n"); hdmi_infoframe_log(loglevel, i915->drm.dev, a); drm_printf(&p, "found:\n"); @@ -4852,17 +4848,12 @@ pipe_config_dp_vsc_sdp_mismatch(bool fastset, const struct intel_crtc *crtc, struct drm_i915_private *i915 = to_i915(crtc->base.dev); struct drm_printer p; - if (fastset) { + if (fastset) p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL); - - drm_printf(&p, "[CRTC:%d:%s] fastset requirement not met in %s dp sdp\n", - crtc->base.base.id, crtc->base.name, name); - } else { + else p = drm_err_printer(&i915->drm, NULL); - drm_printf(&p, "[CRTC:%d:%s] mismatch in %s dp sdp\n", - crtc->base.base.id, crtc->base.name, name); - } + pipe_config_mismatch(fastset, crtc, name, "dp sdp"); drm_printf(&p, "expected:\n"); drm_dp_vsc_sdp_log(&p, a); @@ -4889,27 +4880,19 @@ pipe_config_buffer_mismatch(bool fastset, const struct intel_crtc *crtc, const char *name, const u8 *a, const u8 *b, size_t len) { - struct drm_i915_private *i915 = to_i915(crtc->base.dev); - struct drm_printer p; const char *loglevel; if (fastset) { if (!drm_debug_enabled(DRM_UT_KMS)) return; - p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL); loglevel = KERN_DEBUG; - - drm_printf(&p, "[CRTC:%d:%s] fastset requirement not met in %s buffer\n", - crtc->base.base.id, crtc->base.name, name); } else { - p = drm_err_printer(&i915->drm, NULL); loglevel = KERN_ERR; - - drm_printf(&p, "[CRTC:%d:%s] mismatch in %s buffer\n", - crtc->base.base.id, crtc->base.name, name); } + pipe_config_mismatch(fastset, crtc, name, "buffer"); + /* only dump up to the last difference */ len = memcmp_diff_len(a, b, len); @@ -4929,17 +4912,12 @@ pipe_config_pll_mismatch(bool fastset, struct drm_i915_private *i915 = to_i915(crtc->base.dev); struct drm_printer p; - if (fastset) { + if (fastset) p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL); - - drm_printf(&p, "[CRTC:%d:%s] fastset requirement not met in %s\n", - crtc->base.base.id, crtc->base.name, name); - } else { + else p = drm_err_printer(&i915->drm, NULL); - drm_printf(&p, "[CRTC:%d:%s] mismatch in %s\n", - crtc->base.base.id, crtc->base.name, name); - } + pipe_config_mismatch(fastset, crtc, name, " "); /* stupid -Werror=format-zero-length */ drm_printf(&p, "expected:\n"); intel_dpll_dump_hw_state(i915, &p, a); From patchwork Thu Feb 29 18:42:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 13577558 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 ADEAEC54E49 for ; Thu, 29 Feb 2024 18:42:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3B68810E123; Thu, 29 Feb 2024 18:42:39 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="mI3KU4wP"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5410510E123 for ; Thu, 29 Feb 2024 18:42:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709232158; x=1740768158; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=O26PvYQNw+0nrTBss+r0uPPyMPRpxjXfihQrN9WsoDM=; b=mI3KU4wPvSANVftJrzCC1ot4M/Q6Y0JKm3wtnvh8AdP+tlUgp1FqTBis MoCstqMvOnMVHTnOpLIhUnFve/XBDMr2lhe33Zttf+tI8tcMWJZIfXzeF yeFwQrajNM7owrK2nBC2w73LdxswVUV+kKfDvl68vmsYrKhACYrQcyPbt eWXfaGbzBLKVklYnJqaaBoSm5b80lqSeSvxJ3utXh9GhPt+RI4+spI9dT 2wZc9n0U68IQASjCg7nbnxqlGTMYN0lmDpzlCb8U4NAypn2O/bmKtvo+c OMtwwGEnk0Aax3TkWmioKW/18ROU2zaFb5lgUIaVZzStV0TNeim0y1J3g A==; X-IronPort-AV: E=McAfee;i="6600,9927,10999"; a="3585313" X-IronPort-AV: E=Sophos;i="6.06,194,1705392000"; d="scan'208";a="3585313" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Feb 2024 10:42:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10999"; a="827771627" X-IronPort-AV: E=Sophos;i="6.06,194,1705392000"; d="scan'208";a="827771627" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.74]) by orsmga001.jf.intel.com with SMTP; 29 Feb 2024 10:42:35 -0800 Received: by stinkbox (sSMTP sendmail emulation); Thu, 29 Feb 2024 20:42:34 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Cc: Jani Nikula Subject: [PATCH v2 12/12] drm/i915: Create the printer only once in intel_pipe_config_compare() Date: Thu, 29 Feb 2024 20:42:34 +0200 Message-ID: <20240229184234.31272-1-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240215164055.30585-13-ville.syrjala@linux.intel.com> References: <20240215164055.30585-13-ville.syrjala@linux.intel.com> MIME-Version: 1.0 X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Ville Syrjälä Create the drm_printer at the start of intel_pipe_config_compare() and pass it on to all the mismatch() functions. v2: Rebase Reviewed-by: Jani Nikula Signed-off-by: Ville Syrjälä --- drivers/gpu/drm/i915/display/intel_display.c | 101 +++++++++---------- 1 file changed, 46 insertions(+), 55 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 4d5ef823c5fe..69c9693dcc8d 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/intel_display.c @@ -4787,11 +4787,11 @@ intel_compare_buffer(const u8 *a, const u8 *b, size_t len) return memcmp(a, b, len) == 0; } -static void __printf(4, 5) -pipe_config_mismatch(bool fastset, const struct intel_crtc *crtc, +static void __printf(5, 6) +pipe_config_mismatch(struct drm_printer *p, bool fastset, + const struct intel_crtc *crtc, const char *name, const char *format, ...) { - struct drm_i915_private *i915 = to_i915(crtc->base.dev); struct va_format vaf; va_list args; @@ -4800,65 +4800,55 @@ pipe_config_mismatch(bool fastset, const struct intel_crtc *crtc, vaf.va = &args; if (fastset) - drm_dbg_kms(&i915->drm, - "[CRTC:%d:%s] fastset requirement not met in %s %pV\n", - crtc->base.base.id, crtc->base.name, name, &vaf); + drm_printf(p, "[CRTC:%d:%s] fastset requirement not met in %s %pV\n", + crtc->base.base.id, crtc->base.name, name, &vaf); else - drm_err(&i915->drm, "[CRTC:%d:%s] mismatch in %s %pV\n", - crtc->base.base.id, crtc->base.name, name, &vaf); + drm_printf(p, "[CRTC:%d:%s] mismatch in %s %pV\n", + crtc->base.base.id, crtc->base.name, name, &vaf); va_end(args); } static void -pipe_config_infoframe_mismatch(bool fastset, const struct intel_crtc *crtc, +pipe_config_infoframe_mismatch(struct drm_printer *p, bool fastset, + const struct intel_crtc *crtc, const char *name, const union hdmi_infoframe *a, const union hdmi_infoframe *b) { struct drm_i915_private *i915 = to_i915(crtc->base.dev); - struct drm_printer p; const char *loglevel; if (fastset) { if (!drm_debug_enabled(DRM_UT_KMS)) return; - p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL); loglevel = KERN_DEBUG; } else { - p = drm_err_printer(&i915->drm, NULL); loglevel = KERN_ERR; } - pipe_config_mismatch(fastset, crtc, name, "infoframe"); + pipe_config_mismatch(p, fastset, crtc, name, "infoframe"); - drm_printf(&p, "expected:\n"); + drm_printf(p, "expected:\n"); hdmi_infoframe_log(loglevel, i915->drm.dev, a); - drm_printf(&p, "found:\n"); + drm_printf(p, "found:\n"); hdmi_infoframe_log(loglevel, i915->drm.dev, b); } static void -pipe_config_dp_vsc_sdp_mismatch(bool fastset, const struct intel_crtc *crtc, +pipe_config_dp_vsc_sdp_mismatch(struct drm_printer *p, bool fastset, + const struct intel_crtc *crtc, const char *name, const struct drm_dp_vsc_sdp *a, const struct drm_dp_vsc_sdp *b) { - struct drm_i915_private *i915 = to_i915(crtc->base.dev); - struct drm_printer p; + pipe_config_mismatch(p, fastset, crtc, name, "dp sdp"); - if (fastset) - p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL); - else - p = drm_err_printer(&i915->drm, NULL); - - pipe_config_mismatch(fastset, crtc, name, "dp sdp"); - - drm_printf(&p, "expected:\n"); - drm_dp_vsc_sdp_log(&p, a); - drm_printf(&p, "found:\n"); - drm_dp_vsc_sdp_log(&p, b); + 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 */ @@ -4876,7 +4866,8 @@ memcmp_diff_len(const u8 *a, const u8 *b, size_t len) } static void -pipe_config_buffer_mismatch(bool fastset, const struct intel_crtc *crtc, +pipe_config_buffer_mismatch(struct drm_printer *p, bool fastset, + const struct intel_crtc *crtc, const char *name, const u8 *a, const u8 *b, size_t len) { @@ -4891,7 +4882,7 @@ pipe_config_buffer_mismatch(bool fastset, const struct intel_crtc *crtc, loglevel = KERN_ERR; } - pipe_config_mismatch(fastset, crtc, name, "buffer"); + pipe_config_mismatch(p, fastset, crtc, name, "buffer"); /* only dump up to the last difference */ len = memcmp_diff_len(a, b, len); @@ -4903,26 +4894,20 @@ pipe_config_buffer_mismatch(bool fastset, const struct intel_crtc *crtc, } static void -pipe_config_pll_mismatch(bool fastset, +pipe_config_pll_mismatch(struct drm_printer *p, bool fastset, const struct intel_crtc *crtc, const char *name, const struct intel_dpll_hw_state *a, const struct intel_dpll_hw_state *b) { struct drm_i915_private *i915 = to_i915(crtc->base.dev); - struct drm_printer p; - if (fastset) - p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL); - else - p = drm_err_printer(&i915->drm, NULL); + pipe_config_mismatch(p, fastset, crtc, name, " "); /* stupid -Werror=format-zero-length */ - pipe_config_mismatch(fastset, crtc, name, " "); /* stupid -Werror=format-zero-length */ - - drm_printf(&p, "expected:\n"); - intel_dpll_dump_hw_state(i915, &p, a); - drm_printf(&p, "found:\n"); - intel_dpll_dump_hw_state(i915, &p, b); + drm_printf(p, "expected:\n"); + intel_dpll_dump_hw_state(i915, p, a); + drm_printf(p, "found:\n"); + intel_dpll_dump_hw_state(i915, p, b); } bool @@ -4932,13 +4917,19 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, { struct drm_i915_private *dev_priv = to_i915(current_config->uapi.crtc->dev); struct intel_crtc *crtc = to_intel_crtc(pipe_config->uapi.crtc); + struct drm_printer p; bool ret = true; + if (fastset) + p = drm_dbg_printer(&dev_priv->drm, DRM_UT_KMS, NULL); + else + p = drm_err_printer(&dev_priv->drm, NULL); + #define PIPE_CONF_CHECK_X(name) do { \ if (current_config->name != pipe_config->name) { \ BUILD_BUG_ON_MSG(__same_type(current_config->name, bool), \ __stringify(name) " is bool"); \ - pipe_config_mismatch(fastset, crtc, __stringify(name), \ + pipe_config_mismatch(&p, fastset, crtc, __stringify(name), \ "(expected 0x%08x, found 0x%08x)", \ current_config->name, \ pipe_config->name); \ @@ -4950,7 +4941,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, if ((current_config->name & (mask)) != (pipe_config->name & (mask))) { \ BUILD_BUG_ON_MSG(__same_type(current_config->name, bool), \ __stringify(name) " is bool"); \ - pipe_config_mismatch(fastset, crtc, __stringify(name), \ + pipe_config_mismatch(&p, fastset, crtc, __stringify(name), \ "(expected 0x%08x, found 0x%08x)", \ current_config->name & (mask), \ pipe_config->name & (mask)); \ @@ -4962,7 +4953,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, if (current_config->name != pipe_config->name) { \ BUILD_BUG_ON_MSG(__same_type(current_config->name, bool), \ __stringify(name) " is bool"); \ - pipe_config_mismatch(fastset, crtc, __stringify(name), \ + pipe_config_mismatch(&p, fastset, crtc, __stringify(name), \ "(expected %i, found %i)", \ current_config->name, \ pipe_config->name); \ @@ -4974,7 +4965,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, if (current_config->name != pipe_config->name) { \ BUILD_BUG_ON_MSG(!__same_type(current_config->name, bool), \ __stringify(name) " is not bool"); \ - pipe_config_mismatch(fastset, crtc, __stringify(name), \ + pipe_config_mismatch(&p, fastset, crtc, __stringify(name), \ "(expected %s, found %s)", \ str_yes_no(current_config->name), \ str_yes_no(pipe_config->name)); \ @@ -4984,7 +4975,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, #define PIPE_CONF_CHECK_P(name) do { \ if (current_config->name != pipe_config->name) { \ - pipe_config_mismatch(fastset, crtc, __stringify(name), \ + pipe_config_mismatch(&p, fastset, crtc, __stringify(name), \ "(expected %p, found %p)", \ current_config->name, \ pipe_config->name); \ @@ -4995,7 +4986,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, #define PIPE_CONF_CHECK_M_N(name) do { \ if (!intel_compare_link_m_n(¤t_config->name, \ &pipe_config->name)) { \ - pipe_config_mismatch(fastset, crtc, __stringify(name), \ + pipe_config_mismatch(&p, fastset, crtc, __stringify(name), \ "(expected tu %i data %i/%i link %i/%i, " \ "found tu %i, data %i/%i link %i/%i)", \ current_config->name.tu, \ @@ -5015,7 +5006,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, #define PIPE_CONF_CHECK_PLL(name) do { \ if (!intel_dpll_compare_hw_state(dev_priv, ¤t_config->name, \ &pipe_config->name)) { \ - pipe_config_pll_mismatch(fastset, crtc, __stringify(name), \ + pipe_config_pll_mismatch(&p, fastset, crtc, __stringify(name), \ ¤t_config->name, \ &pipe_config->name); \ ret = false; \ @@ -5048,7 +5039,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, #define PIPE_CONF_CHECK_FLAGS(name, mask) do { \ if ((current_config->name ^ pipe_config->name) & (mask)) { \ - pipe_config_mismatch(fastset, crtc, __stringify(name), \ + pipe_config_mismatch(&p, fastset, crtc, __stringify(name), \ "(%x) (expected %i, found %i)", \ (mask), \ current_config->name & (mask), \ @@ -5060,7 +5051,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, #define PIPE_CONF_CHECK_INFOFRAME(name) do { \ if (!intel_compare_infoframe(¤t_config->infoframes.name, \ &pipe_config->infoframes.name)) { \ - pipe_config_infoframe_mismatch(fastset, crtc, __stringify(name), \ + pipe_config_infoframe_mismatch(&p, fastset, crtc, __stringify(name), \ ¤t_config->infoframes.name, \ &pipe_config->infoframes.name); \ ret = false; \ @@ -5070,7 +5061,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, #define PIPE_CONF_CHECK_DP_VSC_SDP(name) do { \ if (!intel_compare_dp_vsc_sdp(¤t_config->infoframes.name, \ &pipe_config->infoframes.name)) { \ - pipe_config_dp_vsc_sdp_mismatch(fastset, crtc, __stringify(name), \ + pipe_config_dp_vsc_sdp_mismatch(&p, fastset, crtc, __stringify(name), \ ¤t_config->infoframes.name, \ &pipe_config->infoframes.name); \ ret = false; \ @@ -5081,7 +5072,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, BUILD_BUG_ON(sizeof(current_config->name) != (len)); \ BUILD_BUG_ON(sizeof(pipe_config->name) != (len)); \ if (!intel_compare_buffer(current_config->name, pipe_config->name, (len))) { \ - pipe_config_buffer_mismatch(fastset, crtc, __stringify(name), \ + pipe_config_buffer_mismatch(&p, fastset, crtc, __stringify(name), \ current_config->name, \ pipe_config->name, \ (len)); \ @@ -5094,7 +5085,7 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, !intel_color_lut_equal(current_config, \ current_config->lut, pipe_config->lut, \ is_pre_csc_lut)) { \ - pipe_config_mismatch(fastset, crtc, __stringify(lut), \ + pipe_config_mismatch(&p, fastset, crtc, __stringify(lut), \ "hw_state doesn't match sw_state"); \ ret = false; \ } \