2 * Copyright © 2009 Jerome Glisse <glisse@freedesktop.org>
4 * This file is free software; you can redistribute it and/or modify
5 * it under the terms of version 2 of the GNU General Public License
6 * as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software Foundation,
15 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20 #define RADEON_CTX_MAX_PM4 (64 * 1024 / 4)
24 #include <pipe/p_compiler.h>
87 R600_SHADER_MAX
= R600_SHADER_FS
,
90 enum radeon_family
radeon_get_family(struct radeon
*rw
);
91 void radeon_set_mem_constant(struct radeon
*radeon
, boolean state
);
95 struct radeon_ws_bo
*radeon_ws_bo(struct radeon
*radeon
,
96 unsigned size
, unsigned alignment
, unsigned usage
);
97 struct radeon_ws_bo
*radeon_ws_bo_handle(struct radeon
*radeon
,
99 void *radeon_ws_bo_map(struct radeon
*radeon
, struct radeon_ws_bo
*bo
, unsigned usage
, void *ctx
);
100 void radeon_ws_bo_unmap(struct radeon
*radeon
, struct radeon_ws_bo
*bo
);
101 void radeon_ws_bo_reference(struct radeon
*radeon
, struct radeon_ws_bo
**dst
,
102 struct radeon_ws_bo
*src
);
104 struct radeon_stype_info
;
108 struct radeon_state
{
109 struct radeon
*radeon
;
111 struct radeon_stype_info
*stype
;
114 unsigned shader_index
;
122 struct radeon_ws_bo
*bo
[4];
124 unsigned reloc_pm4_id
[8];
125 unsigned reloc_bo_id
[8];
127 unsigned bo_dirty
[4];
130 int radeon_state_init(struct radeon_state
*rstate
, struct radeon
*radeon
, u32 type
, u32 id
, u32 shader_class
);
131 void radeon_state_fini(struct radeon_state
*state
);
132 int radeon_state_pm4(struct radeon_state
*state
);
133 int radeon_state_convert(struct radeon_state
*state
, u32 stype
, u32 id
, u32 shader_type
);
139 struct radeon
*radeon
;
140 struct radeon_state
**state
;
143 int radeon_draw_init(struct radeon_draw
*draw
, struct radeon
*radeon
);
144 void radeon_draw_bind(struct radeon_draw
*draw
, struct radeon_state
*state
);
145 void radeon_draw_unbind(struct radeon_draw
*draw
, struct radeon_state
*state
);
148 * radeon context functions
151 struct radeon_cs_reloc
{
153 uint32_t read_domain
;
154 uint32_t write_domain
;
161 struct radeon_ctx
*radeon_ctx_init(struct radeon
*radeon
);
162 void radeon_ctx_fini(struct radeon_ctx
*ctx
);
163 void radeon_ctx_clear(struct radeon_ctx
*ctx
);
164 int radeon_ctx_set_draw(struct radeon_ctx
*ctx
, struct radeon_draw
*draw
);
165 int radeon_ctx_submit(struct radeon_ctx
*ctx
);
166 void radeon_ctx_dump_bof(struct radeon_ctx
*ctx
, const char *file
);
167 int radeon_ctx_set_query_state(struct radeon_ctx
*ctx
, struct radeon_state
*state
);
176 R600_STATE_RASTERIZER
,
181 R600_STATE_SHADER
, /* has PS,VS,GS,FS variants */
182 R600_STATE_CONSTANT
, /* has PS,VS,GS,FS variants */
183 R600_STATE_CBUF
, /* has PS,VS,GS,FS variants */
184 R600_STATE_RESOURCE
, /* has PS,VS,GS,FS variants */
185 R600_STATE_SAMPLER
, /* has PS,VS,GS,FS variants */
186 R600_STATE_SAMPLER_BORDER
, /* has PS,VS,GS,FS variants */
196 R600_STATE_QUERY_BEGIN
,
197 R600_STATE_QUERY_END
,
206 #include "r600_states_inc.h"
207 #include "eg_states_inc.h"
209 /* R600 QUERY BEGIN/END */
210 #define R600_QUERY__OFFSET 0
211 #define R600_QUERY_SIZE 1
212 #define R600_QUERY_PM4 128
214 void r600_flush_ctx(void *data
);