diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-07-17 09:02:19 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-07-17 09:02:19 +0100 |
commit | 3f3071c6c91c3907cb0fecf2f69a995feefe7956 (patch) | |
tree | cd7f4721b3e37930d89c715c423c1ef433afae2d | |
parent | 0952e7e04167d7b2284fc794ed9fb30afebdaf52 (diff) |
sna: Set a minimum size for tiled IO
And assert that we never ask for a zero-sized upload.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/kgem.c | 9 | ||||
-rw-r--r-- | src/sna/sna_io.c | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index 02d74819..605e0497 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -1277,6 +1277,8 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, unsigned gen) kgem->max_upload_tile_size = kgem->aperture_high/2; if (kgem->max_upload_tile_size > kgem->aperture_low) kgem->max_upload_tile_size = kgem->aperture_low; + if (kgem->max_upload_tile_size < 16*PAGE_SIZE) + kgem->max_upload_tile_size = 16*PAGE_SIZE; kgem->large_object_size = MAX_CACHE_SIZE; if (kgem->large_object_size > half_gpu_max) @@ -1285,6 +1287,8 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, unsigned gen) kgem->max_copy_tile_size = kgem->aperture_high/2; if (kgem->max_copy_tile_size > kgem->aperture_low) kgem->max_copy_tile_size = kgem->aperture_low; + if (kgem->max_copy_tile_size < 16*PAGE_SIZE) + kgem->max_copy_tile_size = 16*PAGE_SIZE; if (kgem->has_llc | kgem->has_cacheing | kgem->has_userptr) { if (kgem->large_object_size > kgem->max_cpu_size) @@ -3201,6 +3205,8 @@ search_linear_cache(struct kgem *kgem, unsigned int num_pages, unsigned flags) num_pages >= MAX_CACHE_SIZE / PAGE_SIZE, MAX_CACHE_SIZE / PAGE_SIZE)); + assert(num_pages); + if (num_pages >= MAX_CACHE_SIZE / PAGE_SIZE) { DBG(("%s: searching large buffers\n", __FUNCTION__)); retry_large: @@ -3524,13 +3530,14 @@ struct kgem_bo *kgem_create_linear(struct kgem *kgem, int size, unsigned flags) uint32_t handle; DBG(("%s(%d)\n", __FUNCTION__, size)); + assert(size); if (flags & CREATE_GTT_MAP && kgem->has_llc) { flags &= ~CREATE_GTT_MAP; flags |= CREATE_CPU_MAP; } - size = (size + PAGE_SIZE - 1) / PAGE_SIZE; + size = NUM_PAGES(size); bo = search_linear_cache(kgem, size, CREATE_INACTIVE | flags); if (bo) { assert(bo->domain != DOMAIN_GPU); diff --git a/src/sna/sna_io.c b/src/sna/sna_io.c index 406fa63a..be819688 100644 --- a/src/sna/sna_io.c +++ b/src/sna/sna_io.c @@ -307,6 +307,7 @@ fallback: DBG(("%s: tiling download, using %dx%d tiles\n", __FUNCTION__, step, step)); + assert(step); for (tile.y1 = extents.y1; tile.y1 < extents.y2; tile.y1 = tile.y2) { int y2 = tile.y1 + step; @@ -757,6 +758,7 @@ tile: if (step * cpp > 4096) step = 4096 / cpp; + assert(step); DBG(("%s: tiling upload, using %dx%d tiles\n", __FUNCTION__, step, step)); @@ -1131,6 +1133,7 @@ tile: DBG(("%s: tiling upload, using %dx%d tiles\n", __FUNCTION__, step, step)); + assert(step); if (n > ARRAY_SIZE(stack)) { clipped = malloc(sizeof(BoxRec) * n); |