|
From: Antonino D. <ad...@po...> - 2002-12-14 21:36:27
|
On Fri, 2002-12-13 at 15:09, Petr Vandrovec wrote:
> Current interface just supports only cfb, and only very bad for my needs.
> And because of matroxfb supports also other modes (such as native text
> mode, or loading font into accelerator), bye-bye. For now I recommend you
> either to not upgrade, or use vesafb. Besides that accel_putcs() does not
> call fb_sync when using font width which is not multiple of 8, and that
Can you explain why an fb_sync is needed for every character?
> with fonts greater than 16*16 pixels (I believe that such fonts are still
> supported...) it will corrupt memory...
I agree. To be more specific, buffer overruns will occur if (xres *
fontheight/8 > 8192). The pixmap needs to be dynamically allocated and
resized somewhere in the fbcon layer (ideally in accel_setup(), but this
was removed). For those concerned about this problem, you can try this
patch as a temporary measure until fbcon is fixed. It should not cause
to much slowdown:
For anyone concerned, this is a heads up: The data in the pixmap must
be read completely by the hardware before exiting, otherwise font
corruption will occur. If you think this will be a problem, the
function can be easily modified to do multiple buffering instead.
Comments?
Tony
diff -Naur linux-2.5.51/drivers/video/console/fbcon.c linux/drivers/video/console/fbcon.c
--- linux-2.5.51/drivers/video/console/fbcon.c 2002-12-14 23:33:50.000000000 +0000
+++ linux/drivers/video/console/fbcon.c 2002-12-14 23:35:10.000000000 +0000
@@ -390,7 +390,9 @@
unsigned int cellsize = vc->vc_font.height * width;
struct fb_image image;
u16 c = scr_readw(s);
- static u8 pixmap[8192];
+ static int xres = 0;
+ static int fontheight = 0;
+ static u8 *pixmap = NULL;
image.fg_color = attr_fgcol(p, c);
image.bg_color = attr_bgcol(p, c);
@@ -399,9 +401,24 @@
image.height = vc->vc_font.height;
image.depth = 1;
-/* pixmap = kmalloc((info->var.bits_per_pixel + 7) >> 3 *
- vc->vc_font.height, GFP_KERNEL);
-*/
+ /*
+ * FIXME: This code segment has to be placed
+ * somewhere else to allow freeing of
+ * memory on exit and to reduce unnecessary
+ * processing.
+ */
+ if (xres != info->var.xres ||
+ fontheight != vc->vc_font.height) {
+ xres = info->var.xres;
+ fontheight = vc->vc_font.height;
+
+ if (info->fbops->fb_sync)
+ info->fbops->fb_sync(info);
+ if (pixmap != NULL)
+ kfree(pixmap);
+ pixmap = kmalloc((xres + 7)/8 *
+ fontheight, GFP_KERNEL);
+ }
if (!(vc->vc_font.width & 7) && pixmap != NULL) {
unsigned int pitch = width * count, i, j;
@@ -432,10 +449,6 @@
image.dx += vc->vc_font.width;
}
}
- /*
- if (pixmap);
- kfree(pixmap);
- */
}
void accel_clear_margins(struct vc_data *vc, struct display *p,
|