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)
85 R600_SHADER_MAX
= R600_SHADER_FS
,
88 enum radeon_family
radeon_get_family(struct radeon
*rw
);
91 * radeon object functions
101 struct radeon_bo
*radeon_bo(struct radeon
*radeon
, unsigned handle
,
102 unsigned size
, unsigned alignment
, void *ptr
);
103 int radeon_bo_map(struct radeon
*radeon
, struct radeon_bo
*bo
);
104 void radeon_bo_unmap(struct radeon
*radeon
, struct radeon_bo
*bo
);
105 struct radeon_bo
*radeon_bo_incref(struct radeon
*radeon
, struct radeon_bo
*bo
);
106 struct radeon_bo
*radeon_bo_decref(struct radeon
*radeon
, struct radeon_bo
*bo
);
107 int radeon_bo_wait(struct radeon
*radeon
, struct radeon_bo
*bo
);
109 struct radeon_stype_info
;
113 struct radeon_state
{
114 struct radeon
*radeon
;
116 struct radeon_stype_info
*stype
;
119 unsigned shader_index
;
127 struct radeon_bo
*bo
[4];
129 unsigned reloc_pm4_id
[8];
130 unsigned reloc_bo_id
[8];
132 unsigned bo_dirty
[4];
135 int radeon_state_init(struct radeon_state
*rstate
, struct radeon
*radeon
, u32 type
, u32 id
, u32 shader_class
);
136 void radeon_state_fini(struct radeon_state
*state
);
137 int radeon_state_pm4(struct radeon_state
*state
);
138 int radeon_state_convert(struct radeon_state
*state
, u32 stype
, u32 id
, u32 shader_type
);
144 struct radeon
*radeon
;
145 struct radeon_state
**state
;
148 int radeon_draw_init(struct radeon_draw
*draw
, struct radeon
*radeon
);
149 void radeon_draw_bind(struct radeon_draw
*draw
, struct radeon_state
*state
);
150 void radeon_draw_unbind(struct radeon_draw
*draw
, struct radeon_state
*state
);
153 * radeon context functions
156 struct radeon_cs_reloc
{
158 uint32_t read_domain
;
159 uint32_t write_domain
;
165 struct radeon
*radeon
;
170 struct radeon_cs_reloc
*reloc
;
172 struct radeon_bo
**bo
;
175 int radeon_ctx_init(struct radeon_ctx
*ctx
, struct radeon
*radeon
);
176 void radeon_ctx_fini(struct radeon_ctx
*ctx
);
177 void radeon_ctx_clear(struct radeon_ctx
*ctx
);
178 int radeon_ctx_set_draw(struct radeon_ctx
*ctx
, struct radeon_draw
*draw
);
179 int radeon_ctx_submit(struct radeon_ctx
*ctx
);
180 void radeon_ctx_dump_bof(struct radeon_ctx
*ctx
, const char *file
);
181 int radeon_ctx_set_query_state(struct radeon_ctx
*ctx
, struct radeon_state
*state
);
190 R600_STATE_RASTERIZER
,
195 R600_STATE_SHADER
, /* has PS,VS,GS,FS variants */
196 R600_STATE_CONSTANT
, /* has PS,VS,GS,FS variants */
197 R600_STATE_CBUF
, /* has PS,VS,GS,FS variants */
198 R600_STATE_RESOURCE
, /* has PS,VS,GS,FS variants */
199 R600_STATE_SAMPLER
, /* has PS,VS,GS,FS variants */
200 R600_STATE_SAMPLER_BORDER
, /* has PS,VS,GS,FS variants */
210 R600_STATE_QUERY_BEGIN
,
211 R600_STATE_QUERY_END
,
220 #include "r600_states_inc.h"
221 #include "eg_states_inc.h"
223 /* R600 QUERY BEGIN/END */
224 #define R600_QUERY__OFFSET 0
225 #define R600_QUERY_SIZE 1
226 #define R600_QUERY_PM4 128