blob: 494ed690334a4167ff742f66d9edac1a557ef65e [file] [log] [blame]
Chia-I Wu09142132014-08-11 15:42:55 +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.
Chia-I Wu44e42362014-09-02 08:32:09 +080023 *
24 * Authors:
25 * Chia-I Wu <olv@lunarg.com>
26 * Courtney Goeltzenleuchter <courtney@lunarg.com>
Chia-I Wu09142132014-08-11 15:42:55 +080027 */
28
Chia-I Wu730e5362014-08-19 12:15:09 +080029#include "genhw/genhw.h"
30#include "kmd/winsys.h"
31#include "dev.h"
Chia-I Wu343b1372014-08-20 16:39:20 +080032#include "mem.h"
Chia-I Wu730e5362014-08-19 12:15:09 +080033#include "obj.h"
Chia-I Wu00a23b22014-08-20 15:28:08 +080034#include "cmd_priv.h"
Jon Ashburnc04b4dc2015-01-08 18:48:10 -070035#include "fb.h"
Chia-I Wu09142132014-08-11 15:42:55 +080036
Chia-I Wu3c3edc02014-09-09 10:32:59 +080037/**
38 * Free all resources used by a writer. Note that the initial size is not
39 * reset.
40 */
41static void cmd_writer_reset(struct intel_cmd *cmd,
42 enum intel_cmd_writer_type which)
Chia-I Wu730e5362014-08-19 12:15:09 +080043{
Chia-I Wu68f319d2014-09-09 09:43:21 +080044 struct intel_cmd_writer *writer = &cmd->writers[which];
Chia-I Wu730e5362014-08-19 12:15:09 +080045
Chia-I Wu3c3edc02014-09-09 10:32:59 +080046 if (writer->ptr) {
47 intel_bo_unmap(writer->bo);
48 writer->ptr = NULL;
Chia-I Wu730e5362014-08-19 12:15:09 +080049 }
50
Chia-I Wu3c3edc02014-09-09 10:32:59 +080051 if (writer->bo) {
52 intel_bo_unreference(writer->bo);
53 writer->bo = NULL;
54 }
55
Chia-I Wue24c3292014-08-21 14:05:23 +080056 writer->used = 0;
Chia-I Wu00b51a82014-09-09 12:07:37 +080057
58 if (writer->items) {
59 icd_free(writer->items);
Courtney Goeltzenleuchter2ba70162014-09-25 18:14:53 -060060 writer->items = NULL;
Chia-I Wu00b51a82014-09-09 12:07:37 +080061 writer->item_alloc = 0;
62 writer->item_used = 0;
63 }
Chia-I Wu3c3edc02014-09-09 10:32:59 +080064}
65
66/**
67 * Discard everything written so far.
68 */
69static void cmd_writer_discard(struct intel_cmd *cmd,
70 enum intel_cmd_writer_type which)
71{
72 struct intel_cmd_writer *writer = &cmd->writers[which];
73
74 intel_bo_truncate_relocs(writer->bo, 0);
75 writer->used = 0;
Chia-I Wu00b51a82014-09-09 12:07:37 +080076 writer->item_used = 0;
Chia-I Wu3c3edc02014-09-09 10:32:59 +080077}
78
79static struct intel_bo *alloc_writer_bo(struct intel_winsys *winsys,
80 enum intel_cmd_writer_type which,
Chia-I Wu72292b72014-09-09 10:48:33 +080081 XGL_SIZE size)
Chia-I Wu3c3edc02014-09-09 10:32:59 +080082{
83 static const char *writer_names[INTEL_CMD_WRITER_COUNT] = {
84 [INTEL_CMD_WRITER_BATCH] = "batch",
85 [INTEL_CMD_WRITER_INSTRUCTION] = "instruction",
86 };
87
Chia-I Wu72292b72014-09-09 10:48:33 +080088 return intel_winsys_alloc_buffer(winsys, writer_names[which], size, true);
Chia-I Wu3c3edc02014-09-09 10:32:59 +080089}
90
91/**
92 * Allocate and map the buffer for writing.
93 */
94static XGL_RESULT cmd_writer_alloc_and_map(struct intel_cmd *cmd,
95 enum intel_cmd_writer_type which)
96{
97 struct intel_cmd_writer *writer = &cmd->writers[which];
98 struct intel_bo *bo;
99
100 bo = alloc_writer_bo(cmd->dev->winsys, which, writer->size);
101 if (bo) {
102 if (writer->bo)
103 intel_bo_unreference(writer->bo);
104 writer->bo = bo;
105 } else if (writer->bo) {
106 /* reuse the old bo */
107 cmd_writer_discard(cmd, which);
108 } else {
109 return XGL_ERROR_OUT_OF_GPU_MEMORY;
110 }
111
112 writer->used = 0;
Chia-I Wu00b51a82014-09-09 12:07:37 +0800113 writer->item_used = 0;
Chia-I Wu3c3edc02014-09-09 10:32:59 +0800114
115 writer->ptr = intel_bo_map(writer->bo, true);
116 if (!writer->ptr)
117 return XGL_ERROR_UNKNOWN;
Chia-I Wu730e5362014-08-19 12:15:09 +0800118
119 return XGL_SUCCESS;
120}
121
Chia-I Wu3c3edc02014-09-09 10:32:59 +0800122/**
123 * Unmap the buffer for submission.
124 */
125static void cmd_writer_unmap(struct intel_cmd *cmd,
126 enum intel_cmd_writer_type which)
Chia-I Wu5e25c272014-08-21 20:19:12 +0800127{
Chia-I Wu68f319d2014-09-09 09:43:21 +0800128 struct intel_cmd_writer *writer = &cmd->writers[which];
129
Chia-I Wu3c3edc02014-09-09 10:32:59 +0800130 intel_bo_unmap(writer->bo);
131 writer->ptr = NULL;
132}
133
134/**
135 * Grow a mapped writer to at least \p new_size. Failures are handled
136 * silently.
137 */
138void cmd_writer_grow(struct intel_cmd *cmd,
139 enum intel_cmd_writer_type which,
Chia-I Wu72292b72014-09-09 10:48:33 +0800140 XGL_SIZE new_size)
Chia-I Wu3c3edc02014-09-09 10:32:59 +0800141{
142 struct intel_cmd_writer *writer = &cmd->writers[which];
143 struct intel_bo *new_bo;
144 void *new_ptr;
145
146 if (new_size < writer->size << 1)
147 new_size = writer->size << 1;
148 /* STATE_BASE_ADDRESS requires page-aligned buffers */
Chia-I Wu72292b72014-09-09 10:48:33 +0800149 new_size = u_align(new_size, 4096);
Chia-I Wu3c3edc02014-09-09 10:32:59 +0800150
151 new_bo = alloc_writer_bo(cmd->dev->winsys, which, new_size);
152 if (!new_bo) {
153 cmd_writer_discard(cmd, which);
154 cmd->result = XGL_ERROR_OUT_OF_GPU_MEMORY;
155 return;
156 }
157
158 /* map and copy the data over */
159 new_ptr = intel_bo_map(new_bo, true);
160 if (!new_ptr) {
161 intel_bo_unreference(new_bo);
162 cmd_writer_discard(cmd, which);
163 cmd->result = XGL_ERROR_UNKNOWN;
164 return;
165 }
166
Chia-I Wu72292b72014-09-09 10:48:33 +0800167 memcpy(new_ptr, writer->ptr, writer->used);
Chia-I Wu3c3edc02014-09-09 10:32:59 +0800168
169 intel_bo_unmap(writer->bo);
170 intel_bo_unreference(writer->bo);
171
172 writer->size = new_size;
173 writer->bo = new_bo;
174 writer->ptr = new_ptr;
Chia-I Wu5e25c272014-08-21 20:19:12 +0800175}
176
Chia-I Wu00b51a82014-09-09 12:07:37 +0800177/**
178 * Record an item for later decoding.
179 */
180void cmd_writer_record(struct intel_cmd *cmd,
181 enum intel_cmd_writer_type which,
182 enum intel_cmd_item_type type,
183 XGL_SIZE offset, XGL_SIZE size)
184{
185 struct intel_cmd_writer *writer = &cmd->writers[which];
186 struct intel_cmd_item *item;
187
188 if (writer->item_used == writer->item_alloc) {
189 const unsigned new_alloc = (writer->item_alloc) ?
190 writer->item_alloc << 1 : 256;
191 struct intel_cmd_item *items;
192
193 items = icd_alloc(sizeof(writer->items[0]) * new_alloc,
194 0, XGL_SYSTEM_ALLOC_DEBUG);
195 if (!items) {
196 writer->item_used = 0;
197 cmd->result = XGL_ERROR_OUT_OF_MEMORY;
198 return;
199 }
200
201 memcpy(items, writer->items,
202 sizeof(writer->items[0]) * writer->item_alloc);
203
204 icd_free(writer->items);
205
206 writer->items = items;
207 writer->item_alloc = new_alloc;
208 }
209
210 item = &writer->items[writer->item_used++];
211 item->type = type;
212 item->offset = offset;
213 item->size = size;
214}
215
Chia-I Wu5e25c272014-08-21 20:19:12 +0800216static void cmd_writer_patch(struct intel_cmd *cmd,
Chia-I Wu68f319d2014-09-09 09:43:21 +0800217 enum intel_cmd_writer_type which,
Chia-I Wu72292b72014-09-09 10:48:33 +0800218 XGL_SIZE offset, uint32_t val)
Chia-I Wu5e25c272014-08-21 20:19:12 +0800219{
Chia-I Wu68f319d2014-09-09 09:43:21 +0800220 struct intel_cmd_writer *writer = &cmd->writers[which];
221
Chia-I Wu72292b72014-09-09 10:48:33 +0800222 assert(offset + sizeof(val) <= writer->used);
223 *((uint32_t *) ((char *) writer->ptr + offset)) = val;
Chia-I Wu5e25c272014-08-21 20:19:12 +0800224}
225
Chia-I Wu730e5362014-08-19 12:15:09 +0800226static void cmd_reset(struct intel_cmd *cmd)
227{
Chia-I Wu68f319d2014-09-09 09:43:21 +0800228 XGL_UINT i;
229
230 for (i = 0; i < INTEL_CMD_WRITER_COUNT; i++)
231 cmd_writer_reset(cmd, i);
Chia-I Wue97aa0e2014-08-27 12:51:26 +0800232
Chia-I Wua57761b2014-10-14 14:27:44 +0800233 if (cmd->bind.shader_cache.entries)
234 icd_free(cmd->bind.shader_cache.entries);
235
Chia-I Wue97aa0e2014-08-27 12:51:26 +0800236 memset(&cmd->bind, 0, sizeof(cmd->bind));
237
Chia-I Wu343b1372014-08-20 16:39:20 +0800238 cmd->reloc_used = 0;
Chia-I Wu04966702014-08-20 15:05:03 +0800239 cmd->result = XGL_SUCCESS;
Chia-I Wu730e5362014-08-19 12:15:09 +0800240}
241
242static void cmd_destroy(struct intel_obj *obj)
243{
244 struct intel_cmd *cmd = intel_cmd_from_obj(obj);
245
246 intel_cmd_destroy(cmd);
247}
248
249XGL_RESULT intel_cmd_create(struct intel_dev *dev,
250 const XGL_CMD_BUFFER_CREATE_INFO *info,
251 struct intel_cmd **cmd_ret)
252{
Chia-I Wu63883292014-08-25 13:50:26 +0800253 int pipeline_select;
Chia-I Wu730e5362014-08-19 12:15:09 +0800254 struct intel_cmd *cmd;
255
Chia-I Wu63883292014-08-25 13:50:26 +0800256 switch (info->queueType) {
257 case XGL_QUEUE_TYPE_GRAPHICS:
258 pipeline_select = GEN6_PIPELINE_SELECT_DW0_SELECT_3D;
259 break;
260 case XGL_QUEUE_TYPE_COMPUTE:
261 pipeline_select = GEN6_PIPELINE_SELECT_DW0_SELECT_MEDIA;
262 break;
263 case XGL_QUEUE_TYPE_DMA:
264 pipeline_select = -1;
265 break;
266 default:
267 return XGL_ERROR_INVALID_VALUE;
268 break;
269 }
270
Chia-I Wu730e5362014-08-19 12:15:09 +0800271 cmd = (struct intel_cmd *) intel_base_create(dev, sizeof(*cmd),
272 dev->base.dbg, XGL_DBG_OBJECT_CMD_BUFFER, info, 0);
273 if (!cmd)
274 return XGL_ERROR_OUT_OF_MEMORY;
275
276 cmd->obj.destroy = cmd_destroy;
277
278 cmd->dev = dev;
Chia-I Wu0b784442014-08-25 22:54:16 +0800279 cmd->scratch_bo = dev->cmd_scratch_bo;
Chia-I Wu63883292014-08-25 13:50:26 +0800280 cmd->pipeline_select = pipeline_select;
Chia-I Wue24c3292014-08-21 14:05:23 +0800281
Chia-I Wue0cdd832014-08-25 12:38:56 +0800282 /*
283 * XXX This is not quite right. intel_gpu sets maxMemRefsPerSubmission to
284 * batch_buffer_reloc_count, but we may emit up to two relocs, for start
285 * and end offsets, for each referenced memories.
286 */
Chia-I Wu343b1372014-08-20 16:39:20 +0800287 cmd->reloc_count = dev->gpu->batch_buffer_reloc_count;
288 cmd->relocs = icd_alloc(sizeof(cmd->relocs[0]) * cmd->reloc_count,
289 4096, XGL_SYSTEM_ALLOC_INTERNAL);
290 if (!cmd->relocs) {
291 intel_cmd_destroy(cmd);
292 return XGL_ERROR_OUT_OF_MEMORY;
293 }
Chia-I Wu730e5362014-08-19 12:15:09 +0800294
295 *cmd_ret = cmd;
296
297 return XGL_SUCCESS;
298}
299
300void intel_cmd_destroy(struct intel_cmd *cmd)
301{
302 cmd_reset(cmd);
Chia-I Wue24c3292014-08-21 14:05:23 +0800303
304 icd_free(cmd->relocs);
Chia-I Wu730e5362014-08-19 12:15:09 +0800305 intel_base_destroy(&cmd->obj.base);
306}
307
Jon Ashburnc04b4dc2015-01-08 18:48:10 -0700308XGL_RESULT intel_cmd_begin(struct intel_cmd *cmd, const XGL_CMD_BUFFER_BEGIN_INFO* info)
Chia-I Wu730e5362014-08-19 12:15:09 +0800309{
Chia-I Wu24565ee2014-08-21 20:24:31 +0800310 XGL_RESULT ret;
Chia-I Wu68f319d2014-09-09 09:43:21 +0800311 XGL_UINT i;
Jon Ashburnc04b4dc2015-01-08 18:48:10 -0700312 XGL_FLAGS flags = 0;
313 XGL_CMD_BUFFER_BEGIN_INFO* next= (XGL_CMD_BUFFER_BEGIN_INFO*) info;
314 XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO *ginfo;
Chia-I Wu730e5362014-08-19 12:15:09 +0800315
316 cmd_reset(cmd);
317
Jon Ashburnc04b4dc2015-01-08 18:48:10 -0700318 while (next != NULL) {
319 switch (next->sType) {
320 case XGL_STRUCTURE_TYPE_CMD_BUFFER_BEGIN_INFO:
321 flags = next->flags;
322 break;
323 case XGL_STRUCTURE_TYPE_CMD_BUFFER_GRAPHICS_BEGIN_INFO:
324 ginfo = (XGL_CMD_BUFFER_GRAPHICS_BEGIN_INFO *) next;
325 cmd->bind.render_pass = (struct intel_render_pass *)
326 ginfo->renderPass;
327 break;
328 default:
329 return XGL_ERROR_INVALID_VALUE;
330 break;
331 }
332 next = (XGL_CMD_BUFFER_BEGIN_INFO*) next->pNext;
333 }
334
Chia-I Wu24565ee2014-08-21 20:24:31 +0800335 if (cmd->flags != flags) {
Chia-I Wue24c3292014-08-21 14:05:23 +0800336 cmd->flags = flags;
Chia-I Wu68f319d2014-09-09 09:43:21 +0800337 cmd->writers[INTEL_CMD_WRITER_BATCH].size = 0;
Chia-I Wu730e5362014-08-19 12:15:09 +0800338 }
339
Chia-I Wu68f319d2014-09-09 09:43:21 +0800340 if (!cmd->writers[INTEL_CMD_WRITER_BATCH].size) {
Chia-I Wu72292b72014-09-09 10:48:33 +0800341 const XGL_UINT size = cmd->dev->gpu->max_batch_buffer_size / 2;
Chia-I Wu1cbc0052014-08-25 09:50:12 +0800342 XGL_UINT divider = 1;
Chia-I Wu24565ee2014-08-21 20:24:31 +0800343
344 if (flags & XGL_CMD_BUFFER_OPTIMIZE_GPU_SMALL_BATCH_BIT)
345 divider *= 4;
346
Chia-I Wu68f319d2014-09-09 09:43:21 +0800347 cmd->writers[INTEL_CMD_WRITER_BATCH].size = size / divider;
348 cmd->writers[INTEL_CMD_WRITER_STATE].size = size / divider;
Chia-I Wu72292b72014-09-09 10:48:33 +0800349 cmd->writers[INTEL_CMD_WRITER_INSTRUCTION].size = 16384 / divider;
Chia-I Wu24565ee2014-08-21 20:24:31 +0800350 }
351
Chia-I Wu68f319d2014-09-09 09:43:21 +0800352 for (i = 0; i < INTEL_CMD_WRITER_COUNT; i++) {
Chia-I Wu3c3edc02014-09-09 10:32:59 +0800353 ret = cmd_writer_alloc_and_map(cmd, i);
Chia-I Wu68f319d2014-09-09 09:43:21 +0800354 if (ret != XGL_SUCCESS) {
355 cmd_reset(cmd);
356 return ret;
357 }
Chia-I Wu24565ee2014-08-21 20:24:31 +0800358 }
359
Chia-I Wu79dfbb32014-08-25 12:19:02 +0800360 cmd_batch_begin(cmd);
361
Chia-I Wu24565ee2014-08-21 20:24:31 +0800362 return XGL_SUCCESS;
Chia-I Wu730e5362014-08-19 12:15:09 +0800363}
364
365XGL_RESULT intel_cmd_end(struct intel_cmd *cmd)
366{
367 struct intel_winsys *winsys = cmd->dev->winsys;
Chia-I Wu343b1372014-08-20 16:39:20 +0800368 XGL_UINT i;
Chia-I Wu730e5362014-08-19 12:15:09 +0800369
Chia-I Wub8762122014-12-01 22:51:03 +0800370 /* no matching intel_cmd_begin() */
371 if (!cmd->writers[INTEL_CMD_WRITER_BATCH].ptr)
372 return XGL_ERROR_INCOMPLETE_COMMAND_BUFFER;
373
Chia-I Wue24c3292014-08-21 14:05:23 +0800374 cmd_batch_end(cmd);
Chia-I Wu730e5362014-08-19 12:15:09 +0800375
Chia-I Wu343b1372014-08-20 16:39:20 +0800376 /* TODO we need a more "explicit" winsys */
Chia-I Wufdfb8ed2014-08-21 15:40:07 +0800377 for (i = 0; i < cmd->reloc_used; i++) {
Chia-I Wu343b1372014-08-20 16:39:20 +0800378 const struct intel_cmd_reloc *reloc = &cmd->relocs[i];
Chia-I Wu68f319d2014-09-09 09:43:21 +0800379 const struct intel_cmd_writer *writer = &cmd->writers[reloc->which];
Chia-I Wu343b1372014-08-20 16:39:20 +0800380 uint64_t presumed_offset;
381 int err;
382
Chia-I Wud7d1e482014-10-18 13:25:10 +0800383 /*
384 * Once a bo is used as a reloc target, libdrm_intel disallows more
385 * relocs to be added to it. That may happen when
386 * INTEL_CMD_RELOC_TARGET_IS_WRITER is set. We have to process them
387 * in another pass.
388 */
389 if (reloc->flags & INTEL_CMD_RELOC_TARGET_IS_WRITER)
390 continue;
391
Chia-I Wu72292b72014-09-09 10:48:33 +0800392 err = intel_bo_add_reloc(writer->bo, reloc->offset,
Chia-I Wud7d1e482014-10-18 13:25:10 +0800393 (struct intel_bo *) reloc->target, reloc->target_offset,
Chia-I Wu32a22462014-08-26 14:13:46 +0800394 reloc->flags, &presumed_offset);
Chia-I Wu343b1372014-08-20 16:39:20 +0800395 if (err) {
396 cmd->result = XGL_ERROR_UNKNOWN;
397 break;
398 }
399
400 assert(presumed_offset == (uint64_t) (uint32_t) presumed_offset);
Chia-I Wu72292b72014-09-09 10:48:33 +0800401 cmd_writer_patch(cmd, reloc->which, reloc->offset,
Chia-I Wue24c3292014-08-21 14:05:23 +0800402 (uint32_t) presumed_offset);
Chia-I Wu343b1372014-08-20 16:39:20 +0800403 }
Chia-I Wud7d1e482014-10-18 13:25:10 +0800404 for (i = 0; i < cmd->reloc_used; i++) {
405 const struct intel_cmd_reloc *reloc = &cmd->relocs[i];
406 const struct intel_cmd_writer *writer = &cmd->writers[reloc->which];
407 uint64_t presumed_offset;
408 int err;
409
410 if (!(reloc->flags & INTEL_CMD_RELOC_TARGET_IS_WRITER))
411 continue;
412
413 err = intel_bo_add_reloc(writer->bo, reloc->offset,
414 cmd->writers[reloc->target].bo, reloc->target_offset,
415 reloc->flags & ~INTEL_CMD_RELOC_TARGET_IS_WRITER,
416 &presumed_offset);
417 if (err) {
418 cmd->result = XGL_ERROR_UNKNOWN;
419 break;
420 }
421
422 assert(presumed_offset == (uint64_t) (uint32_t) presumed_offset);
423 cmd_writer_patch(cmd, reloc->which, reloc->offset,
424 (uint32_t) presumed_offset);
425 }
Chia-I Wu343b1372014-08-20 16:39:20 +0800426
Chia-I Wu3c3edc02014-09-09 10:32:59 +0800427 for (i = 0; i < INTEL_CMD_WRITER_COUNT; i++)
428 cmd_writer_unmap(cmd, i);
Chia-I Wu730e5362014-08-19 12:15:09 +0800429
Chia-I Wu04966702014-08-20 15:05:03 +0800430 if (cmd->result != XGL_SUCCESS)
431 return cmd->result;
Chia-I Wue24c3292014-08-21 14:05:23 +0800432
Chia-I Wu68f319d2014-09-09 09:43:21 +0800433 if (intel_winsys_can_submit_bo(winsys,
434 &cmd->writers[INTEL_CMD_WRITER_BATCH].bo, 1))
Chia-I Wu730e5362014-08-19 12:15:09 +0800435 return XGL_SUCCESS;
436 else
437 return XGL_ERROR_TOO_MANY_MEMORY_REFERENCES;
438}
439
Chia-I Wu96177272015-01-03 15:27:41 +0800440ICD_EXPORT XGL_RESULT XGLAPI xglCreateCommandBuffer(
Chia-I Wu09142132014-08-11 15:42:55 +0800441 XGL_DEVICE device,
442 const XGL_CMD_BUFFER_CREATE_INFO* pCreateInfo,
443 XGL_CMD_BUFFER* pCmdBuffer)
444{
Chia-I Wu730e5362014-08-19 12:15:09 +0800445 struct intel_dev *dev = intel_dev(device);
446
447 return intel_cmd_create(dev, pCreateInfo,
448 (struct intel_cmd **) pCmdBuffer);
Chia-I Wu09142132014-08-11 15:42:55 +0800449}
450
Chia-I Wu96177272015-01-03 15:27:41 +0800451ICD_EXPORT XGL_RESULT XGLAPI xglBeginCommandBuffer(
Chia-I Wu09142132014-08-11 15:42:55 +0800452 XGL_CMD_BUFFER cmdBuffer,
Jon Ashburnc04b4dc2015-01-08 18:48:10 -0700453 const XGL_CMD_BUFFER_BEGIN_INFO *info)
Chia-I Wu09142132014-08-11 15:42:55 +0800454{
Chia-I Wu730e5362014-08-19 12:15:09 +0800455 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
456
Jon Ashburnc04b4dc2015-01-08 18:48:10 -0700457 return intel_cmd_begin(cmd, info);
Chia-I Wu09142132014-08-11 15:42:55 +0800458}
459
Chia-I Wu96177272015-01-03 15:27:41 +0800460ICD_EXPORT XGL_RESULT XGLAPI xglEndCommandBuffer(
Chia-I Wu09142132014-08-11 15:42:55 +0800461 XGL_CMD_BUFFER cmdBuffer)
462{
Chia-I Wu730e5362014-08-19 12:15:09 +0800463 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
464
465 return intel_cmd_end(cmd);
Chia-I Wu09142132014-08-11 15:42:55 +0800466}
467
Chia-I Wu96177272015-01-03 15:27:41 +0800468ICD_EXPORT XGL_RESULT XGLAPI xglResetCommandBuffer(
Chia-I Wu09142132014-08-11 15:42:55 +0800469 XGL_CMD_BUFFER cmdBuffer)
470{
Chia-I Wu730e5362014-08-19 12:15:09 +0800471 struct intel_cmd *cmd = intel_cmd(cmdBuffer);
472
473 cmd_reset(cmd);
474
475 return XGL_SUCCESS;
Chia-I Wu09142132014-08-11 15:42:55 +0800476}
477
Chia-I Wu714df452015-01-01 07:55:04 +0800478ICD_EXPORT XGL_VOID XGLAPI xglCmdBufferAtomic(
Chia-I Wu09142132014-08-11 15:42:55 +0800479 XGL_CMD_BUFFER cmdBuffer,
Chia-I Wu714df452015-01-01 07:55:04 +0800480 XGL_BUFFER destBuffer,
Chia-I Wu09142132014-08-11 15:42:55 +0800481 XGL_GPU_SIZE destOffset,
482 XGL_UINT64 srcData,
483 XGL_ATOMIC_OP atomicOp)
484{
485}
486
Chia-I Wu96177272015-01-03 15:27:41 +0800487ICD_EXPORT XGL_VOID XGLAPI xglCmdInitAtomicCounters(
Chia-I Wu09142132014-08-11 15:42:55 +0800488 XGL_CMD_BUFFER cmdBuffer,
489 XGL_PIPELINE_BIND_POINT pipelineBindPoint,
490 XGL_UINT startCounter,
491 XGL_UINT counterCount,
492 const XGL_UINT32* pData)
493{
494}
495
Chia-I Wu96177272015-01-03 15:27:41 +0800496ICD_EXPORT XGL_VOID XGLAPI xglCmdLoadAtomicCounters(
Chia-I Wu09142132014-08-11 15:42:55 +0800497 XGL_CMD_BUFFER cmdBuffer,
498 XGL_PIPELINE_BIND_POINT pipelineBindPoint,
499 XGL_UINT startCounter,
500 XGL_UINT counterCount,
Chia-I Wu714df452015-01-01 07:55:04 +0800501 XGL_BUFFER srcBuffer,
Chia-I Wu09142132014-08-11 15:42:55 +0800502 XGL_GPU_SIZE srcOffset)
503{
504}
505
Chia-I Wu96177272015-01-03 15:27:41 +0800506ICD_EXPORT XGL_VOID XGLAPI xglCmdSaveAtomicCounters(
Chia-I Wu09142132014-08-11 15:42:55 +0800507 XGL_CMD_BUFFER cmdBuffer,
508 XGL_PIPELINE_BIND_POINT pipelineBindPoint,
509 XGL_UINT startCounter,
510 XGL_UINT counterCount,
Chia-I Wu714df452015-01-01 07:55:04 +0800511 XGL_BUFFER destBuffer,
Chia-I Wu09142132014-08-11 15:42:55 +0800512 XGL_GPU_SIZE destOffset)
513{
514}
515
Chia-I Wu96177272015-01-03 15:27:41 +0800516ICD_EXPORT XGL_VOID XGLAPI xglCmdDbgMarkerBegin(
Chia-I Wu09142132014-08-11 15:42:55 +0800517 XGL_CMD_BUFFER cmdBuffer,
518 const XGL_CHAR* pMarker)
519{
520}
521
Chia-I Wu96177272015-01-03 15:27:41 +0800522ICD_EXPORT XGL_VOID XGLAPI xglCmdDbgMarkerEnd(
Chia-I Wu09142132014-08-11 15:42:55 +0800523 XGL_CMD_BUFFER cmdBuffer)
524{
525}