1 #ifndef __NOUVEAU_CONTEXT_H__
2 #define __NOUVEAU_CONTEXT_H__
7 #include "nouveau/nouveau_winsys.h"
8 #include "nouveau_drmif.h"
9 #include "nouveau_dma.h"
11 struct nouveau_framebuffer
{
12 struct st_framebuffer
*stfb
;
15 struct nouveau_channel_context
{
16 struct pipe_screen
*pscreen
;
21 struct pipe_context
**pctx
;
23 struct nouveau_channel
*channel
;
25 struct nouveau_notifier
*sync_notifier
;
28 struct nouveau_grobj
*NvM2MF
;
30 struct nouveau_grobj
*NvCtxSurf2D
;
31 struct nouveau_grobj
*NvSwzSurf
;
32 struct nouveau_grobj
*NvImageBlit
;
33 struct nouveau_grobj
*NvGdiRect
;
34 struct nouveau_grobj
*NvSIFM
;
36 struct nouveau_grobj
*Nv2D
;
39 uint32_t next_subchannel
;
40 uint32_t next_sequence
;
43 struct nouveau_context
{
44 struct st_context
*st
;
47 __DRIscreenPrivate
*dri_screen
;
48 __DRIdrawablePrivate
*dri_drawable
;
49 unsigned int last_stamp
;
50 driOptionCache dri_option_cache
;
51 drm_context_t drm_context
;
54 struct nouveau_screen
*nv_screen
;
55 struct pipe_surface
*frontbuffer
;
62 /* Hardware context */
63 struct nouveau_channel_context
*nvc
;
66 /* pipe_surface accel */
67 struct pipe_surface
*surf_src
, *surf_dst
;
68 unsigned surf_src_offset
, surf_dst_offset
;
69 int (*surface_copy_prep
)(struct nouveau_context
*,
70 struct pipe_surface
*dst
,
71 struct pipe_surface
*src
);
72 void (*surface_copy
)(struct nouveau_context
*, unsigned dx
, unsigned dy
,
73 unsigned sx
, unsigned sy
, unsigned w
, unsigned h
);
74 void (*surface_copy_done
)(struct nouveau_context
*);
75 int (*surface_fill
)(struct nouveau_context
*, struct pipe_surface
*,
76 unsigned, unsigned, unsigned, unsigned, unsigned);
79 extern GLboolean
nouveau_context_create(const __GLcontextModes
*,
80 __DRIcontextPrivate
*, void *);
81 extern void nouveau_context_destroy(__DRIcontextPrivate
*);
82 extern GLboolean
nouveau_context_bind(__DRIcontextPrivate
*,
83 __DRIdrawablePrivate
*draw
,
84 __DRIdrawablePrivate
*read
);
85 extern GLboolean
nouveau_context_unbind(__DRIcontextPrivate
*);
88 extern int __nouveau_debug
;
90 #define DEBUG_BO (1 << 0)
92 #define DBG(flag, ...) do { \
93 if (__nouveau_debug & (DEBUG_##flag)) \
94 NOUVEAU_ERR(__VA_ARGS__); \
97 #define DBG(flag, ...)
100 extern void LOCK_HARDWARE(struct nouveau_context
*);
101 extern void UNLOCK_HARDWARE(struct nouveau_context
*);
104 nouveau_surface_channel_create_nv04(struct nouveau_channel_context
*);
106 nouveau_surface_channel_create_nv50(struct nouveau_channel_context
*);
107 extern int nouveau_surface_init_nv04(struct nouveau_context
*);
108 extern int nouveau_surface_init_nv50(struct nouveau_context
*);
110 extern uint32_t *nouveau_pipe_dma_beginp(struct nouveau_grobj
*, int, int);
111 extern void nouveau_pipe_dma_kickoff(struct nouveau_channel
*);