Skip to contentSkip to conversation

drm/print: add and use drm_debug_enabled()

PATCH Superseded Jani Nikula 5 participants 19 messages Sep 13, 2019 – Sep 20, 2019

Subsystems (9)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover drm/print: add and use drm_debug_enabled()

Hi all, just a little refactoring around drm_debug access to abstract it better. There shouldn't be any functional changes.

I'd appreciate acks for merging the lot via drm-misc. If there are any objections to that, we'll need to postpone the last patch until everything has been merged and converted in drm-next.

BR,
Jani.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc David (ChunMing) Zhou <[email protected]>
Cc Ben Skeggs <[email protected]>
Cc Rob Clark <[email protected]>
Cc Sean Paul <[email protected]>
Cc Francisco Jerez <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Russell King <[email protected]>
Cc Christian Gmeiner <[email protected]>

Jani Nikula (9):
drm/print: move drm_debug variable to drm_print.[ch] drm/print: add drm_debug_enabled()
drm/etnaviv: use drm_debug_enabled() to check for debug categories drm/i2c/sil164: use drm_debug_enabled() to check for debug categories drm/i915: use drm_debug_enabled() to check for debug categories drm/msm: use drm_debug_enabled() to check for debug categories drm/nouveau: use drm_debug_enabled() to check for debug categories drm/amdgpu: use drm_debug_enabled() to check for debug categories drm/print: rename drm_debug to __drm_debug to discourage use

 drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c   |  4 ++--
 drivers/gpu/drm/drm_atomic_uapi.c            |  2 +-
 drivers/gpu/drm/drm_dp_mst_topology.c        |  6 ++---
 drivers/gpu/drm/drm_drv.c                    | 17 ---------------
 drivers/gpu/drm/drm_edid.c                   |  2 +-
 drivers/gpu/drm/drm_edid_load.c              |  2 +-
 drivers/gpu/drm/drm_mipi_dbi.c               |  4 ++--
 drivers/gpu/drm/drm_print.c                  | 23 ++++++++++++++++++--
 drivers/gpu/drm/drm_vblank.c                 |  6 ++---
 drivers/gpu/drm/etnaviv/etnaviv_buffer.c     |  8 +++----
 drivers/gpu/drm/i2c/sil164_drv.c             |  2 +-
 drivers/gpu/drm/i915/display/intel_display.c |  4 ++--
 drivers/gpu/drm/i915/display/intel_dp.c      |  2 +-
 drivers/gpu/drm/i915/i915_drv.c              |  2 +-
 drivers/gpu/drm/i915/i915_gem.h              |  2 +-
 drivers/gpu/drm/i915/i915_utils.c            |  2 +-
 drivers/gpu/drm/i915/intel_pm.c              |  2 +-
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h      |  4 ++--
 drivers/gpu/drm/nouveau/dispnv50/disp.h      |  4 ++--
 drivers/gpu/drm/nouveau/nouveau_drv.h        |  4 ++--
 include/drm/drm_drv.h                        |  2 --
 include/drm/drm_print.h                      |  8 +++++++
 22 files changed, 60 insertions(+), 52 deletions(-)
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

PATCH 1/9 drm/print: move drm_debug variable to drm_print.[ch]

Move drm_debug variable declaration and definition to where they are relevant and needed. No functional changes.

---
 drivers/gpu/drm/drm_drv.c   | 17 -----------------
 drivers/gpu/drm/drm_print.c | 19 +++++++++++++++++++
 include/drm/drm_drv.h       |  2 --
 include/drm/drm_print.h     |  2 ++
 4 files changed, 21 insertions(+), 19 deletions(-)
drivers/gpu/drm/drm_drv.c +0 -17
index c456c3d3def2..b5b3fffe2299 100644
@@ -46,26 +46,9 @@
 #include "drm_internal.h"
 #include "drm_legacy.h"
 
-/*
- * drm_debug: Enable debug output.
- * Bitmask of DRM_UT_x. See include/drm/drm_print.h for details.
- */
-unsigned int drm_debug = 0;
-EXPORT_SYMBOL(drm_debug);
-
 MODULE_AUTHOR("Gareth Hughes, Leif Delgass, José Fonseca, Jon Smirl");
 MODULE_DESCRIPTION("DRM shared core routines");
 MODULE_LICENSE("GPL and additional rights");
-MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug category.\n"
-"\t\tBit 0 (0x01)  will enable CORE messages (drm core code)\n"
-"\t\tBit 1 (0x02)  will enable DRIVER messages (drm controller code)\n"
-"\t\tBit 2 (0x04)  will enable KMS messages (modesetting code)\n"
-"\t\tBit 3 (0x08)  will enable PRIME messages (prime code)\n"
-"\t\tBit 4 (0x10)  will enable ATOMIC messages (atomic code)\n"
-"\t\tBit 5 (0x20)  will enable VBL messages (vblank code)\n"
-"\t\tBit 7 (0x80)  will enable LEASE messages (leasing code)\n"
-"\t\tBit 8 (0x100) will enable DP messages (displayport code)");
-module_param_named(debug, drm_debug, int, 0600);
 
 static DEFINE_SPINLOCK(drm_minor_lock);
 static struct idr drm_minors_idr;
drivers/gpu/drm/drm_print.c +19 -0
index dfa27367ebb8..c9b57012d412 100644
@@ -28,6 +28,7 @@
 #include <stdarg.h>
 
 #include <linux/io.h>
+#include <linux/moduleparam.h>
 #include <linux/seq_file.h>
 #include <linux/slab.h>
 
@@ -35,6 +36,24 @@
 #include <drm/drm_drv.h>
 #include <drm/drm_print.h>
 
