1b8e80941Smrg/* 2b8e80941Smrg * Copyright © 2017 Intel Corporation 3b8e80941Smrg * 4b8e80941Smrg * Permission is hereby granted, free of charge, to any person obtaining a 5b8e80941Smrg * copy of this software and associated documentation files (the "Software"), 6b8e80941Smrg * to deal in the Software without restriction, including without limitation 7b8e80941Smrg * on the rights to use, copy, modify, merge, publish, distribute, sub 8b8e80941Smrg * license, and/or sell copies of the Software, and to permit persons to whom 9b8e80941Smrg * the Software is furnished to do so, subject to the following conditions: 10b8e80941Smrg * 11b8e80941Smrg * The above copyright notice and this permission notice (including the next 12b8e80941Smrg * paragraph) shall be included in all copies or substantial portions of the 13b8e80941Smrg * Software. 14b8e80941Smrg * 15b8e80941Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16b8e80941Smrg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17b8e80941Smrg * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18b8e80941Smrg * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 19b8e80941Smrg * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20b8e80941Smrg * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 21b8e80941Smrg * USE OR OTHER DEALINGS IN THE SOFTWARE. 22b8e80941Smrg */ 23b8e80941Smrg#ifndef IRIS_CONTEXT_H 24b8e80941Smrg#define IRIS_CONTEXT_H 25b8e80941Smrg 26b8e80941Smrg#include "pipe/p_context.h" 27b8e80941Smrg#include "pipe/p_state.h" 28b8e80941Smrg#include "util/u_debug.h" 29b8e80941Smrg#include "intel/blorp/blorp.h" 30b8e80941Smrg#include "intel/dev/gen_debug.h" 31b8e80941Smrg#include "intel/compiler/brw_compiler.h" 32b8e80941Smrg#include "iris_batch.h" 33b8e80941Smrg#include "iris_binder.h" 34b8e80941Smrg#include "iris_fence.h" 35b8e80941Smrg#include "iris_resource.h" 36b8e80941Smrg#include "iris_screen.h" 37b8e80941Smrg 38b8e80941Smrgstruct iris_bo; 39b8e80941Smrgstruct iris_context; 40b8e80941Smrgstruct blorp_batch; 41b8e80941Smrgstruct blorp_params; 42b8e80941Smrg 43b8e80941Smrg#define IRIS_MAX_TEXTURE_BUFFER_SIZE (1 << 27) 44b8e80941Smrg#define IRIS_MAX_TEXTURE_SAMPLERS 32 45b8e80941Smrg/* IRIS_MAX_ABOS and IRIS_MAX_SSBOS must be the same. */ 46b8e80941Smrg#define IRIS_MAX_ABOS 16 47b8e80941Smrg#define IRIS_MAX_SSBOS 16 48b8e80941Smrg#define IRIS_MAX_VIEWPORTS 16 49b8e80941Smrg#define IRIS_MAX_CLIP_PLANES 8 50b8e80941Smrg 51b8e80941Smrgenum iris_param_domain { 52b8e80941Smrg BRW_PARAM_DOMAIN_BUILTIN = 0, 53b8e80941Smrg BRW_PARAM_DOMAIN_IMAGE, 54b8e80941Smrg}; 55b8e80941Smrg 56b8e80941Smrg#define BRW_PARAM(domain, val) (BRW_PARAM_DOMAIN_##domain << 24 | (val)) 57b8e80941Smrg#define BRW_PARAM_DOMAIN(param) ((uint32_t)(param) >> 24) 58b8e80941Smrg#define BRW_PARAM_VALUE(param) ((uint32_t)(param) & 0x00ffffff) 59b8e80941Smrg#define BRW_PARAM_IMAGE(idx, offset) BRW_PARAM(IMAGE, ((idx) << 8) | (offset)) 60b8e80941Smrg#define BRW_PARAM_IMAGE_IDX(value) (BRW_PARAM_VALUE(value) >> 8) 61b8e80941Smrg#define BRW_PARAM_IMAGE_OFFSET(value)(BRW_PARAM_VALUE(value) & 0xf) 62b8e80941Smrg 63b8e80941Smrg/** 64b8e80941Smrg * Dirty flags. When state changes, we flag some combination of these 65b8e80941Smrg * to indicate that particular GPU commands need to be re-emitted. 66b8e80941Smrg * 67b8e80941Smrg * Each bit typically corresponds to a single 3DSTATE_* command packet, but 68b8e80941Smrg * in rare cases they map to a group of related packets that need to be 69b8e80941Smrg * emitted together. 70b8e80941Smrg * 71b8e80941Smrg * See iris_upload_render_state(). 72b8e80941Smrg */ 73b8e80941Smrg#define IRIS_DIRTY_COLOR_CALC_STATE (1ull << 0) 74b8e80941Smrg#define IRIS_DIRTY_POLYGON_STIPPLE (1ull << 1) 75b8e80941Smrg#define IRIS_DIRTY_SCISSOR_RECT (1ull << 2) 76b8e80941Smrg#define IRIS_DIRTY_WM_DEPTH_STENCIL (1ull << 3) 77b8e80941Smrg#define IRIS_DIRTY_CC_VIEWPORT (1ull << 4) 78b8e80941Smrg#define IRIS_DIRTY_SF_CL_VIEWPORT (1ull << 5) 79b8e80941Smrg#define IRIS_DIRTY_PS_BLEND (1ull << 6) 80b8e80941Smrg#define IRIS_DIRTY_BLEND_STATE (1ull << 7) 81b8e80941Smrg#define IRIS_DIRTY_RASTER (1ull << 8) 82b8e80941Smrg#define IRIS_DIRTY_CLIP (1ull << 9) 83b8e80941Smrg#define IRIS_DIRTY_SBE (1ull << 10) 84b8e80941Smrg#define IRIS_DIRTY_LINE_STIPPLE (1ull << 11) 85b8e80941Smrg#define IRIS_DIRTY_VERTEX_ELEMENTS (1ull << 12) 86b8e80941Smrg#define IRIS_DIRTY_MULTISAMPLE (1ull << 13) 87b8e80941Smrg#define IRIS_DIRTY_VERTEX_BUFFERS (1ull << 14) 88b8e80941Smrg#define IRIS_DIRTY_SAMPLE_MASK (1ull << 15) 89b8e80941Smrg#define IRIS_DIRTY_SAMPLER_STATES_VS (1ull << 16) 90b8e80941Smrg#define IRIS_DIRTY_SAMPLER_STATES_TCS (1ull << 17) 91b8e80941Smrg#define IRIS_DIRTY_SAMPLER_STATES_TES (1ull << 18) 92b8e80941Smrg#define IRIS_DIRTY_SAMPLER_STATES_GS (1ull << 19) 93b8e80941Smrg#define IRIS_DIRTY_SAMPLER_STATES_PS (1ull << 20) 94b8e80941Smrg#define IRIS_DIRTY_SAMPLER_STATES_CS (1ull << 21) 95b8e80941Smrg#define IRIS_DIRTY_UNCOMPILED_VS (1ull << 22) 96b8e80941Smrg#define IRIS_DIRTY_UNCOMPILED_TCS (1ull << 23) 97b8e80941Smrg#define IRIS_DIRTY_UNCOMPILED_TES (1ull << 24) 98b8e80941Smrg#define IRIS_DIRTY_UNCOMPILED_GS (1ull << 25) 99b8e80941Smrg#define IRIS_DIRTY_UNCOMPILED_FS (1ull << 26) 100b8e80941Smrg#define IRIS_DIRTY_UNCOMPILED_CS (1ull << 27) 101b8e80941Smrg#define IRIS_DIRTY_VS (1ull << 28) 102b8e80941Smrg#define IRIS_DIRTY_TCS (1ull << 29) 103b8e80941Smrg#define IRIS_DIRTY_TES (1ull << 30) 104b8e80941Smrg#define IRIS_DIRTY_GS (1ull << 31) 105b8e80941Smrg#define IRIS_DIRTY_FS (1ull << 32) 106b8e80941Smrg#define IRIS_DIRTY_CS (1ull << 33) 107b8e80941Smrg#define IRIS_DIRTY_URB (1ull << 34) 108b8e80941Smrg#define IRIS_DIRTY_CONSTANTS_VS (1ull << 35) 109b8e80941Smrg#define IRIS_DIRTY_CONSTANTS_TCS (1ull << 36) 110b8e80941Smrg#define IRIS_DIRTY_CONSTANTS_TES (1ull << 37) 111b8e80941Smrg#define IRIS_DIRTY_CONSTANTS_GS (1ull << 38) 112b8e80941Smrg#define IRIS_DIRTY_CONSTANTS_FS (1ull << 39) 113b8e80941Smrg#define IRIS_DIRTY_CONSTANTS_CS (1ull << 40) 114b8e80941Smrg#define IRIS_DIRTY_DEPTH_BUFFER (1ull << 41) 115b8e80941Smrg#define IRIS_DIRTY_WM (1ull << 42) 116b8e80941Smrg#define IRIS_DIRTY_BINDINGS_VS (1ull << 43) 117b8e80941Smrg#define IRIS_DIRTY_BINDINGS_TCS (1ull << 44) 118b8e80941Smrg#define IRIS_DIRTY_BINDINGS_TES (1ull << 45) 119b8e80941Smrg#define IRIS_DIRTY_BINDINGS_GS (1ull << 46) 120b8e80941Smrg#define IRIS_DIRTY_BINDINGS_FS (1ull << 47) 121b8e80941Smrg#define IRIS_DIRTY_BINDINGS_CS (1ull << 48) 122b8e80941Smrg#define IRIS_DIRTY_SO_BUFFERS (1ull << 49) 123b8e80941Smrg#define IRIS_DIRTY_SO_DECL_LIST (1ull << 50) 124b8e80941Smrg#define IRIS_DIRTY_STREAMOUT (1ull << 51) 125b8e80941Smrg#define IRIS_DIRTY_VF_SGVS (1ull << 52) 126b8e80941Smrg#define IRIS_DIRTY_VF (1ull << 53) 127b8e80941Smrg#define IRIS_DIRTY_VF_TOPOLOGY (1ull << 54) 128b8e80941Smrg#define IRIS_DIRTY_RENDER_RESOLVES_AND_FLUSHES (1ull << 55) 129b8e80941Smrg#define IRIS_DIRTY_COMPUTE_RESOLVES_AND_FLUSHES (1ull << 56) 130b8e80941Smrg#define IRIS_DIRTY_VF_STATISTICS (1ull << 57) 131b8e80941Smrg 132b8e80941Smrg#define IRIS_ALL_DIRTY_FOR_COMPUTE (IRIS_DIRTY_CS | \ 133b8e80941Smrg IRIS_DIRTY_SAMPLER_STATES_CS | \ 134b8e80941Smrg IRIS_DIRTY_UNCOMPILED_CS | \ 135b8e80941Smrg IRIS_DIRTY_CONSTANTS_CS | \ 136b8e80941Smrg IRIS_DIRTY_BINDINGS_CS | \ 137b8e80941Smrg IRIS_DIRTY_COMPUTE_RESOLVES_AND_FLUSHES) 138b8e80941Smrg 139b8e80941Smrg#define IRIS_ALL_DIRTY_FOR_RENDER ~IRIS_ALL_DIRTY_FOR_COMPUTE 140b8e80941Smrg 141b8e80941Smrg#define IRIS_ALL_DIRTY_BINDINGS (IRIS_DIRTY_BINDINGS_VS | \ 142b8e80941Smrg IRIS_DIRTY_BINDINGS_TCS | \ 143b8e80941Smrg IRIS_DIRTY_BINDINGS_TES | \ 144b8e80941Smrg IRIS_DIRTY_BINDINGS_GS | \ 145b8e80941Smrg IRIS_DIRTY_BINDINGS_FS | \ 146b8e80941Smrg IRIS_DIRTY_BINDINGS_CS) 147b8e80941Smrg 148b8e80941Smrg/** 149b8e80941Smrg * Non-orthogonal state (NOS) dependency flags. 150b8e80941Smrg * 151b8e80941Smrg * Shader programs may depend on non-orthogonal state. These flags are 152b8e80941Smrg * used to indicate that a shader's key depends on the state provided by 153b8e80941Smrg * a certain Gallium CSO. Changing any CSOs marked as a dependency will 154b8e80941Smrg * cause the driver to re-compute the shader key, possibly triggering a 155b8e80941Smrg * shader recompile. 156b8e80941Smrg */ 157b8e80941Smrgenum iris_nos_dep { 158b8e80941Smrg IRIS_NOS_FRAMEBUFFER, 159b8e80941Smrg IRIS_NOS_DEPTH_STENCIL_ALPHA, 160b8e80941Smrg IRIS_NOS_RASTERIZER, 161b8e80941Smrg IRIS_NOS_BLEND, 162b8e80941Smrg IRIS_NOS_LAST_VUE_MAP, 163b8e80941Smrg 164b8e80941Smrg IRIS_NOS_COUNT, 165b8e80941Smrg}; 166b8e80941Smrg 167b8e80941Smrgstruct iris_depth_stencil_alpha_state; 168b8e80941Smrg 169b8e80941Smrg/** 170b8e80941Smrg * Cache IDs for the in-memory program cache (ice->shaders.cache). 171b8e80941Smrg */ 172b8e80941Smrgenum iris_program_cache_id { 173b8e80941Smrg IRIS_CACHE_VS = MESA_SHADER_VERTEX, 174b8e80941Smrg IRIS_CACHE_TCS = MESA_SHADER_TESS_CTRL, 175b8e80941Smrg IRIS_CACHE_TES = MESA_SHADER_TESS_EVAL, 176b8e80941Smrg IRIS_CACHE_GS = MESA_SHADER_GEOMETRY, 177b8e80941Smrg IRIS_CACHE_FS = MESA_SHADER_FRAGMENT, 178b8e80941Smrg IRIS_CACHE_CS = MESA_SHADER_COMPUTE, 179b8e80941Smrg IRIS_CACHE_BLORP, 180b8e80941Smrg}; 181b8e80941Smrg 182b8e80941Smrg/** @{ 183b8e80941Smrg * 184b8e80941Smrg * Defines for PIPE_CONTROL operations, which trigger cache flushes, 185b8e80941Smrg * synchronization, pipelined memory writes, and so on. 186b8e80941Smrg * 187b8e80941Smrg * The bits here are not the actual hardware values. The actual fields 188b8e80941Smrg * move between various generations, so we just have flags for each 189b8e80941Smrg * potential operation, and use genxml to encode the actual packet. 190b8e80941Smrg */ 191b8e80941Smrgenum pipe_control_flags 192b8e80941Smrg{ 193b8e80941Smrg PIPE_CONTROL_FLUSH_LLC = (1 << 1), 194b8e80941Smrg PIPE_CONTROL_LRI_POST_SYNC_OP = (1 << 2), 195b8e80941Smrg PIPE_CONTROL_STORE_DATA_INDEX = (1 << 3), 196b8e80941Smrg PIPE_CONTROL_CS_STALL = (1 << 4), 197b8e80941Smrg PIPE_CONTROL_GLOBAL_SNAPSHOT_COUNT_RESET = (1 << 5), 198b8e80941Smrg PIPE_CONTROL_SYNC_GFDT = (1 << 6), 199b8e80941Smrg PIPE_CONTROL_TLB_INVALIDATE = (1 << 7), 200b8e80941Smrg PIPE_CONTROL_MEDIA_STATE_CLEAR = (1 << 8), 201b8e80941Smrg PIPE_CONTROL_WRITE_IMMEDIATE = (1 << 9), 202b8e80941Smrg PIPE_CONTROL_WRITE_DEPTH_COUNT = (1 << 10), 203b8e80941Smrg PIPE_CONTROL_WRITE_TIMESTAMP = (1 << 11), 204b8e80941Smrg PIPE_CONTROL_DEPTH_STALL = (1 << 12), 205b8e80941Smrg PIPE_CONTROL_RENDER_TARGET_FLUSH = (1 << 13), 206b8e80941Smrg PIPE_CONTROL_INSTRUCTION_INVALIDATE = (1 << 14), 207b8e80941Smrg PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE = (1 << 15), 208b8e80941Smrg PIPE_CONTROL_INDIRECT_STATE_POINTERS_DISABLE = (1 << 16), 209b8e80941Smrg PIPE_CONTROL_NOTIFY_ENABLE = (1 << 17), 210b8e80941Smrg PIPE_CONTROL_FLUSH_ENABLE = (1 << 18), 211b8e80941Smrg PIPE_CONTROL_DATA_CACHE_FLUSH = (1 << 19), 212b8e80941Smrg PIPE_CONTROL_VF_CACHE_INVALIDATE = (1 << 20), 213b8e80941Smrg PIPE_CONTROL_CONST_CACHE_INVALIDATE = (1 << 21), 214b8e80941Smrg PIPE_CONTROL_STATE_CACHE_INVALIDATE = (1 << 22), 215b8e80941Smrg PIPE_CONTROL_STALL_AT_SCOREBOARD = (1 << 23), 216b8e80941Smrg PIPE_CONTROL_DEPTH_CACHE_FLUSH = (1 << 24), 217b8e80941Smrg}; 218b8e80941Smrg 219b8e80941Smrg#define PIPE_CONTROL_CACHE_FLUSH_BITS \ 220b8e80941Smrg (PIPE_CONTROL_DEPTH_CACHE_FLUSH | \ 221b8e80941Smrg PIPE_CONTROL_DATA_CACHE_FLUSH | \ 222b8e80941Smrg PIPE_CONTROL_RENDER_TARGET_FLUSH) 223b8e80941Smrg 224b8e80941Smrg#define PIPE_CONTROL_CACHE_INVALIDATE_BITS \ 225b8e80941Smrg (PIPE_CONTROL_STATE_CACHE_INVALIDATE | \ 226b8e80941Smrg PIPE_CONTROL_CONST_CACHE_INVALIDATE | \ 227b8e80941Smrg PIPE_CONTROL_VF_CACHE_INVALIDATE | \ 228b8e80941Smrg PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE | \ 229b8e80941Smrg PIPE_CONTROL_INSTRUCTION_INVALIDATE) 230b8e80941Smrg 231b8e80941Smrgenum iris_predicate_state { 232b8e80941Smrg /* The first two states are used if we can determine whether to draw 233b8e80941Smrg * without having to look at the values in the query object buffer. This 234b8e80941Smrg * will happen if there is no conditional render in progress, if the query 235b8e80941Smrg * object is already completed or if something else has already added 236b8e80941Smrg * samples to the preliminary result. 237b8e80941Smrg */ 238b8e80941Smrg IRIS_PREDICATE_STATE_RENDER, 239b8e80941Smrg IRIS_PREDICATE_STATE_DONT_RENDER, 240b8e80941Smrg 241b8e80941Smrg /* In this case whether to draw or not depends on the result of an 242b8e80941Smrg * MI_PREDICATE command so the predicate enable bit needs to be checked. 243b8e80941Smrg */ 244b8e80941Smrg IRIS_PREDICATE_STATE_USE_BIT, 245b8e80941Smrg}; 246b8e80941Smrg 247b8e80941Smrg/** @} */ 248b8e80941Smrg 249b8e80941Smrg/** 250b8e80941Smrg * A compiled shader variant, containing a pointer to the GPU assembly, 251b8e80941Smrg * as well as program data and other packets needed by state upload. 252b8e80941Smrg * 253b8e80941Smrg * There can be several iris_compiled_shader variants per API-level shader 254b8e80941Smrg * (iris_uncompiled_shader), due to state-based recompiles (brw_*_prog_key). 255b8e80941Smrg */ 256b8e80941Smrgstruct iris_compiled_shader { 257b8e80941Smrg /** Reference to the uploaded assembly. */ 258b8e80941Smrg struct iris_state_ref assembly; 259b8e80941Smrg 260b8e80941Smrg /** Pointer to the assembly in the BO's map. */ 261b8e80941Smrg void *map; 262b8e80941Smrg 263b8e80941Smrg /** The program data (owned by the program cache hash table) */ 264b8e80941Smrg struct brw_stage_prog_data *prog_data; 265b8e80941Smrg 266b8e80941Smrg /** A list of system values to be uploaded as uniforms. */ 267b8e80941Smrg enum brw_param_builtin *system_values; 268b8e80941Smrg unsigned num_system_values; 269b8e80941Smrg 270b8e80941Smrg /** Number of constbufs expected by the shader. */ 271b8e80941Smrg unsigned num_cbufs; 272b8e80941Smrg 273b8e80941Smrg /** 274b8e80941Smrg * Derived 3DSTATE_STREAMOUT and 3DSTATE_SO_DECL_LIST packets 275b8e80941Smrg * (the VUE-based information for transform feedback outputs). 276b8e80941Smrg */ 277b8e80941Smrg uint32_t *streamout; 278b8e80941Smrg 279b8e80941Smrg /** 280b8e80941Smrg * Shader packets and other data derived from prog_data. These must be 281b8e80941Smrg * completely determined from prog_data. 282b8e80941Smrg */ 283b8e80941Smrg uint8_t derived_data[0]; 284b8e80941Smrg}; 285b8e80941Smrg 286b8e80941Smrg/** 287b8e80941Smrg * API context state that is replicated per shader stage. 288b8e80941Smrg */ 289b8e80941Smrgstruct iris_shader_state { 290b8e80941Smrg /** Uniform Buffers */ 291b8e80941Smrg struct pipe_shader_buffer constbuf[PIPE_MAX_CONSTANT_BUFFERS]; 292b8e80941Smrg struct iris_state_ref constbuf_surf_state[PIPE_MAX_CONSTANT_BUFFERS]; 293b8e80941Smrg 294b8e80941Smrg struct pipe_constant_buffer cbuf0; 295b8e80941Smrg bool cbuf0_needs_upload; 296b8e80941Smrg 297b8e80941Smrg /** Shader Storage Buffers */ 298b8e80941Smrg struct pipe_shader_buffer ssbo[PIPE_MAX_SHADER_BUFFERS]; 299b8e80941Smrg struct iris_state_ref ssbo_surf_state[PIPE_MAX_SHADER_BUFFERS]; 300b8e80941Smrg 301b8e80941Smrg /** Shader Storage Images (image load store) */ 302b8e80941Smrg struct iris_image_view image[PIPE_MAX_SHADER_IMAGES]; 303b8e80941Smrg 304b8e80941Smrg struct iris_state_ref sampler_table; 305b8e80941Smrg struct iris_sampler_state *samplers[IRIS_MAX_TEXTURE_SAMPLERS]; 306b8e80941Smrg struct iris_sampler_view *textures[IRIS_MAX_TEXTURE_SAMPLERS]; 307b8e80941Smrg 308b8e80941Smrg /** Bitfield of which constant buffers are bound (non-null). */ 309b8e80941Smrg uint32_t bound_cbufs; 310b8e80941Smrg 311b8e80941Smrg /** Bitfield of which image views are bound (non-null). */ 312b8e80941Smrg uint32_t bound_image_views; 313b8e80941Smrg 314b8e80941Smrg /** Bitfield of which sampler views are bound (non-null). */ 315b8e80941Smrg uint32_t bound_sampler_views; 316b8e80941Smrg 317b8e80941Smrg /** Bitfield of which shader storage buffers are bound (non-null). */ 318b8e80941Smrg uint32_t bound_ssbos; 319b8e80941Smrg 320b8e80941Smrg /** Bitfield of which shader storage buffers are writable. */ 321b8e80941Smrg uint32_t writable_ssbos; 322b8e80941Smrg}; 323b8e80941Smrg 324b8e80941Smrg/** 325b8e80941Smrg * Gallium CSO for stream output (transform feedback) targets. 326b8e80941Smrg */ 327b8e80941Smrgstruct iris_stream_output_target { 328b8e80941Smrg struct pipe_stream_output_target base; 329b8e80941Smrg 330b8e80941Smrg /** Storage holding the offset where we're writing in the buffer */ 331b8e80941Smrg struct iris_state_ref offset; 332b8e80941Smrg 333b8e80941Smrg /** Stride (dwords-per-vertex) during this transform feedback operation */ 334b8e80941Smrg uint16_t stride; 335b8e80941Smrg 336b8e80941Smrg /** Has 3DSTATE_SO_BUFFER actually been emitted, zeroing the offsets? */ 337b8e80941Smrg bool zeroed; 338b8e80941Smrg}; 339b8e80941Smrg 340b8e80941Smrg/** 341b8e80941Smrg * Virtual table for generation-specific (genxml) function calls. 342b8e80941Smrg */ 343b8e80941Smrgstruct iris_vtable { 344b8e80941Smrg void (*destroy_state)(struct iris_context *ice); 345b8e80941Smrg void (*init_render_context)(struct iris_screen *screen, 346b8e80941Smrg struct iris_batch *batch, 347b8e80941Smrg struct iris_vtable *vtbl, 348b8e80941Smrg struct pipe_debug_callback *dbg); 349b8e80941Smrg void (*init_compute_context)(struct iris_screen *screen, 350b8e80941Smrg struct iris_batch *batch, 351b8e80941Smrg struct iris_vtable *vtbl, 352b8e80941Smrg struct pipe_debug_callback *dbg); 353b8e80941Smrg void (*upload_render_state)(struct iris_context *ice, 354b8e80941Smrg struct iris_batch *batch, 355b8e80941Smrg const struct pipe_draw_info *draw); 356b8e80941Smrg void (*update_surface_base_address)(struct iris_batch *batch, 357b8e80941Smrg struct iris_binder *binder); 358b8e80941Smrg void (*upload_compute_state)(struct iris_context *ice, 359b8e80941Smrg struct iris_batch *batch, 360b8e80941Smrg const struct pipe_grid_info *grid); 361b8e80941Smrg void (*rebind_buffer)(struct iris_context *ice, 362b8e80941Smrg struct iris_resource *res, 363b8e80941Smrg uint64_t old_address); 364b8e80941Smrg void (*load_register_reg32)(struct iris_batch *batch, uint32_t dst, 365b8e80941Smrg uint32_t src); 366b8e80941Smrg void (*load_register_reg64)(struct iris_batch *batch, uint32_t dst, 367b8e80941Smrg uint32_t src); 368b8e80941Smrg void (*load_register_imm32)(struct iris_batch *batch, uint32_t reg, 369b8e80941Smrg uint32_t val); 370b8e80941Smrg void (*load_register_imm64)(struct iris_batch *batch, uint32_t reg, 371b8e80941Smrg uint64_t val); 372b8e80941Smrg void (*load_register_mem32)(struct iris_batch *batch, uint32_t reg, 373b8e80941Smrg struct iris_bo *bo, uint32_t offset); 374b8e80941Smrg void (*load_register_mem64)(struct iris_batch *batch, uint32_t reg, 375b8e80941Smrg struct iris_bo *bo, uint32_t offset); 376b8e80941Smrg void (*store_register_mem32)(struct iris_batch *batch, uint32_t reg, 377b8e80941Smrg struct iris_bo *bo, uint32_t offset, 378b8e80941Smrg bool predicated); 379b8e80941Smrg void (*store_register_mem64)(struct iris_batch *batch, uint32_t reg, 380b8e80941Smrg struct iris_bo *bo, uint32_t offset, 381b8e80941Smrg bool predicated); 382b8e80941Smrg void (*store_data_imm32)(struct iris_batch *batch, 383b8e80941Smrg struct iris_bo *bo, uint32_t offset, 384b8e80941Smrg uint32_t value); 385b8e80941Smrg void (*store_data_imm64)(struct iris_batch *batch, 386b8e80941Smrg struct iris_bo *bo, uint32_t offset, 387b8e80941Smrg uint64_t value); 388b8e80941Smrg void (*copy_mem_mem)(struct iris_batch *batch, 389b8e80941Smrg struct iris_bo *dst_bo, uint32_t dst_offset, 390b8e80941Smrg struct iris_bo *src_bo, uint32_t src_offset, 391b8e80941Smrg unsigned bytes); 392b8e80941Smrg void (*emit_raw_pipe_control)(struct iris_batch *batch, uint32_t flags, 393b8e80941Smrg struct iris_bo *bo, uint32_t offset, 394b8e80941Smrg uint64_t imm); 395b8e80941Smrg 396b8e80941Smrg unsigned (*derived_program_state_size)(enum iris_program_cache_id id); 397b8e80941Smrg void (*store_derived_program_state)(struct iris_context *ice, 398b8e80941Smrg enum iris_program_cache_id cache_id, 399b8e80941Smrg struct iris_compiled_shader *shader); 400b8e80941Smrg uint32_t *(*create_so_decl_list)(const struct pipe_stream_output_info *sol, 401b8e80941Smrg const struct brw_vue_map *vue_map); 402b8e80941Smrg void (*populate_vs_key)(const struct iris_context *ice, 403b8e80941Smrg const struct shader_info *info, 404b8e80941Smrg struct brw_vs_prog_key *key); 405b8e80941Smrg void (*populate_tcs_key)(const struct iris_context *ice, 406b8e80941Smrg struct brw_tcs_prog_key *key); 407b8e80941Smrg void (*populate_tes_key)(const struct iris_context *ice, 408b8e80941Smrg struct brw_tes_prog_key *key); 409b8e80941Smrg void (*populate_gs_key)(const struct iris_context *ice, 410b8e80941Smrg struct brw_gs_prog_key *key); 411b8e80941Smrg void (*populate_fs_key)(const struct iris_context *ice, 412b8e80941Smrg struct brw_wm_prog_key *key); 413b8e80941Smrg void (*populate_cs_key)(const struct iris_context *ice, 414b8e80941Smrg struct brw_cs_prog_key *key); 415b8e80941Smrg uint32_t (*mocs)(const struct iris_bo *bo); 416b8e80941Smrg}; 417b8e80941Smrg 418b8e80941Smrg/** 419b8e80941Smrg * A pool containing SAMPLER_BORDER_COLOR_STATE entries. 420b8e80941Smrg * 421b8e80941Smrg * See iris_border_color.c for more information. 422b8e80941Smrg */ 423b8e80941Smrgstruct iris_border_color_pool { 424b8e80941Smrg struct iris_bo *bo; 425b8e80941Smrg void *map; 426b8e80941Smrg unsigned insert_point; 427b8e80941Smrg 428b8e80941Smrg /** Map from border colors to offsets in the buffer. */ 429b8e80941Smrg struct hash_table *ht; 430b8e80941Smrg}; 431b8e80941Smrg 432b8e80941Smrg/** 433b8e80941Smrg * The API context (derived from pipe_context). 434b8e80941Smrg * 435b8e80941Smrg * Most driver state is tracked here. 436b8e80941Smrg */ 437b8e80941Smrgstruct iris_context { 438b8e80941Smrg struct pipe_context ctx; 439b8e80941Smrg 440b8e80941Smrg /** A debug callback for KHR_debug output. */ 441b8e80941Smrg struct pipe_debug_callback dbg; 442b8e80941Smrg 443b8e80941Smrg /** Slab allocator for iris_transfer_map objects. */ 444b8e80941Smrg struct slab_child_pool transfer_pool; 445b8e80941Smrg 446b8e80941Smrg struct iris_vtable vtbl; 447b8e80941Smrg 448b8e80941Smrg struct blorp_context blorp; 449b8e80941Smrg 450b8e80941Smrg struct iris_batch batches[IRIS_BATCH_COUNT]; 451b8e80941Smrg 452b8e80941Smrg struct u_upload_mgr *query_buffer_uploader; 453b8e80941Smrg 454b8e80941Smrg struct { 455b8e80941Smrg struct { 456b8e80941Smrg /** 457b8e80941Smrg * Either the value of BaseVertex for indexed draw calls or the value 458b8e80941Smrg * of the argument <first> for non-indexed draw calls. 459b8e80941Smrg */ 460b8e80941Smrg int firstvertex; 461b8e80941Smrg int baseinstance; 462b8e80941Smrg } params; 463b8e80941Smrg 464b8e80941Smrg /** 465b8e80941Smrg * Resource and offset that stores draw_parameters from the indirect 466b8e80941Smrg * buffer or to the buffer that stures the previous values for non 467b8e80941Smrg * indirect draws. 468b8e80941Smrg */ 469b8e80941Smrg struct pipe_resource *draw_params_res; 470b8e80941Smrg uint32_t draw_params_offset; 471b8e80941Smrg 472b8e80941Smrg struct { 473b8e80941Smrg /** 474b8e80941Smrg * The value of DrawID. This always comes in from it's own vertex 475b8e80941Smrg * buffer since it's not part of the indirect draw parameters. 476b8e80941Smrg */ 477b8e80941Smrg int drawid; 478b8e80941Smrg 479b8e80941Smrg /** 480b8e80941Smrg * Stores if an indexed or non-indexed draw (~0/0). Useful to 481b8e80941Smrg * calculate BaseVertex as an AND of firstvertex and is_indexed_draw. 482b8e80941Smrg */ 483b8e80941Smrg int is_indexed_draw; 484b8e80941Smrg } derived_params; 485b8e80941Smrg 486b8e80941Smrg /** 487b8e80941Smrg * Resource and offset used for GL_ARB_shader_draw_parameters which 488b8e80941Smrg * contains parameters that are not present in the indirect buffer as 489b8e80941Smrg * drawid and is_indexed_draw. They will go in their own vertex element. 490b8e80941Smrg */ 491b8e80941Smrg struct pipe_resource *derived_draw_params_res; 492b8e80941Smrg uint32_t derived_draw_params_offset; 493b8e80941Smrg 494b8e80941Smrg bool is_indirect; 495b8e80941Smrg } draw; 496b8e80941Smrg 497b8e80941Smrg struct { 498b8e80941Smrg struct iris_uncompiled_shader *uncompiled[MESA_SHADER_STAGES]; 499b8e80941Smrg struct iris_compiled_shader *prog[MESA_SHADER_STAGES]; 500b8e80941Smrg struct brw_vue_map *last_vue_map; 501b8e80941Smrg 502b8e80941Smrg struct u_upload_mgr *uploader; 503b8e80941Smrg struct hash_table *cache; 504b8e80941Smrg 505b8e80941Smrg unsigned urb_size; 506b8e80941Smrg 507b8e80941Smrg /** Is a GS or TES outputting points or lines? */ 508b8e80941Smrg bool output_topology_is_points_or_lines; 509b8e80941Smrg 510b8e80941Smrg /* Track last VS URB entry size */ 511b8e80941Smrg unsigned last_vs_entry_size; 512b8e80941Smrg 513b8e80941Smrg /** 514b8e80941Smrg * Scratch buffers for various sizes and stages. 515b8e80941Smrg * 516b8e80941Smrg * Indexed by the "Per-Thread Scratch Space" field's 4-bit encoding, 517b8e80941Smrg * and shader stage. 518b8e80941Smrg */ 519b8e80941Smrg struct iris_bo *scratch_bos[1 << 4][MESA_SHADER_STAGES]; 520b8e80941Smrg } shaders; 521b8e80941Smrg 522b8e80941Smrg struct { 523b8e80941Smrg struct iris_query *query; 524b8e80941Smrg bool condition; 525b8e80941Smrg } condition; 526b8e80941Smrg 527b8e80941Smrg struct { 528b8e80941Smrg uint64_t dirty; 529b8e80941Smrg uint64_t dirty_for_nos[IRIS_NOS_COUNT]; 530b8e80941Smrg 531b8e80941Smrg unsigned num_viewports; 532b8e80941Smrg unsigned sample_mask; 533b8e80941Smrg struct iris_blend_state *cso_blend; 534b8e80941Smrg struct iris_rasterizer_state *cso_rast; 535b8e80941Smrg struct iris_depth_stencil_alpha_state *cso_zsa; 536b8e80941Smrg struct iris_vertex_element_state *cso_vertex_elements; 537b8e80941Smrg struct pipe_blend_color blend_color; 538b8e80941Smrg struct pipe_poly_stipple poly_stipple; 539b8e80941Smrg struct pipe_viewport_state viewports[IRIS_MAX_VIEWPORTS]; 540b8e80941Smrg struct pipe_scissor_state scissors[IRIS_MAX_VIEWPORTS]; 541b8e80941Smrg struct pipe_stencil_ref stencil_ref; 542b8e80941Smrg struct pipe_framebuffer_state framebuffer; 543b8e80941Smrg struct pipe_clip_state clip_planes; 544b8e80941Smrg 545b8e80941Smrg float default_outer_level[4]; 546b8e80941Smrg float default_inner_level[2]; 547b8e80941Smrg 548b8e80941Smrg /** Bitfield of which vertex buffers are bound (non-null). */ 549b8e80941Smrg uint64_t bound_vertex_buffers; 550b8e80941Smrg 551b8e80941Smrg bool primitive_restart; 552b8e80941Smrg unsigned cut_index; 553b8e80941Smrg enum pipe_prim_type prim_mode:8; 554b8e80941Smrg bool prim_is_points_or_lines; 555b8e80941Smrg uint8_t vertices_per_patch; 556b8e80941Smrg 557b8e80941Smrg /** The last compute grid size */ 558b8e80941Smrg uint32_t last_grid[3]; 559b8e80941Smrg /** Reference to the BO containing the compute grid size */ 560b8e80941Smrg struct iris_state_ref grid_size; 561b8e80941Smrg /** Reference to the SURFACE_STATE for the compute grid resource */ 562b8e80941Smrg struct iris_state_ref grid_surf_state; 563b8e80941Smrg 564b8e80941Smrg /** 565b8e80941Smrg * Array of aux usages for drawing, altered to account for any 566b8e80941Smrg * self-dependencies from resources bound for sampling and rendering. 567b8e80941Smrg */ 568b8e80941Smrg enum isl_aux_usage draw_aux_usage[BRW_MAX_DRAW_BUFFERS]; 569b8e80941Smrg 570b8e80941Smrg /** Bitfield of whether color blending is enabled for RT[i] */ 571b8e80941Smrg uint8_t blend_enables; 572b8e80941Smrg 573b8e80941Smrg /** Are depth writes enabled? (Depth buffer may or may not exist.) */ 574b8e80941Smrg bool depth_writes_enabled; 575b8e80941Smrg 576b8e80941Smrg /** Are stencil writes enabled? (Stencil buffer may or may not exist.) */ 577b8e80941Smrg bool stencil_writes_enabled; 578b8e80941Smrg 579b8e80941Smrg /** GenX-specific current state */ 580b8e80941Smrg struct iris_genx_state *genx; 581b8e80941Smrg 582b8e80941Smrg struct iris_shader_state shaders[MESA_SHADER_STAGES]; 583b8e80941Smrg 584b8e80941Smrg /** Do vertex shader uses shader draw parameters ? */ 585b8e80941Smrg bool vs_uses_draw_params; 586b8e80941Smrg bool vs_uses_derived_draw_params; 587b8e80941Smrg bool vs_needs_sgvs_element; 588b8e80941Smrg 589b8e80941Smrg /** Do vertex shader uses edge flag ? */ 590b8e80941Smrg bool vs_needs_edge_flag; 591b8e80941Smrg 592b8e80941Smrg /** Do any samplers need border color? One bit per shader stage. */ 593b8e80941Smrg uint8_t need_border_colors; 594b8e80941Smrg 595b8e80941Smrg struct pipe_stream_output_target *so_target[PIPE_MAX_SO_BUFFERS]; 596b8e80941Smrg bool streamout_active; 597b8e80941Smrg 598b8e80941Smrg bool statistics_counters_enabled; 599b8e80941Smrg 600b8e80941Smrg /** Current conditional rendering mode */ 601b8e80941Smrg enum iris_predicate_state predicate; 602b8e80941Smrg 603b8e80941Smrg /** 604b8e80941Smrg * Query BO with a MI_PREDICATE_RESULT snapshot calculated on the 605b8e80941Smrg * render context that needs to be uploaded to the compute context. 606b8e80941Smrg */ 607b8e80941Smrg struct iris_bo *compute_predicate; 608b8e80941Smrg 609b8e80941Smrg /** Is a PIPE_QUERY_PRIMITIVES_GENERATED query active? */ 610b8e80941Smrg bool prims_generated_query_active; 611b8e80941Smrg 612b8e80941Smrg /** 3DSTATE_STREAMOUT and 3DSTATE_SO_DECL_LIST packets */ 613b8e80941Smrg uint32_t *streamout; 614b8e80941Smrg 615b8e80941Smrg /** Current strides for each streamout buffer */ 616b8e80941Smrg uint16_t *streamout_strides; 617b8e80941Smrg 618b8e80941Smrg /** The SURFACE_STATE for a 1x1x1 null surface. */ 619b8e80941Smrg struct iris_state_ref unbound_tex; 620b8e80941Smrg 621b8e80941Smrg /** The SURFACE_STATE for a framebuffer-sized null surface. */ 622b8e80941Smrg struct iris_state_ref null_fb; 623b8e80941Smrg 624b8e80941Smrg struct u_upload_mgr *surface_uploader; 625b8e80941Smrg // XXX: may want a separate uploader for "hey I made a CSO!" vs 626b8e80941Smrg // "I'm streaming this out at draw time and never want it again!" 627b8e80941Smrg struct u_upload_mgr *dynamic_uploader; 628b8e80941Smrg 629b8e80941Smrg struct iris_binder binder; 630b8e80941Smrg 631b8e80941Smrg struct iris_border_color_pool border_color_pool; 632b8e80941Smrg 633b8e80941Smrg /** The high 16-bits of the last VBO/index buffer addresses */ 634b8e80941Smrg uint16_t last_vbo_high_bits[33]; 635b8e80941Smrg uint16_t last_index_bo_high_bits; 636b8e80941Smrg 637b8e80941Smrg /** 638b8e80941Smrg * Resources containing streamed state which our render context 639b8e80941Smrg * currently points to. Used to re-add these to the validation 640b8e80941Smrg * list when we start a new batch and haven't resubmitted commands. 641b8e80941Smrg */ 642b8e80941Smrg struct { 643b8e80941Smrg struct pipe_resource *cc_vp; 644b8e80941Smrg struct pipe_resource *sf_cl_vp; 645b8e80941Smrg struct pipe_resource *color_calc; 646b8e80941Smrg struct pipe_resource *scissor; 647b8e80941Smrg struct pipe_resource *blend; 648b8e80941Smrg struct pipe_resource *index_buffer; 649b8e80941Smrg } last_res; 650b8e80941Smrg } state; 651b8e80941Smrg}; 652b8e80941Smrg 653b8e80941Smrg#define perf_debug(dbg, ...) do { \ 654b8e80941Smrg if (INTEL_DEBUG & DEBUG_PERF) \ 655b8e80941Smrg dbg_printf(__VA_ARGS__); \ 656b8e80941Smrg if (unlikely(dbg)) \ 657b8e80941Smrg pipe_debug_message(dbg, PERF_INFO, __VA_ARGS__); \ 658b8e80941Smrg} while(0) 659b8e80941Smrg 660b8e80941Smrgdouble get_time(void); 661b8e80941Smrg 662b8e80941Smrgstruct pipe_context * 663b8e80941Smrgiris_create_context(struct pipe_screen *screen, void *priv, unsigned flags); 664b8e80941Smrg 665b8e80941Smrgvoid iris_init_blit_functions(struct pipe_context *ctx); 666b8e80941Smrgvoid iris_init_clear_functions(struct pipe_context *ctx); 667b8e80941Smrgvoid iris_init_program_functions(struct pipe_context *ctx); 668b8e80941Smrgvoid iris_init_resource_functions(struct pipe_context *ctx); 669b8e80941Smrgvoid iris_init_query_functions(struct pipe_context *ctx); 670b8e80941Smrgvoid iris_update_compiled_shaders(struct iris_context *ice); 671b8e80941Smrgvoid iris_update_compiled_compute_shader(struct iris_context *ice); 672b8e80941Smrgvoid iris_fill_cs_push_const_buffer(struct brw_cs_prog_data *cs_prog_data, 673b8e80941Smrg uint32_t *dst); 674b8e80941Smrg 675b8e80941Smrg 676b8e80941Smrg/* iris_blit.c */ 677b8e80941Smrgvoid iris_blorp_surf_for_resource(struct iris_vtable *vtbl, 678b8e80941Smrg struct blorp_surf *surf, 679b8e80941Smrg struct pipe_resource *p_res, 680b8e80941Smrg enum isl_aux_usage aux_usage, 681b8e80941Smrg unsigned level, 682b8e80941Smrg bool is_render_target); 683b8e80941Smrgvoid iris_copy_region(struct blorp_context *blorp, 684b8e80941Smrg struct iris_batch *batch, 685b8e80941Smrg struct pipe_resource *dst, 686b8e80941Smrg unsigned dst_level, 687b8e80941Smrg unsigned dstx, unsigned dsty, unsigned dstz, 688b8e80941Smrg struct pipe_resource *src, 689b8e80941Smrg unsigned src_level, 690b8e80941Smrg const struct pipe_box *src_box); 691b8e80941Smrg 692b8e80941Smrg/* iris_draw.c */ 693b8e80941Smrg 694b8e80941Smrgvoid iris_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info); 695b8e80941Smrgvoid iris_launch_grid(struct pipe_context *, const struct pipe_grid_info *); 696b8e80941Smrg 697b8e80941Smrg/* iris_pipe_control.c */ 698b8e80941Smrg 699b8e80941Smrgvoid iris_emit_pipe_control_flush(struct iris_batch *batch, 700b8e80941Smrg uint32_t flags); 701b8e80941Smrgvoid iris_emit_pipe_control_write(struct iris_batch *batch, uint32_t flags, 702b8e80941Smrg struct iris_bo *bo, uint32_t offset, 703b8e80941Smrg uint64_t imm); 704b8e80941Smrgvoid iris_emit_end_of_pipe_sync(struct iris_batch *batch, 705b8e80941Smrg uint32_t flags); 706b8e80941Smrg 707b8e80941Smrgvoid iris_init_flush_functions(struct pipe_context *ctx); 708b8e80941Smrg 709b8e80941Smrg/* iris_blorp.c */ 710b8e80941Smrgvoid gen8_init_blorp(struct iris_context *ice); 711b8e80941Smrgvoid gen9_init_blorp(struct iris_context *ice); 712b8e80941Smrgvoid gen10_init_blorp(struct iris_context *ice); 713b8e80941Smrgvoid gen11_init_blorp(struct iris_context *ice); 714b8e80941Smrg 715b8e80941Smrg/* iris_border_color.c */ 716b8e80941Smrg 717b8e80941Smrgvoid iris_init_border_color_pool(struct iris_context *ice); 718b8e80941Smrgvoid iris_destroy_border_color_pool(struct iris_context *ice); 719b8e80941Smrgvoid iris_border_color_pool_reserve(struct iris_context *ice, unsigned count); 720b8e80941Smrguint32_t iris_upload_border_color(struct iris_context *ice, 721b8e80941Smrg union pipe_color_union *color); 722b8e80941Smrg 723b8e80941Smrg/* iris_state.c */ 724b8e80941Smrgvoid gen8_init_state(struct iris_context *ice); 725b8e80941Smrgvoid gen9_init_state(struct iris_context *ice); 726b8e80941Smrgvoid gen10_init_state(struct iris_context *ice); 727b8e80941Smrgvoid gen11_init_state(struct iris_context *ice); 728b8e80941Smrgvoid gen8_emit_urb_setup(struct iris_context *ice, 729b8e80941Smrg struct iris_batch *batch, 730b8e80941Smrg const unsigned size[4], 731b8e80941Smrg bool tess_present, bool gs_present); 732b8e80941Smrgvoid gen9_emit_urb_setup(struct iris_context *ice, 733b8e80941Smrg struct iris_batch *batch, 734b8e80941Smrg const unsigned size[4], 735b8e80941Smrg bool tess_present, bool gs_present); 736b8e80941Smrgvoid gen10_emit_urb_setup(struct iris_context *ice, 737b8e80941Smrg struct iris_batch *batch, 738b8e80941Smrg const unsigned size[4], 739b8e80941Smrg bool tess_present, bool gs_present); 740b8e80941Smrgvoid gen11_emit_urb_setup(struct iris_context *ice, 741b8e80941Smrg struct iris_batch *batch, 742b8e80941Smrg const unsigned size[4], 743b8e80941Smrg bool tess_present, bool gs_present); 744b8e80941Smrg 745b8e80941Smrg/* iris_program.c */ 746b8e80941Smrgconst struct shader_info *iris_get_shader_info(const struct iris_context *ice, 747b8e80941Smrg gl_shader_stage stage); 748b8e80941Smrgstruct iris_bo *iris_get_scratch_space(struct iris_context *ice, 749b8e80941Smrg unsigned per_thread_scratch, 750b8e80941Smrg gl_shader_stage stage); 751b8e80941Smrg 752b8e80941Smrg/* iris_program_cache.c */ 753b8e80941Smrg 754b8e80941Smrgvoid iris_init_program_cache(struct iris_context *ice); 755b8e80941Smrgvoid iris_destroy_program_cache(struct iris_context *ice); 756b8e80941Smrgvoid iris_print_program_cache(struct iris_context *ice); 757b8e80941Smrgstruct iris_compiled_shader *iris_find_cached_shader(struct iris_context *ice, 758b8e80941Smrg enum iris_program_cache_id, 759b8e80941Smrg uint32_t key_size, 760b8e80941Smrg const void *key); 761b8e80941Smrgstruct iris_compiled_shader *iris_upload_shader(struct iris_context *ice, 762b8e80941Smrg enum iris_program_cache_id, 763b8e80941Smrg uint32_t key_size, 764b8e80941Smrg const void *key, 765b8e80941Smrg const void *assembly, 766b8e80941Smrg struct brw_stage_prog_data *, 767b8e80941Smrg uint32_t *streamout, 768b8e80941Smrg enum brw_param_builtin *sysv, 769b8e80941Smrg unsigned num_system_values, 770b8e80941Smrg unsigned num_cbufs); 771b8e80941Smrgconst void *iris_find_previous_compile(const struct iris_context *ice, 772b8e80941Smrg enum iris_program_cache_id cache_id, 773b8e80941Smrg unsigned program_string_id); 774b8e80941Smrgbool iris_blorp_lookup_shader(struct blorp_batch *blorp_batch, 775b8e80941Smrg const void *key, 776b8e80941Smrg uint32_t key_size, 777b8e80941Smrg uint32_t *kernel_out, 778b8e80941Smrg void *prog_data_out); 779b8e80941Smrgbool iris_blorp_upload_shader(struct blorp_batch *blorp_batch, 780b8e80941Smrg const void *key, uint32_t key_size, 781b8e80941Smrg const void *kernel, uint32_t kernel_size, 782b8e80941Smrg const struct brw_stage_prog_data *prog_data, 783b8e80941Smrg uint32_t prog_data_size, 784b8e80941Smrg uint32_t *kernel_out, 785b8e80941Smrg void *prog_data_out); 786b8e80941Smrg 787b8e80941Smrg/* iris_query.c */ 788b8e80941Smrg 789b8e80941Smrgvoid iris_math_div32_gpr0(struct iris_context *ice, 790b8e80941Smrg struct iris_batch *batch, 791b8e80941Smrg uint32_t D); 792b8e80941Smrgvoid iris_math_add32_gpr0(struct iris_context *ice, 793b8e80941Smrg struct iris_batch *batch, 794b8e80941Smrg uint32_t x); 795b8e80941Smrg 796b8e80941Smrguint64_t iris_timebase_scale(const struct gen_device_info *devinfo, 797b8e80941Smrg uint64_t gpu_timestamp); 798b8e80941Smrgvoid iris_resolve_conditional_render(struct iris_context *ice); 799b8e80941Smrg 800b8e80941Smrg/* iris_resolve.c */ 801b8e80941Smrg 802b8e80941Smrgvoid iris_predraw_resolve_inputs(struct iris_context *ice, 803b8e80941Smrg struct iris_batch *batch, 804b8e80941Smrg bool *draw_aux_buffer_disabled, 805b8e80941Smrg gl_shader_stage stage, 806b8e80941Smrg bool consider_framebuffer); 807b8e80941Smrgvoid iris_predraw_resolve_framebuffer(struct iris_context *ice, 808b8e80941Smrg struct iris_batch *batch, 809b8e80941Smrg bool *draw_aux_buffer_disabled); 810b8e80941Smrgvoid iris_postdraw_update_resolve_tracking(struct iris_context *ice, 811b8e80941Smrg struct iris_batch *batch); 812b8e80941Smrgvoid iris_cache_sets_clear(struct iris_batch *batch); 813b8e80941Smrgvoid iris_flush_depth_and_render_caches(struct iris_batch *batch); 814b8e80941Smrgvoid iris_cache_flush_for_read(struct iris_batch *batch, struct iris_bo *bo); 815b8e80941Smrgvoid iris_cache_flush_for_render(struct iris_batch *batch, 816b8e80941Smrg struct iris_bo *bo, 817b8e80941Smrg enum isl_format format, 818b8e80941Smrg enum isl_aux_usage aux_usage); 819b8e80941Smrgvoid iris_render_cache_add_bo(struct iris_batch *batch, 820b8e80941Smrg struct iris_bo *bo, 821b8e80941Smrg enum isl_format format, 822b8e80941Smrg enum isl_aux_usage aux_usage); 823b8e80941Smrgvoid iris_cache_flush_for_depth(struct iris_batch *batch, struct iris_bo *bo); 824b8e80941Smrgvoid iris_depth_cache_add_bo(struct iris_batch *batch, struct iris_bo *bo); 825b8e80941Smrg 826b8e80941Smrg/* iris_state.c */ 827b8e80941Smrgvoid gen9_toggle_preemption(struct iris_context *ice, 828b8e80941Smrg struct iris_batch *batch, 829b8e80941Smrg const struct pipe_draw_info *draw); 830b8e80941Smrg#endif 831