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
;
86 mt
->logical_width0
= width0
;
87 mt
->logical_height0
= height0
;
88 mt
->logical_depth0
= depth0
;
90 /* The cpp is bytes per (1, blockheight)-sized block for compressed
91 * textures. This is why you'll see divides by blockheight all over
94 _mesa_get_format_block_size(format
, &bw
, &bh
);
95 assert(_mesa_get_format_bytes(mt
->format
) % bw
== 0);
96 mt
->cpp
= _mesa_get_format_bytes(mt
->format
) / bw
;
98 mt
->compressed
= _mesa_is_format_compressed(format
);
101 if (target
== GL_TEXTURE_CUBE_MAP
) {
106 mt
->physical_width0
= width0
;
107 mt
->physical_height0
= height0
;
108 mt
->physical_depth0
= depth0
;
110 intel_get_texture_alignment_unit(intel
, mt
->format
,
111 &mt
->align_w
, &mt
->align_h
);
115 i945_miptree_layout(mt
);
117 i915_miptree_layout(mt
);
123 * \brief Helper function for intel_miptree_create().
126 intel_miptree_choose_tiling(struct intel_context
*intel
,
129 enum intel_miptree_tiling_mode requested
,
130 struct intel_mipmap_tree
*mt
)
132 /* Some usages may want only one type of tiling, like depth miptrees (Y
133 * tiled), or temporary BOs for uploading data once (linear).
136 case INTEL_MIPTREE_TILING_ANY
:
138 case INTEL_MIPTREE_TILING_Y
:
139 return I915_TILING_Y
;
140 case INTEL_MIPTREE_TILING_NONE
:
141 return I915_TILING_NONE
;
144 int minimum_pitch
= mt
->total_width
* mt
->cpp
;
146 /* If the width is much smaller than a tile, don't bother tiling. */
147 if (minimum_pitch
< 64)
148 return I915_TILING_NONE
;
150 if (ALIGN(minimum_pitch
, 512) >= 32768) {
151 perf_debug("%dx%d miptree too large to blit, falling back to untiled",
152 mt
->total_width
, mt
->total_height
);
153 return I915_TILING_NONE
;
156 /* We don't have BLORP to handle Y-tiled blits, so use X-tiling. */
157 return I915_TILING_X
;
160 struct intel_mipmap_tree
*
161 intel_miptree_create(struct intel_context
*intel
,
169 bool expect_accelerated_upload
,
170 enum intel_miptree_tiling_mode requested_tiling
)
172 struct intel_mipmap_tree
*mt
;
173 GLuint total_width
, total_height
;
176 mt
= intel_miptree_create_layout(intel
, target
, format
,
177 first_level
, last_level
, width0
,
180 * pitch == 0 || height == 0 indicates the null texture
182 if (!mt
|| !mt
->total_width
|| !mt
->total_height
) {
183 intel_miptree_release(&mt
);
187 total_width
= mt
->total_width
;
188 total_height
= mt
->total_height
;
190 uint32_t tiling
= intel_miptree_choose_tiling(intel
, format
, width0
,
193 bool y_or_x
= tiling
== (I915_TILING_Y
| I915_TILING_X
);
195 mt
->region
= intel_region_alloc(intel
->intelScreen
,
196 y_or_x
? I915_TILING_Y
: tiling
,
200 expect_accelerated_upload
);
202 /* If the region is too large to fit in the aperture, we need to use the
203 * BLT engine to support it. The BLT paths can't currently handle Y-tiling,
204 * so we need to fall back to X.
206 if (y_or_x
&& mt
->region
->bo
->size
>= intel
->max_gtt_map_object_size
) {
207 perf_debug("%dx%d miptree larger than aperture; falling back to X-tiled\n",
208 mt
->total_width
, mt
->total_height
);
209 intel_region_release(&mt
->region
);
211 mt
->region
= intel_region_alloc(intel
->intelScreen
,
216 expect_accelerated_upload
);
222 intel_miptree_release(&mt
);
229 struct intel_mipmap_tree
*
230 intel_miptree_create_for_bo(struct intel_context
*intel
,
239 struct intel_mipmap_tree
*mt
;
241 struct intel_region
*region
= calloc(1, sizeof(*region
));
245 /* Nothing will be able to use this miptree with the BO if the offset isn't
248 if (tiling
!= I915_TILING_NONE
)
249 assert(offset
% 4096 == 0);
251 /* miptrees can't handle negative pitch. If you need flipping of images,
252 * that's outside of the scope of the mt.
256 mt
= intel_miptree_create_layout(intel
, GL_TEXTURE_2D
, format
,
264 region
->cpp
= mt
->cpp
;
265 region
->width
= width
;
266 region
->height
= height
;
267 region
->pitch
= pitch
;
268 region
->refcount
= 1;
269 drm_intel_bo_reference(bo
);
271 region
->tiling
= tiling
;
281 * For a singlesample DRI2 buffer, this simply wraps the given region with a miptree.
283 * For a multisample DRI2 buffer, this wraps the given region with
284 * a singlesample miptree, then creates a multisample miptree into which the
285 * singlesample miptree is embedded as a child.
287 struct intel_mipmap_tree
*
288 intel_miptree_create_for_dri2_buffer(struct intel_context
*intel
,
289 unsigned dri_attachment
,
291 struct intel_region
*region
)
293 struct intel_mipmap_tree
*mt
= NULL
;
295 /* Only the front and back buffers, which are color buffers, are shared
298 assert(dri_attachment
== __DRI_BUFFER_BACK_LEFT
||
299 dri_attachment
== __DRI_BUFFER_FRONT_LEFT
||
300 dri_attachment
== __DRI_BUFFER_FAKE_FRONT_LEFT
);
301 assert(_mesa_get_format_base_format(format
) == GL_RGB
||
302 _mesa_get_format_base_format(format
) == GL_RGBA
);
304 mt
= intel_miptree_create_for_bo(intel
,
314 mt
->region
->name
= region
->name
;
320 * For a singlesample image buffer, this simply wraps the given region with a miptree.
322 * For a multisample image buffer, this wraps the given region with
323 * a singlesample miptree, then creates a multisample miptree into which the
324 * singlesample miptree is embedded as a child.
326 struct intel_mipmap_tree
*
327 intel_miptree_create_for_image_buffer(struct intel_context
*intel
,
328 enum __DRIimageBufferMask buffer_type
,
330 uint32_t num_samples
,
331 struct intel_region
*region
)
333 struct intel_mipmap_tree
*mt
= NULL
;
335 /* Only the front and back buffers, which are color buffers, are allocated
336 * through the image loader.
338 assert(_mesa_get_format_base_format(format
) == GL_RGB
||
339 _mesa_get_format_base_format(format
) == GL_RGBA
);
341 mt
= intel_miptree_create_for_bo(intel
,
352 struct intel_mipmap_tree
*
353 intel_miptree_create_for_renderbuffer(struct intel_context
*intel
,
360 return intel_miptree_create(intel
, GL_TEXTURE_2D
, format
, 0, 0,
361 width
, height
, depth
, true,
362 INTEL_MIPTREE_TILING_ANY
);
366 intel_miptree_reference(struct intel_mipmap_tree
**dst
,
367 struct intel_mipmap_tree
*src
)
372 intel_miptree_release(dst
);
376 DBG("%s %p refcount now %d\n", __func__
, src
, src
->refcount
);
384 intel_miptree_release(struct intel_mipmap_tree
**mt
)
389 DBG("%s %p refcount will be %d\n", __func__
, *mt
, (*mt
)->refcount
- 1);
390 if (--(*mt
)->refcount
<= 0) {
393 DBG("%s deleting %p\n", __func__
, *mt
);
395 intel_region_release(&((*mt
)->region
));
397 for (i
= 0; i
< MAX_TEXTURE_LEVELS
; i
++) {
398 free((*mt
)->level
[i
].slice
);
407 intel_miptree_get_dimensions_for_image(struct gl_texture_image
*image
,
408 int *width
, int *height
, int *depth
)
410 switch (image
->TexObject
->Target
) {
411 case GL_TEXTURE_1D_ARRAY
:
412 *width
= image
->Width
;
414 *depth
= image
->Height
;
417 *width
= image
->Width
;
418 *height
= image
->Height
;
419 *depth
= image
->Depth
;
425 * Can the image be pulled into a unified mipmap tree? This mirrors
426 * the completeness test in a lot of ways.
428 * Not sure whether I want to pass gl_texture_image here.
431 intel_miptree_match_image(struct intel_mipmap_tree
*mt
,
432 struct gl_texture_image
*image
)
434 struct intel_texture_image
*intelImage
= intel_texture_image(image
);
435 GLuint level
= intelImage
->base
.Base
.Level
;
436 int width
, height
, depth
;
438 /* glTexImage* choose the texture object based on the target passed in, and
439 * objects can't change targets over their lifetimes, so this should be
442 assert(target_to_target(image
->TexObject
->Target
) == mt
->target
);
444 mesa_format mt_format
= mt
->format
;
446 if (image
->TexFormat
!= mt_format
)
449 intel_miptree_get_dimensions_for_image(image
, &width
, &height
, &depth
);
451 if (mt
->target
== GL_TEXTURE_CUBE_MAP
)
454 /* Test image dimensions against the base level image adjusted for
455 * minification. This will also catch images not present in the
456 * tree, changed targets, etc.
458 if (mt
->target
== GL_TEXTURE_2D_MULTISAMPLE
||
459 mt
->target
== GL_TEXTURE_2D_MULTISAMPLE_ARRAY
) {
460 /* nonzero level here is always bogus */
463 if (width
!= mt
->logical_width0
||
464 height
!= mt
->logical_height0
||
465 depth
!= mt
->logical_depth0
) {
470 /* all normal textures, renderbuffers, etc */
471 if (width
!= mt
->level
[level
].width
||
472 height
!= mt
->level
[level
].height
||
473 depth
!= mt
->level
[level
].depth
) {
483 intel_miptree_set_level_info(struct intel_mipmap_tree
*mt
,
486 GLuint w
, GLuint h
, GLuint d
)
488 mt
->level
[level
].width
= w
;
489 mt
->level
[level
].height
= h
;
490 mt
->level
[level
].depth
= d
;
491 mt
->level
[level
].level_x
= x
;
492 mt
->level
[level
].level_y
= y
;
494 DBG("%s level %d size: %d,%d,%d offset %d,%d\n", __func__
,
495 level
, w
, h
, d
, x
, y
);
497 assert(mt
->level
[level
].slice
== NULL
);
499 mt
->level
[level
].slice
= calloc(d
, sizeof(*mt
->level
[0].slice
));
500 mt
->level
[level
].slice
[0].x_offset
= mt
->level
[level
].level_x
;
501 mt
->level
[level
].slice
[0].y_offset
= mt
->level
[level
].level_y
;
506 intel_miptree_set_image_offset(struct intel_mipmap_tree
*mt
,
507 GLuint level
, GLuint img
,
510 if (img
== 0 && level
== 0)
511 assert(x
== 0 && y
== 0);
513 assert(img
< mt
->level
[level
].depth
);
515 mt
->level
[level
].slice
[img
].x_offset
= mt
->level
[level
].level_x
+ x
;
516 mt
->level
[level
].slice
[img
].y_offset
= mt
->level
[level
].level_y
+ y
;
518 DBG("%s level %d img %d pos %d,%d\n",
519 __func__
, level
, img
,
520 mt
->level
[level
].slice
[img
].x_offset
,
521 mt
->level
[level
].slice
[img
].y_offset
);
525 intel_miptree_get_image_offset(struct intel_mipmap_tree
*mt
,
526 GLuint level
, GLuint slice
,
527 GLuint
*x
, GLuint
*y
)
529 assert(slice
< mt
->level
[level
].depth
);
531 *x
= mt
->level
[level
].slice
[slice
].x_offset
;
532 *y
= mt
->level
[level
].slice
[slice
].y_offset
;
536 * Rendering with tiled buffers requires that the base address of the buffer
537 * be aligned to a page boundary. For renderbuffers, and sometimes with
538 * textures, we may want the surface to point at a texture image level that
539 * isn't at a page boundary.
541 * This function returns an appropriately-aligned base offset
542 * according to the tiling restrictions, plus any required x/y offset
546 intel_miptree_get_tile_offsets(struct intel_mipmap_tree
*mt
,
547 GLuint level
, GLuint slice
,
551 struct intel_region
*region
= mt
->region
;
553 uint32_t mask_x
, mask_y
;
555 intel_region_get_tile_masks(region
, &mask_x
, &mask_y
, false);
556 intel_miptree_get_image_offset(mt
, level
, slice
, &x
, &y
);
558 *tile_x
= x
& mask_x
;
559 *tile_y
= y
& mask_y
;
561 return intel_region_get_aligned_offset(region
, x
& ~mask_x
, y
& ~mask_y
,
566 intel_miptree_copy_slice_sw(struct intel_context
*intel
,
567 struct intel_mipmap_tree
*dst_mt
,
568 struct intel_mipmap_tree
*src_mt
,
575 int src_stride
, dst_stride
;
576 int cpp
= dst_mt
->cpp
;
578 intel_miptree_map(intel
, src_mt
,
585 intel_miptree_map(intel
, dst_mt
,
589 GL_MAP_WRITE_BIT
| GL_MAP_INVALIDATE_RANGE_BIT
,
592 DBG("sw blit %s mt %p %p/%d -> %s mt %p %p/%d (%dx%d)\n",
593 _mesa_get_format_name(src_mt
->format
),
594 src_mt
, src
, src_stride
,
595 _mesa_get_format_name(dst_mt
->format
),
596 dst_mt
, dst
, dst_stride
,
599 int row_size
= cpp
* width
;
600 if (src_stride
== row_size
&&
601 dst_stride
== row_size
) {
602 memcpy(dst
, src
, row_size
* height
);
604 for (int i
= 0; i
< height
; i
++) {
605 memcpy(dst
, src
, row_size
);
611 intel_miptree_unmap(intel
, dst_mt
, level
, slice
);
612 intel_miptree_unmap(intel
, src_mt
, level
, slice
);
616 intel_miptree_copy_slice(struct intel_context
*intel
,
617 struct intel_mipmap_tree
*dst_mt
,
618 struct intel_mipmap_tree
*src_mt
,
624 mesa_format format
= src_mt
->format
;
625 uint32_t width
= src_mt
->level
[level
].width
;
626 uint32_t height
= src_mt
->level
[level
].height
;
634 assert(depth
< src_mt
->level
[level
].depth
);
635 assert(src_mt
->format
== dst_mt
->format
);
637 if (dst_mt
->compressed
) {
638 height
= ALIGN(height
, dst_mt
->align_h
) / dst_mt
->align_h
;
639 width
= ALIGN(width
, dst_mt
->align_w
);
642 uint32_t dst_x
, dst_y
, src_x
, src_y
;
643 intel_miptree_get_image_offset(dst_mt
, level
, slice
, &dst_x
, &dst_y
);
644 intel_miptree_get_image_offset(src_mt
, level
, slice
, &src_x
, &src_y
);
646 DBG("validate blit mt %s %p %d,%d/%d -> mt %s %p %d,%d/%d (%dx%d)\n",
647 _mesa_get_format_name(src_mt
->format
),
648 src_mt
, src_x
, src_y
, src_mt
->region
->pitch
,
649 _mesa_get_format_name(dst_mt
->format
),
650 dst_mt
, dst_x
, dst_y
, dst_mt
->region
->pitch
,
653 if (!intel_miptree_blit(intel
,
654 src_mt
, level
, slice
, 0, 0, false,
655 dst_mt
, level
, slice
, 0, 0, false,
656 width
, height
, GL_COPY
)) {
657 perf_debug("miptree validate blit for %s failed\n",
658 _mesa_get_format_name(format
));
660 intel_miptree_copy_slice_sw(intel
, dst_mt
, src_mt
, level
, slice
,
666 * Copies the image's current data to the given miptree, and associates that
667 * miptree with the image.
669 * If \c invalidate is true, then the actual image data does not need to be
670 * copied, but the image still needs to be associated to the new miptree (this
671 * is set to true if we're about to clear the image).
674 intel_miptree_copy_teximage(struct intel_context
*intel
,
675 struct intel_texture_image
*intelImage
,
676 struct intel_mipmap_tree
*dst_mt
,
679 struct intel_mipmap_tree
*src_mt
= intelImage
->mt
;
680 struct intel_texture_object
*intel_obj
=
681 intel_texture_object(intelImage
->base
.Base
.TexObject
);
682 int level
= intelImage
->base
.Base
.Level
;
683 int face
= intelImage
->base
.Base
.Face
;
684 GLuint depth
= intelImage
->base
.Base
.Depth
;
687 for (int slice
= 0; slice
< depth
; slice
++) {
688 intel_miptree_copy_slice(intel
, dst_mt
, src_mt
, level
, face
, slice
);
692 intel_miptree_reference(&intelImage
->mt
, dst_mt
);
693 intel_obj
->needs_validate
= true;
697 intel_miptree_map_raw(struct intel_context
*intel
, struct intel_mipmap_tree
*mt
)
699 drm_intel_bo
*bo
= mt
->region
->bo
;
701 if (unlikely(INTEL_DEBUG
& DEBUG_PERF
)) {
702 if (drm_intel_bo_busy(bo
)) {
703 perf_debug("Mapping a busy BO, causing a stall on the GPU.\n");
707 intel_flush(&intel
->ctx
);
709 if (mt
->region
->tiling
!= I915_TILING_NONE
)
710 drm_intel_gem_bo_map_gtt(bo
);
712 drm_intel_bo_map(bo
, true);
718 intel_miptree_unmap_raw(struct intel_mipmap_tree
*mt
)
720 drm_intel_bo_unmap(mt
->region
->bo
);
724 intel_miptree_map_gtt(struct intel_context
*intel
,
725 struct intel_mipmap_tree
*mt
,
726 struct intel_miptree_map
*map
,
727 unsigned int level
, unsigned int slice
)
731 unsigned int image_x
, image_y
;
735 /* For compressed formats, the stride is the number of bytes per
736 * row of blocks. intel_miptree_get_image_offset() already does
739 _mesa_get_format_block_size(mt
->format
, &bw
, &bh
);
743 base
= intel_miptree_map_raw(intel
, mt
) + mt
->offset
;
748 /* Note that in the case of cube maps, the caller must have passed the
749 * slice number referencing the face.
751 intel_miptree_get_image_offset(mt
, level
, slice
, &image_x
, &image_y
);
755 map
->stride
= mt
->region
->pitch
;
756 map
->ptr
= base
+ y
* map
->stride
+ x
* mt
->cpp
;
759 DBG("%s: %d,%d %dx%d from mt %p (%s) %d,%d = %p/%d\n", __func__
,
760 map
->x
, map
->y
, map
->w
, map
->h
,
761 mt
, _mesa_get_format_name(mt
->format
),
762 x
, y
, map
->ptr
, map
->stride
);
766 intel_miptree_unmap_gtt(struct intel_mipmap_tree
*mt
)
768 intel_miptree_unmap_raw(mt
);
772 intel_miptree_map_blit(struct intel_context
*intel
,
773 struct intel_mipmap_tree
*mt
,
774 struct intel_miptree_map
*map
,
775 unsigned int level
, unsigned int slice
)
777 map
->mt
= intel_miptree_create(intel
, GL_TEXTURE_2D
, mt
->format
,
781 INTEL_MIPTREE_TILING_NONE
);
783 fprintf(stderr
, "Failed to allocate blit temporary\n");
786 map
->stride
= map
->mt
->region
->pitch
;
788 if (!intel_miptree_blit(intel
,
790 map
->x
, map
->y
, false,
793 map
->w
, map
->h
, GL_COPY
)) {
794 fprintf(stderr
, "Failed to blit\n");
798 intel_batchbuffer_flush(intel
);
799 map
->ptr
= intel_miptree_map_raw(intel
, map
->mt
);
801 DBG("%s: %d,%d %dx%d from mt %p (%s) %d,%d = %p/%d\n", __func__
,
802 map
->x
, map
->y
, map
->w
, map
->h
,
803 mt
, _mesa_get_format_name(mt
->format
),
804 level
, slice
, map
->ptr
, map
->stride
);
809 intel_miptree_release(&map
->mt
);
815 intel_miptree_unmap_blit(struct intel_context
*intel
,
816 struct intel_mipmap_tree
*mt
,
817 struct intel_miptree_map
*map
,
821 struct gl_context
*ctx
= &intel
->ctx
;
823 intel_miptree_unmap_raw(map
->mt
);
825 if (map
->mode
& GL_MAP_WRITE_BIT
) {
826 bool ok
= intel_miptree_blit(intel
,
830 map
->x
, map
->y
, false,
831 map
->w
, map
->h
, GL_COPY
);
832 WARN_ONCE(!ok
, "Failed to blit from linear temporary mapping");
835 intel_miptree_release(&map
->mt
);
839 * Create and attach a map to the miptree at (level, slice). Return the
842 static struct intel_miptree_map
*
843 intel_miptree_attach_map(struct intel_mipmap_tree
*mt
,
852 struct intel_miptree_map
*map
= calloc(1, sizeof(*map
));
857 assert(mt
->level
[level
].slice
[slice
].map
== NULL
);
858 mt
->level
[level
].slice
[slice
].map
= map
;
870 * Release the map at (level, slice).
873 intel_miptree_release_map(struct intel_mipmap_tree
*mt
,
877 struct intel_miptree_map
**map
;
879 map
= &mt
->level
[level
].slice
[slice
].map
;
885 intel_miptree_map(struct intel_context
*intel
,
886 struct intel_mipmap_tree
*mt
,
897 struct intel_miptree_map
*map
;
899 map
= intel_miptree_attach_map(mt
, level
, slice
, x
, y
, w
, h
, mode
);
906 /* See intel_miptree_blit() for details on the 32k pitch limit. */
907 if (mt
->region
->tiling
!= I915_TILING_NONE
&&
908 mt
->region
->bo
->size
>= intel
->max_gtt_map_object_size
) {
909 assert(mt
->region
->pitch
< 32768);
910 intel_miptree_map_blit(intel
, mt
, map
, level
, slice
);
912 intel_miptree_map_gtt(intel
, mt
, map
, level
, slice
);
916 *out_stride
= map
->stride
;
918 if (map
->ptr
== NULL
)
919 intel_miptree_release_map(mt
, level
, slice
);
923 intel_miptree_unmap(struct intel_context
*intel
,
924 struct intel_mipmap_tree
*mt
,
928 struct intel_miptree_map
*map
= mt
->level
[level
].slice
[slice
].map
;
933 DBG("%s: mt %p (%s) level %d slice %d\n", __func__
,
934 mt
, _mesa_get_format_name(mt
->format
), level
, slice
);
937 intel_miptree_unmap_blit(intel
, mt
, map
, level
, slice
);
939 intel_miptree_unmap_gtt(mt
);
942 intel_miptree_release_map(mt
, level
, slice
);