summaryrefslogtreecommitdiff
path: root/src/nouveau/winsys/nouveau_device.h
blob: 0468c1405287af262777a61ab4924d5960aae072 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef NOUVEAU_DEVICE
#define NOUVEAU_DEVICE 1

#include "nouveau_private.h"
#include "nv_device_info.h"
#include "util/simple_mtx.h"
#include "util/vma.h"

#include <stddef.h>

struct _drmDevice;
struct hash_table;

#ifdef __cplusplus
extern "C" {
#endif

#ifndef NVK_NEW_UAPI
#define NVK_NEW_UAPI 1
#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,
};

struct nouveau_ws_device {
   int fd;

   struct nv_device_info info;

   uint32_t local_mem_domain;

   enum nvk_debug debug_flags;

   simple_mtx_t bos_lock;
   struct hash_table *bos;

#if NVK_NEW_UAPI == 1
   bool has_vm_bind;
   struct util_vma_heap vma_heap;
   simple_mtx_t vma_mutex;
#endif
};

struct nouveau_ws_device *nouveau_ws_device_new(struct _drmDevice *drm_device);
void nouveau_ws_device_destroy(struct nouveau_ws_device *);

#ifdef __cplusplus
}
#endif

#endif