~mmach/netext73/mesa-haswell

« back to all changes in this revision

Viewing changes to src/gallium/drivers/nouveau/nouveau_screen.h

  • Committer: mmach
  • Date: 2022-09-22 19:56:13 UTC
  • Revision ID: netbit73@gmail.com-20220922195613-wtik9mmy20tmor0i
2022-09-22 21:17:09

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef __NOUVEAU_SCREEN_H__
2
 
#define __NOUVEAU_SCREEN_H__
3
 
 
4
 
#include "pipe/p_screen.h"
5
 
#include "util/disk_cache.h"
6
 
#include "util/u_atomic.h"
7
 
#include "util/u_memory.h"
8
 
 
9
 
#ifndef NDEBUG
10
 
# define NOUVEAU_ENABLE_DRIVER_STATISTICS
11
 
#endif
12
 
 
13
 
typedef uint32_t u32;
14
 
typedef uint16_t u16;
15
 
 
16
 
extern int nouveau_mesa_debug;
17
 
 
18
 
struct nouveau_bo;
19
 
 
20
 
#define NOUVEAU_SHADER_CACHE_FLAGS_IR_TGSI 0 << 0
21
 
#define NOUVEAU_SHADER_CACHE_FLAGS_IR_NIR  1 << 0
22
 
 
23
 
struct nouveau_screen {
24
 
   struct pipe_screen base;
25
 
   struct nouveau_drm *drm;
26
 
   struct nouveau_device *device;
27
 
   struct nouveau_object *channel;
28
 
   struct nouveau_client *client;
29
 
   struct nouveau_pushbuf *pushbuf;
30
 
 
31
 
   char chipset_name[8];
32
 
 
33
 
   int refcount;
34
 
 
35
 
   unsigned transfer_pushbuf_threshold;
36
 
 
37
 
   unsigned vidmem_bindings; /* PIPE_BIND_* where VRAM placement is desired */
38
 
   unsigned sysmem_bindings; /* PIPE_BIND_* where GART placement is desired */
39
 
   unsigned lowmem_bindings; /* PIPE_BIND_* that require an address < 4 GiB */
40
 
   /*
41
 
    * For bindings with (vidmem & sysmem) bits set, PIPE_USAGE_* decides
42
 
    * placement.
43
 
    */
44
 
 
45
 
   uint16_t class_3d;
46
 
 
47
 
   struct {
48
 
      struct nouveau_fence *head;
49
 
      struct nouveau_fence *tail;
50
 
      struct nouveau_fence *current;
51
 
      u32 sequence;
52
 
      u32 sequence_ack;
53
 
      void (*emit)(struct pipe_screen *, u32 *sequence);
54
 
      u32  (*update)(struct pipe_screen *);
55
 
   } fence;
56
 
 
57
 
   struct nouveau_mman *mm_VRAM;
58
 
   struct nouveau_mman *mm_GART;
59
 
 
60
 
   int64_t cpu_gpu_time_delta;
61
 
 
62
 
   bool hint_buf_keep_sysmem_copy;
63
 
   bool tegra_sector_layout;
64
 
 
65
 
   unsigned vram_domain;
66
 
 
67
 
   struct {
68
 
      unsigned profiles_checked;
69
 
      unsigned profiles_present;
70
 
   } firmware_info;
71
 
 
72
 
   struct disk_cache *disk_shader_cache;
73
 
 
74
 
   bool prefer_nir;
75
 
   bool force_enable_cl;
76
 
   bool has_svm;
77
 
   void *svm_cutout;
78
 
   size_t svm_cutout_size;
79
 
 
80
 
#ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
81
 
   union {
82
 
      uint64_t v[29];
83
 
      struct {
84
 
         uint64_t tex_obj_current_count;
85
 
         uint64_t tex_obj_current_bytes;
86
 
         uint64_t buf_obj_current_count;
87
 
         uint64_t buf_obj_current_bytes_vid;
88
 
         uint64_t buf_obj_current_bytes_sys;
89
 
         uint64_t tex_transfers_rd;
90
 
         uint64_t tex_transfers_wr;
91
 
         uint64_t tex_copy_count;
92
 
         uint64_t tex_blit_count;
93
 
         uint64_t tex_cache_flush_count;
94
 
         uint64_t buf_transfers_rd;
95
 
         uint64_t buf_transfers_wr;
96
 
         uint64_t buf_read_bytes_staging_vid;
97
 
         uint64_t buf_write_bytes_direct;
98
 
         uint64_t buf_write_bytes_staging_vid;
99
 
         uint64_t buf_write_bytes_staging_sys;
100
 
         uint64_t buf_copy_bytes;
101
 
         uint64_t buf_non_kernel_fence_sync_count;
102
 
         uint64_t any_non_kernel_fence_sync_count;
103
 
         uint64_t query_sync_count;
104
 
         uint64_t gpu_serialize_count;
105
 
         uint64_t draw_calls_array;
106
 
         uint64_t draw_calls_indexed;
107
 
         uint64_t draw_calls_fallback_count;
108
 
         uint64_t user_buffer_upload_bytes;
109
 
         uint64_t constbuf_upload_count;
110
 
         uint64_t constbuf_upload_bytes;
111
 
         uint64_t pushbuf_count;
112
 
         uint64_t resource_validate_count;
113
 
      } named;
114
 
   } stats;
115
 
#endif
116
 
};
117
 
 
118
 
#define NV_VRAM_DOMAIN(screen) ((screen)->vram_domain)
119
 
 
120
 
#ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
121
 
# define NOUVEAU_DRV_STAT(s, n, v) do {         \
122
 
      p_atomic_add(&(s)->stats.named.n, (v));   \
123
 
   } while(0)
124
 
# define NOUVEAU_DRV_STAT_RES(r, n, v) do {                                \
125
 
      p_atomic_add(&nouveau_screen((r)->base.screen)->stats.named.n, v);   \
126
 
   } while(0)
127
 
# define NOUVEAU_DRV_STAT_IFD(x) x
128
 
#else
129
 
# define NOUVEAU_DRV_STAT(s, n, v)     do { } while(0)
130
 
# define NOUVEAU_DRV_STAT_RES(r, n, v) do { } while(0)
131
 
# define NOUVEAU_DRV_STAT_IFD(x)
132
 
#endif
133
 
 
134
 
static inline struct nouveau_screen *
135
 
nouveau_screen(struct pipe_screen *pscreen)
136
 
{
137
 
   return (struct nouveau_screen *)pscreen;
138
 
}
139
 
 
140
 
bool nouveau_drm_screen_unref(struct nouveau_screen *screen);
141
 
 
142
 
bool
143
 
nouveau_screen_bo_get_handle(struct pipe_screen *pscreen,
144
 
                             struct nouveau_bo *bo,
145
 
                             unsigned stride,
146
 
                             struct winsys_handle *whandle);
147
 
struct nouveau_bo *
148
 
nouveau_screen_bo_from_handle(struct pipe_screen *pscreen,
149
 
                              struct winsys_handle *whandle,
150
 
                              unsigned *out_stride);
151
 
 
152
 
 
153
 
int nouveau_screen_init(struct nouveau_screen *, struct nouveau_device *);
154
 
void nouveau_screen_fini(struct nouveau_screen *);
155
 
 
156
 
void nouveau_screen_init_vdec(struct nouveau_screen *);
157
 
 
158
 
#endif