summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2017-10-11 15:25:24 +0200
committerThierry Reding <treding@nvidia.com>2019-08-23 18:07:24 +0200
commit4445d73e3aeafe9682716c621da11f4bc76829fa (patch)
treeb3842010bba834456a7336de9605b4a72e70981a
parentf1e6a48458578900399194d686f9525b86f74325 (diff)
HACK: nouveau: Add debugging output
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r--src/gallium/drivers/nouveau/nouveau_fence.c5
-rw-r--r--src/gallium/drivers/nouveau/nouveau_screen.c52
-rw-r--r--src/gallium/drivers/nouveau/nv50/nv50_miptree.c21
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_context.c10
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c26
-rw-r--r--src/gallium/drivers/nouveau/nvc0/nvc0_resource.c20
6 files changed, 112 insertions, 22 deletions
diff --git a/src/gallium/drivers/nouveau/nouveau_fence.c b/src/gallium/drivers/nouveau/nouveau_fence.c
index b508b9b7163f..5380aff885d8 100644
--- a/src/gallium/drivers/nouveau/nouveau_fence.c
+++ b/src/gallium/drivers/nouveau/nouveau_fence.c
@@ -174,6 +174,8 @@ nouveau_fence_kick(struct nouveau_fence *fence)
{
struct nouveau_screen *screen = fence->screen;
+ debug_printf("> %s(fence=%p)\n", __func__, fence);
+
/* wtf, someone is waiting on a fence in flush_notify handler? */
assert(fence->state != NOUVEAU_FENCE_STATE_EMITTING);
@@ -189,6 +191,8 @@ nouveau_fence_kick(struct nouveau_fence *fence)
if (fence->state < NOUVEAU_FENCE_STATE_FLUSHED) {
if (nouveau_pushbuf_kick_fence(screen->pushbuf, screen->pushbuf->channel, &fence->fd))
return false;
+
+ debug_printf(" fd: %d\n", fence->fd);
}
if (fence == screen->fence.current)
@@ -196,6 +200,7 @@ nouveau_fence_kick(struct nouveau_fence *fence)
nouveau_fence_update(screen, false);
+ debug_printf("< %s() = true\n", __func__);
return true;
}
diff --git a/src/gallium/drivers/nouveau/nouveau_screen.c b/src/gallium/drivers/nouveau/nouveau_screen.c
index c2c9a3b3045c..374786202b1b 100644
--- a/src/gallium/drivers/nouveau/nouveau_screen.c
+++ b/src/gallium/drivers/nouveau/nouveau_screen.c
@@ -93,8 +93,15 @@ nouveau_screen_fence_get_fd(struct pipe_screen *screen,
struct pipe_fence_handle *pfence)
{
struct nouveau_fence *fence = nouveau_fence(pfence);
+ int ret;
+
+ debug_printf("> %s(screen=%p, pfence=%p)\n", __func__, screen, pfence);
+ debug_printf(" fd: %d\n", fence->fd);
+
+ ret = dup(fence->fd);
- return dup(fence->fd);
+ debug_printf("< %s() = %d\n", __func__, ret);
+ return ret;
}
struct nouveau_bo *
@@ -141,18 +148,42 @@ nouveau_screen_bo_get_handle(struct pipe_screen *pscreen,
unsigned stride,
struct winsys_handle *whandle)
{
+ struct nouveau_device *dev = bo->device;
+ bool ret = false;
+
+ debug_printf("> %s(pscreen=%p, bo=%p, stride=%u, whandle=%p)\n", __func__, pscreen, bo, stride, whandle);
+ debug_printf(" handle: %u\n", whandle->handle);
+ debug_printf(" type: %u\n", whandle->type);
+
+ if (dev->chipset >= 0xc0) {
+ debug_printf(" config: nvc0\n");
+ debug_printf(" memtype: %08x\n", bo->config.nvc0.memtype);
+ debug_printf(" tile_mode: %08x\n", bo->config.nvc0.tile_mode);
+ } else if (dev->chipset >= 0x50) {
+ debug_printf(" config: nv50\n");
+ debug_printf(" memtype: %08x\n", bo->config.nv50.memtype);
+ debug_printf(" tile_mode: %08x\n", bo->config.nv50.tile_mode);
+ } else {
+ debug_printf(" config: nv04\n");
+ debug_printf(" surf_flags: %08x\n", bo->config.nv04.surf_flags);
+ debug_printf(" surf_pitch: %08x\n", bo->config.nv04.surf_pitch);
+ }
+
whandle->stride = stride;
if (whandle->type == WINSYS_HANDLE_TYPE_SHARED) {
- return nouveau_bo_name_get(bo, &whandle->handle) == 0;
+ ret = nouveau_bo_name_get(bo, &whandle->handle) == 0;
} else if (whandle->type == WINSYS_HANDLE_TYPE_KMS) {
whandle->handle = bo->handle;
- return true;
+ ret = true;
} else if (whandle->type == WINSYS_HANDLE_TYPE_FD) {
- return nouveau_bo_set_prime(bo, (int *)&whandle->handle) == 0;
- } else {
- return false;
+ ret = nouveau_bo_set_prime(bo, (int *)&whandle->handle) == 0;
}
+
+ debug_printf(" whandle: %x\n", whandle->handle);
+ debug_printf(" modifier: %" PRIx64 "\n", whandle->modifier);
+ debug_printf("< %s() = %s\n", __func__, ret ? "true" : "false");
+ return ret;
}
static void
@@ -324,8 +355,13 @@ nouveau_create_fence_fd(struct pipe_context *pipe,
{
struct nouveau_screen *screen = nouveau_screen(pipe->screen);
+ debug_printf("> %s(pipe=%p, pfence=%p, fd=%d, type=%d)\n", __func__, pipe,
+ pfence, fd, type);
+
assert(type == PIPE_FD_TYPE_NATIVE_SYNC);
nouveau_fence_fd(screen, (struct nouveau_fence **)pfence, fd);
+
+ debug_printf("< %s()\n", __func__);
}
static void
@@ -335,7 +371,11 @@ nouveau_fence_server_sync(struct pipe_context *pipe,
struct nouveau_context *context = nouveau_context(pipe);
struct nouveau_fence *fence = nouveau_fence(pfence);
+ debug_printf("> %s(pipe=%p, pfence=%p)\n", __func__, pipe, pfence);
+
sync_accumulate("nouveau", &context->in_fence_fd, fence->fd);
+
+ debug_printf("< %s()\n", __func__);
}
void
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
index 786d1803306b..f2eff504eb7f 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_miptree.c
@@ -185,16 +185,25 @@ nv50_miptree_get_handle(struct pipe_screen *pscreen,
{
struct nv50_miptree *mt = nv50_miptree(pt);
unsigned stride;
+ bool ret;
- if (!mt || !mt->base.bo)
- return false;
+ debug_printf("> %s(pscreen=%p, pt=%p, whandle=%p)\n", __func__, pscreen, pt, whandle);
+
+ if (!mt || !mt->base.bo) {
+ ret = false;
+ goto out;
+ }
stride = mt->level[0].pitch;
- return nouveau_screen_bo_get_handle(pscreen,
- mt->base.bo,
- stride,
- whandle);
+ ret = nouveau_screen_bo_get_handle(pscreen,
+ mt->base.bo,
+ stride,
+ whandle);
+
+out:
+ debug_printf("< %s() = %d\n", __func__, ret);
+ return ret;
}
const struct u_resource_vtbl nv50_miptree_vtbl =
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
index 5aa69fb69373..7423cad93efe 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_context.c
@@ -36,6 +36,11 @@ nvc0_flush(struct pipe_context *pipe,
struct nvc0_context *nvc0 = nvc0_context(pipe);
struct nouveau_screen *screen = &nvc0->screen->base;
+ debug_printf("> %s(pipe=%p, pfence=%p, flags=%x)\n", __func__, pipe, pfence, flags);
+#ifdef DEBUG
+ debug_print_flush_flags(" flags", flags);
+#endif
+
if (pfence)
nouveau_fence_ref(screen->fence.current, (struct nouveau_fence **)pfence);
@@ -45,7 +50,10 @@ nvc0_flush(struct pipe_context *pipe,
struct nouveau_object *channel = pushbuf->channel;
int fd = nvc0->base.in_fence_fd;
+ debug_printf(" fd < %d\n", fd);
nouveau_pushbuf_kick_fence(pushbuf, channel, &fd);
+ debug_printf(" current: %p\n", fence);
+ debug_printf(" fd > %d\n", fd);
nvc0->base.in_fence_fd = -1;
fence->fd = fd;
} else {
@@ -53,6 +61,8 @@ nvc0_flush(struct pipe_context *pipe,
}
nouveau_context_update_frame_stats(&nvc0->base);
+
+ debug_printf("< %s()\n", __func__);
}
static void
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
index e6847bac0ad0..fccbf49a65b8 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_miptree.c
@@ -41,13 +41,18 @@ static uint32_t
nvc0_mt_choose_storage_type(struct nv50_miptree *mt, bool compressed)
{
const unsigned ms = util_logbase2(mt->base.base.nr_samples);
-
uint32_t tile_flags;
- if (unlikely(mt->base.base.bind & PIPE_BIND_CURSOR))
- return 0;
- if (unlikely(mt->base.base.flags & NOUVEAU_RESOURCE_FLAG_LINEAR))
- return 0;
+ debug_printf("> %s(mt=%p, compressed=%d)\n", __func__, mt, compressed);
+
+ if (unlikely(mt->base.base.bind & PIPE_BIND_CURSOR)) {
+ tile_flags = 0;
+ goto out;
+ }
+ if (unlikely(mt->base.base.flags & NOUVEAU_RESOURCE_FLAG_LINEAR)) {
+ tile_flags = 0;
+ goto out;
+ }
switch (mt->base.base.format) {
case PIPE_FORMAT_Z16_UNORM:
@@ -101,7 +106,8 @@ nvc0_mt_choose_storage_type(struct nv50_miptree *mt, bool compressed)
case 2: tile_flags = 0xed; break;
case 3: tile_flags = 0xf2; break;
default:
- return 0;
+ tile_flags = 0;
+ goto out;
}
} else {
tile_flags = 0xfe;
@@ -117,7 +123,8 @@ nvc0_mt_choose_storage_type(struct nv50_miptree *mt, bool compressed)
case 2: tile_flags = 0xdf; break;
case 3: tile_flags = 0xe4; break;
default:
- return 0;
+ tile_flags = 0;
+ goto out;
}
} else {
tile_flags = 0xfe;
@@ -128,11 +135,14 @@ nvc0_mt_choose_storage_type(struct nv50_miptree *mt, bool compressed)
tile_flags = 0xfe;
break;
default:
- return 0;
+ tile_flags = 0;
+ goto out;
}
break;
}
+out:
+ debug_printf("< %s() = %x\n", __func__, tile_flags);
return tile_flags;
}
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c
index d73ecf71624c..30c1db9f7aff 100644
--- a/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c
+++ b/src/gallium/drivers/nouveau/nvc0/nvc0_resource.c
@@ -4,6 +4,7 @@
#include "nvc0/nvc0_resource.h"
#include "nouveau_screen.h"
+#include "util/u_modifier.h"
static struct pipe_resource *
nvc0_resource_create(struct pipe_screen *screen,
@@ -24,12 +25,27 @@ nvc0_resource_create_with_modifiers(struct pipe_screen *screen,
const struct pipe_resource *templ,
const uint64_t *modifiers, int count)
{
+ struct pipe_resource *resource;
+ int i;
+
+ debug_printf("> %s(screen=%p, templ=%p, modifiers=%p, count=%d)\n",
+ __func__, screen, templ, modifiers, count);
+ debug_printf(" modifiers: %d\n", count);
+ for (i = 0; i < count; i++)
+ debug_printf(" %d: %" PRIu64 " (%s)\n", i, modifiers[i],
+ util_modifier_name(modifiers[i]));
+
switch (templ->target) {
case PIPE_BUFFER:
- return nouveau_buffer_create(screen, templ);
+ resource = nouveau_buffer_create(screen, templ);
+ break;
default:
- return nvc0_miptree_create(screen, templ, modifiers, count);
+ resource = nvc0_miptree_create(screen, templ, modifiers, count);
+ break;
}
+
+ debug_printf("< %s() = %p\n", __func__, resource);
+ return resource;
}
static void