diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index ba5e2645185..5557e2a93e5 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -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: diff --git a/src/gallium/winsys/nouveau/drm/meson.build b/src/gallium/winsys/nouveau/drm/meson.build index 5a7898f54c1..6cf38078993 100644 --- a/src/gallium/winsys/nouveau/drm/meson.build +++ b/src/gallium/winsys/nouveau/drm/meson.build @@ -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( diff --git a/src/gallium/winsys/nouveau/drm/nouveau.c b/src/gallium/winsys/nouveau/drm/nouveau.c index 4898ede0040..4bf35f46cac 100644 --- a/src/gallium/winsys/nouveau/drm/nouveau.c +++ b/src/gallium/winsys/nouveau/drm/nouveau.c @@ -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; } diff --git a/src/gallium/winsys/nouveau/drm/nouveau.h b/src/gallium/winsys/nouveau/drm/nouveau.h index 309e4ca97d8..7b03241661c 100644 --- a/src/gallium/winsys/nouveau/drm/nouveau.h +++ b/src/gallium/winsys/nouveau/drm/nouveau.h @@ -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 **);