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 for (i
= 0; i
< NVFX_STATE_MAX
; i
++) {
36 if (nvfx
->state
.hw
[i
])
37 so_ref(NULL
, &nvfx
->state
.hw
[i
]);
41 draw_destroy(nvfx
->draw
);
46 nvfx_create(struct pipe_screen
*pscreen
, void *priv
)
48 struct nvfx_screen
*screen
= nvfx_screen(pscreen
);
49 struct pipe_winsys
*ws
= pscreen
->winsys
;
50 struct nvfx_context
*nvfx
;
51 struct nouveau_winsys
*nvws
= screen
->nvws
;
53 nvfx
= CALLOC(1, sizeof(struct nvfx_context
));
56 nvfx
->screen
= screen
;
60 nvfx
->pipe
.winsys
= ws
;
61 nvfx
->pipe
.screen
= pscreen
;
62 nvfx
->pipe
.priv
= priv
;
63 nvfx
->pipe
.destroy
= nvfx_destroy
;
64 nvfx
->pipe
.draw_arrays
= nvfx_draw_arrays
;
65 nvfx
->pipe
.draw_elements
= nvfx_draw_elements
;
66 nvfx
->pipe
.clear
= nvfx_clear
;
67 nvfx
->pipe
.flush
= nvfx_flush
;
69 screen
->base
.channel
->user_private
= nvfx
;
71 nvfx
->is_nv4x
= screen
->is_nv4x
;
73 nvfx_init_query_functions(nvfx
);
74 nvfx_init_surface_functions(nvfx
);
75 nvfx_init_state_functions(nvfx
);
76 nvfx_init_resource_functions(&nvfx
->pipe
);
78 /* Create, configure, and install fallback swtnl path */
79 nvfx
->draw
= draw_create();
80 draw_wide_point_threshold(nvfx
->draw
, 9999999.0);
81 draw_wide_line_threshold(nvfx
->draw
, 9999999.0);
82 draw_enable_line_stipple(nvfx
->draw
, FALSE
);
83 draw_enable_point_sprites(nvfx
->draw
, FALSE
);
84 draw_set_rasterize_stage(nvfx
->draw
, nvfx_draw_render_stage(nvfx
));
86 /* set these to that we init them on first validation */
87 nvfx
->state
.scissor_enabled
= ~0;