iris: Fix texture buffer / image buffer sizes.
[mesa.git] / src / gallium / drivers / iris / iris_context.h
1 /*
2 * Copyright © 2017 Intel Corporation
3 *
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 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
10 *
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
13 * Software.
14 *
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 NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23 #ifndef IRIS_CONTEXT_H
24 #define IRIS_CONTEXT_H
25
26 #include "pipe/p_context.h"
27 #include "pipe/p_state.h"
28 #include "util/u_debug.h"
29 #include "intel/blorp/blorp.h"
30 #include "intel/common/gen_debug.h"
31 #include "intel/compiler/brw_compiler.h"
32 #include "iris_batch.h"
33 #include "iris_binder.h"
34 #include "iris_resource.h"
35 #include "iris_screen.h"
36
37 struct iris_bo;
38 struct iris_context;
39 struct blorp_batch;
40 struct blorp_params;
41
42 #define IRIS_MAX_TEXTURE_BUFFER_SIZE (1 << 27)
43 #define IRIS_MAX_TEXTURE_SAMPLERS 32
44 /* IRIS_MAX_ABOS and IRIS_MAX_SSBOS must be the same. */
45 #define IRIS_MAX_ABOS 16
46 #define IRIS_MAX_SSBOS 16
47 #define IRIS_MAX_VIEWPORTS 16
48
49 /**
50 * Dirty flags. When state changes, we flag some combination of these
51 * to indicate that particular GPU commands need to be re-emitted.
52 *
53 * Each bit typically corresponds to a single 3DSTATE_* command packet, but
54 * in rare cases they map to a group of related packets that need to be
55 * emitted together.
56 *
57 * See iris_upload_render_state().
58 */
59 #define IRIS_DIRTY_COLOR_CALC_STATE (1ull << 0)
60 #define IRIS_DIRTY_POLYGON_STIPPLE (1ull << 1)
61 #define IRIS_DIRTY_SCISSOR_RECT (1ull << 2)
62 #define IRIS_DIRTY_WM_DEPTH_STENCIL (1ull << 3)
63 #define IRIS_DIRTY_CC_VIEWPORT (1ull << 4)
64 #define IRIS_DIRTY_SF_CL_VIEWPORT (1ull << 5)
65 #define IRIS_DIRTY_PS_BLEND (1ull << 6)
66 #define IRIS_DIRTY_BLEND_STATE (1ull << 7)
67 #define IRIS_DIRTY_RASTER (1ull << 8)
68 #define IRIS_DIRTY_CLIP (1ull << 9)
69 #define IRIS_DIRTY_SBE (1ull << 10)
70 #define IRIS_DIRTY_LINE_STIPPLE (1ull << 11)
71 #define IRIS_DIRTY_VERTEX_ELEMENTS (1ull << 12)
72 #define IRIS_DIRTY_MULTISAMPLE (1ull << 13)
73 #define IRIS_DIRTY_VERTEX_BUFFERS (1ull << 14)
74 #define IRIS_DIRTY_SAMPLE_MASK (1ull << 15)
75 #define IRIS_DIRTY_SAMPLER_STATES_VS (1ull << 16)
76 #define IRIS_DIRTY_SAMPLER_STATES_TCS (1ull << 17)
77 #define IRIS_DIRTY_SAMPLER_STATES_TES (1ull << 18)
78 #define IRIS_DIRTY_SAMPLER_STATES_GS (1ull << 19)
79 #define IRIS_DIRTY_SAMPLER_STATES_PS (1ull << 20)
80 #define IRIS_DIRTY_SAMPLER_STATES_CS (1ull << 21)
81 #define IRIS_DIRTY_UNCOMPILED_VS (1ull << 22)
82 #define IRIS_DIRTY_UNCOMPILED_TCS (1ull << 23)
83 #define IRIS_DIRTY_UNCOMPILED_TES (1ull << 24)
84 #define IRIS_DIRTY_UNCOMPILED_GS (1ull << 25)
85 #define IRIS_DIRTY_UNCOMPILED_FS (1ull << 26)
86 #define IRIS_DIRTY_UNCOMPILED_CS (1ull << 27)
87 #define IRIS_DIRTY_VS (1ull << 28)
88 #define IRIS_DIRTY_TCS (1ull << 29)
89 #define IRIS_DIRTY_TES (1ull << 30)
90 #define IRIS_DIRTY_GS (1ull << 31)
91 #define IRIS_DIRTY_FS (1ull << 32)
92 #define IRIS_DIRTY_CS (1ull << 33)
93 #define IRIS_DIRTY_URB (1ull << 34)
94 #define IRIS_DIRTY_CONSTANTS_VS (1ull << 35)
95 #define IRIS_DIRTY_CONSTANTS_TCS (1ull << 36)
96 #define IRIS_DIRTY_CONSTANTS_TES (1ull << 37)
97 #define IRIS_DIRTY_CONSTANTS_GS (1ull << 38)
98 #define IRIS_DIRTY_CONSTANTS_FS (1ull << 39)
99 #define IRIS_DIRTY_CONSTANTS_CS (1ull << 40)
100 #define IRIS_DIRTY_DEPTH_BUFFER (1ull << 41)
101 #define IRIS_DIRTY_WM (1ull << 42)
102 #define IRIS_DIRTY_BINDINGS_VS (1ull << 43)
103 #define IRIS_DIRTY_BINDINGS_TCS (1ull << 44)
104 #define IRIS_DIRTY_BINDINGS_TES (1ull << 45)
105 #define IRIS_DIRTY_BINDINGS_GS (1ull << 46)
106 #define IRIS_DIRTY_BINDINGS_FS (1ull << 47)
107 #define IRIS_DIRTY_BINDINGS_CS (1ull << 48)
108 #define IRIS_DIRTY_SO_BUFFERS (1ull << 49)
109 #define IRIS_DIRTY_SO_DECL_LIST (1ull << 50)
110 #define IRIS_DIRTY_STREAMOUT (1ull << 51)
111 #define IRIS_DIRTY_VF_SGVS (1ull << 52)
112 #define IRIS_DIRTY_VF (1ull << 53)
113 #define IRIS_DIRTY_VF_TOPOLOGY (1ull << 54)
114
115 #define IRIS_ALL_DIRTY_FOR_COMPUTE (IRIS_DIRTY_CS | \
116 IRIS_DIRTY_SAMPLER_STATES_CS | \
117 IRIS_DIRTY_UNCOMPILED_CS | \
118 IRIS_DIRTY_CONSTANTS_CS | \
119 IRIS_DIRTY_BINDINGS_CS)
120
121 #define IRIS_ALL_DIRTY_FOR_RENDER ~IRIS_ALL_DIRTY_FOR_COMPUTE
122
123 #define IRIS_ALL_DIRTY_BINDINGS (IRIS_DIRTY_BINDINGS_VS | \
124 IRIS_DIRTY_BINDINGS_TCS | \
125 IRIS_DIRTY_BINDINGS_TES | \
126 IRIS_DIRTY_BINDINGS_GS | \
127 IRIS_DIRTY_BINDINGS_FS | \
128 IRIS_DIRTY_BINDINGS_CS)
129
130 /**
131 * Non-orthogonal state (NOS) dependency flags.
132 *
133 * Shader programs may depend on non-orthogonal state. These flags are
134 * used to indicate that a shader's key depends on the state provided by
135 * a certain Gallium CSO. Changing any CSOs marked as a dependency will
136 * cause the driver to re-compute the shader key, possibly triggering a
137 * shader recompile.
138 */
139 enum iris_nos_dep {
140 IRIS_NOS_FRAMEBUFFER,
141 IRIS_NOS_DEPTH_STENCIL_ALPHA,
142 IRIS_NOS_RASTERIZER,
143 IRIS_NOS_BLEND,
144 IRIS_NOS_LAST_VUE_MAP,
145
146 IRIS_NOS_COUNT,
147 };
148
149 struct iris_depth_stencil_alpha_state;
150
151 /**
152 * Cache IDs for the in-memory program cache (ice->shaders.cache).
153 */
154 enum iris_program_cache_id {
155 IRIS_CACHE_VS = MESA_SHADER_VERTEX,
156 IRIS_CACHE_TCS = MESA_SHADER_TESS_CTRL,
157 IRIS_CACHE_TES = MESA_SHADER_TESS_EVAL,
158 IRIS_CACHE_GS = MESA_SHADER_GEOMETRY,
159 IRIS_CACHE_FS = MESA_SHADER_FRAGMENT,
160 IRIS_CACHE_CS = MESA_SHADER_COMPUTE,
161 IRIS_CACHE_BLORP,
162 };
163
164 /** @{
165 *
166 * Defines for PIPE_CONTROL operations, which trigger cache flushes,
167 * synchronization, pipelined memory writes, and so on.
168 *
169 * The bits here are not the actual hardware values. The actual fields
170 * move between various generations, so we just have flags for each
171 * potential operation, and use genxml to encode the actual packet.
172 */
173 enum pipe_control_flags
174 {
175 PIPE_CONTROL_FLUSH_LLC = (1 << 1),
176 PIPE_CONTROL_LRI_POST_SYNC_OP = (1 << 2),
177 PIPE_CONTROL_STORE_DATA_INDEX = (1 << 3),
178 PIPE_CONTROL_CS_STALL = (1 << 4),
179 PIPE_CONTROL_GLOBAL_SNAPSHOT_COUNT_RESET = (1 << 5),
180 PIPE_CONTROL_SYNC_GFDT = (1 << 6),
181 PIPE_CONTROL_TLB_INVALIDATE = (1 << 7),
182 PIPE_CONTROL_MEDIA_STATE_CLEAR = (1 << 8),
183 PIPE_CONTROL_WRITE_IMMEDIATE = (1 << 9),
184 PIPE_CONTROL_WRITE_DEPTH_COUNT = (1 << 10),
185 PIPE_CONTROL_WRITE_TIMESTAMP = (1 << 11),
186 PIPE_CONTROL_DEPTH_STALL = (1 << 12),
187 PIPE_CONTROL_RENDER_TARGET_FLUSH = (1 << 13),
188 PIPE_CONTROL_INSTRUCTION_INVALIDATE = (1 << 14),
189 PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE = (1 << 15),
190 PIPE_CONTROL_INDIRECT_STATE_POINTERS_DISABLE = (1 << 16),
191 PIPE_CONTROL_NOTIFY_ENABLE = (1 << 17),
192 PIPE_CONTROL_FLUSH_ENABLE = (1 << 18),
193 PIPE_CONTROL_DATA_CACHE_FLUSH = (1 << 19),
194 PIPE_CONTROL_VF_CACHE_INVALIDATE = (1 << 20),
195 PIPE_CONTROL_CONST_CACHE_INVALIDATE = (1 << 21),
196 PIPE_CONTROL_STATE_CACHE_INVALIDATE = (1 << 22),
197 PIPE_CONTROL_STALL_AT_SCOREBOARD = (1 << 23),
198 PIPE_CONTROL_DEPTH_CACHE_FLUSH = (1 << 24),
199 };
200
201 #define PIPE_CONTROL_CACHE_FLUSH_BITS \
202 (PIPE_CONTROL_DEPTH_CACHE_FLUSH | \
203 PIPE_CONTROL_DATA_CACHE_FLUSH | \
204 PIPE_CONTROL_RENDER_TARGET_FLUSH)
205
206 #define PIPE_CONTROL_CACHE_INVALIDATE_BITS \
207 (PIPE_CONTROL_STATE_CACHE_INVALIDATE | \
208 PIPE_CONTROL_CONST_CACHE_INVALIDATE | \
209 PIPE_CONTROL_VF_CACHE_INVALIDATE | \
210 PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE | \
211 PIPE_CONTROL_INSTRUCTION_INVALIDATE)
212
213 /** @} */
214
215 /**
216 * A compiled shader variant, containing a pointer to the GPU assembly,
217 * as well as program data and other packets needed by state upload.
218 *
219 * There can be several iris_compiled_shader variants per API-level shader
220 * (iris_uncompiled_shader), due to state-based recompiles (brw_*_prog_key).
221 */
222 struct iris_compiled_shader {
223 /** Reference to the uploaded assembly. */
224 struct iris_state_ref assembly;
225
226 /** Pointer to the assembly in the BO's map. */
227 void *map;
228
229 /** The program data (owned by the program cache hash table) */
230 struct brw_stage_prog_data *prog_data;
231
232 /**
233 * Derived 3DSTATE_STREAMOUT and 3DSTATE_SO_DECL_LIST packets
234 * (the VUE-based information for transform feedback outputs).
235 */
236 uint32_t *streamout;
237
238 /**
239 * Shader packets and other data derived from prog_data. These must be
240 * completely determined from prog_data.
241 */
242 uint8_t derived_data[0];
243 };
244
245 /**
246 * Constant buffer (UBO) information. See iris_set_const_buffer().
247 */
248 struct iris_const_buffer {
249 /** The resource and offset for the actual constant data */
250 struct iris_state_ref data;
251
252 /** The resource and offset for the SURFACE_STATE for pull access. */
253 struct iris_state_ref surface_state;
254 };
255
256 /**
257 * API context state that is replicated per shader stage.
258 */
259 struct iris_shader_state {
260 /** Uniform Buffers */
261 struct iris_const_buffer constbuf[PIPE_MAX_CONSTANT_BUFFERS];
262
263 /** Shader Storage Buffers */
264 struct pipe_resource *ssbo[PIPE_MAX_SHADER_BUFFERS];
265 struct iris_state_ref ssbo_surface_state[PIPE_MAX_SHADER_BUFFERS];
266
267 /** Shader Storage Images (image load store) */
268 struct {
269 struct pipe_resource *res;
270 struct iris_state_ref surface_state;
271 unsigned access;
272 } image[PIPE_MAX_SHADER_IMAGES];
273
274 struct iris_state_ref sampler_table;
275 struct iris_sampler_state *samplers[IRIS_MAX_TEXTURE_SAMPLERS];
276 struct iris_sampler_view *textures[IRIS_MAX_TEXTURE_SAMPLERS];
277 unsigned num_samplers;
278 unsigned num_textures;
279 };
280
281 /**
282 * Virtual table for generation-specific (genxml) function calls.
283 */
284 struct iris_vtable {
285 void (*destroy_state)(struct iris_context *ice);
286 void (*init_render_context)(struct iris_screen *screen,
287 struct iris_batch *batch,
288 struct iris_vtable *vtbl,
289 struct pipe_debug_callback *dbg);
290 void (*init_compute_context)(struct iris_screen *screen,
291 struct iris_batch *batch,
292 struct iris_vtable *vtbl,
293 struct pipe_debug_callback *dbg);
294 void (*upload_render_state)(struct iris_context *ice,
295 struct iris_batch *batch,
296 const struct pipe_draw_info *draw);
297 void (*update_surface_base_address)(struct iris_batch *batch,
298 struct iris_binder *binder);
299 void (*upload_compute_state)(struct iris_context *ice,
300 struct iris_batch *batch,
301 const struct pipe_grid_info *grid);
302 void (*load_register_imm32)(struct iris_batch *batch, uint32_t reg,
303 uint32_t val);
304 void (*load_register_imm64)(struct iris_batch *batch, uint32_t reg,
305 uint64_t val);
306 void (*load_register_mem32)(struct iris_batch *batch, uint32_t reg,
307 struct iris_bo *bo, uint32_t offset);
308 void (*load_register_mem64)(struct iris_batch *batch, uint32_t reg,
309 struct iris_bo *bo, uint32_t offset);
310 void (*store_register_mem32)(struct iris_batch *batch, uint32_t reg,
311 struct iris_bo *bo, uint32_t offset,
312 bool predicated);
313 void (*store_register_mem64)(struct iris_batch *batch, uint32_t reg,
314 struct iris_bo *bo, uint32_t offset,
315 bool predicated);
316 void (*store_data_imm32)(struct iris_batch *batch,
317 struct iris_bo *bo, uint32_t offset,
318 uint32_t value);
319 void (*store_data_imm64)(struct iris_batch *batch,
320 struct iris_bo *bo, uint32_t offset,
321 uint64_t value);
322 void (*copy_mem_mem)(struct iris_batch *batch,
323 struct iris_bo *dst_bo, uint32_t dst_offset,
324 struct iris_bo *src_bo, uint32_t src_offset,
325 unsigned bytes);
326 void (*emit_raw_pipe_control)(struct iris_batch *batch, uint32_t flags,
327 struct iris_bo *bo, uint32_t offset,
328 uint64_t imm);
329
330 unsigned (*derived_program_state_size)(enum iris_program_cache_id id);
331 void (*store_derived_program_state)(const struct gen_device_info *devinfo,
332 enum iris_program_cache_id cache_id,
333 struct iris_compiled_shader *shader);
334 uint32_t *(*create_so_decl_list)(const struct pipe_stream_output_info *sol,
335 const struct brw_vue_map *vue_map);
336 void (*populate_vs_key)(const struct iris_context *ice,
337 struct brw_vs_prog_key *key);
338 void (*populate_tcs_key)(const struct iris_context *ice,
339 struct brw_tcs_prog_key *key);
340 void (*populate_tes_key)(const struct iris_context *ice,
341 struct brw_tes_prog_key *key);
342 void (*populate_gs_key)(const struct iris_context *ice,
343 struct brw_gs_prog_key *key);
344 void (*populate_fs_key)(const struct iris_context *ice,
345 struct brw_wm_prog_key *key);
346 void (*populate_cs_key)(const struct iris_context *ice,
347 struct brw_cs_prog_key *key);
348 };
349
350 /**
351 * A pool containing SAMPLER_BORDER_COLOR_STATE entries.
352 *
353 * See iris_border_color.c for more information.
354 */
355 struct iris_border_color_pool {
356 struct iris_bo *bo;
357 void *map;
358 unsigned insert_point;
359
360 /** Map from border colors to offsets in the buffer. */
361 struct hash_table *ht;
362 };
363
364 /**
365 * The API context (derived from pipe_context).
366 *
367 * Most driver state is tracked here.
368 */
369 struct iris_context {
370 struct pipe_context ctx;
371
372 /** A debug callback for KHR_debug output. */
373 struct pipe_debug_callback dbg;
374
375 /** Slab allocator for iris_transfer_map objects. */
376 struct slab_child_pool transfer_pool;
377
378 struct iris_vtable vtbl;
379
380 struct blorp_context blorp;
381
382 /** The main batch for rendering. */
383 struct iris_batch render_batch;
384
385 /** The batch for compute shader dispatch */
386 struct iris_batch compute_batch;
387
388 struct {
389 struct iris_uncompiled_shader *uncompiled[MESA_SHADER_STAGES];
390 struct iris_compiled_shader *prog[MESA_SHADER_STAGES];
391 struct brw_vue_map *last_vue_map;
392
393 struct u_upload_mgr *uploader;
394 struct hash_table *cache;
395
396 unsigned urb_size;
397 } shaders;
398
399 struct {
400 uint64_t dirty;
401 uint64_t dirty_for_nos[IRIS_NOS_COUNT];
402
403 unsigned num_viewports;
404 unsigned sample_mask;
405 struct iris_blend_state *cso_blend;
406 struct iris_rasterizer_state *cso_rast;
407 struct iris_depth_stencil_alpha_state *cso_zsa;
408 struct iris_vertex_element_state *cso_vertex_elements;
409 struct pipe_blend_color blend_color;
410 struct pipe_poly_stipple poly_stipple;
411 struct pipe_viewport_state viewports[IRIS_MAX_VIEWPORTS];
412 struct pipe_scissor_state scissors[IRIS_MAX_VIEWPORTS];
413 struct pipe_stencil_ref stencil_ref;
414 struct pipe_framebuffer_state framebuffer;
415
416 float default_outer_level[4];
417 float default_inner_level[2];
418
419 bool primitive_restart;
420 unsigned cut_index;
421 enum pipe_prim_type prim_mode:8;
422 uint8_t vertices_per_patch;
423
424 /** The last compute grid size */
425 uint32_t last_grid[3];
426 /** Reference to the BO containing the compute grid size */
427 struct iris_state_ref grid_size;
428 /** Reference to the SURFACE_STATE for the compute grid resource */
429 struct iris_state_ref grid_surf_state;
430
431 /** Are depth writes enabled? (Depth buffer may or may not exist.) */
432 bool depth_writes_enabled;
433
434 /** Are stencil writes enabled? (Stencil buffer may or may not exist.) */
435 bool stencil_writes_enabled;
436
437 /** GenX-specific current state */
438 struct iris_genx_state *genx;
439
440 struct iris_shader_state shaders[MESA_SHADER_STAGES];
441
442 /** Do any samplers (for any stage) need border color? */
443 bool need_border_colors;
444
445 struct pipe_stream_output_target *so_target[PIPE_MAX_SO_BUFFERS];
446 bool streamout_active;
447
448 /** Is a PIPE_QUERY_PRIMITIVES_GENERATED query active? */
449 bool prims_generated_query_active;
450
451 /** 3DSTATE_STREAMOUT and 3DSTATE_SO_DECL_LIST packets */
452 uint32_t *streamout;
453
454 /** The SURFACE_STATE for a 1x1x1 null surface. */
455 struct iris_state_ref unbound_tex;
456
457 /** The SURFACE_STATE for a framebuffer-sized null surface. */
458 struct iris_state_ref null_fb;
459
460 struct u_upload_mgr *surface_uploader;
461 // XXX: may want a separate uploader for "hey I made a CSO!" vs
462 // "I'm streaming this out at draw time and never want it again!"
463 struct u_upload_mgr *dynamic_uploader;
464
465 struct iris_binder binder;
466
467 struct iris_border_color_pool border_color_pool;
468
469 /**
470 * Resources containing streamed state which our render context
471 * currently points to. Used to re-add these to the validation
472 * list when we start a new batch and haven't resubmitted commands.
473 */
474 struct {
475 struct pipe_resource *cc_vp;
476 struct pipe_resource *sf_cl_vp;
477 struct pipe_resource *color_calc;
478 struct pipe_resource *scissor;
479 struct pipe_resource *blend;
480 struct pipe_resource *index_buffer;
481 } last_res;
482 } state;
483 };
484
485 #define perf_debug(dbg, ...) do { \
486 if (INTEL_DEBUG & DEBUG_PERF) \
487 dbg_printf(__VA_ARGS__); \
488 if (unlikely(dbg)) \
489 pipe_debug_message(dbg, PERF_INFO, __VA_ARGS__); \
490 } while(0)
491
492 double get_time(void);
493
494 struct pipe_context *
495 iris_create_context(struct pipe_screen *screen, void *priv, unsigned flags);
496
497 void iris_init_blit_functions(struct pipe_context *ctx);
498 void iris_init_clear_functions(struct pipe_context *ctx);
499 void iris_init_program_functions(struct pipe_context *ctx);
500 void iris_init_resource_functions(struct pipe_context *ctx);
501 void iris_init_query_functions(struct pipe_context *ctx);
502 void iris_update_compiled_shaders(struct iris_context *ice);
503 void iris_update_compiled_compute_shader(struct iris_context *ice);
504 void iris_fill_cs_push_const_buffer(struct brw_cs_prog_data *cs_prog_data,
505 uint32_t *dst);
506
507
508 /* iris_blit.c */
509 void iris_blorp_surf_for_resource(struct blorp_surf *surf,
510 struct pipe_resource *p_res,
511 enum isl_aux_usage aux_usage,
512 bool is_render_target);
513
514 /* iris_draw.c */
515
516 void iris_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info);
517 void iris_launch_grid(struct pipe_context *, const struct pipe_grid_info *);
518
519 /* iris_pipe_control.c */
520
521 void iris_emit_pipe_control_flush(struct iris_batch *batch,
522 uint32_t flags);
523 void iris_emit_pipe_control_write(struct iris_batch *batch, uint32_t flags,
524 struct iris_bo *bo, uint32_t offset,
525 uint64_t imm);
526 void iris_emit_end_of_pipe_sync(struct iris_batch *batch,
527 uint32_t flags);
528
529 void iris_init_flush_functions(struct pipe_context *ctx);
530
531 /* iris_blorp.c */
532
533 void gen9_init_blorp(struct iris_context *ice);
534 void gen10_init_blorp(struct iris_context *ice);
535 void gen11_init_blorp(struct iris_context *ice);
536
537 /* iris_border_color.c */
538
539 void iris_init_border_color_pool(struct iris_context *ice);
540 void iris_border_color_pool_reserve(struct iris_context *ice, unsigned count);
541 uint32_t iris_upload_border_color(struct iris_context *ice,
542 union pipe_color_union *color);
543
544 /* iris_state.c */
545
546 void gen9_init_state(struct iris_context *ice);
547 void gen10_init_state(struct iris_context *ice);
548 void gen11_init_state(struct iris_context *ice);
549
550 /* iris_program.c */
551 const struct shader_info *iris_get_shader_info(const struct iris_context *ice,
552 gl_shader_stage stage);
553 unsigned iris_get_shader_num_ubos(const struct iris_context *ice,
554 gl_shader_stage stage);
555
556
557 /* iris_program_cache.c */
558
559 void iris_init_program_cache(struct iris_context *ice);
560 void iris_destroy_program_cache(struct iris_context *ice);
561 void iris_print_program_cache(struct iris_context *ice);
562 bool iris_bind_cached_shader(struct iris_context *ice,
563 enum iris_program_cache_id cache_id,
564 const void *key);
565 void iris_unbind_shader(struct iris_context *ice,
566 enum iris_program_cache_id cache_id);
567 void iris_upload_and_bind_shader(struct iris_context *ice,
568 enum iris_program_cache_id cache_id,
569 const void *key,
570 const void *assembly,
571 struct brw_stage_prog_data *prog_data,
572 uint32_t *streamout);
573 const void *iris_find_previous_compile(const struct iris_context *ice,
574 enum iris_program_cache_id cache_id,
575 unsigned program_string_id);
576 bool iris_blorp_lookup_shader(struct blorp_batch *blorp_batch,
577 const void *key,
578 uint32_t key_size,
579 uint32_t *kernel_out,
580 void *prog_data_out);
581 bool iris_blorp_upload_shader(struct blorp_batch *blorp_batch,
582 const void *key, uint32_t key_size,
583 const void *kernel, uint32_t kernel_size,
584 const struct brw_stage_prog_data *prog_data,
585 uint32_t prog_data_size,
586 uint32_t *kernel_out,
587 void *prog_data_out);
588
589 /* iris_query.c */
590
591 uint64_t iris_timebase_scale(const struct gen_device_info *devinfo,
592 uint64_t gpu_timestamp);
593
594 /* iris_resolve.c */
595
596 void iris_predraw_resolve_inputs(struct iris_context *ice,
597 struct iris_batch *batch);
598 void iris_predraw_resolve_framebuffer(struct iris_context *ice,
599 struct iris_batch *batch);
600 void iris_postdraw_update_resolve_tracking(struct iris_context *ice,
601 struct iris_batch *batch);
602 void iris_cache_sets_clear(struct iris_batch *batch);
603 void iris_flush_depth_and_render_caches(struct iris_batch *batch);
604 void iris_cache_flush_for_read(struct iris_batch *batch, struct iris_bo *bo);
605 void iris_cache_flush_for_render(struct iris_batch *batch,
606 struct iris_bo *bo,
607 enum isl_format format,
608 enum isl_aux_usage aux_usage);
609 void iris_render_cache_add_bo(struct iris_batch *batch,
610 struct iris_bo *bo,
611 enum isl_format format,
612 enum isl_aux_usage aux_usage);
613 void iris_cache_flush_for_depth(struct iris_batch *batch, struct iris_bo *bo);
614 void iris_depth_cache_add_bo(struct iris_batch *batch, struct iris_bo *bo);
615
616 #endif