1 #ifndef __NOUVEAU_CONTEXT_H__
2 #define __NOUVEAU_CONTEXT_H__
4 /*#include "xmlconfig.h"*/
7 #include "nouveau/nouveau_winsys.h"
8 #include "nouveau_drmif.h"
9 #include "nouveau_dma.h"
11 struct nouveau_channel_context
{
12 struct pipe_screen
*pscreen
;
17 struct pipe_context
**pctx
;
19 struct nouveau_channel
*channel
;
21 struct nouveau_notifier
*sync_notifier
;
24 struct nouveau_grobj
*NvM2MF
;
26 struct nouveau_grobj
*NvCtxSurf2D
;
27 struct nouveau_grobj
*NvSwzSurf
;
28 struct nouveau_grobj
*NvImageBlit
;
29 struct nouveau_grobj
*NvGdiRect
;
30 struct nouveau_grobj
*NvSIFM
;
32 struct nouveau_grobj
*Nv2D
;
35 uint32_t next_subchannel
;
36 uint32_t next_sequence
;
39 struct nouveau_context
{
41 dri_context_t
*dri_context
;
42 dri_drawable_t
*dri_drawable
;
43 unsigned int last_stamp
;
44 /*driOptionCache dri_option_cache;*/
45 drm_context_t drm_context
;
48 struct nouveau_screen
*nv_screen
;
49 struct pipe_surface
*frontbuffer
;
56 /* Hardware context */
57 struct nouveau_channel_context
*nvc
;
60 /* pipe_surface accel */
61 struct pipe_surface
*surf_src
, *surf_dst
;
62 unsigned surf_src_offset
, surf_dst_offset
;
64 int (*surface_copy_prep
)(struct nouveau_context
*,
65 struct pipe_surface
*dst
,
66 struct pipe_surface
*src
);
67 void (*surface_copy
)(struct nouveau_context
*, unsigned dx
, unsigned dy
,
68 unsigned sx
, unsigned sy
, unsigned w
, unsigned h
);
69 void (*surface_copy_done
)(struct nouveau_context
*);
70 int (*surface_fill
)(struct nouveau_context
*, struct pipe_surface
*,
71 unsigned, unsigned, unsigned, unsigned, unsigned);
74 extern int nouveau_context_create(dri_context_t
*);
75 extern void nouveau_context_destroy(dri_context_t
*);
76 extern int nouveau_context_bind(struct nouveau_context
*, dri_drawable_t
*);
77 extern int nouveau_context_unbind(struct nouveau_context
*);
80 extern int __nouveau_debug
;
82 #define DEBUG_BO (1 << 0)
84 #define DBG(flag, ...) do { \
85 if (__nouveau_debug & (DEBUG_##flag)) \
86 NOUVEAU_ERR(__VA_ARGS__); \
89 #define DBG(flag, ...)
92 extern void LOCK_HARDWARE(struct nouveau_context
*);
93 extern void UNLOCK_HARDWARE(struct nouveau_context
*);
96 nouveau_surface_channel_create_nv04(struct nouveau_channel_context
*);
98 nouveau_surface_channel_create_nv50(struct nouveau_channel_context
*);
99 extern int nouveau_surface_init_nv04(struct nouveau_context
*);
100 extern int nouveau_surface_init_nv50(struct nouveau_context
*);
102 extern uint32_t *nouveau_pipe_dma_beginp(struct nouveau_grobj
*, int, int);
103 extern void nouveau_pipe_dma_kickoff(struct nouveau_channel
*);