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)
mdev->debugfs_root = debugfs_create_dir("komeda", NULL);
debugfs_create_file("register", 0444, mdev->debugfs_root,
mdev, &komeda_register_fops);
debugfs_create_x16("err_verbosity", 0664, mdev->debugfs_root,
&mdev->err_verbosity);
}
#endif
......@@ -273,6 +275,8 @@ struct komeda_dev *komeda_dev_create(struct device *dev)
goto err_cleanup;
}
mdev->err_verbosity = KOMEDA_DEV_PRINT_ERR_EVENTS;
#ifdef CONFIG_DEBUG_FS
komeda_debugfs_init(mdev);
#endif
......
......@@ -202,6 +202,14 @@ struct komeda_dev {
/** @debugfs_root: root directory of komeda debugfs */
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
......@@ -219,9 +227,11 @@ void komeda_dev_destroy(struct komeda_dev *mdev);
struct komeda_dev *dev_to_mdev(struct device *dev);
#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
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
int komeda_dev_resume(struct komeda_dev *mdev);
......
......@@ -107,10 +107,12 @@ static bool is_new_frame(struct komeda_events *a)
(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;
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 */
if (evts->global || is_new_frame(evts))
......@@ -118,6 +120,9 @@ void komeda_print_events(struct komeda_events *evts)
if (!en_print)
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) {
char msg[256];
struct komeda_str str;
......
......@@ -48,7 +48,7 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data)
memset(&evts, 0, sizeof(evts));
status = mdev->funcs->irq_handler(mdev, &evts);
komeda_print_events(&evts);
komeda_print_events(&evts, drm);
/* Notify the crtc to handle the events */
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