2
* Copyright © 2012 Intel Corporation
4
* Permission is hereby granted, free of charge, to any person obtaining a
5
* copy of this software and associated documentation files (the "Software"),
6
* to deal in the Software without restriction, including without limitation
7
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
* and/or sell copies of the Software, and to permit persons to whom the
9
* Software is furnished to do so, subject to the following conditions:
11
* The above copyright notice and this permission notice (including the next
12
* paragraph) shall be included in all copies or substantial portions of the
15
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
32
struct brw_stage_prog_data;
42
bool use_mesh_shading;
45
struct blorp_context {
48
const struct isl_device *isl_dev;
50
const struct brw_compiler *compiler;
52
bool (*lookup_shader)(struct blorp_batch *batch,
53
const void *key, uint32_t key_size,
54
uint32_t *kernel_out, void *prog_data_out);
55
bool (*upload_shader)(struct blorp_batch *batch,
57
const void *key, uint32_t key_size,
58
const void *kernel, uint32_t kernel_size,
59
const struct brw_stage_prog_data *prog_data,
60
uint32_t prog_data_size,
61
uint32_t *kernel_out, void *prog_data_out);
62
void (*exec)(struct blorp_batch *batch, const struct blorp_params *params);
64
struct blorp_config config;
67
void blorp_init(struct blorp_context *blorp, void *driver_ctx,
68
struct isl_device *isl_dev, const struct blorp_config *config);
69
void blorp_finish(struct blorp_context *blorp);
71
enum blorp_batch_flags {
73
* This flag indicates that blorp should *not* re-emit the depth and
74
* stencil buffer packets. Instead, the driver guarantees that all depth
75
* and stencil images passed in will match what is currently set in the
78
BLORP_BATCH_NO_EMIT_DEPTH_STENCIL = (1 << 0),
80
/* This flag indicates that the blorp call should be predicated. */
81
BLORP_BATCH_PREDICATE_ENABLE = (1 << 1),
83
/* This flag indicates that blorp should *not* update the indirect clear
86
BLORP_BATCH_NO_UPDATE_CLEAR_COLOR = (1 << 2),
88
/* This flag indicates that blorp should use a compute program for the
91
BLORP_BATCH_USE_COMPUTE = (1 << 3),
93
/** Use the hardware blitter to perform any operations in this batch */
94
BLORP_BATCH_USE_BLITTER = (1 << 4),
98
struct blorp_context *blorp;
100
enum blorp_batch_flags flags;
103
void blorp_batch_init(struct blorp_context *blorp, struct blorp_batch *batch,
104
void *driver_batch, enum blorp_batch_flags flags);
105
void blorp_batch_finish(struct blorp_batch *batch);
107
struct blorp_address {
110
unsigned reloc_flags;
114
* True if this buffer is intended to live in device-local memory.
115
* This is only a performance hint; it's OK to set it to true even
116
* if eviction has temporarily forced the buffer to system memory.
123
const struct isl_surf *surf;
124
struct blorp_address addr;
126
const struct isl_surf *aux_surf;
127
struct blorp_address aux_addr;
128
enum isl_aux_usage aux_usage;
130
union isl_color_value clear_color;
133
* If set (bo != NULL), clear_color is ignored and the actual clear color
134
* is fetched from this address. On gfx7-8, this is all of dword 7 of
135
* RENDER_SURFACE_STATE and is the responsibility of the caller to ensure
136
* that it contains a swizzle of RGBA and resource min LOD of 0.
138
struct blorp_address clear_color_addr;
140
/* Only allowed for simple 2D non-MSAA surfaces */
141
uint32_t tile_x_sa, tile_y_sa;
146
BLORP_FILTER_NEAREST,
147
BLORP_FILTER_BILINEAR,
148
BLORP_FILTER_SAMPLE_0,
149
BLORP_FILTER_AVERAGE,
150
BLORP_FILTER_MIN_SAMPLE,
151
BLORP_FILTER_MAX_SAMPLE,
155
blorp_blit(struct blorp_batch *batch,
156
const struct blorp_surf *src_surf,
157
unsigned src_level, float src_layer,
158
enum isl_format src_format, struct isl_swizzle src_swizzle,
159
const struct blorp_surf *dst_surf,
160
unsigned dst_level, unsigned dst_layer,
161
enum isl_format dst_format, struct isl_swizzle dst_swizzle,
162
float src_x0, float src_y0,
163
float src_x1, float src_y1,
164
float dst_x0, float dst_y0,
165
float dst_x1, float dst_y1,
166
enum blorp_filter filter,
167
bool mirror_x, bool mirror_y);
170
blorp_copy(struct blorp_batch *batch,
171
const struct blorp_surf *src_surf,
172
unsigned src_level, unsigned src_layer,
173
const struct blorp_surf *dst_surf,
174
unsigned dst_level, unsigned dst_layer,
175
uint32_t src_x, uint32_t src_y,
176
uint32_t dst_x, uint32_t dst_y,
177
uint32_t src_width, uint32_t src_height);
180
blorp_buffer_copy(struct blorp_batch *batch,
181
struct blorp_address src,
182
struct blorp_address dst,
186
blorp_fast_clear(struct blorp_batch *batch,
187
const struct blorp_surf *surf,
188
enum isl_format format, struct isl_swizzle swizzle,
189
uint32_t level, uint32_t start_layer, uint32_t num_layers,
190
uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1);
193
blorp_clear_supports_compute(struct blorp_context *blorp,
194
uint8_t color_write_disable, bool blend_enabled,
195
enum isl_aux_usage aux_usage);
198
blorp_copy_supports_compute(struct blorp_context *blorp,
199
const struct isl_surf *src_surf,
200
const struct isl_surf *dst_surf,
201
enum isl_aux_usage dst_aux_usage);
204
blorp_blit_supports_compute(struct blorp_context *blorp,
205
const struct isl_surf *src_surf,
206
const struct isl_surf *dst_surf,
207
enum isl_aux_usage dst_aux_usage);
210
blorp_copy_supports_blitter(struct blorp_context *blorp,
211
const struct isl_surf *src_surf,
212
const struct isl_surf *dst_surf,
213
enum isl_aux_usage src_aux_usage,
214
enum isl_aux_usage dst_aux_usage);
217
blorp_clear(struct blorp_batch *batch,
218
const struct blorp_surf *surf,
219
enum isl_format format, struct isl_swizzle swizzle,
220
uint32_t level, uint32_t start_layer, uint32_t num_layers,
221
uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1,
222
union isl_color_value clear_color,
223
uint8_t color_write_disable);
226
blorp_clear_depth_stencil(struct blorp_batch *batch,
227
const struct blorp_surf *depth,
228
const struct blorp_surf *stencil,
229
uint32_t level, uint32_t start_layer,
231
uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1,
232
bool clear_depth, float depth_value,
233
uint8_t stencil_mask, uint8_t stencil_value);
235
blorp_can_hiz_clear_depth(const struct intel_device_info *devinfo,
236
const struct isl_surf *surf,
237
enum isl_aux_usage aux_usage,
238
uint32_t level, uint32_t layer,
239
uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1);
241
blorp_hiz_clear_depth_stencil(struct blorp_batch *batch,
242
const struct blorp_surf *depth,
243
const struct blorp_surf *stencil,
245
uint32_t start_layer, uint32_t num_layers,
246
uint32_t x0, uint32_t y0,
247
uint32_t x1, uint32_t y1,
248
bool clear_depth, float depth_value,
249
bool clear_stencil, uint8_t stencil_value);
253
blorp_gfx8_hiz_clear_attachments(struct blorp_batch *batch,
254
uint32_t num_samples,
255
uint32_t x0, uint32_t y0,
256
uint32_t x1, uint32_t y1,
257
bool clear_depth, bool clear_stencil,
258
uint8_t stencil_value);
260
blorp_clear_attachments(struct blorp_batch *batch,
261
uint32_t binding_table_offset,
262
enum isl_format depth_format,
263
uint32_t num_samples,
264
uint32_t start_layer, uint32_t num_layers,
265
uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1,
266
bool clear_color, union isl_color_value color_value,
267
bool clear_depth, float depth_value,
268
uint8_t stencil_mask, uint8_t stencil_value);
271
blorp_ccs_resolve(struct blorp_batch *batch,
272
struct blorp_surf *surf, uint32_t level,
273
uint32_t start_layer, uint32_t num_layers,
274
enum isl_format format,
275
enum isl_aux_op resolve_op);
278
blorp_ccs_ambiguate(struct blorp_batch *batch,
279
struct blorp_surf *surf,
280
uint32_t level, uint32_t layer);
283
blorp_mcs_partial_resolve(struct blorp_batch *batch,
284
struct blorp_surf *surf,
285
enum isl_format format,
286
uint32_t start_layer, uint32_t num_layers);
289
blorp_hiz_op(struct blorp_batch *batch, struct blorp_surf *surf,
290
uint32_t level, uint32_t start_layer, uint32_t num_layers,
294
} /* end extern "C" */
295
#endif /* __cplusplus */