blob: dd0cbf6486b7b7a14e71422f69cd62d100ce4460 [file] [log] [blame]
Chia-I Wub2755562014-08-20 13:38:52 +08001/*
2 * XGL
3 *
4 * Copyright (C) 2014 LunarG, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included
14 * in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 */
24
Chia-I Wu9f039862014-08-20 15:39:56 +080025#include "genhw/genhw.h"
Chia-I Wub2755562014-08-20 13:38:52 +080026#include "dset.h"
Chia-I Wu7fae4e32014-08-21 11:39:44 +080027#include "img.h"
Chia-I Wub2755562014-08-20 13:38:52 +080028#include "mem.h"
Chia-I Wu018a3962014-08-21 10:37:52 +080029#include "pipeline.h"
Chia-I Wub2755562014-08-20 13:38:52 +080030#include "state.h"
31#include "view.h"
32#include "cmd_priv.h"
33
Chia-I Wu48c283d2014-08-25 23:13:46 +080034enum {
35 GEN6_WA_POST_SYNC_FLUSH = 1 << 0,
Chia-I Wu48c283d2014-08-25 23:13:46 +080036};
37
Chia-I Wu59c097e2014-08-21 10:51:07 +080038static void gen6_3DPRIMITIVE(struct intel_cmd *cmd,
Chia-I Wu254db422014-08-21 11:54:29 +080039 int prim_type, bool indexed,
Chia-I Wu59c097e2014-08-21 10:51:07 +080040 uint32_t vertex_count,
41 uint32_t vertex_start,
42 uint32_t instance_count,
43 uint32_t instance_start,
44 uint32_t vertex_base)
45{
46 const uint8_t cmd_len = 6;
47 uint32_t dw0;
48
49 CMD_ASSERT(cmd, 6, 6);
50
Chia-I Wu426072d2014-08-26 14:31:55 +080051 dw0 = GEN6_RENDER_CMD(3D, 3DPRIMITIVE) |
Chia-I Wu254db422014-08-21 11:54:29 +080052 prim_type << GEN6_3DPRIM_DW0_TYPE__SHIFT |
Chia-I Wu59c097e2014-08-21 10:51:07 +080053 (cmd_len - 2);
54
55 if (indexed)
56 dw0 |= GEN6_3DPRIM_DW0_ACCESS_RANDOM;
57
Chia-I Wue24c3292014-08-21 14:05:23 +080058 cmd_batch_reserve(cmd, cmd_len);
59 cmd_batch_write(cmd, dw0);
60 cmd_batch_write(cmd, vertex_count);
61 cmd_batch_write(cmd, vertex_start);
62 cmd_batch_write(cmd, instance_count);
63 cmd_batch_write(cmd, instance_start);
64 cmd_batch_write(cmd, vertex_base);
Chia-I Wu59c097e2014-08-21 10:51:07 +080065}
66
67static void gen7_3DPRIMITIVE(struct intel_cmd *cmd,
Chia-I Wu254db422014-08-21 11:54:29 +080068 int prim_type, bool indexed,
Chia-I Wu59c097e2014-08-21 10:51:07 +080069 uint32_t vertex_count,
70 uint32_t vertex_start,
71 uint32_t instance_count,
72 uint32_t instance_start,
73 uint32_t vertex_base)
74{
75 const uint8_t cmd_len = 7;
76 uint32_t dw0, dw1;
77
78 CMD_ASSERT(cmd, 7, 7.5);
79
Chia-I Wu426072d2014-08-26 14:31:55 +080080 dw0 = GEN6_RENDER_CMD(3D, 3DPRIMITIVE) | (cmd_len - 2);
Chia-I Wu254db422014-08-21 11:54:29 +080081 dw1 = prim_type << GEN7_3DPRIM_DW1_TYPE__SHIFT;
Chia-I Wu59c097e2014-08-21 10:51:07 +080082
83 if (indexed)
84 dw1 |= GEN7_3DPRIM_DW1_ACCESS_RANDOM;
85
Chia-I Wue24c3292014-08-21 14:05:23 +080086 cmd_batch_reserve(cmd, cmd_len);
87 cmd_batch_write(cmd, dw0);
88 cmd_batch_write(cmd, dw1);
89 cmd_batch_write(cmd, vertex_count);
90 cmd_batch_write(cmd, vertex_start);
91 cmd_batch_write(cmd, instance_count);
92 cmd_batch_write(cmd, instance_start);
93 cmd_batch_write(cmd, vertex_base);
Chia-I Wu59c097e2014-08-21 10:51:07 +080094}
95
Chia-I Wu270b1e82014-08-25 15:53:39 +080096static void gen6_PIPE_CONTROL(struct intel_cmd *cmd, uint32_t dw1,
97 struct intel_bo *bo, uint32_t bo_offset)
98{
99 const uint8_t cmd_len = 5;
Chia-I Wu426072d2014-08-26 14:31:55 +0800100 const uint32_t dw0 = GEN6_RENDER_CMD(3D, PIPE_CONTROL) |
Chia-I Wu270b1e82014-08-25 15:53:39 +0800101 (cmd_len - 2);
Chia-I Wu270b1e82014-08-25 15:53:39 +0800102
103 CMD_ASSERT(cmd, 6, 7.5);
104
105 assert(bo_offset % 8 == 0);
106
107 if (dw1 & GEN6_PIPE_CONTROL_CS_STALL) {
108 /*
109 * From the Sandy Bridge PRM, volume 2 part 1, page 73:
110 *
111 * "1 of the following must also be set (when CS stall is set):
112 *
113 * * Depth Cache Flush Enable ([0] of DW1)
114 * * Stall at Pixel Scoreboard ([1] of DW1)
115 * * Depth Stall ([13] of DW1)
116 * * Post-Sync Operation ([13] of DW1)
117 * * Render Target Cache Flush Enable ([12] of DW1)
118 * * Notify Enable ([8] of DW1)"
119 *
120 * From the Ivy Bridge PRM, volume 2 part 1, page 61:
121 *
122 * "One of the following must also be set (when CS stall is set):
123 *
124 * * Render Target Cache Flush Enable ([12] of DW1)
125 * * Depth Cache Flush Enable ([0] of DW1)
126 * * Stall at Pixel Scoreboard ([1] of DW1)
127 * * Depth Stall ([13] of DW1)
128 * * Post-Sync Operation ([13] of DW1)"
129 */
130 uint32_t bit_test = GEN6_PIPE_CONTROL_RENDER_CACHE_FLUSH |
131 GEN6_PIPE_CONTROL_DEPTH_CACHE_FLUSH |
132 GEN6_PIPE_CONTROL_PIXEL_SCOREBOARD_STALL |
133 GEN6_PIPE_CONTROL_DEPTH_STALL;
134
135 /* post-sync op */
136 bit_test |= GEN6_PIPE_CONTROL_WRITE_IMM |
137 GEN6_PIPE_CONTROL_WRITE_PS_DEPTH_COUNT |
138 GEN6_PIPE_CONTROL_WRITE_TIMESTAMP;
139
140 if (cmd_gen(cmd) == INTEL_GEN(6))
141 bit_test |= GEN6_PIPE_CONTROL_NOTIFY_ENABLE;
142
143 assert(dw1 & bit_test);
144 }
145
146 if (dw1 & GEN6_PIPE_CONTROL_DEPTH_STALL) {
147 /*
148 * From the Sandy Bridge PRM, volume 2 part 1, page 73:
149 *
150 * "Following bits must be clear (when Depth Stall is set):
151 *
152 * * Render Target Cache Flush Enable ([12] of DW1)
153 * * Depth Cache Flush Enable ([0] of DW1)"
154 */
155 assert(!(dw1 & (GEN6_PIPE_CONTROL_RENDER_CACHE_FLUSH |
156 GEN6_PIPE_CONTROL_DEPTH_CACHE_FLUSH)));
157 }
158
159 /*
160 * From the Sandy Bridge PRM, volume 1 part 3, page 19:
161 *
162 * "[DevSNB] PPGTT memory writes by MI_* (such as MI_STORE_DATA_IMM)
163 * and PIPE_CONTROL are not supported."
164 *
165 * The kernel will add the mapping automatically (when write domain is
166 * INTEL_DOMAIN_INSTRUCTION).
167 */
168 if (cmd_gen(cmd) == INTEL_GEN(6) && bo)
169 bo_offset |= GEN6_PIPE_CONTROL_DW2_USE_GGTT;
170
171 cmd_batch_reserve_reloc(cmd, cmd_len, (bool) bo);
172 cmd_batch_write(cmd, dw0);
173 cmd_batch_write(cmd, dw1);
Chia-I Wu32a22462014-08-26 14:13:46 +0800174 if (bo) {
175 cmd_batch_reloc(cmd, bo_offset, bo, INTEL_RELOC_GGTT |
176 INTEL_RELOC_WRITE);
177 } else {
Chia-I Wu270b1e82014-08-25 15:53:39 +0800178 cmd_batch_write(cmd, 0);
Chia-I Wu32a22462014-08-26 14:13:46 +0800179 }
Chia-I Wu270b1e82014-08-25 15:53:39 +0800180 cmd_batch_write(cmd, 0);
181 cmd_batch_write(cmd, 0);
182}
183
Chia-I Wu254db422014-08-21 11:54:29 +0800184static bool gen6_can_primitive_restart(const struct intel_cmd *cmd)
185{
186 const struct intel_pipeline *p = cmd->bind.pipeline.graphics;
187 bool supported;
188
189 CMD_ASSERT(cmd, 6, 7.5);
190
191 if (cmd_gen(cmd) >= INTEL_GEN(7.5))
192 return (p->prim_type != GEN6_3DPRIM_RECTLIST);
193
194 switch (p->prim_type) {
195 case GEN6_3DPRIM_POINTLIST:
196 case GEN6_3DPRIM_LINELIST:
197 case GEN6_3DPRIM_LINESTRIP:
198 case GEN6_3DPRIM_TRILIST:
199 case GEN6_3DPRIM_TRISTRIP:
200 supported = true;
201 break;
202 default:
203 supported = false;
204 break;
205 }
206
207 if (!supported)
208 return false;
209
210 switch (cmd->bind.index.type) {
211 case XGL_INDEX_8:
212 supported = (p->primitive_restart_index != 0xffu);
213 break;
214 case XGL_INDEX_16:
215 supported = (p->primitive_restart_index != 0xffffu);
216 break;
217 case XGL_INDEX_32:
218 supported = (p->primitive_restart_index != 0xffffffffu);
219 break;
220 default:
221 supported = false;
222 break;
223 }
224
225 return supported;
226}
227
Chia-I Wu59c097e2014-08-21 10:51:07 +0800228static void gen6_3DSTATE_INDEX_BUFFER(struct intel_cmd *cmd,
Chia-I Wu958d1b72014-08-21 11:28:11 +0800229 const struct intel_mem *mem,
Chia-I Wu59c097e2014-08-21 10:51:07 +0800230 XGL_GPU_SIZE offset,
231 XGL_INDEX_TYPE type,
232 bool enable_cut_index)
233{
234 const uint8_t cmd_len = 3;
235 uint32_t dw0, end_offset;
236 unsigned offset_align;
237
238 CMD_ASSERT(cmd, 6, 7.5);
239
Chia-I Wu426072d2014-08-26 14:31:55 +0800240 dw0 = GEN6_RENDER_CMD(3D, 3DSTATE_INDEX_BUFFER) | (cmd_len - 2);
Chia-I Wu59c097e2014-08-21 10:51:07 +0800241
242 /* the bit is moved to 3DSTATE_VF */
243 if (cmd_gen(cmd) >= INTEL_GEN(7.5))
244 assert(!enable_cut_index);
245 if (enable_cut_index)
246 dw0 |= GEN6_IB_DW0_CUT_INDEX_ENABLE;
247
248 switch (type) {
249 case XGL_INDEX_8:
250 dw0 |= GEN6_IB_DW0_FORMAT_BYTE;
251 offset_align = 1;
252 break;
253 case XGL_INDEX_16:
254 dw0 |= GEN6_IB_DW0_FORMAT_WORD;
255 offset_align = 2;
256 break;
257 case XGL_INDEX_32:
258 dw0 |= GEN6_IB_DW0_FORMAT_DWORD;
259 offset_align = 4;
260 break;
261 default:
262 cmd->result = XGL_ERROR_INVALID_VALUE;
263 return;
264 break;
265 }
266
267 if (offset % offset_align) {
268 cmd->result = XGL_ERROR_INVALID_VALUE;
269 return;
270 }
271
272 /* aligned and inclusive */
273 end_offset = mem->size - (mem->size % offset_align) - 1;
274
Chia-I Wu2de65d02014-08-25 10:02:53 +0800275 cmd_batch_reserve_reloc(cmd, cmd_len, 2);
Chia-I Wue24c3292014-08-21 14:05:23 +0800276 cmd_batch_write(cmd, dw0);
Chia-I Wu32a22462014-08-26 14:13:46 +0800277 cmd_batch_reloc(cmd, offset, mem->bo, 0);
278 cmd_batch_reloc(cmd, end_offset, mem->bo, 0);
Chia-I Wu59c097e2014-08-21 10:51:07 +0800279}
280
Chia-I Wu254db422014-08-21 11:54:29 +0800281static inline void
282gen75_3DSTATE_VF(struct intel_cmd *cmd,
283 bool enable_cut_index,
284 uint32_t cut_index)
285{
286 const uint8_t cmd_len = 2;
287 uint32_t dw0;
288
289 CMD_ASSERT(cmd, 7.5, 7.5);
290
Chia-I Wu426072d2014-08-26 14:31:55 +0800291 dw0 = GEN75_RENDER_CMD(3D, 3DSTATE_VF) | (cmd_len - 2);
Chia-I Wu254db422014-08-21 11:54:29 +0800292 if (enable_cut_index)
293 dw0 |= GEN75_VF_DW0_CUT_INDEX_ENABLE;
294
Chia-I Wue24c3292014-08-21 14:05:23 +0800295 cmd_batch_reserve(cmd, cmd_len);
296 cmd_batch_write(cmd, dw0);
297 cmd_batch_write(cmd, cut_index);
Chia-I Wu254db422014-08-21 11:54:29 +0800298}
299
Chia-I Wud88e02d2014-08-25 10:56:13 +0800300static void gen6_3DSTATE_DRAWING_RECTANGLE(struct intel_cmd *cmd,
301 XGL_UINT width, XGL_UINT height)
302{
303 const uint8_t cmd_len = 4;
Chia-I Wu426072d2014-08-26 14:31:55 +0800304 const uint32_t dw0 = GEN6_RENDER_CMD(3D, 3DSTATE_DRAWING_RECTANGLE) |
Chia-I Wud88e02d2014-08-25 10:56:13 +0800305 (cmd_len - 2);
306
307 CMD_ASSERT(cmd, 6, 7.5);
308
309 cmd_batch_reserve(cmd, cmd_len);
310 cmd_batch_write(cmd, dw0);
311 if (width && height) {
312 cmd_batch_write(cmd, 0);
313 cmd_batch_write(cmd, (height - 1) << 16 |
314 (width - 1));
315 } else {
316 cmd_batch_write(cmd, 1);
317 cmd_batch_write(cmd, 0);
318 }
319 cmd_batch_write(cmd, 0);
320}
321
Chia-I Wu7fae4e32014-08-21 11:39:44 +0800322static void gen6_3DSTATE_DEPTH_BUFFER(struct intel_cmd *cmd,
323 const struct intel_ds_view *view)
324{
325 const uint8_t cmd_len = 7;
326 uint32_t dw0;
327
328 CMD_ASSERT(cmd, 6, 7.5);
329
330 dw0 = (cmd_gen(cmd) >= INTEL_GEN(7)) ?
Chia-I Wu426072d2014-08-26 14:31:55 +0800331 GEN7_RENDER_CMD(3D, 3DSTATE_DEPTH_BUFFER) :
332 GEN6_RENDER_CMD(3D, 3DSTATE_DEPTH_BUFFER);
Chia-I Wu7fae4e32014-08-21 11:39:44 +0800333 dw0 |= (cmd_len - 2);
334
Chia-I Wu2de65d02014-08-25 10:02:53 +0800335 cmd_batch_reserve_reloc(cmd, cmd_len, (bool) view->img);
Chia-I Wue24c3292014-08-21 14:05:23 +0800336 cmd_batch_write(cmd, dw0);
337 cmd_batch_write(cmd, view->cmd[0]);
Courtney Goeltzenleuchtere316d972014-08-22 16:25:24 -0600338 if (view->img) {
Chia-I Wu9ee38722014-08-25 12:11:36 +0800339 cmd_batch_reloc(cmd, view->cmd[1], view->img->obj.mem->bo,
Chia-I Wu32a22462014-08-26 14:13:46 +0800340 INTEL_RELOC_WRITE);
Courtney Goeltzenleuchtere316d972014-08-22 16:25:24 -0600341 } else {
342 cmd_batch_write(cmd, 0);
343 }
Chia-I Wue24c3292014-08-21 14:05:23 +0800344 cmd_batch_write(cmd, view->cmd[2]);
345 cmd_batch_write(cmd, view->cmd[3]);
346 cmd_batch_write(cmd, view->cmd[4]);
347 cmd_batch_write(cmd, view->cmd[5]);
Chia-I Wu7fae4e32014-08-21 11:39:44 +0800348}
349
350static void gen6_3DSTATE_STENCIL_BUFFER(struct intel_cmd *cmd,
351 const struct intel_ds_view *view)
352{
353 const uint8_t cmd_len = 3;
354 uint32_t dw0;
355
356 CMD_ASSERT(cmd, 6, 7.5);
357
358 dw0 = (cmd_gen(cmd) >= INTEL_GEN(7)) ?
Chia-I Wu426072d2014-08-26 14:31:55 +0800359 GEN7_RENDER_CMD(3D, 3DSTATE_STENCIL_BUFFER) :
360 GEN6_RENDER_CMD(3D, 3DSTATE_STENCIL_BUFFER);
Chia-I Wu7fae4e32014-08-21 11:39:44 +0800361 dw0 |= (cmd_len - 2);
362
Chia-I Wu2de65d02014-08-25 10:02:53 +0800363 cmd_batch_reserve_reloc(cmd, cmd_len, (bool) view->img);
Chia-I Wue24c3292014-08-21 14:05:23 +0800364 cmd_batch_write(cmd, dw0);
365 cmd_batch_write(cmd, view->cmd[6]);
Courtney Goeltzenleuchtere316d972014-08-22 16:25:24 -0600366 if (view->img) {
Chia-I Wu9ee38722014-08-25 12:11:36 +0800367 cmd_batch_reloc(cmd, view->cmd[7], view->img->obj.mem->bo,
Chia-I Wu32a22462014-08-26 14:13:46 +0800368 INTEL_RELOC_WRITE);
Courtney Goeltzenleuchtere316d972014-08-22 16:25:24 -0600369 } else {
370 cmd_batch_write(cmd, 0);
371 }
Chia-I Wu7fae4e32014-08-21 11:39:44 +0800372}
373
374static void gen6_3DSTATE_HIER_DEPTH_BUFFER(struct intel_cmd *cmd,
375 const struct intel_ds_view *view)
376{
377 const uint8_t cmd_len = 3;
378 uint32_t dw0;
379
380 CMD_ASSERT(cmd, 6, 7.5);
381
382 dw0 = (cmd_gen(cmd) >= INTEL_GEN(7)) ?
Chia-I Wu426072d2014-08-26 14:31:55 +0800383 GEN7_RENDER_CMD(3D, 3DSTATE_HIER_DEPTH_BUFFER) :
384 GEN6_RENDER_CMD(3D, 3DSTATE_HIER_DEPTH_BUFFER);
Chia-I Wu7fae4e32014-08-21 11:39:44 +0800385 dw0 |= (cmd_len - 2);
386
Chia-I Wu2de65d02014-08-25 10:02:53 +0800387 cmd_batch_reserve_reloc(cmd, cmd_len, (bool) view->img);
Chia-I Wue24c3292014-08-21 14:05:23 +0800388 cmd_batch_write(cmd, dw0);
389 cmd_batch_write(cmd, view->cmd[8]);
Courtney Goeltzenleuchtere316d972014-08-22 16:25:24 -0600390 if (view->img) {
Chia-I Wu9ee38722014-08-25 12:11:36 +0800391 cmd_batch_reloc(cmd, view->cmd[9], view->img->obj.mem->bo,
Chia-I Wu32a22462014-08-26 14:13:46 +0800392 INTEL_RELOC_WRITE);
Courtney Goeltzenleuchtere316d972014-08-22 16:25:24 -0600393 } else {
394 cmd_batch_write(cmd, 0);
395 }
Chia-I Wu7fae4e32014-08-21 11:39:44 +0800396}
397
Chia-I Wuf8231032014-08-25 10:44:45 +0800398static void gen6_3DSTATE_CLEAR_PARAMS(struct intel_cmd *cmd,
399 uint32_t clear_val)
400{
401 const uint8_t cmd_len = 2;
Chia-I Wu426072d2014-08-26 14:31:55 +0800402 const uint32_t dw0 = GEN6_RENDER_CMD(3D, 3DSTATE_CLEAR_PARAMS) |
Chia-I Wuf8231032014-08-25 10:44:45 +0800403 GEN6_CLEAR_PARAMS_DW0_VALID |
404 (cmd_len - 2);
405
406 CMD_ASSERT(cmd, 6, 6);
407
408 cmd_batch_reserve(cmd, cmd_len);
409 cmd_batch_write(cmd, dw0);
410 cmd_batch_write(cmd, clear_val);
411}
412
413static void gen7_3DSTATE_CLEAR_PARAMS(struct intel_cmd *cmd,
414 uint32_t clear_val)
415{
416 const uint8_t cmd_len = 3;
Chia-I Wu426072d2014-08-26 14:31:55 +0800417 const uint32_t dw0 = GEN7_RENDER_CMD(3D, 3DSTATE_CLEAR_PARAMS) |
Chia-I Wuf8231032014-08-25 10:44:45 +0800418 (cmd_len - 2);
419
420 CMD_ASSERT(cmd, 7, 7.5);
421
422 cmd_batch_reserve(cmd, cmd_len);
423 cmd_batch_write(cmd, dw0);
424 cmd_batch_write(cmd, clear_val);
425 cmd_batch_write(cmd, 1);
426}
427
Chia-I Wu302742d2014-08-22 10:28:29 +0800428static void gen6_3DSTATE_CC_STATE_POINTERS(struct intel_cmd *cmd,
429 XGL_UINT blend_pos,
430 XGL_UINT ds_pos,
431 XGL_UINT cc_pos)
432{
433 const uint8_t cmd_len = 4;
434 uint32_t dw0;
435
436 CMD_ASSERT(cmd, 6, 6);
437
Chia-I Wu426072d2014-08-26 14:31:55 +0800438 dw0 = GEN6_RENDER_CMD(3D, 3DSTATE_CC_STATE_POINTERS) |
Chia-I Wu302742d2014-08-22 10:28:29 +0800439 (cmd_len - 2);
440
441 cmd_batch_reserve(cmd, cmd_len);
442 cmd_batch_write(cmd, dw0);
443 cmd_batch_write(cmd, (blend_pos << 2) | 1);
444 cmd_batch_write(cmd, (ds_pos << 2) | 1);
445 cmd_batch_write(cmd, (cc_pos << 2) | 1);
446}
447
Chia-I Wu1744cca2014-08-22 11:10:17 +0800448static void gen6_3DSTATE_VIEWPORT_STATE_POINTERS(struct intel_cmd *cmd,
449 XGL_UINT clip_pos,
450 XGL_UINT sf_pos,
451 XGL_UINT cc_pos)
452{
453 const uint8_t cmd_len = 4;
454 uint32_t dw0;
455
456 CMD_ASSERT(cmd, 6, 6);
457
Chia-I Wu426072d2014-08-26 14:31:55 +0800458 dw0 = GEN6_RENDER_CMD(3D, 3DSTATE_VIEWPORT_STATE_POINTERS) |
Chia-I Wu1744cca2014-08-22 11:10:17 +0800459 GEN6_PTR_VP_DW0_CLIP_CHANGED |
460 GEN6_PTR_VP_DW0_SF_CHANGED |
461 GEN6_PTR_VP_DW0_CC_CHANGED |
462 (cmd_len - 2);
463
464 cmd_batch_reserve(cmd, cmd_len);
465 cmd_batch_write(cmd, dw0);
466 cmd_batch_write(cmd, clip_pos << 2);
467 cmd_batch_write(cmd, sf_pos << 2);
468 cmd_batch_write(cmd, cc_pos << 2);
469}
470
471static void gen6_3DSTATE_SCISSOR_STATE_POINTERS(struct intel_cmd *cmd,
472 XGL_UINT scissor_pos)
473{
474 const uint8_t cmd_len = 2;
475 uint32_t dw0;
476
477 CMD_ASSERT(cmd, 6, 6);
478
Chia-I Wu426072d2014-08-26 14:31:55 +0800479 dw0 = GEN6_RENDER_CMD(3D, 3DSTATE_SCISSOR_STATE_POINTERS) |
Chia-I Wu1744cca2014-08-22 11:10:17 +0800480 (cmd_len - 2);
481
482 cmd_batch_reserve(cmd, cmd_len);
483 cmd_batch_write(cmd, dw0);
484 cmd_batch_write(cmd, scissor_pos << 2);
485}
486
Chia-I Wu42a56202014-08-23 16:47:48 +0800487static void gen6_3DSTATE_BINDING_TABLE_POINTERS(struct intel_cmd *cmd,
488 XGL_UINT vs_pos,
489 XGL_UINT gs_pos,
490 XGL_UINT ps_pos)
491{
492 const uint8_t cmd_len = 4;
493 uint32_t dw0;
494
495 CMD_ASSERT(cmd, 6, 6);
496
Chia-I Wu426072d2014-08-26 14:31:55 +0800497 dw0 = GEN6_RENDER_CMD(3D, 3DSTATE_BINDING_TABLE_POINTERS) |
Chia-I Wu42a56202014-08-23 16:47:48 +0800498 GEN6_PTR_BINDING_TABLE_DW0_VS_CHANGED |
499 GEN6_PTR_BINDING_TABLE_DW0_GS_CHANGED |
500 GEN6_PTR_BINDING_TABLE_DW0_PS_CHANGED |
501 (cmd_len - 2);
502
503 cmd_batch_reserve(cmd, cmd_len);
504 cmd_batch_write(cmd, dw0);
505 cmd_batch_write(cmd, vs_pos << 2);
506 cmd_batch_write(cmd, gs_pos << 2);
507 cmd_batch_write(cmd, ps_pos << 2);
508}
509
Chia-I Wu302742d2014-08-22 10:28:29 +0800510static void gen7_3dstate_pointer(struct intel_cmd *cmd,
511 int subop, XGL_UINT pos)
512{
513 const uint8_t cmd_len = 2;
514 const uint32_t dw0 = GEN6_RENDER_TYPE_RENDER |
515 GEN6_RENDER_SUBTYPE_3D |
516 subop | (cmd_len - 2);
517
518 cmd_batch_reserve(cmd, cmd_len);
519 cmd_batch_write(cmd, dw0);
520 cmd_batch_write(cmd, pos << 2);
521}
522
523static XGL_UINT gen6_BLEND_STATE(struct intel_cmd *cmd,
524 const struct intel_blend_state *state)
525{
526 const uint8_t cmd_align = GEN6_ALIGNMENT_BLEND_STATE;
527 const uint8_t cmd_len = XGL_MAX_COLOR_ATTACHMENTS * 2;
528
529 CMD_ASSERT(cmd, 6, 7.5);
530 STATIC_ASSERT(ARRAY_SIZE(state->cmd) >= cmd_len);
531
532 return cmd_state_copy(cmd, state->cmd, cmd_len, cmd_align);
533}
534
535static XGL_UINT gen6_DEPTH_STENCIL_STATE(struct intel_cmd *cmd,
536 const struct intel_ds_state *state)
537{
538 const uint8_t cmd_align = GEN6_ALIGNMENT_DEPTH_STENCIL_STATE;
539 const uint8_t cmd_len = 3;
540
541 CMD_ASSERT(cmd, 6, 7.5);
542 STATIC_ASSERT(ARRAY_SIZE(state->cmd) >= cmd_len);
543
544 return cmd_state_copy(cmd, state->cmd, cmd_len, cmd_align);
545}
546
547static XGL_UINT gen6_COLOR_CALC_STATE(struct intel_cmd *cmd,
548 uint32_t stencil_ref,
549 const uint32_t blend_color[4])
550{
551 const uint8_t cmd_align = GEN6_ALIGNMENT_COLOR_CALC_STATE;
552 const uint8_t cmd_len = 6;
553 XGL_UINT pos;
554 uint32_t *dw;
555
556 CMD_ASSERT(cmd, 6, 7.5);
557
558 dw = cmd_state_reserve(cmd, cmd_len, cmd_align, &pos);
559 dw[0] = stencil_ref;
560 dw[1] = 0;
561 dw[2] = blend_color[0];
562 dw[3] = blend_color[1];
563 dw[4] = blend_color[2];
564 dw[5] = blend_color[3];
565 cmd_state_advance(cmd, cmd_len);
566
567 return pos;
568}
569
Chia-I Wu48c283d2014-08-25 23:13:46 +0800570static void gen6_wa_post_sync_flush(struct intel_cmd *cmd)
571{
Chia-I Wu707a29e2014-08-27 12:51:47 +0800572 if (!cmd->bind.draw_count)
573 return;
574
Chia-I Wu48c283d2014-08-25 23:13:46 +0800575 if (cmd->bind.wa_flags & GEN6_WA_POST_SYNC_FLUSH)
576 return;
577
578 CMD_ASSERT(cmd, 6, 7.5);
579
580 cmd->bind.wa_flags |= GEN6_WA_POST_SYNC_FLUSH;
581
582 /*
583 * From the Sandy Bridge PRM, volume 2 part 1, page 60:
584 *
585 * "Pipe-control with CS-stall bit set must be sent BEFORE the
586 * pipe-control with a post-sync op and no write-cache flushes."
587 *
588 * The workaround below necessitates this workaround.
589 */
590 gen6_PIPE_CONTROL(cmd,
591 GEN6_PIPE_CONTROL_CS_STALL |
592 GEN6_PIPE_CONTROL_PIXEL_SCOREBOARD_STALL,
593 NULL, 0);
594
595 /*
596 * From the Sandy Bridge PRM, volume 2 part 1, page 60:
597 *
598 * "Before any depth stall flush (including those produced by
599 * non-pipelined state commands), software needs to first send a
600 * PIPE_CONTROL with no bits set except Post-Sync Operation != 0."
601 *
602 * "Before a PIPE_CONTROL with Write Cache Flush Enable =1, a
603 * PIPE_CONTROL with any non-zero post-sync-op is required."
604 */
605 gen6_PIPE_CONTROL(cmd, GEN6_PIPE_CONTROL_WRITE_IMM, cmd->scratch_bo, 0);
606}
607
Courtney Goeltzenleuchterf9e1a412014-08-27 13:59:36 -0600608static void gen6_wa_wm_multisample_flush(struct intel_cmd *cmd)
609{
Chia-I Wu9cb84ee2014-08-28 10:12:34 +0800610 if (!cmd->bind.draw_count)
611 return;
612
Courtney Goeltzenleuchterf9e1a412014-08-27 13:59:36 -0600613 CMD_ASSERT(cmd, 6, 6);
614
615 gen6_wa_post_sync_flush(cmd);
616
617 /*
618 * From the Sandy Bridge PRM, volume 2 part 1, page 305:
619 *
620 * "Driver must guarentee that all the caches in the depth pipe are
621 * flushed before this command (3DSTATE_MULTISAMPLE) is parsed. This
622 * requires driver to send a PIPE_CONTROL with a CS stall along with a
623 * Depth Flush prior to this command."
624 */
625 gen6_PIPE_CONTROL(cmd,
626 GEN6_PIPE_CONTROL_DEPTH_CACHE_FLUSH |
627 GEN6_PIPE_CONTROL_CS_STALL,
628 0, 0);
629}
630
Chia-I Wu48c283d2014-08-25 23:13:46 +0800631static void gen6_wa_ds_flush(struct intel_cmd *cmd)
632{
Chia-I Wu707a29e2014-08-27 12:51:47 +0800633 if (!cmd->bind.draw_count)
634 return;
635
Chia-I Wu48c283d2014-08-25 23:13:46 +0800636 CMD_ASSERT(cmd, 6, 7.5);
637
Chia-I Wu48c283d2014-08-25 23:13:46 +0800638 gen6_wa_post_sync_flush(cmd);
639
640 gen6_PIPE_CONTROL(cmd, GEN6_PIPE_CONTROL_DEPTH_STALL, NULL, 0);
641 gen6_PIPE_CONTROL(cmd, GEN6_PIPE_CONTROL_DEPTH_CACHE_FLUSH, NULL, 0);
642 gen6_PIPE_CONTROL(cmd, GEN6_PIPE_CONTROL_DEPTH_STALL, NULL, 0);
643}
644
Chia-I Wu525c6602014-08-27 10:22:34 +0800645void cmd_batch_flush(struct intel_cmd *cmd, uint32_t pipe_control_dw0)
646{
647 if (!cmd->bind.draw_count)
648 return;
649
650 assert(!(pipe_control_dw0 & GEN6_PIPE_CONTROL_WRITE__MASK));
651
652 if (pipe_control_dw0 & GEN6_PIPE_CONTROL_RENDER_CACHE_FLUSH)
653 gen6_wa_post_sync_flush(cmd);
654
655 gen6_PIPE_CONTROL(cmd, pipe_control_dw0, NULL, 0);
656}
657
Chia-I Wu302742d2014-08-22 10:28:29 +0800658static void gen6_cc_states(struct intel_cmd *cmd)
659{
660 const struct intel_blend_state *blend = cmd->bind.state.blend;
661 const struct intel_ds_state *ds = cmd->bind.state.ds;
662 XGL_UINT blend_pos, ds_pos, cc_pos;
Chia-I Wuce9f11f2014-08-22 10:38:51 +0800663 uint32_t stencil_ref;
664 uint32_t blend_color[4];
Chia-I Wu302742d2014-08-22 10:28:29 +0800665
666 CMD_ASSERT(cmd, 6, 6);
667
Chia-I Wuce9f11f2014-08-22 10:38:51 +0800668 if (blend) {
669 blend_pos = gen6_BLEND_STATE(cmd, blend);
670 memcpy(blend_color, blend->cmd_blend_color, sizeof(blend_color));
671 } else {
672 blend_pos = 0;
673 memset(blend_color, 0, sizeof(blend_color));
674 }
675
676 if (ds) {
677 ds_pos = gen6_DEPTH_STENCIL_STATE(cmd, ds);
678 stencil_ref = ds->cmd_stencil_ref;
679 } else {
680 ds_pos = 0;
681 stencil_ref = 0;
682 }
683
684 cc_pos = gen6_COLOR_CALC_STATE(cmd, stencil_ref, blend_color);
Chia-I Wu302742d2014-08-22 10:28:29 +0800685
686 gen6_3DSTATE_CC_STATE_POINTERS(cmd, blend_pos, ds_pos, cc_pos);
687}
688
Chia-I Wu1744cca2014-08-22 11:10:17 +0800689static void gen6_viewport_states(struct intel_cmd *cmd)
690{
691 const struct intel_viewport_state *viewport = cmd->bind.state.viewport;
692 XGL_UINT pos;
693
694 if (!viewport)
695 return;
696
697 pos = cmd_state_copy(cmd, viewport->cmd, viewport->cmd_len,
698 viewport->cmd_align);
699
700 gen6_3DSTATE_VIEWPORT_STATE_POINTERS(cmd,
701 pos + viewport->cmd_clip_offset,
702 pos,
703 pos + viewport->cmd_cc_offset);
704
705 pos = (viewport->scissor_enable) ?
706 pos + viewport->cmd_scissor_rect_offset : 0;
707
708 gen6_3DSTATE_SCISSOR_STATE_POINTERS(cmd, pos);
709}
710
Chia-I Wu302742d2014-08-22 10:28:29 +0800711static void gen7_cc_states(struct intel_cmd *cmd)
712{
713 const struct intel_blend_state *blend = cmd->bind.state.blend;
714 const struct intel_ds_state *ds = cmd->bind.state.ds;
Chia-I Wuce9f11f2014-08-22 10:38:51 +0800715 uint32_t stencil_ref;
716 uint32_t blend_color[4];
Chia-I Wu302742d2014-08-22 10:28:29 +0800717 XGL_UINT pos;
718
719 CMD_ASSERT(cmd, 7, 7.5);
720
Chia-I Wuce9f11f2014-08-22 10:38:51 +0800721 if (!blend && !ds)
722 return;
Chia-I Wu302742d2014-08-22 10:28:29 +0800723
Chia-I Wuce9f11f2014-08-22 10:38:51 +0800724 if (blend) {
725 pos = gen6_BLEND_STATE(cmd, blend);
726 gen7_3dstate_pointer(cmd,
727 GEN7_RENDER_OPCODE_3DSTATE_BLEND_STATE_POINTERS, pos);
Chia-I Wu302742d2014-08-22 10:28:29 +0800728
Chia-I Wuce9f11f2014-08-22 10:38:51 +0800729 memcpy(blend_color, blend->cmd_blend_color, sizeof(blend_color));
730 } else {
731 memset(blend_color, 0, sizeof(blend_color));
732 }
733
734 if (ds) {
735 pos = gen6_DEPTH_STENCIL_STATE(cmd, ds);
736 gen7_3dstate_pointer(cmd,
737 GEN7_RENDER_OPCODE_3DSTATE_DEPTH_STENCIL_STATE_POINTERS, pos);
738 } else {
739 stencil_ref = 0;
740 }
741
742 pos = gen6_COLOR_CALC_STATE(cmd, stencil_ref, blend_color);
Chia-I Wu302742d2014-08-22 10:28:29 +0800743 gen7_3dstate_pointer(cmd,
744 GEN6_RENDER_OPCODE_3DSTATE_CC_STATE_POINTERS, pos);
745}
746
Chia-I Wu1744cca2014-08-22 11:10:17 +0800747static void gen7_viewport_states(struct intel_cmd *cmd)
748{
749 const struct intel_viewport_state *viewport = cmd->bind.state.viewport;
750 XGL_UINT pos;
751
752 if (!viewport)
753 return;
754
755 pos = cmd_state_copy(cmd, viewport->cmd, viewport->cmd_len,
756 viewport->cmd_align);
757
758 gen7_3dstate_pointer(cmd,
759 GEN7_RENDER_OPCODE_3DSTATE_VIEWPORT_STATE_POINTERS_SF_CLIP, pos);
760 gen7_3dstate_pointer(cmd,
761 GEN7_RENDER_OPCODE_3DSTATE_VIEWPORT_STATE_POINTERS_CC,
762 pos + viewport->cmd_cc_offset);
763 if (viewport->scissor_enable) {
764 gen7_3dstate_pointer(cmd,
765 GEN6_RENDER_OPCODE_3DSTATE_SCISSOR_STATE_POINTERS,
766 pos + viewport->cmd_scissor_rect_offset);
767 }
768}
769
Chia-I Wu7fd5cac2014-08-27 13:19:29 +0800770static void gen6_pcb(struct intel_cmd *cmd, int subop,
771 const XGL_PIPELINE_SHADER *sh)
772{
773 const uint8_t cmd_len = 5;
774 const XGL_UINT alignment = 32;
775 const XGL_UINT max_size =
776 (subop == GEN6_RENDER_OPCODE_3DSTATE_CONSTANT_VS) ? 1024 : 2048;
777 const XGL_UINT max_pcb = 4;
778 uint32_t pcb[4] = { 0, 0, 0, 0 };
779 XGL_FLAGS pcb_enables = 0;
780 XGL_SIZE total_size = 0;
781 uint32_t dw0;
782 XGL_UINT i;
783
784 for (i = 0; i < sh->linkConstBufferCount; i++) {
785 const XGL_LINK_CONST_BUFFER *info = &sh->pLinkConstBufferInfo[i];
786 const XGL_SIZE size = u_align(info->bufferSize, alignment);
787 void *ptr;
788
789 if (info->bufferId >= max_pcb ||
790 pcb_enables & ((1 << info->bufferId)) ||
791 total_size + info->bufferSize > max_size) {
792 cmd->result = XGL_ERROR_UNKNOWN;
793 return;
794 }
795 if (!size)
796 continue;
797
798 pcb_enables |= 1 << info->bufferId;
799 total_size += size;
800
801 ptr = cmd_state_reserve(cmd, size / sizeof(uint32_t),
802 alignment / sizeof(uint32_t), &pcb[info->bufferId]);
803 memcpy(ptr, info->pBufferData, info->bufferSize);
804 cmd_state_advance(cmd, size / sizeof(uint32_t));
805
806 pcb[info->bufferId] |= size / alignment - 1;
807 }
808
809 dw0 = GEN6_RENDER_TYPE_RENDER |
810 GEN6_RENDER_SUBTYPE_3D |
811 subop |
812 pcb_enables << 12 |
813 (cmd_len - 2);
814
815 cmd_batch_reserve(cmd, cmd_len);
816 cmd_batch_write(cmd, dw0);
817 cmd_batch_write(cmd, pcb[0]);
818 cmd_batch_write(cmd, pcb[1]);
819 cmd_batch_write(cmd, pcb[2]);
820 cmd_batch_write(cmd, pcb[3]);
821}
822
823static void gen7_pcb(struct intel_cmd *cmd, int subop,
824 const XGL_PIPELINE_SHADER *sh)
825{
826 const uint8_t cmd_len = 7;
827 const uint32_t dw0 = GEN6_RENDER_TYPE_RENDER |
828 GEN6_RENDER_SUBTYPE_3D |
829 subop |
830 (cmd_len - 2);
831 const XGL_UINT alignment = 32;
832 const XGL_UINT max_size = 2048;
833 const XGL_UINT max_pcb = 4;
834 uint16_t pcb_len[4] = { 0, 0, 0, 0 };
835 uint32_t pcb[4] = { 0, 0, 0, 0 };
836 XGL_FLAGS pcb_enables = 0;
837 XGL_SIZE total_size = 0;
838 XGL_UINT i;
839
840 for (i = 0; i < sh->linkConstBufferCount; i++) {
841 const XGL_LINK_CONST_BUFFER *info = &sh->pLinkConstBufferInfo[i];
842 const XGL_SIZE size = u_align(info->bufferSize, alignment);
843 void *ptr;
844
845 if (info->bufferId >= max_pcb ||
846 pcb_enables & ((1 << info->bufferId)) ||
847 total_size + info->bufferSize > max_size) {
848 cmd->result = XGL_ERROR_UNKNOWN;
849 return;
850 }
851 if (!size)
852 continue;
853
854 pcb_enables |= 1 << info->bufferId;
855 total_size += size;
856
857 pcb_len[info->bufferId] = size / alignment;
858
859 ptr = cmd_state_reserve(cmd, size / sizeof(uint32_t),
860 alignment / sizeof(uint32_t), &pcb[info->bufferId]);
861 memcpy(ptr, info->pBufferData, info->bufferSize);
862 cmd_state_advance(cmd, size / sizeof(uint32_t));
863 }
864
865 /* no holes */
866 if (!u_is_pow2(pcb_enables + 1)) {
867 cmd->result = XGL_ERROR_UNKNOWN;
868 return;
869 }
870
871 cmd_batch_reserve(cmd, cmd_len);
872 cmd_batch_write(cmd, dw0);
873 cmd_batch_write(cmd, pcb_len[1] << 16 | pcb_len[0]);
874 cmd_batch_write(cmd, pcb_len[3] << 16 | pcb_len[2]);
875 cmd_batch_write(cmd, pcb[0]);
876 cmd_batch_write(cmd, pcb[1]);
877 cmd_batch_write(cmd, pcb[2]);
878 cmd_batch_write(cmd, pcb[3]);
879}
880
Chia-I Wu42a56202014-08-23 16:47:48 +0800881static void emit_ps_resources(struct intel_cmd *cmd,
882 const struct intel_rmap *rmap)
883{
884 const XGL_UINT surface_count = rmap->rt_count +
885 rmap->resource_count + rmap->uav_count;
886 uint32_t binding_table[256];
887 XGL_UINT pos, i;
888
889 assert(surface_count <= ARRAY_SIZE(binding_table));
890
891 for (i = 0; i < surface_count; i++) {
892 const struct intel_rmap_slot *slot = &rmap->slots[i];
893 uint32_t *dw;
894
895 switch (slot->path_len) {
896 case 0:
897 pos = 0;
898 break;
899 case INTEL_RMAP_SLOT_RT:
900 {
901 const struct intel_rt_view *view = cmd->bind.att.rt[i];
902
903 dw = cmd_state_reserve_reloc(cmd, view->cmd_len, 1,
904 GEN6_ALIGNMENT_SURFACE_STATE, &pos);
905
906 memcpy(dw, view->cmd, sizeof(uint32_t) * view->cmd_len);
Chia-I Wubda55fd2014-08-25 12:46:10 +0800907 cmd_state_reloc(cmd, 1, view->cmd[1], view->img->obj.mem->bo,
Chia-I Wu32a22462014-08-26 14:13:46 +0800908 INTEL_RELOC_WRITE);
Chia-I Wu42a56202014-08-23 16:47:48 +0800909 cmd_state_advance(cmd, view->cmd_len);
910 }
911 break;
912 case INTEL_RMAP_SLOT_DYN:
913 {
914 const struct intel_mem_view *view =
Chia-I Wu9f1722c2014-08-25 10:17:58 +0800915 &cmd->bind.dyn_view.graphics;
Chia-I Wu42a56202014-08-23 16:47:48 +0800916
917 dw = cmd_state_reserve_reloc(cmd, view->cmd_len, 1,
918 GEN6_ALIGNMENT_SURFACE_STATE, &pos);
919
920 memcpy(dw, view->cmd, sizeof(uint32_t) * view->cmd_len);
Chia-I Wubda55fd2014-08-25 12:46:10 +0800921 cmd_state_reloc(cmd, 1, view->cmd[1], view->mem->bo,
Chia-I Wu32a22462014-08-26 14:13:46 +0800922 INTEL_RELOC_WRITE);
Chia-I Wu42a56202014-08-23 16:47:48 +0800923 cmd_state_advance(cmd, view->cmd_len);
924 }
925 break;
926 case 1:
927 default:
928 /* TODO */
929 assert(!"no dset support");
930 break;
931 }
932
933 binding_table[i] = pos << 2;
934 }
935
936 pos = cmd_state_copy(cmd, binding_table, surface_count,
937 GEN6_ALIGNMENT_BINDING_TABLE_STATE);
938
939 if (cmd_gen(cmd) >= INTEL_GEN(7)) {
940 gen7_3dstate_pointer(cmd,
941 GEN7_RENDER_OPCODE_3DSTATE_BINDING_TABLE_POINTERS_PS, pos);
942 } else {
943 gen6_3DSTATE_BINDING_TABLE_POINTERS(cmd, 0, 0, pos);
944 }
945}
946
Chia-I Wu52500102014-08-22 00:46:04 +0800947static void emit_bounded_states(struct intel_cmd *cmd)
948{
949 const struct intel_msaa_state *msaa = cmd->bind.state.msaa;
950
951 /* TODO more states */
952
Chia-I Wu1744cca2014-08-22 11:10:17 +0800953 if (cmd_gen(cmd) >= INTEL_GEN(7)) {
Chia-I Wu302742d2014-08-22 10:28:29 +0800954 gen7_cc_states(cmd);
Chia-I Wu1744cca2014-08-22 11:10:17 +0800955 gen7_viewport_states(cmd);
Chia-I Wu7fd5cac2014-08-27 13:19:29 +0800956
957 gen7_pcb(cmd, GEN6_RENDER_OPCODE_3DSTATE_CONSTANT_VS,
958 &cmd->bind.pipeline.graphics->vs);
959 gen7_pcb(cmd, GEN6_RENDER_OPCODE_3DSTATE_CONSTANT_PS,
960 &cmd->bind.pipeline.graphics->fs);
Chia-I Wu1744cca2014-08-22 11:10:17 +0800961 } else {
Chia-I Wu302742d2014-08-22 10:28:29 +0800962 gen6_cc_states(cmd);
Chia-I Wu1744cca2014-08-22 11:10:17 +0800963 gen6_viewport_states(cmd);
Chia-I Wu7fd5cac2014-08-27 13:19:29 +0800964
965 gen6_pcb(cmd, GEN6_RENDER_OPCODE_3DSTATE_CONSTANT_VS,
966 &cmd->bind.pipeline.graphics->vs);
967 gen6_pcb(cmd, GEN6_RENDER_OPCODE_3DSTATE_CONSTANT_PS,
968 &cmd->bind.pipeline.graphics->fs);
Chia-I Wu1744cca2014-08-22 11:10:17 +0800969 }
Chia-I Wu302742d2014-08-22 10:28:29 +0800970
Chia-I Wu42a56202014-08-23 16:47:48 +0800971 emit_ps_resources(cmd, cmd->bind.pipeline.graphics->fs_rmap);
972
Chia-I Wu48c283d2014-08-25 23:13:46 +0800973 gen6_wa_post_sync_flush(cmd);
Chia-I Wu9cb84ee2014-08-28 10:12:34 +0800974 /* need multisample flush on gen6 */
975 if (cmd_gen(cmd) == INTEL_GEN(6))
976 gen6_wa_wm_multisample_flush(cmd);
977 /* 3DSTATE_MULTISAMPLE and 3DSTATE_SAMPLE_MASK */
Chia-I Wu52500102014-08-22 00:46:04 +0800978 cmd_batch_reserve(cmd, msaa->cmd_len);
979 cmd_batch_write_n(cmd, msaa->cmd, msaa->cmd_len);
Courtney Goeltzenleuchterd85c1d62014-08-27 14:04:53 -0600980
981 /* 3DSTATE_CONSTANT_GS */
982 if (cmd->bind.pipeline.graphics->active_shaders & SHADER_GEOMETRY_FLAG) {
983
984 } else {
985
986 }
987}
988
989void cmd_clear_shader_cache(struct intel_cmd *cmd)
990{
991 uint32_t i;
992 struct intel_cmd_shader *cmdShader;
993
994 for (i=0; i<cmd->bind.shaderCache.used; i++) {
995 cmdShader = &cmd->bind.shaderCache.shaderList[i];
996 cmdShader->shader = NULL;
997 }
998 cmd->bind.shaderCache.used = 0;
999}
1000
1001static void emit_shader(struct intel_cmd *cmd,
1002 struct intel_pipe_shader *shader)
1003{
1004 uint32_t i;
1005 struct intel_cmd_shader *cmdShader;
1006
1007 for (i=0; i<cmd->bind.shaderCache.used; i++) {
1008 if (cmd->bind.shaderCache.shaderList[i].shader == shader) {
1009 /* shader is already part of pipeline */
1010 return;
1011 }
1012 }
1013
1014 if (cmd->bind.shaderCache.used == cmd->bind.shaderCache.size) {
1015 cmdShader = &cmd->bind.shaderCache.shaderList[0];
1016 cmd->bind.shaderCache.size += 16;
1017 cmd->bind.shaderCache.shaderList = icd_alloc(sizeof(struct intel_shader) * cmd->bind.shaderCache.size,
1018 sizeof(struct intel_shader *),
1019 XGL_SYSTEM_ALLOC_INTERNAL_SHADER);
1020 if (cmd->bind.shaderCache.shaderList == NULL) {
1021 cmd->bind.shaderCache.shaderList = cmdShader;
1022 cmd->result = XGL_ERROR_OUT_OF_MEMORY;
1023 return;
1024 }
1025 memcpy(cmd->bind.shaderCache.shaderList,
1026 cmdShader,
1027 sizeof(struct intel_cmd_shader) * cmd->bind.shaderCache.used);
1028 icd_free(cmdShader);
1029 }
1030
1031 cmdShader = &cmd->bind.shaderCache.shaderList[cmd->bind.shaderCache.used];
1032 cmdShader->shader = shader;
1033 cmdShader->kernel_pos = cmd_kernel_copy(cmd, shader->pCode, shader->codeSize);
1034 cmd->bind.shaderCache.used++;
1035 return;
1036}
1037
1038static void emit_pipeline_state(struct intel_cmd *cmd,
1039 const struct intel_pipeline *pipeline)
1040{
1041 if (cmd_gen(cmd) >= INTEL_GEN(7.5)) {
1042
1043 }
1044
Chia-I Wu52500102014-08-22 00:46:04 +08001045}
1046
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001047static void cmd_bind_graphics_pipeline(struct intel_cmd *cmd,
Courtney Goeltzenleuchterd85c1d62014-08-27 14:04:53 -06001048 struct intel_pipeline *pipeline)
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001049{
1050 cmd->bind.pipeline.graphics = pipeline;
Courtney Goeltzenleuchterd85c1d62014-08-27 14:04:53 -06001051 if (pipeline->active_shaders & SHADER_VERTEX_FLAG) {
1052 emit_shader(cmd, &pipeline->intel_vs);
1053 }
1054 if (pipeline->active_shaders & SHADER_GEOMETRY_FLAG) {
1055 emit_shader(cmd, &pipeline->gs);
1056 }
1057 if (pipeline->active_shaders & SHADER_FRAGMENT_FLAG) {
1058 emit_shader(cmd, &pipeline->intel_fs);
1059 }
1060 if (pipeline->active_shaders & SHADER_TESS_CONTROL_FLAG) {
1061 emit_shader(cmd, &pipeline->tess_control);
1062 }
1063 if (pipeline->active_shaders & SHADER_TESS_EVAL_FLAG) {
1064 emit_shader(cmd, &pipeline->tess_eval);
1065 }
1066
1067 emit_pipeline_state(cmd, pipeline);
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001068}
1069
1070static void cmd_bind_compute_pipeline(struct intel_cmd *cmd,
1071 const struct intel_pipeline *pipeline)
1072{
1073 cmd->bind.pipeline.compute = pipeline;
1074}
1075
1076static void cmd_bind_graphics_delta(struct intel_cmd *cmd,
1077 const struct intel_pipeline_delta *delta)
1078{
1079 cmd->bind.pipeline.graphics_delta = delta;
1080}
1081
1082static void cmd_bind_compute_delta(struct intel_cmd *cmd,
1083 const struct intel_pipeline_delta *delta)
1084{
1085 cmd->bind.pipeline.compute_delta = delta;
1086}
1087
1088static void cmd_bind_graphics_dset(struct intel_cmd *cmd,
1089 const struct intel_dset *dset,
1090 XGL_UINT slot_offset)
1091{
1092 cmd->bind.dset.graphics = dset;
1093 cmd->bind.dset.graphics_offset = slot_offset;
1094}
1095
1096static void cmd_bind_compute_dset(struct intel_cmd *cmd,
1097 const struct intel_dset *dset,
1098 XGL_UINT slot_offset)
1099{
1100 cmd->bind.dset.compute = dset;
1101 cmd->bind.dset.compute_offset = slot_offset;
1102}
1103
1104static void cmd_bind_graphics_dyn_view(struct intel_cmd *cmd,
1105 const XGL_MEMORY_VIEW_ATTACH_INFO *info)
1106{
1107 intel_mem_view_init(&cmd->bind.dyn_view.graphics, cmd->dev, info);
1108}
1109
1110static void cmd_bind_compute_dyn_view(struct intel_cmd *cmd,
1111 const XGL_MEMORY_VIEW_ATTACH_INFO *info)
1112{
1113 intel_mem_view_init(&cmd->bind.dyn_view.compute, cmd->dev, info);
1114}
1115
1116static void cmd_bind_index_data(struct intel_cmd *cmd,
1117 const struct intel_mem *mem,
1118 XGL_GPU_SIZE offset, XGL_INDEX_TYPE type)
1119{
1120 if (cmd_gen(cmd) >= INTEL_GEN(7.5)) {
1121 gen6_3DSTATE_INDEX_BUFFER(cmd, mem, offset, type, false);
1122 } else {
1123 cmd->bind.index.mem = mem;
1124 cmd->bind.index.offset = offset;
1125 cmd->bind.index.type = type;
1126 }
1127}
1128
1129static void cmd_bind_rt(struct intel_cmd *cmd,
1130 const XGL_COLOR_ATTACHMENT_BIND_INFO *attachments,
1131 XGL_UINT count)
1132{
Chia-I Wud88e02d2014-08-25 10:56:13 +08001133 XGL_UINT width = 0, height = 0;
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001134 XGL_UINT i;
1135
1136 for (i = 0; i < count; i++) {
1137 const XGL_COLOR_ATTACHMENT_BIND_INFO *att = &attachments[i];
1138 const struct intel_rt_view *rt = intel_rt_view(att->view);
Chia-I Wud88e02d2014-08-25 10:56:13 +08001139 const struct intel_layout *layout = &rt->img->layout;
1140
1141 if (i == 0) {
1142 width = layout->width0;
1143 height = layout->height0;
1144 } else {
1145 if (width > layout->width0)
1146 width = layout->width0;
1147 if (height > layout->height0)
1148 height = layout->height0;
1149 }
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001150
1151 cmd->bind.att.rt[i] = rt;
1152 }
1153
1154 cmd->bind.att.rt_count = count;
Chia-I Wud88e02d2014-08-25 10:56:13 +08001155
Chia-I Wu48c283d2014-08-25 23:13:46 +08001156 gen6_wa_post_sync_flush(cmd);
Chia-I Wud88e02d2014-08-25 10:56:13 +08001157 gen6_3DSTATE_DRAWING_RECTANGLE(cmd, width, height);
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001158}
1159
1160static void cmd_bind_ds(struct intel_cmd *cmd,
1161 const XGL_DEPTH_STENCIL_BIND_INFO *info)
1162{
1163 const struct intel_ds_view *ds;
1164
1165 if (info) {
1166 cmd->bind.att.ds = intel_ds_view(info->view);
1167 ds = cmd->bind.att.ds;
1168 } else {
1169 /* all zeros */
1170 static const struct intel_ds_view null_ds;
1171 ds = &null_ds;
1172 }
1173
Chia-I Wu48c283d2014-08-25 23:13:46 +08001174 gen6_wa_ds_flush(cmd);
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001175 gen6_3DSTATE_DEPTH_BUFFER(cmd, ds);
1176 gen6_3DSTATE_STENCIL_BUFFER(cmd, ds);
1177 gen6_3DSTATE_HIER_DEPTH_BUFFER(cmd, ds);
Chia-I Wuf8231032014-08-25 10:44:45 +08001178
1179 if (cmd_gen(cmd) >= INTEL_GEN(7))
1180 gen7_3DSTATE_CLEAR_PARAMS(cmd, 0);
1181 else
1182 gen6_3DSTATE_CLEAR_PARAMS(cmd, 0);
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001183}
1184
1185static void cmd_bind_viewport_state(struct intel_cmd *cmd,
1186 const struct intel_viewport_state *state)
1187{
1188 cmd->bind.state.viewport = state;
1189}
1190
1191static void cmd_bind_raster_state(struct intel_cmd *cmd,
1192 const struct intel_raster_state *state)
1193{
1194 cmd->bind.state.raster = state;
1195}
1196
1197static void cmd_bind_ds_state(struct intel_cmd *cmd,
1198 const struct intel_ds_state *state)
1199{
1200 cmd->bind.state.ds = state;
1201}
1202
1203static void cmd_bind_blend_state(struct intel_cmd *cmd,
1204 const struct intel_blend_state *state)
1205{
1206 cmd->bind.state.blend = state;
1207}
1208
1209static void cmd_bind_msaa_state(struct intel_cmd *cmd,
1210 const struct intel_msaa_state *state)
1211{
1212 cmd->bind.state.msaa = state;
1213}
1214
1215static void cmd_draw(struct intel_cmd *cmd,
1216 XGL_UINT vertex_start,
1217 XGL_UINT vertex_count,
1218 XGL_UINT instance_start,
1219 XGL_UINT instance_count,
1220 bool indexed,
1221 XGL_UINT vertex_base)
1222{
1223 const struct intel_pipeline *p = cmd->bind.pipeline.graphics;
1224
1225 emit_bounded_states(cmd);
1226
1227 if (indexed) {
1228 if (p->primitive_restart && !gen6_can_primitive_restart(cmd))
1229 cmd->result = XGL_ERROR_UNKNOWN;
1230
1231 if (cmd_gen(cmd) >= INTEL_GEN(7.5)) {
1232 gen75_3DSTATE_VF(cmd, p->primitive_restart,
1233 p->primitive_restart_index);
1234 } else {
1235 gen6_3DSTATE_INDEX_BUFFER(cmd, cmd->bind.index.mem,
1236 cmd->bind.index.offset, cmd->bind.index.type,
1237 p->primitive_restart);
1238 }
1239 } else {
1240 assert(!vertex_base);
1241 }
1242
1243 if (cmd_gen(cmd) >= INTEL_GEN(7)) {
1244 gen7_3DPRIMITIVE(cmd, p->prim_type, indexed, vertex_count,
1245 vertex_start, instance_count, instance_start, vertex_base);
1246 } else {
1247 gen6_3DPRIMITIVE(cmd, p->prim_type, indexed, vertex_count,
1248 vertex_start, instance_count, instance_start, vertex_base);
1249 }
Chia-I Wu48c283d2014-08-25 23:13:46 +08001250
Chia-I Wu707a29e2014-08-27 12:51:47 +08001251 cmd->bind.draw_count++;
Chia-I Wu48c283d2014-08-25 23:13:46 +08001252 /* need to re-emit all workarounds */
1253 cmd->bind.wa_flags = 0;
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001254}
1255
Chia-I Wub2755562014-08-20 13:38:52 +08001256XGL_VOID XGLAPI intelCmdBindPipeline(
1257 XGL_CMD_BUFFER cmdBuffer,
1258 XGL_PIPELINE_BIND_POINT pipelineBindPoint,
1259 XGL_PIPELINE pipeline)
1260{
1261 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
1262
1263 switch (pipelineBindPoint) {
1264 case XGL_PIPELINE_BIND_POINT_COMPUTE:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001265 cmd_bind_compute_pipeline(cmd, intel_pipeline(pipeline));
Chia-I Wub2755562014-08-20 13:38:52 +08001266 break;
1267 case XGL_PIPELINE_BIND_POINT_GRAPHICS:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001268 cmd_bind_graphics_pipeline(cmd, intel_pipeline(pipeline));
Chia-I Wub2755562014-08-20 13:38:52 +08001269 break;
1270 default:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001271 cmd->result = XGL_ERROR_INVALID_VALUE;
Chia-I Wub2755562014-08-20 13:38:52 +08001272 break;
1273 }
1274}
1275
1276XGL_VOID XGLAPI intelCmdBindPipelineDelta(
1277 XGL_CMD_BUFFER cmdBuffer,
1278 XGL_PIPELINE_BIND_POINT pipelineBindPoint,
1279 XGL_PIPELINE_DELTA delta)
1280{
1281 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
1282
1283 switch (pipelineBindPoint) {
1284 case XGL_PIPELINE_BIND_POINT_COMPUTE:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001285 cmd_bind_compute_delta(cmd, delta);
Chia-I Wub2755562014-08-20 13:38:52 +08001286 break;
1287 case XGL_PIPELINE_BIND_POINT_GRAPHICS:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001288 cmd_bind_graphics_delta(cmd, delta);
Chia-I Wub2755562014-08-20 13:38:52 +08001289 break;
1290 default:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001291 cmd->result = XGL_ERROR_INVALID_VALUE;
Chia-I Wub2755562014-08-20 13:38:52 +08001292 break;
1293 }
1294}
1295
1296XGL_VOID XGLAPI intelCmdBindStateObject(
1297 XGL_CMD_BUFFER cmdBuffer,
1298 XGL_STATE_BIND_POINT stateBindPoint,
1299 XGL_STATE_OBJECT state)
1300{
1301 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
1302
1303 switch (stateBindPoint) {
1304 case XGL_STATE_BIND_VIEWPORT:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001305 cmd_bind_viewport_state(cmd,
1306 intel_viewport_state((XGL_VIEWPORT_STATE_OBJECT) state));
Chia-I Wub2755562014-08-20 13:38:52 +08001307 break;
1308 case XGL_STATE_BIND_RASTER:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001309 cmd_bind_raster_state(cmd,
1310 intel_raster_state((XGL_RASTER_STATE_OBJECT) state));
Chia-I Wub2755562014-08-20 13:38:52 +08001311 break;
1312 case XGL_STATE_BIND_DEPTH_STENCIL:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001313 cmd_bind_ds_state(cmd,
1314 intel_ds_state((XGL_DEPTH_STENCIL_STATE_OBJECT) state));
Chia-I Wub2755562014-08-20 13:38:52 +08001315 break;
1316 case XGL_STATE_BIND_COLOR_BLEND:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001317 cmd_bind_blend_state(cmd,
1318 intel_blend_state((XGL_COLOR_BLEND_STATE_OBJECT) state));
Chia-I Wub2755562014-08-20 13:38:52 +08001319 break;
1320 case XGL_STATE_BIND_MSAA:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001321 cmd_bind_msaa_state(cmd,
1322 intel_msaa_state((XGL_MSAA_STATE_OBJECT) state));
Chia-I Wub2755562014-08-20 13:38:52 +08001323 break;
1324 default:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001325 cmd->result = XGL_ERROR_INVALID_VALUE;
Chia-I Wub2755562014-08-20 13:38:52 +08001326 break;
1327 }
1328}
1329
1330XGL_VOID XGLAPI intelCmdBindDescriptorSet(
1331 XGL_CMD_BUFFER cmdBuffer,
1332 XGL_PIPELINE_BIND_POINT pipelineBindPoint,
1333 XGL_UINT index,
1334 XGL_DESCRIPTOR_SET descriptorSet,
1335 XGL_UINT slotOffset)
1336{
1337 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
1338 struct intel_dset *dset = intel_dset(descriptorSet);
1339
1340 assert(!index);
1341
1342 switch (pipelineBindPoint) {
1343 case XGL_PIPELINE_BIND_POINT_COMPUTE:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001344 cmd_bind_compute_dset(cmd, dset, slotOffset);
Chia-I Wub2755562014-08-20 13:38:52 +08001345 break;
1346 case XGL_PIPELINE_BIND_POINT_GRAPHICS:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001347 cmd_bind_graphics_dset(cmd, dset, slotOffset);
Chia-I Wub2755562014-08-20 13:38:52 +08001348 break;
1349 default:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001350 cmd->result = XGL_ERROR_INVALID_VALUE;
Chia-I Wub2755562014-08-20 13:38:52 +08001351 break;
1352 }
1353}
1354
1355XGL_VOID XGLAPI intelCmdBindDynamicMemoryView(
1356 XGL_CMD_BUFFER cmdBuffer,
1357 XGL_PIPELINE_BIND_POINT pipelineBindPoint,
1358 const XGL_MEMORY_VIEW_ATTACH_INFO* pMemView)
1359{
1360 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
1361
1362 switch (pipelineBindPoint) {
1363 case XGL_PIPELINE_BIND_POINT_COMPUTE:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001364 cmd_bind_compute_dyn_view(cmd, pMemView);
Chia-I Wub2755562014-08-20 13:38:52 +08001365 break;
1366 case XGL_PIPELINE_BIND_POINT_GRAPHICS:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001367 cmd_bind_graphics_dyn_view(cmd, pMemView);
Chia-I Wub2755562014-08-20 13:38:52 +08001368 break;
1369 default:
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001370 cmd->result = XGL_ERROR_INVALID_VALUE;
Chia-I Wub2755562014-08-20 13:38:52 +08001371 break;
1372 }
1373}
1374
1375XGL_VOID XGLAPI intelCmdBindIndexData(
1376 XGL_CMD_BUFFER cmdBuffer,
1377 XGL_GPU_MEMORY mem_,
1378 XGL_GPU_SIZE offset,
1379 XGL_INDEX_TYPE indexType)
1380{
1381 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
1382 struct intel_mem *mem = intel_mem(mem_);
1383
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001384 cmd_bind_index_data(cmd, mem, offset, indexType);
Chia-I Wub2755562014-08-20 13:38:52 +08001385}
1386
1387XGL_VOID XGLAPI intelCmdBindAttachments(
1388 XGL_CMD_BUFFER cmdBuffer,
1389 XGL_UINT colorAttachmentCount,
1390 const XGL_COLOR_ATTACHMENT_BIND_INFO* pColorAttachments,
1391 const XGL_DEPTH_STENCIL_BIND_INFO* pDepthStencilAttachment)
1392{
1393 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
Chia-I Wub2755562014-08-20 13:38:52 +08001394
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001395 cmd_bind_rt(cmd, pColorAttachments, colorAttachmentCount);
1396 cmd_bind_ds(cmd, pDepthStencilAttachment);
Chia-I Wub2755562014-08-20 13:38:52 +08001397}
1398
1399XGL_VOID XGLAPI intelCmdDraw(
1400 XGL_CMD_BUFFER cmdBuffer,
1401 XGL_UINT firstVertex,
1402 XGL_UINT vertexCount,
1403 XGL_UINT firstInstance,
1404 XGL_UINT instanceCount)
1405{
Chia-I Wu59c097e2014-08-21 10:51:07 +08001406 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
Chia-I Wu59c097e2014-08-21 10:51:07 +08001407
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001408 cmd_draw(cmd, firstVertex, vertexCount,
1409 firstInstance, instanceCount, false, 0);
Chia-I Wub2755562014-08-20 13:38:52 +08001410}
1411
1412XGL_VOID XGLAPI intelCmdDrawIndexed(
1413 XGL_CMD_BUFFER cmdBuffer,
1414 XGL_UINT firstIndex,
1415 XGL_UINT indexCount,
1416 XGL_INT vertexOffset,
1417 XGL_UINT firstInstance,
1418 XGL_UINT instanceCount)
1419{
Chia-I Wu59c097e2014-08-21 10:51:07 +08001420 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
Chia-I Wu59c097e2014-08-21 10:51:07 +08001421
Chia-I Wu9f1722c2014-08-25 10:17:58 +08001422 cmd_draw(cmd, firstIndex, indexCount,
1423 firstInstance, instanceCount, true, vertexOffset);
Chia-I Wub2755562014-08-20 13:38:52 +08001424}
1425
1426XGL_VOID XGLAPI intelCmdDrawIndirect(
1427 XGL_CMD_BUFFER cmdBuffer,
1428 XGL_GPU_MEMORY mem,
1429 XGL_GPU_SIZE offset,
1430 XGL_UINT32 count,
1431 XGL_UINT32 stride)
1432{
Chia-I Wu59c097e2014-08-21 10:51:07 +08001433 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
1434
1435 cmd->result = XGL_ERROR_UNKNOWN;
Chia-I Wub2755562014-08-20 13:38:52 +08001436}
1437
1438XGL_VOID XGLAPI intelCmdDrawIndexedIndirect(
1439 XGL_CMD_BUFFER cmdBuffer,
1440 XGL_GPU_MEMORY mem,
1441 XGL_GPU_SIZE offset,
1442 XGL_UINT32 count,
1443 XGL_UINT32 stride)
1444{
Chia-I Wu59c097e2014-08-21 10:51:07 +08001445 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
1446
1447 cmd->result = XGL_ERROR_UNKNOWN;
Chia-I Wub2755562014-08-20 13:38:52 +08001448}
1449
1450XGL_VOID XGLAPI intelCmdDispatch(
1451 XGL_CMD_BUFFER cmdBuffer,
1452 XGL_UINT x,
1453 XGL_UINT y,
1454 XGL_UINT z)
1455{
Chia-I Wu59c097e2014-08-21 10:51:07 +08001456 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
1457
1458 cmd->result = XGL_ERROR_UNKNOWN;
Chia-I Wub2755562014-08-20 13:38:52 +08001459}
1460
1461XGL_VOID XGLAPI intelCmdDispatchIndirect(
1462 XGL_CMD_BUFFER cmdBuffer,
1463 XGL_GPU_MEMORY mem,
1464 XGL_GPU_SIZE offset)
1465{
Chia-I Wu59c097e2014-08-21 10:51:07 +08001466 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
1467
1468 cmd->result = XGL_ERROR_UNKNOWN;
Chia-I Wub2755562014-08-20 13:38:52 +08001469}