nvk: Move debug flags int nvk_debug.h

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30033>
This commit is contained in:
Faith Ekstrand 2024-07-05 17:15:09 -05:00 committed by Marge Bot
parent d96bf198b4
commit d3264fdfb9
11 changed files with 44 additions and 42 deletions

View file

@ -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;

View file

@ -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',

View file

@ -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"

View file

@ -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 */

View file

@ -7,7 +7,7 @@
#include "nvk_private.h"
#include "nouveau_device.h"
#include "nvk_debug.h"
#include "vk_instance.h"
#include "util/xmlconfig.h"

View file

@ -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"

View file

@ -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);

View file

@ -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);

View file

@ -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 <assert.h>
#include <stdbool.h>

View file

@ -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;

View file

@ -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 *);