diff options
author | Eric Anholt <[email protected]> | 2013-05-23 16:58:58 -0700 |
---|---|---|
committer | Eric Anholt <[email protected]> | 2013-05-28 13:06:56 -0700 |
commit | e845c5cf7abce55759501a473459aff3bf25c9ca (patch) | |
tree | e85b20fc1c4515ec4ec5b9e6e8f300a53ea79614 /src/mesa | |
parent | 4a13beef886a1d4ce190fe29d3ef94db0c2e60b8 (diff) |
intel: Make a temporary miptree for the blit path of miptree mapping.
In a bit of debug code, we no longer have the inter-slice x/y to print.
But I think the level/slice is more useful in this case for looking at
what's getting mapped, especially given that INTEL_DEBUG=blit will tell
you the other value.
Reviewed-and-tested-by: Ian Romanick <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Acked-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 99 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 4 |
2 files changed, 29 insertions, 74 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 9998300c256..30ac470fb13 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -1461,57 +1461,39 @@ intel_miptree_map_blit(struct intel_context *intel, struct intel_miptree_map *map, unsigned int level, unsigned int slice) { - unsigned int image_x, image_y; - int x = map->x; - int y = map->y; - int ret; - - /* The blitter requires the pitch to be aligned to 4. */ - map->stride = ALIGN(map->w * mt->region->cpp, 4); - - map->bo = drm_intel_bo_alloc(intel->bufmgr, "intel_miptree_map_blit() temp", - map->stride * map->h, 4096); - if (!map->bo) { + map->mt = intel_miptree_create(intel, GL_TEXTURE_2D, mt->format, + 0, 0, + map->w, map->h, 1, + false, 0, + (1 << I915_TILING_NONE)); + if (!map->mt) { fprintf(stderr, "Failed to allocate blit temporary\n"); goto fail; } + map->stride = map->mt->region->pitch; - intel_miptree_get_image_offset(mt, level, slice, &image_x, &image_y); - x += image_x; - y += image_y; - - if (!intelEmitCopyBlit(intel, - mt->region->cpp, - mt->region->pitch, mt->region->bo, - mt->offset, mt->region->tiling, - map->stride, map->bo, - 0, I915_TILING_NONE, - x, y, - 0, 0, - map->w, map->h, - GL_COPY)) { + if (!intel_miptree_blit(intel, + mt, level, slice, + map->x, map->y, false, + map->mt, 0, 0, + 0, 0, false, + map->w, map->h, GL_COPY)) { fprintf(stderr, "Failed to blit\n"); goto fail; } intel_batchbuffer_flush(intel); - ret = drm_intel_bo_map(map->bo, (map->mode & GL_MAP_WRITE_BIT) != 0); - if (ret) { - fprintf(stderr, "Failed to map blit temporary\n"); - goto fail; - } - - map->ptr = map->bo->virtual; + map->ptr = intel_miptree_map_raw(intel, map->mt); DBG("%s: %d,%d %dx%d from mt %p (%s) %d,%d = %p/%d\n", __FUNCTION__, map->x, map->y, map->w, map->h, mt, _mesa_get_format_name(mt->format), - x, y, map->ptr, map->stride); + level, slice, map->ptr, map->stride); return; fail: - drm_intel_bo_unreference(map->bo); + intel_miptree_release(&map->mt); map->ptr = NULL; map->stride = 0; } @@ -1524,30 +1506,20 @@ intel_miptree_unmap_blit(struct intel_context *intel, unsigned int slice) { struct gl_context *ctx = &intel->ctx; - drm_intel_bo_unmap(map->bo); - if (map->mode & GL_MAP_WRITE_BIT) { - unsigned int image_x, image_y; - int x = map->x; - int y = map->y; - intel_miptree_get_image_offset(mt, level, slice, &image_x, &image_y); - x += image_x; - y += image_y; + intel_miptree_unmap_raw(intel, map->mt); - bool ok = intelEmitCopyBlit(intel, - mt->region->cpp, - map->stride, map->bo, - 0, I915_TILING_NONE, - mt->region->pitch, mt->region->bo, - mt->offset, mt->region->tiling, - 0, 0, - x, y, - map->w, map->h, - GL_COPY); + if (map->mode & GL_MAP_WRITE_BIT) { + bool ok = intel_miptree_blit(intel, + map->mt, 0, 0, + 0, 0, false, + mt, level, slice, + map->x, map->y, false, + map->w, map->h, GL_COPY); WARN_ONCE(!ok, "Failed to blit from linear temporary mapping"); } - drm_intel_bo_unreference(map->bo); + intel_miptree_release(&map->mt); } static void @@ -1901,24 +1873,7 @@ intel_miptree_map_singlesample(struct intel_context *intel, } else if (mt->stencil_mt && !(mode & BRW_MAP_DIRECT_BIT)) { intel_miptree_map_depthstencil(intel, mt, map, level, slice); } - /* According to the Ivy Bridge PRM, Vol1 Part4, section 1.2.1.2 (Graphics - * Data Size Limitations): - * - * The BLT engine is capable of transferring very large quantities of - * graphics data. Any graphics data read from and written to the - * destination is permitted to represent a number of pixels that - * occupies up to 65,536 scan lines and up to 32,768 bytes per scan line - * at the destination. The maximum number of pixels that may be - * represented per scan line’s worth of graphics data depends on the - * color depth. - * - * Furthermore, intelEmitCopyBlit (which is called by - * intel_miptree_map_blit) uses a signed 16-bit integer to represent buffer - * pitch, so it can only handle buffer pitches < 32k. - * - * As a result of these two limitations, we can only use - * intel_miptree_map_blit() when the region's pitch is less than 32k. - */ + /* See intel_miptree_blit() for details on the 32k pitch limit. */ else if (intel->has_llc && !(mode & GL_MAP_WRITE_BIT) && !mt->compressed && @@ -1964,7 +1919,7 @@ intel_miptree_unmap_singlesample(struct intel_context *intel, intel_miptree_unmap_etc(intel, mt, map, level, slice); } else if (mt->stencil_mt && !(map->mode & BRW_MAP_DIRECT_BIT)) { intel_miptree_unmap_depthstencil(intel, mt, map, level, slice); - } else if (map->bo) { + } else if (map->mt) { intel_miptree_unmap_blit(intel, mt, map, level, slice); } else { intel_miptree_unmap_gtt(intel, mt, map, level, slice); diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h index 42521283f1c..2055d1da4f1 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h @@ -84,8 +84,8 @@ struct intel_miptree_map { int x, y, w, h; /** Possibly malloced temporary buffer for the mapping. */ void *buffer; - /** Possible pointer to a BO temporary for the mapping. */ - drm_intel_bo *bo; + /** Possible pointer to a temporary linear miptree for the mapping. */ + struct intel_mipmap_tree *mt; /** Pointer to the start of (map_x, map_y) returned by the mapping. */ void *ptr; /** Stride of the mapping. */ |