From 393389347c75114ad2b793134f87769db683699f Mon Sep 17 00:00:00 2001 From: Mihail Atanassov Date: Thu, 7 Nov 2019 11:42:36 +0000 Subject: [PATCH] drm/komeda: Optionally dump DRM state on interrupts It's potentially useful information when diagnosing error/warn IRQs, so dump it to dmesg with a drm_info_printer. Hide this extra debug dumping behind another komeda_dev->err_verbosity bit. Note that there's not much sense in dumping it for INFO events, since the VSYNC event will swamp the log. Reviewed-by: James Qian Wang (Arm Technology China) Acked-by: Liviu Dudau Signed-off-by: Mihail Atanassov Link: https://patchwork.freedesktop.org/patch/msgid/20191107114155.54307-4-mihail.atanassov@arm.com --- drivers/gpu/drm/arm/display/komeda/komeda_dev.h | 5 ++++- drivers/gpu/drm/arm/display/komeda/komeda_event.c | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h index 831c375..4809000 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_dev.h +++ b/drivers/gpu/drm/arm/display/komeda/komeda_dev.h @@ -205,11 +205,14 @@ struct komeda_dev { /** * @err_verbosity: bitmask for how much extra info to print on error * - * See KOMEDA_DEV_* macros for details. + * See KOMEDA_DEV_* macros for details. Low byte contains the debug + * level categories, the high byte contains extra debug options. */ u16 err_verbosity; /* Print a single line per error per frame with error events. */ #define KOMEDA_DEV_PRINT_ERR_EVENTS BIT(0) + /* Dump DRM state on an error or warning event. */ +#define KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT BIT(8) }; static inline bool diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_event.c b/drivers/gpu/drm/arm/display/komeda/komeda_event.c index 575ed4d..de99a58 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_event.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_event.c @@ -4,6 +4,7 @@ * Author: James.Qian.Wang * */ +#include #include #include "komeda_dev.h" @@ -113,6 +114,7 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev) static bool en_print = true; struct komeda_dev *mdev = dev->dev_private; u16 const err_verbosity = mdev->err_verbosity; + u64 evts_mask = evts->global | evts->pipes[0] | evts->pipes[1]; /* reduce the same msg print, only print the first evt for one frame */ if (evts->global || is_new_frame(evts)) @@ -123,9 +125,10 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev) if (err_verbosity & KOMEDA_DEV_PRINT_ERR_EVENTS) print_evts |= KOMEDA_ERR_EVENTS; - if ((evts->global | evts->pipes[0] | evts->pipes[1]) & print_evts) { + if (evts_mask & print_evts) { char msg[256]; struct komeda_str str; + struct drm_printer p = drm_info_printer(dev->dev); str.str = msg; str.sz = sizeof(msg); @@ -139,6 +142,9 @@ void komeda_print_events(struct komeda_events *evts, struct drm_device *dev) evt_str(&str, evts->pipes[1]); DRM_ERROR("err detect: %s\n", msg); + if ((err_verbosity & KOMEDA_DEV_PRINT_DUMP_STATE_ON_EVENT) && + (evts_mask & (KOMEDA_ERR_EVENTS | KOMEDA_WARN_EVENTS))) + drm_state_dump(dev, &p); en_print = false; } -- 2.7.4