xf86-video-intel: 2 commits - src/sna/kgem.c src/sna/kgem.h src/sna/sna_io.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Jul 17 01:20:04 PDT 2013


 src/sna/kgem.c   |    9 ++++++++-
 src/sna/kgem.h   |    2 +-
 src/sna/sna_io.c |    3 +++
 3 files changed, 12 insertions(+), 2 deletions(-)

New commits:
commit 3f3071c6c91c3907cb0fecf2f69a995feefe7956
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jul 17 09:02:19 2013 +0100

    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 at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 02d7481..605e049 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 406fa63..be81968 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);
commit 0952e7e04167d7b2284fc794ed9fb30afebdaf52
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jul 17 08:24:19 2013 +0100

    sna: Include linear GTT maps when deciding whether a bo is mappable
    
    If the linear bo is still in the CPU domain, we can map it through the
    CPU with no penalty, so treat it as mappable.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 8e8e883..6156b4c 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -564,7 +564,7 @@ static inline bool kgem_bo_can_map(struct kgem *kgem, struct kgem_bo *bo)
 	if (kgem_bo_mapped(kgem, bo))
 		return true;
 
-	if (!bo->tiling && kgem->has_llc)
+	if (!bo->tiling && (kgem->has_llc || bo->domain == DOMAIN_CPU))
 		return true;
 
 	if (kgem->gen == 021 && bo->tiling == I915_TILING_Y)


More information about the xorg-commit mailing list