Skip to contentSkip to conversation

Fix atyfb

PATCH Applied Paul Mackerras 2 participants 2 messages Jan 10, 2003 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix atyfb

Here is a patch which fixes a couple of problems in atyfb.

1. It was modifying the par structure in the check_var routine and not reading info->var in the set_par routine.

2. It was relying on info->var.accel_flags and consequently we were getting a situation where it was trying to use the drawing engine without having initialized it. This caused my G3 powerbook to hang on boot when the console text got to the bottom of the screen and it tried to scroll. I have added an accel_flags field to the par structure so that the driver can control when it starts and stops using acceleration. I also added code to the accelerated drawing routines so that they will fall back to the cfb routines if acceleration is disabled.

3. It was accessing the pseudo_palette as 16-bit quantities in 15/16 bpp mode rather than as u32.

The driver generally is badly formatted, particularly in the atyfb_init routine, which is very long and should be split up. James, would you accept a patch to split up atyfb_init and fix the formatting?

Paul.

drivers/video/aty/atyfb.h +1 -0
diff -urN linux-2.5/drivers/video/aty/atyfb.h pmac-2.5/drivers/video/aty/atyfb.h
@@ -79,6 +79,7 @@
 	u8 ram_type;
 	u8 mem_refresh_rate;
 	u8 blitter_may_be_busy;
+	u32 accel_flags;
 #ifdef __sparc__
 	struct pci_mmap_map *mmap_map;
 	u8 mmaped;
drivers/video/aty/atyfb_base.c +35 -52

189 lines not on this page · raw message

drivers/video/aty/mach64_accel.c +12 -0
diff -urN linux-2.5/drivers/video/aty/mach64_accel.c pmac-2.5/drivers/video/aty/mach64_accel.c
@@ -179,6 +179,12 @@
 
 	if (!area->width || !area->height)
 		return;
+	if (!par->accel_flags) {
+		if (par->blitter_may_be_busy)
+			wait_for_idle(par);
+		cfb_copyarea(info, area);
+		return;
+	}
 
 	pitch_value = info->var.xres_virtual;
 	if (info->var.bits_per_pixel == 24) {
@@ -216,6 +222,12 @@
 
 	if (!rect->width || !rect->height)
 		return;
+	if (!par->accel_flags) {
+		if (par->blitter_may_be_busy)
+			wait_for_idle(par);
+		cfb_fillrect(info, rect);
+		return;
+	}
 
 	rect->color |= (rect->color << 8);
 	rect->color |= (rect->color << 16);