Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp4788052pxb; Tue, 31 Aug 2021 13:23:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz8X1kW92e0jxTIj3yKTD83vxSqBFGNb/HPeX708qIgnCeF4FVJ2knxXXqsiFhaSHblMbLE X-Received: by 2002:a17:906:9ac5:: with SMTP id ah5mr32547569ejc.224.1630441435992; Tue, 31 Aug 2021 13:23:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630441435; cv=none; d=google.com; s=arc-20160816; b=E6TsvjHtIyJXUQ7buSPYXPXh83xeYrjhqSu81EOy8fB2aD6Dh77zJn2ulB5byhIwcJ yoBgwz0RZ0UdtMPUKg2OG/ql8PM/3nZaUezPt+L47SlNy6i63nq1QdOkwHplVPHKs7us mCyzSa3L3h2NW/jKN0LLlkzsuwPaf5YQ6kJZnyydRUGNCfK+7EEaRt+hL/HT4oGjoIbU 748ChkYTmfNcpYInzH7DCacGGd2b3k5i0ArN8CF01SH58gR9dGOc0furuQtzr3XdWgCk /kR++4BOvOfV7uD9zqt+3iQMwG2ODtXyaQo6VBptIfB1HFAgjMsc5aCuwyEohR9GJCzq Aiug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kuB3RkzY1zFR/gTAbpOQb93W/7QigOgH822eKzxQKfY=; b=hRTwHRLPCftgXZvq1Xhgv+iVe/C4BrvZnDMwcHqcu0UIbHFPGB+iwezCp37r8Tkvz3 oRZfaWUnlMS7CC9zIZiIa5l+I7hZRSN0zR4QIFAkgP+53+rASKHqRm1uuAONGzcYNZKs KCwLAqAfaJ5onx3U7zBCwoslxygG0kQGmQb4gBY234XYorT0DyqsGRQ9T3qbrIogZTtK e8STh1gdhtw+fvBEvAs3b22BELi4zxJT6M43o653/6rGa/tsBBkaQvEexWaU3t6FOJhS C01/NurgcN0VBHOutJCDbDJdtZwVmBSiW6+Krt8UKTOnhcmKzeb06grY7d8gUsRueI9h cGig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZsN6D0QX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i5si10755799ejo.475.2021.08.31.13.23.32; Tue, 31 Aug 2021 13:23:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZsN6D0QX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241121AbhHaUWs (ORCPT + 99 others); Tue, 31 Aug 2021 16:22:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241051AbhHaUWk (ORCPT ); Tue, 31 Aug 2021 16:22:40 -0400 Received: from mail-io1-xd33.google.com (mail-io1-xd33.google.com [IPv6:2607:f8b0:4864:20::d33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34C07C06179A for ; Tue, 31 Aug 2021 13:21:44 -0700 (PDT) Received: by mail-io1-xd33.google.com with SMTP id f6so675568iox.0 for ; Tue, 31 Aug 2021 13:21:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kuB3RkzY1zFR/gTAbpOQb93W/7QigOgH822eKzxQKfY=; b=ZsN6D0QXyvTW7mikr08SMEj8mIyLS3HzG1B7LfVjZ+AkDVPTjZUoAlhwOFZVCd/oK4 w1bddGOp6FqXSajxAksdhWn3nmqoEUwguvW3LEynpAQ5ZVA4XxrFbcQFRy9MGmn59AQT d1i7Y6zg50ac+vZGYYgGa6CykJi0Motn96/0eldHZE8v/rlnBzrZ5xAkjXDHBPqephfX mHl4AsR6hO2SKi5OeZYx8XPjO+cyShKJpEyURD5wv0BkeuszLawRG+b5RXOezyi0S1qg biw66hxtMl1aRJO9q6ZecJGsXmHA7vr2/6eP4GFdLEPzfcCeVycKZDCV0MhViN5WgROy KNIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kuB3RkzY1zFR/gTAbpOQb93W/7QigOgH822eKzxQKfY=; b=Ox8N2Uq4v9abKuHp2r9MFfiLby8PCZrXLDxOATS3nKbxSsJHGxu3vt6ye+1FKHglL0 qOZZaRGkEkTxctD+pVjH3txA8HiCKsSjdq/B+U5GV0Od86RkQwvzVqbCzaZ8/Fypznx3 S/0nrg4n4pR3evfZs1Ya3cePmvAg6pn6JTeuZJQ76K0cvh1NXpqBdufKkJdmHIDsc+lE 3GBHzqSI5o5DI9cw3ByrYJlpHX9jlQaGHZz7+3nW+yUQakA8QNi17Mq3h63uiyd2yeaZ /UQHJ1bxqbHnYd/44rR7+7zidJp/13LdyPgt/2A9d/b/mS7oc94+YAvYdw3NwyfQMHYq Ds7Q== X-Gm-Message-State: AOAM531Xpsk449rnCFZSlqt+GS/1h30VvVsqLujU1kmV7EuCG/AyBivY YNUiJMwEQuEAFNiK1GqQs7Y= X-Received: by 2002:a02:644:: with SMTP id 65mr4532552jav.84.1630441303603; Tue, 31 Aug 2021 13:21:43 -0700 (PDT) Received: from frodo.. (c-24-9-77-57.hsd1.co.comcast.net. [24.9.77.57]) by smtp.googlemail.com with ESMTPSA id u15sm10597384ilk.53.2021.08.31.13.21.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Aug 2021 13:21:43 -0700 (PDT) From: Jim Cromie To: jbaron@akamai.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gvt-dev@lists.freedesktop.org, intel-gfx@lists.freedesktop.org Cc: Jim Cromie Subject: [PATCH v7 4/8] amdgpu: use DEFINE_DYNAMIC_DEBUG_CATEGORIES Date: Tue, 31 Aug 2021 14:21:29 -0600 Message-Id: <20210831202133.2165222-5-jim.cromie@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210831202133.2165222-1-jim.cromie@gmail.com> References: <20210831202133.2165222-1-jim.cromie@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org logger_types.h defines many DC_LOG_*() categorized debug wrappers. Most of these use DRM debug API, so are controllable using drm.debug, but others use bare pr_debug("$prefix: .."), each with a different class-prefix matching "^\[\w+\]:" Use DEFINE_DYNAMIC_DEBUG_CATEGORIES to create a /sys debug_dc parameter, modinfos, and to specify a map from bits -> categorized pr_debugs to be controlled. Signed-off-by: Jim Cromie --- .../gpu/drm/amd/display/dc/core/dc_debug.c | 44 ++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc_debug.c b/drivers/gpu/drm/amd/display/dc/core/dc_debug.c index 21be2a684393..9fd43254db88 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc_debug.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc_debug.c @@ -36,8 +36,50 @@ #include "resource.h" -#define DC_LOGGER_INIT(logger) +#ifdef CONFIG_DRM_USE_DYNAMIC_DEBUG +/* define a drm.debug style dyndbg pr-debug control point */ +#include + +unsigned long __debug_dc; +EXPORT_SYMBOL(__debug_dc); + +#define _help_(key) "\t " key "\t- help for " key "\n" + +/* Id like to do these inside DEFINE_DYNAMIC_DEBUG_CATEGORIES, if possible */ +#define DC_DYNDBG_BITMAP_DESC(name) \ + "Control pr_debugs via /sys/module/amdgpu/parameters/" #name \ + ", where each bit controls a debug category.\n" \ + _help_("[SURFACE]:") \ + _help_("[CURSOR]:") \ + _help_("[PFLIP]:") \ + _help_("[VBLANK]:") \ + _help_("[HW_LINK_TRAINING]:") \ + _help_("[HW_AUDIO]:") \ + _help_("[SCALER]:") \ + _help_("[BIOS]:") \ + _help_("[BANDWIDTH_CALCS]:") \ + _help_("[DML]:") \ + _help_("[IF_TRACE]:") \ + _help_("[GAMMA]:") \ + _help_("[SMU_MSG]:") + +DEFINE_DYNAMIC_DEBUG_CATEGORIES(debug_dc, __debug_dc, + DC_DYNDBG_BITMAP_DESC(debug_dc), + _DD_cat_("[CURSOR]:"), + _DD_cat_("[PFLIP]:"), + _DD_cat_("[VBLANK]:"), + _DD_cat_("[HW_LINK_TRAINING]:"), + _DD_cat_("[HW_AUDIO]:"), + _DD_cat_("[SCALER]:"), + _DD_cat_("[BIOS]:"), + _DD_cat_("[BANDWIDTH_CALCS]:"), + _DD_cat_("[DML]:"), + _DD_cat_("[IF_TRACE]:"), + _DD_cat_("[GAMMA]:"), + _DD_cat_("[SMU_MSG]:")); +#endif +#define DC_LOGGER_INIT(logger) #define SURFACE_TRACE(...) do {\ if (dc->debug.surface_trace) \ -- 2.31.1