1 #include "draw/draw_context.h"
2 #include "pipe/p_defines.h"
4 #include "nvfx_context.h"
5 #include "nvfx_screen.h"
6 #include "nvfx_resource.h"
9 nvfx_flush(struct pipe_context
*pipe
, unsigned flags
,
10 struct pipe_fence_handle
**fence
)
12 struct nvfx_context
*nvfx
= nvfx_context(pipe
);
13 struct nvfx_screen
*screen
= nvfx
->screen
;
14 struct nouveau_channel
*chan
= screen
->base
.channel
;
15 struct nouveau_grobj
*eng3d
= screen
->eng3d
;
17 if (flags
& PIPE_FLUSH_TEXTURE_CACHE
) {
18 BEGIN_RING(chan
, eng3d
, 0x1fd8, 1);
20 BEGIN_RING(chan
, eng3d
, 0x1fd8, 1);
30 nvfx_destroy(struct pipe_context
*pipe
)
32 struct nvfx_context
*nvfx
= nvfx_context(pipe
);
35 draw_destroy(nvfx
->draw
);
40 nvfx_create(struct pipe_screen
*pscreen
, void *priv
)
42 struct nvfx_screen
*screen
= nvfx_screen(pscreen
);
43 struct pipe_winsys
*ws
= pscreen
->winsys
;
44 struct nvfx_context
*nvfx
;
45 struct nouveau_winsys
*nvws
= screen
->nvws
;
47 nvfx
= CALLOC(1, sizeof(struct nvfx_context
));
50 nvfx
->screen
= screen
;
54 nvfx
->pipe
.winsys
= ws
;
55 nvfx
->pipe
.screen
= pscreen
;
56 nvfx
->pipe
.priv
= priv
;
57 nvfx
->pipe
.destroy
= nvfx_destroy
;
58 nvfx
->pipe
.draw_arrays
= nvfx_draw_arrays
;
59 nvfx
->pipe
.draw_elements
= nvfx_draw_elements
;
60 nvfx
->pipe
.clear
= nvfx_clear
;
61 nvfx
->pipe
.flush
= nvfx_flush
;
63 screen
->base
.channel
->user_private
= nvfx
;
65 nvfx
->is_nv4x
= screen
->is_nv4x
;
67 nvfx_init_query_functions(nvfx
);
68 nvfx_init_surface_functions(nvfx
);
69 nvfx_init_state_functions(nvfx
);
70 nvfx_init_resource_functions(&nvfx
->pipe
);
72 /* Create, configure, and install fallback swtnl path */
73 nvfx
->draw
= draw_create(&nvfx
->pipe
);
74 draw_wide_point_threshold(nvfx
->draw
, 9999999.0);
75 draw_wide_line_threshold(nvfx
->draw
, 9999999.0);
76 draw_enable_line_stipple(nvfx
->draw
, FALSE
);
77 draw_enable_point_sprites(nvfx
->draw
, FALSE
);
78 draw_set_rasterize_stage(nvfx
->draw
, nvfx_draw_render_stage(nvfx
));
80 /* set these to that we init them on first validation */
81 nvfx
->state
.scissor_enabled
= ~0;
82 nvfx
->state
.stipple_enabled
= ~0;