1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Copyright © 2017 Intel Corporation 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 5bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 6bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 7bf215546Sopenharmony_ci * on the rights to use, copy, modify, merge, publish, distribute, sub 8bf215546Sopenharmony_ci * license, and/or sell copies of the Software, and to permit persons to whom 9bf215546Sopenharmony_ci * the Software is furnished to do so, subject to the following conditions: 10bf215546Sopenharmony_ci * 11bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the next 12bf215546Sopenharmony_ci * paragraph) shall be included in all copies or substantial portions of the 13bf215546Sopenharmony_ci * Software. 14bf215546Sopenharmony_ci * 15bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL 18bf215546Sopenharmony_ci * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, 19bf215546Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 20bf215546Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 21bf215546Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE. 22bf215546Sopenharmony_ci */ 23bf215546Sopenharmony_ci#ifndef CROCUS_CONTEXT_H 24bf215546Sopenharmony_ci#define CROCUS_CONTEXT_H 25bf215546Sopenharmony_ci 26bf215546Sopenharmony_ci#include "pipe/p_context.h" 27bf215546Sopenharmony_ci#include "pipe/p_state.h" 28bf215546Sopenharmony_ci#include "util/u_debug.h" 29bf215546Sopenharmony_ci#include "util/u_threaded_context.h" 30bf215546Sopenharmony_ci#include "intel/blorp/blorp.h" 31bf215546Sopenharmony_ci#include "intel/dev/intel_debug.h" 32bf215546Sopenharmony_ci#include "intel/compiler/brw_compiler.h" 33bf215546Sopenharmony_ci#include "crocus_batch.h" 34bf215546Sopenharmony_ci#include "crocus_fence.h" 35bf215546Sopenharmony_ci#include "crocus_resource.h" 36bf215546Sopenharmony_ci#include "crocus_screen.h" 37bf215546Sopenharmony_ci#include "util/u_blitter.h" 38bf215546Sopenharmony_ci 39bf215546Sopenharmony_cistruct crocus_bo; 40bf215546Sopenharmony_cistruct crocus_context; 41bf215546Sopenharmony_cistruct blorp_batch; 42bf215546Sopenharmony_cistruct blorp_params; 43bf215546Sopenharmony_ci 44bf215546Sopenharmony_ci#define CROCUS_MAX_TEXTURE_BUFFER_SIZE (1 << 27) 45bf215546Sopenharmony_ci#define CROCUS_MAX_TEXTURE_SAMPLERS 32 46bf215546Sopenharmony_ci/* CROCUS_MAX_ABOS and CROCUS_MAX_SSBOS must be the same. */ 47bf215546Sopenharmony_ci#define CROCUS_MAX_ABOS 16 48bf215546Sopenharmony_ci#define CROCUS_MAX_SSBOS 16 49bf215546Sopenharmony_ci#define CROCUS_MAX_VIEWPORTS 16 50bf215546Sopenharmony_ci#define CROCUS_MAX_CLIP_PLANES 8 51bf215546Sopenharmony_ci 52bf215546Sopenharmony_cienum crocus_param_domain { 53bf215546Sopenharmony_ci BRW_PARAM_DOMAIN_BUILTIN = 0, 54bf215546Sopenharmony_ci BRW_PARAM_DOMAIN_IMAGE, 55bf215546Sopenharmony_ci}; 56bf215546Sopenharmony_ci 57bf215546Sopenharmony_cienum { 58bf215546Sopenharmony_ci DRI_CONF_BO_REUSE_DISABLED, 59bf215546Sopenharmony_ci DRI_CONF_BO_REUSE_ALL 60bf215546Sopenharmony_ci}; 61bf215546Sopenharmony_ci 62bf215546Sopenharmony_ci#define BRW_PARAM(domain, val) (BRW_PARAM_DOMAIN_##domain << 24 | (val)) 63bf215546Sopenharmony_ci#define BRW_PARAM_DOMAIN(param) ((uint32_t)(param) >> 24) 64bf215546Sopenharmony_ci#define BRW_PARAM_VALUE(param) ((uint32_t)(param) & 0x00ffffff) 65bf215546Sopenharmony_ci#define BRW_PARAM_IMAGE(idx, offset) BRW_PARAM(IMAGE, ((idx) << 8) | (offset)) 66bf215546Sopenharmony_ci#define BRW_PARAM_IMAGE_IDX(value) (BRW_PARAM_VALUE(value) >> 8) 67bf215546Sopenharmony_ci#define BRW_PARAM_IMAGE_OFFSET(value)(BRW_PARAM_VALUE(value) & 0xf) 68bf215546Sopenharmony_ci 69bf215546Sopenharmony_ci/** 70bf215546Sopenharmony_ci * Dirty flags. When state changes, we flag some combination of these 71bf215546Sopenharmony_ci * to indicate that particular GPU commands need to be re-emitted. 72bf215546Sopenharmony_ci * 73bf215546Sopenharmony_ci * Each bit typically corresponds to a single 3DSTATE_* command packet, but 74bf215546Sopenharmony_ci * in rare cases they map to a group of related packets that need to be 75bf215546Sopenharmony_ci * emitted together. 76bf215546Sopenharmony_ci * 77bf215546Sopenharmony_ci * See crocus_upload_render_state(). 78bf215546Sopenharmony_ci */ 79bf215546Sopenharmony_ci#define CROCUS_DIRTY_COLOR_CALC_STATE (1ull << 0) 80bf215546Sopenharmony_ci#define CROCUS_DIRTY_POLYGON_STIPPLE (1ull << 1) 81bf215546Sopenharmony_ci#define CROCUS_DIRTY_CC_VIEWPORT (1ull << 2) 82bf215546Sopenharmony_ci#define CROCUS_DIRTY_SF_CL_VIEWPORT (1ull << 3) 83bf215546Sopenharmony_ci#define CROCUS_DIRTY_RASTER (1ull << 4) 84bf215546Sopenharmony_ci#define CROCUS_DIRTY_CLIP (1ull << 5) 85bf215546Sopenharmony_ci#define CROCUS_DIRTY_LINE_STIPPLE (1ull << 6) 86bf215546Sopenharmony_ci#define CROCUS_DIRTY_VERTEX_ELEMENTS (1ull << 7) 87bf215546Sopenharmony_ci#define CROCUS_DIRTY_VERTEX_BUFFERS (1ull << 8) 88bf215546Sopenharmony_ci#define CROCUS_DIRTY_DRAWING_RECTANGLE (1ull << 9) 89bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN6_URB (1ull << 10) 90bf215546Sopenharmony_ci#define CROCUS_DIRTY_DEPTH_BUFFER (1ull << 11) 91bf215546Sopenharmony_ci#define CROCUS_DIRTY_WM (1ull << 12) 92bf215546Sopenharmony_ci#define CROCUS_DIRTY_SO_DECL_LIST (1ull << 13) 93bf215546Sopenharmony_ci#define CROCUS_DIRTY_STREAMOUT (1ull << 14) 94bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN4_CONSTANT_COLOR (1ull << 15) 95bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN4_CURBE (1ull << 16) 96bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN4_URB_FENCE (1ull << 17) 97bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN5_PIPELINED_POINTERS (1ull << 18) 98bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN5_BINDING_TABLE_POINTERS (1ull << 19) 99bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN6_BLEND_STATE (1ull << 20) 100bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN6_SCISSOR_RECT (1ull << 21) 101bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN6_WM_DEPTH_STENCIL (1ull << 22) 102bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN6_MULTISAMPLE (1ull << 23) 103bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN6_SAMPLE_MASK (1ull << 24) 104bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN7_SBE (1ull << 25) 105bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN7_L3_CONFIG (1ull << 26) 106bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN7_SO_BUFFERS (1ull << 27) 107bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN75_VF (1ull << 28) 108bf215546Sopenharmony_ci#define CROCUS_DIRTY_RENDER_RESOLVES_AND_FLUSHES (1ull << 29) 109bf215546Sopenharmony_ci#define CROCUS_DIRTY_COMPUTE_RESOLVES_AND_FLUSHES (1ull << 30) 110bf215546Sopenharmony_ci#define CROCUS_DIRTY_VF_STATISTICS (1ull << 31) 111bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN4_CLIP_PROG (1ull << 32) 112bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN4_SF_PROG (1ull << 33) 113bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN4_FF_GS_PROG (1ull << 34) 114bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN6_SAMPLER_STATE_POINTERS (1ull << 35) 115bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN6_SVBI (1ull << 36) 116bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN8_VF_TOPOLOGY (1ull << 37) 117bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN8_PMA_FIX (1ull << 38) 118bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN8_VF_SGVS (1ull << 39) 119bf215546Sopenharmony_ci#define CROCUS_DIRTY_GEN8_PS_BLEND (1ull << 40) 120bf215546Sopenharmony_ci 121bf215546Sopenharmony_ci#define CROCUS_ALL_DIRTY_FOR_COMPUTE (CROCUS_DIRTY_COMPUTE_RESOLVES_AND_FLUSHES) 122bf215546Sopenharmony_ci 123bf215546Sopenharmony_ci#define CROCUS_ALL_DIRTY_FOR_RENDER (~CROCUS_ALL_DIRTY_FOR_COMPUTE) 124bf215546Sopenharmony_ci 125bf215546Sopenharmony_ci/** 126bf215546Sopenharmony_ci * Per-stage dirty flags. When state changes, we flag some combination of 127bf215546Sopenharmony_ci * these to indicate that particular GPU commands need to be re-emitted. 128bf215546Sopenharmony_ci * Unlike the IRIS_DIRTY_* flags these are shader stage-specific and can be 129bf215546Sopenharmony_ci * indexed by shifting the mask by the shader stage index. 130bf215546Sopenharmony_ci * 131bf215546Sopenharmony_ci * See crocus_upload_render_state(). 132bf215546Sopenharmony_ci */ 133bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_SAMPLER_STATES_VS (1ull << 0) 134bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_SAMPLER_STATES_TCS (1ull << 1) 135bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_SAMPLER_STATES_TES (1ull << 2) 136bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_SAMPLER_STATES_GS (1ull << 3) 137bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_SAMPLER_STATES_PS (1ull << 4) 138bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_SAMPLER_STATES_CS (1ull << 5) 139bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_UNCOMPILED_VS (1ull << 6) 140bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_UNCOMPILED_TCS (1ull << 7) 141bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_UNCOMPILED_TES (1ull << 8) 142bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_UNCOMPILED_GS (1ull << 9) 143bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_UNCOMPILED_FS (1ull << 10) 144bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_UNCOMPILED_CS (1ull << 11) 145bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_VS (1ull << 12) 146bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_TCS (1ull << 13) 147bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_TES (1ull << 14) 148bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_GS (1ull << 15) 149bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_FS (1ull << 16) 150bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_CS (1ull << 17) 151bf215546Sopenharmony_ci#define CROCUS_SHIFT_FOR_STAGE_DIRTY_CONSTANTS 18 152bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_CONSTANTS_VS (1ull << 18) 153bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_CONSTANTS_TCS (1ull << 19) 154bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_CONSTANTS_TES (1ull << 20) 155bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_CONSTANTS_GS (1ull << 21) 156bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_CONSTANTS_FS (1ull << 22) 157bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_CONSTANTS_CS (1ull << 23) 158bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_BINDINGS_VS (1ull << 24) 159bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_BINDINGS_TCS (1ull << 25) 160bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_BINDINGS_TES (1ull << 26) 161bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_BINDINGS_GS (1ull << 27) 162bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_BINDINGS_FS (1ull << 28) 163bf215546Sopenharmony_ci#define CROCUS_STAGE_DIRTY_BINDINGS_CS (1ull << 29) 164bf215546Sopenharmony_ci 165bf215546Sopenharmony_ci#define CROCUS_ALL_STAGE_DIRTY_FOR_COMPUTE (CROCUS_STAGE_DIRTY_CS | \ 166bf215546Sopenharmony_ci CROCUS_STAGE_DIRTY_SAMPLER_STATES_CS | \ 167bf215546Sopenharmony_ci CROCUS_STAGE_DIRTY_UNCOMPILED_CS | \ 168bf215546Sopenharmony_ci CROCUS_STAGE_DIRTY_CONSTANTS_CS | \ 169bf215546Sopenharmony_ci CROCUS_STAGE_DIRTY_BINDINGS_CS) 170bf215546Sopenharmony_ci 171bf215546Sopenharmony_ci#define CROCUS_ALL_STAGE_DIRTY_FOR_RENDER (~CROCUS_ALL_STAGE_DIRTY_FOR_COMPUTE) 172bf215546Sopenharmony_ci 173bf215546Sopenharmony_ci#define CROCUS_ALL_STAGE_DIRTY_BINDINGS (CROCUS_STAGE_DIRTY_BINDINGS_VS | \ 174bf215546Sopenharmony_ci CROCUS_STAGE_DIRTY_BINDINGS_TCS | \ 175bf215546Sopenharmony_ci CROCUS_STAGE_DIRTY_BINDINGS_TES | \ 176bf215546Sopenharmony_ci CROCUS_STAGE_DIRTY_BINDINGS_GS | \ 177bf215546Sopenharmony_ci CROCUS_STAGE_DIRTY_BINDINGS_FS | \ 178bf215546Sopenharmony_ci CROCUS_STAGE_DIRTY_BINDINGS_CS) 179bf215546Sopenharmony_ci 180bf215546Sopenharmony_ci#define CROCUS_RENDER_STAGE_DIRTY_CONSTANTS (CROCUS_STAGE_DIRTY_CONSTANTS_VS | \ 181bf215546Sopenharmony_ci CROCUS_STAGE_DIRTY_CONSTANTS_TCS | \ 182bf215546Sopenharmony_ci CROCUS_STAGE_DIRTY_CONSTANTS_TES | \ 183bf215546Sopenharmony_ci CROCUS_STAGE_DIRTY_CONSTANTS_GS | \ 184bf215546Sopenharmony_ci CROCUS_STAGE_DIRTY_CONSTANTS_FS) 185bf215546Sopenharmony_ci 186bf215546Sopenharmony_ci/** 187bf215546Sopenharmony_ci * Non-orthogonal state (NOS) dependency flags. 188bf215546Sopenharmony_ci * 189bf215546Sopenharmony_ci * Shader programs may depend on non-orthogonal state. These flags are 190bf215546Sopenharmony_ci * used to indicate that a shader's key depends on the state provided by 191bf215546Sopenharmony_ci * a certain Gallium CSO. Changing any CSOs marked as a dependency will 192bf215546Sopenharmony_ci * cause the driver to re-compute the shader key, possibly triggering a 193bf215546Sopenharmony_ci * shader recompile. 194bf215546Sopenharmony_ci */ 195bf215546Sopenharmony_cienum crocus_nos_dep { 196bf215546Sopenharmony_ci CROCUS_NOS_FRAMEBUFFER, 197bf215546Sopenharmony_ci CROCUS_NOS_DEPTH_STENCIL_ALPHA, 198bf215546Sopenharmony_ci CROCUS_NOS_RASTERIZER, 199bf215546Sopenharmony_ci CROCUS_NOS_BLEND, 200bf215546Sopenharmony_ci CROCUS_NOS_LAST_VUE_MAP, 201bf215546Sopenharmony_ci CROCUS_NOS_TEXTURES, 202bf215546Sopenharmony_ci CROCUS_NOS_VERTEX_ELEMENTS, 203bf215546Sopenharmony_ci CROCUS_NOS_COUNT, 204bf215546Sopenharmony_ci}; 205bf215546Sopenharmony_ci 206bf215546Sopenharmony_cistruct crocus_depth_stencil_alpha_state; 207bf215546Sopenharmony_ci 208bf215546Sopenharmony_ci/** 209bf215546Sopenharmony_ci * Cache IDs for the in-memory program cache (ice->shaders.cache). 210bf215546Sopenharmony_ci */ 211bf215546Sopenharmony_cienum crocus_program_cache_id { 212bf215546Sopenharmony_ci CROCUS_CACHE_VS = MESA_SHADER_VERTEX, 213bf215546Sopenharmony_ci CROCUS_CACHE_TCS = MESA_SHADER_TESS_CTRL, 214bf215546Sopenharmony_ci CROCUS_CACHE_TES = MESA_SHADER_TESS_EVAL, 215bf215546Sopenharmony_ci CROCUS_CACHE_GS = MESA_SHADER_GEOMETRY, 216bf215546Sopenharmony_ci CROCUS_CACHE_FS = MESA_SHADER_FRAGMENT, 217bf215546Sopenharmony_ci CROCUS_CACHE_CS = MESA_SHADER_COMPUTE, 218bf215546Sopenharmony_ci CROCUS_CACHE_BLORP, 219bf215546Sopenharmony_ci CROCUS_CACHE_SF, 220bf215546Sopenharmony_ci CROCUS_CACHE_CLIP, 221bf215546Sopenharmony_ci CROCUS_CACHE_FF_GS, 222bf215546Sopenharmony_ci}; 223bf215546Sopenharmony_ci 224bf215546Sopenharmony_ci/** @{ 225bf215546Sopenharmony_ci * 226bf215546Sopenharmony_ci * Defines for PIPE_CONTROL operations, which trigger cache flushes, 227bf215546Sopenharmony_ci * synchronization, pipelined memory writes, and so on. 228bf215546Sopenharmony_ci * 229bf215546Sopenharmony_ci * The bits here are not the actual hardware values. The actual fields 230bf215546Sopenharmony_ci * move between various generations, so we just have flags for each 231bf215546Sopenharmony_ci * potential operation, and use genxml to encode the actual packet. 232bf215546Sopenharmony_ci */ 233bf215546Sopenharmony_cienum pipe_control_flags 234bf215546Sopenharmony_ci{ 235bf215546Sopenharmony_ci PIPE_CONTROL_FLUSH_LLC = (1 << 1), 236bf215546Sopenharmony_ci PIPE_CONTROL_LRI_POST_SYNC_OP = (1 << 2), 237bf215546Sopenharmony_ci PIPE_CONTROL_STORE_DATA_INDEX = (1 << 3), 238bf215546Sopenharmony_ci PIPE_CONTROL_CS_STALL = (1 << 4), 239bf215546Sopenharmony_ci PIPE_CONTROL_GLOBAL_SNAPSHOT_COUNT_RESET = (1 << 5), 240bf215546Sopenharmony_ci PIPE_CONTROL_SYNC_GFDT = (1 << 6), 241bf215546Sopenharmony_ci PIPE_CONTROL_TLB_INVALIDATE = (1 << 7), 242bf215546Sopenharmony_ci PIPE_CONTROL_MEDIA_STATE_CLEAR = (1 << 8), 243bf215546Sopenharmony_ci PIPE_CONTROL_WRITE_IMMEDIATE = (1 << 9), 244bf215546Sopenharmony_ci PIPE_CONTROL_WRITE_DEPTH_COUNT = (1 << 10), 245bf215546Sopenharmony_ci PIPE_CONTROL_WRITE_TIMESTAMP = (1 << 11), 246bf215546Sopenharmony_ci PIPE_CONTROL_DEPTH_STALL = (1 << 12), 247bf215546Sopenharmony_ci PIPE_CONTROL_RENDER_TARGET_FLUSH = (1 << 13), 248bf215546Sopenharmony_ci PIPE_CONTROL_INSTRUCTION_INVALIDATE = (1 << 14), 249bf215546Sopenharmony_ci PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE = (1 << 15), 250bf215546Sopenharmony_ci PIPE_CONTROL_INDIRECT_STATE_POINTERS_DISABLE = (1 << 16), 251bf215546Sopenharmony_ci PIPE_CONTROL_NOTIFY_ENABLE = (1 << 17), 252bf215546Sopenharmony_ci PIPE_CONTROL_FLUSH_ENABLE = (1 << 18), 253bf215546Sopenharmony_ci PIPE_CONTROL_DATA_CACHE_FLUSH = (1 << 19), 254bf215546Sopenharmony_ci PIPE_CONTROL_VF_CACHE_INVALIDATE = (1 << 20), 255bf215546Sopenharmony_ci PIPE_CONTROL_CONST_CACHE_INVALIDATE = (1 << 21), 256bf215546Sopenharmony_ci PIPE_CONTROL_STATE_CACHE_INVALIDATE = (1 << 22), 257bf215546Sopenharmony_ci PIPE_CONTROL_STALL_AT_SCOREBOARD = (1 << 23), 258bf215546Sopenharmony_ci PIPE_CONTROL_DEPTH_CACHE_FLUSH = (1 << 24), 259bf215546Sopenharmony_ci PIPE_CONTROL_TILE_CACHE_FLUSH = (1 << 25), 260bf215546Sopenharmony_ci}; 261bf215546Sopenharmony_ci 262bf215546Sopenharmony_ci#define PIPE_CONTROL_CACHE_FLUSH_BITS \ 263bf215546Sopenharmony_ci (PIPE_CONTROL_DEPTH_CACHE_FLUSH | \ 264bf215546Sopenharmony_ci PIPE_CONTROL_DATA_CACHE_FLUSH | \ 265bf215546Sopenharmony_ci PIPE_CONTROL_RENDER_TARGET_FLUSH) 266bf215546Sopenharmony_ci 267bf215546Sopenharmony_ci#define PIPE_CONTROL_CACHE_INVALIDATE_BITS \ 268bf215546Sopenharmony_ci (PIPE_CONTROL_STATE_CACHE_INVALIDATE | \ 269bf215546Sopenharmony_ci PIPE_CONTROL_CONST_CACHE_INVALIDATE | \ 270bf215546Sopenharmony_ci PIPE_CONTROL_VF_CACHE_INVALIDATE | \ 271bf215546Sopenharmony_ci PIPE_CONTROL_TEXTURE_CACHE_INVALIDATE | \ 272bf215546Sopenharmony_ci PIPE_CONTROL_INSTRUCTION_INVALIDATE) 273bf215546Sopenharmony_ci 274bf215546Sopenharmony_cienum crocus_predicate_state { 275bf215546Sopenharmony_ci /* The first two states are used if we can determine whether to draw 276bf215546Sopenharmony_ci * without having to look at the values in the query object buffer. This 277bf215546Sopenharmony_ci * will happen if there is no conditional render in progress, if the query 278bf215546Sopenharmony_ci * object is already completed or if something else has already added 279bf215546Sopenharmony_ci * samples to the preliminary result. 280bf215546Sopenharmony_ci */ 281bf215546Sopenharmony_ci CROCUS_PREDICATE_STATE_RENDER, 282bf215546Sopenharmony_ci CROCUS_PREDICATE_STATE_DONT_RENDER, 283bf215546Sopenharmony_ci 284bf215546Sopenharmony_ci /* In this case whether to draw or not depends on the result of an 285bf215546Sopenharmony_ci * MI_PREDICATE command so the predicate enable bit needs to be checked. 286bf215546Sopenharmony_ci */ 287bf215546Sopenharmony_ci CROCUS_PREDICATE_STATE_USE_BIT, 288bf215546Sopenharmony_ci /* In this case, either MI_PREDICATE doesn't exist or we lack the 289bf215546Sopenharmony_ci * necessary kernel features to use it. Stall for the query result. 290bf215546Sopenharmony_ci */ 291bf215546Sopenharmony_ci CROCUS_PREDICATE_STATE_STALL_FOR_QUERY, 292bf215546Sopenharmony_ci}; 293bf215546Sopenharmony_ci 294bf215546Sopenharmony_ci/** @} */ 295bf215546Sopenharmony_ci 296bf215546Sopenharmony_ci/** 297bf215546Sopenharmony_ci * An uncompiled, API-facing shader. This is the Gallium CSO for shaders. 298bf215546Sopenharmony_ci * It primarily contains the NIR for the shader. 299bf215546Sopenharmony_ci * 300bf215546Sopenharmony_ci * Each API-facing shader can be compiled into multiple shader variants, 301bf215546Sopenharmony_ci * based on non-orthogonal state dependencies, recorded in the shader key. 302bf215546Sopenharmony_ci * 303bf215546Sopenharmony_ci * See crocus_compiled_shader, which represents a compiled shader variant. 304bf215546Sopenharmony_ci */ 305bf215546Sopenharmony_cistruct crocus_uncompiled_shader { 306bf215546Sopenharmony_ci struct nir_shader *nir; 307bf215546Sopenharmony_ci 308bf215546Sopenharmony_ci struct pipe_stream_output_info stream_output; 309bf215546Sopenharmony_ci 310bf215546Sopenharmony_ci /* A SHA1 of the serialized NIR for the disk cache. */ 311bf215546Sopenharmony_ci unsigned char nir_sha1[20]; 312bf215546Sopenharmony_ci 313bf215546Sopenharmony_ci unsigned program_id; 314bf215546Sopenharmony_ci 315bf215546Sopenharmony_ci /** Bitfield of (1 << CROCUS_NOS_*) flags. */ 316bf215546Sopenharmony_ci unsigned nos; 317bf215546Sopenharmony_ci 318bf215546Sopenharmony_ci /** Have any shader variants been compiled yet? */ 319bf215546Sopenharmony_ci bool compiled_once; 320bf215546Sopenharmony_ci 321bf215546Sopenharmony_ci bool needs_edge_flag; 322bf215546Sopenharmony_ci 323bf215546Sopenharmony_ci /** Constant data scraped from the shader by nir_opt_large_constants */ 324bf215546Sopenharmony_ci struct pipe_resource *const_data; 325bf215546Sopenharmony_ci 326bf215546Sopenharmony_ci /** Surface state for const_data */ 327bf215546Sopenharmony_ci struct crocus_state_ref const_data_state; 328bf215546Sopenharmony_ci}; 329bf215546Sopenharmony_ci 330bf215546Sopenharmony_cienum crocus_surface_group { 331bf215546Sopenharmony_ci CROCUS_SURFACE_GROUP_RENDER_TARGET, 332bf215546Sopenharmony_ci CROCUS_SURFACE_GROUP_RENDER_TARGET_READ, 333bf215546Sopenharmony_ci CROCUS_SURFACE_GROUP_SOL, 334bf215546Sopenharmony_ci CROCUS_SURFACE_GROUP_CS_WORK_GROUPS, 335bf215546Sopenharmony_ci CROCUS_SURFACE_GROUP_TEXTURE, 336bf215546Sopenharmony_ci CROCUS_SURFACE_GROUP_TEXTURE_GATHER, 337bf215546Sopenharmony_ci CROCUS_SURFACE_GROUP_IMAGE, 338bf215546Sopenharmony_ci CROCUS_SURFACE_GROUP_UBO, 339bf215546Sopenharmony_ci CROCUS_SURFACE_GROUP_SSBO, 340bf215546Sopenharmony_ci 341bf215546Sopenharmony_ci CROCUS_SURFACE_GROUP_COUNT, 342bf215546Sopenharmony_ci}; 343bf215546Sopenharmony_ci 344bf215546Sopenharmony_cienum { 345bf215546Sopenharmony_ci /* Invalid value for a binding table index. */ 346bf215546Sopenharmony_ci CROCUS_SURFACE_NOT_USED = 0xa0a0a0a0, 347bf215546Sopenharmony_ci}; 348bf215546Sopenharmony_ci 349bf215546Sopenharmony_cistruct crocus_binding_table { 350bf215546Sopenharmony_ci uint32_t size_bytes; 351bf215546Sopenharmony_ci 352bf215546Sopenharmony_ci /** Number of surfaces in each group, before compacting. */ 353bf215546Sopenharmony_ci uint32_t sizes[CROCUS_SURFACE_GROUP_COUNT]; 354bf215546Sopenharmony_ci 355bf215546Sopenharmony_ci /** Initial offset of each group. */ 356bf215546Sopenharmony_ci uint32_t offsets[CROCUS_SURFACE_GROUP_COUNT]; 357bf215546Sopenharmony_ci 358bf215546Sopenharmony_ci /** Mask of surfaces used in each group. */ 359bf215546Sopenharmony_ci uint64_t used_mask[CROCUS_SURFACE_GROUP_COUNT]; 360bf215546Sopenharmony_ci}; 361bf215546Sopenharmony_ci 362bf215546Sopenharmony_ci/** 363bf215546Sopenharmony_ci * A compiled shader variant, containing a pointer to the GPU assembly, 364bf215546Sopenharmony_ci * as well as program data and other packets needed by state upload. 365bf215546Sopenharmony_ci * 366bf215546Sopenharmony_ci * There can be several crocus_compiled_shader variants per API-level shader 367bf215546Sopenharmony_ci * (crocus_uncompiled_shader), due to state-based recompiles (brw_*_prog_key). 368bf215546Sopenharmony_ci */ 369bf215546Sopenharmony_cistruct crocus_compiled_shader { 370bf215546Sopenharmony_ci /** Reference to the uploaded assembly. */ 371bf215546Sopenharmony_ci uint32_t offset; 372bf215546Sopenharmony_ci 373bf215546Sopenharmony_ci /* asm size in map */ 374bf215546Sopenharmony_ci uint32_t map_size; 375bf215546Sopenharmony_ci 376bf215546Sopenharmony_ci /** The program data (owned by the program cache hash table) */ 377bf215546Sopenharmony_ci struct brw_stage_prog_data *prog_data; 378bf215546Sopenharmony_ci uint32_t prog_data_size; 379bf215546Sopenharmony_ci 380bf215546Sopenharmony_ci /** A list of system values to be uploaded as uniforms. */ 381bf215546Sopenharmony_ci enum brw_param_builtin *system_values; 382bf215546Sopenharmony_ci unsigned num_system_values; 383bf215546Sopenharmony_ci 384bf215546Sopenharmony_ci /** Number of constbufs expected by the shader. */ 385bf215546Sopenharmony_ci unsigned num_cbufs; 386bf215546Sopenharmony_ci 387bf215546Sopenharmony_ci /** 388bf215546Sopenharmony_ci * Derived 3DSTATE_STREAMOUT and 3DSTATE_SO_DECL_LIST packets 389bf215546Sopenharmony_ci * (the VUE-based information for transform feedback outputs). 390bf215546Sopenharmony_ci */ 391bf215546Sopenharmony_ci uint32_t *streamout; 392bf215546Sopenharmony_ci 393bf215546Sopenharmony_ci struct crocus_binding_table bt; 394bf215546Sopenharmony_ci 395bf215546Sopenharmony_ci uint32_t bind_bo_offset; 396bf215546Sopenharmony_ci uint32_t surf_offset[128];//TODO 397bf215546Sopenharmony_ci}; 398bf215546Sopenharmony_ci 399bf215546Sopenharmony_ci/** 400bf215546Sopenharmony_ci * API context state that is replicated per shader stage. 401bf215546Sopenharmony_ci */ 402bf215546Sopenharmony_cistruct crocus_shader_state { 403bf215546Sopenharmony_ci /** Uniform Buffers */ 404bf215546Sopenharmony_ci struct pipe_constant_buffer constbufs[PIPE_MAX_CONSTANT_BUFFERS]; 405bf215546Sopenharmony_ci 406bf215546Sopenharmony_ci bool sysvals_need_upload; 407bf215546Sopenharmony_ci 408bf215546Sopenharmony_ci /** Shader Storage Buffers */ 409bf215546Sopenharmony_ci struct pipe_shader_buffer ssbo[PIPE_MAX_SHADER_BUFFERS]; 410bf215546Sopenharmony_ci 411bf215546Sopenharmony_ci /** Shader Storage Images (image load store) */ 412bf215546Sopenharmony_ci struct crocus_image_view image[PIPE_MAX_SHADER_IMAGES]; 413bf215546Sopenharmony_ci 414bf215546Sopenharmony_ci struct crocus_sampler_state *samplers[CROCUS_MAX_TEXTURE_SAMPLERS]; 415bf215546Sopenharmony_ci struct crocus_sampler_view *textures[CROCUS_MAX_TEXTURE_SAMPLERS]; 416bf215546Sopenharmony_ci 417bf215546Sopenharmony_ci /** Bitfield of which constant buffers are bound (non-null). */ 418bf215546Sopenharmony_ci uint32_t bound_cbufs; 419bf215546Sopenharmony_ci 420bf215546Sopenharmony_ci /** Bitfield of which image views are bound (non-null). */ 421bf215546Sopenharmony_ci uint32_t bound_image_views; 422bf215546Sopenharmony_ci 423bf215546Sopenharmony_ci /** Bitfield of which sampler views are bound (non-null). */ 424bf215546Sopenharmony_ci uint32_t bound_sampler_views; 425bf215546Sopenharmony_ci 426bf215546Sopenharmony_ci /** Bitfield of which shader storage buffers are bound (non-null). */ 427bf215546Sopenharmony_ci uint32_t bound_ssbos; 428bf215546Sopenharmony_ci 429bf215546Sopenharmony_ci /** Bitfield of which shader storage buffers are writable. */ 430bf215546Sopenharmony_ci uint32_t writable_ssbos; 431bf215546Sopenharmony_ci 432bf215546Sopenharmony_ci uint32_t sampler_offset; 433bf215546Sopenharmony_ci}; 434bf215546Sopenharmony_ci 435bf215546Sopenharmony_ci/** 436bf215546Sopenharmony_ci * The API context (derived from pipe_context). 437bf215546Sopenharmony_ci * 438bf215546Sopenharmony_ci * Most driver state is tracked here. 439bf215546Sopenharmony_ci */ 440bf215546Sopenharmony_cistruct crocus_context { 441bf215546Sopenharmony_ci struct pipe_context ctx; 442bf215546Sopenharmony_ci struct threaded_context *thrctx; 443bf215546Sopenharmony_ci 444bf215546Sopenharmony_ci /** A debug callback for KHR_debug output. */ 445bf215546Sopenharmony_ci struct util_debug_callback dbg; 446bf215546Sopenharmony_ci 447bf215546Sopenharmony_ci /** A device reset status callback for notifying that the GPU is hosed. */ 448bf215546Sopenharmony_ci struct pipe_device_reset_callback reset; 449bf215546Sopenharmony_ci 450bf215546Sopenharmony_ci /** Slab allocator for crocus_transfer_map objects. */ 451bf215546Sopenharmony_ci struct slab_child_pool transfer_pool; 452bf215546Sopenharmony_ci 453bf215546Sopenharmony_ci /** Slab allocator for threaded_context's crocus_transfer_map objects */ 454bf215546Sopenharmony_ci struct slab_child_pool transfer_pool_unsync; 455bf215546Sopenharmony_ci 456bf215546Sopenharmony_ci struct blorp_context blorp; 457bf215546Sopenharmony_ci 458bf215546Sopenharmony_ci int batch_count; 459bf215546Sopenharmony_ci struct crocus_batch batches[CROCUS_BATCH_COUNT]; 460bf215546Sopenharmony_ci 461bf215546Sopenharmony_ci struct u_upload_mgr *query_buffer_uploader; 462bf215546Sopenharmony_ci 463bf215546Sopenharmony_ci struct blitter_context *blitter; 464bf215546Sopenharmony_ci 465bf215546Sopenharmony_ci struct { 466bf215546Sopenharmony_ci struct { 467bf215546Sopenharmony_ci /** 468bf215546Sopenharmony_ci * Either the value of BaseVertex for indexed draw calls or the value 469bf215546Sopenharmony_ci * of the argument <first> for non-indexed draw calls. 470bf215546Sopenharmony_ci */ 471bf215546Sopenharmony_ci int firstvertex; 472bf215546Sopenharmony_ci int baseinstance; 473bf215546Sopenharmony_ci } params; 474bf215546Sopenharmony_ci 475bf215546Sopenharmony_ci /** 476bf215546Sopenharmony_ci * Are the above values the ones stored in the draw_params buffer? 477bf215546Sopenharmony_ci * If so, we can compare them against new values to see if anything 478bf215546Sopenharmony_ci * changed. If not, we need to assume they changed. 479bf215546Sopenharmony_ci */ 480bf215546Sopenharmony_ci bool params_valid; 481bf215546Sopenharmony_ci 482bf215546Sopenharmony_ci /** 483bf215546Sopenharmony_ci * Resource and offset that stores draw_parameters from the indirect 484bf215546Sopenharmony_ci * buffer or to the buffer that stures the previous values for non 485bf215546Sopenharmony_ci * indirect draws. 486bf215546Sopenharmony_ci */ 487bf215546Sopenharmony_ci struct crocus_state_ref draw_params; 488bf215546Sopenharmony_ci 489bf215546Sopenharmony_ci struct { 490bf215546Sopenharmony_ci /** 491bf215546Sopenharmony_ci * The value of DrawID. This always comes in from it's own vertex 492bf215546Sopenharmony_ci * buffer since it's not part of the indirect draw parameters. 493bf215546Sopenharmony_ci */ 494bf215546Sopenharmony_ci int drawid; 495bf215546Sopenharmony_ci 496bf215546Sopenharmony_ci /** 497bf215546Sopenharmony_ci * Stores if an indexed or non-indexed draw (~0/0). Useful to 498bf215546Sopenharmony_ci * calculate BaseVertex as an AND of firstvertex and is_indexed_draw. 499bf215546Sopenharmony_ci */ 500bf215546Sopenharmony_ci int is_indexed_draw; 501bf215546Sopenharmony_ci } derived_params; 502bf215546Sopenharmony_ci 503bf215546Sopenharmony_ci /** 504bf215546Sopenharmony_ci * Resource and offset used for GL_ARB_shader_draw_parameters which 505bf215546Sopenharmony_ci * contains parameters that are not present in the indirect buffer as 506bf215546Sopenharmony_ci * drawid and is_indexed_draw. They will go in their own vertex element. 507bf215546Sopenharmony_ci */ 508bf215546Sopenharmony_ci struct crocus_state_ref derived_draw_params; 509bf215546Sopenharmony_ci } draw; 510bf215546Sopenharmony_ci 511bf215546Sopenharmony_ci struct { 512bf215546Sopenharmony_ci struct crocus_uncompiled_shader *uncompiled[MESA_SHADER_STAGES]; 513bf215546Sopenharmony_ci struct crocus_compiled_shader *prog[MESA_SHADER_STAGES]; 514bf215546Sopenharmony_ci struct brw_vue_map *last_vue_map; 515bf215546Sopenharmony_ci 516bf215546Sopenharmony_ci struct crocus_bo *cache_bo; 517bf215546Sopenharmony_ci uint32_t cache_next_offset; 518bf215546Sopenharmony_ci void *cache_bo_map; 519bf215546Sopenharmony_ci struct hash_table *cache; 520bf215546Sopenharmony_ci 521bf215546Sopenharmony_ci unsigned urb_size; 522bf215546Sopenharmony_ci 523bf215546Sopenharmony_ci /* gen 4/5 clip/sf progs */ 524bf215546Sopenharmony_ci struct crocus_compiled_shader *clip_prog; 525bf215546Sopenharmony_ci struct crocus_compiled_shader *sf_prog; 526bf215546Sopenharmony_ci /* gen4/5 prims, gen6 streamout */ 527bf215546Sopenharmony_ci struct crocus_compiled_shader *ff_gs_prog; 528bf215546Sopenharmony_ci uint32_t clip_offset; 529bf215546Sopenharmony_ci uint32_t sf_offset; 530bf215546Sopenharmony_ci uint32_t wm_offset; 531bf215546Sopenharmony_ci uint32_t vs_offset; 532bf215546Sopenharmony_ci uint32_t gs_offset; 533bf215546Sopenharmony_ci uint32_t cc_offset; 534bf215546Sopenharmony_ci 535bf215546Sopenharmony_ci /** Is a GS or TES outputting points or lines? */ 536bf215546Sopenharmony_ci bool output_topology_is_points_or_lines; 537bf215546Sopenharmony_ci 538bf215546Sopenharmony_ci /* Track last VS URB entry size */ 539bf215546Sopenharmony_ci unsigned last_vs_entry_size; 540bf215546Sopenharmony_ci 541bf215546Sopenharmony_ci /** 542bf215546Sopenharmony_ci * Scratch buffers for various sizes and stages. 543bf215546Sopenharmony_ci * 544bf215546Sopenharmony_ci * Indexed by the "Per-Thread Scratch Space" field's 4-bit encoding, 545bf215546Sopenharmony_ci * and shader stage. 546bf215546Sopenharmony_ci */ 547bf215546Sopenharmony_ci struct crocus_bo *scratch_bos[1 << 4][MESA_SHADER_STAGES]; 548bf215546Sopenharmony_ci } shaders; 549bf215546Sopenharmony_ci 550bf215546Sopenharmony_ci struct { 551bf215546Sopenharmony_ci struct crocus_query *query; 552bf215546Sopenharmony_ci bool condition; 553bf215546Sopenharmony_ci enum pipe_render_cond_flag mode; 554bf215546Sopenharmony_ci } condition; 555bf215546Sopenharmony_ci 556bf215546Sopenharmony_ci struct intel_perf_context *perf_ctx; 557bf215546Sopenharmony_ci 558bf215546Sopenharmony_ci struct { 559bf215546Sopenharmony_ci uint64_t dirty; 560bf215546Sopenharmony_ci uint64_t stage_dirty; 561bf215546Sopenharmony_ci uint64_t stage_dirty_for_nos[CROCUS_NOS_COUNT]; 562bf215546Sopenharmony_ci 563bf215546Sopenharmony_ci unsigned num_viewports; 564bf215546Sopenharmony_ci unsigned sample_mask; 565bf215546Sopenharmony_ci struct crocus_blend_state *cso_blend; 566bf215546Sopenharmony_ci struct crocus_rasterizer_state *cso_rast; 567bf215546Sopenharmony_ci struct crocus_depth_stencil_alpha_state *cso_zsa; 568bf215546Sopenharmony_ci struct crocus_vertex_element_state *cso_vertex_elements; 569bf215546Sopenharmony_ci struct pipe_blend_color blend_color; 570bf215546Sopenharmony_ci struct pipe_poly_stipple poly_stipple; 571bf215546Sopenharmony_ci struct pipe_viewport_state viewports[CROCUS_MAX_VIEWPORTS]; 572bf215546Sopenharmony_ci struct pipe_scissor_state scissors[CROCUS_MAX_VIEWPORTS]; 573bf215546Sopenharmony_ci struct pipe_stencil_ref stencil_ref; 574bf215546Sopenharmony_ci struct pipe_framebuffer_state framebuffer; 575bf215546Sopenharmony_ci struct pipe_clip_state clip_planes; 576bf215546Sopenharmony_ci 577bf215546Sopenharmony_ci float default_outer_level[4]; 578bf215546Sopenharmony_ci float default_inner_level[2]; 579bf215546Sopenharmony_ci 580bf215546Sopenharmony_ci /** Bitfield of which vertex buffers are bound (non-null). */ 581bf215546Sopenharmony_ci uint32_t bound_vertex_buffers; 582bf215546Sopenharmony_ci struct pipe_vertex_buffer vertex_buffers[16]; 583bf215546Sopenharmony_ci uint32_t vb_end[16]; 584bf215546Sopenharmony_ci 585bf215546Sopenharmony_ci bool primitive_restart; 586bf215546Sopenharmony_ci unsigned cut_index; 587bf215546Sopenharmony_ci enum pipe_prim_type reduced_prim_mode:8; 588bf215546Sopenharmony_ci enum pipe_prim_type prim_mode:8; 589bf215546Sopenharmony_ci bool prim_is_points_or_lines; 590bf215546Sopenharmony_ci uint8_t vertices_per_patch; 591bf215546Sopenharmony_ci uint8_t patch_vertices; 592bf215546Sopenharmony_ci 593bf215546Sopenharmony_ci bool window_space_position; 594bf215546Sopenharmony_ci 595bf215546Sopenharmony_ci /** The last compute group size */ 596bf215546Sopenharmony_ci uint32_t last_block[3]; 597bf215546Sopenharmony_ci 598bf215546Sopenharmony_ci /** The last compute grid size */ 599bf215546Sopenharmony_ci uint32_t last_grid[3]; 600bf215546Sopenharmony_ci /** Reference to the BO containing the compute grid size */ 601bf215546Sopenharmony_ci struct crocus_state_ref grid_size; 602bf215546Sopenharmony_ci 603bf215546Sopenharmony_ci /** 604bf215546Sopenharmony_ci * Array of aux usages for drawing, altered to account for any 605bf215546Sopenharmony_ci * self-dependencies from resources bound for sampling and rendering. 606bf215546Sopenharmony_ci */ 607bf215546Sopenharmony_ci enum isl_aux_usage draw_aux_usage[BRW_MAX_DRAW_BUFFERS]; 608bf215546Sopenharmony_ci 609bf215546Sopenharmony_ci /** Aux usage of the fb's depth buffer (which may or may not exist). */ 610bf215546Sopenharmony_ci enum isl_aux_usage hiz_usage; 611bf215546Sopenharmony_ci 612bf215546Sopenharmony_ci /** Bitfield of whether color blending is enabled for RT[i] */ 613bf215546Sopenharmony_ci uint8_t blend_enables; 614bf215546Sopenharmony_ci 615bf215546Sopenharmony_ci /** Are depth writes enabled? (Depth buffer may or may not exist.) */ 616bf215546Sopenharmony_ci bool depth_writes_enabled; 617bf215546Sopenharmony_ci 618bf215546Sopenharmony_ci /** Are stencil writes enabled? (Stencil buffer may or may not exist.) */ 619bf215546Sopenharmony_ci bool stencil_writes_enabled; 620bf215546Sopenharmony_ci 621bf215546Sopenharmony_ci /** GenX-specific current state */ 622bf215546Sopenharmony_ci struct crocus_genx_state *genx; 623bf215546Sopenharmony_ci 624bf215546Sopenharmony_ci struct crocus_shader_state shaders[MESA_SHADER_STAGES]; 625bf215546Sopenharmony_ci 626bf215546Sopenharmony_ci /* track if geom shader is active for IVB GT2 workaround */ 627bf215546Sopenharmony_ci bool gs_enabled; 628bf215546Sopenharmony_ci /** Do vertex shader uses shader draw parameters ? */ 629bf215546Sopenharmony_ci bool vs_uses_draw_params; 630bf215546Sopenharmony_ci bool vs_uses_derived_draw_params; 631bf215546Sopenharmony_ci bool vs_needs_sgvs_element; 632bf215546Sopenharmony_ci bool vs_uses_vertexid; 633bf215546Sopenharmony_ci bool vs_uses_instanceid; 634bf215546Sopenharmony_ci 635bf215546Sopenharmony_ci /** Do vertex shader uses edge flag ? */ 636bf215546Sopenharmony_ci bool vs_needs_edge_flag; 637bf215546Sopenharmony_ci 638bf215546Sopenharmony_ci struct pipe_stream_output_target *so_target[PIPE_MAX_SO_BUFFERS]; 639bf215546Sopenharmony_ci bool streamout_active; 640bf215546Sopenharmony_ci int so_targets; 641bf215546Sopenharmony_ci 642bf215546Sopenharmony_ci bool statistics_counters_enabled; 643bf215546Sopenharmony_ci 644bf215546Sopenharmony_ci /** Current conditional rendering mode */ 645bf215546Sopenharmony_ci enum crocus_predicate_state predicate; 646bf215546Sopenharmony_ci bool predicate_supported; 647bf215546Sopenharmony_ci 648bf215546Sopenharmony_ci /** 649bf215546Sopenharmony_ci * Query BO with a MI_PREDICATE_RESULT snapshot calculated on the 650bf215546Sopenharmony_ci * render context that needs to be uploaded to the compute context. 651bf215546Sopenharmony_ci */ 652bf215546Sopenharmony_ci struct crocus_bo *compute_predicate; 653bf215546Sopenharmony_ci 654bf215546Sopenharmony_ci /** Is a PIPE_QUERY_PRIMITIVES_GENERATED query active? */ 655bf215546Sopenharmony_ci bool prims_generated_query_active; 656bf215546Sopenharmony_ci 657bf215546Sopenharmony_ci /** 3DSTATE_STREAMOUT and 3DSTATE_SO_DECL_LIST packets */ 658bf215546Sopenharmony_ci uint32_t *streamout; 659bf215546Sopenharmony_ci 660bf215546Sopenharmony_ci /** 661bf215546Sopenharmony_ci * Resources containing streamed state which our render context 662bf215546Sopenharmony_ci * currently points to. Used to re-add these to the validation 663bf215546Sopenharmony_ci * list when we start a new batch and haven't resubmitted commands. 664bf215546Sopenharmony_ci */ 665bf215546Sopenharmony_ci struct { 666bf215546Sopenharmony_ci struct pipe_resource *res; 667bf215546Sopenharmony_ci uint32_t offset; 668bf215546Sopenharmony_ci uint32_t size; 669bf215546Sopenharmony_ci uint32_t index_size; 670bf215546Sopenharmony_ci bool prim_restart; 671bf215546Sopenharmony_ci } index_buffer; 672bf215546Sopenharmony_ci 673bf215546Sopenharmony_ci uint32_t sf_vp_address; 674bf215546Sopenharmony_ci uint32_t clip_vp_address; 675bf215546Sopenharmony_ci uint32_t cc_vp_address; 676bf215546Sopenharmony_ci 677bf215546Sopenharmony_ci uint32_t stats_wm; 678bf215546Sopenharmony_ci float global_depth_offset_clamp; 679bf215546Sopenharmony_ci 680bf215546Sopenharmony_ci uint32_t last_xfb_verts_per_prim; 681bf215546Sopenharmony_ci uint64_t svbi; 682bf215546Sopenharmony_ci } state; 683bf215546Sopenharmony_ci 684bf215546Sopenharmony_ci /* BRW_NEW_URB_ALLOCATIONS: 685bf215546Sopenharmony_ci */ 686bf215546Sopenharmony_ci struct { 687bf215546Sopenharmony_ci uint32_t vsize; /* vertex size plus header in urb registers */ 688bf215546Sopenharmony_ci uint32_t gsize; /* GS output size in urb registers */ 689bf215546Sopenharmony_ci uint32_t hsize; /* Tessellation control output size in urb registers */ 690bf215546Sopenharmony_ci uint32_t dsize; /* Tessellation evaluation output size in urb registers */ 691bf215546Sopenharmony_ci uint32_t csize; /* constant buffer size in urb registers */ 692bf215546Sopenharmony_ci uint32_t sfsize; /* setup data size in urb registers */ 693bf215546Sopenharmony_ci 694bf215546Sopenharmony_ci bool constrained; 695bf215546Sopenharmony_ci 696bf215546Sopenharmony_ci uint32_t nr_vs_entries; 697bf215546Sopenharmony_ci uint32_t nr_hs_entries; 698bf215546Sopenharmony_ci uint32_t nr_ds_entries; 699bf215546Sopenharmony_ci uint32_t nr_gs_entries; 700bf215546Sopenharmony_ci uint32_t nr_clip_entries; 701bf215546Sopenharmony_ci uint32_t nr_sf_entries; 702bf215546Sopenharmony_ci uint32_t nr_cs_entries; 703bf215546Sopenharmony_ci 704bf215546Sopenharmony_ci uint32_t vs_start; 705bf215546Sopenharmony_ci uint32_t hs_start; 706bf215546Sopenharmony_ci uint32_t ds_start; 707bf215546Sopenharmony_ci uint32_t gs_start; 708bf215546Sopenharmony_ci uint32_t clip_start; 709bf215546Sopenharmony_ci uint32_t sf_start; 710bf215546Sopenharmony_ci uint32_t cs_start; 711bf215546Sopenharmony_ci /** 712bf215546Sopenharmony_ci * URB size in the current configuration. The units this is expressed 713bf215546Sopenharmony_ci * in are somewhat inconsistent, see intel_device_info::urb::size. 714bf215546Sopenharmony_ci * 715bf215546Sopenharmony_ci * FINISHME: Represent the URB size consistently in KB on all platforms. 716bf215546Sopenharmony_ci */ 717bf215546Sopenharmony_ci uint32_t size; 718bf215546Sopenharmony_ci 719bf215546Sopenharmony_ci /* True if the most recently sent _3DSTATE_URB message allocated 720bf215546Sopenharmony_ci * URB space for the GS. 721bf215546Sopenharmony_ci */ 722bf215546Sopenharmony_ci bool gs_present; 723bf215546Sopenharmony_ci 724bf215546Sopenharmony_ci /* True if the most recently sent _3DSTATE_URB message allocated 725bf215546Sopenharmony_ci * URB space for the HS and DS. 726bf215546Sopenharmony_ci */ 727bf215546Sopenharmony_ci bool tess_present; 728bf215546Sopenharmony_ci } urb; 729bf215546Sopenharmony_ci 730bf215546Sopenharmony_ci /* GEN4/5 curbe */ 731bf215546Sopenharmony_ci struct { 732bf215546Sopenharmony_ci unsigned wm_start; 733bf215546Sopenharmony_ci unsigned wm_size; 734bf215546Sopenharmony_ci unsigned clip_start; 735bf215546Sopenharmony_ci unsigned clip_size; 736bf215546Sopenharmony_ci unsigned vs_start; 737bf215546Sopenharmony_ci unsigned vs_size; 738bf215546Sopenharmony_ci unsigned total_size; 739bf215546Sopenharmony_ci 740bf215546Sopenharmony_ci struct crocus_resource *curbe_res; 741bf215546Sopenharmony_ci unsigned curbe_offset; 742bf215546Sopenharmony_ci } curbe; 743bf215546Sopenharmony_ci 744bf215546Sopenharmony_ci /** 745bf215546Sopenharmony_ci * A buffer containing a marker + description of the driver. This buffer is 746bf215546Sopenharmony_ci * added to all execbufs syscalls so that we can identify the driver that 747bf215546Sopenharmony_ci * generated a hang by looking at the content of the buffer in the error 748bf215546Sopenharmony_ci * state. It is also used for hardware workarounds that require scratch 749bf215546Sopenharmony_ci * writes or reads from some unimportant memory. To avoid overriding the 750bf215546Sopenharmony_ci * debug data, use the workaround_address field for workarounds. 751bf215546Sopenharmony_ci */ 752bf215546Sopenharmony_ci struct crocus_bo *workaround_bo; 753bf215546Sopenharmony_ci unsigned workaround_offset; 754bf215546Sopenharmony_ci}; 755bf215546Sopenharmony_ci 756bf215546Sopenharmony_ci#define perf_debug(dbg, ...) do { \ 757bf215546Sopenharmony_ci if (INTEL_DEBUG(DEBUG_PERF)) \ 758bf215546Sopenharmony_ci dbg_printf(__VA_ARGS__); \ 759bf215546Sopenharmony_ci if (unlikely(dbg)) \ 760bf215546Sopenharmony_ci util_debug_message(dbg, PERF_INFO, __VA_ARGS__); \ 761bf215546Sopenharmony_ci} while(0) 762bf215546Sopenharmony_ci 763bf215546Sopenharmony_ci 764bf215546Sopenharmony_cistruct pipe_context * 765bf215546Sopenharmony_cicrocus_create_context(struct pipe_screen *screen, void *priv, unsigned flags); 766bf215546Sopenharmony_ci 767bf215546Sopenharmony_civoid crocus_lost_context_state(struct crocus_batch *batch); 768bf215546Sopenharmony_ci 769bf215546Sopenharmony_civoid crocus_init_blit_functions(struct pipe_context *ctx); 770bf215546Sopenharmony_civoid crocus_init_clear_functions(struct pipe_context *ctx); 771bf215546Sopenharmony_civoid crocus_init_program_functions(struct pipe_context *ctx); 772bf215546Sopenharmony_civoid crocus_init_resource_functions(struct pipe_context *ctx); 773bf215546Sopenharmony_cibool crocus_update_compiled_shaders(struct crocus_context *ice); 774bf215546Sopenharmony_civoid crocus_update_compiled_compute_shader(struct crocus_context *ice); 775bf215546Sopenharmony_civoid crocus_fill_cs_push_const_buffer(struct brw_cs_prog_data *cs_prog_data, 776bf215546Sopenharmony_ci unsigned threads, uint32_t *dst); 777bf215546Sopenharmony_ci 778bf215546Sopenharmony_ci 779bf215546Sopenharmony_ci/* crocus_blit.c */ 780bf215546Sopenharmony_cienum crocus_blitter_op 781bf215546Sopenharmony_ci{ 782bf215546Sopenharmony_ci CROCUS_SAVE_TEXTURES = 1, 783bf215546Sopenharmony_ci CROCUS_SAVE_FRAMEBUFFER = 2, 784bf215546Sopenharmony_ci CROCUS_SAVE_FRAGMENT_STATE = 4, 785bf215546Sopenharmony_ci CROCUS_DISABLE_RENDER_COND = 8, 786bf215546Sopenharmony_ci}; 787bf215546Sopenharmony_civoid crocus_blitter_begin(struct crocus_context *ice, enum crocus_blitter_op op, bool render_cond); 788bf215546Sopenharmony_ci 789bf215546Sopenharmony_civoid crocus_blorp_surf_for_resource(struct crocus_vtable *vtbl, 790bf215546Sopenharmony_ci struct isl_device *isl_dev, 791bf215546Sopenharmony_ci struct blorp_surf *surf, 792bf215546Sopenharmony_ci struct pipe_resource *p_res, 793bf215546Sopenharmony_ci enum isl_aux_usage aux_usage, 794bf215546Sopenharmony_ci unsigned level, 795bf215546Sopenharmony_ci bool is_render_target); 796bf215546Sopenharmony_civoid crocus_copy_region(struct blorp_context *blorp, 797bf215546Sopenharmony_ci struct crocus_batch *batch, 798bf215546Sopenharmony_ci struct pipe_resource *dst, 799bf215546Sopenharmony_ci unsigned dst_level, 800bf215546Sopenharmony_ci unsigned dstx, unsigned dsty, unsigned dstz, 801bf215546Sopenharmony_ci struct pipe_resource *src, 802bf215546Sopenharmony_ci unsigned src_level, 803bf215546Sopenharmony_ci const struct pipe_box *src_box); 804bf215546Sopenharmony_ci 805bf215546Sopenharmony_ci/* crocus_draw.c */ 806bf215546Sopenharmony_civoid crocus_draw_vbo(struct pipe_context *ctx, 807bf215546Sopenharmony_ci const struct pipe_draw_info *info, 808bf215546Sopenharmony_ci unsigned drawid_offset, 809bf215546Sopenharmony_ci const struct pipe_draw_indirect_info *indirect, 810bf215546Sopenharmony_ci const struct pipe_draw_start_count_bias *draws, 811bf215546Sopenharmony_ci unsigned num_draws); 812bf215546Sopenharmony_civoid crocus_launch_grid(struct pipe_context *, const struct pipe_grid_info *); 813bf215546Sopenharmony_ci 814bf215546Sopenharmony_ci/* crocus_pipe_control.c */ 815bf215546Sopenharmony_ci 816bf215546Sopenharmony_civoid crocus_emit_pipe_control_flush(struct crocus_batch *batch, 817bf215546Sopenharmony_ci const char *reason, uint32_t flags); 818bf215546Sopenharmony_civoid crocus_emit_pipe_control_write(struct crocus_batch *batch, 819bf215546Sopenharmony_ci const char *reason, uint32_t flags, 820bf215546Sopenharmony_ci struct crocus_bo *bo, uint32_t offset, 821bf215546Sopenharmony_ci uint64_t imm); 822bf215546Sopenharmony_civoid crocus_emit_mi_flush(struct crocus_batch *batch); 823bf215546Sopenharmony_civoid crocus_emit_depth_stall_flushes(struct crocus_batch *batch); 824bf215546Sopenharmony_civoid crocus_emit_post_sync_nonzero_flush(struct crocus_batch *batch); 825bf215546Sopenharmony_civoid crocus_emit_end_of_pipe_sync(struct crocus_batch *batch, 826bf215546Sopenharmony_ci const char *reason, uint32_t flags); 827bf215546Sopenharmony_civoid crocus_flush_all_caches(struct crocus_batch *batch); 828bf215546Sopenharmony_ci 829bf215546Sopenharmony_ci#define crocus_handle_always_flush_cache(batch) \ 830bf215546Sopenharmony_ci if (unlikely(batch->screen->driconf.always_flush_cache)) \ 831bf215546Sopenharmony_ci crocus_flush_all_caches(batch); 832bf215546Sopenharmony_ci 833bf215546Sopenharmony_civoid crocus_init_flush_functions(struct pipe_context *ctx); 834bf215546Sopenharmony_ci 835bf215546Sopenharmony_ci/* crocus_program.c */ 836bf215546Sopenharmony_ciconst struct shader_info *crocus_get_shader_info(const struct crocus_context *ice, 837bf215546Sopenharmony_ci gl_shader_stage stage); 838bf215546Sopenharmony_cistruct crocus_bo *crocus_get_scratch_space(struct crocus_context *ice, 839bf215546Sopenharmony_ci unsigned per_thread_scratch, 840bf215546Sopenharmony_ci gl_shader_stage stage); 841bf215546Sopenharmony_ci/** 842bf215546Sopenharmony_ci * Map a <group, index> pair to a binding table index. 843bf215546Sopenharmony_ci * 844bf215546Sopenharmony_ci * For example: <UBO, 5> => binding table index 12 845bf215546Sopenharmony_ci */ 846bf215546Sopenharmony_cistatic inline uint32_t crocus_group_index_to_bti(const struct crocus_binding_table *bt, 847bf215546Sopenharmony_ci enum crocus_surface_group group, 848bf215546Sopenharmony_ci uint32_t index) 849bf215546Sopenharmony_ci{ 850bf215546Sopenharmony_ci assert(index < bt->sizes[group]); 851bf215546Sopenharmony_ci uint64_t mask = bt->used_mask[group]; 852bf215546Sopenharmony_ci uint64_t bit = 1ull << index; 853bf215546Sopenharmony_ci if (bit & mask) { 854bf215546Sopenharmony_ci return bt->offsets[group] + util_bitcount64((bit - 1) & mask); 855bf215546Sopenharmony_ci } else { 856bf215546Sopenharmony_ci return CROCUS_SURFACE_NOT_USED; 857bf215546Sopenharmony_ci } 858bf215546Sopenharmony_ci} 859bf215546Sopenharmony_ci 860bf215546Sopenharmony_ci/** 861bf215546Sopenharmony_ci * Map a binding table index back to a <group, index> pair. 862bf215546Sopenharmony_ci * 863bf215546Sopenharmony_ci * For example: binding table index 12 => <UBO, 5> 864bf215546Sopenharmony_ci */ 865bf215546Sopenharmony_cistatic inline uint32_t 866bf215546Sopenharmony_cicrocus_bti_to_group_index(const struct crocus_binding_table *bt, 867bf215546Sopenharmony_ci enum crocus_surface_group group, uint32_t bti) 868bf215546Sopenharmony_ci{ 869bf215546Sopenharmony_ci uint64_t used_mask = bt->used_mask[group]; 870bf215546Sopenharmony_ci assert(bti >= bt->offsets[group]); 871bf215546Sopenharmony_ci 872bf215546Sopenharmony_ci uint32_t c = bti - bt->offsets[group]; 873bf215546Sopenharmony_ci while (used_mask) { 874bf215546Sopenharmony_ci int i = u_bit_scan64(&used_mask); 875bf215546Sopenharmony_ci if (c == 0) 876bf215546Sopenharmony_ci return i; 877bf215546Sopenharmony_ci c--; 878bf215546Sopenharmony_ci } 879bf215546Sopenharmony_ci 880bf215546Sopenharmony_ci return CROCUS_SURFACE_NOT_USED; 881bf215546Sopenharmony_ci} 882bf215546Sopenharmony_ci 883bf215546Sopenharmony_ci 884bf215546Sopenharmony_ci/* crocus_disk_cache.c */ 885bf215546Sopenharmony_ci 886bf215546Sopenharmony_civoid crocus_disk_cache_store(struct disk_cache *cache, 887bf215546Sopenharmony_ci const struct crocus_uncompiled_shader *ish, 888bf215546Sopenharmony_ci const struct crocus_compiled_shader *shader, 889bf215546Sopenharmony_ci void *map, 890bf215546Sopenharmony_ci const void *prog_key, 891bf215546Sopenharmony_ci uint32_t prog_key_size); 892bf215546Sopenharmony_cistruct crocus_compiled_shader * 893bf215546Sopenharmony_cicrocus_disk_cache_retrieve(struct crocus_context *ice, 894bf215546Sopenharmony_ci const struct crocus_uncompiled_shader *ish, 895bf215546Sopenharmony_ci const void *prog_key, 896bf215546Sopenharmony_ci uint32_t prog_key_size); 897bf215546Sopenharmony_ci 898bf215546Sopenharmony_ci/* crocus_program_cache.c */ 899bf215546Sopenharmony_ci 900bf215546Sopenharmony_civoid crocus_init_program_cache(struct crocus_context *ice); 901bf215546Sopenharmony_civoid crocus_destroy_program_cache(struct crocus_context *ice); 902bf215546Sopenharmony_civoid crocus_print_program_cache(struct crocus_context *ice); 903bf215546Sopenharmony_cistruct crocus_compiled_shader *crocus_find_cached_shader(struct crocus_context *ice, 904bf215546Sopenharmony_ci enum crocus_program_cache_id, 905bf215546Sopenharmony_ci uint32_t key_size, 906bf215546Sopenharmony_ci const void *key); 907bf215546Sopenharmony_cistruct crocus_compiled_shader *crocus_upload_shader(struct crocus_context *ice, 908bf215546Sopenharmony_ci enum crocus_program_cache_id, 909bf215546Sopenharmony_ci uint32_t key_size, 910bf215546Sopenharmony_ci const void *key, 911bf215546Sopenharmony_ci const void *assembly, 912bf215546Sopenharmony_ci uint32_t asm_size, 913bf215546Sopenharmony_ci struct brw_stage_prog_data *, 914bf215546Sopenharmony_ci uint32_t prog_data_size, 915bf215546Sopenharmony_ci uint32_t *streamout, 916bf215546Sopenharmony_ci enum brw_param_builtin *sysv, 917bf215546Sopenharmony_ci unsigned num_system_values, 918bf215546Sopenharmony_ci unsigned num_cbufs, 919bf215546Sopenharmony_ci const struct crocus_binding_table *bt); 920bf215546Sopenharmony_ciconst void *crocus_find_previous_compile(const struct crocus_context *ice, 921bf215546Sopenharmony_ci enum crocus_program_cache_id cache_id, 922bf215546Sopenharmony_ci unsigned program_string_id); 923bf215546Sopenharmony_cibool crocus_blorp_lookup_shader(struct blorp_batch *blorp_batch, 924bf215546Sopenharmony_ci const void *key, 925bf215546Sopenharmony_ci uint32_t key_size, 926bf215546Sopenharmony_ci uint32_t *kernel_out, 927bf215546Sopenharmony_ci void *prog_data_out); 928bf215546Sopenharmony_cibool crocus_blorp_upload_shader(struct blorp_batch *blorp_batch, 929bf215546Sopenharmony_ci uint32_t stage, 930bf215546Sopenharmony_ci const void *key, uint32_t key_size, 931bf215546Sopenharmony_ci const void *kernel, uint32_t kernel_size, 932bf215546Sopenharmony_ci const struct brw_stage_prog_data *prog_data, 933bf215546Sopenharmony_ci uint32_t prog_data_size, 934bf215546Sopenharmony_ci uint32_t *kernel_out, 935bf215546Sopenharmony_ci void *prog_data_out); 936bf215546Sopenharmony_ci 937bf215546Sopenharmony_ci/* crocus_resolve.c */ 938bf215546Sopenharmony_ci 939bf215546Sopenharmony_civoid crocus_predraw_resolve_inputs(struct crocus_context *ice, 940bf215546Sopenharmony_ci struct crocus_batch *batch, 941bf215546Sopenharmony_ci bool *draw_aux_buffer_disabled, 942bf215546Sopenharmony_ci gl_shader_stage stage, 943bf215546Sopenharmony_ci bool consider_framebuffer); 944bf215546Sopenharmony_civoid crocus_predraw_resolve_framebuffer(struct crocus_context *ice, 945bf215546Sopenharmony_ci struct crocus_batch *batch, 946bf215546Sopenharmony_ci bool *draw_aux_buffer_disabled); 947bf215546Sopenharmony_civoid crocus_postdraw_update_resolve_tracking(struct crocus_context *ice, 948bf215546Sopenharmony_ci struct crocus_batch *batch); 949bf215546Sopenharmony_civoid crocus_cache_sets_clear(struct crocus_batch *batch); 950bf215546Sopenharmony_civoid crocus_flush_depth_and_render_caches(struct crocus_batch *batch); 951bf215546Sopenharmony_civoid crocus_cache_flush_for_read(struct crocus_batch *batch, struct crocus_bo *bo); 952bf215546Sopenharmony_civoid crocus_cache_flush_for_render(struct crocus_batch *batch, 953bf215546Sopenharmony_ci struct crocus_bo *bo, 954bf215546Sopenharmony_ci enum isl_format format, 955bf215546Sopenharmony_ci enum isl_aux_usage aux_usage); 956bf215546Sopenharmony_civoid crocus_render_cache_add_bo(struct crocus_batch *batch, 957bf215546Sopenharmony_ci struct crocus_bo *bo, 958bf215546Sopenharmony_ci enum isl_format format, 959bf215546Sopenharmony_ci enum isl_aux_usage aux_usage); 960bf215546Sopenharmony_civoid crocus_cache_flush_for_depth(struct crocus_batch *batch, struct crocus_bo *bo); 961bf215546Sopenharmony_civoid crocus_depth_cache_add_bo(struct crocus_batch *batch, struct crocus_bo *bo); 962bf215546Sopenharmony_ciint crocus_get_driver_query_info(struct pipe_screen *pscreen, unsigned index, 963bf215546Sopenharmony_ci struct pipe_driver_query_info *info); 964bf215546Sopenharmony_ciint crocus_get_driver_query_group_info(struct pipe_screen *pscreen, 965bf215546Sopenharmony_ci unsigned index, 966bf215546Sopenharmony_ci struct pipe_driver_query_group_info *info); 967bf215546Sopenharmony_ci 968bf215546Sopenharmony_cistruct pipe_rasterizer_state *crocus_get_rast_state(struct crocus_context *ctx); 969bf215546Sopenharmony_ci 970bf215546Sopenharmony_cibool crocus_sw_check_cond_render(struct crocus_context *ice); 971bf215546Sopenharmony_cistatic inline bool crocus_check_conditional_render(struct crocus_context *ice) 972bf215546Sopenharmony_ci{ 973bf215546Sopenharmony_ci if (ice->state.predicate == CROCUS_PREDICATE_STATE_STALL_FOR_QUERY) 974bf215546Sopenharmony_ci return crocus_sw_check_cond_render(ice); 975bf215546Sopenharmony_ci return ice->state.predicate != CROCUS_PREDICATE_STATE_DONT_RENDER; 976bf215546Sopenharmony_ci} 977bf215546Sopenharmony_ci 978bf215546Sopenharmony_ci#ifdef genX 979bf215546Sopenharmony_ci# include "crocus_genx_protos.h" 980bf215546Sopenharmony_ci#else 981bf215546Sopenharmony_ci# define genX(x) gfx4_##x 982bf215546Sopenharmony_ci# include "crocus_genx_protos.h" 983bf215546Sopenharmony_ci# undef genX 984bf215546Sopenharmony_ci# define genX(x) gfx45_##x 985bf215546Sopenharmony_ci# include "crocus_genx_protos.h" 986bf215546Sopenharmony_ci# undef genX 987bf215546Sopenharmony_ci# define genX(x) gfx5_##x 988bf215546Sopenharmony_ci# include "crocus_genx_protos.h" 989bf215546Sopenharmony_ci# undef genX 990bf215546Sopenharmony_ci# define genX(x) gfx6_##x 991bf215546Sopenharmony_ci# include "crocus_genx_protos.h" 992bf215546Sopenharmony_ci# undef genX 993bf215546Sopenharmony_ci# define genX(x) gfx7_##x 994bf215546Sopenharmony_ci# include "crocus_genx_protos.h" 995bf215546Sopenharmony_ci# undef genX 996bf215546Sopenharmony_ci# define genX(x) gfx75_##x 997bf215546Sopenharmony_ci# include "crocus_genx_protos.h" 998bf215546Sopenharmony_ci# undef genX 999bf215546Sopenharmony_ci# define genX(x) gfx8_##x 1000bf215546Sopenharmony_ci# include "crocus_genx_protos.h" 1001bf215546Sopenharmony_ci# undef genX 1002bf215546Sopenharmony_ci#endif 1003bf215546Sopenharmony_ci 1004bf215546Sopenharmony_ci#endif 1005