1 #include "draw/draw_context.h"
2 #include "pipe/p_defines.h"
4 #include "nvfx_context.h"
5 #include "nvfx_screen.h"
8 nv30_flush(struct pipe_context
*pipe
, unsigned flags
,
9 struct pipe_fence_handle
**fence
)
11 struct nvfx_context
*nvfx
= nvfx_context(pipe
);
12 struct nvfx_screen
*screen
= nvfx
->screen
;
13 struct nouveau_channel
*chan
= screen
->base
.channel
;
14 struct nouveau_grobj
*eng3d
= screen
->eng3d
;
16 if (flags
& PIPE_FLUSH_TEXTURE_CACHE
) {
17 BEGIN_RING(chan
, eng3d
, 0x1fd8, 1);
19 BEGIN_RING(chan
, eng3d
, 0x1fd8, 1);
29 nv30_destroy(struct pipe_context
*pipe
)
31 struct nvfx_context
*nvfx
= nvfx_context(pipe
);
34 for (i
= 0; i
< NVFX_STATE_MAX
; i
++) {
35 if (nvfx
->state
.hw
[i
])
36 so_ref(NULL
, &nvfx
->state
.hw
[i
]);
40 draw_destroy(nvfx
->draw
);
45 nv30_create(struct pipe_screen
*pscreen
, void *priv
)
47 struct nvfx_screen
*screen
= nvfx_screen(pscreen
);
48 struct pipe_winsys
*ws
= pscreen
->winsys
;
49 struct nvfx_context
*nvfx
;
50 struct nouveau_winsys
*nvws
= screen
->nvws
;
52 nvfx
= CALLOC(1, sizeof(struct nvfx_context
));
55 nvfx
->screen
= screen
;
59 nvfx
->pipe
.winsys
= ws
;
60 nvfx
->pipe
.screen
= pscreen
;
61 nvfx
->pipe
.priv
= priv
;
62 nvfx
->pipe
.destroy
= nv30_destroy
;
63 nvfx
->pipe
.draw_arrays
= nvfx_draw_arrays
;
64 nvfx
->pipe
.draw_elements
= nvfx_draw_elements
;
65 nvfx
->pipe
.clear
= nvfx_clear
;
66 nvfx
->pipe
.flush
= nv30_flush
;
68 nvfx
->pipe
.is_texture_referenced
= nouveau_is_texture_referenced
;
69 nvfx
->pipe
.is_buffer_referenced
= nouveau_is_buffer_referenced
;
71 screen
->base
.channel
->user_private
= nvfx
;
72 screen
->base
.channel
->flush_notify
= nvfx_state_flush_notify
;
74 nvfx
->is_nv4x
= screen
->is_nv4x
;
76 nvfx_init_query_functions(nvfx
);
77 nvfx_init_surface_functions(nvfx
);
78 nvfx_init_state_functions(nvfx
);
79 nvfx_init_transfer_functions(nvfx
);
81 /* Create, configure, and install fallback swtnl path */
82 nvfx
->draw
= draw_create();
83 draw_wide_point_threshold(nvfx
->draw
, 9999999.0);
84 draw_wide_line_threshold(nvfx
->draw
, 9999999.0);
85 draw_enable_line_stipple(nvfx
->draw
, FALSE
);
86 draw_enable_point_sprites(nvfx
->draw
, FALSE
);
87 draw_set_rasterize_stage(nvfx
->draw
, nvfx_draw_render_stage(nvfx
));