1 /**************************************************************************
3 * Copyright 2006 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 <GL/internal/dri_interface.h>
31 #include "intel_batchbuffer.h"
32 #include "intel_chipset.h"
33 #include "intel_context.h"
34 #include "intel_mipmap_tree.h"
35 #include "intel_regions.h"
36 #include "intel_tex_layout.h"
37 #include "intel_tex.h"
38 #include "intel_blit.h"
40 #include "main/enums.h"
41 #include "main/formats.h"
42 #include "main/glformats.h"
43 #include "main/teximage.h"
45 #define FILE_DEBUG_FLAG DEBUG_MIPTREE
48 target_to_target(GLenum target
)
51 case GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB
:
52 case GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB
:
53 case GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB
:
54 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB
:
55 case GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB
:
56 case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB
:
57 return GL_TEXTURE_CUBE_MAP_ARB
;
63 struct intel_mipmap_tree
*
64 intel_miptree_create_layout(struct intel_context
*intel
,
73 struct intel_mipmap_tree
*mt
= calloc(sizeof(*mt
), 1);
77 DBG("%s target %s format %s level %d..%d <-- %p\n", __func__
,
78 _mesa_enum_to_string(target
),
79 _mesa_get_format_name(format
),
80 first_level
, last_level
, mt
);
82 mt
->target
= target_to_target(target
);
84 mt
->first_level
= first_level
;
85 mt
->last_level
= last_level
;
87 /* The cpp is bytes per (1, blockheight)-sized block for compressed
88 * textures. This is why you'll see divides by blockheight all over
91 _mesa_get_format_block_size(format
, &bw
, &bh
);
92 assert(_mesa_get_format_bytes(mt
->format
) % bw
== 0);
93 mt
->cpp
= _mesa_get_format_bytes(mt
->format
) / bw
;
95 mt
->compressed
= _mesa_is_format_compressed(format
);
98 if (target
== GL_TEXTURE_CUBE_MAP
) {
103 mt
->physical_width0
= width0
;
104 mt
->physical_height0
= height0
;
105 mt
->physical_depth0
= depth0
;
107 intel_get_texture_alignment_unit(intel
, mt
->format
,
108 &mt
->align_w
, &mt
->align_h
);
111 i945_miptree_layout(mt
);
113 i915_miptree_layout(mt
);
119 * \brief Helper function for intel_miptree_create().
122 intel_miptree_choose_tiling(struct intel_context
*intel
,
125 enum intel_miptree_tiling_mode requested
,
126 struct intel_mipmap_tree
*mt
)
128 /* Some usages may want only one type of tiling, like depth miptrees (Y
129 * tiled), or temporary BOs for uploading data once (linear).
132 case INTEL_MIPTREE_TILING_ANY
:
134 case INTEL_MIPTREE_TILING_Y
:
135 return I915_TILING_Y
;
136 case INTEL_MIPTREE_TILING_NONE
:
137 return I915_TILING_NONE
;
140 int minimum_pitch
= mt
->total_width
* mt
->cpp
;
142 /* If the width is much smaller than a tile, don't bother tiling. */
143 if (minimum_pitch
< 64)
144 return I915_TILING_NONE
;
146 if (ALIGN(minimum_pitch
, 512) >= 32768) {
147 perf_debug("%dx%d miptree too large to blit, falling back to untiled",
148 mt
->total_width
, mt
->total_height
);
149 return I915_TILING_NONE
;
152 /* We don't have BLORP to handle Y-tiled blits, so use X-tiling. */
153 return I915_TILING_X
;
156 struct intel_mipmap_tree
*
157 intel_miptree_create(struct intel_context
*intel
,
165 bool expect_accelerated_upload
,
166 enum intel_miptree_tiling_mode requested_tiling
)
168 struct intel_mipmap_tree
*mt
;
169 GLuint total_width
, total_height
;
172 mt
= intel_miptree_create_layout(intel
, target
, format
,
173 first_level
, last_level
, width0
,
176 /* pitch == 0 || height == 0 indicates the null texture */
177 if (!mt
|| !mt
->total_width
|| !mt
->total_height
) {
178 intel_miptree_release(&mt
);
182 total_width
= mt
->total_width
;
183 total_height
= mt
->total_height
;
185 uint32_t tiling
= intel_miptree_choose_tiling(intel
, format
, width0
,
188 bool y_or_x
= tiling
== (I915_TILING_Y
| I915_TILING_X
);
190 mt
->region
= intel_region_alloc(intel
->intelScreen
,
191 y_or_x
? I915_TILING_Y
: tiling
,
195 expect_accelerated_upload
);
197 /* If the region is too large to fit in the aperture, we need to use the
198 * BLT engine to support it. The BLT paths can't currently handle Y-tiling,
199 * so we need to fall back to X.
201 if (y_or_x
&& mt
->region
->bo
->size
>= intel
->max_gtt_map_object_size
) {
202 perf_debug("%dx%d miptree larger than aperture; falling back to X-tiled\n",
203 mt
->total_width
, mt
->total_height
);
204 intel_region_release(&mt
->region
);
206 mt
->region
= intel_region_alloc(intel
->intelScreen
,
211 expect_accelerated_upload
);
217 intel_miptree_release(&mt
);
224 struct intel_mipmap_tree
*
225 intel_miptree_create_for_bo(struct intel_context
*intel
,
234 struct intel_mipmap_tree
*mt
;
236 struct intel_region
*region
= calloc(1, sizeof(*region
));
240 /* Nothing will be able to use this miptree with the BO if the offset isn't
243 if (tiling
!= I915_TILING_NONE
)
244 assert(offset
% 4096 == 0);
246 /* miptrees can't handle negative pitch. If you need flipping of images,
247 * that's outside of the scope of the mt.
251 mt
= intel_miptree_create_layout(intel
, GL_TEXTURE_2D
, format
,
259 region
->cpp
= mt
->cpp
;
260 region
->width
= width
;
261 region
->height
= height
;
262 region
->pitch
= pitch
;
263 region
->refcount
= 1;
264 drm_intel_bo_reference(bo
);
266 region
->tiling
= tiling
;
276 * Wraps the given region with a miptree.
278 struct intel_mipmap_tree
*
279 intel_miptree_create_for_dri2_buffer(struct intel_context
*intel
,
280 unsigned dri_attachment
,
282 struct intel_region
*region
)
284 struct intel_mipmap_tree
*mt
= NULL
;
286 /* Only the front and back buffers, which are color buffers, are shared
289 assert(dri_attachment
== __DRI_BUFFER_BACK_LEFT
||
290 dri_attachment
== __DRI_BUFFER_FRONT_LEFT
||
291 dri_attachment
== __DRI_BUFFER_FAKE_FRONT_LEFT
);
292 assert(_mesa_get_format_base_format(format
) == GL_RGB
||
293 _mesa_get_format_base_format(format
) == GL_RGBA
);
295 mt
= intel_miptree_create_for_bo(intel
,
305 mt
->region
->name
= region
->name
;
311 * Wraps the given region with a miptree.
313 struct intel_mipmap_tree
*
314 intel_miptree_create_for_image_buffer(struct intel_context
*intel
,
315 enum __DRIimageBufferMask buffer_type
,
317 uint32_t num_samples
,
318 struct intel_region
*region
)
320 struct intel_mipmap_tree
*mt
= NULL
;
322 /* Only the front and back buffers, which are color buffers, are allocated
323 * through the image loader.
325 assert(_mesa_get_format_base_format(format
) == GL_RGB
||
326 _mesa_get_format_base_format(format
) == GL_RGBA
);
328 mt
= intel_miptree_create_for_bo(intel
,
339 struct intel_mipmap_tree
*
340 intel_miptree_create_for_renderbuffer(struct intel_context
*intel
,
347 return intel_miptree_create(intel
, GL_TEXTURE_2D
, format
, 0, 0,
348 width
, height
, depth
, true,
349 INTEL_MIPTREE_TILING_ANY
);
353 intel_miptree_reference(struct intel_mipmap_tree
**dst
,
354 struct intel_mipmap_tree
*src
)
359 intel_miptree_release(dst
);
363 DBG("%s %p refcount now %d\n", __func__
, src
, src
->refcount
);
371 intel_miptree_release(struct intel_mipmap_tree
**mt
)
376 DBG("%s %p refcount will be %d\n", __func__
, *mt
, (*mt
)->refcount
- 1);
377 if (--(*mt
)->refcount
<= 0) {
380 DBG("%s deleting %p\n", __func__
, *mt
);
382 intel_region_release(&((*mt
)->region
));
384 for (i
= 0; i
< MAX_TEXTURE_LEVELS
; i
++) {
385 free((*mt
)->level
[i
].slice
);
394 intel_miptree_get_dimensions_for_image(struct gl_texture_image
*image
,
395 int *width
, int *height
, int *depth
)
397 switch (image
->TexObject
->Target
) {
399 *width
= image
->Width
;
400 *height
= image
->Height
;
401 *depth
= image
->Depth
;
407 * Can the image be pulled into a unified mipmap tree? This mirrors
408 * the completeness test in a lot of ways.
410 * Not sure whether I want to pass gl_texture_image here.
413 intel_miptree_match_image(struct intel_mipmap_tree
*mt
,
414 struct gl_texture_image
*image
)
416 struct intel_texture_image
*intelImage
= intel_texture_image(image
);
417 GLuint level
= intelImage
->base
.Base
.Level
;
418 int width
, height
, depth
;
420 /* glTexImage* choose the texture object based on the target passed in, and
421 * objects can't change targets over their lifetimes, so this should be
424 assert(target_to_target(image
->TexObject
->Target
) == mt
->target
);
426 mesa_format mt_format
= mt
->format
;
428 if (image
->TexFormat
!= mt_format
)
431 intel_miptree_get_dimensions_for_image(image
, &width
, &height
, &depth
);
433 if (mt
->target
== GL_TEXTURE_CUBE_MAP
)
436 /* Test image dimensions against the base level image adjusted for
437 * minification. This will also catch images not present in the
438 * tree, changed targets, etc.
440 if (width
!= mt
->level
[level
].width
||
441 height
!= mt
->level
[level
].height
||
442 depth
!= mt
->level
[level
].depth
) {
451 intel_miptree_set_level_info(struct intel_mipmap_tree
*mt
,
454 GLuint w
, GLuint h
, GLuint d
)
456 mt
->level
[level
].width
= w
;
457 mt
->level
[level
].height
= h
;
458 mt
->level
[level
].depth
= d
;
459 mt
->level
[level
].level_x
= x
;
460 mt
->level
[level
].level_y
= y
;
462 DBG("%s level %d size: %d,%d,%d offset %d,%d\n", __func__
,
463 level
, w
, h
, d
, x
, y
);
465 assert(mt
->level
[level
].slice
== NULL
);
467 mt
->level
[level
].slice
= calloc(d
, sizeof(*mt
->level
[0].slice
));
468 mt
->level
[level
].slice
[0].x_offset
= mt
->level
[level
].level_x
;
469 mt
->level
[level
].slice
[0].y_offset
= mt
->level
[level
].level_y
;
474 intel_miptree_set_image_offset(struct intel_mipmap_tree
*mt
,
475 GLuint level
, GLuint img
,
478 if (img
== 0 && level
== 0)
479 assert(x
== 0 && y
== 0);
481 assert(img
< mt
->level
[level
].depth
);
483 mt
->level
[level
].slice
[img
].x_offset
= mt
->level
[level
].level_x
+ x
;
484 mt
->level
[level
].slice
[img
].y_offset
= mt
->level
[level
].level_y
+ y
;
486 DBG("%s level %d img %d pos %d,%d\n",
487 __func__
, level
, img
,
488 mt
->level
[level
].slice
[img
].x_offset
,
489 mt
->level
[level
].slice
[img
].y_offset
);
493 intel_miptree_get_image_offset(struct intel_mipmap_tree
*mt
,
494 GLuint level
, GLuint slice
,
495 GLuint
*x
, GLuint
*y
)
497 assert(slice
< mt
->level
[level
].depth
);
499 *x
= mt
->level
[level
].slice
[slice
].x_offset
;
500 *y
= mt
->level
[level
].slice
[slice
].y_offset
;
504 * Rendering with tiled buffers requires that the base address of the buffer
505 * be aligned to a page boundary. For renderbuffers, and sometimes with
506 * textures, we may want the surface to point at a texture image level that
507 * isn't at a page boundary.
509 * This function returns an appropriately-aligned base offset
510 * according to the tiling restrictions, plus any required x/y offset
514 intel_miptree_get_tile_offsets(struct intel_mipmap_tree
*mt
,
515 GLuint level
, GLuint slice
,
519 struct intel_region
*region
= mt
->region
;
521 uint32_t mask_x
, mask_y
;
523 intel_region_get_tile_masks(region
, &mask_x
, &mask_y
);
524 intel_miptree_get_image_offset(mt
, level
, slice
, &x
, &y
);
526 *tile_x
= x
& mask_x
;
527 *tile_y
= y
& mask_y
;
529 return intel_region_get_aligned_offset(region
, x
& ~mask_x
, y
& ~mask_y
);
533 intel_miptree_copy_slice_sw(struct intel_context
*intel
,
534 struct intel_mipmap_tree
*dst_mt
,
535 struct intel_mipmap_tree
*src_mt
,
542 int src_stride
, dst_stride
;
543 int cpp
= dst_mt
->cpp
;
545 intel_miptree_map(intel
, src_mt
,
552 intel_miptree_map(intel
, dst_mt
,
556 GL_MAP_WRITE_BIT
| GL_MAP_INVALIDATE_RANGE_BIT
,
559 DBG("sw blit %s mt %p %p/%d -> %s mt %p %p/%d (%dx%d)\n",
560 _mesa_get_format_name(src_mt
->format
),
561 src_mt
, src
, src_stride
,
562 _mesa_get_format_name(dst_mt
->format
),
563 dst_mt
, dst
, dst_stride
,
566 int row_size
= cpp
* width
;
567 if (src_stride
== row_size
&&
568 dst_stride
== row_size
) {
569 memcpy(dst
, src
, row_size
* height
);
571 for (int i
= 0; i
< height
; i
++) {
572 memcpy(dst
, src
, row_size
);
578 intel_miptree_unmap(intel
, dst_mt
, level
, slice
);
579 intel_miptree_unmap(intel
, src_mt
, level
, slice
);
583 intel_miptree_copy_slice(struct intel_context
*intel
,
584 struct intel_mipmap_tree
*dst_mt
,
585 struct intel_mipmap_tree
*src_mt
,
591 mesa_format format
= src_mt
->format
;
592 uint32_t width
= src_mt
->level
[level
].width
;
593 uint32_t height
= src_mt
->level
[level
].height
;
601 assert(depth
< src_mt
->level
[level
].depth
);
602 assert(src_mt
->format
== dst_mt
->format
);
604 if (dst_mt
->compressed
) {
605 height
= ALIGN(height
, dst_mt
->align_h
) / dst_mt
->align_h
;
606 width
= ALIGN(width
, dst_mt
->align_w
);
609 uint32_t dst_x
, dst_y
, src_x
, src_y
;
610 intel_miptree_get_image_offset(dst_mt
, level
, slice
, &dst_x
, &dst_y
);
611 intel_miptree_get_image_offset(src_mt
, level
, slice
, &src_x
, &src_y
);
613 DBG("validate blit mt %s %p %d,%d/%d -> mt %s %p %d,%d/%d (%dx%d)\n",
614 _mesa_get_format_name(src_mt
->format
),
615 src_mt
, src_x
, src_y
, src_mt
->region
->pitch
,
616 _mesa_get_format_name(dst_mt
->format
),
617 dst_mt
, dst_x
, dst_y
, dst_mt
->region
->pitch
,
620 if (!intel_miptree_blit(intel
,
621 src_mt
, level
, slice
, 0, 0, false,
622 dst_mt
, level
, slice
, 0, 0, false,
623 width
, height
, COLOR_LOGICOP_COPY
)) {
624 perf_debug("miptree validate blit for %s failed\n",
625 _mesa_get_format_name(format
));
627 intel_miptree_copy_slice_sw(intel
, dst_mt
, src_mt
, level
, slice
,
633 * Copies the image's current data to the given miptree, and associates that
634 * miptree with the image.
636 * If \c invalidate is true, then the actual image data does not need to be
637 * copied, but the image still needs to be associated to the new miptree (this
638 * is set to true if we're about to clear the image).
641 intel_miptree_copy_teximage(struct intel_context
*intel
,
642 struct intel_texture_image
*intelImage
,
643 struct intel_mipmap_tree
*dst_mt
,
646 struct intel_mipmap_tree
*src_mt
= intelImage
->mt
;
647 struct intel_texture_object
*intel_obj
=
648 intel_texture_object(intelImage
->base
.Base
.TexObject
);
649 int level
= intelImage
->base
.Base
.Level
;
650 int face
= intelImage
->base
.Base
.Face
;
651 GLuint depth
= intelImage
->base
.Base
.Depth
;
654 for (int slice
= 0; slice
< depth
; slice
++) {
655 intel_miptree_copy_slice(intel
, dst_mt
, src_mt
, level
, face
, slice
);
659 intel_miptree_reference(&intelImage
->mt
, dst_mt
);
660 intel_obj
->needs_validate
= true;
664 intel_miptree_map_raw(struct intel_context
*intel
, struct intel_mipmap_tree
*mt
)
666 drm_intel_bo
*bo
= mt
->region
->bo
;
668 if (unlikely(INTEL_DEBUG
& DEBUG_PERF
)) {
669 if (drm_intel_bo_busy(bo
)) {
670 perf_debug("Mapping a busy BO, causing a stall on the GPU.\n");
674 intel_flush(&intel
->ctx
);
676 if (mt
->region
->tiling
!= I915_TILING_NONE
)
677 drm_intel_gem_bo_map_gtt(bo
);
679 drm_intel_bo_map(bo
, true);
685 intel_miptree_unmap_raw(struct intel_mipmap_tree
*mt
)
687 drm_intel_bo_unmap(mt
->region
->bo
);
691 intel_miptree_map_gtt(struct intel_context
*intel
,
692 struct intel_mipmap_tree
*mt
,
693 struct intel_miptree_map
*map
,
694 unsigned int level
, unsigned int slice
)
698 unsigned int image_x
, image_y
;
702 /* For compressed formats, the stride is the number of bytes per
703 * row of blocks. intel_miptree_get_image_offset() already does
706 _mesa_get_format_block_size(mt
->format
, &bw
, &bh
);
710 base
= intel_miptree_map_raw(intel
, mt
) + mt
->offset
;
715 /* Note that in the case of cube maps, the caller must have passed the
716 * slice number referencing the face.
718 intel_miptree_get_image_offset(mt
, level
, slice
, &image_x
, &image_y
);
722 map
->stride
= mt
->region
->pitch
;
723 map
->ptr
= base
+ y
* map
->stride
+ x
* mt
->cpp
;
726 DBG("%s: %d,%d %dx%d from mt %p (%s) %d,%d = %p/%d\n", __func__
,
727 map
->x
, map
->y
, map
->w
, map
->h
,
728 mt
, _mesa_get_format_name(mt
->format
),
729 x
, y
, map
->ptr
, map
->stride
);
733 intel_miptree_unmap_gtt(struct intel_mipmap_tree
*mt
)
735 intel_miptree_unmap_raw(mt
);
739 intel_miptree_map_blit(struct intel_context
*intel
,
740 struct intel_mipmap_tree
*mt
,
741 struct intel_miptree_map
*map
,
742 unsigned int level
, unsigned int slice
)
744 map
->mt
= intel_miptree_create(intel
, GL_TEXTURE_2D
, mt
->format
,
748 INTEL_MIPTREE_TILING_NONE
);
750 fprintf(stderr
, "Failed to allocate blit temporary\n");
753 map
->stride
= map
->mt
->region
->pitch
;
755 if (!intel_miptree_blit(intel
,
757 map
->x
, map
->y
, false,
760 map
->w
, map
->h
, COLOR_LOGICOP_COPY
)) {
761 fprintf(stderr
, "Failed to blit\n");
765 intel_batchbuffer_flush(intel
);
766 map
->ptr
= intel_miptree_map_raw(intel
, map
->mt
);
768 DBG("%s: %d,%d %dx%d from mt %p (%s) %d,%d = %p/%d\n", __func__
,
769 map
->x
, map
->y
, map
->w
, map
->h
,
770 mt
, _mesa_get_format_name(mt
->format
),
771 level
, slice
, map
->ptr
, map
->stride
);
776 intel_miptree_release(&map
->mt
);
782 intel_miptree_unmap_blit(struct intel_context
*intel
,
783 struct intel_mipmap_tree
*mt
,
784 struct intel_miptree_map
*map
,
788 struct gl_context
*ctx
= &intel
->ctx
;
790 intel_miptree_unmap_raw(map
->mt
);
792 if (map
->mode
& GL_MAP_WRITE_BIT
) {
793 bool ok
= intel_miptree_blit(intel
,
797 map
->x
, map
->y
, false,
798 map
->w
, map
->h
, COLOR_LOGICOP_COPY
);
799 WARN_ONCE(!ok
, "Failed to blit from linear temporary mapping");
802 intel_miptree_release(&map
->mt
);
806 * Create and attach a map to the miptree at (level, slice). Return the
809 static struct intel_miptree_map
*
810 intel_miptree_attach_map(struct intel_mipmap_tree
*mt
,
819 struct intel_miptree_map
*map
= calloc(1, sizeof(*map
));
824 assert(mt
->level
[level
].slice
[slice
].map
== NULL
);
825 mt
->level
[level
].slice
[slice
].map
= map
;
837 * Release the map at (level, slice).
840 intel_miptree_release_map(struct intel_mipmap_tree
*mt
,
844 struct intel_miptree_map
**map
;
846 map
= &mt
->level
[level
].slice
[slice
].map
;
852 intel_miptree_map(struct intel_context
*intel
,
853 struct intel_mipmap_tree
*mt
,
864 struct intel_miptree_map
*map
;
866 map
= intel_miptree_attach_map(mt
, level
, slice
, x
, y
, w
, h
, mode
);
873 /* See intel_miptree_blit() for details on the 32k pitch limit. */
874 if (mt
->region
->tiling
!= I915_TILING_NONE
&&
875 mt
->region
->bo
->size
>= intel
->max_gtt_map_object_size
) {
876 assert(mt
->region
->pitch
< 32768);
877 intel_miptree_map_blit(intel
, mt
, map
, level
, slice
);
879 intel_miptree_map_gtt(intel
, mt
, map
, level
, slice
);
883 *out_stride
= map
->stride
;
885 if (map
->ptr
== NULL
)
886 intel_miptree_release_map(mt
, level
, slice
);
890 intel_miptree_unmap(struct intel_context
*intel
,
891 struct intel_mipmap_tree
*mt
,
895 struct intel_miptree_map
*map
= mt
->level
[level
].slice
[slice
].map
;
900 DBG("%s: mt %p (%s) level %d slice %d\n", __func__
,
901 mt
, _mesa_get_format_name(mt
->format
), level
, slice
);
904 intel_miptree_unmap_blit(intel
, mt
, map
, level
, slice
);
906 intel_miptree_unmap_gtt(mt
);
909 intel_miptree_release_map(mt
, level
, slice
);