1 #include "draw/draw_context.h"
2 #include "pipe/p_defines.h"
3 #include "util/u_simple_screen.h"
5 #include "nv40_context.h"
6 #include "nv40_screen.h"
9 nv40_flush(struct pipe_context
*pipe
, unsigned flags
,
10 struct pipe_fence_handle
**fence
)
12 struct nv40_context
*nv40
= nv40_context(pipe
);
13 struct nv40_screen
*screen
= nv40
->screen
;
14 struct nouveau_channel
*chan
= screen
->base
.channel
;
15 struct nouveau_grobj
*curie
= screen
->curie
;
17 if (flags
& PIPE_FLUSH_TEXTURE_CACHE
) {
18 BEGIN_RING(chan
, curie
, 0x1fd8, 1);
20 BEGIN_RING(chan
, curie
, 0x1fd8, 1);
30 nv40_destroy(struct pipe_context
*pipe
)
32 struct nv40_context
*nv40
= nv40_context(pipe
);
35 for (i
= 0; i
< NV40_STATE_MAX
; i
++) {
36 if (nv40
->state
.hw
[i
])
37 so_ref(NULL
, &nv40
->state
.hw
[i
]);
41 draw_destroy(nv40
->draw
);
46 nv40_create(struct pipe_screen
*pscreen
, unsigned pctx_id
)
48 struct nv40_screen
*screen
= nv40_screen(pscreen
);
49 struct pipe_winsys
*ws
= pscreen
->winsys
;
50 struct nv40_context
*nv40
;
51 struct nouveau_winsys
*nvws
= screen
->nvws
;
53 nv40
= CALLOC(1, sizeof(struct nv40_context
));
56 nv40
->screen
= screen
;
57 nv40
->pctx_id
= pctx_id
;
61 nv40
->pipe
.winsys
= ws
;
62 nv40
->pipe
.screen
= pscreen
;
63 nv40
->pipe
.destroy
= nv40_destroy
;
64 nv40
->pipe
.draw_arrays
= nv40_draw_arrays
;
65 nv40
->pipe
.draw_elements
= nv40_draw_elements
;
66 nv40
->pipe
.clear
= nv40_clear
;
67 nv40
->pipe
.flush
= nv40_flush
;
69 nv40
->pipe
.is_texture_referenced
= nouveau_is_texture_referenced
;
70 nv40
->pipe
.is_buffer_referenced
= nouveau_is_buffer_referenced
;
72 screen
->base
.channel
->user_private
= nv40
;
73 screen
->base
.channel
->flush_notify
= nv40_state_flush_notify
;
75 nv40_init_query_functions(nv40
);
76 nv40_init_surface_functions(nv40
);
77 nv40_init_state_functions(nv40
);
79 /* Create, configure, and install fallback swtnl path */
80 nv40
->draw
= draw_create();
81 draw_wide_point_threshold(nv40
->draw
, 9999999.0);
82 draw_wide_line_threshold(nv40
->draw
, 9999999.0);
83 draw_enable_line_stipple(nv40
->draw
, FALSE
);
84 draw_enable_point_sprites(nv40
->draw
, FALSE
);
85 draw_set_rasterize_stage(nv40
->draw
, nv40_draw_render_stage(nv40
));