summaryrefslogtreecommitdiff
path: root/bsd-core
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2004-11-06 11:50:08 +0000
committerEric Anholt <anholt@freebsd.org>2004-11-06 11:50:08 +0000
commitb2f275b46e575766c7b5dab22ba30a367a182c9e (patch)
tree8447f1f94a6fac6e490850824ba20691fc4fbcc0 /bsd-core
parent7adee84064d55207dbf7893cc8cb579bfa1a7631 (diff)
Hook the debug output up to a sysctl, so you can choose to enable at
runtime.
Diffstat (limited to 'bsd-core')
-rw-r--r--bsd-core/drmP.h7
-rw-r--r--bsd-core/drm_drv.c6
-rw-r--r--bsd-core/drm_sysctl.c4
3 files changed, 7 insertions, 10 deletions
diff --git a/bsd-core/drmP.h b/bsd-core/drmP.h
index c5015100..00c84ef7 100644
--- a/bsd-core/drmP.h
+++ b/bsd-core/drmP.h
@@ -128,8 +128,6 @@ typedef struct drm_file drm_file_t;
#define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */
#define DRM_RESERVED_CONTEXTS 1 /* Change drm_resctx if changed */
-#define DRM_FLAG_DEBUG 0x01
-
#define DRM_MEM_DMA 0
#define DRM_MEM_SAREA 1
#define DRM_MEM_DRIVER 2
@@ -414,7 +412,7 @@ for ( ret = 0 ; !ret && !(condition) ; ) { \
#define DRM_INFO(fmt, arg...) printf("info: [" DRM_NAME "] " fmt , ## arg)
#define DRM_DEBUG(fmt, arg...) do { \
- if (drm_flags & DRM_FLAG_DEBUG) \
+ if (drm_debug_flag) \
printf("[" DRM_NAME ":pid%d:%s] " fmt, DRM_CURRENTPID, \
__func__ , ## arg); \
} while (0)
@@ -729,8 +727,7 @@ struct drm_device {
drm_local_map_t *agp_buffer_map;
};
-extern int drm_flags;
-
+extern int drm_debug_flag;
/* Device setup support (drm_drv.c) */
#ifdef __FreeBSD__
diff --git a/bsd-core/drm_drv.c b/bsd-core/drm_drv.c
index 7138096c..cdf99eac 100644
--- a/bsd-core/drm_drv.c
+++ b/bsd-core/drm_drv.c
@@ -33,11 +33,7 @@
#include "drmP.h"
#include "drm.h"
-#ifdef DRM_DEBUG_DEFAULT_ON
-int drm_flags = DRM_FLAG_DEBUG;
-#else
-int drm_flags = 0;
-#endif
+int drm_debug_flag = 0;
static int drm_init(device_t nbdev);
static void drm_cleanup(drm_device_t *dev);
diff --git a/bsd-core/drm_sysctl.c b/bsd-core/drm_sysctl.c
index 64066bc2..09cba5b9 100644
--- a/bsd-core/drm_sysctl.c
+++ b/bsd-core/drm_sysctl.c
@@ -96,6 +96,10 @@ int drm_sysctl_init(drm_device_t *dev)
if (!oid)
return 1;
}
+ SYSCTL_ADD_INT(&info->ctx, SYSCTL_CHILDREN(top), OID_AUTO, "debug",
+ CTLFLAG_RW, &drm_debug_flag, sizeof(drm_debug_flag),
+ "Enable debugging output");
+
return 0;
}