1#ifndef __NOUVEAU_SCREEN_H__
2#define __NOUVEAU_SCREEN_H__
3
4#include "pipe/p_screen.h"
5#include "util/u_memory.h"
6
7typedef uint32_t u32;
8
9extern int nouveau_mesa_debug;
10
11struct nouveau_bo;
12
13struct 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 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
46static INLINE struct nouveau_screen *
47nouveau_screen(struct pipe_screen *pscreen)
48{
49	return (struct nouveau_screen *)pscreen;
50}
51
52boolean
53nouveau_screen_bo_get_handle(struct pipe_screen *pscreen,
54			     struct nouveau_bo *bo,
55			     unsigned stride,
56			     struct winsys_handle *whandle);
57struct nouveau_bo *
58nouveau_screen_bo_from_handle(struct pipe_screen *pscreen,
59			      struct winsys_handle *whandle,
60			      unsigned *out_stride);
61
62
63int nouveau_screen_init(struct nouveau_screen *, struct nouveau_device *);
64void nouveau_screen_fini(struct nouveau_screen *);
65
66void nouveau_screen_init_vdec(struct nouveau_screen *);
67
68#endif
69