diff --git a/src/nouveau/mme/tests/mme_runner.cpp b/src/nouveau/mme/tests/mme_runner.cpp index 0d33c9f4857..44f86d9c84a 100644 --- a/src/nouveau/mme/tests/mme_runner.cpp +++ b/src/nouveau/mme/tests/mme_runner.cpp @@ -76,7 +76,7 @@ mme_hw_runner::set_up_hw(uint16_t min_cls, uint16_t max_cls) if (devices[i]->available_nodes & 1 << DRM_NODE_RENDER && devices[i]->bustype == DRM_BUS_PCI && devices[i]->deviceinfo.pci->vendor_id == 0x10de) { - dev = nouveau_ws_device_new(devices[i], (enum nvk_debug)0); + dev = nouveau_ws_device_new(devices[i]); if (dev == NULL) continue; diff --git a/src/nouveau/vulkan/meson.build b/src/nouveau/vulkan/meson.build index fed5029b7eb..685f348df13 100644 --- a/src/nouveau/vulkan/meson.build +++ b/src/nouveau/vulkan/meson.build @@ -16,6 +16,7 @@ nvk_files = files( 'nvk_cmd_pool.c', 'nvk_cmd_pool.h', 'nvk_codegen.c', + 'nvk_debug.h', 'nvk_descriptor_set.h', 'nvk_descriptor_set.c', 'nvk_descriptor_set_layout.c', diff --git a/src/nouveau/vulkan/nvk_codegen.c b/src/nouveau/vulkan/nvk_codegen.c index a69103af024..514370222f0 100644 --- a/src/nouveau/vulkan/nvk_codegen.c +++ b/src/nouveau/vulkan/nvk_codegen.c @@ -13,6 +13,7 @@ #include "nv50_ir_driver.h" #include "pipe/p_defines.h" #include "pipe/p_shader_tokens.h" +#include "util/u_memory.h" #include "nv_push_cl9097.h" diff --git a/src/nouveau/vulkan/nvk_debug.h b/src/nouveau/vulkan/nvk_debug.h new file mode 100644 index 00000000000..6d43ec7d40e --- /dev/null +++ b/src/nouveau/vulkan/nvk_debug.h @@ -0,0 +1,34 @@ +/* + * Copyright © 2024 Collabora, Ltd. + * SPDX-License-Identifier: MIT + */ +#ifndef NVK_DEBUG_H +#define NVK_DEBUG_H 1 + +enum nvk_debug { + /* dumps all push buffers after submission */ + NVK_DEBUG_PUSH_DUMP = 1ull << 0, + + /* push buffer submissions wait on completion + * + * This is useful to find the submission killing the GPU context. For + * easier debugging it also dumps the buffer leading to that. + */ + NVK_DEBUG_PUSH_SYNC = 1ull << 1, + + /* Zero all client memory allocations + */ + NVK_DEBUG_ZERO_MEMORY = 1ull << 2, + + /* Dump VM bind/unbinds + */ + NVK_DEBUG_VM = 1ull << 3, + + /* Disable most cbufs + * + * Root descriptors still end up in a cbuf + */ + NVK_DEBUG_NO_CBUF = 1ull << 5, +}; + +#endif /* NVK_DEBUG_H */ diff --git a/src/nouveau/vulkan/nvk_instance.h b/src/nouveau/vulkan/nvk_instance.h index b3643510e92..780cafbc11f 100644 --- a/src/nouveau/vulkan/nvk_instance.h +++ b/src/nouveau/vulkan/nvk_instance.h @@ -7,7 +7,7 @@ #include "nvk_private.h" -#include "nouveau_device.h" +#include "nvk_debug.h" #include "vk_instance.h" #include "util/xmlconfig.h" diff --git a/src/nouveau/vulkan/nvk_physical_device.h b/src/nouveau/vulkan/nvk_physical_device.h index fb3d78ede63..363be8f453b 100644 --- a/src/nouveau/vulkan/nvk_physical_device.h +++ b/src/nouveau/vulkan/nvk_physical_device.h @@ -7,7 +7,7 @@ #include "nvk_private.h" -#include "nouveau_device.h" +#include "nvk_debug.h" #include "nv_device_info.h" #include "vk_physical_device.h" diff --git a/src/nouveau/vulkan/nvkmd/nouveau/nvkmd_nouveau_dev.c b/src/nouveau/vulkan/nvkmd/nouveau/nvkmd_nouveau_dev.c index 51fdc70ba7f..e88d3f62462 100644 --- a/src/nouveau/vulkan/nvkmd/nouveau/nvkmd_nouveau_dev.c +++ b/src/nouveau/vulkan/nvkmd/nouveau/nvkmd_nouveau_dev.c @@ -31,7 +31,7 @@ nvkmd_nouveau_create_dev(struct nvkmd_pdev *_pdev, "Failed to get DRM device: %m"); } - dev->ws_dev = nouveau_ws_device_new(drm_device, pdev->ws_dev->debug_flags); + dev->ws_dev = nouveau_ws_device_new(drm_device); drmFreeDevice(&drm_device); if (dev->ws_dev == NULL) { FREE(dev); diff --git a/src/nouveau/vulkan/nvkmd/nouveau/nvkmd_nouveau_pdev.c b/src/nouveau/vulkan/nvkmd/nouveau/nvkmd_nouveau_pdev.c index 323cc955e4b..292043978db 100644 --- a/src/nouveau/vulkan/nvkmd/nouveau/nvkmd_nouveau_pdev.c +++ b/src/nouveau/vulkan/nvkmd/nouveau/nvkmd_nouveau_pdev.c @@ -70,8 +70,7 @@ nvkmd_nouveau_try_create_pdev(struct _drmDevice *drm_device, if (!drm_device_is_nouveau(drm_device->nodes[DRM_NODE_RENDER])) return VK_ERROR_INCOMPATIBLE_DRIVER; - struct nouveau_ws_device *ws_dev = - nouveau_ws_device_new(drm_device, debug_flags); + struct nouveau_ws_device *ws_dev = nouveau_ws_device_new(drm_device); if (!ws_dev) return vk_error(log_obj, VK_ERROR_INCOMPATIBLE_DRIVER); diff --git a/src/nouveau/vulkan/nvkmd/nvkmd.h b/src/nouveau/vulkan/nvkmd/nvkmd.h index 185795fb57c..aa0605a2a5e 100644 --- a/src/nouveau/vulkan/nvkmd/nvkmd.h +++ b/src/nouveau/vulkan/nvkmd/nvkmd.h @@ -8,8 +8,8 @@ #include "nv_device_info.h" #include "util/u_atomic.h" +#include "../nvk_debug.h" #include "vulkan/vulkan_core.h" -#include "nouveau_device.h" #include #include diff --git a/src/nouveau/winsys/nouveau_device.c b/src/nouveau/winsys/nouveau_device.c index 07273d20a86..25ccc64c98e 100644 --- a/src/nouveau/winsys/nouveau_device.c +++ b/src/nouveau/winsys/nouveau_device.c @@ -256,8 +256,7 @@ nouveau_ws_device_info(int fd, struct nouveau_ws_device *dev) } struct nouveau_ws_device * -nouveau_ws_device_new(drmDevicePtr drm_device, - enum nvk_debug debug_flags) +nouveau_ws_device_new(drmDevicePtr drm_device) { const char *path = drm_device->nodes[DRM_NODE_RENDER]; struct nouveau_ws_device *device = CALLOC_STRUCT(nouveau_ws_device); @@ -353,8 +352,6 @@ nouveau_ws_device_new(drmDevicePtr drm_device, device->info.gpc_count = (value >> 0) & 0x000000ff; device->info.tpc_count = (value >> 8) & 0x0000ffff; - device->debug_flags = debug_flags; - struct nouveau_ws_context *tmp_ctx; if (nouveau_ws_context_create(device, ~0, &tmp_ctx)) goto out_err; diff --git a/src/nouveau/winsys/nouveau_device.h b/src/nouveau/winsys/nouveau_device.h index d3777e0b46d..b3824115dd4 100644 --- a/src/nouveau/winsys/nouveau_device.h +++ b/src/nouveau/winsys/nouveau_device.h @@ -14,33 +14,6 @@ struct hash_table; extern "C" { #endif - -enum nvk_debug { - /* dumps all push buffers after submission */ - NVK_DEBUG_PUSH_DUMP = 1ull << 0, - - /* push buffer submissions wait on completion - * - * This is useful to find the submission killing the GPU context. For - * easier debugging it also dumps the buffer leading to that. - */ - NVK_DEBUG_PUSH_SYNC = 1ull << 1, - - /* Zero all client memory allocations - */ - NVK_DEBUG_ZERO_MEMORY = 1ull << 2, - - /* Dump VM bind/unbinds - */ - NVK_DEBUG_VM = 1ull << 3, - - /* Disable most cbufs - * - * Root descriptors still end up in a cbuf - */ - NVK_DEBUG_NO_CBUF = 1ull << 5, -}; - #define NOUVEAU_WS_DEVICE_KERNEL_RESERVATION_START (1ull << 39) struct nouveau_ws_device { @@ -51,16 +24,13 @@ struct nouveau_ws_device { uint32_t max_push; uint32_t local_mem_domain; - enum nvk_debug debug_flags; - simple_mtx_t bos_lock; struct hash_table *bos; bool has_vm_bind; }; -struct nouveau_ws_device *nouveau_ws_device_new(struct _drmDevice *drm_device, - enum nvk_debug debug_flags); +struct nouveau_ws_device *nouveau_ws_device_new(struct _drmDevice *drm_device); void nouveau_ws_device_destroy(struct nouveau_ws_device *); uint64_t nouveau_ws_device_vram_used(struct nouveau_ws_device *);