All of lore.kernel.org
 help / color / mirror / Atom feed
From: Antonino Daplas <adaplas@pol.net>
To: Petr Vandrovec <VANDROVE@vc.cvut.cz>
Cc: Ariel <aslinux@dsgml.com>,
	Linux Fbdev development list
	<linux-fbdev-devel@lists.sourceforge.net>
Subject: Re: Re: kernel: matrox fb - missing files, doesn't compile
Date: 15 Dec 2002 05:30:43 +0500	[thread overview]
Message-ID: <1039912121.1008.59.camel@localhost.localdomain> (raw)
In-Reply-To: <A31FF58755A@vcnet.vc.cvut.cz>

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,






-------------------------------------------------------
This sf.net email is sponsored by:
With Great Power, Comes Great Responsibility 
Learn to use your power at OSDN's High Performance Computing Channel
http://hpc.devchannel.org/

  reply	other threads:[~2002-12-14 21:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-13 10:09 kernel: matrox fb - missing files, doesn't compile Petr Vandrovec
2002-12-15  0:30 ` Antonino Daplas [this message]
2002-12-14 22:44   ` Petr Vandrovec
2002-12-15 17:45     ` Antonino Daplas
2002-12-22  8:44       ` Geert Uytterhoeven
2002-12-27 15:02         ` Antonino Daplas
2002-12-22  8:42   ` Geert Uytterhoeven

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1039912121.1008.59.camel@localhost.localdomain \
    --to=adaplas@pol.net \
    --cc=VANDROVE@vc.cvut.cz \
    --cc=aslinux@dsgml.com \
    --cc=linux-fbdev-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.