1 #ifndef __NOUVEAU_CONTEXT_H__
2 #define __NOUVEAU_CONTEXT_H__
7 #include "pipe/nouveau/nouveau_winsys.h"
8 #include "nouveau_device.h"
9 #include "nouveau_drmif.h"
10 #include "nouveau_dma.h"
12 struct nouveau_framebuffer
{
13 struct st_framebuffer
*stfb
;
16 struct nouveau_context
{
17 struct st_context
*st
;
23 __DRIscreenPrivate
*dri_screen
;
24 __DRIdrawablePrivate
*dri_drawable
;
25 unsigned int last_stamp
;
26 driOptionCache dri_option_cache
;
27 drm_context_t drm_context
;
30 struct nouveau_screen
*nv_screen
;
31 struct pipe_surface
*frontbuffer
;
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
;
43 uint32_t next_subchannel
;
44 uint32_t next_sequence
;
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);
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
*);
68 extern int __nouveau_debug
;
70 #define DEBUG_BO (1 << 0)
72 #define DBG(flag, ...) do { \
73 if (__nouveau_debug & (DEBUG_##flag)) \
74 NOUVEAU_ERR(__VA_ARGS__); \
77 #define DBG(flag, ...)
80 extern void LOCK_HARDWARE(struct nouveau_context
*);
81 extern void UNLOCK_HARDWARE(struct nouveau_context
*);
83 extern int nouveau_surface_init_nv04(struct nouveau_context
*);
84 extern int nouveau_surface_init_nv50(struct nouveau_context
*);
86 extern uint32_t *nouveau_pipe_dma_beginp(struct nouveau_grobj
*, int, int);
87 extern void nouveau_pipe_dma_kickoff(struct nouveau_channel
*);