+/*
+ * drm_debug: Enable debug output.
+ * Bitmask of DRM_UT_x. See include/drm/drm_print.h for details.
+ */
+unsigned int drm_debug;
+EXPORT_SYMBOL(drm_debug);
+
+MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug category.\n"
+"\t\tBit 0 (0x01)  will enable CORE messages (drm core code)\n"
+"\t\tBit 1 (0x02)  will enable DRIVER messages (drm controller code)\n"
+"\t\tBit 2 (0x04)  will enable KMS messages (modesetting code)\n"
+"\t\tBit 3 (0x08)  will enable PRIME messages (prime code)\n"
+"\t\tBit 4 (0x10)  will enable ATOMIC messages (atomic code)\n"
+"\t\tBit 5 (0x20)  will enable VBL messages (vblank code)\n"
+"\t\tBit 7 (0x80)  will enable LEASE messages (leasing code)\n"
+"\t\tBit 8 (0x100) will enable DP messages (displayport code)");
+module_param_named(debug, drm_debug, int, 0600);
+
 void __drm_puts_coredump(struct drm_printer *p, const char *str)
 {
 	struct drm_print_iterator *iterator = p->arg;
include/drm/drm_drv.h +0 -2
index 8976afe48c1c..cf13470810a5 100644
@@ -778,8 +778,6 @@ struct drm_driver {
 	int dev_priv_size;
 };
 
-extern unsigned int drm_debug;
-
 int drm_dev_init(struct drm_device *dev,
 		 struct drm_driver *driver,
 		 struct device *parent);
include/drm/drm_print.h +2 -0
index 12d4916254b4..e5c421abce48 100644
@@ -34,6 +34,8 @@
 
 #include <drm/drm.h>
 
+extern unsigned int drm_debug;
+
 /**
  * DOC: print
  *
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw

PATCH 2/9 drm/print: add drm_debug_enabled()

In reply to Jani Nikula

Add helper to check if a drm debug category is enabled. Convert drm core to use it. No functional changes.

---
 drivers/gpu/drm/drm_atomic_uapi.c     | 2 +-
 drivers/gpu/drm/drm_dp_mst_topology.c | 6 +++---
 drivers/gpu/drm/drm_edid.c            | 2 +-
 drivers/gpu/drm/drm_edid_load.c       | 2 +-
 drivers/gpu/drm/drm_mipi_dbi.c        | 4 ++--
 drivers/gpu/drm/drm_print.c           | 4 ++--
 drivers/gpu/drm/drm_vblank.c          | 6 +++---
 include/drm/drm_print.h               | 5 +++++
 8 files changed, 18 insertions(+), 13 deletions(-)
drivers/gpu/drm/drm_atomic_uapi.c +1 -1
index 5a5b42db6f2a..6576cd997cbd 100644
@@ -1406,7 +1406,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
 	} else if (arg->flags & DRM_MODE_ATOMIC_NONBLOCK) {
 		ret = drm_atomic_nonblocking_commit(state);
 	} else {
-		if (unlikely(drm_debug & DRM_UT_STATE))
+		if (unlikely(drm_debug_enabled(DRM_UT_STATE)))
 			drm_atomic_print_state(state);
 
 		ret = drm_atomic_commit(state);
drivers/gpu/drm/drm_dp_mst_topology.c +3 -3
index 97216099a718..f47c5b6b51f7 100644
@@ -1180,7 +1180,7 @@ static int drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
 		}
 	}
 out:
-	if (unlikely(ret == -EIO && drm_debug & DRM_UT_DP)) {
+	if (unlikely(ret == -EIO && drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
@@ -2321,7 +2321,7 @@ static int process_single_tx_qlock(struct drm_dp_mst_topology_mgr *mgr,
 	idx += tosend + 1;
 
 	ret = drm_dp_send_sideband_msg(mgr, up, chunk, idx);
-	if (unlikely(ret && drm_debug & DRM_UT_DP)) {
+	if (unlikely(ret && drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_printf(&p, "sideband msg failed to send\n");
@@ -2388,7 +2388,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,
 	mutex_lock(&mgr->qlock);
 	list_add_tail(&txmsg->next, &mgr->tx_msg_downq);
 
-	if (unlikely(drm_debug & DRM_UT_DP)) {
+	if (unlikely(drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
drivers/gpu/drm/drm_edid.c +1 -1
index 12c783f4d956..58dad4d24cd4 100644
@@ -1551,7 +1551,7 @@ static void connector_bad_edid(struct drm_connector *connector,
 {
 	int i;
 
-	if (connector->bad_edid_counter++ && !(drm_debug & DRM_UT_KMS))
+	if (connector->bad_edid_counter++ && !drm_debug_enabled(DRM_UT_KMS))
 		return;
 
 	dev_warn(connector->dev->dev,
drivers/gpu/drm/drm_edid_load.c +1 -1
index d38b3b255926..37d8ba3ddb46 100644
@@ -175,7 +175,7 @@ static void *edid_load(struct drm_connector *connector, const char *name,
 	u8 *edid;
 	int fwsize, builtin;
 	int i, valid_extensions = 0;
-	bool print_bad_edid = !connector->bad_edid_counter || (drm_debug & DRM_UT_KMS);
+	bool print_bad_edid = !connector->bad_edid_counter || drm_debug_enabled(DRM_UT_KMS);
 
 	builtin = match_string(generic_edid_name, GENERIC_EDIDS, name);
 	if (builtin >= 0) {
drivers/gpu/drm/drm_mipi_dbi.c +2 -2
index f8154316a3b0..ccfb5b33c5e3 100644
@@ -783,7 +783,7 @@ static int mipi_dbi_spi1e_transfer(struct mipi_dbi *dbi, int dc,
 	int i, ret;
 	u8 *dst;
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		pr_debug("[drm:%s] dc=%d, max_chunk=%zu, transfers:\n",
 			 __func__, dc, max_chunk);
 
@@ -907,7 +907,7 @@ static int mipi_dbi_spi1_transfer(struct mipi_dbi *dbi, int dc,
 	max_chunk = dbi->tx_buf9_len;
 	dst16 = dbi->tx_buf9;
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		pr_debug("[drm:%s] dc=%d, max_chunk=%zu, transfers:\n",
 			 __func__, dc, max_chunk);
 
drivers/gpu/drm/drm_print.c +2 -2
index c9b57012d412..a7c89ec5ff26 100644
@@ -264,7 +264,7 @@ void drm_dev_dbg(const struct device *dev, unsigned int category,
 	struct va_format vaf;
 	va_list args;
 
-	if (!(drm_debug & category))
+	if (!drm_debug_enabled(category))
 		return;
 
 	va_start(args, format);
@@ -287,7 +287,7 @@ void drm_dbg(unsigned int category, const char *format, ...)
 	struct va_format vaf;
 	va_list args;
 
-	if (!(drm_debug & category))
+	if (!drm_debug_enabled(category))
 		return;
 
 	va_start(args, format);
drivers/gpu/drm/drm_vblank.c +3 -3
index 9c6899758bc9..4f7962b6427b 100644
@@ -332,7 +332,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
 	u64 vblank;
 	unsigned long flags;
 
-	WARN_ONCE(drm_debug & DRM_UT_VBL && !dev->driver->get_vblank_timestamp,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !dev->driver->get_vblank_timestamp,
 		  "This function requires support for accurate vblank timestamps.");
 
 	spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -706,7 +706,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	 */
 	*vblank_time = ktime_sub_ns(etime, delta_ns);
 
-	if ((drm_debug & DRM_UT_VBL) == 0)
+	if (!drm_debug_enabled(DRM_UT_VBL))
 		return true;
 
 	ts_etime = ktime_to_timespec64(etime);
@@ -1352,7 +1352,7 @@ void drm_vblank_restore(struct drm_device *dev, unsigned int pipe)
 	assert_spin_locked(&dev->vblank_time_lock);
 
 	vblank = &dev->vblank[pipe];
-	WARN_ONCE((drm_debug & DRM_UT_VBL) && !vblank->framedur_ns,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !vblank->framedur_ns,
 		  "Cannot compute missed vblanks without frame duration\n");
 	framedur_ns = vblank->framedur_ns;
 
include/drm/drm_print.h +5 -0
index e5c421abce48..e13f901312a4 100644
@@ -294,6 +294,11 @@ static inline struct drm_printer drm_err_printer(const char *prefix)
 #define DRM_UT_LEASE		0x80
 #define DRM_UT_DP		0x100
 
+static inline bool drm_debug_enabled(unsigned int category)
+{
+	return drm_debug & category;
+}
+
 __printf(3, 4)
 void drm_dev_printk(const struct device *dev, const char *level,
 		    const char *format, ...);
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw

PATCH 3/9 drm/etnaviv: use drm_debug_enabled() to check for debug categories

In reply to Jani Nikula

Allow better abstraction of the drm_debug global variable in the future. No functional changes.

Cc Lucas Stach <[email protected]>
Cc Russell King <[email protected]>
Cc Christian Gmeiner <[email protected]>
---
 drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_buffer.c +4 -4
index 7e4e2959bf4f..32d9fac587f9 100644
@@ -326,7 +326,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
 
 	lockdep_assert_held(&gpu->lock);
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		etnaviv_buffer_dump(gpu, buffer, 0, 0x50);
 
 	link_target = etnaviv_cmdbuf_get_va(cmdbuf,
@@ -459,13 +459,13 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
 		 etnaviv_cmdbuf_get_va(buffer, &gpu->mmu_context->cmdbuf_mapping)
 		 + buffer->user_size - 4);
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		pr_info("stream link to 0x%08x @ 0x%08x %p\n",
 			return_target,
 			etnaviv_cmdbuf_get_va(cmdbuf, &gpu->mmu_context->cmdbuf_mapping),
 			cmdbuf->vaddr);
 
-	if (drm_debug & DRM_UT_DRIVER) {
+	if (drm_debug_enabled(DRM_UT_DRIVER)) {
 		print_hex_dump(KERN_INFO, "cmd ", DUMP_PREFIX_OFFSET, 16, 4,
 			       cmdbuf->vaddr, cmdbuf->size, 0);
 
@@ -484,6 +484,6 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
 				    VIV_FE_LINK_HEADER_PREFETCH(link_dwords),
 				    link_target);
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		etnaviv_buffer_dump(gpu, buffer, 0, 0x50);
 }
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#10 lore raw

PATCH 4/9 drm/i2c/sil164: use drm_debug_enabled() to check for debug categories

In reply to Jani Nikula

Allow better abstraction of the drm_debug global variable in the future. No functional changes.

Cc Francisco Jerez <[email protected]>
---
 drivers/gpu/drm/i2c/sil164_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i2c/sil164_drv.c +1 -1
index 8bcf0d199145..a839f78a4c8a 100644
@@ -44,7 +44,7 @@ struct sil164_priv {
 	((struct sil164_priv *)to_encoder_slave(x)->slave_priv)
 
 #define sil164_dbg(client, format, ...) do {				\
-		if (drm_debug & DRM_UT_KMS)				\
+		if (drm_debug_enabled(DRM_UT_KMS))			\
 			dev_printk(KERN_DEBUG, &client->dev,		\
 				   "%s: " format, __func__, ## __VA_ARGS__); \
 	} while (0)
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw

PATCH 5/9 drm/i915: use drm_debug_enabled() to check for debug categories

In reply to Jani Nikula

Allow better abstraction of the drm_debug global variable in the future. No functional changes.

---
 drivers/gpu/drm/i915/display/intel_display.c | 4 ++--
 drivers/gpu/drm/i915/display/intel_dp.c      | 2 +-
 drivers/gpu/drm/i915/i915_drv.c              | 2 +-
 drivers/gpu/drm/i915/i915_gem.h              | 2 +-
 drivers/gpu/drm/i915/i915_utils.c            | 2 +-
 drivers/gpu/drm/i915/intel_pm.c              | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +2 -2
index a19f8c73f2e0..b0f688152bd9 100644
@@ -11956,7 +11956,7 @@ static void
 intel_dump_infoframe(struct drm_i915_private *dev_priv,
 		     const union hdmi_infoframe *frame)
 {
-	if ((drm_debug & DRM_UT_KMS) == 0)
+	if (!drm_debug_enabled(DRM_UT_KMS))
 		return;
 
 	hdmi_infoframe_log(KERN_DEBUG, dev_priv->drm.dev, frame);
@@ -12472,7 +12472,7 @@ pipe_config_infoframe_mismatch(struct drm_i915_private *dev_priv,
 			       const union hdmi_infoframe *b)
 {
 	if (fastset) {
-		if ((drm_debug & DRM_UT_KMS) == 0)
+		if (!drm_debug_enabled(DRM_UT_KMS))
 			return;
 
 		drm_dbg(DRM_UT_KMS, "fastset mismatch in %s infoframe", name);
drivers/gpu/drm/i915/display/intel_dp.c +1 -1
index d09133a958e1..1281d52b0670 100644
@@ -1685,7 +1685,7 @@ static void intel_dp_print_rates(struct intel_dp *intel_dp)
 {
 	char str[128]; /* FIXME: too big for stack? */
 
-	if ((drm_debug & DRM_UT_KMS) == 0)
+	if (!drm_debug_enabled(DRM_UT_KMS))
 		return;
 
 	snprintf_int_array(str, sizeof(str),
drivers/gpu/drm/i915/i915_drv.c +1 -1
index 0dfcb40f3162..46ed265d5e79 100644
@@ -1442,7 +1442,7 @@ static void i915_driver_unregister(struct drm_i915_private *dev_priv)
 
 static void i915_welcome_messages(struct drm_i915_private *dev_priv)
 {
-	if (drm_debug & DRM_UT_DRIVER) {
+	if (drm_debug_enabled(DRM_UT_DRIVER)) {
 		struct drm_printer p = drm_debug_printer("i915 device info:");
 
 		drm_printf(&p, "pciid=0x%04x rev=0x%02x platform=%s (subplatform=0x%x) gen=%i\n",
drivers/gpu/drm/i915/i915_gem.h +1 -1
index 167a7b56ed5b..a49b39e896b7 100644
@@ -34,7 +34,7 @@ struct drm_i915_private;
 
 #ifdef CONFIG_DRM_I915_DEBUG_GEM
 
-#define GEM_SHOW_DEBUG() (drm_debug & DRM_UT_DRIVER)
+#define GEM_SHOW_DEBUG() drm_debug_enabled(DRM_UT_DRIVER)
 
 #define GEM_BUG_ON(condition) do { if (unlikely((condition))) {	\
 		pr_err("%s:%d GEM_BUG_ON(%s)\n", \
drivers/gpu/drm/i915/i915_utils.c +1 -1
index 16acdf7bdbe6..f66540e15793 100644
@@ -23,7 +23,7 @@ __i915_printk(struct drm_i915_private *dev_priv, const char *level,
 	struct va_format vaf;
 	va_list args;
 
-	if (is_debug && !(drm_debug & DRM_UT_DRIVER))
+	if (is_debug && !drm_debug_enabled(DRM_UT_DRIVER))
 		return;
 
 	va_start(args, fmt);
drivers/gpu/drm/i915/intel_pm.c +1 -1
index d0ceb272551f..d173d2aa17fe 100644
@@ -5343,7 +5343,7 @@ skl_print_wm_changes(struct intel_atomic_state *state)
 	struct intel_crtc *crtc;
 	int i;
 
-	if ((drm_debug & DRM_UT_KMS) == 0)
+	if (!drm_debug_enabled(DRM_UT_KMS))
 		return;
 
 	for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#12 lore raw

PATCH 6/9 drm/msm: use drm_debug_enabled() to check for debug categories

In reply to Jani Nikula

Allow better abstraction of the drm_debug global variable in the future. No functional changes.

---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +2 -2
index 9e40f559c51f..00e3353f9aad 100644
@@ -29,7 +29,7 @@
  */
 #define DPU_DEBUG(fmt, ...)                                                \
 	do {                                                               \
-		if (unlikely(drm_debug & DRM_UT_KMS))                      \
+		if (unlikely(drm_debug_enabled(DRM_UT_KMS)))               \
 			DRM_DEBUG(fmt, ##__VA_ARGS__); \
 		else                                                       \
 			pr_debug(fmt, ##__VA_ARGS__);                      \
@@ -41,7 +41,7 @@
  */
 #define DPU_DEBUG_DRIVER(fmt, ...)                                         \
 	do {                                                               \
-		if (unlikely(drm_debug & DRM_UT_DRIVER))                   \
+		if (unlikely(drm_debug_enabled(DRM_UT_DRIVER)))            \
 			DRM_ERROR(fmt, ##__VA_ARGS__); \
 		else                                                       \
 			pr_debug(fmt, ##__VA_ARGS__);                      \
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#14 lore raw

PATCH 7/9 drm/nouveau: use drm_debug_enabled() to check for debug categories

In reply to Jani Nikula

Allow better abstraction of the drm_debug global variable in the future. No functional changes.

---
 drivers/gpu/drm/nouveau/dispnv50/disp.h | 4 ++--
 drivers/gpu/drm/nouveau/nouveau_drv.h   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/nouveau/dispnv50/disp.h +2 -2
index 7c41b0599d1a..c0a79531b087 100644
@@ -78,14 +78,14 @@ void evo_kick(u32 *, struct nv50_dmac *);
 
 #define evo_mthd(p, m, s) do {						\
 	const u32 _m = (m), _s = (s);					\
-	if (drm_debug & DRM_UT_KMS)					\
+	if (drm_debug_enabled(DRM_UT_KMS))				\
 		pr_err("%04x %d %s\n", _m, _s, __func__);		\
 	*((p)++) = ((_s << 18) | _m);					\
 } while(0)
 
 #define evo_data(p, d) do {						\
 	const u32 _d = (d);						\
-	if (drm_debug & DRM_UT_KMS)					\
+	if (drm_debug_enabled(DRM_UT_KMS))				\
 		pr_err("\t%08x\n", _d);					\
 	*((p)++) = _d;							\
 } while(0)
drivers/gpu/drm/nouveau/nouveau_drv.h +2 -2
index 70f34cacc552..16283d1e51aa 100644
@@ -248,11 +248,11 @@ void nouveau_drm_device_remove(struct drm_device *dev);
 #define NV_INFO(drm,f,a...) NV_PRINTK(info, &(drm)->client, f, ##a)
 
 #define NV_DEBUG(drm,f,a...) do {                                              \
-	if (unlikely(drm_debug & DRM_UT_DRIVER))                               \
+	if (unlikely(drm_debug_enabled(DRM_UT_DRIVER)))                        \
 		NV_PRINTK(info, &(drm)->client, f, ##a);                       \
 } while(0)
 #define NV_ATOMIC(drm,f,a...) do {                                             \
-	if (unlikely(drm_debug & DRM_UT_ATOMIC))                               \
+	if (unlikely(drm_debug_enabled(DRM_UT_ATOMIC)))                        \
 		NV_PRINTK(info, &(drm)->client, f, ##a);                       \
 } while(0)
 
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#15 lore raw

PATCH 8/9 drm/amdgpu: use drm_debug_enabled() to check for debug categories

In reply to Jani Nikula

Allow better abstraction of the drm_debug global variable in the future. No functional changes.

Cc Alex Deucher <[email protected]>
Cc Christian König <[email protected]>
Cc David (ChunMing) Zhou <[email protected]>
---
 drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c +2 -2
index 4a5951036927..5f17bd4899e2 100644
@@ -234,7 +234,7 @@ static uint32_t smu_v11_0_i2c_transmit(struct i2c_adapter *control,
 	DRM_DEBUG_DRIVER("I2C_Transmit(), address = %x, bytes = %d , data: ",
 		 (uint16_t)address, numbytes);
 
-	if (drm_debug & DRM_UT_DRIVER) {
+	if (drm_debug_enabled(DRM_UT_DRIVER)) {
 		print_hex_dump(KERN_INFO, "data: ", DUMP_PREFIX_NONE,
 			       16, 1, data, numbytes, false);
 	}
@@ -388,7 +388,7 @@ static uint32_t smu_v11_0_i2c_receive(struct i2c_adapter *control,
 	DRM_DEBUG_DRIVER("I2C_Receive(), address = %x, bytes = %d, data :",
 		  (uint16_t)address, bytes_received);
 
-	if (drm_debug & DRM_UT_DRIVER) {
+	if (drm_debug_enabled(DRM_UT_DRIVER)) {
 		print_hex_dump(KERN_INFO, "data: ", DUMP_PREFIX_NONE,
 			       16, 1, data, bytes_received, false);
 	}
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#16 lore raw

PATCH 9/9 drm/print: rename drm_debug to __drm_debug to discourage use

In reply to Jani Nikula

drm_debug_enabled() is the way to check. __drm_debug is now reserved for drm print code only. No functional changes.

---
 drivers/gpu/drm/drm_print.c | 8 ++++----
 include/drm/drm_print.h     | 5 +++--
 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/gpu/drm/drm_print.c +4 -4
index a7c89ec5ff26..ca3c56b026f0 100644
@@ -37,11 +37,11 @@
 #include <drm/drm_print.h>
 
 /*
- * drm_debug: Enable debug output.
+ * __drm_debug: Enable debug output.
  * Bitmask of DRM_UT_x. See include/drm/drm_print.h for details.
  */
-unsigned int drm_debug;
-EXPORT_SYMBOL(drm_debug);
+unsigned int __drm_debug;
+EXPORT_SYMBOL(__drm_debug);
 
 MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug category.\n"
 "\t\tBit 0 (0x01)  will enable CORE messages (drm core code)\n"
@@ -52,7 +52,7 @@ MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug cat
 "\t\tBit 5 (0x20)  will enable VBL messages (vblank code)\n"
 "\t\tBit 7 (0x80)  will enable LEASE messages (leasing code)\n"
 "\t\tBit 8 (0x100) will enable DP messages (displayport code)");
-module_param_named(debug, drm_debug, int, 0600);
+module_param_named(debug, __drm_debug, int, 0600);
 
 void __drm_puts_coredump(struct drm_printer *p, const char *str)
 {
include/drm/drm_print.h +3 -2
index e13f901312a4..880bc0d1fd48 100644
@@ -34,7 +34,8 @@
 
 #include <drm/drm.h>
 
-extern unsigned int drm_debug;
+/* Do *not* use outside of drm_print.[ch]! */
+extern unsigned int __drm_debug;
 
 /**
  * DOC: print
@@ -296,7 +297,7 @@ static inline struct drm_printer drm_err_printer(const char *prefix)
 
 static inline bool drm_debug_enabled(unsigned int category)
 {
-	return drm_debug & category;
+	return __drm_debug & category;
 }
 
 __printf(3, 4)
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw

Re: [PATCH 2/9] drm/print: add drm_debug_enabled()

In reply to Jani Nikula
Quoted 165 lines · Jani Nikula

Add helper to check if a drm debug category is enabled. Convert drm core to use it. No functional changes.

---
 drivers/gpu/drm/drm_atomic_uapi.c     | 2 +-
 drivers/gpu/drm/drm_dp_mst_topology.c | 6 +++---
 drivers/gpu/drm/drm_edid.c            | 2 +-
 drivers/gpu/drm/drm_edid_load.c       | 2 +-
 drivers/gpu/drm/drm_mipi_dbi.c        | 4 ++--
 drivers/gpu/drm/drm_print.c           | 4 ++--
 drivers/gpu/drm/drm_vblank.c          | 6 +++---
 include/drm/drm_print.h               | 5 +++++
 8 files changed, 18 insertions(+), 13 deletions(-)
drivers/gpu/drm/drm_atomic_uapi.c +1 -1
index 5a5b42db6f2a..6576cd997cbd 100644
@@ -1406,7 +1406,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
 	} else if (arg->flags & DRM_MODE_ATOMIC_NONBLOCK) {
 		ret = drm_atomic_nonblocking_commit(state);
 	} else {
-		if (unlikely(drm_debug & DRM_UT_STATE))
+		if (unlikely(drm_debug_enabled(DRM_UT_STATE)))
 			drm_atomic_print_state(state);
 
 		ret = drm_atomic_commit(state);
drivers/gpu/drm/drm_dp_mst_topology.c +3 -3
index 97216099a718..f47c5b6b51f7 100644
@@ -1180,7 +1180,7 @@ static int drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
 		}
 	}
 out:
-	if (unlikely(ret == -EIO && drm_debug & DRM_UT_DP)) {
+	if (unlikely(ret == -EIO && drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
@@ -2321,7 +2321,7 @@ static int process_single_tx_qlock(struct drm_dp_mst_topology_mgr *mgr,
 	idx += tosend + 1;
 
 	ret = drm_dp_send_sideband_msg(mgr, up, chunk, idx);
-	if (unlikely(ret && drm_debug & DRM_UT_DP)) {
+	if (unlikely(ret && drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_printf(&p, "sideband msg failed to send\n");
@@ -2388,7 +2388,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,
 	mutex_lock(&mgr->qlock);
 	list_add_tail(&txmsg->next, &mgr->tx_msg_downq);
 
-	if (unlikely(drm_debug & DRM_UT_DP)) {
+	if (unlikely(drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
drivers/gpu/drm/drm_edid.c +1 -1
index 12c783f4d956..58dad4d24cd4 100644
@@ -1551,7 +1551,7 @@ static void connector_bad_edid(struct drm_connector *connector,
 {
 	int i;
 
-	if (connector->bad_edid_counter++ && !(drm_debug & DRM_UT_KMS))
+	if (connector->bad_edid_counter++ && !drm_debug_enabled(DRM_UT_KMS))
 		return;
 
 	dev_warn(connector->dev->dev,
drivers/gpu/drm/drm_edid_load.c +1 -1
index d38b3b255926..37d8ba3ddb46 100644
@@ -175,7 +175,7 @@ static void *edid_load(struct drm_connector *connector, const char *name,
 	u8 *edid;
 	int fwsize, builtin;
 	int i, valid_extensions = 0;
-	bool print_bad_edid = !connector->bad_edid_counter || (drm_debug & DRM_UT_KMS);
+	bool print_bad_edid = !connector->bad_edid_counter || drm_debug_enabled(DRM_UT_KMS);
 
 	builtin = match_string(generic_edid_name, GENERIC_EDIDS, name);
 	if (builtin >= 0) {
drivers/gpu/drm/drm_mipi_dbi.c +2 -2
index f8154316a3b0..ccfb5b33c5e3 100644
@@ -783,7 +783,7 @@ static int mipi_dbi_spi1e_transfer(struct mipi_dbi *dbi, int dc,
 	int i, ret;
 	u8 *dst;
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		pr_debug("[drm:%s] dc=%d, max_chunk=%zu, transfers:\n",
 			 __func__, dc, max_chunk);
 
@@ -907,7 +907,7 @@ static int mipi_dbi_spi1_transfer(struct mipi_dbi *dbi, int dc,
 	max_chunk = dbi->tx_buf9_len;
 	dst16 = dbi->tx_buf9;
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		pr_debug("[drm:%s] dc=%d, max_chunk=%zu, transfers:\n",
 			 __func__, dc, max_chunk);
 
drivers/gpu/drm/drm_print.c +2 -2
index c9b57012d412..a7c89ec5ff26 100644
@@ -264,7 +264,7 @@ void drm_dev_dbg(const struct device *dev, unsigned int category,
 	struct va_format vaf;
 	va_list args;
 
-	if (!(drm_debug & category))
+	if (!drm_debug_enabled(category))
 		return;
 
 	va_start(args, format);
@@ -287,7 +287,7 @@ void drm_dbg(unsigned int category, const char *format, ...)
 	struct va_format vaf;
 	va_list args;
 
-	if (!(drm_debug & category))
+	if (!drm_debug_enabled(category))
 		return;
 
 	va_start(args, format);
drivers/gpu/drm/drm_vblank.c +3 -3
index 9c6899758bc9..4f7962b6427b 100644
@@ -332,7 +332,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
 	u64 vblank;
 	unsigned long flags;
 
-	WARN_ONCE(drm_debug & DRM_UT_VBL && !dev->driver->get_vblank_timestamp,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !dev->driver->get_vblank_timestamp,
 		  "This function requires support for accurate vblank timestamps.");
 
 	spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -706,7 +706,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	 */
 	*vblank_time = ktime_sub_ns(etime, delta_ns);
 
-	if ((drm_debug & DRM_UT_VBL) == 0)
+	if (!drm_debug_enabled(DRM_UT_VBL))
 		return true;
 
 	ts_etime = ktime_to_timespec64(etime);
@@ -1352,7 +1352,7 @@ void drm_vblank_restore(struct drm_device *dev, unsigned int pipe)
 	assert_spin_locked(&dev->vblank_time_lock);
 
 	vblank = &dev->vblank[pipe];
-	WARN_ONCE((drm_debug & DRM_UT_VBL) && !vblank->framedur_ns,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !vblank->framedur_ns,
 		  "Cannot compute missed vblanks without frame duration\n");
 	framedur_ns = vblank->framedur_ns;
 
include/drm/drm_print.h +0 -0
index e5c421abce48..e13f901312a4 100644

include/drm/drm_print.h static inline struct drm_printer drm_err_printer(const char *prefix) · line 299

Quoted 6 lines
include/drm/drm_print.h +3 -0
@@ -294,6 +294,11 @@ static inline struct drm_printer drm_err_printer(const char *prefix)
 #define DRM_UT_LEASE		0x80
 #define DRM_UT_DP		0x100
 
+static inline bool drm_debug_enabled(unsigned int category)
+{
+	return drm_debug & category;

Worth making that return unlikely(drm_debug & category); to make sure the preloaded path is always to skip the debug stuff?

Quoted 12 lines
include/drm/drm_print.h +2 -0
+}
+
 __printf(3, 4)
 void drm_dev_printk(const struct device *dev, const char *level,
 		    const char *format, ...);
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer Acked-by on v1 3/9
#9 lore raw

Re: [PATCH 3/9] drm/etnaviv: use drm_debug_enabled() to check for debug categories

In reply to Jani Nikula
Quoted 8 lines · Jani Nikula

Allow better abstraction of the drm_debug global variable in the future. No functional changes.

Cc Lucas Stach <[email protected]>
Cc Russell King <[email protected]>
Cc Christian Gmeiner <[email protected]>
Quoted 34 lines
---
 drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_buffer.c +3 -3
index 7e4e2959bf4f..32d9fac587f9 100644
@@ -326,7 +326,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
 
 	lockdep_assert_held(&gpu->lock);
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		etnaviv_buffer_dump(gpu, buffer, 0, 0x50);
 
 	link_target = etnaviv_cmdbuf_get_va(cmdbuf,
@@ -459,13 +459,13 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
 		 etnaviv_cmdbuf_get_va(buffer, &gpu->mmu_context->cmdbuf_mapping)
 		 + buffer->user_size - 4);
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		pr_info("stream link to 0x%08x @ 0x%08x %p\n",
 			return_target,
 			etnaviv_cmdbuf_get_va(cmdbuf, &gpu->mmu_context->cmdbuf_mapping),
 			cmdbuf->vaddr);
 
-	if (drm_debug & DRM_UT_DRIVER) {
+	if (drm_debug_enabled(DRM_UT_DRIVER)) {
 		print_hex_dump(KERN_INFO, "cmd ", DUMP_PREFIX_OFFSET, 16, 4,
 			       cmdbuf->vaddr, cmdbuf->size, 0);
 

drivers/gpu/drm/etnaviv/etnaviv_buffer.c void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state, · line 489

Quoted 7 lines
drivers/gpu/drm/etnaviv/etnaviv_buffer.c +1 -1
@@ -484,6 +484,6 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
 				    VIV_FE_LINK_HEADER_PREFETCH(link_dwords),
 				    link_target);
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		etnaviv_buffer_dump(gpu, buffer, 0, 0x50);
 }

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#17 lore raw

✓ Fi.CI.BAT: success for drm/print: add and use drm_debug_enabled()

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: drm/print: add and use drm_debug_enabled()
URL : https://patchwork.freedesktop.org/series/66656/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6890 -> Patchwork_14400
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/

Known issues
------------

Here are the changes found in Patchwork_14400 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_switch@legacy-render:
- fi-bxt-dsi: [PASS][1] -> [INCOMPLETE][2] ([fdo#103927] / [fdo#111381])
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/fi-bxt-dsi/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/fi-bxt-dsi/igt@[email protected]

* igt@gem_linear_blits@basic:
- fi-icl-u3: [PASS][3] -> [DMESG-WARN][4] ([fdo#107724]) +2 similar issues
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/fi-icl-u3/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/fi-icl-u3/igt@[email protected]

* igt@i915_selftest@live_hangcheck:
- fi-icl-u2: [PASS][5] -> [DMESG-FAIL][6] ([fdo#111678])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/fi-icl-u2/igt@i915_selftest@live_hangcheck.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/fi-icl-u2/igt@i915_selftest@live_hangcheck.html

* igt@i915_selftest@live_workarounds:
- fi-bsw-kefka: [PASS][7] -> [DMESG-WARN][8] ([fdo#111373])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/fi-bsw-kefka/igt@i915_selftest@live_workarounds.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/fi-bsw-kefka/igt@i915_selftest@live_workarounds.html

* igt@kms_frontbuffer_tracking@basic:
- fi-hsw-peppy: [PASS][9] -> [DMESG-WARN][10] ([fdo#102614])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/fi-hsw-peppy/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/fi-hsw-peppy/igt@[email protected]

#### Possible fixes ####

* igt@gem_render_linear_blits@basic:
- fi-icl-u3: [DMESG-WARN][11] ([fdo#107724]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/fi-icl-u3/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/fi-icl-u3/igt@[email protected]

* igt@gem_sync@basic-each:
- {fi-tgl-u}: [INCOMPLETE][13] ([fdo#111647]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/fi-tgl-u/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/fi-tgl-u/igt@[email protected]

* igt@kms_frontbuffer_tracking@basic:
- {fi-icl-u4}: [FAIL][15] ([fdo#103167]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/fi-icl-u4/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/fi-icl-u4/igt@[email protected]
- fi-icl-u2: [FAIL][17] ([fdo#103167]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/fi-icl-u2/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/fi-icl-u2/igt@[email protected]

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#111373]: https://bugs.freedesktop.org/show_bug.cgi?id=111373
[fdo#111381]: https://bugs.freedesktop.org/show_bug.cgi?id=111381
[fdo#111647]: https://bugs.freedesktop.org/show_bug.cgi?id=111647
[fdo#111678]: https://bugs.freedesktop.org/show_bug.cgi?id=111678

Participating hosts (54 -> 45)
------------------------------

Missing (9): fi-ilk-m540 fi-hsw-4200u fi-bsw-n3050 fi-byt-squawks fi-bsw-cyan fi-kbl-7500u fi-icl-y fi-byt-clapper fi-bdw-samus

Build changes
-------------

* CI: CI-20190529 -> None
* Linux: CI_DRM_6890 -> Patchwork_14400

CI-20190529: 20190529
CI_DRM_6890: 85db8e7ffdfa727551a7d99e77a26c4befb8e640 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5180: 811b10e2bd7fd2cd8ced9bbb55361c178886bbbd @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14400: 0cf240ef4bf2fa488c4a57142bc4cb9a8790c858 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

0cf240ef4bf2 drm/print: rename drm_debug to __drm_debug to discourage use 54c5afd601a3 drm/amdgpu: use drm_debug_enabled() to check for debug categories bd8165b9afbd drm/nouveau: use drm_debug_enabled() to check for debug categories 57178519fc00 drm/msm: use drm_debug_enabled() to check for debug categories ce482587ea13 drm/i915: use drm_debug_enabled() to check for debug categories 2954a9709b2a drm/i2c/sil164: use drm_debug_enabled() to check for debug categories ae79a509528f drm/etnaviv: use drm_debug_enabled() to check for debug categories b28ce38ce593 drm/print: add drm_debug_enabled()
2bd6d26e4dd2 drm/print: move drm_debug variable to drm_print.[ch]

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#18 lore raw

✓ Fi.CI.IGT: success for drm/print: add and use drm_debug_enabled()

In reply to Jani Nikula
== Series Details ==

== Series Details ==

Series: drm/print: add and use drm_debug_enabled()
URL : https://patchwork.freedesktop.org/series/66656/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6890_full -> Patchwork_14400_full
====================================================

Summary
-------

**SUCCESS**

No regressions found.

Known issues
------------

Here are the changes found in Patchwork_14400_full that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_ctx_shared@exec-single-timeline-bsd1:
- shard-iclb: [PASS][1] -> [SKIP][2] ([fdo#109276]) +15 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-iclb2/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-iclb8/igt@[email protected]

* igt@gem_exec_balancer@smoke:
- shard-iclb: [PASS][3] -> [SKIP][4] ([fdo#110854])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-iclb4/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-iclb3/igt@[email protected]

* igt@gem_exec_schedule@preemptive-hang-bsd:
- shard-iclb: [PASS][5] -> [SKIP][6] ([fdo#111325]) +5 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-iclb5/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-iclb4/igt@[email protected]

* igt@i915_suspend@sysfs-reader:
- shard-apl: [PASS][7] -> [DMESG-WARN][8] ([fdo#108566]) +6 similar issues
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-apl4/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-apl5/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-128x128-random:
- shard-iclb: [PASS][9] -> [INCOMPLETE][10] ([fdo#107713])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-iclb5/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-iclb7/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-64x64-sliding:
- shard-skl: [PASS][11] -> [FAIL][12] ([fdo#103232])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-skl3/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-skl2/igt@[email protected]

* igt@kms_draw_crc@draw-method-rgb565-mmap-cpu-xtiled:
- shard-skl: [PASS][13] -> [FAIL][14] ([fdo#103184] / [fdo#103232])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-skl9/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-skl10/igt@[email protected]

* igt@kms_flip@dpms-vs-vblank-race:
- shard-apl: [PASS][15] -> [FAIL][16] ([fdo#111609])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-apl4/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-apl4/igt@[email protected]

* igt@kms_flip@flip-vs-expired-vblank:
- shard-skl: [PASS][17] -> [FAIL][18] ([fdo#105363]) +1 similar issue
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-skl10/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-skl6/igt@[email protected]

* igt@kms_flip@flip-vs-suspend:
- shard-skl: [PASS][19] -> [INCOMPLETE][20] ([fdo#109507])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-skl10/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-skl9/igt@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible:
- shard-kbl: [PASS][21] -> [DMESG-WARN][22] ([fdo#108566]) +1 similar issue
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-kbl1/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-kbl3/igt@[email protected]

* igt@kms_flip_tiling@flip-to-yf-tiled:
- shard-skl: [PASS][23] -> [FAIL][24] ([fdo#107931] / [fdo#108134])
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-skl9/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-skl10/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-pwrite:
- shard-iclb: [PASS][25] -> [FAIL][26] ([fdo#103167]) +4 similar issues
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-iclb8/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-pwrite.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-iclb7/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-pwrite.html

* igt@kms_frontbuffer_tracking@psr-1p-offscren-pri-indfb-draw-mmap-wc:
- shard-skl: [PASS][27] -> [FAIL][28] ([fdo#103167]) +1 similar issue
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-skl9/igt@kms_frontbuffer_tracking@psr-1p-offscren-pri-indfb-draw-mmap-wc.html
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-skl10/igt@kms_frontbuffer_tracking@psr-1p-offscren-pri-indfb-draw-mmap-wc.html

* igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
- shard-skl: [PASS][29] -> [FAIL][30] ([fdo#103166])
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-skl9/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-skl10/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-a-constant-alpha-min:
- shard-skl: [PASS][31] -> [FAIL][32] ([fdo#108145]) +1 similar issue
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-skl9/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-skl10/igt@[email protected]

* igt@kms_plane_alpha_blend@pipe-c-coverage-7efc:
- shard-skl: [PASS][33] -> [FAIL][34] ([fdo#108145] / [fdo#110403])
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-skl3/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-skl2/igt@[email protected]

* igt@kms_setmode@basic:
- shard-hsw: [PASS][35] -> [FAIL][36] ([fdo#99912])
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-hsw7/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-hsw5/igt@[email protected]

* igt@perf@blocking:
- shard-skl: [PASS][37] -> [FAIL][38] ([fdo#110728])
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-skl6/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-skl8/igt@[email protected]

#### Possible fixes ####

* igt@gem_exec_schedule@independent-bsd:
- shard-iclb: [SKIP][39] ([fdo#111325]) -> [PASS][40] +2 similar issues
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-iclb2/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-iclb8/igt@[email protected]

* igt@gem_exec_schedule@preempt-queue-bsd1:
- shard-iclb: [SKIP][41] ([fdo#109276]) -> [PASS][42] +14 similar issues
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-iclb5/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-iclb1/igt@[email protected]

* igt@gem_softpin@noreloc-s3:
- shard-kbl: [DMESG-WARN][43] ([fdo#108566]) -> [PASS][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-kbl3/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-kbl6/igt@[email protected]

* igt@gem_workarounds@suspend-resume-context:
- shard-apl: [DMESG-WARN][45] ([fdo#108566]) -> [PASS][46] +2 similar issues
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-apl8/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-apl3/igt@[email protected]

* igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-blt:
- shard-iclb: [FAIL][47] ([fdo#103167]) -> [PASS][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-blt.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-iclb8/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-cur-indfb-draw-blt.html

* igt@kms_plane_alpha_blend@pipe-b-coverage-7efc:
- shard-skl: [FAIL][49] ([fdo#108145] / [fdo#110403]) -> [PASS][50]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-skl9/igt@[email protected]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-skl8/igt@[email protected]

* igt@kms_psr2_su@page_flip:
- shard-iclb: [SKIP][51] ([fdo#109642] / [fdo#111068]) -> [PASS][52]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-iclb6/igt@kms_psr2_su@page_flip.html
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-iclb2/igt@kms_psr2_su@page_flip.html

* igt@kms_psr@psr2_dpms:
- shard-iclb: [SKIP][53] ([fdo#109441]) -> [PASS][54] +1 similar issue
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-iclb6/igt@kms_psr@psr2_dpms.html
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-iclb2/igt@kms_psr@psr2_dpms.html

* igt@kms_setmode@basic:
- shard-apl: [FAIL][55] ([fdo#99912]) -> [PASS][56]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-apl5/igt@[email protected]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-apl2/igt@[email protected]

* igt@kms_vblank@pipe-b-ts-continuation-modeset-hang:
- shard-iclb: [INCOMPLETE][57] ([fdo#107713]) -> [PASS][58]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-iclb7/igt@[email protected]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-iclb8/igt@[email protected]

* igt@perf@polling:
- shard-skl: [FAIL][59] ([fdo#110728]) -> [PASS][60]
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-skl3/igt@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-skl9/igt@[email protected]

#### Warnings ####

* igt@gem_ctx_isolation@vcs1-nonpriv:
- shard-iclb: [SKIP][61] ([fdo#109276]) -> [FAIL][62] ([fdo#111329])
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-iclb5/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-iclb1/igt@[email protected]

* igt@gem_mocs_settings@mocs-isolation-bsd2:
- shard-iclb: [FAIL][63] ([fdo#111330]) -> [SKIP][64] ([fdo#109276])
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-iclb2/igt@[email protected]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-iclb8/igt@[email protected]

* igt@gem_mocs_settings@mocs-reset-bsd2:
- shard-iclb: [SKIP][65] ([fdo#109276]) -> [FAIL][66] ([fdo#111330]) +1 similar issue
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6890/shard-iclb3/igt@[email protected]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/shard-iclb1/igt@[email protected]

[fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
[fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
[fdo#103184]: https://bugs.freedesktop.org/show_bug.cgi?id=103184
[fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
[fdo#105363]: https://bugs.freedesktop.org/show_bug.cgi?id=105363
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107931]: https://bugs.freedesktop.org/show_bug.cgi?id=107931
[fdo#108134]: https://bugs.freedesktop.org/show_bug.cgi?id=108134
[fdo#108145]: https://bugs.freedesktop.org/show_bug.cgi?id=108145
[fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
[fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
[fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
[fdo#109507]: https://bugs.freedesktop.org/show_bug.cgi?id=109507
[fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
[fdo#110403]: https://bugs.freedesktop.org/show_bug.cgi?id=110403
[fdo#110728]: https://bugs.freedesktop.org/show_bug.cgi?id=110728
[fdo#110854]: https://bugs.freedesktop.org/show_bug.cgi?id=110854
[fdo#111068]: https://bugs.freedesktop.org/show_bug.cgi?id=111068
[fdo#111325]: https://bugs.freedesktop.org/show_bug.cgi?id=111325
[fdo#111329]: https://bugs.freedesktop.org/show_bug.cgi?id=111329
[fdo#111330]: https://bugs.freedesktop.org/show_bug.cgi?id=111330
[fdo#111609]: https://bugs.freedesktop.org/show_bug.cgi?id=111609
[fdo#99912]: https://bugs.freedesktop.org/show_bug.cgi?id=99912

Participating hosts (10 -> 10)
------------------------------

No changes in participating hosts

Build changes
-------------

* CI: CI-20190529 -> None
* Linux: CI_DRM_6890 -> Patchwork_14400

CI-20190529: 20190529
CI_DRM_6890: 85db8e7ffdfa727551a7d99e77a26c4befb8e640 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5180: 811b10e2bd7fd2cd8ced9bbb55361c178886bbbd @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14400: 0cf240ef4bf2fa488c4a57142bc4cb9a8790c858 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14400/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 6/9
#13 lore raw

Re: [PATCH 6/9] drm/msm: use drm_debug_enabled() to check for debug categories

In reply to Jani Nikula
Quoted 9 lines · Jani Nikula

Allow better abstraction of the drm_debug global variable in the future. No functional changes.

I don't think this should conflict w/ anything, so land via drm-misc?

BR,
-R

Quoted 27 lines
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +2 -3
index 9e40f559c51f..00e3353f9aad 100644
@@ -29,7 +29,7 @@
  */
 #define DPU_DEBUG(fmt, ...)                                                \
        do {                                                               \
-               if (unlikely(drm_debug & DRM_UT_KMS))                      \
+               if (unlikely(drm_debug_enabled(DRM_UT_KMS)))               \
                        DRM_DEBUG(fmt, ##__VA_ARGS__); \
                else                                                       \
                        pr_debug(fmt, ##__VA_ARGS__);                      \
@@ -41,7 +41,7 @@
  */
 #define DPU_DEBUG_DRIVER(fmt, ...)                                         \
        do {                                                               \
-               if (unlikely(drm_debug & DRM_UT_DRIVER))                   \
+               if (unlikely(drm_debug_enabled(DRM_UT_DRIVER)))            \
                        DRM_ERROR(fmt, ##__VA_ARGS__); \
                else                                                       \
                        pr_debug(fmt, ##__VA_ARGS__);                      \
--
Quoted 2 lines

2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw

Re: [PATCH 2/9] drm/print: add drm_debug_enabled()

In reply to Eric Engestrom
Quoted 169 lines · Eric Engestrom
Quoted 168 lines · Jani Nikula

Add helper to check if a drm debug category is enabled. Convert drm core to use it. No functional changes.

---
 drivers/gpu/drm/drm_atomic_uapi.c     | 2 +-
 drivers/gpu/drm/drm_dp_mst_topology.c | 6 +++---
 drivers/gpu/drm/drm_edid.c            | 2 +-
 drivers/gpu/drm/drm_edid_load.c       | 2 +-
 drivers/gpu/drm/drm_mipi_dbi.c        | 4 ++--
 drivers/gpu/drm/drm_print.c           | 4 ++--
 drivers/gpu/drm/drm_vblank.c          | 6 +++---
 include/drm/drm_print.h               | 5 +++++
 8 files changed, 18 insertions(+), 13 deletions(-)
drivers/gpu/drm/drm_atomic_uapi.c +1 -1
index 5a5b42db6f2a..6576cd997cbd 100644
@@ -1406,7 +1406,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
 	} else if (arg->flags & DRM_MODE_ATOMIC_NONBLOCK) {
 		ret = drm_atomic_nonblocking_commit(state);
 	} else {
-		if (unlikely(drm_debug & DRM_UT_STATE))
+		if (unlikely(drm_debug_enabled(DRM_UT_STATE)))
 			drm_atomic_print_state(state);
 
 		ret = drm_atomic_commit(state);
drivers/gpu/drm/drm_dp_mst_topology.c +3 -3
index 97216099a718..f47c5b6b51f7 100644
@@ -1180,7 +1180,7 @@ static int drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
 		}
 	}
 out:
-	if (unlikely(ret == -EIO && drm_debug & DRM_UT_DP)) {
+	if (unlikely(ret == -EIO && drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
@@ -2321,7 +2321,7 @@ static int process_single_tx_qlock(struct drm_dp_mst_topology_mgr *mgr,
 	idx += tosend + 1;
 
 	ret = drm_dp_send_sideband_msg(mgr, up, chunk, idx);
-	if (unlikely(ret && drm_debug & DRM_UT_DP)) {
+	if (unlikely(ret && drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_printf(&p, "sideband msg failed to send\n");
@@ -2388,7 +2388,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,
 	mutex_lock(&mgr->qlock);
 	list_add_tail(&txmsg->next, &mgr->tx_msg_downq);
 
-	if (unlikely(drm_debug & DRM_UT_DP)) {
+	if (unlikely(drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
drivers/gpu/drm/drm_edid.c +1 -1
index 12c783f4d956..58dad4d24cd4 100644
@@ -1551,7 +1551,7 @@ static void connector_bad_edid(struct drm_connector *connector,
 {
 	int i;
 
-	if (connector->bad_edid_counter++ && !(drm_debug & DRM_UT_KMS))
+	if (connector->bad_edid_counter++ && !drm_debug_enabled(DRM_UT_KMS))
 		return;
 
 	dev_warn(connector->dev->dev,
drivers/gpu/drm/drm_edid_load.c +1 -1
index d38b3b255926..37d8ba3ddb46 100644
@@ -175,7 +175,7 @@ static void *edid_load(struct drm_connector *connector, const char *name,
 	u8 *edid;
 	int fwsize, builtin;
 	int i, valid_extensions = 0;
-	bool print_bad_edid = !connector->bad_edid_counter || (drm_debug & DRM_UT_KMS);
+	bool print_bad_edid = !connector->bad_edid_counter || drm_debug_enabled(DRM_UT_KMS);
 
 	builtin = match_string(generic_edid_name, GENERIC_EDIDS, name);
 	if (builtin >= 0) {
drivers/gpu/drm/drm_mipi_dbi.c +2 -2
index f8154316a3b0..ccfb5b33c5e3 100644
@@ -783,7 +783,7 @@ static int mipi_dbi_spi1e_transfer(struct mipi_dbi *dbi, int dc,
 	int i, ret;
 	u8 *dst;
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		pr_debug("[drm:%s] dc=%d, max_chunk=%zu, transfers:\n",
 			 __func__, dc, max_chunk);
 
@@ -907,7 +907,7 @@ static int mipi_dbi_spi1_transfer(struct mipi_dbi *dbi, int dc,
 	max_chunk = dbi->tx_buf9_len;
 	dst16 = dbi->tx_buf9;
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		pr_debug("[drm:%s] dc=%d, max_chunk=%zu, transfers:\n",
 			 __func__, dc, max_chunk);
 
drivers/gpu/drm/drm_print.c +2 -2
index c9b57012d412..a7c89ec5ff26 100644
@@ -264,7 +264,7 @@ void drm_dev_dbg(const struct device *dev, unsigned int category,
 	struct va_format vaf;
 	va_list args;
 
-	if (!(drm_debug & category))
+	if (!drm_debug_enabled(category))
 		return;
 
 	va_start(args, format);
@@ -287,7 +287,7 @@ void drm_dbg(unsigned int category, const char *format, ...)
 	struct va_format vaf;
 	va_list args;
 
-	if (!(drm_debug & category))
+	if (!drm_debug_enabled(category))
 		return;
 
 	va_start(args, format);
drivers/gpu/drm/drm_vblank.c +3 -3
index 9c6899758bc9..4f7962b6427b 100644
@@ -332,7 +332,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
 	u64 vblank;
 	unsigned long flags;
 
-	WARN_ONCE(drm_debug & DRM_UT_VBL && !dev->driver->get_vblank_timestamp,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !dev->driver->get_vblank_timestamp,
 		  "This function requires support for accurate vblank timestamps.");
 
 	spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -706,7 +706,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	 */
 	*vblank_time = ktime_sub_ns(etime, delta_ns);
 
-	if ((drm_debug & DRM_UT_VBL) == 0)
+	if (!drm_debug_enabled(DRM_UT_VBL))
 		return true;
 
 	ts_etime = ktime_to_timespec64(etime);
@@ -1352,7 +1352,7 @@ void drm_vblank_restore(struct drm_device *dev, unsigned int pipe)
 	assert_spin_locked(&dev->vblank_time_lock);
 
 	vblank = &dev->vblank[pipe];
-	WARN_ONCE((drm_debug & DRM_UT_VBL) && !vblank->framedur_ns,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !vblank->framedur_ns,
 		  "Cannot compute missed vblanks without frame duration\n");
 	framedur_ns = vblank->framedur_ns;
 
include/drm/drm_print.h +0 -0
index e5c421abce48..e13f901312a4 100644
@@ -294,6 +294,11 @@ static inline struct drm_printer drm_err_printer(const char *prefix)
 #define DRM_UT_LEASE		0x80
 #define DRM_UT_DP		0x100
 
Quoted 6 lines

include/drm/drm_print.h static inline struct drm_printer drm_err_printer(const char *prefix) · line 299

Quoted 3 lines
include/drm/drm_print.h +3 -0
+static inline bool drm_debug_enabled(unsigned int category)
+{
+	return drm_debug & category;

Worth making that return unlikely(drm_debug & category); to make sure the preloaded path is always to skip the debug stuff?

If that would let us drop the unlikely() wrapping from the various users of this function, agreed, it would be great.

However I'm not at all certain unlikely() here will propagate like that. I just don't know. Do you?

BR,
Jani.

Quoted 17 lines
Quoted 13 lines
include/drm/drm_print.h +2 -0
+}
+
 __printf(3, 4)
 void drm_dev_printk(const struct device *dev, const char *level,
 		    const char *format, ...);
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#5 lore raw

Re: [PATCH 2/9] drm/print: add drm_debug_enabled()

Quoted 177 lines · Jani Nikula
Quoted 169 lines · Eric Engestrom
Quoted 168 lines · Jani Nikula

Add helper to check if a drm debug category is enabled. Convert drm core to use it. No functional changes.

---
 drivers/gpu/drm/drm_atomic_uapi.c     | 2 +-
 drivers/gpu/drm/drm_dp_mst_topology.c | 6 +++---
 drivers/gpu/drm/drm_edid.c            | 2 +-
 drivers/gpu/drm/drm_edid_load.c       | 2 +-
 drivers/gpu/drm/drm_mipi_dbi.c        | 4 ++--
 drivers/gpu/drm/drm_print.c           | 4 ++--
 drivers/gpu/drm/drm_vblank.c          | 6 +++---
 include/drm/drm_print.h               | 5 +++++
 8 files changed, 18 insertions(+), 13 deletions(-)
drivers/gpu/drm/drm_atomic_uapi.c +1 -1
index 5a5b42db6f2a..6576cd997cbd 100644
@@ -1406,7 +1406,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
 	} else if (arg->flags & DRM_MODE_ATOMIC_NONBLOCK) {
 		ret = drm_atomic_nonblocking_commit(state);
 	} else {
-		if (unlikely(drm_debug & DRM_UT_STATE))
+		if (unlikely(drm_debug_enabled(DRM_UT_STATE)))
 			drm_atomic_print_state(state);
 
 		ret = drm_atomic_commit(state);
drivers/gpu/drm/drm_dp_mst_topology.c +3 -3
index 97216099a718..f47c5b6b51f7 100644
@@ -1180,7 +1180,7 @@ static int drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
 		}
 	}
 out:
-	if (unlikely(ret == -EIO && drm_debug & DRM_UT_DP)) {
+	if (unlikely(ret == -EIO && drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
@@ -2321,7 +2321,7 @@ static int process_single_tx_qlock(struct drm_dp_mst_topology_mgr *mgr,
 	idx += tosend + 1;
 
 	ret = drm_dp_send_sideband_msg(mgr, up, chunk, idx);
-	if (unlikely(ret && drm_debug & DRM_UT_DP)) {
+	if (unlikely(ret && drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_printf(&p, "sideband msg failed to send\n");
@@ -2388,7 +2388,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,
 	mutex_lock(&mgr->qlock);
 	list_add_tail(&txmsg->next, &mgr->tx_msg_downq);
 
-	if (unlikely(drm_debug & DRM_UT_DP)) {
+	if (unlikely(drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
drivers/gpu/drm/drm_edid.c +1 -1
index 12c783f4d956..58dad4d24cd4 100644
@@ -1551,7 +1551,7 @@ static void connector_bad_edid(struct drm_connector *connector,
 {
 	int i;
 
-	if (connector->bad_edid_counter++ && !(drm_debug & DRM_UT_KMS))
+	if (connector->bad_edid_counter++ && !drm_debug_enabled(DRM_UT_KMS))
 		return;
 
 	dev_warn(connector->dev->dev,
drivers/gpu/drm/drm_edid_load.c +1 -1
index d38b3b255926..37d8ba3ddb46 100644
@@ -175,7 +175,7 @@ static void *edid_load(struct drm_connector *connector, const char *name,
 	u8 *edid;
 	int fwsize, builtin;
 	int i, valid_extensions = 0;
-	bool print_bad_edid = !connector->bad_edid_counter || (drm_debug & DRM_UT_KMS);
+	bool print_bad_edid = !connector->bad_edid_counter || drm_debug_enabled(DRM_UT_KMS);
 
 	builtin = match_string(generic_edid_name, GENERIC_EDIDS, name);
 	if (builtin >= 0) {
drivers/gpu/drm/drm_mipi_dbi.c +2 -2
index f8154316a3b0..ccfb5b33c5e3 100644
@@ -783,7 +783,7 @@ static int mipi_dbi_spi1e_transfer(struct mipi_dbi *dbi, int dc,
 	int i, ret;
 	u8 *dst;
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		pr_debug("[drm:%s] dc=%d, max_chunk=%zu, transfers:\n",
 			 __func__, dc, max_chunk);
 
@@ -907,7 +907,7 @@ static int mipi_dbi_spi1_transfer(struct mipi_dbi *dbi, int dc,
 	max_chunk = dbi->tx_buf9_len;
 	dst16 = dbi->tx_buf9;
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		pr_debug("[drm:%s] dc=%d, max_chunk=%zu, transfers:\n",
 			 __func__, dc, max_chunk);
 
drivers/gpu/drm/drm_print.c +2 -2
index c9b57012d412..a7c89ec5ff26 100644
@@ -264,7 +264,7 @@ void drm_dev_dbg(const struct device *dev, unsigned int category,
 	struct va_format vaf;
 	va_list args;
 
-	if (!(drm_debug & category))
+	if (!drm_debug_enabled(category))
 		return;
 
 	va_start(args, format);
@@ -287,7 +287,7 @@ void drm_dbg(unsigned int category, const char *format, ...)
 	struct va_format vaf;
 	va_list args;
 
-	if (!(drm_debug & category))
+	if (!drm_debug_enabled(category))
 		return;
 
 	va_start(args, format);
drivers/gpu/drm/drm_vblank.c +3 -3
index 9c6899758bc9..4f7962b6427b 100644
@@ -332,7 +332,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
 	u64 vblank;
 	unsigned long flags;
 
-	WARN_ONCE(drm_debug & DRM_UT_VBL && !dev->driver->get_vblank_timestamp,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !dev->driver->get_vblank_timestamp,
 		  "This function requires support for accurate vblank timestamps.");
 
 	spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -706,7 +706,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	 */
 	*vblank_time = ktime_sub_ns(etime, delta_ns);
 
-	if ((drm_debug & DRM_UT_VBL) == 0)
+	if (!drm_debug_enabled(DRM_UT_VBL))
 		return true;
 
 	ts_etime = ktime_to_timespec64(etime);
@@ -1352,7 +1352,7 @@ void drm_vblank_restore(struct drm_device *dev, unsigned int pipe)
 	assert_spin_locked(&dev->vblank_time_lock);
 
 	vblank = &dev->vblank[pipe];
-	WARN_ONCE((drm_debug & DRM_UT_VBL) && !vblank->framedur_ns,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !vblank->framedur_ns,
 		  "Cannot compute missed vblanks without frame duration\n");
 	framedur_ns = vblank->framedur_ns;
 
include/drm/drm_print.h +0 -0
index e5c421abce48..e13f901312a4 100644
@@ -294,6 +294,11 @@ static inline struct drm_printer drm_err_printer(const char *prefix)
 #define DRM_UT_LEASE		0x80
 #define DRM_UT_DP		0x100
 
Quoted 6 lines

include/drm/drm_print.h static inline struct drm_printer drm_err_printer(const char *prefix) · line 299

Quoted 3 lines
include/drm/drm_print.h +3 -0
+static inline bool drm_debug_enabled(unsigned int category)
+{
+	return drm_debug & category;

Worth making that return unlikely(drm_debug & category); to make sure the preloaded path is always to skip the debug stuff?

Quoted 5 lines

If that would let us drop the unlikely() wrapping from the various users of this function, agreed, it would be great.

However I'm not at all certain unlikely() here will propagate like that. I just don't know. Do you?

I don't know either, but I expect it would? Otherwise, this definitely would:
#define drm_debug_enabled(cat) unlikely(drm_debug & category)

And yeah, dropping the unlikely() sprinkled around some drm_debug_enabled() calls is a definite bonus.

Quoted 14 lines

BR,
Jani.

Quoted 9 lines
Quoted 9 lines
include/drm/drm_print.h +2 -0
+}
+
 __printf(3, 4)
 void drm_dev_printk(const struct device *dev, const char *level,
 		    const char *format, ...);
Signature · 1 line
2.20.1
Quoted 11 lines
Quoted 8 lines
Quoted 4 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

Re: [PATCH 2/9] drm/print: add drm_debug_enabled()

Quoted 184 lines · Eric Engestrom
Quoted 177 lines · Jani Nikula
Quoted 169 lines · Eric Engestrom
Quoted 168 lines · Jani Nikula

Add helper to check if a drm debug category is enabled. Convert drm core to use it. No functional changes.

---
 drivers/gpu/drm/drm_atomic_uapi.c     | 2 +-
 drivers/gpu/drm/drm_dp_mst_topology.c | 6 +++---
 drivers/gpu/drm/drm_edid.c            | 2 +-
 drivers/gpu/drm/drm_edid_load.c       | 2 +-
 drivers/gpu/drm/drm_mipi_dbi.c        | 4 ++--
 drivers/gpu/drm/drm_print.c           | 4 ++--
 drivers/gpu/drm/drm_vblank.c          | 6 +++---
 include/drm/drm_print.h               | 5 +++++
 8 files changed, 18 insertions(+), 13 deletions(-)
drivers/gpu/drm/drm_atomic_uapi.c +1 -1
index 5a5b42db6f2a..6576cd997cbd 100644
@@ -1406,7 +1406,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
 	} else if (arg->flags & DRM_MODE_ATOMIC_NONBLOCK) {
 		ret = drm_atomic_nonblocking_commit(state);
 	} else {
-		if (unlikely(drm_debug & DRM_UT_STATE))
+		if (unlikely(drm_debug_enabled(DRM_UT_STATE)))
 			drm_atomic_print_state(state);
 
 		ret = drm_atomic_commit(state);
drivers/gpu/drm/drm_dp_mst_topology.c +3 -3
index 97216099a718..f47c5b6b51f7 100644
@@ -1180,7 +1180,7 @@ static int drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
 		}
 	}
 out:
-	if (unlikely(ret == -EIO && drm_debug & DRM_UT_DP)) {
+	if (unlikely(ret == -EIO && drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
@@ -2321,7 +2321,7 @@ static int process_single_tx_qlock(struct drm_dp_mst_topology_mgr *mgr,
 	idx += tosend + 1;
 
 	ret = drm_dp_send_sideband_msg(mgr, up, chunk, idx);
-	if (unlikely(ret && drm_debug & DRM_UT_DP)) {
+	if (unlikely(ret && drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_printf(&p, "sideband msg failed to send\n");
@@ -2388,7 +2388,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,
 	mutex_lock(&mgr->qlock);
 	list_add_tail(&txmsg->next, &mgr->tx_msg_downq);
 
-	if (unlikely(drm_debug & DRM_UT_DP)) {
+	if (unlikely(drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
drivers/gpu/drm/drm_edid.c +1 -1
index 12c783f4d956..58dad4d24cd4 100644
@@ -1551,7 +1551,7 @@ static void connector_bad_edid(struct drm_connector *connector,
 {
 	int i;
 
-	if (connector->bad_edid_counter++ && !(drm_debug & DRM_UT_KMS))
+	if (connector->bad_edid_counter++ && !drm_debug_enabled(DRM_UT_KMS))
 		return;
 
 	dev_warn(connector->dev->dev,
drivers/gpu/drm/drm_edid_load.c +1 -1
index d38b3b255926..37d8ba3ddb46 100644
@@ -175,7 +175,7 @@ static void *edid_load(struct drm_connector *connector, const char *name,
 	u8 *edid;
 	int fwsize, builtin;
 	int i, valid_extensions = 0;
-	bool print_bad_edid = !connector->bad_edid_counter || (drm_debug & DRM_UT_KMS);
+	bool print_bad_edid = !connector->bad_edid_counter || drm_debug_enabled(DRM_UT_KMS);
 
 	builtin = match_string(generic_edid_name, GENERIC_EDIDS, name);
 	if (builtin >= 0) {
drivers/gpu/drm/drm_mipi_dbi.c +2 -2
index f8154316a3b0..ccfb5b33c5e3 100644
@@ -783,7 +783,7 @@ static int mipi_dbi_spi1e_transfer(struct mipi_dbi *dbi, int dc,
 	int i, ret;
 	u8 *dst;
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		pr_debug("[drm:%s] dc=%d, max_chunk=%zu, transfers:\n",
 			 __func__, dc, max_chunk);
 
@@ -907,7 +907,7 @@ static int mipi_dbi_spi1_transfer(struct mipi_dbi *dbi, int dc,
 	max_chunk = dbi->tx_buf9_len;
 	dst16 = dbi->tx_buf9;
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		pr_debug("[drm:%s] dc=%d, max_chunk=%zu, transfers:\n",
 			 __func__, dc, max_chunk);
 
drivers/gpu/drm/drm_print.c +2 -2
index c9b57012d412..a7c89ec5ff26 100644
@@ -264,7 +264,7 @@ void drm_dev_dbg(const struct device *dev, unsigned int category,
 	struct va_format vaf;
 	va_list args;
 
-	if (!(drm_debug & category))
+	if (!drm_debug_enabled(category))
 		return;
 
 	va_start(args, format);
@@ -287,7 +287,7 @@ void drm_dbg(unsigned int category, const char *format, ...)
 	struct va_format vaf;
 	va_list args;
 
-	if (!(drm_debug & category))
+	if (!drm_debug_enabled(category))
 		return;
 
 	va_start(args, format);
drivers/gpu/drm/drm_vblank.c +3 -3
index 9c6899758bc9..4f7962b6427b 100644
@@ -332,7 +332,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
 	u64 vblank;
 	unsigned long flags;
 
-	WARN_ONCE(drm_debug & DRM_UT_VBL && !dev->driver->get_vblank_timestamp,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !dev->driver->get_vblank_timestamp,
 		  "This function requires support for accurate vblank timestamps.");
 
 	spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -706,7 +706,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	 */
 	*vblank_time = ktime_sub_ns(etime, delta_ns);
 
-	if ((drm_debug & DRM_UT_VBL) == 0)
+	if (!drm_debug_enabled(DRM_UT_VBL))
 		return true;
 
 	ts_etime = ktime_to_timespec64(etime);
@@ -1352,7 +1352,7 @@ void drm_vblank_restore(struct drm_device *dev, unsigned int pipe)
 	assert_spin_locked(&dev->vblank_time_lock);
 
 	vblank = &dev->vblank[pipe];
-	WARN_ONCE((drm_debug & DRM_UT_VBL) && !vblank->framedur_ns,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !vblank->framedur_ns,
 		  "Cannot compute missed vblanks without frame duration\n");
 	framedur_ns = vblank->framedur_ns;
 
include/drm/drm_print.h +0 -0
index e5c421abce48..e13f901312a4 100644
@@ -294,6 +294,11 @@ static inline struct drm_printer drm_err_printer(const char *prefix)
 #define DRM_UT_LEASE		0x80
 #define DRM_UT_DP		0x100
 
Quoted 6 lines

include/drm/drm_print.h static inline struct drm_printer drm_err_printer(const char *prefix) · line 299

Quoted 3 lines
include/drm/drm_print.h +3 -0
+static inline bool drm_debug_enabled(unsigned int category)
+{
+	return drm_debug & category;

Worth making that return unlikely(drm_debug & category); to make sure the preloaded path is always to skip the debug stuff?

Quoted 5 lines

If that would let us drop the unlikely() wrapping from the various users of this function, agreed, it would be great.

However I'm not at all certain unlikely() here will propagate like that. I just don't know. Do you?

Quoted 6 lines

I don't know either, but I expect it would? Otherwise, this definitely would:
#define drm_debug_enabled(cat) unlikely(drm_debug & category)

And yeah, dropping the unlikely() sprinkled around some drm_debug_enabled() calls is a definite bonus.

With either of the approaches, would it be okay to change call sites like this:

- if (unlikely(ret && drm_debug_enabled(DRM_UT_DP))) {
+ if (ret && drm_debug_enabled(DRM_UT_DP)) {

In theory the compiler should be able to conclude that the unlikely covers the whole branch even if ret is short-circuit evaluated.

BR,
Jani.

Quoted 26 lines
Quoted 26 lines

BR,
Jani.

Quoted 17 lines
Quoted 13 lines
include/drm/drm_print.h +2 -0
+}
+
 __printf(3, 4)
 void drm_dev_printk(const struct device *dev, const char *level,
 		    const char *format, ...);
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw

Re: [PATCH 2/9] drm/print: add drm_debug_enabled()

Quoted 198 lines · Jani Nikula
Quoted 184 lines · Eric Engestrom
Quoted 177 lines · Jani Nikula
Quoted 169 lines · Eric Engestrom
Quoted 168 lines · Jani Nikula

Add helper to check if a drm debug category is enabled. Convert drm core to use it. No functional changes.

---
 drivers/gpu/drm/drm_atomic_uapi.c     | 2 +-
 drivers/gpu/drm/drm_dp_mst_topology.c | 6 +++---
 drivers/gpu/drm/drm_edid.c            | 2 +-
 drivers/gpu/drm/drm_edid_load.c       | 2 +-
 drivers/gpu/drm/drm_mipi_dbi.c        | 4 ++--
 drivers/gpu/drm/drm_print.c           | 4 ++--
 drivers/gpu/drm/drm_vblank.c          | 6 +++---
 include/drm/drm_print.h               | 5 +++++
 8 files changed, 18 insertions(+), 13 deletions(-)
drivers/gpu/drm/drm_atomic_uapi.c +1 -1
index 5a5b42db6f2a..6576cd997cbd 100644
@@ -1406,7 +1406,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
 	} else if (arg->flags & DRM_MODE_ATOMIC_NONBLOCK) {
 		ret = drm_atomic_nonblocking_commit(state);
 	} else {
-		if (unlikely(drm_debug & DRM_UT_STATE))
+		if (unlikely(drm_debug_enabled(DRM_UT_STATE)))
 			drm_atomic_print_state(state);
 
 		ret = drm_atomic_commit(state);
drivers/gpu/drm/drm_dp_mst_topology.c +3 -3
index 97216099a718..f47c5b6b51f7 100644
@@ -1180,7 +1180,7 @@ static int drm_dp_mst_wait_tx_reply(struct drm_dp_mst_branch *mstb,
 		}
 	}
 out:
-	if (unlikely(ret == -EIO && drm_debug & DRM_UT_DP)) {
+	if (unlikely(ret == -EIO && drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
@@ -2321,7 +2321,7 @@ static int process_single_tx_qlock(struct drm_dp_mst_topology_mgr *mgr,
 	idx += tosend + 1;
 
 	ret = drm_dp_send_sideband_msg(mgr, up, chunk, idx);
-	if (unlikely(ret && drm_debug & DRM_UT_DP)) {
+	if (unlikely(ret && drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_printf(&p, "sideband msg failed to send\n");
@@ -2388,7 +2388,7 @@ static void drm_dp_queue_down_tx(struct drm_dp_mst_topology_mgr *mgr,
 	mutex_lock(&mgr->qlock);
 	list_add_tail(&txmsg->next, &mgr->tx_msg_downq);
 
-	if (unlikely(drm_debug & DRM_UT_DP)) {
+	if (unlikely(drm_debug_enabled(DRM_UT_DP))) {
 		struct drm_printer p = drm_debug_printer(DBG_PREFIX);
 
 		drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
drivers/gpu/drm/drm_edid.c +1 -1
index 12c783f4d956..58dad4d24cd4 100644
@@ -1551,7 +1551,7 @@ static void connector_bad_edid(struct drm_connector *connector,
 {
 	int i;
 
-	if (connector->bad_edid_counter++ && !(drm_debug & DRM_UT_KMS))
+	if (connector->bad_edid_counter++ && !drm_debug_enabled(DRM_UT_KMS))
 		return;
 
 	dev_warn(connector->dev->dev,
drivers/gpu/drm/drm_edid_load.c +1 -1
index d38b3b255926..37d8ba3ddb46 100644
@@ -175,7 +175,7 @@ static void *edid_load(struct drm_connector *connector, const char *name,
 	u8 *edid;
 	int fwsize, builtin;
 	int i, valid_extensions = 0;
-	bool print_bad_edid = !connector->bad_edid_counter || (drm_debug & DRM_UT_KMS);
+	bool print_bad_edid = !connector->bad_edid_counter || drm_debug_enabled(DRM_UT_KMS);
 
 	builtin = match_string(generic_edid_name, GENERIC_EDIDS, name);
 	if (builtin >= 0) {
drivers/gpu/drm/drm_mipi_dbi.c +2 -2
index f8154316a3b0..ccfb5b33c5e3 100644
@@ -783,7 +783,7 @@ static int mipi_dbi_spi1e_transfer(struct mipi_dbi *dbi, int dc,
 	int i, ret;
 	u8 *dst;
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		pr_debug("[drm:%s] dc=%d, max_chunk=%zu, transfers:\n",
 			 __func__, dc, max_chunk);
 
@@ -907,7 +907,7 @@ static int mipi_dbi_spi1_transfer(struct mipi_dbi *dbi, int dc,
 	max_chunk = dbi->tx_buf9_len;
 	dst16 = dbi->tx_buf9;
 
-	if (drm_debug & DRM_UT_DRIVER)
+	if (drm_debug_enabled(DRM_UT_DRIVER))
 		pr_debug("[drm:%s] dc=%d, max_chunk=%zu, transfers:\n",
 			 __func__, dc, max_chunk);
 
drivers/gpu/drm/drm_print.c +2 -2
index c9b57012d412..a7c89ec5ff26 100644
@@ -264,7 +264,7 @@ void drm_dev_dbg(const struct device *dev, unsigned int category,
 	struct va_format vaf;
 	va_list args;
 
-	if (!(drm_debug & category))
+	if (!drm_debug_enabled(category))
 		return;
 
 	va_start(args, format);
@@ -287,7 +287,7 @@ void drm_dbg(unsigned int category, const char *format, ...)
 	struct va_format vaf;
 	va_list args;
 
-	if (!(drm_debug & category))
+	if (!drm_debug_enabled(category))
 		return;
 
 	va_start(args, format);
drivers/gpu/drm/drm_vblank.c +3 -3
index 9c6899758bc9..4f7962b6427b 100644
@@ -332,7 +332,7 @@ u64 drm_crtc_accurate_vblank_count(struct drm_crtc *crtc)
 	u64 vblank;
 	unsigned long flags;
 
-	WARN_ONCE(drm_debug & DRM_UT_VBL && !dev->driver->get_vblank_timestamp,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !dev->driver->get_vblank_timestamp,
 		  "This function requires support for accurate vblank timestamps.");
 
 	spin_lock_irqsave(&dev->vblank_time_lock, flags);
@@ -706,7 +706,7 @@ bool drm_calc_vbltimestamp_from_scanoutpos(struct drm_device *dev,
 	 */
 	*vblank_time = ktime_sub_ns(etime, delta_ns);
 
-	if ((drm_debug & DRM_UT_VBL) == 0)
+	if (!drm_debug_enabled(DRM_UT_VBL))
 		return true;
 
 	ts_etime = ktime_to_timespec64(etime);
@@ -1352,7 +1352,7 @@ void drm_vblank_restore(struct drm_device *dev, unsigned int pipe)
 	assert_spin_locked(&dev->vblank_time_lock);
 
 	vblank = &dev->vblank[pipe];
-	WARN_ONCE((drm_debug & DRM_UT_VBL) && !vblank->framedur_ns,
+	WARN_ONCE(drm_debug_enabled(DRM_UT_VBL) && !vblank->framedur_ns,
 		  "Cannot compute missed vblanks without frame duration\n");
 	framedur_ns = vblank->framedur_ns;
 
include/drm/drm_print.h +0 -0
index e5c421abce48..e13f901312a4 100644
@@ -294,6 +294,11 @@ static inline struct drm_printer drm_err_printer(const char *prefix)
 #define DRM_UT_LEASE		0x80
 #define DRM_UT_DP		0x100
 
Quoted 6 lines

include/drm/drm_print.h static inline struct drm_printer drm_err_printer(const char *prefix) · line 299

Quoted 3 lines
include/drm/drm_print.h +3 -0
+static inline bool drm_debug_enabled(unsigned int category)
+{
+	return drm_debug & category;

Worth making that return unlikely(drm_debug & category); to make sure the preloaded path is always to skip the debug stuff?

Quoted 5 lines

If that would let us drop the unlikely() wrapping from the various users of this function, agreed, it would be great.

However I'm not at all certain unlikely() here will propagate like that. I just don't know. Do you?

Quoted 6 lines

I don't know either, but I expect it would? Otherwise, this definitely would:
#define drm_debug_enabled(cat) unlikely(drm_debug & category)

And yeah, dropping the unlikely() sprinkled around some drm_debug_enabled() calls is a definite bonus.

With either of the approaches, would it be okay to change call sites like this:

(quoted diff) +1 -1
- 	if (unlikely(ret && drm_debug_enabled(DRM_UT_DP))) {
+ 	if (ret && drm_debug_enabled(DRM_UT_DP)) {
Quoted 2 lines

In theory the compiler should be able to conclude that the unlikely covers the whole branch even if ret is short-circuit evaluated.

Yeah, the compiler should definitely be smart enough to figure out that ret && probably_false is probably_false :)

Quoted 31 lines

BR,
Jani.

Quoted 24 lines
Quoted 24 lines

BR,
Jani.

Quoted 17 lines
Quoted 13 lines
include/drm/drm_print.h +2 -0
+}
+
 __printf(3, 4)
 void drm_dev_printk(const struct device *dev, const char *level,
 		    const char *format, ...);
Signature · 6 lines
2.20.1

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel