nouveau: improve buffer transfers
[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 typedef uint32_t u32;
8
9 extern int nouveau_mesa_debug;
10
11 struct nouveau_bo;
12
13 struct nouveau_screen {
14 struct pipe_screen base;
15 struct nouveau_device *device;
16 struct nouveau_object *channel;
17 struct nouveau_client *client;
18 struct nouveau_pushbuf *pushbuf;
19
20 unsigned vidmem_bindings; /* PIPE_BIND_* where VRAM placement is desired */
21 unsigned sysmem_bindings; /* PIPE_BIND_* where GART placement is desired */
22 unsigned lowmem_bindings; /* PIPE_BIND_* that require an address < 4 GiB */
23 /*
24 * For bindings with (vidmem & sysmem) bits set, PIPE_USAGE_* decides
25 * placement.
26 */
27
28 uint16_t class_3d;
29
30 struct {
31 struct nouveau_fence *head;
32 struct nouveau_fence *tail;
33 struct nouveau_fence *current;
34 u32 sequence;
35 u32 sequence_ack;
36 void (*emit)(struct pipe_screen *, u32 *sequence);
37 u32 (*update)(struct pipe_screen *);
38 } fence;
39
40 struct nouveau_mman *mm_VRAM;
41 struct nouveau_mman *mm_GART;
42
43 int64_t cpu_gpu_time_delta;
44
45 boolean hint_buf_keep_sysmem_copy;
46 };
47
48 static INLINE struct nouveau_screen *
49 nouveau_screen(struct pipe_screen *pscreen)
50 {
51 return (struct nouveau_screen *)pscreen;
52 }
53
54 boolean
55 nouveau_screen_bo_get_handle(struct pipe_screen *pscreen,
56 struct nouveau_bo *bo,
57 unsigned stride,
58 struct winsys_handle *whandle);
59 struct nouveau_bo *
60 nouveau_screen_bo_from_handle(struct pipe_screen *pscreen,
61 struct winsys_handle *whandle,
62 unsigned *out_stride);
63
64
65 int nouveau_screen_init(struct nouveau_screen *, struct nouveau_device *);
66 void nouveau_screen_fini(struct nouveau_screen *);
67
68 void nouveau_screen_init_vdec(struct nouveau_screen *);
69
70 #endif