nouveau: match gallium code reorginisation.
[mesa.git] / src / gallium / winsys / dri / nouveau / nouveau_context.h
1 #ifndef __NOUVEAU_CONTEXT_H__
2 #define __NOUVEAU_CONTEXT_H__
3
4 #include "dri_util.h"
5 #include "xmlconfig.h"
6
7 #include "nouveau/nouveau_winsys.h"
8 #include "nouveau_device.h"
9 #include "nouveau_drmif.h"
10 #include "nouveau_dma.h"
11
12 struct nouveau_framebuffer {
13 struct st_framebuffer *stfb;
14 };
15
16 struct nouveau_context {
17 struct st_context *st;
18
19 /* Misc HW info */
20 uint64_t chipset;
21
22 /* DRI stuff */
23 __DRIscreenPrivate *dri_screen;
24 __DRIdrawablePrivate *dri_drawable;
25 unsigned int last_stamp;
26 driOptionCache dri_option_cache;
27 drm_context_t drm_context;
28 drmLock drm_lock;
29 GLboolean locked;
30 struct nouveau_screen *nv_screen;
31 struct pipe_surface *frontbuffer;
32
33 /* Hardware context */
34 struct nouveau_channel *channel;
35 struct nouveau_notifier *sync_notifier;
36 struct nouveau_grobj *NvNull;
37 struct nouveau_grobj *NvCtxSurf2D;
38 struct nouveau_grobj *NvImageBlit;
39 struct nouveau_grobj *NvGdiRect;
40 struct nouveau_grobj *NvM2MF;
41 struct nouveau_grobj *Nv2D;
42 uint32_t next_handle;
43 uint32_t next_subchannel;
44 uint32_t next_sequence;
45
46 /* pipe_surface accel */
47 struct pipe_surface *surf_src, *surf_dst;
48 unsigned surf_src_offset, surf_dst_offset;
49 int (*surface_copy_prep)(struct nouveau_context *,
50 struct pipe_surface *dst,
51 struct pipe_surface *src);
52 void (*surface_copy)(struct nouveau_context *, unsigned dx, unsigned dy,
53 unsigned sx, unsigned sy, unsigned w, unsigned h);
54 void (*surface_copy_done)(struct nouveau_context *);
55 int (*surface_fill)(struct nouveau_context *, struct pipe_surface *,
56 unsigned, unsigned, unsigned, unsigned, unsigned);
57 };
58
59 extern GLboolean nouveau_context_create(const __GLcontextModes *,
60 __DRIcontextPrivate *, void *);
61 extern void nouveau_context_destroy(__DRIcontextPrivate *);
62 extern GLboolean nouveau_context_bind(__DRIcontextPrivate *,
63 __DRIdrawablePrivate *draw,
64 __DRIdrawablePrivate *read);
65 extern GLboolean nouveau_context_unbind(__DRIcontextPrivate *);
66
67 #ifdef DEBUG
68 extern int __nouveau_debug;
69
70 #define DEBUG_BO (1 << 0)
71
72 #define DBG(flag, ...) do { \
73 if (__nouveau_debug & (DEBUG_##flag)) \
74 NOUVEAU_ERR(__VA_ARGS__); \
75 } while(0)
76 #else
77 #define DBG(flag, ...)
78 #endif
79
80 extern void LOCK_HARDWARE(struct nouveau_context *);
81 extern void UNLOCK_HARDWARE(struct nouveau_context *);
82
83 extern int nouveau_surface_init_nv04(struct nouveau_context *);
84 extern int nouveau_surface_init_nv50(struct nouveau_context *);
85
86 extern uint32_t *nouveau_pipe_dma_beginp(struct nouveau_grobj *, int, int);
87 extern void nouveau_pipe_dma_kickoff(struct nouveau_channel *);
88
89 #endif