* [PATCH v2 0/9] drm/print: add and use drm_debug_enabled()
@ 2019-09-24 12:58 Jani Nikula
2019-09-24 12:58 ` [PATCH v2 1/9] drm/print: move drm_debug variable to drm_print.[ch] Jani Nikula
` (9 more replies)
0 siblings, 10 replies; 22+ messages in thread
From: Jani Nikula @ 2019-09-24 12:58 UTC (permalink / raw)
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: David Zhou, Francisco Jerez, jani.nikula-ral2JQCrhuEAvxtiuMwx3w,
nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Russell King,
Christian Gmeiner, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
etnaviv-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Eric Engestrom,
Rob Clark, Ben Skeggs, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
Alex Deucher, freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
Sean Paul, Christian König, Lucas Stach
Hi all, v2 of [1], 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: Eric Engestrom <eric.engestrom@intel.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: David (ChunMing) Zhou <David1.Zhou@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: nouveau@lists.freedesktop.org
Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <sean@poorly.run>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Cc: Francisco Jerez <currojerez@riseup.net>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Russell King <linux+etnaviv@armlinux.org.uk>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: etnaviv@lists.freedesktop.org
[1] http://mid.mail-archive.com/cover.1568375189.git.jani.nikula@intel.com
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(-)
--
2.20.1
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v2 1/9] drm/print: move drm_debug variable to drm_print.[ch]
2019-09-24 12:58 [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Jani Nikula
@ 2019-09-24 12:58 ` Jani Nikula
2019-09-24 17:45 ` Alex Deucher
2019-09-24 12:58 ` [PATCH v2 2/9] drm/print: add drm_debug_enabled() Jani Nikula
` (8 subsequent siblings)
9 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2019-09-24 12:58 UTC (permalink / raw)
To: dri-devel; +Cc: jani.nikula, intel-gfx
Move drm_debug variable declaration and definition to where they are
relevant and needed. No functional changes.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
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(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 769feefeeeef..1b9b40a1c7c9 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -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;
diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index dfa27367ebb8..c9b57012d412 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -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;
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index 8976afe48c1c..cf13470810a5 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -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);
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 12d4916254b4..e5c421abce48 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -34,6 +34,8 @@
#include <drm/drm.h>
+extern unsigned int drm_debug;
+
/**
* DOC: print
*
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 2/9] drm/print: add drm_debug_enabled()
2019-09-24 12:58 [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Jani Nikula
2019-09-24 12:58 ` [PATCH v2 1/9] drm/print: move drm_debug variable to drm_print.[ch] Jani Nikula
@ 2019-09-24 12:58 ` Jani Nikula
2019-09-24 17:45 ` Alex Deucher
2019-10-01 14:06 ` [PATCH v3] " Jani Nikula
2019-09-24 12:58 ` [PATCH v2 3/9] drm/etnaviv: use drm_debug_enabled() to check for debug categories Jani Nikula
` (7 subsequent siblings)
9 siblings, 2 replies; 22+ messages in thread
From: Jani Nikula @ 2019-09-24 12:58 UTC (permalink / raw)
To: dri-devel; +Cc: jani.nikula, intel-gfx
Add helper to check if a drm debug category is enabled. Convert drm core
to use it. No functional changes.
v2: Move unlikely() to drm_debug_enabled() (Eric)
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
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(-)
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 7a26bfb5329c..0d466d3b0809 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -1405,7 +1405,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 (drm_debug_enabled(DRM_UT_STATE))
drm_atomic_print_state(state);
ret = drm_atomic_commit(state);
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 97216099a718..5b41dc167816 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -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 (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 (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 (drm_debug_enabled(DRM_UT_DP)) {
struct drm_printer p = drm_debug_printer(DBG_PREFIX);
drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 3c9703b08491..0552175313cb 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1651,7 +1651,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,
diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c
index d38b3b255926..37d8ba3ddb46 100644
--- a/drivers/gpu/drm/drm_edid_load.c
+++ b/drivers/gpu/drm/drm_edid_load.c
@@ -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) {
diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index f8154316a3b0..ccfb5b33c5e3 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -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);
diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index c9b57012d412..a7c89ec5ff26 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -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);
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 9c6899758bc9..4f7962b6427b 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -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;
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index e5c421abce48..4618e90cd124 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -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 unlikely(drm_debug & category);
+}
+
__printf(3, 4)
void drm_dev_printk(const struct device *dev, const char *level,
const char *format, ...);
--
2.20.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 3/9] drm/etnaviv: use drm_debug_enabled() to check for debug categories
2019-09-24 12:58 [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Jani Nikula
2019-09-24 12:58 ` [PATCH v2 1/9] drm/print: move drm_debug variable to drm_print.[ch] Jani Nikula
2019-09-24 12:58 ` [PATCH v2 2/9] drm/print: add drm_debug_enabled() Jani Nikula
@ 2019-09-24 12:58 ` Jani Nikula
2019-09-24 12:59 ` [PATCH v2 4/9] drm/i2c/sil164: " Jani Nikula
` (6 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: Jani Nikula @ 2019-09-24 12:58 UTC (permalink / raw)
To: dri-devel; +Cc: jani.nikula, intel-gfx, etnaviv, Russell King, Lucas Stach
Allow better abstraction of the drm_debug global variable in the
future. No functional changes.
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Russell King <linux+etnaviv@armlinux.org.uk>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: etnaviv@lists.freedesktop.org
Acked-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
index 7e4e2959bf4f..32d9fac587f9 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
@@ -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);
}
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 4/9] drm/i2c/sil164: use drm_debug_enabled() to check for debug categories
2019-09-24 12:58 [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Jani Nikula
` (2 preceding siblings ...)
2019-09-24 12:58 ` [PATCH v2 3/9] drm/etnaviv: use drm_debug_enabled() to check for debug categories Jani Nikula
@ 2019-09-24 12:59 ` Jani Nikula
2019-09-24 19:29 ` Francisco Jerez
2019-09-24 12:59 ` [PATCH v2 5/9] drm/i915: " Jani Nikula
` (5 subsequent siblings)
9 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2019-09-24 12:59 UTC (permalink / raw)
To: dri-devel; +Cc: jani.nikula, intel-gfx
Allow better abstraction of the drm_debug global variable in the
future. No functional changes.
Cc: Francisco Jerez <currojerez@riseup.net>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
drivers/gpu/drm/i2c/sil164_drv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i2c/sil164_drv.c b/drivers/gpu/drm/i2c/sil164_drv.c
index 8bcf0d199145..a839f78a4c8a 100644
--- a/drivers/gpu/drm/i2c/sil164_drv.c
+++ b/drivers/gpu/drm/i2c/sil164_drv.c
@@ -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)
--
2.20.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 5/9] drm/i915: use drm_debug_enabled() to check for debug categories
2019-09-24 12:58 [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Jani Nikula
` (3 preceding siblings ...)
2019-09-24 12:59 ` [PATCH v2 4/9] drm/i2c/sil164: " Jani Nikula
@ 2019-09-24 12:59 ` Jani Nikula
[not found] ` <cover.1569329774.git.jani.nikula-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
` (4 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: Jani Nikula @ 2019-09-24 12:59 UTC (permalink / raw)
To: dri-devel; +Cc: jani.nikula, intel-gfx
Allow better abstraction of the drm_debug global variable in the
future. No functional changes.
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
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(-)
diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
index 5ecf54270181..621460b1a551 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -12041,7 +12041,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);
@@ -12557,7 +12557,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);
diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c
index 829559f97440..f6960555403d 100644
--- a/drivers/gpu/drm/i915/display/intel_dp.c
+++ b/drivers/gpu/drm/i915/display/intel_dp.c
@@ -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),
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index a9ee73b61f4d..5aff93642325 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1455,7 +1455,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",
diff --git a/drivers/gpu/drm/i915/i915_gem.h b/drivers/gpu/drm/i915/i915_gem.h
index 167a7b56ed5b..a49b39e896b7 100644
--- a/drivers/gpu/drm/i915/i915_gem.h
+++ b/drivers/gpu/drm/i915/i915_gem.h
@@ -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", \
diff --git a/drivers/gpu/drm/i915/i915_utils.c b/drivers/gpu/drm/i915/i915_utils.c
index 16acdf7bdbe6..f66540e15793 100644
--- a/drivers/gpu/drm/i915/i915_utils.c
+++ b/drivers/gpu/drm/i915/i915_utils.c
@@ -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);
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 6aa40f546226..3d4ccdf849a5 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -5342,7 +5342,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,
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 6/9] drm/msm: use drm_debug_enabled() to check for debug categories
[not found] ` <cover.1569329774.git.jani.nikula-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2019-09-24 12:59 ` Jani Nikula
2019-10-02 14:11 ` [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Jani Nikula
1 sibling, 0 replies; 22+ messages in thread
From: Jani Nikula @ 2019-09-24 12:59 UTC (permalink / raw)
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: Sean Paul, jani.nikula-ral2JQCrhuEAvxtiuMwx3w,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Rob Clark,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Allow better abstraction of the drm_debug global variable in the
future. No functional changes.
v2: Move unlikely() to drm_debug_enabled()
Cc: Rob Clark <robdclark@gmail.com>
Cc: Sean Paul <sean@poorly.run>
Cc: linux-arm-msm@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Reviewed-by: Rob Clark <robdclark@gmail.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
index 4c889aabdaf9..959d03e007fa 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
@@ -31,7 +31,7 @@
*/
#define DPU_DEBUG(fmt, ...) \
do { \
- if (unlikely(drm_debug & DRM_UT_KMS)) \
+ if (drm_debug_enabled(DRM_UT_KMS)) \
DRM_DEBUG(fmt, ##__VA_ARGS__); \
else \
pr_debug(fmt, ##__VA_ARGS__); \
@@ -43,7 +43,7 @@
*/
#define DPU_DEBUG_DRIVER(fmt, ...) \
do { \
- if (unlikely(drm_debug & DRM_UT_DRIVER)) \
+ if (drm_debug_enabled(DRM_UT_DRIVER)) \
DRM_ERROR(fmt, ##__VA_ARGS__); \
else \
pr_debug(fmt, ##__VA_ARGS__); \
--
2.20.1
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 7/9] drm/nouveau: use drm_debug_enabled() to check for debug categories
2019-09-24 12:58 [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Jani Nikula
` (5 preceding siblings ...)
[not found] ` <cover.1569329774.git.jani.nikula-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2019-09-24 12:59 ` Jani Nikula
2019-09-24 12:59 ` [PATCH v2 8/9] drm/amdgpu: " Jani Nikula
` (2 subsequent siblings)
9 siblings, 0 replies; 22+ messages in thread
From: Jani Nikula @ 2019-09-24 12:59 UTC (permalink / raw)
To: dri-devel; +Cc: jani.nikula, nouveau, intel-gfx, Ben Skeggs
Allow better abstraction of the drm_debug global variable in the
future. No functional changes.
v2: move unlikely() to drm_debug_enabled()
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
drivers/gpu/drm/nouveau/dispnv50/disp.h | 4 ++--
drivers/gpu/drm/nouveau/nouveau_drv.h | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.h b/drivers/gpu/drm/nouveau/dispnv50/disp.h
index 7c41b0599d1a..c0a79531b087 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.h
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.h
@@ -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)
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h
index 70f34cacc552..da8c46e09943 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drv.h
+++ b/drivers/gpu/drm/nouveau/nouveau_drv.h
@@ -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 (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 (drm_debug_enabled(DRM_UT_ATOMIC)) \
NV_PRINTK(info, &(drm)->client, f, ##a); \
} while(0)
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 8/9] drm/amdgpu: use drm_debug_enabled() to check for debug categories
2019-09-24 12:58 [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Jani Nikula
` (6 preceding siblings ...)
2019-09-24 12:59 ` [PATCH v2 7/9] drm/nouveau: use drm_debug_enabled() to check for debug categories Jani Nikula
@ 2019-09-24 12:59 ` Jani Nikula
2019-09-24 17:44 ` Alex Deucher
2019-09-24 12:59 ` [PATCH v2 9/9] drm/print: rename drm_debug to __drm_debug to discourage use Jani Nikula
2019-09-26 7:48 ` [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Eric Engestrom
9 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2019-09-24 12:59 UTC (permalink / raw)
To: dri-devel
Cc: jani.nikula, intel-gfx, amd-gfx, Alex Deucher, Christian König
Allow better abstraction of the drm_debug global variable in the
future. No functional changes.
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: David (ChunMing) Zhou <David1.Zhou@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c b/drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c
index 4a5951036927..5f17bd4899e2 100644
--- a/drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c
+++ b/drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c
@@ -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);
}
--
2.20.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH v2 9/9] drm/print: rename drm_debug to __drm_debug to discourage use
2019-09-24 12:58 [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Jani Nikula
` (7 preceding siblings ...)
2019-09-24 12:59 ` [PATCH v2 8/9] drm/amdgpu: " Jani Nikula
@ 2019-09-24 12:59 ` Jani Nikula
2019-09-24 17:46 ` Alex Deucher
2019-09-26 7:48 ` [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Eric Engestrom
9 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2019-09-24 12:59 UTC (permalink / raw)
To: dri-devel; +Cc: jani.nikula, intel-gfx
drm_debug_enabled() is the way to check. __drm_debug is now reserved for
drm print code only. No functional changes.
v2: Rebase on move unlikely() to drm_debug_enabled()
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
drivers/gpu/drm/drm_print.c | 8 ++++----
include/drm/drm_print.h | 5 +++--
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index a7c89ec5ff26..ca3c56b026f0 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -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)
{
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index 4618e90cd124..cde54900d593 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -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 unlikely(drm_debug & category);
+ return unlikely(__drm_debug & category);
}
__printf(3, 4)
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH v2 8/9] drm/amdgpu: use drm_debug_enabled() to check for debug categories
2019-09-24 12:59 ` [PATCH v2 8/9] drm/amdgpu: " Jani Nikula
@ 2019-09-24 17:44 ` Alex Deucher
0 siblings, 0 replies; 22+ messages in thread
From: Alex Deucher @ 2019-09-24 17:44 UTC (permalink / raw)
To: Jani Nikula
Cc: Alex Deucher, Intel Graphics Development, amd-gfx list,
Maling list - DRI developers, Christian König
On Tue, Sep 24, 2019 at 9:00 AM Jani Nikula <jani.nikula@intel.com> wrote:
>
> Allow better abstraction of the drm_debug global variable in the
> future. No functional changes.
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: David (ChunMing) Zhou <David1.Zhou@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c b/drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c
> index 4a5951036927..5f17bd4899e2 100644
> --- a/drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c
> +++ b/drivers/gpu/drm/amd/amdgpu/smu_v11_0_i2c.c
> @@ -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);
> }
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 1/9] drm/print: move drm_debug variable to drm_print.[ch]
2019-09-24 12:58 ` [PATCH v2 1/9] drm/print: move drm_debug variable to drm_print.[ch] Jani Nikula
@ 2019-09-24 17:45 ` Alex Deucher
0 siblings, 0 replies; 22+ messages in thread
From: Alex Deucher @ 2019-09-24 17:45 UTC (permalink / raw)
To: Jani Nikula; +Cc: Intel Graphics Development, Maling list - DRI developers
On Tue, Sep 24, 2019 at 8:59 AM Jani Nikula <jani.nikula@intel.com> wrote:
>
> Move drm_debug variable declaration and definition to where they are
> relevant and needed. No functional changes.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> index 769feefeeeef..1b9b40a1c7c9 100644
> --- a/drivers/gpu/drm/drm_drv.c
> +++ b/drivers/gpu/drm/drm_drv.c
> @@ -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;
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index dfa27367ebb8..c9b57012d412 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -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;
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index 8976afe48c1c..cf13470810a5 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -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);
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 12d4916254b4..e5c421abce48 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -34,6 +34,8 @@
>
> #include <drm/drm.h>
>
> +extern unsigned int drm_debug;
> +
> /**
> * DOC: print
> *
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 2/9] drm/print: add drm_debug_enabled()
2019-09-24 12:58 ` [PATCH v2 2/9] drm/print: add drm_debug_enabled() Jani Nikula
@ 2019-09-24 17:45 ` Alex Deucher
2019-10-01 14:06 ` [PATCH v3] " Jani Nikula
1 sibling, 0 replies; 22+ messages in thread
From: Alex Deucher @ 2019-09-24 17:45 UTC (permalink / raw)
To: Jani Nikula; +Cc: Intel Graphics Development, Maling list - DRI developers
On Tue, Sep 24, 2019 at 8:59 AM Jani Nikula <jani.nikula@intel.com> wrote:
>
> Add helper to check if a drm debug category is enabled. Convert drm core
> to use it. No functional changes.
>
> v2: Move unlikely() to drm_debug_enabled() (Eric)
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 7a26bfb5329c..0d466d3b0809 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -1405,7 +1405,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 (drm_debug_enabled(DRM_UT_STATE))
> drm_atomic_print_state(state);
>
> ret = drm_atomic_commit(state);
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 97216099a718..5b41dc167816 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -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 (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 (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 (drm_debug_enabled(DRM_UT_DP)) {
> struct drm_printer p = drm_debug_printer(DBG_PREFIX);
>
> drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 3c9703b08491..0552175313cb 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -1651,7 +1651,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,
> diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c
> index d38b3b255926..37d8ba3ddb46 100644
> --- a/drivers/gpu/drm/drm_edid_load.c
> +++ b/drivers/gpu/drm/drm_edid_load.c
> @@ -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) {
> diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
> index f8154316a3b0..ccfb5b33c5e3 100644
> --- a/drivers/gpu/drm/drm_mipi_dbi.c
> +++ b/drivers/gpu/drm/drm_mipi_dbi.c
> @@ -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);
>
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index c9b57012d412..a7c89ec5ff26 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -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);
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 9c6899758bc9..4f7962b6427b 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -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;
>
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index e5c421abce48..4618e90cd124 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -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 unlikely(drm_debug & category);
> +}
> +
> __printf(3, 4)
> void drm_dev_printk(const struct device *dev, const char *level,
> const char *format, ...);
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 9/9] drm/print: rename drm_debug to __drm_debug to discourage use
2019-09-24 12:59 ` [PATCH v2 9/9] drm/print: rename drm_debug to __drm_debug to discourage use Jani Nikula
@ 2019-09-24 17:46 ` Alex Deucher
0 siblings, 0 replies; 22+ messages in thread
From: Alex Deucher @ 2019-09-24 17:46 UTC (permalink / raw)
To: Jani Nikula; +Cc: Intel Graphics Development, Maling list - DRI developers
On Tue, Sep 24, 2019 at 9:00 AM Jani Nikula <jani.nikula@intel.com> wrote:
>
> drm_debug_enabled() is the way to check. __drm_debug is now reserved for
> drm print code only. No functional changes.
>
> v2: Rebase on move unlikely() to drm_debug_enabled()
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/gpu/drm/drm_print.c | 8 ++++----
> include/drm/drm_print.h | 5 +++--
> 2 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index a7c89ec5ff26..ca3c56b026f0 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -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)
> {
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 4618e90cd124..cde54900d593 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -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 unlikely(drm_debug & category);
> + return unlikely(__drm_debug & category);
> }
>
> __printf(3, 4)
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 4/9] drm/i2c/sil164: use drm_debug_enabled() to check for debug categories
2019-09-24 12:59 ` [PATCH v2 4/9] drm/i2c/sil164: " Jani Nikula
@ 2019-09-24 19:29 ` Francisco Jerez
0 siblings, 0 replies; 22+ messages in thread
From: Francisco Jerez @ 2019-09-24 19:29 UTC (permalink / raw)
To: dri-devel; +Cc: jani.nikula, intel-gfx
[-- Attachment #1.1.1: Type: text/plain, Size: 1008 bytes --]
Jani Nikula <jani.nikula@intel.com> writes:
> Allow better abstraction of the drm_debug global variable in the
> future. No functional changes.
>
> Cc: Francisco Jerez <currojerez@riseup.net>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Reviewed-by: Francisco Jerez <currojerez@riseup.net>
> ---
> drivers/gpu/drm/i2c/sil164_drv.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i2c/sil164_drv.c b/drivers/gpu/drm/i2c/sil164_drv.c
> index 8bcf0d199145..a839f78a4c8a 100644
> --- a/drivers/gpu/drm/i2c/sil164_drv.c
> +++ b/drivers/gpu/drm/i2c/sil164_drv.c
> @@ -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)
> --
> 2.20.1
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]
[-- Attachment #2: Type: text/plain, Size: 159 bytes --]
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 0/9] drm/print: add and use drm_debug_enabled()
2019-09-24 12:58 [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Jani Nikula
` (8 preceding siblings ...)
2019-09-24 12:59 ` [PATCH v2 9/9] drm/print: rename drm_debug to __drm_debug to discourage use Jani Nikula
@ 2019-09-26 7:48 ` Eric Engestrom
[not found] ` <20190926074814.rdzxjmut6izqf4d5-op+oiCINJLTt9jDmeYuA0g@public.gmane.org>
9 siblings, 1 reply; 22+ messages in thread
From: Eric Engestrom @ 2019-09-26 7:48 UTC (permalink / raw)
To: Jani Nikula
Cc: nouveau, intel-gfx, Russell King, amd-gfx, etnaviv, dri-devel,
linux-arm-msm, Alex Deucher, freedreno, Sean Paul,
Christian König, Ben Skeggs
On Tuesday, 2019-09-24 15:58:56 +0300, Jani Nikula wrote:
> Hi all, v2 of [1], 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: Eric Engestrom <eric.engestrom@intel.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: David (ChunMing) Zhou <David1.Zhou@amd.com>
> Cc: amd-gfx@lists.freedesktop.org
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: nouveau@lists.freedesktop.org
> Cc: Rob Clark <robdclark@gmail.com>
> Cc: Sean Paul <sean@poorly.run>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: freedreno@lists.freedesktop.org
> Cc: Francisco Jerez <currojerez@riseup.net>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: Russell King <linux+etnaviv@armlinux.org.uk>
> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
> Cc: etnaviv@lists.freedesktop.org
>
>
> [1] http://mid.mail-archive.com/cover.1568375189.git.jani.nikula@intel.com
>
> Jani Nikula (9):
> drm/print: move drm_debug variable to drm_print.[ch]
> drm/print: add drm_debug_enabled()
> drm/i915: use drm_debug_enabled() to check for debug categories
> drm/print: rename drm_debug to __drm_debug to discourage use
The above four patches are:
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Did you check to make sure the `unlikely()` is propagated correctly
outside the `drm_debug_enabled()` call?
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 0/9] drm/print: add and use drm_debug_enabled()
[not found] ` <20190926074814.rdzxjmut6izqf4d5-op+oiCINJLTt9jDmeYuA0g@public.gmane.org>
@ 2019-10-01 11:03 ` Jani Nikula
[not found] ` <875zl8d8x0.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2019-10-01 11:03 UTC (permalink / raw)
To: Eric Engestrom
Cc: David Zhou, nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Russell King,
Christian Gmeiner, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
etnaviv-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Rob Clark, Lucas Stach,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Alex Deucher,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Sean Paul,
Christian König, Ben Skeggs
On Thu, 26 Sep 2019, Eric Engestrom <eric@engestrom.ch> wrote:
> On Tuesday, 2019-09-24 15:58:56 +0300, Jani Nikula wrote:
>> Hi all, v2 of [1], 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: Eric Engestrom <eric.engestrom@intel.com>
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>> Cc: Christian König <christian.koenig@amd.com>
>> Cc: David (ChunMing) Zhou <David1.Zhou@amd.com>
>> Cc: amd-gfx@lists.freedesktop.org
>> Cc: Ben Skeggs <bskeggs@redhat.com>
>> Cc: nouveau@lists.freedesktop.org
>> Cc: Rob Clark <robdclark@gmail.com>
>> Cc: Sean Paul <sean@poorly.run>
>> Cc: linux-arm-msm@vger.kernel.org
>> Cc: freedreno@lists.freedesktop.org
>> Cc: Francisco Jerez <currojerez@riseup.net>
>> Cc: Lucas Stach <l.stach@pengutronix.de>
>> Cc: Russell King <linux+etnaviv@armlinux.org.uk>
>> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
>> Cc: etnaviv@lists.freedesktop.org
>>
>>
>> [1] http://mid.mail-archive.com/cover.1568375189.git.jani.nikula@intel.com
>>
>> Jani Nikula (9):
>> drm/print: move drm_debug variable to drm_print.[ch]
>> drm/print: add drm_debug_enabled()
>> drm/i915: use drm_debug_enabled() to check for debug categories
>> drm/print: rename drm_debug to __drm_debug to discourage use
>
> The above four patches are:
> Reviewed-by: Eric Engestrom <eric@engestrom.ch>
>
> Did you check to make sure the `unlikely()` is propagated correctly
> outside the `drm_debug_enabled()` call?
I did now.
Having drm_debug_enabled() as a macro vs. as an inline function does not
seem to make a difference, so I think the inline is clearly preferrable.
However, for example
unlikely(foo && drm_debug & DRM_UT_DP)
does produce code different from
(foo && drm_debug_enabled(DRM_UT_DP))
indicating that the unlikely() within drm_debug_enabled() does not
propagate to the whole condition. It's possible to retain the same
assembly output with
(unlikely(foo) && drm_debug_enabled(DRM_UT_DP))
but it's unclear to me whether this is really worth it, either
readability or performance wise.
Thoughts?
BR,
Jani.
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 0/9] drm/print: add and use drm_debug_enabled()
[not found] ` <875zl8d8x0.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
@ 2019-10-01 12:34 ` Eric Engestrom
[not found] ` <20191001123444.xtp7wpickwjus4m2-op+oiCINJLTt9jDmeYuA0g@public.gmane.org>
0 siblings, 1 reply; 22+ messages in thread
From: Eric Engestrom @ 2019-10-01 12:34 UTC (permalink / raw)
To: Jani Nikula
Cc: David Zhou, Francisco Jerez,
nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Russell King,
Christian Gmeiner, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
etnaviv-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Rob Clark, Lucas Stach,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Alex Deucher,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Sean Paul,
Christian König, Ben Skeggs
On Tuesday, 2019-10-01 14:03:55 +0300, Jani Nikula wrote:
> On Thu, 26 Sep 2019, Eric Engestrom <eric@engestrom.ch> wrote:
> > On Tuesday, 2019-09-24 15:58:56 +0300, Jani Nikula wrote:
> >> Hi all, v2 of [1], 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: Eric Engestrom <eric.engestrom@intel.com>
> >> Cc: Alex Deucher <alexander.deucher@amd.com>
> >> Cc: Christian König <christian.koenig@amd.com>
> >> Cc: David (ChunMing) Zhou <David1.Zhou@amd.com>
> >> Cc: amd-gfx@lists.freedesktop.org
> >> Cc: Ben Skeggs <bskeggs@redhat.com>
> >> Cc: nouveau@lists.freedesktop.org
> >> Cc: Rob Clark <robdclark@gmail.com>
> >> Cc: Sean Paul <sean@poorly.run>
> >> Cc: linux-arm-msm@vger.kernel.org
> >> Cc: freedreno@lists.freedesktop.org
> >> Cc: Francisco Jerez <currojerez@riseup.net>
> >> Cc: Lucas Stach <l.stach@pengutronix.de>
> >> Cc: Russell King <linux+etnaviv@armlinux.org.uk>
> >> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
> >> Cc: etnaviv@lists.freedesktop.org
> >>
> >>
> >> [1] http://mid.mail-archive.com/cover.1568375189.git.jani.nikula@intel.com
> >>
> >> Jani Nikula (9):
> >> drm/print: move drm_debug variable to drm_print.[ch]
> >> drm/print: add drm_debug_enabled()
> >> drm/i915: use drm_debug_enabled() to check for debug categories
> >> drm/print: rename drm_debug to __drm_debug to discourage use
> >
> > The above four patches are:
> > Reviewed-by: Eric Engestrom <eric@engestrom.ch>
> >
> > Did you check to make sure the `unlikely()` is propagated correctly
> > outside the `drm_debug_enabled()` call?
>
> I did now.
>
> Having drm_debug_enabled() as a macro vs. as an inline function does not
> seem to make a difference, so I think the inline is clearly preferrable.
Agreed :)
>
> However, for example
>
> unlikely(foo && drm_debug & DRM_UT_DP)
>
> does produce code different from
>
> (foo && drm_debug_enabled(DRM_UT_DP))
>
> indicating that the unlikely() within drm_debug_enabled() does not
> propagate to the whole condition. It's possible to retain the same
> assembly output with
>
> (unlikely(foo) && drm_debug_enabled(DRM_UT_DP))
>
> but it's unclear to me whether this is really worth it, either
> readability or performance wise.
>
> Thoughts?
That kind of code only happens 2 times, both in
drivers/gpu/drm/drm_dp_mst_topology.c (in patch 2/9), right?
I think your suggestion is the right thing to do here:
- if (unlikely(ret && drm_debug & DRM_UT_DP)) {
+ if (unlikely(ret) && drm_debug_enabled(DRM_UT_DP)) {
It doesn't really cost much in readability (especially compared to what
it was before), and whether it's important performance wise I couldn't
tell, but I think it's best to keep the code optimised as it was before
unless there's a reason to drop it.
Lyude might know more since she wrote 2f015ec6eab69301fdcf5, if you want
to ping her?
>
> BR,
> Jani.
>
>
> --
> Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH v3] drm/print: add drm_debug_enabled()
2019-09-24 12:58 ` [PATCH v2 2/9] drm/print: add drm_debug_enabled() Jani Nikula
2019-09-24 17:45 ` Alex Deucher
@ 2019-10-01 14:06 ` Jani Nikula
2019-10-01 15:02 ` Eric Engestrom
1 sibling, 1 reply; 22+ messages in thread
From: Jani Nikula @ 2019-10-01 14:06 UTC (permalink / raw)
To: Jani Nikula, dri-devel; +Cc: Alex Deucher, intel-gfx, Eric Engestrom
Add helper to check if a drm debug category is enabled. Convert drm core
to use it. No functional changes.
v2: Move unlikely() to drm_debug_enabled() (Eric)
v3: Keep unlikely() when combined with other conditions (Eric)
Cc: Eric Engestrom <eric@engestrom.ch>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
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(-)
diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
index 7a26bfb5329c..0d466d3b0809 100644
--- a/drivers/gpu/drm/drm_atomic_uapi.c
+++ b/drivers/gpu/drm/drm_atomic_uapi.c
@@ -1405,7 +1405,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 (drm_debug_enabled(DRM_UT_STATE))
drm_atomic_print_state(state);
ret = drm_atomic_commit(state);
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index e6801db54d0f..6b14b63b8d62 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -1179,7 +1179,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);
@@ -2322,7 +2322,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");
@@ -2389,7 +2389,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 (drm_debug_enabled(DRM_UT_DP)) {
struct drm_printer p = drm_debug_printer(DBG_PREFIX);
drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 3c9703b08491..0552175313cb 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -1651,7 +1651,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,
diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c
index d38b3b255926..37d8ba3ddb46 100644
--- a/drivers/gpu/drm/drm_edid_load.c
+++ b/drivers/gpu/drm/drm_edid_load.c
@@ -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) {
diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
index f8154316a3b0..ccfb5b33c5e3 100644
--- a/drivers/gpu/drm/drm_mipi_dbi.c
+++ b/drivers/gpu/drm/drm_mipi_dbi.c
@@ -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);
diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
index 1ade3a917c10..9a25d73c155c 100644
--- a/drivers/gpu/drm/drm_print.c
+++ b/drivers/gpu/drm/drm_print.c
@@ -262,7 +262,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);
@@ -285,7 +285,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);
diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
index 9c6899758bc9..4f7962b6427b 100644
--- a/drivers/gpu/drm/drm_vblank.c
+++ b/drivers/gpu/drm/drm_vblank.c
@@ -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;
diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
index fc9f218ab715..5b8049992c24 100644
--- a/include/drm/drm_print.h
+++ b/include/drm/drm_print.h
@@ -293,6 +293,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 unlikely(drm_debug & category);
+}
+
__printf(3, 4)
void drm_dev_printk(const struct device *dev, const char *level,
const char *format, ...);
--
2.20.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH v2 0/9] drm/print: add and use drm_debug_enabled()
[not found] ` <20191001123444.xtp7wpickwjus4m2-op+oiCINJLTt9jDmeYuA0g@public.gmane.org>
@ 2019-10-01 14:08 ` Jani Nikula
0 siblings, 0 replies; 22+ messages in thread
From: Jani Nikula @ 2019-10-01 14:08 UTC (permalink / raw)
To: Eric Engestrom
Cc: David Zhou, Francisco Jerez,
nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Russell King,
Christian Gmeiner, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
etnaviv-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Rob Clark, Lucas Stach,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
linux-arm-msm-u79uwXL29TY76Z2rM5mHXA, Alex Deucher,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Sean Paul,
Christian König, Ben Skeggs
On Tue, 01 Oct 2019, Eric Engestrom <eric@engestrom.ch> wrote:
> On Tuesday, 2019-10-01 14:03:55 +0300, Jani Nikula wrote:
>> On Thu, 26 Sep 2019, Eric Engestrom <eric@engestrom.ch> wrote:
>> > On Tuesday, 2019-09-24 15:58:56 +0300, Jani Nikula wrote:
>> >> Hi all, v2 of [1], 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: Eric Engestrom <eric.engestrom@intel.com>
>> >> Cc: Alex Deucher <alexander.deucher@amd.com>
>> >> Cc: Christian König <christian.koenig@amd.com>
>> >> Cc: David (ChunMing) Zhou <David1.Zhou@amd.com>
>> >> Cc: amd-gfx@lists.freedesktop.org
>> >> Cc: Ben Skeggs <bskeggs@redhat.com>
>> >> Cc: nouveau@lists.freedesktop.org
>> >> Cc: Rob Clark <robdclark@gmail.com>
>> >> Cc: Sean Paul <sean@poorly.run>
>> >> Cc: linux-arm-msm@vger.kernel.org
>> >> Cc: freedreno@lists.freedesktop.org
>> >> Cc: Francisco Jerez <currojerez@riseup.net>
>> >> Cc: Lucas Stach <l.stach@pengutronix.de>
>> >> Cc: Russell King <linux+etnaviv@armlinux.org.uk>
>> >> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
>> >> Cc: etnaviv@lists.freedesktop.org
>> >>
>> >>
>> >> [1] http://mid.mail-archive.com/cover.1568375189.git.jani.nikula@intel.com
>> >>
>> >> Jani Nikula (9):
>> >> drm/print: move drm_debug variable to drm_print.[ch]
>> >> drm/print: add drm_debug_enabled()
>> >> drm/i915: use drm_debug_enabled() to check for debug categories
>> >> drm/print: rename drm_debug to __drm_debug to discourage use
>> >
>> > The above four patches are:
>> > Reviewed-by: Eric Engestrom <eric@engestrom.ch>
>> >
>> > Did you check to make sure the `unlikely()` is propagated correctly
>> > outside the `drm_debug_enabled()` call?
>>
>> I did now.
>>
>> Having drm_debug_enabled() as a macro vs. as an inline function does not
>> seem to make a difference, so I think the inline is clearly preferrable.
>
> Agreed :)
>
>>
>> However, for example
>>
>> unlikely(foo && drm_debug & DRM_UT_DP)
>>
>> does produce code different from
>>
>> (foo && drm_debug_enabled(DRM_UT_DP))
>>
>> indicating that the unlikely() within drm_debug_enabled() does not
>> propagate to the whole condition. It's possible to retain the same
>> assembly output with
>>
>> (unlikely(foo) && drm_debug_enabled(DRM_UT_DP))
>>
>> but it's unclear to me whether this is really worth it, either
>> readability or performance wise.
>>
>> Thoughts?
>
> That kind of code only happens 2 times, both in
> drivers/gpu/drm/drm_dp_mst_topology.c (in patch 2/9), right?
>
> I think your suggestion is the right thing to do here:
>
> - if (unlikely(ret && drm_debug & DRM_UT_DP)) {
> + if (unlikely(ret) && drm_debug_enabled(DRM_UT_DP)) {
>
> It doesn't really cost much in readability (especially compared to what
> it was before), and whether it's important performance wise I couldn't
> tell, but I think it's best to keep the code optimised as it was before
> unless there's a reason to drop it.
>
> Lyude might know more since she wrote 2f015ec6eab69301fdcf5, if you want
> to ping her?
Just ended up sending the updated version with what you suggest and I
agree with; pedantically the change should be a separate patch anyway.
Thanks for your inputs.
BR,
Jani.
>
>>
>> BR,
>> Jani.
>>
>>
>> --
>> Jani Nikula, Intel Open Source Graphics Center
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v3] drm/print: add drm_debug_enabled()
2019-10-01 14:06 ` [PATCH v3] " Jani Nikula
@ 2019-10-01 15:02 ` Eric Engestrom
0 siblings, 0 replies; 22+ messages in thread
From: Eric Engestrom @ 2019-10-01 15:02 UTC (permalink / raw)
To: Jani Nikula; +Cc: Alex Deucher, intel-gfx, dri-devel
On Tuesday, 2019-10-01 17:06:14 +0300, Jani Nikula wrote:
> Add helper to check if a drm debug category is enabled. Convert drm core
> to use it. No functional changes.
>
> v2: Move unlikely() to drm_debug_enabled() (Eric)
>
> v3: Keep unlikely() when combined with other conditions (Eric)
>
> Cc: Eric Engestrom <eric@engestrom.ch>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
> Acked-by: Alex Deucher <alexander.deucher@amd.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> 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(-)
>
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 7a26bfb5329c..0d466d3b0809 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -1405,7 +1405,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 (drm_debug_enabled(DRM_UT_STATE))
> drm_atomic_print_state(state);
>
> ret = drm_atomic_commit(state);
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
> index e6801db54d0f..6b14b63b8d62 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -1179,7 +1179,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);
> @@ -2322,7 +2322,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");
> @@ -2389,7 +2389,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 (drm_debug_enabled(DRM_UT_DP)) {
> struct drm_printer p = drm_debug_printer(DBG_PREFIX);
>
> drm_dp_mst_dump_sideband_msg_tx(&p, txmsg);
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 3c9703b08491..0552175313cb 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -1651,7 +1651,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,
> diff --git a/drivers/gpu/drm/drm_edid_load.c b/drivers/gpu/drm/drm_edid_load.c
> index d38b3b255926..37d8ba3ddb46 100644
> --- a/drivers/gpu/drm/drm_edid_load.c
> +++ b/drivers/gpu/drm/drm_edid_load.c
> @@ -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) {
> diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c
> index f8154316a3b0..ccfb5b33c5e3 100644
> --- a/drivers/gpu/drm/drm_mipi_dbi.c
> +++ b/drivers/gpu/drm/drm_mipi_dbi.c
> @@ -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);
>
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index 1ade3a917c10..9a25d73c155c 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -262,7 +262,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);
> @@ -285,7 +285,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);
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index 9c6899758bc9..4f7962b6427b 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -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;
>
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index fc9f218ab715..5b8049992c24 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -293,6 +293,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 unlikely(drm_debug & category);
> +}
> +
> __printf(3, 4)
> void drm_dev_printk(const struct device *dev, const char *level,
> const char *format, ...);
> --
> 2.20.1
>
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH v2 0/9] drm/print: add and use drm_debug_enabled()
[not found] ` <cover.1569329774.git.jani.nikula-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-09-24 12:59 ` [PATCH v2 6/9] drm/msm: " Jani Nikula
@ 2019-10-02 14:11 ` Jani Nikula
1 sibling, 0 replies; 22+ messages in thread
From: Jani Nikula @ 2019-10-02 14:11 UTC (permalink / raw)
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
Cc: David Zhou, Francisco Jerez,
nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
intel-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Russell King,
Christian Gmeiner, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
etnaviv-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, Eric Engestrom,
Rob Clark, Ben Skeggs, linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
Alex Deucher, freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
Sean Paul, Christian König, Lucas Stach
On Tue, 24 Sep 2019, Jani Nikula <jani.nikula@intel.com> wrote:
> 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/msm: use drm_debug_enabled() to check for debug categories
Pushed the above patches to drm-misc-next, thanks for the reviews and
acks!
The below i915 and amdgpu patches conflict on drm-misc-next, and I
haven't received any feedback on nouveau.
> drm/i915: 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
BR,
Jani.
--
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2019-10-02 14:11 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-24 12:58 [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Jani Nikula
2019-09-24 12:58 ` [PATCH v2 1/9] drm/print: move drm_debug variable to drm_print.[ch] Jani Nikula
2019-09-24 17:45 ` Alex Deucher
2019-09-24 12:58 ` [PATCH v2 2/9] drm/print: add drm_debug_enabled() Jani Nikula
2019-09-24 17:45 ` Alex Deucher
2019-10-01 14:06 ` [PATCH v3] " Jani Nikula
2019-10-01 15:02 ` Eric Engestrom
2019-09-24 12:58 ` [PATCH v2 3/9] drm/etnaviv: use drm_debug_enabled() to check for debug categories Jani Nikula
2019-09-24 12:59 ` [PATCH v2 4/9] drm/i2c/sil164: " Jani Nikula
2019-09-24 19:29 ` Francisco Jerez
2019-09-24 12:59 ` [PATCH v2 5/9] drm/i915: " Jani Nikula
[not found] ` <cover.1569329774.git.jani.nikula-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-09-24 12:59 ` [PATCH v2 6/9] drm/msm: " Jani Nikula
2019-10-02 14:11 ` [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Jani Nikula
2019-09-24 12:59 ` [PATCH v2 7/9] drm/nouveau: use drm_debug_enabled() to check for debug categories Jani Nikula
2019-09-24 12:59 ` [PATCH v2 8/9] drm/amdgpu: " Jani Nikula
2019-09-24 17:44 ` Alex Deucher
2019-09-24 12:59 ` [PATCH v2 9/9] drm/print: rename drm_debug to __drm_debug to discourage use Jani Nikula
2019-09-24 17:46 ` Alex Deucher
2019-09-26 7:48 ` [PATCH v2 0/9] drm/print: add and use drm_debug_enabled() Eric Engestrom
[not found] ` <20190926074814.rdzxjmut6izqf4d5-op+oiCINJLTt9jDmeYuA0g@public.gmane.org>
2019-10-01 11:03 ` Jani Nikula
[not found] ` <875zl8d8x0.fsf-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-10-01 12:34 ` Eric Engestrom
[not found] ` <20191001123444.xtp7wpickwjus4m2-op+oiCINJLTt9jDmeYuA0g@public.gmane.org>
2019-10-01 14:08 ` Jani Nikula
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).