Commit 8894cd58 authored by Mihail Atanassov's avatar Mihail Atanassov Committed by Mihail Atanassov

drm/komeda: Add debugfs node to control error verbosity

Named 'err_verbosity', currently with only 1 active bit in that
replicates the existing level - print error events once per flip.
Reviewed-by: default avatarJames Qian Wang (Arm Technology China) <james.qian.wang@arm.com>
Acked-by: default avatarLiviu Dudau <liviu.dudau@arm.com>
Signed-off-by: default avatarMihail Atanassov <mihail.atanassov@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191107114155.54307-2-mihail.atanassov@arm.com
parent 97de8636
...@@ -58,6 +58,8 @@ static void komeda_debugfs_init(struct komeda_dev *mdev) ...@@ -58,6 +58,8 @@ static void komeda_debugfs_init(struct komeda_dev *mdev)
mdev->debugfs_root = debugfs_create_dir("komeda", NULL); mdev->debugfs_root = debugfs_create_dir("komeda", NULL);
debugfs_create_file("register", 0444, mdev->debugfs_root, debugfs_create_file("register", 0444, mdev->debugfs_root,
mdev, &komeda_register_fops); mdev, &komeda_register_fops);
debugfs_create_x16("err_verbosity", 0664, mdev->debugfs_root,
&mdev->err_verbosity);
} }
#endif #endif
...@@ -273,6 +275,8 @@ struct komeda_dev *komeda_dev_create(struct device *dev) ...@@ -273,6 +275,8 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
goto err_cleanup; goto err_cleanup;
} }
mdev->err_verbosity = KOMEDA_DEV_PRINT_ERR_EVENTS;
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
komeda_debugfs_init(mdev); komeda_debugfs_init(mdev);
#endif #endif
......
...@@ -202,6 +202,14 @@ struct komeda_dev { ...@@ -202,6 +202,14 @@ struct komeda_dev {
/** @debugfs_root: root directory of komeda debugfs */ /** @debugfs_root: root directory of komeda debugfs */
struct dentry *debugfs_root; struct dentry *debugfs_root;
/**
* @err_verbosity: bitmask for how much extra info to print on error
*
* See KOMEDA_DEV_* macros for details.
*/
u16 err_verbosity;
/* Print a single line per error per frame with error events. */
#define KOMEDA_DEV_PRINT_ERR_EVENTS BIT(0)
}; };
static inline bool static inline bool
...@@ -219,9 +227,11 @@ void komeda_dev_destroy(struct komeda_dev *mdev); ...@@ -219,9 +227,11 @@ void komeda_dev_destroy(struct komeda_dev *mdev);
struct komeda_dev *dev_to_mdev(struct device *dev); struct komeda_dev *dev_to_mdev(struct device *dev);
#ifdef CONFIG_DRM_KOMEDA_ERROR_PRINT #ifdef CONFIG_DRM_KOMEDA_ERROR_PRINT
void komeda_print_events(struct komeda_events *evts); void komeda_print_events(struct komeda_events *evts, struct drm_device *dev);
#else #else
static inline void komeda_print_events(struct komeda_events *evts) {} static inline void komeda_print_events(struct komeda_events *evts,
struct drm_device *dev)
{}
#endif #endif
int komeda_dev_resume(struct komeda_dev *mdev); int komeda_dev_resume(struct komeda_dev *mdev);
......
...@@ -107,10 +107,12 @@ static bool is_new_frame(struct komeda_events *a) ...@@ -107,10 +107,12 @@ static bool is_new_frame(struct komeda_events *a)
(KOMEDA_EVENT_FLIP | KOMEDA_EVENT_EOW); (KOMEDA_EVENT_FLIP | KOMEDA_EVENT_EOW);
} }
void komeda_print_events(struct komeda_events *evts) void komeda_print_events(struct komeda_events *evts, struct drm_device *dev)
{ {
u64 print_evts = KOMEDA_ERR_EVENTS; u64 print_evts = 0;
static bool en_print = true; static bool en_print = true;
struct komeda_dev *mdev = dev->dev_private;
u16 const err_verbosity = mdev->err_verbosity;
/* reduce the same msg print, only print the first evt for one frame */ /* reduce the same msg print, only print the first evt for one frame */
if (evts->global || is_new_frame(evts)) if (evts->global || is_new_frame(evts))
...@@ -118,6 +120,9 @@ void komeda_print_events(struct komeda_events *evts) ...@@ -118,6 +120,9 @@ void komeda_print_events(struct komeda_events *evts)
if (!en_print) if (!en_print)
return; return;
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->global | evts->pipes[0] | evts->pipes[1]) & print_evts) {
char msg[256]; char msg[256];
struct komeda_str str; struct komeda_str str;
......
...@@ -48,7 +48,7 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data) ...@@ -48,7 +48,7 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data)
memset(&evts, 0, sizeof(evts)); memset(&evts, 0, sizeof(evts));
status = mdev->funcs->irq_handler(mdev, &evts); status = mdev->funcs->irq_handler(mdev, &evts);
komeda_print_events(&evts); komeda_print_events(&evts, drm);
/* Notify the crtc to handle the events */ /* Notify the crtc to handle the events */
for (i = 0; i < kms->n_crtcs; i++) for (i = 0; i < kms->n_crtcs; i++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment