nouveau/nvc0: add support for using common pushbuf dumper

This dumper is covers things a lot better than just hex, and
should support all the classes we currently use on nvc0.

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29542>
This commit is contained in:
Dave Airlie 2024-06-19 11:09:18 +10:00 committed by Marge Bot
parent f12641f89f
commit 65092ab1a5
4 changed files with 53 additions and 6 deletions

View file

@ -1487,6 +1487,11 @@ nvc0_screen_create(struct nouveau_device *dev)
if (!nvc0_blitter_create(screen))
goto fail;
nouveau_device_set_classes_for_debug(dev,
screen->eng3d->oclass,
screen->compute->oclass,
screen->m2mf->oclass,
screen->copy->oclass);
return &screen->base;
fail:

View file

@ -40,7 +40,7 @@ libnouveauwinsys = static_library(
cc.get_supported_arguments('-Wno-gnu-variable-sized-type-not-at-end')
],
gnu_symbol_visibility : 'hidden',
dependencies : [dep_libdrm, idep_mesautil],
dependencies : [dep_libdrm, idep_mesautil, idep_nvidia_headers],
)
idep_libnouveauwinsys = declare_dependency(

View file

@ -12,6 +12,9 @@
#include "nvif/cl0080.h"
#include "nvif/ioctl.h"
#include "nv_push.h"
#include "nv_device_info.h"
#include "util/bitscan.h"
#include "util/list.h"
#include "util/os_mman.h"
@ -442,6 +445,19 @@ done:
return ret;
}
void
nouveau_device_set_classes_for_debug(struct nouveau_device *dev,
uint32_t cls_eng3d,
uint32_t cls_compute,
uint32_t cls_m2mf,
uint32_t cls_copy)
{
dev->cls_eng3d = cls_eng3d;
dev->cls_compute = cls_compute;
dev->cls_m2mf = cls_m2mf;
dev->cls_copy = cls_copy;
}
void
nouveau_device_del(struct nouveau_device **pdev)
{
@ -1033,7 +1049,8 @@ nouveau_pushbuf(struct nouveau_pushbuf *push)
}
static void
pushbuf_dump(struct nouveau_pushbuf_krec *krec, int krec_id, int chid)
pushbuf_dump(struct nouveau_device *dev,
struct nouveau_pushbuf_krec *krec, int krec_id, int chid)
{
struct drm_nouveau_gem_pushbuf_reloc *krel;
struct drm_nouveau_gem_pushbuf_push *kpsh;
@ -1074,8 +1091,23 @@ pushbuf_dump(struct nouveau_pushbuf_krec *krec, int krec_id, int chid)
(unsigned long long)(kpsh->offset + kpsh->length));
if (!bo->map)
continue;
while (bgn < end)
err("\t0x%08x\n", *bgn++);
if (dev->cls_eng3d) {
struct nv_device_info info = {
.cls_eng3d = dev->cls_eng3d,
.cls_compute = dev->cls_compute,
.cls_m2mf = dev->cls_m2mf,
.cls_copy = dev->cls_copy,
};
struct nv_push push = {
.start = bgn,
.end = end
};
vk_push_print(nouveau_out, &push, &info);
} else {
while (bgn < end)
err("\t0x%08x\n", *bgn++);
}
}
}
@ -1118,7 +1150,7 @@ pushbuf_submit(struct nouveau_pushbuf *push, struct nouveau_object *chan)
req.gart_available = 0;
if (dbg_on(0))
pushbuf_dump(krec, krec_id++, channel);
pushbuf_dump(dev, krec, krec_id++, channel);
ret = drmCommandWriteRead(drm->fd, DRM_NOUVEAU_GEM_PUSHBUF, &req, sizeof(req));
nvpb->suffix0 = req.suffix0;
@ -1128,7 +1160,7 @@ pushbuf_submit(struct nouveau_pushbuf *push, struct nouveau_object *chan)
if (ret) {
err("kernel rejected pushbuf: %s\n", strerror(-ret));
pushbuf_dump(krec, krec_id++, channel);
pushbuf_dump(dev, krec, krec_id++, channel);
break;
}

View file

@ -50,6 +50,11 @@ struct nouveau_device {
uint64_t gart_size;
uint64_t vram_limit;
uint64_t gart_limit;
/* classes for common push buf dumping */
uint32_t cls_eng3d;
uint32_t cls_compute;
uint32_t cls_m2mf;
uint32_t cls_copy;
};
struct nouveau_client {
@ -155,6 +160,11 @@ struct nv_device_info_v0;
int nouveau_device_new(struct nouveau_object *parent, struct nouveau_device **);
void nouveau_device_del(struct nouveau_device **);
int nouveau_device_info(struct nouveau_device *, struct nv_device_info_v0 *);
void nouveau_device_set_classes_for_debug(struct nouveau_device *dev,
uint32_t cls_eng3d,
uint32_t cls_compute,
uint32_t cls_m2mf,
uint32_t cls_copy);
int nouveau_getparam(struct nouveau_device *, uint64_t param, uint64_t *value);
int nouveau_client_new(struct nouveau_device *, struct nouveau_client **);