nouveau: rework debugging so we can also dump into a file
Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>main
parent
c0ae9cfa00
commit
17a51b0b31
|
@ -46,15 +46,33 @@
|
||||||
#include "nvif/ioctl.h"
|
#include "nvif/ioctl.h"
|
||||||
#include "nvif/unpack.h"
|
#include "nvif/unpack.h"
|
||||||
|
|
||||||
|
drm_private FILE *nouveau_out = NULL;
|
||||||
drm_private uint32_t nouveau_debug = 0;
|
drm_private uint32_t nouveau_debug = 0;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
debug_init(char *args)
|
debug_init(void)
|
||||||
{
|
{
|
||||||
if (args) {
|
static bool once = false;
|
||||||
int n = strtol(args, NULL, 0);
|
char *debug, *out;
|
||||||
|
|
||||||
|
if (once)
|
||||||
|
return;
|
||||||
|
once = true;
|
||||||
|
|
||||||
|
debug = getenv("NOUVEAU_LIBDRM_DEBUG");
|
||||||
|
if (debug) {
|
||||||
|
int n = strtol(debug, NULL, 0);
|
||||||
if (n >= 0)
|
if (n >= 0)
|
||||||
nouveau_debug = n;
|
nouveau_debug = n;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
nouveau_out = stderr;
|
||||||
|
out = getenv("NOUVEAU_LIBDRM_OUT");
|
||||||
|
if (out) {
|
||||||
|
FILE *fout = fopen(out, "w");
|
||||||
|
if (fout)
|
||||||
|
nouveau_out = fout;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,7 +343,7 @@ nouveau_drm_new(int fd, struct nouveau_drm **pdrm)
|
||||||
struct nouveau_drm *drm;
|
struct nouveau_drm *drm;
|
||||||
drmVersionPtr ver;
|
drmVersionPtr ver;
|
||||||
|
|
||||||
debug_init(getenv("NOUVEAU_LIBDRM_DEBUG"));
|
debug_init();
|
||||||
|
|
||||||
if (!(drm = calloc(1, sizeof(*drm))))
|
if (!(drm = calloc(1, sizeof(*drm))))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef __NOUVEAU_LIBDRM_PRIVATE_H__
|
#ifndef __NOUVEAU_LIBDRM_PRIVATE_H__
|
||||||
#define __NOUVEAU_LIBDRM_PRIVATE_H__
|
#define __NOUVEAU_LIBDRM_PRIVATE_H__
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <libdrm_macros.h>
|
#include <libdrm_macros.h>
|
||||||
#include <xf86drm.h>
|
#include <xf86drm.h>
|
||||||
#include <xf86atomic.h>
|
#include <xf86atomic.h>
|
||||||
|
@ -10,12 +12,13 @@
|
||||||
#include "nouveau.h"
|
#include "nouveau.h"
|
||||||
|
|
||||||
drm_private extern uint32_t nouveau_debug;
|
drm_private extern uint32_t nouveau_debug;
|
||||||
|
drm_private extern FILE *nouveau_out;
|
||||||
#define dbg_on(lvl) (nouveau_debug & (1 << lvl))
|
#define dbg_on(lvl) (nouveau_debug & (1 << lvl))
|
||||||
#define dbg(lvl, fmt, args...) do { \
|
#define dbg(lvl, fmt, args...) do { \
|
||||||
if (dbg_on((lvl))) \
|
if (dbg_on((lvl))) \
|
||||||
fprintf(stderr, "nouveau: "fmt, ##args); \
|
fprintf(nouveau_out, "nouveau: "fmt, ##args); \
|
||||||
} while(0)
|
} while(0)
|
||||||
#define err(fmt, args...) fprintf(stderr, "nouveau: "fmt, ##args)
|
#define err(fmt, args...) fprintf(nouveau_out, "nouveau: "fmt, ##args)
|
||||||
|
|
||||||
struct nouveau_client_kref {
|
struct nouveau_client_kref {
|
||||||
struct drm_nouveau_gem_pushbuf_bo *kref;
|
struct drm_nouveau_gem_pushbuf_bo *kref;
|
||||||
|
|
Loading…
Reference in New Issue