[parisc-linux-cvs] -pa57 - byte mode sti fix

Thomas Bogendoerfer tsbogend@alpha.franken.de
Mon, 15 Oct 2001 02:55:10 +0200


Hi,

another patch, which fixes the not working sticon for byte mode sti roms.
When I changed the code to use just one internal sti rom format, 
I didn't expect, that the sti rom routines would need there native font
format, which even makes more sense. I've changed the code to convert 
the font to byte mode format, if the sti rom is byte mode format.

Thomas.

Index: sticore.c
===================================================================
RCS file: /home/cvs/parisc/linux/drivers/video/sti/sticore.c,v
retrieving revision 1.25
diff -u -r1.25 sticore.c
--- sticore.c	2001/10/14 18:24:44	1.25
+++ sticore.c	2001/10/15 00:43:14
@@ -454,7 +454,6 @@
 	return 0;
 }
 
-
 struct sti_cooked_font * __init
 sti_select_fbfont( struct sti_cooked_rom *cooked_rom, char *fbfont_name )
 {
@@ -607,6 +606,25 @@
 #define BMODE_RELOCATE(offset)        offset = (offset) / 4;
 #define BMODE_LAST_ADDR_OFFS          0x50
 
+static void * __init
+sti_bmode_font_raw(struct sti_cooked_font *f)
+{
+	unsigned char *n, *p, *q;
+	int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font);
+	
+	n = kmalloc (4*size, GFP_KERNEL);
+	if (!n)
+		return NULL;
+	memset (n, 0, 4*size);
+	p = n + 3;
+	q = (unsigned char *)f->raw;
+	while (size--) {
+		*p = *q++;
+		p+=4;
+	}
+	return n + 3;
+}
+
 static void __init
 sti_bmode_rom_copy(unsigned long base, unsigned long count, void *dest)
 {
@@ -713,7 +731,16 @@
 	sti->font = sti_select_font(sti->rom, sti_search_font);
 	sti->font_width = sti->font->raw->width;
 	sti->font_height = sti->font->raw->height;
-	sti->font->raw = STI_PTR(sti->font->raw);
+	if (wordmode)
+		sti->font->raw = STI_PTR(sti->font->raw);
+	else {
+		void *rf = sti_bmode_font_raw(sti->font);
+		
+		if (rf)
+			sti->font->raw = STI_PTR(rf);
+		else
+			goto out_err;
+	}
 
 	sti->sti_mem_request = raw->sti_mem_req;
 	sti->graphics_id[0] = raw->graphics_id[0];

-- 
Crap can work. Given enough thrust pigs will fly, but it's not necessary a
good idea.                                 [ Alexander Viro on linux-kernel ]