From patchwork Wed Dec 28 16:42:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Vetter X-Patchwork-Id: 9490505 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ABE4460838 for ; Wed, 28 Dec 2016 16:42:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 893FD1FF8F for ; Wed, 28 Dec 2016 16:42:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DE112624D; Wed, 28 Dec 2016 16:42:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B81531FF8F for ; Wed, 28 Dec 2016 16:42:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 50386898C7; Wed, 28 Dec 2016 16:42:21 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-pg0-x242.google.com (mail-pg0-x242.google.com [IPv6:2607:f8b0:400e:c05::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 071E3898AA for ; Wed, 28 Dec 2016 16:42:19 +0000 (UTC) Received: by mail-pg0-x242.google.com with SMTP id g1so16200218pgn.0 for ; Wed, 28 Dec 2016 08:42:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id; bh=04zjZ8tlZdw38Yl19dVCTqVONEN+hpnRnkewtc7+TUI=; b=W3bFD6hN3XFSZU3sphCtH5/2Wy0nx8xtOOnF76iA+AkTMWNnel52qmSiktTcr6zQ+m FhhU7Tc2s8RXjKfbiHXl+O5pYrcXKekcGm5TRCHsxPZsLEUbtKBF9+OGXYHdgvRmk5g3 J1Z8j9EAQPOjMPAoktarNhA94OWqwjQB3aYA8= 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; bh=04zjZ8tlZdw38Yl19dVCTqVONEN+hpnRnkewtc7+TUI=; b=l3/Dtlpo/fBhsy+2TeQw7/N7UD2EAH6Lna/YIYSOgpP76CrYmgQVC+YBbSnrz/6+DL ncwWnVFYENW07uNlCUahrwrVBuINM4aJs3+mAazlCKnbuwmBEaGj1QbCLtIwvSN5Z0Tu FFiHIdnrHTwDOJJy4qb8JPcsNwTlcim+i/AXKUr5WudQdmFm/6u18bbZvvCVnA6kQtGl leU7PNV4ZgNsm7/GzYk9yumId4QgNNwn+fi9ePJYexOhbV1ZCvnHYkhxZH+Da5Cc9/X/ +JaHu3qD7ptC+KdJPxObO3tgbp0iC/xKiX9oF2RyWGRoAM1r8zZ0nf3renScEmQtcr7B 6j9w== X-Gm-Message-State: AIkVDXLbAj9Is4xvkmH0TWlgQKaUbkqRPZRAZCzrCJOKn+6UATW1Gf49ItQL79GiqCHGNw== X-Received: by 10.98.41.3 with SMTP id p3mr35739533pfp.22.1482943338316; Wed, 28 Dec 2016 08:42:18 -0800 (PST) Received: from dvetter-linux.ger.corp.intel.com ([192.55.54.45]) by smtp.gmail.com with ESMTPSA id b71sm98520107pfj.62.2016.12.28.08.42.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Dec 2016 08:42:17 -0800 (PST) From: Daniel Vetter To: DRI Development Date: Wed, 28 Dec 2016 17:42:09 +0100 Message-Id: <1482943330-11592-1-git-send-email-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.7.4 Cc: Daniel Vetter , Intel Graphics Development , Daniel Vetter Subject: [Intel-gfx] [PATCH 1/2] drm/printer: add debug printer X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Useful for dumping lots of data into dmesg, e.g. drm_mm. Cc: Rob Clark Signed-off-by: Daniel Vetter Reviewed-by: Chris Wilson --- drivers/gpu/drm/drm_print.c | 6 ++++++ include/drm/drm_print.h | 20 ++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c index ad3caaa1f48b..a8300cd2d3b3 100644 --- a/drivers/gpu/drm/drm_print.c +++ b/drivers/gpu/drm/drm_print.c @@ -40,6 +40,12 @@ void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf) } EXPORT_SYMBOL(__drm_printfn_info); +void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf) +{ + pr_debug("%s %pV", p->prefix, vaf); +} +EXPORT_SYMBOL(__drm_printfn_info); + /** * drm_printf - print to a &drm_printer stream * @p: the &drm_printer diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h index 1adf84aea622..e9d0ba20089c 100644 --- a/include/drm/drm_print.h +++ b/include/drm/drm_print.h @@ -60,19 +60,20 @@ /** * struct drm_printer - drm output "stream" - * @printfn: actual output fxn - * @arg: output fxn specific data * * Do not use struct members directly. Use drm_printer_seq_file(), * drm_printer_info(), etc to initialize. And drm_printf() for output. */ struct drm_printer { + /* private: */ void (*printfn)(struct drm_printer *p, struct va_format *vaf); void *arg; + const char *prefix; }; void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf); 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_printf(struct drm_printer *p, const char *f, ...); @@ -109,4 +110,19 @@ 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; +} #endif /* DRM_PRINT_H_ */