1 /**************************************************************************
3 * Copyright 2003 VMware, Inc.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
29 #include "main/imports.h"
30 #include "main/mtypes.h"
31 #include "main/macros.h"
32 #include "main/bufferobj.h"
34 #include "intel_blit.h"
35 #include "intel_buffer_objects.h"
36 #include "intel_batchbuffer.h"
37 #include "intel_context.h"
38 #include "intel_fbo.h"
39 #include "intel_mipmap_tree.h"
40 #include "intel_regions.h"
43 intel_bufferobj_unmap(struct gl_context
* ctx
, struct gl_buffer_object
*obj
);
45 /** Allocates a new drm_intel_bo to store the data for the buffer object. */
47 intel_bufferobj_alloc_buffer(struct intel_context
*intel
,
48 struct intel_buffer_object
*intel_obj
)
50 intel_obj
->buffer
= drm_intel_bo_alloc(intel
->bufmgr
, "bufferobj",
51 intel_obj
->Base
.Size
, 64);
55 release_buffer(struct intel_buffer_object
*intel_obj
)
57 drm_intel_bo_unreference(intel_obj
->buffer
);
58 intel_obj
->buffer
= NULL
;
59 intel_obj
->offset
= 0;
60 intel_obj
->source
= 0;
64 * There is some duplication between mesa's bufferobjects and our
65 * bufmgr buffers. Both have an integer handle and a hashtable to
66 * lookup an opaque structure. It would be nice if the handles and
67 * internal structure where somehow shared.
69 static struct gl_buffer_object
*
70 intel_bufferobj_alloc(struct gl_context
* ctx
, GLuint name
, GLenum target
)
72 struct intel_buffer_object
*obj
= CALLOC_STRUCT(intel_buffer_object
);
74 _mesa_initialize_buffer_object(ctx
, &obj
->Base
, name
, target
);
82 * Deallocate/free a vertex/pixel buffer object.
83 * Called via glDeleteBuffersARB().
86 intel_bufferobj_free(struct gl_context
* ctx
, struct gl_buffer_object
*obj
)
88 struct intel_buffer_object
*intel_obj
= intel_buffer_object(obj
);
92 /* Buffer objects are automatically unmapped when deleting according
93 * to the spec, but Mesa doesn't do UnmapBuffer for us at context destroy
94 * (though it does if you call glDeleteBuffers)
97 intel_bufferobj_unmap(ctx
, obj
);
99 free(intel_obj
->sys_buffer
);
101 drm_intel_bo_unreference(intel_obj
->buffer
);
108 * Allocate space for and store data in a buffer object. Any data that was
109 * previously stored in the buffer object is lost. If data is NULL,
110 * memory will be allocated, but no copy will occur.
111 * Called via ctx->Driver.BufferData().
112 * \return true for success, false if out of memory
115 intel_bufferobj_data(struct gl_context
* ctx
,
119 GLenum usage
, struct gl_buffer_object
*obj
)
121 struct intel_context
*intel
= intel_context(ctx
);
122 struct intel_buffer_object
*intel_obj
= intel_buffer_object(obj
);
124 intel_obj
->Base
.Size
= size
;
125 intel_obj
->Base
.Usage
= usage
;
127 assert(!obj
->Pointer
); /* Mesa should have unmapped it */
129 if (intel_obj
->buffer
!= NULL
)
130 release_buffer(intel_obj
);
132 free(intel_obj
->sys_buffer
);
133 intel_obj
->sys_buffer
= NULL
;
136 /* Stick VBOs in system memory, as we're always doing swtnl with their
139 if (target
== GL_ARRAY_BUFFER
|| target
== GL_ELEMENT_ARRAY_BUFFER
) {
140 intel_obj
->sys_buffer
= malloc(size
);
141 if (intel_obj
->sys_buffer
!= NULL
) {
143 memcpy(intel_obj
->sys_buffer
, data
, size
);
148 intel_bufferobj_alloc_buffer(intel
, intel_obj
);
149 if (!intel_obj
->buffer
)
153 drm_intel_bo_subdata(intel_obj
->buffer
, 0, size
, data
);
161 * Replace data in a subrange of buffer object. If the data range
162 * specified by size + offset extends beyond the end of the buffer or
163 * if data is NULL, no copy is performed.
164 * Called via glBufferSubDataARB().
167 intel_bufferobj_subdata(struct gl_context
* ctx
,
170 const GLvoid
* data
, struct gl_buffer_object
*obj
)
172 struct intel_context
*intel
= intel_context(ctx
);
173 struct intel_buffer_object
*intel_obj
= intel_buffer_object(obj
);
181 /* If we have a single copy in system memory, update that */
182 if (intel_obj
->sys_buffer
) {
183 if (intel_obj
->source
)
184 release_buffer(intel_obj
);
186 if (intel_obj
->buffer
== NULL
) {
187 memcpy((char *)intel_obj
->sys_buffer
+ offset
, data
, size
);
191 free(intel_obj
->sys_buffer
);
192 intel_obj
->sys_buffer
= NULL
;
195 /* Otherwise we need to update the copy in video memory. */
197 drm_intel_bo_busy(intel_obj
->buffer
) ||
198 drm_intel_bo_references(intel
->batch
.bo
, intel_obj
->buffer
);
201 if (size
== intel_obj
->Base
.Size
) {
202 /* Replace the current busy bo with fresh data. */
203 drm_intel_bo_unreference(intel_obj
->buffer
);
204 intel_bufferobj_alloc_buffer(intel
, intel_obj
);
205 drm_intel_bo_subdata(intel_obj
->buffer
, 0, size
, data
);
207 perf_debug("Using a blit copy to avoid stalling on %ldb "
208 "glBufferSubData() to a busy buffer object.\n",
210 drm_intel_bo
*temp_bo
=
211 drm_intel_bo_alloc(intel
->bufmgr
, "subdata temp", size
, 64);
213 drm_intel_bo_subdata(temp_bo
, 0, size
, data
);
215 intel_emit_linear_blit(intel
,
216 intel_obj
->buffer
, offset
,
220 drm_intel_bo_unreference(temp_bo
);
223 drm_intel_bo_subdata(intel_obj
->buffer
, offset
, size
, data
);
229 * Called via glGetBufferSubDataARB().
232 intel_bufferobj_get_subdata(struct gl_context
* ctx
,
235 GLvoid
* data
, struct gl_buffer_object
*obj
)
237 struct intel_buffer_object
*intel_obj
= intel_buffer_object(obj
);
238 struct intel_context
*intel
= intel_context(ctx
);
241 if (intel_obj
->sys_buffer
)
242 memcpy(data
, (char *)intel_obj
->sys_buffer
+ offset
, size
);
244 if (drm_intel_bo_references(intel
->batch
.bo
, intel_obj
->buffer
)) {
245 intel_batchbuffer_flush(intel
);
247 drm_intel_bo_get_subdata(intel_obj
->buffer
, offset
, size
, data
);
254 * Called via glMapBufferRange and glMapBuffer
256 * The goal of this extension is to allow apps to accumulate their rendering
257 * at the same time as they accumulate their buffer object. Without it,
258 * you'd end up blocking on execution of rendering every time you mapped
259 * the buffer to put new data in.
261 * We support it in 3 ways: If unsynchronized, then don't bother
262 * flushing the batchbuffer before mapping the buffer, which can save blocking
263 * in many cases. If we would still block, and they allow the whole buffer
264 * to be invalidated, then just allocate a new buffer to replace the old one.
265 * If not, and we'd block, and they allow the subrange of the buffer to be
266 * invalidated, then we can make a new little BO, let them write into that,
267 * and blit it into the real BO at unmap time.
270 intel_bufferobj_map_range(struct gl_context
* ctx
,
271 GLintptr offset
, GLsizeiptr length
,
272 GLbitfield access
, struct gl_buffer_object
*obj
)
274 struct intel_context
*intel
= intel_context(ctx
);
275 struct intel_buffer_object
*intel_obj
= intel_buffer_object(obj
);
279 /* _mesa_MapBufferRange (GL entrypoint) sets these, but the vbo module also
280 * internally uses our functions directly.
282 obj
->Offset
= offset
;
283 obj
->Length
= length
;
284 obj
->AccessFlags
= access
;
286 if (intel_obj
->sys_buffer
) {
287 const bool read_only
=
288 (access
& (GL_MAP_READ_BIT
| GL_MAP_WRITE_BIT
)) == GL_MAP_READ_BIT
;
290 if (!read_only
&& intel_obj
->source
)
291 release_buffer(intel_obj
);
293 if (!intel_obj
->buffer
|| intel_obj
->source
) {
294 obj
->Pointer
= intel_obj
->sys_buffer
+ offset
;
298 free(intel_obj
->sys_buffer
);
299 intel_obj
->sys_buffer
= NULL
;
302 if (intel_obj
->buffer
== NULL
) {
307 /* If the access is synchronized (like a normal buffer mapping), then get
308 * things flushed out so the later mapping syncs appropriately through GEM.
309 * If the user doesn't care about existing buffer contents and mapping would
310 * cause us to block, then throw out the old buffer.
312 * If they set INVALIDATE_BUFFER, we can pitch the current contents to
313 * achieve the required synchronization.
315 if (!(access
& GL_MAP_UNSYNCHRONIZED_BIT
)) {
316 if (drm_intel_bo_references(intel
->batch
.bo
, intel_obj
->buffer
)) {
317 if (access
& GL_MAP_INVALIDATE_BUFFER_BIT
) {
318 drm_intel_bo_unreference(intel_obj
->buffer
);
319 intel_bufferobj_alloc_buffer(intel
, intel_obj
);
321 perf_debug("Stalling on the GPU for mapping a busy buffer "
325 } else if (drm_intel_bo_busy(intel_obj
->buffer
) &&
326 (access
& GL_MAP_INVALIDATE_BUFFER_BIT
)) {
327 drm_intel_bo_unreference(intel_obj
->buffer
);
328 intel_bufferobj_alloc_buffer(intel
, intel_obj
);
332 /* If the user is mapping a range of an active buffer object but
333 * doesn't require the current contents of that range, make a new
334 * BO, and we'll copy what they put in there out at unmap or
337 if ((access
& GL_MAP_INVALIDATE_RANGE_BIT
) &&
338 drm_intel_bo_busy(intel_obj
->buffer
)) {
339 /* Ensure that the base alignment of the allocation meets the alignment
340 * guarantees the driver has advertised to the application.
342 const unsigned alignment
= ctx
->Const
.MinMapBufferAlignment
;
343 const unsigned extra
= (uintptr_t) offset
% alignment
;
345 if (access
& GL_MAP_FLUSH_EXPLICIT_BIT
) {
346 intel_obj
->range_map_buffer
= _mesa_align_malloc(length
+ extra
,
348 obj
->Pointer
= intel_obj
->range_map_buffer
+ extra
;
350 intel_obj
->range_map_bo
= drm_intel_bo_alloc(intel
->bufmgr
,
354 if (!(access
& GL_MAP_READ_BIT
)) {
355 drm_intel_gem_bo_map_gtt(intel_obj
->range_map_bo
);
357 drm_intel_bo_map(intel_obj
->range_map_bo
,
358 (access
& GL_MAP_WRITE_BIT
) != 0);
360 obj
->Pointer
= intel_obj
->range_map_bo
->virtual + extra
;
365 if (access
& GL_MAP_UNSYNCHRONIZED_BIT
)
366 drm_intel_gem_bo_map_unsynchronized(intel_obj
->buffer
);
367 else if (!(access
& GL_MAP_READ_BIT
)) {
368 drm_intel_gem_bo_map_gtt(intel_obj
->buffer
);
370 drm_intel_bo_map(intel_obj
->buffer
, (access
& GL_MAP_WRITE_BIT
) != 0);
373 obj
->Pointer
= intel_obj
->buffer
->virtual + offset
;
377 /* Ideally we'd use a BO to avoid taking up cache space for the temporary
378 * data, but FlushMappedBufferRange may be followed by further writes to
379 * the pointer, so we would have to re-map after emitting our blit, which
380 * would defeat the point.
383 intel_bufferobj_flush_mapped_range(struct gl_context
*ctx
,
384 GLintptr offset
, GLsizeiptr length
,
385 struct gl_buffer_object
*obj
)
387 struct intel_context
*intel
= intel_context(ctx
);
388 struct intel_buffer_object
*intel_obj
= intel_buffer_object(obj
);
389 drm_intel_bo
*temp_bo
;
391 /* Unless we're in the range map using a temporary system buffer,
392 * there's no work to do.
394 if (intel_obj
->range_map_buffer
== NULL
)
400 temp_bo
= drm_intel_bo_alloc(intel
->bufmgr
, "range map flush", length
, 64);
402 /* Use obj->Pointer instead of intel_obj->range_map_buffer because the
403 * former points to the actual mapping while the latter may be offset to
404 * meet alignment guarantees.
406 drm_intel_bo_subdata(temp_bo
, 0, length
, obj
->Pointer
);
408 intel_emit_linear_blit(intel
,
409 intel_obj
->buffer
, obj
->Offset
+ offset
,
413 drm_intel_bo_unreference(temp_bo
);
418 * Called via glUnmapBuffer().
421 intel_bufferobj_unmap(struct gl_context
* ctx
, struct gl_buffer_object
*obj
)
423 struct intel_context
*intel
= intel_context(ctx
);
424 struct intel_buffer_object
*intel_obj
= intel_buffer_object(obj
);
427 assert(obj
->Pointer
);
428 if (intel_obj
->sys_buffer
!= NULL
) {
429 /* always keep the mapping around. */
430 } else if (intel_obj
->range_map_buffer
!= NULL
) {
431 /* Since we've emitted some blits to buffers that will (likely) be used
432 * in rendering operations in other cache domains in this batch, emit a
433 * flush. Once again, we wish for a domain tracker in libdrm to cover
434 * usage inside of a batchbuffer.
436 intel_batchbuffer_emit_mi_flush(intel
);
437 _mesa_align_free(intel_obj
->range_map_buffer
);
438 intel_obj
->range_map_buffer
= NULL
;
439 } else if (intel_obj
->range_map_bo
!= NULL
) {
440 const unsigned extra
= obj
->Pointer
- intel_obj
->range_map_bo
->virtual;
442 drm_intel_bo_unmap(intel_obj
->range_map_bo
);
444 intel_emit_linear_blit(intel
,
445 intel_obj
->buffer
, obj
->Offset
,
446 intel_obj
->range_map_bo
, extra
,
449 /* Since we've emitted some blits to buffers that will (likely) be used
450 * in rendering operations in other cache domains in this batch, emit a
451 * flush. Once again, we wish for a domain tracker in libdrm to cover
452 * usage inside of a batchbuffer.
454 intel_batchbuffer_emit_mi_flush(intel
);
456 drm_intel_bo_unreference(intel_obj
->range_map_bo
);
457 intel_obj
->range_map_bo
= NULL
;
458 } else if (intel_obj
->buffer
!= NULL
) {
459 drm_intel_bo_unmap(intel_obj
->buffer
);
469 intel_bufferobj_buffer(struct intel_context
*intel
,
470 struct intel_buffer_object
*intel_obj
)
472 if (intel_obj
->source
)
473 release_buffer(intel_obj
);
475 if (intel_obj
->buffer
== NULL
) {
476 intel_bufferobj_alloc_buffer(intel
, intel_obj
);
477 drm_intel_bo_subdata(intel_obj
->buffer
,
478 0, intel_obj
->Base
.Size
,
479 intel_obj
->sys_buffer
);
481 free(intel_obj
->sys_buffer
);
482 intel_obj
->sys_buffer
= NULL
;
483 intel_obj
->offset
= 0;
486 return intel_obj
->buffer
;
489 #define INTEL_UPLOAD_SIZE (64*1024)
492 intel_upload_finish(struct intel_context
*intel
)
494 if (!intel
->upload
.bo
)
497 if (intel
->upload
.buffer_len
) {
498 drm_intel_bo_subdata(intel
->upload
.bo
,
499 intel
->upload
.buffer_offset
,
500 intel
->upload
.buffer_len
,
501 intel
->upload
.buffer
);
502 intel
->upload
.buffer_len
= 0;
505 drm_intel_bo_unreference(intel
->upload
.bo
);
506 intel
->upload
.bo
= NULL
;
509 static void wrap_buffers(struct intel_context
*intel
, GLuint size
)
511 intel_upload_finish(intel
);
513 if (size
< INTEL_UPLOAD_SIZE
)
514 size
= INTEL_UPLOAD_SIZE
;
516 intel
->upload
.bo
= drm_intel_bo_alloc(intel
->bufmgr
, "upload", size
, 0);
517 intel
->upload
.offset
= 0;
520 void intel_upload_data(struct intel_context
*intel
,
521 const void *ptr
, GLuint size
, GLuint align
,
522 drm_intel_bo
**return_bo
,
523 GLuint
*return_offset
)
527 base
= (intel
->upload
.offset
+ align
- 1) / align
* align
;
528 if (intel
->upload
.bo
== NULL
|| base
+ size
> intel
->upload
.bo
->size
) {
529 wrap_buffers(intel
, size
);
533 drm_intel_bo_reference(intel
->upload
.bo
);
534 *return_bo
= intel
->upload
.bo
;
535 *return_offset
= base
;
537 delta
= base
- intel
->upload
.offset
;
538 if (intel
->upload
.buffer_len
&&
539 intel
->upload
.buffer_len
+ delta
+ size
> sizeof(intel
->upload
.buffer
))
541 drm_intel_bo_subdata(intel
->upload
.bo
,
542 intel
->upload
.buffer_offset
,
543 intel
->upload
.buffer_len
,
544 intel
->upload
.buffer
);
545 intel
->upload
.buffer_len
= 0;
548 if (size
< sizeof(intel
->upload
.buffer
))
550 if (intel
->upload
.buffer_len
== 0)
551 intel
->upload
.buffer_offset
= base
;
553 intel
->upload
.buffer_len
+= delta
;
555 memcpy(intel
->upload
.buffer
+ intel
->upload
.buffer_len
, ptr
, size
);
556 intel
->upload
.buffer_len
+= size
;
560 drm_intel_bo_subdata(intel
->upload
.bo
, base
, size
, ptr
);
563 intel
->upload
.offset
= base
+ size
;
567 intel_bufferobj_source(struct intel_context
*intel
,
568 struct intel_buffer_object
*intel_obj
,
569 GLuint align
, GLuint
*offset
)
571 if (intel_obj
->buffer
== NULL
) {
572 intel_upload_data(intel
,
573 intel_obj
->sys_buffer
, intel_obj
->Base
.Size
, align
,
574 &intel_obj
->buffer
, &intel_obj
->offset
);
575 intel_obj
->source
= 1;
578 *offset
= intel_obj
->offset
;
579 return intel_obj
->buffer
;
583 intel_bufferobj_copy_subdata(struct gl_context
*ctx
,
584 struct gl_buffer_object
*src
,
585 struct gl_buffer_object
*dst
,
586 GLintptr read_offset
, GLintptr write_offset
,
589 struct intel_context
*intel
= intel_context(ctx
);
590 struct intel_buffer_object
*intel_src
= intel_buffer_object(src
);
591 struct intel_buffer_object
*intel_dst
= intel_buffer_object(dst
);
592 drm_intel_bo
*src_bo
, *dst_bo
;
598 /* If we're in system memory, just map and memcpy. */
599 if (intel_src
->sys_buffer
|| intel_dst
->sys_buffer
) {
600 /* The same buffer may be used, but note that regions copied may
604 char *ptr
= intel_bufferobj_map_range(ctx
, 0, dst
->Size
,
608 memmove(ptr
+ write_offset
, ptr
+ read_offset
, size
);
609 intel_bufferobj_unmap(ctx
, dst
);
614 src_ptr
= intel_bufferobj_map_range(ctx
, 0, src
->Size
,
615 GL_MAP_READ_BIT
, src
);
616 dst_ptr
= intel_bufferobj_map_range(ctx
, 0, dst
->Size
,
617 GL_MAP_WRITE_BIT
, dst
);
619 memcpy(dst_ptr
+ write_offset
, src_ptr
+ read_offset
, size
);
621 intel_bufferobj_unmap(ctx
, src
);
622 intel_bufferobj_unmap(ctx
, dst
);
627 /* Otherwise, we have real BOs, so blit them. */
629 dst_bo
= intel_bufferobj_buffer(intel
, intel_dst
);
630 src_bo
= intel_bufferobj_source(intel
, intel_src
, 64, &src_offset
);
632 intel_emit_linear_blit(intel
,
633 dst_bo
, write_offset
,
634 src_bo
, read_offset
+ src_offset
, size
);
636 /* Since we've emitted some blits to buffers that will (likely) be used
637 * in rendering operations in other cache domains in this batch, emit a
638 * flush. Once again, we wish for a domain tracker in libdrm to cover
639 * usage inside of a batchbuffer.
641 intel_batchbuffer_emit_mi_flush(intel
);
645 intel_buffer_purgeable(drm_intel_bo
*buffer
)
650 retained
= drm_intel_bo_madvise (buffer
, I915_MADV_DONTNEED
);
652 return retained
? GL_VOLATILE_APPLE
: GL_RELEASED_APPLE
;
656 intel_buffer_object_purgeable(struct gl_context
* ctx
,
657 struct gl_buffer_object
*obj
,
660 struct intel_buffer_object
*intel_obj
= intel_buffer_object (obj
);
662 if (intel_obj
->buffer
!= NULL
)
663 return intel_buffer_purgeable(intel_obj
->buffer
);
665 if (option
== GL_RELEASED_APPLE
) {
666 free(intel_obj
->sys_buffer
);
667 intel_obj
->sys_buffer
= NULL
;
669 return GL_RELEASED_APPLE
;
671 /* XXX Create the buffer and madvise(MADV_DONTNEED)? */
672 struct intel_context
*intel
= intel_context(ctx
);
673 drm_intel_bo
*bo
= intel_bufferobj_buffer(intel
, intel_obj
);
675 return intel_buffer_purgeable(bo
);
680 intel_texture_object_purgeable(struct gl_context
* ctx
,
681 struct gl_texture_object
*obj
,
684 struct intel_texture_object
*intel
;
689 intel
= intel_texture_object(obj
);
690 if (intel
->mt
== NULL
|| intel
->mt
->region
== NULL
)
691 return GL_RELEASED_APPLE
;
693 return intel_buffer_purgeable(intel
->mt
->region
->bo
);
697 intel_render_object_purgeable(struct gl_context
* ctx
,
698 struct gl_renderbuffer
*obj
,
701 struct intel_renderbuffer
*intel
;
706 intel
= intel_renderbuffer(obj
);
707 if (intel
->mt
== NULL
)
708 return GL_RELEASED_APPLE
;
710 return intel_buffer_purgeable(intel
->mt
->region
->bo
);
714 intel_buffer_unpurgeable(drm_intel_bo
*buffer
)
720 retained
= drm_intel_bo_madvise (buffer
, I915_MADV_WILLNEED
);
722 return retained
? GL_RETAINED_APPLE
: GL_UNDEFINED_APPLE
;
726 intel_buffer_object_unpurgeable(struct gl_context
* ctx
,
727 struct gl_buffer_object
*obj
,
733 return intel_buffer_unpurgeable(intel_buffer_object (obj
)->buffer
);
737 intel_texture_object_unpurgeable(struct gl_context
* ctx
,
738 struct gl_texture_object
*obj
,
741 struct intel_texture_object
*intel
;
746 intel
= intel_texture_object(obj
);
747 if (intel
->mt
== NULL
|| intel
->mt
->region
== NULL
)
748 return GL_UNDEFINED_APPLE
;
750 return intel_buffer_unpurgeable(intel
->mt
->region
->bo
);
754 intel_render_object_unpurgeable(struct gl_context
* ctx
,
755 struct gl_renderbuffer
*obj
,
758 struct intel_renderbuffer
*intel
;
763 intel
= intel_renderbuffer(obj
);
764 if (intel
->mt
== NULL
)
765 return GL_UNDEFINED_APPLE
;
767 return intel_buffer_unpurgeable(intel
->mt
->region
->bo
);
771 intelInitBufferObjectFuncs(struct dd_function_table
*functions
)
773 functions
->NewBufferObject
= intel_bufferobj_alloc
;
774 functions
->DeleteBuffer
= intel_bufferobj_free
;
775 functions
->BufferData
= intel_bufferobj_data
;
776 functions
->BufferSubData
= intel_bufferobj_subdata
;
777 functions
->GetBufferSubData
= intel_bufferobj_get_subdata
;
778 functions
->MapBufferRange
= intel_bufferobj_map_range
;
779 functions
->FlushMappedBufferRange
= intel_bufferobj_flush_mapped_range
;
780 functions
->UnmapBuffer
= intel_bufferobj_unmap
;
781 functions
->CopyBufferSubData
= intel_bufferobj_copy_subdata
;
783 functions
->BufferObjectPurgeable
= intel_buffer_object_purgeable
;
784 functions
->TextureObjectPurgeable
= intel_texture_object_purgeable
;
785 functions
->RenderObjectPurgeable
= intel_render_object_purgeable
;
787 functions
->BufferObjectUnpurgeable
= intel_buffer_object_unpurgeable
;
788 functions
->TextureObjectUnpurgeable
= intel_texture_object_unpurgeable
;
789 functions
->RenderObjectUnpurgeable
= intel_render_object_unpurgeable
;