Dave Airlie | 81b741a | 2015-10-21 14:15:50 +1000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014, 2015 Red Hat. |
Dave Airlie | 3263d93 | 2015-04-20 11:02:39 +1000 | [diff] [blame] | 3 | * |
| 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 5 | * copy of this software and associated documentation files (the "Software"), |
| 6 | * to deal in the Software without restriction, including without limitation |
Dave Airlie | 81b741a | 2015-10-21 14:15:50 +1000 | [diff] [blame] | 7 | * on the rights to use, copy, modify, merge, publish, distribute, sub |
| 8 | * license, and/or sell copies of the Software, and to permit persons to whom |
| 9 | * the Software is furnished to do so, subject to the following conditions: |
Dave Airlie | 3263d93 | 2015-04-20 11:02:39 +1000 | [diff] [blame] | 10 | * |
Dave Airlie | 81b741a | 2015-10-21 14:15:50 +1000 | [diff] [blame] | 11 | * The above copyright notice and this permission notice (including the next |
| 12 | * paragraph) shall be included in all copies or substantial portions of the |
| 13 | * Software. |
Dave Airlie | 3263d93 | 2015-04-20 11:02:39 +1000 | [diff] [blame] | 14 | * |
Dave Airlie | 81b741a | 2015-10-21 14:15:50 +1000 | [diff] [blame] | 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 16 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 17 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL |
| 18 | * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, |
| 19 | * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR |
| 20 | * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE |
| 21 | * USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 22 | */ |
Dave Airlie | 03e3116 | 2015-02-03 13:11:42 +1000 | [diff] [blame] | 23 | #ifndef VIRGL_PROTOCOL_H |
| 24 | #define VIRGL_PROTOCOL_H |
Dave Airlie | a3a2c64 | 2014-03-31 14:07:58 +1000 | [diff] [blame] | 25 | |
| 26 | #define VIRGL_QUERY_STATE_NEW 0 |
| 27 | #define VIRGL_QUERY_STATE_DONE 1 |
| 28 | #define VIRGL_QUERY_STATE_WAIT_HOST 2 |
| 29 | |
| 30 | struct virgl_host_query_state { |
| 31 | uint32_t query_state; |
| 32 | uint32_t result_size; |
| 33 | uint64_t result; |
| 34 | }; |
| 35 | |
| 36 | enum virgl_object_type { |
| 37 | VIRGL_OBJECT_NULL, |
| 38 | VIRGL_OBJECT_BLEND, |
| 39 | VIRGL_OBJECT_RASTERIZER, |
| 40 | VIRGL_OBJECT_DSA, |
Dave Airlie | 81b741a | 2015-10-21 14:15:50 +1000 | [diff] [blame] | 41 | VIRGL_OBJECT_SHADER, |
Dave Airlie | a3a2c64 | 2014-03-31 14:07:58 +1000 | [diff] [blame] | 42 | VIRGL_OBJECT_VERTEX_ELEMENTS, |
| 43 | VIRGL_OBJECT_SAMPLER_VIEW, |
| 44 | VIRGL_OBJECT_SAMPLER_STATE, |
| 45 | VIRGL_OBJECT_SURFACE, |
| 46 | VIRGL_OBJECT_QUERY, |
| 47 | VIRGL_OBJECT_STREAMOUT_TARGET, |
| 48 | VIRGL_MAX_OBJECTS, |
| 49 | }; |
| 50 | |
| 51 | /* context cmds to be encoded in the command stream */ |
| 52 | enum virgl_context_cmd { |
| 53 | VIRGL_CCMD_NOP = 0, |
| 54 | VIRGL_CCMD_CREATE_OBJECT = 1, |
| 55 | VIRGL_CCMD_BIND_OBJECT, |
| 56 | VIRGL_CCMD_DESTROY_OBJECT, |
| 57 | VIRGL_CCMD_SET_VIEWPORT_STATE, |
| 58 | VIRGL_CCMD_SET_FRAMEBUFFER_STATE, |
| 59 | VIRGL_CCMD_SET_VERTEX_BUFFERS, |
| 60 | VIRGL_CCMD_CLEAR, |
| 61 | VIRGL_CCMD_DRAW_VBO, |
| 62 | VIRGL_CCMD_RESOURCE_INLINE_WRITE, |
| 63 | VIRGL_CCMD_SET_SAMPLER_VIEWS, |
| 64 | VIRGL_CCMD_SET_INDEX_BUFFER, |
| 65 | VIRGL_CCMD_SET_CONSTANT_BUFFER, |
| 66 | VIRGL_CCMD_SET_STENCIL_REF, |
| 67 | VIRGL_CCMD_SET_BLEND_COLOR, |
| 68 | VIRGL_CCMD_SET_SCISSOR_STATE, |
| 69 | VIRGL_CCMD_BLIT, |
| 70 | VIRGL_CCMD_RESOURCE_COPY_REGION, |
| 71 | VIRGL_CCMD_BIND_SAMPLER_STATES, |
| 72 | VIRGL_CCMD_BEGIN_QUERY, |
| 73 | VIRGL_CCMD_END_QUERY, |
| 74 | VIRGL_CCMD_GET_QUERY_RESULT, |
| 75 | VIRGL_CCMD_SET_POLYGON_STIPPLE, |
| 76 | VIRGL_CCMD_SET_CLIP_STATE, |
| 77 | VIRGL_CCMD_SET_SAMPLE_MASK, |
| 78 | VIRGL_CCMD_SET_STREAMOUT_TARGETS, |
Dave Airlie | a3a2c64 | 2014-03-31 14:07:58 +1000 | [diff] [blame] | 79 | VIRGL_CCMD_SET_RENDER_CONDITION, |
Dave Airlie | 03e3116 | 2015-02-03 13:11:42 +1000 | [diff] [blame] | 80 | VIRGL_CCMD_SET_UNIFORM_BUFFER, |
| 81 | |
| 82 | VIRGL_CCMD_SET_SUB_CTX, |
| 83 | VIRGL_CCMD_CREATE_SUB_CTX, |
| 84 | VIRGL_CCMD_DESTROY_SUB_CTX, |
Dave Airlie | 85602b3 | 2015-10-23 14:35:46 +1000 | [diff] [blame] | 85 | VIRGL_CCMD_BIND_SHADER, |
Dave Airlie | 0555483 | 2017-08-11 10:50:37 +1000 | [diff] [blame] | 86 | VIRGL_CCMD_SET_TESS_STATE, |
Erik Faye-Lund | d24ac12 | 2018-07-10 10:43:38 +0200 | [diff] [blame] | 87 | VIRGL_CCMD_SET_MIN_SAMPLES, |
Dave Airlie | 083d97f | 2018-07-17 17:44:43 +1000 | [diff] [blame] | 88 | VIRGL_CCMD_SET_SHADER_BUFFERS, |
Dave Airlie | 950de33 | 2018-07-20 08:41:30 +1000 | [diff] [blame] | 89 | VIRGL_CCMD_SET_SHADER_IMAGES, |
Dave Airlie | 8289e3f | 2018-07-18 13:11:39 +1000 | [diff] [blame] | 90 | VIRGL_CCMD_MEMORY_BARRIER, |
Dave Airlie | 38207b5 | 2018-07-30 15:22:51 +1000 | [diff] [blame] | 91 | VIRGL_CCMD_LAUNCH_GRID, |
Dave Airlie | b4965e2 | 2018-07-19 10:32:23 +1000 | [diff] [blame^] | 92 | VIRGL_CCMD_SET_FRAMEBUFFER_STATE_NO_ATTACH, |
Dave Airlie | a3a2c64 | 2014-03-31 14:07:58 +1000 | [diff] [blame] | 93 | }; |
| 94 | |
Dave Airlie | 7e85c2f | 2015-03-20 14:13:19 +1000 | [diff] [blame] | 95 | /* |
Dave Airlie | a3a2c64 | 2014-03-31 14:07:58 +1000 | [diff] [blame] | 96 | 8-bit cmd headers |
| 97 | 8-bit object type |
| 98 | 16-bit length |
| 99 | */ |
| 100 | |
| 101 | #define VIRGL_CMD0(cmd, obj, len) ((cmd) | ((obj) << 8) | ((len) << 16)) |
| 102 | |
Dave Airlie | 03e3116 | 2015-02-03 13:11:42 +1000 | [diff] [blame] | 103 | /* hw specification */ |
| 104 | #define VIRGL_MAX_COLOR_BUFS 8 |
| 105 | #define VIRGL_MAX_CLIP_PLANES 8 |
| 106 | |
| 107 | #define VIRGL_OBJ_CREATE_HEADER 0 |
| 108 | #define VIRGL_OBJ_CREATE_HANDLE 1 |
| 109 | |
| 110 | #define VIRGL_OBJ_BIND_HEADER 0 |
| 111 | #define VIRGL_OBJ_BIND_HANDLE 1 |
| 112 | |
| 113 | #define VIRGL_OBJ_DESTROY_HANDLE 1 |
| 114 | |
| 115 | /* some of these defines are a specification - not used in the code */ |
| 116 | /* bit offsets for blend state object */ |
| 117 | #define VIRGL_OBJ_BLEND_SIZE (VIRGL_MAX_COLOR_BUFS + 3) |
| 118 | #define VIRGL_OBJ_BLEND_HANDLE 1 |
| 119 | #define VIRGL_OBJ_BLEND_S0 2 |
| 120 | #define VIRGL_OBJ_BLEND_S0_INDEPENDENT_BLEND_ENABLE(x) ((x) & 0x1 << 0) |
| 121 | #define VIRGL_OBJ_BLEND_S0_LOGICOP_ENABLE(x) (((x) & 0x1) << 1) |
| 122 | #define VIRGL_OBJ_BLEND_S0_DITHER(x) (((x) & 0x1) << 2) |
| 123 | #define VIRGL_OBJ_BLEND_S0_ALPHA_TO_COVERAGE(x) (((x) & 0x1) << 3) |
| 124 | #define VIRGL_OBJ_BLEND_S0_ALPHA_TO_ONE(x) (((x) & 0x1) << 4) |
| 125 | #define VIRGL_OBJ_BLEND_S1 3 |
| 126 | #define VIRGL_OBJ_BLEND_S1_LOGICOP_FUNC(x) (((x) & 0xf) << 0) |
| 127 | /* repeated once per number of cbufs */ |
| 128 | |
| 129 | #define VIRGL_OBJ_BLEND_S2(cbuf) (4 + (cbuf)) |
| 130 | #define VIRGL_OBJ_BLEND_S2_RT_BLEND_ENABLE(x) (((x) & 0x1) << 0) |
| 131 | #define VIRGL_OBJ_BLEND_S2_RT_RGB_FUNC(x) (((x) & 0x7) << 1) |
| 132 | #define VIRGL_OBJ_BLEND_S2_RT_RGB_SRC_FACTOR(x) (((x) & 0x1f) << 4) |
| 133 | #define VIRGL_OBJ_BLEND_S2_RT_RGB_DST_FACTOR(x) (((x) & 0x1f) << 9) |
| 134 | #define VIRGL_OBJ_BLEND_S2_RT_ALPHA_FUNC(x) (((x) & 0x7) << 14) |
| 135 | #define VIRGL_OBJ_BLEND_S2_RT_ALPHA_SRC_FACTOR(x) (((x) & 0x1f) << 17) |
| 136 | #define VIRGL_OBJ_BLEND_S2_RT_ALPHA_DST_FACTOR(x) (((x) & 0x1f) << 22) |
| 137 | #define VIRGL_OBJ_BLEND_S2_RT_COLORMASK(x) (((x) & 0xf) << 27) |
| 138 | |
| 139 | /* bit offsets for DSA state */ |
| 140 | #define VIRGL_OBJ_DSA_SIZE 5 |
| 141 | #define VIRGL_OBJ_DSA_HANDLE 1 |
| 142 | #define VIRGL_OBJ_DSA_S0 2 |
| 143 | #define VIRGL_OBJ_DSA_S0_DEPTH_ENABLE(x) (((x) & 0x1) << 0) |
| 144 | #define VIRGL_OBJ_DSA_S0_DEPTH_WRITEMASK(x) (((x) & 0x1) << 1) |
| 145 | #define VIRGL_OBJ_DSA_S0_DEPTH_FUNC(x) (((x) & 0x7) << 2) |
| 146 | #define VIRGL_OBJ_DSA_S0_ALPHA_ENABLED(x) (((x) & 0x1) << 8) |
| 147 | #define VIRGL_OBJ_DSA_S0_ALPHA_FUNC(x) (((x) & 0x7) << 9) |
| 148 | #define VIRGL_OBJ_DSA_S1 3 |
| 149 | #define VIRGL_OBJ_DSA_S2 4 |
| 150 | #define VIRGL_OBJ_DSA_S1_STENCIL_ENABLED(x) (((x) & 0x1) << 0) |
| 151 | #define VIRGL_OBJ_DSA_S1_STENCIL_FUNC(x) (((x) & 0x7) << 1) |
| 152 | #define VIRGL_OBJ_DSA_S1_STENCIL_FAIL_OP(x) (((x) & 0x7) << 4) |
| 153 | #define VIRGL_OBJ_DSA_S1_STENCIL_ZPASS_OP(x) (((x) & 0x7) << 7) |
| 154 | #define VIRGL_OBJ_DSA_S1_STENCIL_ZFAIL_OP(x) (((x) & 0x7) << 10) |
| 155 | #define VIRGL_OBJ_DSA_S1_STENCIL_VALUEMASK(x) (((x) & 0xff) << 13) |
| 156 | #define VIRGL_OBJ_DSA_S1_STENCIL_WRITEMASK(x) (((x) & 0xff) << 21) |
| 157 | #define VIRGL_OBJ_DSA_ALPHA_REF 5 |
| 158 | |
| 159 | /* offsets for rasterizer state */ |
| 160 | #define VIRGL_OBJ_RS_SIZE 9 |
| 161 | #define VIRGL_OBJ_RS_HANDLE 1 |
| 162 | #define VIRGL_OBJ_RS_S0 2 |
| 163 | #define VIRGL_OBJ_RS_S0_FLATSHADE(x) (((x) & 0x1) << 0) |
| 164 | #define VIRGL_OBJ_RS_S0_DEPTH_CLIP(x) (((x) & 0x1) << 1) |
| 165 | #define VIRGL_OBJ_RS_S0_CLIP_HALFZ(x) (((x) & 0x1) << 2) |
| 166 | #define VIRGL_OBJ_RS_S0_RASTERIZER_DISCARD(x) (((x) & 0x1) << 3) |
| 167 | #define VIRGL_OBJ_RS_S0_FLATSHADE_FIRST(x) (((x) & 0x1) << 4) |
| 168 | #define VIRGL_OBJ_RS_S0_LIGHT_TWOSIZE(x) (((x) & 0x1) << 5) |
| 169 | #define VIRGL_OBJ_RS_S0_SPRITE_COORD_MODE(x) (((x) & 0x1) << 6) |
| 170 | #define VIRGL_OBJ_RS_S0_POINT_QUAD_RASTERIZATION(x) (((x) & 0x1) << 7) |
| 171 | #define VIRGL_OBJ_RS_S0_CULL_FACE(x) (((x) & 0x3) << 8) |
| 172 | #define VIRGL_OBJ_RS_S0_FILL_FRONT(x) (((x) & 0x3) << 10) |
| 173 | #define VIRGL_OBJ_RS_S0_FILL_BACK(x) (((x) & 0x3) << 12) |
| 174 | #define VIRGL_OBJ_RS_S0_SCISSOR(x) (((x) & 0x1) << 14) |
| 175 | #define VIRGL_OBJ_RS_S0_FRONT_CCW(x) (((x) & 0x1) << 15) |
| 176 | #define VIRGL_OBJ_RS_S0_CLAMP_VERTEX_COLOR(x) (((x) & 0x1) << 16) |
| 177 | #define VIRGL_OBJ_RS_S0_CLAMP_FRAGMENT_COLOR(x) (((x) & 0x1) << 17) |
| 178 | #define VIRGL_OBJ_RS_S0_OFFSET_LINE(x) (((x) & 0x1) << 18) |
| 179 | #define VIRGL_OBJ_RS_S0_OFFSET_POINT(x) (((x) & 0x1) << 19) |
| 180 | #define VIRGL_OBJ_RS_S0_OFFSET_TRI(x) (((x) & 0x1) << 20) |
| 181 | #define VIRGL_OBJ_RS_S0_POLY_SMOOTH(x) (((x) & 0x1) << 21) |
| 182 | #define VIRGL_OBJ_RS_S0_POLY_STIPPLE_ENABLE(x) (((x) & 0x1) << 22) |
| 183 | #define VIRGL_OBJ_RS_S0_POINT_SMOOTH(x) (((x) & 0x1) << 23) |
| 184 | #define VIRGL_OBJ_RS_S0_POINT_SIZE_PER_VERTEX(x) (((x) & 0x1) << 24) |
| 185 | #define VIRGL_OBJ_RS_S0_MULTISAMPLE(x) (((x) & 0x1) << 25) |
| 186 | #define VIRGL_OBJ_RS_S0_LINE_SMOOTH(x) (((x) & 0x1) << 26) |
| 187 | #define VIRGL_OBJ_RS_S0_LINE_STIPPLE_ENABLE(x) (((x) & 0x1) << 27) |
| 188 | #define VIRGL_OBJ_RS_S0_LINE_LAST_PIXEL(x) (((x) & 0x1) << 28) |
| 189 | #define VIRGL_OBJ_RS_S0_HALF_PIXEL_CENTER(x) (((x) & 0x1) << 29) |
| 190 | #define VIRGL_OBJ_RS_S0_BOTTOM_EDGE_RULE(x) (((x) & 0x1) << 30) |
Dave Airlie | 6f67669 | 2017-08-05 13:52:02 +1000 | [diff] [blame] | 191 | #define VIRGL_OBJ_RS_S0_FORCE_PERSAMPLE_INTERP(x) (((x) & 0x1) << 31) |
Dave Airlie | 03e3116 | 2015-02-03 13:11:42 +1000 | [diff] [blame] | 192 | |
| 193 | #define VIRGL_OBJ_RS_POINT_SIZE 3 |
| 194 | #define VIRGL_OBJ_RS_SPRITE_COORD_ENABLE 4 |
| 195 | #define VIRGL_OBJ_RS_S3 5 |
| 196 | |
| 197 | #define VIRGL_OBJ_RS_S3_LINE_STIPPLE_PATTERN(x) (((x) & 0xffff) << 0) |
| 198 | #define VIRGL_OBJ_RS_S3_LINE_STIPPLE_FACTOR(x) (((x) & 0xff) << 16) |
| 199 | #define VIRGL_OBJ_RS_S3_CLIP_PLANE_ENABLE(x) (((x) & 0xff) << 24) |
| 200 | #define VIRGL_OBJ_RS_LINE_WIDTH 6 |
| 201 | #define VIRGL_OBJ_RS_OFFSET_UNITS 7 |
| 202 | #define VIRGL_OBJ_RS_OFFSET_SCALE 8 |
| 203 | #define VIRGL_OBJ_RS_OFFSET_CLAMP 9 |
| 204 | |
| 205 | #define VIRGL_OBJ_CLEAR_SIZE 8 |
| 206 | #define VIRGL_OBJ_CLEAR_BUFFERS 1 |
| 207 | #define VIRGL_OBJ_CLEAR_COLOR_0 2 /* color is 4 * u32/f32/i32 */ |
| 208 | #define VIRGL_OBJ_CLEAR_COLOR_1 3 |
| 209 | #define VIRGL_OBJ_CLEAR_COLOR_2 4 |
| 210 | #define VIRGL_OBJ_CLEAR_COLOR_3 5 |
| 211 | #define VIRGL_OBJ_CLEAR_DEPTH_0 6 /* depth is a double precision float */ |
| 212 | #define VIRGL_OBJ_CLEAR_DEPTH_1 7 |
| 213 | #define VIRGL_OBJ_CLEAR_STENCIL 8 |
| 214 | |
| 215 | /* shader object */ |
Dave Airlie | 81b741a | 2015-10-21 14:15:50 +1000 | [diff] [blame] | 216 | #define VIRGL_OBJ_SHADER_HDR_SIZE(nso) (5 + ((nso) ? (2 * nso) + 4 : 0)) |
Dave Airlie | 03e3116 | 2015-02-03 13:11:42 +1000 | [diff] [blame] | 217 | #define VIRGL_OBJ_SHADER_HANDLE 1 |
Dave Airlie | 81b741a | 2015-10-21 14:15:50 +1000 | [diff] [blame] | 218 | #define VIRGL_OBJ_SHADER_TYPE 2 |
| 219 | #define VIRGL_OBJ_SHADER_OFFSET 3 |
| 220 | #define VIRGL_OBJ_SHADER_OFFSET_VAL(x) (((x) & 0x7fffffff) << 0) |
| 221 | /* start contains full length in VAL - also implies continuations */ |
| 222 | /* continuation contains offset in VAL */ |
| 223 | #define VIRGL_OBJ_SHADER_OFFSET_CONT (0x1 << 31) |
| 224 | #define VIRGL_OBJ_SHADER_NUM_TOKENS 4 |
| 225 | #define VIRGL_OBJ_SHADER_SO_NUM_OUTPUTS 5 |
| 226 | #define VIRGL_OBJ_SHADER_SO_STRIDE(x) (6 + (x)) |
| 227 | #define VIRGL_OBJ_SHADER_SO_OUTPUT0(x) (10 + (x * 2)) |
Dave Airlie | 03e3116 | 2015-02-03 13:11:42 +1000 | [diff] [blame] | 228 | #define VIRGL_OBJ_SHADER_SO_OUTPUT_REGISTER_INDEX(x) (((x) & 0xff) << 0) |
| 229 | #define VIRGL_OBJ_SHADER_SO_OUTPUT_START_COMPONENT(x) (((x) & 0x3) << 8) |
| 230 | #define VIRGL_OBJ_SHADER_SO_OUTPUT_NUM_COMPONENTS(x) (((x) & 0x7) << 10) |
Dave Airlie | ac97277 | 2015-03-11 17:09:03 +1000 | [diff] [blame] | 231 | #define VIRGL_OBJ_SHADER_SO_OUTPUT_BUFFER(x) (((x) & 0x7) << 13) |
Dave Airlie | 03e3116 | 2015-02-03 13:11:42 +1000 | [diff] [blame] | 232 | #define VIRGL_OBJ_SHADER_SO_OUTPUT_DST_OFFSET(x) (((x) & 0xffff) << 16) |
Dave Airlie | 81b741a | 2015-10-21 14:15:50 +1000 | [diff] [blame] | 233 | #define VIRGL_OBJ_SHADER_SO_OUTPUT0_SO(x) (11 + (x * 2)) |
| 234 | #define VIRGL_OBJ_SHADER_SO_OUTPUT_STREAM(x) (((x) & 0x03) << 0) |
Dave Airlie | 03e3116 | 2015-02-03 13:11:42 +1000 | [diff] [blame] | 235 | |
| 236 | /* viewport state */ |
Dave Airlie | 0ff22a0 | 2015-03-10 14:59:44 +1000 | [diff] [blame] | 237 | #define VIRGL_SET_VIEWPORT_STATE_SIZE(num_viewports) ((6 * num_viewports) + 1) |
| 238 | #define VIRGL_SET_VIEWPORT_START_SLOT 1 |
| 239 | #define VIRGL_SET_VIEWPORT_STATE_SCALE_0(x) (2 + (x * 6)) |
| 240 | #define VIRGL_SET_VIEWPORT_STATE_SCALE_1(x) (3 + (x * 6)) |
| 241 | #define VIRGL_SET_VIEWPORT_STATE_SCALE_2(x) (4 + (x * 6)) |
| 242 | #define VIRGL_SET_VIEWPORT_STATE_TRANSLATE_0(x) (5 + (x * 6)) |
| 243 | #define VIRGL_SET_VIEWPORT_STATE_TRANSLATE_1(x) (6 + (x * 6)) |
| 244 | #define VIRGL_SET_VIEWPORT_STATE_TRANSLATE_2(x) (7 + (x * 6)) |
Dave Airlie | 03e3116 | 2015-02-03 13:11:42 +1000 | [diff] [blame] | 245 | |
| 246 | /* framebuffer state */ |
| 247 | #define VIRGL_SET_FRAMEBUFFER_STATE_SIZE(nr_cbufs) (nr_cbufs + 2) |
| 248 | #define VIRGL_SET_FRAMEBUFFER_STATE_NR_CBUFS 1 |
| 249 | #define VIRGL_SET_FRAMEBUFFER_STATE_NR_ZSURF_HANDLE 2 |
| 250 | #define VIRGL_SET_FRAMEBUFFER_STATE_CBUF_HANDLE(x) ((x) + 3) |
| 251 | |
| 252 | /* vertex elements object */ |
| 253 | #define VIRGL_OBJ_VERTEX_ELEMENTS_SIZE(num_elements) (((num_elements) * 4) + 1) |
| 254 | #define VIRGL_OBJ_VERTEX_ELEMENTS_HANDLE 1 |
| 255 | #define VIRGL_OBJ_VERTEX_ELEMENTS_V0_SRC_OFFSET(x) (((x) * 4) + 2) /* repeated per VE */ |
| 256 | #define VIRGL_OBJ_VERTEX_ELEMENTS_V0_INSTANCE_DIVISOR(x) (((x) * 4) + 3) |
| 257 | #define VIRGL_OBJ_VERTEX_ELEMENTS_V0_VERTEX_BUFFER_INDEX(x) (((x) * 4) + 4) |
| 258 | #define VIRGL_OBJ_VERTEX_ELEMENTS_V0_SRC_FORMAT(x) (((x) * 4) + 5) |
| 259 | |
| 260 | /* vertex buffers */ |
| 261 | #define VIRGL_SET_VERTEX_BUFFERS_SIZE(num_buffers) ((num_buffers) * 3) |
| 262 | #define VIRGL_SET_VERTEX_BUFFER_STRIDE(x) (((x) * 3) + 1) |
| 263 | #define VIRGL_SET_VERTEX_BUFFER_OFFSET(x) (((x) * 3) + 2) |
| 264 | #define VIRGL_SET_VERTEX_BUFFER_HANDLE(x) (((x) * 3) + 3) |
| 265 | |
| 266 | /* index buffer */ |
| 267 | #define VIRGL_SET_INDEX_BUFFER_SIZE(ib) (((ib) ? 2 : 0) + 1) |
| 268 | #define VIRGL_SET_INDEX_BUFFER_HANDLE 1 |
| 269 | #define VIRGL_SET_INDEX_BUFFER_INDEX_SIZE 2 /* only if sending an IB handle */ |
| 270 | #define VIRGL_SET_INDEX_BUFFER_OFFSET 3 /* only if sending an IB handle */ |
| 271 | |
| 272 | /* constant buffer */ |
| 273 | #define VIRGL_SET_CONSTANT_BUFFER_SHADER_TYPE 1 |
| 274 | #define VIRGL_SET_CONSTANT_BUFFER_INDEX 2 |
| 275 | #define VIRGL_SET_CONSTANT_BUFFER_DATA_START 3 |
| 276 | |
| 277 | #define VIRGL_SET_UNIFORM_BUFFER_SIZE 5 |
| 278 | #define VIRGL_SET_UNIFORM_BUFFER_SHADER_TYPE 1 |
| 279 | #define VIRGL_SET_UNIFORM_BUFFER_INDEX 2 |
| 280 | #define VIRGL_SET_UNIFORM_BUFFER_OFFSET 3 |
| 281 | #define VIRGL_SET_UNIFORM_BUFFER_LENGTH 4 |
| 282 | #define VIRGL_SET_UNIFORM_BUFFER_RES_HANDLE 5 |
| 283 | |
| 284 | /* draw VBO */ |
Dave Airlie | 9259bc7 | 2015-03-19 10:16:16 +1000 | [diff] [blame] | 285 | #define VIRGL_DRAW_VBO_SIZE 12 |
Dave Airlie | 9485f7e | 2017-08-05 13:39:25 +1000 | [diff] [blame] | 286 | #define VIRGL_DRAW_VBO_SIZE_TESS 14 |
| 287 | #define VIRGL_DRAW_VBO_SIZE_INDIRECT 20 |
Dave Airlie | 03e3116 | 2015-02-03 13:11:42 +1000 | [diff] [blame] | 288 | #define VIRGL_DRAW_VBO_START 1 |
| 289 | #define VIRGL_DRAW_VBO_COUNT 2 |
| 290 | #define VIRGL_DRAW_VBO_MODE 3 |
| 291 | #define VIRGL_DRAW_VBO_INDEXED 4 |
| 292 | #define VIRGL_DRAW_VBO_INSTANCE_COUNT 5 |
| 293 | #define VIRGL_DRAW_VBO_INDEX_BIAS 6 |
| 294 | #define VIRGL_DRAW_VBO_START_INSTANCE 7 |
| 295 | #define VIRGL_DRAW_VBO_PRIMITIVE_RESTART 8 |
| 296 | #define VIRGL_DRAW_VBO_RESTART_INDEX 9 |
| 297 | #define VIRGL_DRAW_VBO_MIN_INDEX 10 |
| 298 | #define VIRGL_DRAW_VBO_MAX_INDEX 11 |
Dave Airlie | 9259bc7 | 2015-03-19 10:16:16 +1000 | [diff] [blame] | 299 | #define VIRGL_DRAW_VBO_COUNT_FROM_SO 12 |
Dave Airlie | 9485f7e | 2017-08-05 13:39:25 +1000 | [diff] [blame] | 300 | /* tess packet */ |
| 301 | #define VIRGL_DRAW_VBO_VERTICES_PER_PATCH 13 |
| 302 | #define VIRGL_DRAW_VBO_DRAWID 14 |
| 303 | /* indirect packet */ |
| 304 | #define VIRGL_DRAW_VBO_INDIRECT_HANDLE 15 |
| 305 | #define VIRGL_DRAW_VBO_INDIRECT_OFFSET 16 |
| 306 | #define VIRGL_DRAW_VBO_INDIRECT_STRIDE 17 |
| 307 | #define VIRGL_DRAW_VBO_INDIRECT_DRAW_COUNT 18 |
| 308 | #define VIRGL_DRAW_VBO_INDIRECT_DRAW_COUNT_OFFSET 19 |
| 309 | #define VIRGL_DRAW_VBO_INDIRECT_DRAW_COUNT_HANDLE 20 |
Dave Airlie | 03e3116 | 2015-02-03 13:11:42 +1000 | [diff] [blame] | 310 | |
| 311 | /* create surface */ |
| 312 | #define VIRGL_OBJ_SURFACE_SIZE 5 |
| 313 | #define VIRGL_OBJ_SURFACE_HANDLE 1 |
| 314 | #define VIRGL_OBJ_SURFACE_RES_HANDLE 2 |
| 315 | #define VIRGL_OBJ_SURFACE_FORMAT 3 |
| 316 | #define VIRGL_OBJ_SURFACE_BUFFER_FIRST_ELEMENT 4 |
| 317 | #define VIRGL_OBJ_SURFACE_BUFFER_LAST_ELEMENT 5 |
| 318 | #define VIRGL_OBJ_SURFACE_TEXTURE_LEVEL 4 |
| 319 | #define VIRGL_OBJ_SURFACE_TEXTURE_LAYERS 5 |
| 320 | |
| 321 | /* create streamout target */ |
| 322 | #define VIRGL_OBJ_STREAMOUT_SIZE 4 |
| 323 | #define VIRGL_OBJ_STREAMOUT_HANDLE 1 |
| 324 | #define VIRGL_OBJ_STREAMOUT_RES_HANDLE 2 |
| 325 | #define VIRGL_OBJ_STREAMOUT_BUFFER_OFFSET 3 |
| 326 | #define VIRGL_OBJ_STREAMOUT_BUFFER_SIZE 4 |
| 327 | |
| 328 | /* sampler state */ |
| 329 | #define VIRGL_OBJ_SAMPLER_STATE_SIZE 9 |
| 330 | #define VIRGL_OBJ_SAMPLER_STATE_HANDLE 1 |
| 331 | #define VIRGL_OBJ_SAMPLER_STATE_S0 2 |
| 332 | #define VIRGL_OBJ_SAMPLE_STATE_S0_WRAP_S(x) (((x) & 0x7) << 0) |
| 333 | #define VIRGL_OBJ_SAMPLE_STATE_S0_WRAP_T(x) (((x) & 0x7) << 3) |
| 334 | #define VIRGL_OBJ_SAMPLE_STATE_S0_WRAP_R(x) (((x) & 0x7) << 6) |
| 335 | #define VIRGL_OBJ_SAMPLE_STATE_S0_MIN_IMG_FILTER(x) (((x) & 0x3) << 9) |
| 336 | #define VIRGL_OBJ_SAMPLE_STATE_S0_MIN_MIP_FILTER(x) (((x) & 0x3) << 11) |
| 337 | #define VIRGL_OBJ_SAMPLE_STATE_S0_MAG_IMG_FILTER(x) (((x) & 0x3) << 13) |
| 338 | #define VIRGL_OBJ_SAMPLE_STATE_S0_COMPARE_MODE(x) (((x) & 0x1) << 15) |
| 339 | #define VIRGL_OBJ_SAMPLE_STATE_S0_COMPARE_FUNC(x) (((x) & 0x7) << 16) |
Stéphane Marchesin | a6a51a2 | 2018-03-16 19:15:06 -0700 | [diff] [blame] | 340 | #define VIRGL_OBJ_SAMPLE_STATE_S0_SEAMLESS_CUBE_MAP(x) (((x) & 0x1) << 19) |
Dave Airlie | 03e3116 | 2015-02-03 13:11:42 +1000 | [diff] [blame] | 341 | |
| 342 | #define VIRGL_OBJ_SAMPLER_STATE_LOD_BIAS 3 |
| 343 | #define VIRGL_OBJ_SAMPLER_STATE_MIN_LOD 4 |
| 344 | #define VIRGL_OBJ_SAMPLER_STATE_MAX_LOD 5 |
| 345 | #define VIRGL_OBJ_SAMPLER_STATE_BORDER_COLOR(x) ((x) + 6) /* 6 - 9 */ |
| 346 | |
| 347 | |
| 348 | /* sampler view */ |
| 349 | #define VIRGL_OBJ_SAMPLER_VIEW_SIZE 6 |
| 350 | #define VIRGL_OBJ_SAMPLER_VIEW_HANDLE 1 |
| 351 | #define VIRGL_OBJ_SAMPLER_VIEW_RES_HANDLE 2 |
| 352 | #define VIRGL_OBJ_SAMPLER_VIEW_FORMAT 3 |
| 353 | #define VIRGL_OBJ_SAMPLER_VIEW_BUFFER_FIRST_ELEMENT 4 |
| 354 | #define VIRGL_OBJ_SAMPLER_VIEW_BUFFER_LAST_ELEMENT 5 |
| 355 | #define VIRGL_OBJ_SAMPLER_VIEW_TEXTURE_LAYER 4 |
| 356 | #define VIRGL_OBJ_SAMPLER_VIEW_TEXTURE_LEVEL 5 |
| 357 | #define VIRGL_OBJ_SAMPLER_VIEW_SWIZZLE 6 |
| 358 | #define VIRGL_OBJ_SAMPLER_VIEW_SWIZZLE_R(x) (((x) & 0x7) << 0) |
| 359 | #define VIRGL_OBJ_SAMPLER_VIEW_SWIZZLE_G(x) (((x) & 0x7) << 3) |
| 360 | #define VIRGL_OBJ_SAMPLER_VIEW_SWIZZLE_B(x) (((x) & 0x7) << 6) |
| 361 | #define VIRGL_OBJ_SAMPLER_VIEW_SWIZZLE_A(x) (((x) & 0x7) << 9) |
| 362 | |
| 363 | /* set sampler views */ |
| 364 | #define VIRGL_SET_SAMPLER_VIEWS_SIZE(num_views) ((num_views) + 2) |
| 365 | #define VIRGL_SET_SAMPLER_VIEWS_SHADER_TYPE 1 |
| 366 | #define VIRGL_SET_SAMPLER_VIEWS_START_SLOT 2 |
| 367 | #define VIRGL_SET_SAMPLER_VIEWS_V0_HANDLE 3 |
| 368 | |
| 369 | /* bind sampler states */ |
| 370 | #define VIRGL_BIND_SAMPLER_STATES(num_states) ((num_states) + 2) |
| 371 | #define VIRGL_BIND_SAMPLER_STATES_SHADER_TYPE 1 |
| 372 | #define VIRGL_BIND_SAMPLER_STATES_START_SLOT 2 |
| 373 | #define VIRGL_BIND_SAMPLER_STATES_S0_HANDLE 3 |
| 374 | |
| 375 | /* set stencil reference */ |
| 376 | #define VIRGL_SET_STENCIL_REF_SIZE 1 |
| 377 | #define VIRGL_SET_STENCIL_REF 1 |
| 378 | #define VIRGL_STENCIL_REF_VAL(f, s) ((f & 0xff) | (((s & 0xff) << 8))) |
| 379 | |
| 380 | /* set blend color */ |
| 381 | #define VIRGL_SET_BLEND_COLOR_SIZE 4 |
| 382 | #define VIRGL_SET_BLEND_COLOR(x) ((x) + 1) |
| 383 | |
| 384 | /* set scissor state */ |
Dave Airlie | 0ff22a0 | 2015-03-10 14:59:44 +1000 | [diff] [blame] | 385 | #define VIRGL_SET_SCISSOR_STATE_SIZE(x) (1 + 2 * x) |
| 386 | #define VIRGL_SET_SCISSOR_START_SLOT 1 |
| 387 | #define VIRGL_SET_SCISSOR_MINX_MINY(x) (2 + (x * 2)) |
Marc-André Lureau | 19fae10 | 2015-03-10 13:40:47 +0100 | [diff] [blame] | 388 | #define VIRGL_SET_SCISSOR_MAXX_MAXY(x) (3 + (x * 2)) |
Dave Airlie | 03e3116 | 2015-02-03 13:11:42 +1000 | [diff] [blame] | 389 | |
| 390 | /* resource copy region */ |
| 391 | #define VIRGL_CMD_RESOURCE_COPY_REGION_SIZE 13 |
| 392 | #define VIRGL_CMD_RCR_DST_RES_HANDLE 1 |
| 393 | #define VIRGL_CMD_RCR_DST_LEVEL 2 |
| 394 | #define VIRGL_CMD_RCR_DST_X 3 |
| 395 | #define VIRGL_CMD_RCR_DST_Y 4 |
| 396 | #define VIRGL_CMD_RCR_DST_Z 5 |
| 397 | #define VIRGL_CMD_RCR_SRC_RES_HANDLE 6 |
| 398 | #define VIRGL_CMD_RCR_SRC_LEVEL 7 |
| 399 | #define VIRGL_CMD_RCR_SRC_X 8 |
| 400 | #define VIRGL_CMD_RCR_SRC_Y 9 |
| 401 | #define VIRGL_CMD_RCR_SRC_Z 10 |
| 402 | #define VIRGL_CMD_RCR_SRC_W 11 |
| 403 | #define VIRGL_CMD_RCR_SRC_H 12 |
| 404 | #define VIRGL_CMD_RCR_SRC_D 13 |
| 405 | |
| 406 | /* blit */ |
| 407 | #define VIRGL_CMD_BLIT_SIZE 21 |
| 408 | #define VIRGL_CMD_BLIT_S0 1 |
| 409 | #define VIRGL_CMD_BLIT_S0_MASK(x) (((x) & 0xff) << 0) |
| 410 | #define VIRGL_CMD_BLIT_S0_FILTER(x) (((x) & 0x3) << 8) |
| 411 | #define VIRGL_CMD_BLIT_S0_SCISSOR_ENABLE(x) (((x) & 0x1) << 10) |
Dave Airlie | 12c89d5 | 2016-03-01 15:47:34 +1000 | [diff] [blame] | 412 | #define VIRGL_CMD_BLIT_S0_RENDER_CONDITION_ENABLE(x) (((x) & 0x1) << 11) |
| 413 | #define VIRGL_CMD_BLIT_S0_ALPHA_BLEND(x) (((x) & 0x1) << 12) |
Dave Airlie | 03e3116 | 2015-02-03 13:11:42 +1000 | [diff] [blame] | 414 | #define VIRGL_CMD_BLIT_SCISSOR_MINX_MINY 2 |
| 415 | #define VIRGL_CMD_BLIT_SCISSOR_MAXX_MAXY 3 |
| 416 | #define VIRGL_CMD_BLIT_DST_RES_HANDLE 4 |
| 417 | #define VIRGL_CMD_BLIT_DST_LEVEL 5 |
| 418 | #define VIRGL_CMD_BLIT_DST_FORMAT 6 |
| 419 | #define VIRGL_CMD_BLIT_DST_X 7 |
| 420 | #define VIRGL_CMD_BLIT_DST_Y 8 |
| 421 | #define VIRGL_CMD_BLIT_DST_Z 9 |
| 422 | #define VIRGL_CMD_BLIT_DST_W 10 |
| 423 | #define VIRGL_CMD_BLIT_DST_H 11 |
| 424 | #define VIRGL_CMD_BLIT_DST_D 12 |
| 425 | #define VIRGL_CMD_BLIT_SRC_RES_HANDLE 13 |
| 426 | #define VIRGL_CMD_BLIT_SRC_LEVEL 14 |
| 427 | #define VIRGL_CMD_BLIT_SRC_FORMAT 15 |
| 428 | #define VIRGL_CMD_BLIT_SRC_X 16 |
| 429 | #define VIRGL_CMD_BLIT_SRC_Y 17 |
| 430 | #define VIRGL_CMD_BLIT_SRC_Z 18 |
| 431 | #define VIRGL_CMD_BLIT_SRC_W 19 |
| 432 | #define VIRGL_CMD_BLIT_SRC_H 20 |
| 433 | #define VIRGL_CMD_BLIT_SRC_D 21 |
| 434 | |
| 435 | /* query object */ |
| 436 | #define VIRGL_OBJ_QUERY_SIZE 4 |
| 437 | #define VIRGL_OBJ_QUERY_HANDLE 1 |
Dave Airlie | fd81164 | 2015-10-23 11:04:01 +1000 | [diff] [blame] | 438 | #define VIRGL_OBJ_QUERY_TYPE_INDEX 2 |
| 439 | #define VIRGL_OBJ_QUERY_TYPE(x) (x & 0xffff) |
| 440 | #define VIRGL_OBJ_QUERY_INDEX(x) ((x & 0xffff) << 16) |
Dave Airlie | 03e3116 | 2015-02-03 13:11:42 +1000 | [diff] [blame] | 441 | #define VIRGL_OBJ_QUERY_OFFSET 3 |
| 442 | #define VIRGL_OBJ_QUERY_RES_HANDLE 4 |
| 443 | |
| 444 | #define VIRGL_QUERY_BEGIN_HANDLE 1 |
| 445 | |
| 446 | #define VIRGL_QUERY_END_HANDLE 1 |
| 447 | |
| 448 | #define VIRGL_QUERY_RESULT_HANDLE 1 |
| 449 | #define VIRGL_QUERY_RESULT_WAIT 2 |
| 450 | |
| 451 | /* render condition */ |
| 452 | #define VIRGL_RENDER_CONDITION_SIZE 3 |
| 453 | #define VIRGL_RENDER_CONDITION_HANDLE 1 |
| 454 | #define VIRGL_RENDER_CONDITION_CONDITION 2 |
| 455 | #define VIRGL_RENDER_CONDITION_MODE 3 |
| 456 | |
| 457 | /* resource inline write */ |
| 458 | #define VIRGL_RESOURCE_IW_RES_HANDLE 1 |
| 459 | #define VIRGL_RESOURCE_IW_LEVEL 2 |
| 460 | #define VIRGL_RESOURCE_IW_USAGE 3 |
| 461 | #define VIRGL_RESOURCE_IW_STRIDE 4 |
| 462 | #define VIRGL_RESOURCE_IW_LAYER_STRIDE 5 |
| 463 | #define VIRGL_RESOURCE_IW_X 6 |
| 464 | #define VIRGL_RESOURCE_IW_Y 7 |
| 465 | #define VIRGL_RESOURCE_IW_Z 8 |
| 466 | #define VIRGL_RESOURCE_IW_W 9 |
| 467 | #define VIRGL_RESOURCE_IW_H 10 |
| 468 | #define VIRGL_RESOURCE_IW_D 11 |
| 469 | #define VIRGL_RESOURCE_IW_DATA_START 12 |
| 470 | |
| 471 | /* set streamout targets */ |
| 472 | #define VIRGL_SET_STREAMOUT_TARGETS_APPEND_BITMASK 1 |
| 473 | #define VIRGL_SET_STREAMOUT_TARGETS_H0 2 |
| 474 | |
| 475 | /* set sample mask */ |
| 476 | #define VIRGL_SET_SAMPLE_MASK_SIZE 1 |
| 477 | #define VIRGL_SET_SAMPLE_MASK_MASK 1 |
| 478 | |
| 479 | /* set clip state */ |
| 480 | #define VIRGL_SET_CLIP_STATE_SIZE 32 |
| 481 | #define VIRGL_SET_CLIP_STATE_C0 1 |
| 482 | |
| 483 | /* polygon stipple */ |
| 484 | #define VIRGL_POLYGON_STIPPLE_SIZE 32 |
| 485 | #define VIRGL_POLYGON_STIPPLE_P0 1 |
Dave Airlie | 85602b3 | 2015-10-23 14:35:46 +1000 | [diff] [blame] | 486 | |
| 487 | #define VIRGL_BIND_SHADER_SIZE 2 |
| 488 | #define VIRGL_BIND_SHADER_HANDLE 1 |
| 489 | #define VIRGL_BIND_SHADER_TYPE 2 |
| 490 | |
Dave Airlie | 0555483 | 2017-08-11 10:50:37 +1000 | [diff] [blame] | 491 | /* tess state */ |
| 492 | #define VIRGL_TESS_STATE_SIZE 6 |
| 493 | |
Erik Faye-Lund | d24ac12 | 2018-07-10 10:43:38 +0200 | [diff] [blame] | 494 | /* set min samples */ |
| 495 | #define VIRGL_SET_MIN_SAMPLES_SIZE 1 |
| 496 | #define VIRGL_SET_MIN_SAMPLES_MASK 1 |
| 497 | |
Dave Airlie | 083d97f | 2018-07-17 17:44:43 +1000 | [diff] [blame] | 498 | /* set shader buffers */ |
| 499 | #define VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE 3 |
| 500 | #define VIRGL_SET_SHADER_BUFFER_SIZE(x) (VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE * (x)) + 2 |
| 501 | #define VIRGL_SET_SHADER_BUFFER_SHADER_TYPE 1 |
| 502 | #define VIRGL_SET_SHADER_BUFFER_START_SLOT 2 |
Dave Airlie | 519a091 | 2018-07-24 05:51:19 +1000 | [diff] [blame] | 503 | #define VIRGL_SET_SHADER_BUFFER_OFFSET(x) ((x) * VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE + 3) |
| 504 | #define VIRGL_SET_SHADER_BUFFER_LENGTH(x) ((x) * VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE + 4) |
| 505 | #define VIRGL_SET_SHADER_BUFFER_RES_HANDLE(x) ((x) * VIRGL_SET_SHADER_BUFFER_ELEMENT_SIZE + 5) |
Dave Airlie | 083d97f | 2018-07-17 17:44:43 +1000 | [diff] [blame] | 506 | |
Dave Airlie | 950de33 | 2018-07-20 08:41:30 +1000 | [diff] [blame] | 507 | /* set shader images */ |
| 508 | #define VIRGL_SET_SHADER_IMAGE_ELEMENT_SIZE 5 |
| 509 | #define VIRGL_SET_SHADER_IMAGE_SIZE(x) (VIRGL_SET_SHADER_IMAGE_ELEMENT_SIZE * (x)) + 2 |
| 510 | #define VIRGL_SET_SHADER_IMAGE_SHADER_TYPE 1 |
| 511 | #define VIRGL_SET_SHADER_IMAGE_START_SLOT 2 |
| 512 | #define VIRGL_SET_SHADER_IMAGE_FORMAT(x) ((x) * VIRGL_SET_SHADER_IMAGE_ELEMENT_SIZE + 3) |
| 513 | #define VIRGL_SET_SHADER_IMAGE_ACCESS(x) ((x) * VIRGL_SET_SHADER_IMAGE_ELEMENT_SIZE + 4) |
| 514 | #define VIRGL_SET_SHADER_IMAGE_LAYER_OFFSET(x) ((x) * VIRGL_SET_SHADER_IMAGE_ELEMENT_SIZE + 5) |
| 515 | #define VIRGL_SET_SHADER_IMAGE_LEVEL_SIZE(x) ((x) * VIRGL_SET_SHADER_IMAGE_ELEMENT_SIZE + 6) |
| 516 | #define VIRGL_SET_SHADER_IMAGE_RES_HANDLE(x) ((x) * VIRGL_SET_SHADER_IMAGE_ELEMENT_SIZE + 7) |
| 517 | |
Dave Airlie | 8289e3f | 2018-07-18 13:11:39 +1000 | [diff] [blame] | 518 | /* memory barrier */ |
| 519 | #define VIRGL_MEMORY_BARRIER_SIZE 1 |
| 520 | #define VIRGL_MEMORY_BARRIER_FLAGS 1 |
| 521 | |
Dave Airlie | 38207b5 | 2018-07-30 15:22:51 +1000 | [diff] [blame] | 522 | /* launch grid */ |
| 523 | #define VIRGL_LAUNCH_GRID_SIZE 8 |
| 524 | #define VIRGL_LAUNCH_BLOCK_X 1 |
| 525 | #define VIRGL_LAUNCH_BLOCK_Y 2 |
| 526 | #define VIRGL_LAUNCH_BLOCK_Z 3 |
| 527 | #define VIRGL_LAUNCH_GRID_X 4 |
| 528 | #define VIRGL_LAUNCH_GRID_Y 5 |
| 529 | #define VIRGL_LAUNCH_GRID_Z 6 |
| 530 | #define VIRGL_LAUNCH_INDIRECT_HANDLE 7 |
| 531 | #define VIRGL_LAUNCH_INDIRECT_OFFSET 8 |
Dave Airlie | b4965e2 | 2018-07-19 10:32:23 +1000 | [diff] [blame^] | 532 | |
| 533 | /* framebuffer state no attachment */ |
| 534 | #define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_SIZE 2 |
| 535 | #define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_WIDTH_HEIGHT 1 |
| 536 | #define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_WIDTH(x) (x & 0xffff) |
| 537 | #define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_HEIGHT(x) ((x >> 16) & 0xffff) |
| 538 | #define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_LAYERS_SAMPLES 2 |
| 539 | #define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_LAYERS(x) (x & 0xffff) |
| 540 | #define VIRGL_SET_FRAMEBUFFER_STATE_NO_ATTACH_SAMPLES(x) ((x >> 16) & 0xff) |
| 541 | |
Dave Airlie | a3a2c64 | 2014-03-31 14:07:58 +1000 | [diff] [blame] | 542 | #endif |