summaryrefslogtreecommitdiff
path: root/lib/libdrm/nouveau
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libdrm/nouveau')
-rw-r--r--lib/libdrm/nouveau/meson.build2
-rw-r--r--lib/libdrm/nouveau/nouveau.c30
-rw-r--r--lib/libdrm/nouveau/pushbuf.c9
3 files changed, 30 insertions, 11 deletions
diff --git a/lib/libdrm/nouveau/meson.build b/lib/libdrm/nouveau/meson.build
index 9bd58fca5..af45336c6 100644
--- a/lib/libdrm/nouveau/meson.build
+++ b/lib/libdrm/nouveau/meson.build
@@ -19,7 +19,7 @@
# SOFTWARE.
-libdrm_nouveau = shared_library(
+libdrm_nouveau = library(
'drm_nouveau',
[files( 'nouveau.c', 'pushbuf.c', 'bufctx.c', 'abi16.c'), config_file],
c_args : libdrm_c_args,
diff --git a/lib/libdrm/nouveau/nouveau.c b/lib/libdrm/nouveau/nouveau.c
index f18d1426b..9fa940a93 100644
--- a/lib/libdrm/nouveau/nouveau.c
+++ b/lib/libdrm/nouveau/nouveau.c
@@ -46,19 +46,35 @@
#include "nvif/ioctl.h"
#include "nvif/unpack.h"
-#ifdef DEBUG
+drm_private FILE *nouveau_out = NULL;
drm_private uint32_t nouveau_debug = 0;
static void
-debug_init(char *args)
+debug_init(void)
{
- if (args) {
- int n = strtol(args, NULL, 0);
+ static bool once = false;
+ char *debug, *out;
+
+ if (once)
+ return;
+ once = true;
+
+ debug = getenv("NOUVEAU_LIBDRM_DEBUG");
+ if (debug) {
+ int n = strtol(debug, NULL, 0);
if (n >= 0)
nouveau_debug = n;
+
+ }
+
+ nouveau_out = stderr;
+ out = getenv("NOUVEAU_LIBDRM_OUT");
+ if (out) {
+ FILE *fout = fopen(out, "w");
+ if (fout)
+ nouveau_out = fout;
}
}
-#endif
static int
nouveau_object_ioctl(struct nouveau_object *obj, void *data, uint32_t size)
@@ -327,9 +343,7 @@ nouveau_drm_new(int fd, struct nouveau_drm **pdrm)
struct nouveau_drm *drm;
drmVersionPtr ver;
-#ifdef DEBUG
- debug_init(getenv("NOUVEAU_LIBDRM_DEBUG"));
-#endif
+ debug_init();
if (!(drm = calloc(1, sizeof(*drm))))
return -ENOMEM;
diff --git a/lib/libdrm/nouveau/pushbuf.c b/lib/libdrm/nouveau/pushbuf.c
index e5f73f0d7..10ff3f57f 100644
--- a/lib/libdrm/nouveau/pushbuf.c
+++ b/lib/libdrm/nouveau/pushbuf.c
@@ -292,11 +292,14 @@ pushbuf_dump(struct nouveau_pushbuf_krec *krec, int krec_id, int chid)
kref = krec->buffer + kpsh->bo_index;
bo = (void *)(unsigned long)kref->user_priv;
bgn = (uint32_t *)((char *)bo->map + kpsh->offset);
- end = bgn + (kpsh->length /4);
+ end = bgn + ((kpsh->length & 0x7fffff) /4);
- err("ch%d: psh %08x %010llx %010llx\n", chid, kpsh->bo_index,
+ err("ch%d: psh %s%08x %010llx %010llx\n", chid,
+ bo->map ? "" : "(unmapped) ", kpsh->bo_index,
(unsigned long long)kpsh->offset,
(unsigned long long)(kpsh->offset + kpsh->length));
+ if (!bo->map)
+ continue;
while (bgn < end)
err("\t0x%08x\n", *bgn++);
}
@@ -336,6 +339,8 @@ pushbuf_submit(struct nouveau_pushbuf *push, struct nouveau_object *chan)
req.suffix0 = nvpb->suffix0;
req.suffix1 = nvpb->suffix1;
req.vram_available = 0; /* for valgrind */
+ if (dbg_on(1))
+ req.vram_available |= NOUVEAU_GEM_PUSHBUF_SYNC;
req.gart_available = 0;
if (dbg_on(0))