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>
93 R600_SHADER_MAX
= R600_SHADER_FS
,
96 enum radeon_family
radeon_get_family(struct radeon
*rw
);
97 enum chip_class
radeon_get_family_class(struct radeon
*radeon
);
98 void radeon_set_mem_constant(struct radeon
*radeon
, boolean state
);
102 struct radeon_ws_bo
*radeon_ws_bo(struct radeon
*radeon
,
103 unsigned size
, unsigned alignment
, unsigned usage
);
104 struct radeon_ws_bo
*radeon_ws_bo_handle(struct radeon
*radeon
,
106 void *radeon_ws_bo_map(struct radeon
*radeon
, struct radeon_ws_bo
*bo
, unsigned usage
, void *ctx
);
107 void radeon_ws_bo_unmap(struct radeon
*radeon
, struct radeon_ws_bo
*bo
);
108 void radeon_ws_bo_reference(struct radeon
*radeon
, struct radeon_ws_bo
**dst
,
109 struct radeon_ws_bo
*src
);
111 struct radeon_stype_info
;
113 /* currently limited to max buffers in a cb flush */
114 #define RADEON_STATE_MAX_BO 8
118 struct radeon_state
{
119 struct radeon
*radeon
;
121 struct radeon_stype_info
*stype
;
124 unsigned shader_index
;
132 struct radeon_ws_bo
*bo
[RADEON_STATE_MAX_BO
];
134 unsigned reloc_pm4_id
[8];
135 unsigned reloc_bo_id
[8];
137 unsigned bo_dirty
[4];
140 int radeon_state_init(struct radeon_state
*rstate
, struct radeon
*radeon
, u32 type
, u32 id
, u32 shader_class
);
141 void radeon_state_fini(struct radeon_state
*state
);
142 int radeon_state_pm4(struct radeon_state
*state
);
143 int radeon_state_convert(struct radeon_state
*state
, u32 stype
, u32 id
, u32 shader_type
);
149 struct radeon
*radeon
;
150 struct radeon_state
**state
;
153 int radeon_draw_init(struct radeon_draw
*draw
, struct radeon
*radeon
);
154 void radeon_draw_bind(struct radeon_draw
*draw
, struct radeon_state
*state
);
155 void radeon_draw_unbind(struct radeon_draw
*draw
, struct radeon_state
*state
);
158 * radeon context functions
161 struct radeon_cs_reloc
{
163 uint32_t read_domain
;
164 uint32_t write_domain
;
171 struct radeon_ctx
*radeon_ctx_init(struct radeon
*radeon
);
172 void radeon_ctx_fini(struct radeon_ctx
*ctx
);
173 void radeon_ctx_clear(struct radeon_ctx
*ctx
);
174 int radeon_ctx_set_draw(struct radeon_ctx
*ctx
, struct radeon_draw
*draw
);
175 int radeon_ctx_submit(struct radeon_ctx
*ctx
);
176 void radeon_ctx_dump_bof(struct radeon_ctx
*ctx
, const char *file
);
177 int radeon_ctx_set_query_state(struct radeon_ctx
*ctx
, struct radeon_state
*state
);
186 R600_STATE_RASTERIZER
,
191 R600_STATE_SHADER
, /* has PS,VS,GS,FS variants */
192 R600_STATE_CONSTANT
, /* has PS,VS,GS,FS variants */
193 R600_STATE_CBUF
, /* has PS,VS,GS,FS variants */
194 R600_STATE_RESOURCE
, /* has PS,VS,GS,FS variants */
195 R600_STATE_SAMPLER
, /* has PS,VS,GS,FS variants */
196 R600_STATE_SAMPLER_BORDER
, /* has PS,VS,GS,FS variants */
206 R600_STATE_QUERY_BEGIN
,
207 R600_STATE_QUERY_END
,
216 #include "r600_states_inc.h"
217 #include "eg_states_inc.h"
219 /* R600 QUERY BEGIN/END */
220 #define R600_QUERY__OFFSET 0
221 #define R600_QUERY_SIZE 1
222 #define R600_QUERY_PM4 128
224 void r600_flush_ctx(void *data
);