freedreno: consolidate C sources list into Makefile.sources
[mesa.git] / src / gallium / drivers / nouveau / nouveau_screen.h
1 #ifndef __NOUVEAU_SCREEN_H__
2 #define __NOUVEAU_SCREEN_H__
3
4 #include "pipe/p_screen.h"
5 #include "util/u_memory.h"
6
7 #ifdef DEBUG
8 # define NOUVEAU_ENABLE_DRIVER_STATISTICS
9 #endif
10
11 typedef uint32_t u32;
12 typedef uint16_t u16;
13
14 extern int nouveau_mesa_debug;
15
16 struct nouveau_bo;
17
18 struct nouveau_screen {
19 struct pipe_screen base;
20 struct nouveau_device *device;
21 struct nouveau_object *channel;
22 struct nouveau_client *client;
23 struct nouveau_pushbuf *pushbuf;
24
25 unsigned vidmem_bindings; /* PIPE_BIND_* where VRAM placement is desired */
26 unsigned sysmem_bindings; /* PIPE_BIND_* where GART placement is desired */
27 unsigned lowmem_bindings; /* PIPE_BIND_* that require an address < 4 GiB */
28 /*
29 * For bindings with (vidmem & sysmem) bits set, PIPE_USAGE_* decides
30 * placement.
31 */
32
33 uint16_t class_3d;
34
35 struct {
36 struct nouveau_fence *head;
37 struct nouveau_fence *tail;
38 struct nouveau_fence *current;
39 u32 sequence;
40 u32 sequence_ack;
41 void (*emit)(struct pipe_screen *, u32 *sequence);
42 u32 (*update)(struct pipe_screen *);
43 } fence;
44
45 struct nouveau_mman *mm_VRAM;
46 struct nouveau_mman *mm_GART;
47
48 int64_t cpu_gpu_time_delta;
49
50 boolean hint_buf_keep_sysmem_copy;
51
52 #ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
53 union {
54 uint64_t v[29];
55 struct {
56 uint64_t tex_obj_current_count;
57 uint64_t tex_obj_current_bytes;
58 uint64_t buf_obj_current_count;
59 uint64_t buf_obj_current_bytes_vid;
60 uint64_t buf_obj_current_bytes_sys;
61 uint64_t tex_transfers_rd;
62 uint64_t tex_transfers_wr;
63 uint64_t tex_copy_count;
64 uint64_t tex_blit_count;
65 uint64_t tex_cache_flush_count;
66 uint64_t buf_transfers_rd;
67 uint64_t buf_transfers_wr;
68 uint64_t buf_read_bytes_staging_vid;
69 uint64_t buf_write_bytes_direct;
70 uint64_t buf_write_bytes_staging_vid;
71 uint64_t buf_write_bytes_staging_sys;
72 uint64_t buf_copy_bytes;
73 uint64_t buf_non_kernel_fence_sync_count;
74 uint64_t any_non_kernel_fence_sync_count;
75 uint64_t query_sync_count;
76 uint64_t gpu_serialize_count;
77 uint64_t draw_calls_array;
78 uint64_t draw_calls_indexed;
79 uint64_t draw_calls_fallback_count;
80 uint64_t user_buffer_upload_bytes;
81 uint64_t constbuf_upload_count;
82 uint64_t constbuf_upload_bytes;
83 uint64_t pushbuf_count;
84 uint64_t resource_validate_count;
85 } named;
86 } stats;
87 #endif
88 };
89
90 #ifdef NOUVEAU_ENABLE_DRIVER_STATISTICS
91 # define NOUVEAU_DRV_STAT(s, n, v) do { \
92 (s)->stats.named.n += (v); \
93 } while(0)
94 # define NOUVEAU_DRV_STAT_RES(r, n, v) do { \
95 nouveau_screen((r)->base.screen)->stats.named.n += (v); \
96 } while(0)
97 # define NOUVEAU_DRV_STAT_IFD(x) x
98 #else
99 # define NOUVEAU_DRV_STAT(s, n, v) do { } while(0)
100 # define NOUVEAU_DRV_STAT_RES(r, n, v) do { } while(0)
101 # define NOUVEAU_DRV_STAT_IFD(x)
102 #endif
103
104 static INLINE struct nouveau_screen *
105 nouveau_screen(struct pipe_screen *pscreen)
106 {
107 return (struct nouveau_screen *)pscreen;
108 }
109
110 boolean
111 nouveau_screen_bo_get_handle(struct pipe_screen *pscreen,
112 struct nouveau_bo *bo,
113 unsigned stride,
114 struct winsys_handle *whandle);
115 struct nouveau_bo *
116 nouveau_screen_bo_from_handle(struct pipe_screen *pscreen,
117 struct winsys_handle *whandle,
118 unsigned *out_stride);
119
120
121 int nouveau_screen_init(struct nouveau_screen *, struct nouveau_device *);
122 void nouveau_screen_fini(struct nouveau_screen *);
123
124 void nouveau_screen_init_vdec(struct nouveau_screen *);
125
126 #endif