Re: [Bug #11875] radeonfb lockup in .28-rc (bisected)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Benjamin Herrenschmidt
Date: Sunday, November 9, 2008 - 10:46 pm

On Sun, 2008-11-09 at 18:59 +0100, Rafael J. Wysocki wrote:

Allright, so I finally managed to find a machine to reproduce it and
I have a patch that fixes it here. I'm basically implementing the same
thing as X which is to ensure the bitmap is padded to 32 pixels. The
core fbcon has support for that to a certain extent so it's a fairly
small change.

Note that there was another bug, I think I was missing one
wait_for_fifo() though fixing that didn't make a difference here.

However, it's possible that this significantly impacts the performances,
maybe to the point where we may want to back out the imageblt
acceleration.

David, would you mind testing on your machine ? It's the one that shows
the biggest performance improvement, and I would like to know how much
it is affected by that patch. As long as the "worst case" performance
is still reasonable, I'm ok to take the hit if the improvement for you
is still significant.

Cheers,
Ben.

radeonfb: Fix accel problems with new imageblit hook

Some radeon chips have issues with color expansion of pixmaps that
aren't a multiple of 32 pixels wide. This works around it the same
way X does by requesting the right pitch alignment from fbcon and
then using the chip scissors to do clipping to the requested size.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---

If confirmed by the reporters (in CC), please apply for .28 as it
fixes a regression.

Index: linux-work/drivers/video/aty/radeon_accel.c
===================================================================
--- linux-work.orig/drivers/video/aty/radeon_accel.c	2008-11-10 14:05:06.000000000 +1100
+++ linux-work/drivers/video/aty/radeon_accel.c	2008-11-10 14:34:45.000000000 +1100
@@ -179,7 +179,7 @@ static void radeonfb_prim_imageblit(stru
 
 	radeonfb_set_creg(rinfo, DP_GUI_MASTER_CNTL, &rinfo->dp_gui_mc_cache,
 			  rinfo->dp_gui_mc_base |
-			  GMC_BRUSH_NONE |
+			  GMC_BRUSH_NONE | GMC_DST_CLIP_LEAVE |
 			  GMC_SRC_DATATYPE_MONO_FG_BG |
 			  ROP3_S |
 			  GMC_BYTE_ORDER_MSB_TO_LSB |
@@ -189,9 +189,6 @@ static void radeonfb_prim_imageblit(stru
 	radeonfb_set_creg(rinfo, DP_SRC_FRGD_CLR, &rinfo->dp_src_fg_cache, fg);
 	radeonfb_set_creg(rinfo, DP_SRC_BKGD_CLR, &rinfo->dp_src_bg_cache, bg);
 
-	radeon_fifo_wait(rinfo, 1);
-	OUTREG(DST_Y_X, (image->dy << 16) | image->dx);
-
 	/* Ensure the dst cache is flushed and the engine idle before
 	 * issuing the operation.
 	 *
@@ -205,13 +202,19 @@ static void radeonfb_prim_imageblit(stru
 
 	/* X here pads width to a multiple of 32 and uses the clipper to
 	 * adjust the result. Is that really necessary ? Things seem to
-	 * work ok for me without that and the doco doesn't seem to imply
+	 * work ok for me without that and the doco doesn't seem to imply]
 	 * there is such a restriction.
 	 */
-	OUTREG(DST_WIDTH_HEIGHT, (image->width << 16) | image->height);
+	radeon_fifo_wait(rinfo, 4);
+	OUTREG(SC_TOP_LEFT, (image->dy << 16) | image->dx);
+	OUTREG(SC_BOTTOM_RIGHT, ((image->dy + image->height) << 16) |
+	       (image->dx + image->width));
+	OUTREG(DST_Y_X, (image->dy << 16) | image->dx);
+
+	OUTREG(DST_HEIGHT_WIDTH, (image->height << 16) | ((image->width + 31) & ~31));
 
-	src_bytes = (((image->width * image->depth) + 7) / 8) * image->height;
-	dwords = (src_bytes + 3) / 4;
+	dwords = (image->width + 31) >> 5;
+	dwords *= image->height;
 	bits = (u32*)(image->data);
 
 	while(dwords >= 8) {
Index: linux-work/drivers/video/aty/radeon_base.c
===================================================================
--- linux-work.orig/drivers/video/aty/radeon_base.c	2008-11-10 14:01:50.000000000 +1100
+++ linux-work/drivers/video/aty/radeon_base.c	2008-11-10 14:36:26.000000000 +1100
@@ -1875,6 +1875,7 @@ static int __devinit radeon_set_fbinfo (
 	info->fbops = &radeonfb_ops;
 	info->screen_base = rinfo->fb_base;
 	info->screen_size = rinfo->mapped_vram;
+
 	/* Fill fix common fields */
 	strlcpy(info->fix.id, rinfo->name, sizeof(info->fix.id));
         info->fix.smem_start = rinfo->fb_base_phys;
@@ -1889,8 +1890,25 @@ static int __devinit radeon_set_fbinfo (
         info->fix.mmio_len = RADEON_REGSIZE;
 	info->fix.accel = FB_ACCEL_ATI_RADEON;
 
+	/* Allocate colormap */
 	fb_alloc_cmap(&info->cmap, 256, 0);
 
+	/* Setup pixmap used for acceleration */
+#define PIXMAP_SIZE	(2048 * 4)
+
+	info->pixmap.addr = kmalloc(PIXMAP_SIZE, GFP_KERNEL);
+	if (!info->pixmap.addr) {
+		printk(KERN_ERR "radeonfb: Failed to allocate pixmap !\n");
+		noaccel = 1;
+		goto bail;
+	}
+	info->pixmap.size = PIXMAP_SIZE;
+	info->pixmap.flags = FB_PIXMAP_SYSTEM;
+	info->pixmap.scan_align = 4;
+	info->pixmap.buf_align = 4;
+	info->pixmap.access_align = 32;
+
+bail:
 	if (noaccel)
 		info->flags |= FBINFO_HWACCEL_DISABLED;
 


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
2.6.28-rc3-git6: Reported regressions from 2.6.27, Rafael J. Wysocki, (Sun Nov 9, 10:53 am)
[Bug #11799] xorg can not start up with stolen memory, Rafael J. Wysocki, (Sun Nov 9, 10:53 am)
[Bug #11806] iwl3945 fails with microcode error, Rafael J. Wysocki, (Sun Nov 9, 10:54 am)
[Bug #11849] default IRQ affinity change in v2.6.27 (break ..., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11834] iwl3945: if I leave my machine running overni ..., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11826] extreme slowness of IO stuff using 2.6.28-rc1, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11822] ACPI Warning (nspredef-0858): _SB_.PCI0.LPC_. ..., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11875] radeonfb lockup in .28-rc (bisected), Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11873] unable to mount ext3 root filesystem due to h ..., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11891] resume from disk broken on hp/compaq nx7000 ( ..., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11858] Timeout regression introduced by 242f9dcb8ba6 ..., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11898] mke2fs hang on AIC79 device., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11899] sometime boot failed on T61 laptop, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11895] 2.6.28-rc2 regression: keyboard dead after re ..., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11906] 2.6.28-rc2 seems to fail at powering down the ..., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11905] lots of extra timer interrupts costing 2W, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11903] regression: vmalloc easily fail, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11908] linux-2.6.28-rc2 regression : oprofile doesnt ..., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11917] Asus Eee PC hotkeys stop working after prolon ..., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11913] USB/INPUT: slab error in cache_alloc_debugche ..., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11911] new PCMCIA device instance after resume - ori ..., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11925] cdrom: missing compat ioctls, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11928] ath5k gets lost with eeepc-laptop removal, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11937] ext3 __log_wait_for_space: no transactions, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11942] AMD64 reboot regression, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11965] regression introduced by - timers: fix itimer ..., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11947] 2.6.28-rc VC switching with Intel graphics broken, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11985] 2.6.28-rc3 truncates nfsd results, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11970] gettimeofday return a old time in mmbench, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11982] Fan level 7 after resume wit 2.6.28-rc3, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11994] Computer doesn't power down after commit CPI: ..., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11989] Suspend failure on NForce4-based boards due t ..., Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11988] Eliminate recursive mutex in compat fb ioctl path, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11986] 2.6.28-rc2-git1: spitz still won't boot, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11987] Bootup time regression from 2.6.27 to 2.6.28-rc3+, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
[Bug #11996] Tracing framework regression in 2.6.28-rc3, Rafael J. Wysocki, (Sun Nov 9, 10:59 am)
Re: [Bug #11985] 2.6.28-rc3 truncates nfsd results, J. Bruce Fields, (Sun Nov 9, 2:05 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Benjamin Herrenschmidt, (Sun Nov 9, 2:15 pm)
Re: [Bug #11925] cdrom: missing compat ioctls, Andreas Schwab, (Sun Nov 9, 4:00 pm)
Re: [Bug #11925] cdrom: missing compat ioctls, Rafael J. Wysocki, (Sun Nov 9, 4:29 pm)
Re: [Bug #11925] cdrom: missing compat ioctls, Andreas Schwab, (Sun Nov 9, 4:39 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Benjamin Herrenschmidt, (Sun Nov 9, 10:46 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Paul Collins, (Mon Nov 10, 12:13 am)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Benjamin Herrenschmidt, (Mon Nov 10, 2:05 am)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), David Miller, (Mon Nov 10, 2:06 am)
Re: [Bug #11989] Suspend failure on NForce4-based boards d ..., Rafael J. Wysocki, (Mon Nov 10, 7:47 am)
Re: [Bug #11895] 2.6.28-rc2 regression: keyboard dead afte ..., Rafael J. Wysocki, (Mon Nov 10, 11:06 am)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Andreas Schwab, (Mon Nov 10, 1:39 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Benjamin Herrenschmidt, (Mon Nov 10, 2:52 pm)
Re: [Bug #11989] Suspend failure on NForce4-based boards d ..., Rafael J. Wysocki, (Mon Nov 10, 3:55 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Andreas Schwab, (Mon Nov 10, 4:20 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Benjamin Herrenschmidt, (Mon Nov 10, 4:34 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Andreas Schwab, (Mon Nov 10, 4:54 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Benjamin Herrenschmidt, (Mon Nov 10, 6:49 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Linus Torvalds, (Mon Nov 10, 7:47 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Benjamin Herrenschmidt, (Mon Nov 10, 8:21 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Andreas Schwab, (Tue Nov 11, 2:31 am)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Benjamin Herrenschmidt, (Tue Nov 11, 4:30 am)
Q: force_quiescent_state &amp;&amp; cpu_online_map, Oleg Nesterov, (Tue Nov 11, 10:03 am)
Re: Q: force_quiescent_state &amp;&amp; cpu_online_map, Paul E. McKenney, (Tue Nov 11, 10:25 am)
Re: [Bug #11989] Suspend failure on NForce4-based boards d ..., Paul E. McKenney, (Tue Nov 11, 10:34 am)
Re: [Bug #11989] Suspend failure on NForce4-based boards d ..., Rafael J. Wysocki, (Tue Nov 11, 4:43 pm)
Re: [Bug #11989] Suspend failure on NForce4-based boards d ..., Paul E. McKenney, (Wed Nov 12, 12:43 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), David Miller, (Thu Nov 13, 4:11 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Benjamin Herrenschmidt, (Thu Nov 13, 5:54 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), David Miller, (Thu Nov 13, 7:50 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), David Miller, (Thu Nov 13, 8:04 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Benjamin Herrenschmidt, (Thu Nov 13, 8:29 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), David Miller, (Thu Nov 13, 9:28 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Benjamin Herrenschmidt, (Fri Nov 14, 1:51 am)
Re: [Bug #11988] Eliminate recursive mutex in compat fb io ..., Geert Uytterhoeven, (Fri Nov 14, 7:51 am)
Re: [Bug #11988] Eliminate recursive mutex in compat fb io ..., Rafael J. Wysocki, (Sat Nov 15, 4:51 am)
Re: [Bug #11989] Suspend failure on NForce4-based boards d ..., Rafael J. Wysocki, (Sat Nov 15, 6:37 am)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Benjamin Herrenschmidt, (Thu Nov 20, 7:55 pm)
Re: [Bug #11875] radeonfb lockup in .28-rc (bisected), Benjamin Herrenschmidt, (Thu Nov 20, 8:02 pm)