xf86-video-intel: src/sna/sna_blt.c

Chris Wilson ickle at kemper.freedesktop.org
Mon Sep 8 08:55:28 PDT 2014


 src/sna/sna_blt.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

New commits:
commit e0f7e9fc2f0b39b9e939ff48edea29950f125420
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Mon Sep 8 16:49:29 2014 +0100

    sna: Initialise and check for batch space
    
    commit 30932a7b9d255c2037bee19e01aa3edc37b07386
    Author: Chris Wilson <chris at chris-wilson.co.uk>
    Date:   Mon Sep 8 12:41:06 2014 +0100
    
        sna: Avoid u16 underflow when computing reserved batch space
    
    relied on gcc a little to much to warn me when I missed initialising 'rem'
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=77074
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_blt.c b/src/sna/sna_blt.c
index 25b6ef5..17ed828 100644
--- a/src/sna/sna_blt.c
+++ b/src/sna/sna_blt.c
@@ -176,7 +176,8 @@ static bool sna_blt_fill_init(struct sna *sna,
 	{
 		uint32_t *b;
 
-		if (!kgem_check_reloc(kgem, 1)) {
+		if (!kgem_check_batch(kgem, 24) ||
+		    !kgem_check_reloc(kgem, 1)) {
 			_kgem_submit(kgem);
 			if (!kgem_check_bo_fenced(kgem, bo))
 				return false;
@@ -1799,6 +1800,7 @@ static void blt_composite_copy_boxes__thread64(struct sna *sna,
 			int nbox_this_time, rem;
 
 			nbox_this_time = nbox;
+			rem = kgem_batch_space(kgem);
 			if (10*nbox_this_time > rem)
 				nbox_this_time = rem / 10;
 			if (2*nbox_this_time > KGEM_RELOC_SIZE(kgem) - kgem->nreloc)
@@ -3496,7 +3498,8 @@ bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu,
 	{
 		uint32_t *b;
 
-		if (!kgem_check_reloc(kgem, 1)) {
+		if (!kgem_check_batch(kgem, 24) ||
+		    !kgem_check_reloc(kgem, 1)) {
 			_kgem_submit(kgem);
 			if (!kgem_check_bo_fenced(&sna->kgem, bo))
 				return false;
@@ -3556,6 +3559,7 @@ bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu,
 		int nbox_this_time, rem;
 
 		nbox_this_time = nbox;
+		rem = kgem_batch_space(kgem);
 		if (3*nbox_this_time > rem)
 			nbox_this_time = rem / 3;
 		assert(nbox_this_time);
@@ -3632,6 +3636,7 @@ bool sna_blt_fill_boxes(struct sna *sna, uint8_t alu,
 				kgem->nbatch += 9;
 			}
 			assert(kgem->nbatch < kgem->surface);
+			assert(kgem_check_batch(kgem, 3));
 		}
 	} while (nbox);
 


More information about the xorg-commit mailing list