Mesa (9.1): intel: Do temporary CPU maps of textures that are too big to GTT map.
Ian Romanick
idr at kemper.freedesktop.org
Wed Jun 19 08:24:25 UTC 2013
Module: Mesa
Branch: 9.1
Commit: a9c794323c78d8ef890b36e41b6ca4752640ca2c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a9c794323c78d8ef890b36e41b6ca4752640ca2c
Author: Eric Anholt <eric at anholt.net>
Date: Tue Apr 2 17:21:25 2013 -0700
intel: Do temporary CPU maps of textures that are too big to GTT map.
This still fails, since 8192*4bpp == 32768, which is too big to use the
blitter on.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Daniel Vetter <daniel.vetter at ffwll.ch>
(cherry picked from commit dfed1150904ce8455126574a3dd5439de541726c)
---
src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index 87635b3..ee4ab92 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -1572,6 +1572,23 @@ intel_miptree_map_singlesample(struct intel_context *intel,
{
struct intel_miptree_map *map;
+ /* Estimate the size of the mappable aperture into the GTT. There's an
+ * ioctl to get the whole GTT size, but not one to get the mappable subset.
+ * It turns out it's basically always 256MB, though some ancient hardware
+ * was smaller.
+ */
+ uint32_t gtt_size = 256 * 1024 * 1024;
+ if (intel->gen == 2)
+ gtt_size = 128 * 1024 * 1024;
+
+ /* We don't want to map two objects such that a memcpy between them would
+ * just fault one mapping in and then the other over and over forever. So
+ * we would need to divide the GTT size by 2. Additionally, some GTT is
+ * taken up by things like the framebuffer and the ringbuffer and such, so
+ * be more conservative.
+ */
+ uint32_t max_gtt_map_object_size = gtt_size / 4;
+
assert(mt->num_samples <= 1);
map = intel_miptree_attach_map(mt, level, slice, x, y, w, h, mode);
@@ -1617,6 +1634,10 @@ intel_miptree_map_singlesample(struct intel_context *intel,
mt->region->tiling == I915_TILING_X &&
mt->region->pitch < 32768) {
intel_miptree_map_blit(intel, mt, map, level, slice);
+ } else if (mt->region->tiling != I915_TILING_NONE &&
+ mt->region->bo->size >= max_gtt_map_object_size) {
+ assert(mt->region->pitch < 32768);
+ intel_miptree_map_blit(intel, mt, map, level, slice);
} else {
intel_miptree_map_gtt(intel, mt, map, level, slice);
}
More information about the mesa-commit
mailing list