Commit 876905b8 authored by Jani Nikula's avatar Jani Nikula

drm/print: convert debug category macros into an enum

Mostly for improved documentation, convert the debug category macros
into an enum. Drop unused DRM_UT_NONE. Document previously undocumented
categories.
Reviewed-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Acked-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Acked-by: default avatarSean Paul <sean@poorly.run>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/96582479e7829d92b89adb805f829e23043ca85c.1572258936.git.jani.nikula@intel.com
parent 99acf471
...@@ -256,7 +256,7 @@ void drm_dev_printk(const struct device *dev, const char *level, ...@@ -256,7 +256,7 @@ void drm_dev_printk(const struct device *dev, const char *level,
} }
EXPORT_SYMBOL(drm_dev_printk); EXPORT_SYMBOL(drm_dev_printk);
void drm_dev_dbg(const struct device *dev, unsigned int category, void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
const char *format, ...) const char *format, ...)
{ {
struct va_format vaf; struct va_format vaf;
...@@ -280,7 +280,7 @@ void drm_dev_dbg(const struct device *dev, unsigned int category, ...@@ -280,7 +280,7 @@ void drm_dev_dbg(const struct device *dev, unsigned int category,
} }
EXPORT_SYMBOL(drm_dev_dbg); EXPORT_SYMBOL(drm_dev_dbg);
void __drm_dbg(unsigned int category, const char *format, ...) void __drm_dbg(enum drm_debug_category category, const char *format, ...)
{ {
struct va_format vaf; struct va_format vaf;
va_list args; va_list args;
......
...@@ -249,52 +249,73 @@ static inline struct drm_printer drm_err_printer(const char *prefix) ...@@ -249,52 +249,73 @@ static inline struct drm_printer drm_err_printer(const char *prefix)
return p; return p;
} }
/* /**
* The following categories are defined: * enum drm_debug_category - The DRM debug categories
*
* CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c, drm_memory.c, ...
* This is the category used by the DRM_DEBUG() macro.
*
* DRIVER: Used in the vendor specific part of the driver: i915, radeon, ...
* This is the category used by the DRM_DEBUG_DRIVER() macro.
*
* KMS: used in the modesetting code.
* This is the category used by the DRM_DEBUG_KMS() macro.
*
* PRIME: used in the prime code.
* This is the category used by the DRM_DEBUG_PRIME() macro.
* *
* ATOMIC: used in the atomic code. * Each of the DRM debug logging macros use a specific category, and the logging
* This is the category used by the DRM_DEBUG_ATOMIC() macro. * is filtered by the drm.debug module parameter. This enum specifies the values
* for the interface.
* *
* VBL: used for verbose debug message in the vblank code * Each DRM_DEBUG_<CATEGORY> macro logs to DRM_UT_<CATEGORY> category, except
* This is the category used by the DRM_DEBUG_VBL() macro. * DRM_DEBUG() logs to DRM_UT_CORE.
* *
* Enabling verbose debug messages is done through the drm.debug parameter, * Enabling verbose debug messages is done through the drm.debug parameter, each
* each category being enabled by a bit. * category being enabled by a bit:
* *
* drm.debug=0x1 will enable CORE messages * - drm.debug=0x1 will enable CORE messages
* drm.debug=0x2 will enable DRIVER messages * - drm.debug=0x2 will enable DRIVER messages
* drm.debug=0x3 will enable CORE and DRIVER messages * - drm.debug=0x3 will enable CORE and DRIVER messages
* ... * - ...
* drm.debug=0x3f will enable all messages * - drm.debug=0x1ff will enable all messages
* *
* An interesting feature is that it's possible to enable verbose logging at * An interesting feature is that it's possible to enable verbose logging at
* run-time by echoing the debug value in its sysfs node: * run-time by echoing the debug value in its sysfs node::
*
* # echo 0xf > /sys/module/drm/parameters/debug * # echo 0xf > /sys/module/drm/parameters/debug
*
*/
enum drm_debug_category {
/**
* @DRM_UT_CORE: Used in the generic drm code: drm_ioctl.c, drm_mm.c,
* drm_memory.c, ...
*/ */
#define DRM_UT_NONE 0x00 DRM_UT_CORE = 0x01,
#define DRM_UT_CORE 0x01 /**
#define DRM_UT_DRIVER 0x02 * @DRM_UT_DRIVER: Used in the vendor specific part of the driver: i915,
#define DRM_UT_KMS 0x04 * radeon, ... macro.
#define DRM_UT_PRIME 0x08 */
#define DRM_UT_ATOMIC 0x10 DRM_UT_DRIVER = 0x02,
#define DRM_UT_VBL 0x20 /**
#define DRM_UT_STATE 0x40 * @DRM_UT_KMS: Used in the modesetting code.
#define DRM_UT_LEASE 0x80 */
#define DRM_UT_DP 0x100 DRM_UT_KMS = 0x04,
/**
static inline bool drm_debug_enabled(unsigned int category) * @DRM_UT_PRIME: Used in the prime code.
*/
DRM_UT_PRIME = 0x08,
/**
* @DRM_UT_ATOMIC: Used in the atomic code.
*/
DRM_UT_ATOMIC = 0x10,
/**
* @DRM_UT_VBL: Used for verbose debug message in the vblank code.
*/
DRM_UT_VBL = 0x20,
/**
* @DRM_UT_STATE: Used for verbose atomic state debugging.
*/
DRM_UT_STATE = 0x40,
/**
* @DRM_UT_LEASE: Used in the lease code.
*/
DRM_UT_LEASE = 0x80,
/**
* @DRM_UT_DP: Used in the DP code.
*/
DRM_UT_DP = 0x100,
};
static inline bool drm_debug_enabled(enum drm_debug_category category)
{ {
return unlikely(__drm_debug & category); return unlikely(__drm_debug & category);
} }
...@@ -303,11 +324,11 @@ __printf(3, 4) ...@@ -303,11 +324,11 @@ __printf(3, 4)
void drm_dev_printk(const struct device *dev, const char *level, void drm_dev_printk(const struct device *dev, const char *level,
const char *format, ...); const char *format, ...);
__printf(3, 4) __printf(3, 4)
void drm_dev_dbg(const struct device *dev, unsigned int category, void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
const char *format, ...); const char *format, ...);
__printf(2, 3) __printf(2, 3)
void __drm_dbg(unsigned int category, const char *format, ...); void __drm_dbg(enum drm_debug_category category, const char *format, ...);
__printf(1, 2) __printf(1, 2)
void __drm_err(const char *format, ...); void __drm_err(const char *format, ...);
......
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