[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#549588: [PATCH] Re: Bug#549588: xserver-xorg-core: Loading glx module causes X server to crash



This bug has been fixed in Ubuntu  with the following patches.

mesa (7.6.0-1ubuntu3) karmic; urgency=low

 * Add 109_revert-dma-reuse.patch: Fix assertion failure leading to crash
   on kwin when compositing is enabled.  This reverts commit 284a7af27.
   (LP: #446578)

-- Bryce Harrington <bryce@ubuntu.com>  Tue, 13 Oct 2009 00:52:32 -0700

mesa (7.6.0-1ubuntu2) karmic; urgency=low

 * Add 108_fix_scissors_regression.patch: Fix window drawing regression
   in Kwin on older Radeon hardware.
   (LP: #446425)

-- Bryce Harrington <bryce@ubuntu.com>  Fri, 09 Oct 2009 14:12:44 -0700

108_fix_scissors_regression.patch has already been committed in mesa upstream.
109_revert-dma-reuse.patch has not.

I have tested these patches on my own system and can confirm that it solves the KDE crashes and graphics corruption issues on my Dell laptop with a Radeon RS690 GPU.

-- Eric


commit 194ede4bf97547ce8a61587ede0b0a5054955783
Author: Alex Deucher <alexdeucher@gmail.com>
Date:   Fri Oct 9 15:44:32 2009 -0400

    radeon: fix scissor regression
    
    fixes fdo bug 24248

diff --git a/src/mesa/drivers/dri/r600/r700_state.c b/src/mesa/drivers/dri/r600/r700_state.c
index 124469b..98f116d 100644
--- a/src/mesa/drivers/dri/r600/r700_state.c
+++ b/src/mesa/drivers/dri/r600/r700_state.c
@@ -1269,11 +1269,15 @@ void r700SetScissor(context_t *context) //---------------
 		return;
 	}
 	if (context->radeon.state.scissor.enabled) {
-		/* r600 has exclusive scissors */
 		x1 = context->radeon.state.scissor.rect.x1;
 		y1 = context->radeon.state.scissor.rect.y1;
-		x2 = context->radeon.state.scissor.rect.x2 + 1;
-		y2 = context->radeon.state.scissor.rect.y2 + 1;
+		x2 = context->radeon.state.scissor.rect.x2;
+		y2 = context->radeon.state.scissor.rect.y2;
+		/* r600 has exclusive BR scissors */
+		if (context->radeon.radeonScreen->kernel_mm) {
+			x2++;
+			y2++;
+		}
 	} else {
 		if (context->radeon.radeonScreen->driScreen->dri2.enabled) {
 			x1 = 0;
diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c
index 9817ff8..8032cbc 100644
--- a/src/mesa/drivers/dri/radeon/radeon_common.c
+++ b/src/mesa/drivers/dri/radeon/radeon_common.c
@@ -229,16 +229,15 @@ void radeonUpdateScissor( GLcontext *ctx )
 	}
 	if (!rmesa->radeonScreen->kernel_mm) {
 	   /* Fix scissors for dri 1 */
-
 	   __DRIdrawablePrivate *dPriv = radeon_get_drawable(rmesa);
 	   x1 += dPriv->x;
-	   x2 += dPriv->x;
+	   x2 += dPriv->x + 1;
 	   min_x += dPriv->x;
-	   max_x += dPriv->x;
+	   max_x += dPriv->x + 1;
 	   y1 += dPriv->y;
-	   y2 += dPriv->y;
+	   y2 += dPriv->y + 1;
 	   min_y += dPriv->y;
-	   max_y += dPriv->y;
+	   max_y += dPriv->y + 1;
 	}
 
 	rmesa->state.scissor.rect.x1 = CLAMP(x1,  min_x, max_x);
diff -Nurp mesa-7.6-revert-dma-reuse-patched/src/mesa/drivers/dri/r200/radeon_dma.c mesa-7.6-revert-dma-reuse-working/src/mesa/drivers/dri/r200/radeon_dma.c
--- mesa-7.6-revert-dma-reuse-patched/src/mesa/drivers/dri/r200/radeon_dma.c	2009-10-08 17:00:00.000000000 -0700
+++ mesa-7.6-revert-dma-reuse-working/src/mesa/drivers/dri/r200/radeon_dma.c	2009-10-08 17:01:37.000000000 -0700
@@ -207,6 +207,7 @@ again_alloc:
 		   counter on unused buffers for later freeing them from
 		   begin of list */
 		dma_bo = last_elem(&rmesa->dma.free);
+		assert(dma_bo->bo->cref == 1);
 		remove_from_list(dma_bo);
 		insert_at_head(&rmesa->dma.reserved, dma_bo);
 	}
@@ -306,10 +307,6 @@ static int radeon_bo_is_idle(struct rade
 		WARN_ONCE("Your libdrm or kernel doesn't have support for busy query.\n"
 			"This may cause small performance drop for you.\n");
 	}
-	/* Protect against bug in legacy bo handling that causes bos stay
-	 * referenced even after they should be freed */
-	if (bo->cref != 1)
-		return 0;
 	return ret != -EBUSY;
 }
 
@@ -346,9 +343,7 @@ void radeonReleaseDmaRegions(radeonConte
 	foreach_s(dma_bo, temp, &rmesa->dma.wait) {
 		if (dma_bo->expire_counter == time) {
 			WARN_ONCE("Leaking dma buffer object!\n");
-			/* force free of buffer so we don't realy start
-			 * leaking stuff now*/
-			while ((dma_bo->bo = radeon_bo_unref(dma_bo->bo))) {}
+			radeon_bo_unref(dma_bo->bo);
 			remove_from_list(dma_bo);
 			FREE(dma_bo);
 			continue;
diff -Nurp mesa-7.6-revert-dma-reuse-patched/src/mesa/drivers/dri/r300/radeon_dma.c mesa-7.6-revert-dma-reuse-working/src/mesa/drivers/dri/r300/radeon_dma.c
--- mesa-7.6-revert-dma-reuse-patched/src/mesa/drivers/dri/r300/radeon_dma.c	2009-10-08 17:00:00.000000000 -0700
+++ mesa-7.6-revert-dma-reuse-working/src/mesa/drivers/dri/r300/radeon_dma.c	2009-10-08 17:01:37.000000000 -0700
@@ -207,6 +207,7 @@ again_alloc:
 		   counter on unused buffers for later freeing them from
 		   begin of list */
 		dma_bo = last_elem(&rmesa->dma.free);
+		assert(dma_bo->bo->cref == 1);
 		remove_from_list(dma_bo);
 		insert_at_head(&rmesa->dma.reserved, dma_bo);
 	}
@@ -306,10 +307,6 @@ static int radeon_bo_is_idle(struct rade
 		WARN_ONCE("Your libdrm or kernel doesn't have support for busy query.\n"
 			"This may cause small performance drop for you.\n");
 	}
-	/* Protect against bug in legacy bo handling that causes bos stay
-	 * referenced even after they should be freed */
-	if (bo->cref != 1)
-		return 0;
 	return ret != -EBUSY;
 }
 
@@ -346,9 +343,7 @@ void radeonReleaseDmaRegions(radeonConte
 	foreach_s(dma_bo, temp, &rmesa->dma.wait) {
 		if (dma_bo->expire_counter == time) {
 			WARN_ONCE("Leaking dma buffer object!\n");
-			/* force free of buffer so we don't realy start
-			 * leaking stuff now*/
-			while ((dma_bo->bo = radeon_bo_unref(dma_bo->bo))) {}
+			radeon_bo_unref(dma_bo->bo);
 			remove_from_list(dma_bo);
 			FREE(dma_bo);
 			continue;
diff -Nurp mesa-7.6-revert-dma-reuse-patched/src/mesa/drivers/dri/r600/radeon_dma.c mesa-7.6-revert-dma-reuse-working/src/mesa/drivers/dri/r600/radeon_dma.c
--- mesa-7.6-revert-dma-reuse-patched/src/mesa/drivers/dri/r600/radeon_dma.c	2009-10-08 17:00:00.000000000 -0700
+++ mesa-7.6-revert-dma-reuse-working/src/mesa/drivers/dri/r600/radeon_dma.c	2009-10-08 17:01:37.000000000 -0700
@@ -207,6 +207,7 @@ again_alloc:
 		   counter on unused buffers for later freeing them from
 		   begin of list */
 		dma_bo = last_elem(&rmesa->dma.free);
+		assert(dma_bo->bo->cref == 1);
 		remove_from_list(dma_bo);
 		insert_at_head(&rmesa->dma.reserved, dma_bo);
 	}
@@ -306,10 +307,6 @@ static int radeon_bo_is_idle(struct rade
 		WARN_ONCE("Your libdrm or kernel doesn't have support for busy query.\n"
 			"This may cause small performance drop for you.\n");
 	}
-	/* Protect against bug in legacy bo handling that causes bos stay
-	 * referenced even after they should be freed */
-	if (bo->cref != 1)
-		return 0;
 	return ret != -EBUSY;
 }
 
@@ -346,9 +343,7 @@ void radeonReleaseDmaRegions(radeonConte
 	foreach_s(dma_bo, temp, &rmesa->dma.wait) {
 		if (dma_bo->expire_counter == time) {
 			WARN_ONCE("Leaking dma buffer object!\n");
-			/* force free of buffer so we don't realy start
-			 * leaking stuff now*/
-			while ((dma_bo->bo = radeon_bo_unref(dma_bo->bo))) {}
+			radeon_bo_unref(dma_bo->bo);
 			remove_from_list(dma_bo);
 			FREE(dma_bo);
 			continue;
diff -Nurp mesa-7.6-revert-dma-reuse-patched/src/mesa/drivers/dri/radeon/radeon_dma.c mesa-7.6-revert-dma-reuse-working/src/mesa/drivers/dri/radeon/radeon_dma.c
--- mesa-7.6-revert-dma-reuse-patched/src/mesa/drivers/dri/radeon/radeon_dma.c	2009-10-08 17:00:00.000000000 -0700
+++ mesa-7.6-revert-dma-reuse-working/src/mesa/drivers/dri/radeon/radeon_dma.c	2009-10-08 17:01:37.000000000 -0700
@@ -207,6 +207,7 @@ again_alloc:
 		   counter on unused buffers for later freeing them from
 		   begin of list */
 		dma_bo = last_elem(&rmesa->dma.free);
+		assert(dma_bo->bo->cref == 1);
 		remove_from_list(dma_bo);
 		insert_at_head(&rmesa->dma.reserved, dma_bo);
 	}
@@ -306,10 +307,6 @@ static int radeon_bo_is_idle(struct rade
 		WARN_ONCE("Your libdrm or kernel doesn't have support for busy query.\n"
 			"This may cause small performance drop for you.\n");
 	}
-	/* Protect against bug in legacy bo handling that causes bos stay
-	 * referenced even after they should be freed */
-	if (bo->cref != 1)
-		return 0;
 	return ret != -EBUSY;
 }
 
@@ -346,9 +343,7 @@ void radeonReleaseDmaRegions(radeonConte
 	foreach_s(dma_bo, temp, &rmesa->dma.wait) {
 		if (dma_bo->expire_counter == time) {
 			WARN_ONCE("Leaking dma buffer object!\n");
-			/* force free of buffer so we don't realy start
-			 * leaking stuff now*/
-			while ((dma_bo->bo = radeon_bo_unref(dma_bo->bo))) {}
+			radeon_bo_unref(dma_bo->bo);
 			remove_from_list(dma_bo);
 			FREE(dma_bo);
 			continue;

Reply to: