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

Chris Wilson ickle at kemper.freedesktop.org
Wed Jan 4 04:52:20 PST 2012


 src/sna/kgem.c              |   15 ++++++++++-----
 src/sna/kgem.h              |    3 ++-
 src/sna/sna_accel.c         |    3 ++-
 src/sna/sna_render_inline.h |    2 +-
 4 files changed, 15 insertions(+), 8 deletions(-)

New commits:
commit 227fbb90c4884bbc58c6c0cfff9663ec9ca54171
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jan 4 11:47:32 2012 +0000

    sna: Carefully free the freed_pixmap upon exit
    
    As the contents of the pixmap are now rubbish, we need to manually
    destroy it rather than pass it to the normal sna_pixmap_destroy()
    routines.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index ab975a9..9279b58 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -9664,7 +9664,8 @@ void sna_accel_close(struct sna *sna)
 {
 	if (sna->freed_pixmap) {
 		assert(sna->freed_pixmap->refcnt == 1);
-		sna_destroy_pixmap(sna->freed_pixmap);
+		free(sna_pixmap(sna->freed_pixmap));
+		fbDestroyPixmap(sna->freed_pixmap);
 		sna->freed_pixmap = NULL;
 	}
 
commit 0ed758cd2176ee4f34e03d05d05130d52d75e577
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Jan 4 12:18:20 2012 +0000

    sna: Limit batch to a single page on 865g
    
    Verified on real hw, this undocumented (at least in the bspec before me)
    bug truly exists.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/kgem.c b/src/sna/kgem.c
index 0e83dfb..6db2e92 100644
--- a/src/sna/kgem.c
+++ b/src/sna/kgem.c
@@ -517,6 +517,11 @@ void kgem_init(struct kgem *kgem, int fd, struct pci_device *dev, int gen)
 	kgem->wedged = drmCommandNone(kgem->fd, DRM_I915_GEM_THROTTLE) == -EIO;
 	kgem->wedged |= DBG_NO_HW;
 
+	kgem->max_batch_size = ARRAY_SIZE(kgem->batch);
+	if (gen == 22)
+		/* 865g cannot handle a batch spanning multiple pages */
+		kgem->max_batch_size = 4096;
+
 	kgem->half_cpu_cache_pages = cpu_cache_size() >> 13;
 
 	list_init(&kgem->partial);
@@ -1121,7 +1126,7 @@ static int kgem_batch_write(struct kgem *kgem, uint32_t handle, uint32_t size)
 	assert(!kgem_busy(kgem, handle));
 
 	/* If there is no surface data, just upload the batch */
-	if (kgem->surface == ARRAY_SIZE(kgem->batch))
+	if (kgem->surface == kgem->max_batch_size)
 		return gem_write(kgem->fd, handle,
 				 0, sizeof(uint32_t)*kgem->nbatch,
 				 kgem->batch);
@@ -1184,7 +1189,7 @@ void kgem_reset(struct kgem *kgem)
 	kgem->aperture = 0;
 	kgem->aperture_fenced = 0;
 	kgem->nbatch = 0;
-	kgem->surface = ARRAY_SIZE(kgem->batch);
+	kgem->surface = kgem->max_batch_size;
 	kgem->mode = KGEM_NONE;
 	kgem->flush = 0;
 
@@ -1198,7 +1203,7 @@ static int compact_batch_surface(struct kgem *kgem)
 	int size, shrink, n;
 
 	/* See if we can pack the contents into one or two pages */
-	size = ARRAY_SIZE(kgem->batch) - kgem->surface + kgem->nbatch;
+	size = kgem->max_batch_size - kgem->surface + kgem->nbatch;
 	if (size > 2048)
 		return sizeof(kgem->batch);
 	else if (size > 1024)
@@ -1237,7 +1242,7 @@ void _kgem_submit(struct kgem *kgem)
 	     kgem->mode, kgem->ring, batch_end, kgem->nbatch, kgem->surface,
 	     kgem->nreloc, kgem->nexec, kgem->nfence, kgem->aperture));
 
-	assert(kgem->nbatch <= ARRAY_SIZE(kgem->batch));
+	assert(kgem->nbatch <= kgem->max_batch_size);
 	assert(kgem->nbatch <= kgem->surface);
 	assert(kgem->nreloc <= ARRAY_SIZE(kgem->reloc));
 	assert(kgem->nexec < ARRAY_SIZE(kgem->exec));
@@ -1247,7 +1252,7 @@ void _kgem_submit(struct kgem *kgem)
 #endif
 
 	rq = kgem->next_request;
-	if (kgem->surface != ARRAY_SIZE(kgem->batch))
+	if (kgem->surface != kgem->max_batch_size)
 		size = compact_batch_surface(kgem);
 	else
 		size = kgem->nbatch * sizeof(kgem->batch[0]);
diff --git a/src/sna/kgem.h b/src/sna/kgem.h
index 7f2ebaf..6aeb1fe 100644
--- a/src/sna/kgem.h
+++ b/src/sna/kgem.h
@@ -116,6 +116,7 @@ struct kgem {
 	uint16_t nexec;
 	uint16_t nreloc;
 	uint16_t nfence;
+	uint16_t max_batch_size;
 	uint16_t vma_count;
 
 	uint32_t flush:1;
@@ -146,7 +147,7 @@ struct kgem {
 #define KGEM_EXEC_RESERVED 1
 
 #define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
-#define KGEM_BATCH_SIZE(K) (ARRAY_SIZE((K)->batch)-KGEM_BATCH_RESERVED)
+#define KGEM_BATCH_SIZE(K) ((K)->max_batch_size-KGEM_BATCH_RESERVED)
 #define KGEM_EXEC_SIZE(K) (int)(ARRAY_SIZE((K)->exec)-KGEM_EXEC_RESERVED)
 #define KGEM_RELOC_SIZE(K) (int)(ARRAY_SIZE((K)->reloc)-KGEM_RELOC_RESERVED)
 
diff --git a/src/sna/sna_render_inline.h b/src/sna/sna_render_inline.h
index 0369123..33fb166 100644
--- a/src/sna/sna_render_inline.h
+++ b/src/sna/sna_render_inline.h
@@ -47,7 +47,7 @@ static inline float pack_2s(int16_t x, int16_t y)
 
 static inline int batch_space(struct sna *sna)
 {
-	return KGEM_BATCH_SIZE(&sna->kgem) - sna->kgem.nbatch;
+	return sna->kgem.surface - sna->kgem.nbatch - KGEM_BATCH_RESERVED;
 }
 
 static inline void batch_emit(struct sna *sna, uint32_t dword)


More information about the xorg-commit mailing list