a335c00afdebed329f2e9d794dd8578f4b99a7c9
[mesa.git] / src / mesa / drivers / dri / i965 / intel_buffer_objects.c
1 /*
2 * Copyright 2003 VMware, Inc.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial portions
15 * of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26 /**
27 * @file intel_buffer_objects.c
28 *
29 * This provides core GL buffer object functionality.
30 */
31
32 #include "main/imports.h"
33 #include "main/mtypes.h"
34 #include "main/macros.h"
35 #include "main/bufferobj.h"
36
37 #include "brw_context.h"
38 #include "intel_blit.h"
39 #include "intel_buffer_objects.h"
40 #include "intel_batchbuffer.h"
41
42 static void
43 mark_buffer_gpu_usage(struct intel_buffer_object *intel_obj,
44 uint32_t offset, uint32_t size)
45 {
46 intel_obj->gpu_active_start = MIN2(intel_obj->gpu_active_start, offset);
47 intel_obj->gpu_active_end = MAX2(intel_obj->gpu_active_end, offset + size);
48 }
49
50 static void
51 mark_buffer_inactive(struct intel_buffer_object *intel_obj)
52 {
53 intel_obj->gpu_active_start = ~0;
54 intel_obj->gpu_active_end = 0;
55 }
56
57 static void
58 mark_buffer_valid_data(struct intel_buffer_object *intel_obj,
59 uint32_t offset, uint32_t size)
60 {
61 intel_obj->valid_data_start = MIN2(intel_obj->valid_data_start, offset);
62 intel_obj->valid_data_end = MAX2(intel_obj->valid_data_end, offset + size);
63 }
64
65 static void
66 mark_buffer_invalid(struct intel_buffer_object *intel_obj)
67 {
68 intel_obj->valid_data_start = ~0;
69 intel_obj->valid_data_end = 0;
70 }
71
72 /** Allocates a new brw_bo to store the data for the buffer object. */
73 static void
74 alloc_buffer_object(struct brw_context *brw,
75 struct intel_buffer_object *intel_obj)
76 {
77 intel_obj->buffer = brw_bo_alloc(brw->bufmgr, "bufferobj",
78 intel_obj->Base.Size, 64);
79
80 /* the buffer might be bound as a uniform buffer, need to update it
81 */
82 if (intel_obj->Base.UsageHistory & USAGE_UNIFORM_BUFFER)
83 brw->ctx.NewDriverState |= BRW_NEW_UNIFORM_BUFFER;
84 if (intel_obj->Base.UsageHistory & USAGE_SHADER_STORAGE_BUFFER)
85 brw->ctx.NewDriverState |= BRW_NEW_UNIFORM_BUFFER;
86 if (intel_obj->Base.UsageHistory & USAGE_TEXTURE_BUFFER)
87 brw->ctx.NewDriverState |= BRW_NEW_TEXTURE_BUFFER;
88 if (intel_obj->Base.UsageHistory & USAGE_ATOMIC_COUNTER_BUFFER)
89 brw->ctx.NewDriverState |= BRW_NEW_ATOMIC_BUFFER;
90
91 mark_buffer_inactive(intel_obj);
92 mark_buffer_invalid(intel_obj);
93 }
94
95 static void
96 release_buffer(struct intel_buffer_object *intel_obj)
97 {
98 brw_bo_unreference(intel_obj->buffer);
99 intel_obj->buffer = NULL;
100 }
101
102 /**
103 * The NewBufferObject() driver hook.
104 *
105 * Allocates a new intel_buffer_object structure and initializes it.
106 *
107 * There is some duplication between mesa's bufferobjects and our
108 * bufmgr buffers. Both have an integer handle and a hashtable to
109 * lookup an opaque structure. It would be nice if the handles and
110 * internal structure where somehow shared.
111 */
112 static struct gl_buffer_object *
113 brw_new_buffer_object(struct gl_context * ctx, GLuint name)
114 {
115 struct intel_buffer_object *obj = CALLOC_STRUCT(intel_buffer_object);
116 if (!obj) {
117 _mesa_error_no_memory(__func__);
118 return NULL;
119 }
120
121 _mesa_initialize_buffer_object(ctx, &obj->Base, name);
122
123 obj->buffer = NULL;
124
125 return &obj->Base;
126 }
127
128 /**
129 * The DeleteBuffer() driver hook.
130 *
131 * Deletes a single OpenGL buffer object. Used by glDeleteBuffers().
132 */
133 static void
134 brw_delete_buffer(struct gl_context * ctx, struct gl_buffer_object *obj)
135 {
136 struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
137
138 assert(intel_obj);
139
140 /* Buffer objects are automatically unmapped when deleting according
141 * to the spec, but Mesa doesn't do UnmapBuffer for us at context destroy
142 * (though it does if you call glDeleteBuffers)
143 */
144 _mesa_buffer_unmap_all_mappings(ctx, obj);
145
146 brw_bo_unreference(intel_obj->buffer);
147 _mesa_delete_buffer_object(ctx, obj);
148 }
149
150
151 /**
152 * The BufferData() driver hook.
153 *
154 * Implements glBufferData(), which recreates a buffer object's data store
155 * and populates it with the given data, if present.
156 *
157 * Any data that was previously stored in the buffer object is lost.
158 *
159 * \return true for success, false if out of memory
160 */
161 static GLboolean
162 brw_buffer_data(struct gl_context *ctx,
163 GLenum target,
164 GLsizeiptrARB size,
165 const GLvoid *data,
166 GLenum usage,
167 GLbitfield storageFlags,
168 struct gl_buffer_object *obj)
169 {
170 struct brw_context *brw = brw_context(ctx);
171 struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
172
173 /* Part of the ABI, but this function doesn't use it.
174 */
175 (void) target;
176
177 intel_obj->Base.Size = size;
178 intel_obj->Base.Usage = usage;
179 intel_obj->Base.StorageFlags = storageFlags;
180
181 assert(!obj->Mappings[MAP_USER].Pointer); /* Mesa should have unmapped it */
182 assert(!obj->Mappings[MAP_INTERNAL].Pointer);
183
184 if (intel_obj->buffer != NULL)
185 release_buffer(intel_obj);
186
187 if (size != 0) {
188 alloc_buffer_object(brw, intel_obj);
189 if (!intel_obj->buffer)
190 return false;
191
192 if (data != NULL) {
193 brw_bo_subdata(intel_obj->buffer, 0, size, data);
194 mark_buffer_valid_data(intel_obj, 0, size);
195 }
196 }
197
198 return true;
199 }
200
201
202 /**
203 * The BufferSubData() driver hook.
204 *
205 * Implements glBufferSubData(), which replaces a portion of the data in a
206 * buffer object.
207 *
208 * If the data range specified by (size + offset) extends beyond the end of
209 * the buffer or if data is NULL, no copy is performed.
210 */
211 static void
212 brw_buffer_subdata(struct gl_context *ctx,
213 GLintptrARB offset,
214 GLsizeiptrARB size,
215 const GLvoid *data,
216 struct gl_buffer_object *obj)
217 {
218 struct brw_context *brw = brw_context(ctx);
219 struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
220 bool busy;
221
222 if (size == 0)
223 return;
224
225 assert(intel_obj);
226
227 /* See if we can unsynchronized write the data into the user's BO. This
228 * avoids GPU stalls in unfortunately common user patterns (uploading
229 * sequentially into a BO, with draw calls in between each upload).
230 *
231 * Once we've hit this path, we mark this GL BO as preferring stalling to
232 * blits, so that we can hopefully hit this path again in the future
233 * (otherwise, an app that might occasionally stall but mostly not will end
234 * up with blitting all the time, at the cost of bandwidth)
235 */
236 if (offset + size <= intel_obj->gpu_active_start ||
237 intel_obj->gpu_active_end <= offset ||
238 offset + size <= intel_obj->valid_data_start ||
239 intel_obj->valid_data_end <= offset) {
240 void *map = brw_bo_map(brw, intel_obj->buffer, MAP_WRITE | MAP_ASYNC);
241 memcpy(map + offset, data, size);
242 brw_bo_unmap(intel_obj->buffer);
243
244 if (intel_obj->gpu_active_end > intel_obj->gpu_active_start)
245 intel_obj->prefer_stall_to_blit = true;
246
247 mark_buffer_valid_data(intel_obj, offset, size);
248 return;
249 }
250
251 busy =
252 brw_bo_busy(intel_obj->buffer) ||
253 brw_batch_references(&brw->batch, intel_obj->buffer);
254
255 if (busy) {
256 if (size == intel_obj->Base.Size ||
257 (intel_obj->valid_data_start >= offset &&
258 intel_obj->valid_data_end <= offset + size)) {
259 /* Replace the current busy bo so the subdata doesn't stall. */
260 brw_bo_unreference(intel_obj->buffer);
261 alloc_buffer_object(brw, intel_obj);
262 } else if (!intel_obj->prefer_stall_to_blit) {
263 perf_debug("Using a blit copy to avoid stalling on "
264 "glBufferSubData(%ld, %ld) (%ldkb) to a busy "
265 "(%d-%d) / valid (%d-%d) buffer object.\n",
266 (long)offset, (long)offset + size, (long)(size/1024),
267 intel_obj->gpu_active_start,
268 intel_obj->gpu_active_end,
269 intel_obj->valid_data_start,
270 intel_obj->valid_data_end);
271 struct brw_bo *temp_bo =
272 brw_bo_alloc(brw->bufmgr, "subdata temp", size, 64);
273
274 brw_bo_subdata(temp_bo, 0, size, data);
275
276 intel_emit_linear_blit(brw,
277 intel_obj->buffer, offset,
278 temp_bo, 0,
279 size);
280
281 brw_bo_unreference(temp_bo);
282 mark_buffer_valid_data(intel_obj, offset, size);
283 return;
284 } else {
285 perf_debug("Stalling on glBufferSubData(%ld, %ld) (%ldkb) to a busy "
286 "(%d-%d) buffer object. Use glMapBufferRange() to "
287 "avoid this.\n",
288 (long)offset, (long)offset + size, (long)(size/1024),
289 intel_obj->gpu_active_start,
290 intel_obj->gpu_active_end);
291 intel_batchbuffer_flush(brw);
292 }
293 }
294
295 brw_bo_subdata(intel_obj->buffer, offset, size, data);
296 mark_buffer_inactive(intel_obj);
297 mark_buffer_valid_data(intel_obj, offset, size);
298 }
299
300
301 /**
302 * The GetBufferSubData() driver hook.
303 *
304 * Implements glGetBufferSubData(), which copies a subrange of a buffer
305 * object into user memory.
306 */
307 static void
308 brw_get_buffer_subdata(struct gl_context *ctx,
309 GLintptrARB offset,
310 GLsizeiptrARB size,
311 GLvoid *data,
312 struct gl_buffer_object *obj)
313 {
314 struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
315 struct brw_context *brw = brw_context(ctx);
316
317 assert(intel_obj);
318 if (brw_batch_references(&brw->batch, intel_obj->buffer)) {
319 intel_batchbuffer_flush(brw);
320 }
321
322 void *map = brw_bo_map(brw, intel_obj->buffer, MAP_READ);
323
324 if (unlikely(!map)) {
325 _mesa_error_no_memory(__func__);
326 return;
327 }
328
329 memcpy(data, map + offset, size);
330 brw_bo_unmap(intel_obj->buffer);
331
332 mark_buffer_inactive(intel_obj);
333 }
334
335
336 /**
337 * The MapBufferRange() driver hook.
338 *
339 * This implements both glMapBufferRange() and glMapBuffer().
340 *
341 * The goal of this extension is to allow apps to accumulate their rendering
342 * at the same time as they accumulate their buffer object. Without it,
343 * you'd end up blocking on execution of rendering every time you mapped
344 * the buffer to put new data in.
345 *
346 * We support it in 3 ways: If unsynchronized, then don't bother
347 * flushing the batchbuffer before mapping the buffer, which can save blocking
348 * in many cases. If we would still block, and they allow the whole buffer
349 * to be invalidated, then just allocate a new buffer to replace the old one.
350 * If not, and we'd block, and they allow the subrange of the buffer to be
351 * invalidated, then we can make a new little BO, let them write into that,
352 * and blit it into the real BO at unmap time.
353 */
354 static void *
355 brw_map_buffer_range(struct gl_context *ctx,
356 GLintptr offset, GLsizeiptr length,
357 GLbitfield access, struct gl_buffer_object *obj,
358 gl_map_buffer_index index)
359 {
360 struct brw_context *brw = brw_context(ctx);
361 struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
362
363 assert(intel_obj);
364
365 STATIC_ASSERT(GL_MAP_UNSYNCHRONIZED_BIT == MAP_ASYNC);
366 STATIC_ASSERT(GL_MAP_WRITE_BIT == MAP_WRITE);
367 STATIC_ASSERT(GL_MAP_READ_BIT == MAP_READ);
368 STATIC_ASSERT(GL_MAP_PERSISTENT_BIT == MAP_PERSISTENT);
369 STATIC_ASSERT(GL_MAP_COHERENT_BIT == MAP_COHERENT);
370 assert((access & MAP_INTERNAL_MASK) == 0);
371
372 /* _mesa_MapBufferRange (GL entrypoint) sets these, but the vbo module also
373 * internally uses our functions directly.
374 */
375 obj->Mappings[index].Offset = offset;
376 obj->Mappings[index].Length = length;
377 obj->Mappings[index].AccessFlags = access;
378
379 if (intel_obj->buffer == NULL) {
380 obj->Mappings[index].Pointer = NULL;
381 return NULL;
382 }
383
384 /* If the access is synchronized (like a normal buffer mapping), then get
385 * things flushed out so the later mapping syncs appropriately through GEM.
386 * If the user doesn't care about existing buffer contents and mapping would
387 * cause us to block, then throw out the old buffer.
388 *
389 * If they set INVALIDATE_BUFFER, we can pitch the current contents to
390 * achieve the required synchronization.
391 */
392 if (!(access & GL_MAP_UNSYNCHRONIZED_BIT)) {
393 if (brw_batch_references(&brw->batch, intel_obj->buffer)) {
394 if (access & GL_MAP_INVALIDATE_BUFFER_BIT) {
395 brw_bo_unreference(intel_obj->buffer);
396 alloc_buffer_object(brw, intel_obj);
397 } else {
398 perf_debug("Stalling on the GPU for mapping a busy buffer "
399 "object\n");
400 intel_batchbuffer_flush(brw);
401 }
402 } else if (brw_bo_busy(intel_obj->buffer) &&
403 (access & GL_MAP_INVALIDATE_BUFFER_BIT)) {
404 brw_bo_unreference(intel_obj->buffer);
405 alloc_buffer_object(brw, intel_obj);
406 }
407 }
408
409 if (access & MAP_WRITE)
410 mark_buffer_valid_data(intel_obj, offset, length);
411
412 /* If the user is mapping a range of an active buffer object but
413 * doesn't require the current contents of that range, make a new
414 * BO, and we'll copy what they put in there out at unmap or
415 * FlushRange time.
416 *
417 * That is, unless they're looking for a persistent mapping -- we would
418 * need to do blits in the MemoryBarrier call, and it's easier to just do a
419 * GPU stall and do a mapping.
420 */
421 if (!(access & (GL_MAP_UNSYNCHRONIZED_BIT | GL_MAP_PERSISTENT_BIT)) &&
422 (access & GL_MAP_INVALIDATE_RANGE_BIT) &&
423 brw_bo_busy(intel_obj->buffer)) {
424 /* Ensure that the base alignment of the allocation meets the alignment
425 * guarantees the driver has advertised to the application.
426 */
427 const unsigned alignment = ctx->Const.MinMapBufferAlignment;
428
429 intel_obj->map_extra[index] = (uintptr_t) offset % alignment;
430 intel_obj->range_map_bo[index] = brw_bo_alloc(brw->bufmgr,
431 "BO blit temp",
432 length +
433 intel_obj->map_extra[index],
434 alignment);
435 void *map = brw_bo_map(brw, intel_obj->range_map_bo[index], access);
436 obj->Mappings[index].Pointer = map + intel_obj->map_extra[index];
437 return obj->Mappings[index].Pointer;
438 }
439
440 void *map = brw_bo_map(brw, intel_obj->buffer, access);
441 if (!(access & GL_MAP_UNSYNCHRONIZED_BIT)) {
442 mark_buffer_inactive(intel_obj);
443 }
444
445 obj->Mappings[index].Pointer = map + offset;
446 return obj->Mappings[index].Pointer;
447 }
448
449 /**
450 * The FlushMappedBufferRange() driver hook.
451 *
452 * Implements glFlushMappedBufferRange(), which signifies that modifications
453 * have been made to a range of a mapped buffer, and it should be flushed.
454 *
455 * This is only used for buffers mapped with GL_MAP_FLUSH_EXPLICIT_BIT.
456 *
457 * Ideally we'd use a BO to avoid taking up cache space for the temporary
458 * data, but FlushMappedBufferRange may be followed by further writes to
459 * the pointer, so we would have to re-map after emitting our blit, which
460 * would defeat the point.
461 */
462 static void
463 brw_flush_mapped_buffer_range(struct gl_context *ctx,
464 GLintptr offset, GLsizeiptr length,
465 struct gl_buffer_object *obj,
466 gl_map_buffer_index index)
467 {
468 struct brw_context *brw = brw_context(ctx);
469 struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
470
471 assert(obj->Mappings[index].AccessFlags & GL_MAP_FLUSH_EXPLICIT_BIT);
472
473 /* If we gave a direct mapping of the buffer instead of using a temporary,
474 * then there's nothing to do.
475 */
476 if (intel_obj->range_map_bo[index] == NULL)
477 return;
478
479 if (length == 0)
480 return;
481
482 /* Note that we're not unmapping our buffer while executing the blit. We
483 * need to have a mapping still at the end of this call, since the user
484 * gets to make further modifications and glFlushMappedBufferRange() calls.
485 * This is safe, because:
486 *
487 * - On LLC platforms, we're using a CPU mapping that's coherent with the
488 * GPU (except for the render caches), so the kernel doesn't need to do
489 * any flushing work for us except for what happens at batch exec time
490 * anyway.
491 *
492 * - On non-LLC platforms, we're using a GTT mapping that writes directly
493 * to system memory (except for the chipset cache that gets flushed at
494 * batch exec time).
495 *
496 * In both cases we don't need to stall for the previous blit to complete
497 * so we can re-map (and we definitely don't want to, since that would be
498 * slow): If the user edits a part of their buffer that's previously been
499 * blitted, then our lack of synchoronization is fine, because either
500 * they'll get some too-new data in the first blit and not do another blit
501 * of that area (but in that case the results are undefined), or they'll do
502 * another blit of that area and the complete newer data will land the
503 * second time.
504 */
505 intel_emit_linear_blit(brw,
506 intel_obj->buffer,
507 obj->Mappings[index].Offset + offset,
508 intel_obj->range_map_bo[index],
509 intel_obj->map_extra[index] + offset,
510 length);
511 mark_buffer_gpu_usage(intel_obj,
512 obj->Mappings[index].Offset + offset,
513 length);
514 }
515
516
517 /**
518 * The UnmapBuffer() driver hook.
519 *
520 * Implements glUnmapBuffer().
521 */
522 static GLboolean
523 brw_unmap_buffer(struct gl_context *ctx,
524 struct gl_buffer_object *obj,
525 gl_map_buffer_index index)
526 {
527 struct brw_context *brw = brw_context(ctx);
528 struct intel_buffer_object *intel_obj = intel_buffer_object(obj);
529
530 assert(intel_obj);
531 assert(obj->Mappings[index].Pointer);
532 if (intel_obj->range_map_bo[index] != NULL) {
533 brw_bo_unmap(intel_obj->range_map_bo[index]);
534
535 if (!(obj->Mappings[index].AccessFlags & GL_MAP_FLUSH_EXPLICIT_BIT)) {
536 intel_emit_linear_blit(brw,
537 intel_obj->buffer, obj->Mappings[index].Offset,
538 intel_obj->range_map_bo[index],
539 intel_obj->map_extra[index],
540 obj->Mappings[index].Length);
541 mark_buffer_gpu_usage(intel_obj, obj->Mappings[index].Offset,
542 obj->Mappings[index].Length);
543 }
544
545 /* Since we've emitted some blits to buffers that will (likely) be used
546 * in rendering operations in other cache domains in this batch, emit a
547 * flush. Once again, we wish for a domain tracker in libdrm to cover
548 * usage inside of a batchbuffer.
549 */
550 brw_emit_mi_flush(brw);
551
552 brw_bo_unreference(intel_obj->range_map_bo[index]);
553 intel_obj->range_map_bo[index] = NULL;
554 } else if (intel_obj->buffer != NULL) {
555 brw_bo_unmap(intel_obj->buffer);
556 }
557 obj->Mappings[index].Pointer = NULL;
558 obj->Mappings[index].Offset = 0;
559 obj->Mappings[index].Length = 0;
560
561 return true;
562 }
563
564 /**
565 * Gets a pointer to the object's BO, and marks the given range as being used
566 * on the GPU.
567 *
568 * Anywhere that uses buffer objects in the pipeline should be using this to
569 * mark the range of the buffer that is being accessed by the pipeline.
570 */
571 struct brw_bo *
572 intel_bufferobj_buffer(struct brw_context *brw,
573 struct intel_buffer_object *intel_obj,
574 uint32_t offset, uint32_t size, bool write)
575 {
576 /* This is needed so that things like transform feedback and texture buffer
577 * objects that need a BO but don't want to check that they exist for
578 * draw-time validation can just always get a BO from a GL buffer object.
579 */
580 if (intel_obj->buffer == NULL)
581 alloc_buffer_object(brw, intel_obj);
582
583 mark_buffer_gpu_usage(intel_obj, offset, size);
584
585 /* If writing, (conservatively) mark this section as having valid data. */
586 if (write)
587 mark_buffer_valid_data(intel_obj, offset, size);
588
589 return intel_obj->buffer;
590 }
591
592 /**
593 * The CopyBufferSubData() driver hook.
594 *
595 * Implements glCopyBufferSubData(), which copies a portion of one buffer
596 * object's data to another. Independent source and destination offsets
597 * are allowed.
598 */
599 static void
600 brw_copy_buffer_subdata(struct gl_context *ctx,
601 struct gl_buffer_object *src,
602 struct gl_buffer_object *dst,
603 GLintptr read_offset, GLintptr write_offset,
604 GLsizeiptr size)
605 {
606 struct brw_context *brw = brw_context(ctx);
607 struct intel_buffer_object *intel_src = intel_buffer_object(src);
608 struct intel_buffer_object *intel_dst = intel_buffer_object(dst);
609 struct brw_bo *src_bo, *dst_bo;
610
611 if (size == 0)
612 return;
613
614 dst_bo = intel_bufferobj_buffer(brw, intel_dst, write_offset, size, true);
615 src_bo = intel_bufferobj_buffer(brw, intel_src, read_offset, size, false);
616
617 intel_emit_linear_blit(brw,
618 dst_bo, write_offset,
619 src_bo, read_offset, size);
620
621 /* Since we've emitted some blits to buffers that will (likely) be used
622 * in rendering operations in other cache domains in this batch, emit a
623 * flush. Once again, we wish for a domain tracker in libdrm to cover
624 * usage inside of a batchbuffer.
625 */
626 brw_emit_mi_flush(brw);
627 }
628
629 void
630 intelInitBufferObjectFuncs(struct dd_function_table *functions)
631 {
632 functions->NewBufferObject = brw_new_buffer_object;
633 functions->DeleteBuffer = brw_delete_buffer;
634 functions->BufferData = brw_buffer_data;
635 functions->BufferSubData = brw_buffer_subdata;
636 functions->GetBufferSubData = brw_get_buffer_subdata;
637 functions->MapBufferRange = brw_map_buffer_range;
638 functions->FlushMappedBufferRange = brw_flush_mapped_buffer_range;
639 functions->UnmapBuffer = brw_unmap_buffer;
640 functions->CopyBufferSubData = brw_copy_buffer_subdata;
641 }