linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [Linux-fbdev-users] PATCH: vga console tweak
       [not found] <20050513214055.GA3107@cosmic.amd.com>
@ 2005-05-13 22:50 ` James Simmons
  2005-05-14  0:20 ` James Simmons
  1 sibling, 0 replies; 4+ messages in thread
From: James Simmons @ 2005-05-13 22:50 UTC (permalink / raw)
  To: Jordan Crouse; +Cc: Linux Fbdev development list



On Fri, 13 May 2005, Jordan Crouse wrote:

> The attached patch puts a hard 32k ceiling on copies to and from
> the VGA VRAM space.
> 
> This bug was discovered with a 1920x1440 framebuffer console - before
> switching from VGA, the console is expanded to 240 cols x 90 rows, equaling
> a screenbuf_size of 43200 bytes.  Since the VGA VRAM space is only 32k bytes
> big, calling vgacon_save_screen during the console transfer copied in a good
> chunk of the video BIOS living at 0xc0000 too, resulting in some very purty
> colors and characters at the bottom of the new console.

Thanks for the patch. Will send it forward.



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Linux-fbdev-users] PATCH: vga console tweak
       [not found] <20050513214055.GA3107@cosmic.amd.com>
  2005-05-13 22:50 ` [Linux-fbdev-users] PATCH: vga console tweak James Simmons
@ 2005-05-14  0:20 ` James Simmons
  2005-05-16 16:31   ` Jordan Crouse
  1 sibling, 1 reply; 4+ messages in thread
From: James Simmons @ 2005-05-14  0:20 UTC (permalink / raw)
  To: Jordan Crouse; +Cc: Linux Fbdev development list


> The attached patch puts a hard 32k ceiling on copies to and from
> the VGA VRAM space.
> 
> This bug was discovered with a 1920x1440 framebuffer console - before
> switching from VGA, the console is expanded to 240 cols x 90 rows, equaling
> a screenbuf_size of 43200 bytes.  Since the VGA VRAM space is only 32k bytes
> big, calling vgacon_save_screen during the console transfer copied in a good
> chunk of the video BIOS living at 0xc0000 too, resulting in some very purty
> colors and characters at the bottom of the new console.

I made the patch a little more flexiable for video size. It is possible to 
use 64K or even 128K of video memory. So we ask. Could you give my patch a 
run. Its against Linus latest tree.

--- linus-2.6/drivers/video/console/vgacon.c	2005-05-10 08:39:33.000000000 -0700
+++ fbdev-2.6/drivers/video/console/vgacon.c	2005-05-13 17:11:37.000000000 -0700
@@ -95,6 +95,7 @@ static unsigned long vgacon_uni_pagedir[
 /* Description of the hardware situation */
 static unsigned long	vga_vram_base;		/* Base of video memory */
 static unsigned long	vga_vram_end;		/* End of video memory */
+static int		vga_vram_size;		/* Size of video memory */
 static u16		vga_video_port_reg;	/* Video register select port */
 static u16		vga_video_port_val;	/* Video register value port */
 static unsigned int	vga_video_num_columns;	/* Number of text columns */
@@ -288,6 +289,7 @@ static const char __init *vgacon_startup
 
 	vga_vram_base = VGA_MAP_MEM(vga_vram_base);
 	vga_vram_end = VGA_MAP_MEM(vga_vram_end);
+	vga_vram_size = vga_vram_end - vga_vram_base;
 
 	/*
 	 *      Find out if there is a graphics card present.
@@ -504,9 +506,13 @@ static int vgacon_switch(struct vc_data 
 	 */
 	vga_video_num_columns = c->vc_cols;
 	vga_video_num_lines = c->vc_rows;
+
+	/* We can only copy out the size of the video buffer here, 
+	 * otherwise we get into VGA BIOS */
+
 	if (!vga_is_gfx)
 		scr_memcpyw((u16 *) c->vc_origin, (u16 *) c->vc_screenbuf,
-			    c->vc_screenbuf_size);
+			    c->vc_screenbuf_size > vga_vram_size ? vga_vram_size : c->vc_screenbuf_size);
 	return 0;		/* Redrawing not needed */
 }
 
@@ -961,7 +967,6 @@ static int vgacon_scrolldelta(struct vc_
 	if (!lines)		/* Turn scrollback off */
 		c->vc_visible_origin = c->vc_origin;
 	else {
-		int vram_size = vga_vram_end - vga_vram_base;
 		int margin = c->vc_size_row * 4;
 		int ul, we, p, st;
 
@@ -971,7 +976,7 @@ static int vgacon_scrolldelta(struct vc_
 			we = vga_rolled_over + c->vc_size_row;
 		} else {
 			ul = 0;
-			we = vram_size;
+			we = vga_vram_size;
 		}
 		p = (c->vc_visible_origin - vga_vram_base - ul + we) % we +
 		    lines * c->vc_size_row;
@@ -1012,9 +1017,13 @@ static void vgacon_save_screen(struct vc
 		c->vc_x = ORIG_X;
 		c->vc_y = ORIG_Y;
 	}
+	
+	/* We can't copy in more then the size of the video buffer, 
+	 * or we'll be copying in VGA BIOS */
+
 	if (!vga_is_gfx)
 		scr_memcpyw((u16 *) c->vc_screenbuf, (u16 *) c->vc_origin,
-			    c->vc_screenbuf_size);
+			    c->vc_screenbuf_size > vga_vram_size ? vga_vram_size : c->vc_screenbuf_size);
 }
 
 static int vgacon_scroll(struct vc_data *c, int t, int b, int dir,



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Linux-fbdev-users] PATCH: vga console tweak
  2005-05-14  0:20 ` James Simmons
@ 2005-05-16 16:31   ` Jordan Crouse
  2005-05-19 21:23     ` James Simmons
  0 siblings, 1 reply; 4+ messages in thread
From: Jordan Crouse @ 2005-05-16 16:31 UTC (permalink / raw)
  To: James Simmons; +Cc: Linux Fbdev development list

> I made the patch a little more flexiable for video size. It is
> possible to  use 64K or even 128K of video memory. So we ask. Could
> you give my patch a  run. Its against Linus latest tree.

Works fine.  Thanks.

Jordan

-- 
Jordan Crouse
Senior Linux Engineer
AMD - Personal Connectivity Solutions Group
<www.amd.com/embeddedprocessors>



-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Re: [Linux-fbdev-users] PATCH: vga console tweak
  2005-05-16 16:31   ` Jordan Crouse
@ 2005-05-19 21:23     ` James Simmons
  0 siblings, 0 replies; 4+ messages in thread
From: James Simmons @ 2005-05-19 21:23 UTC (permalink / raw)
  To: Linux Fbdev development list; +Cc: James Simmons


Submited to andrew. Soon it will go main stream. :-)


On Mon, 16 May 2005, Jordan Crouse wrote:

> > I made the patch a little more flexiable for video size. It is
> > possible to  use 64K or even 128K of video memory. So we ask. Could
> > you give my patch a  run. Its against Linus latest tree.
> 
> Works fine.  Thanks.
> 
> Jordan
> 
> -- 
> Jordan Crouse
> Senior Linux Engineer
> AMD - Personal Connectivity Solutions Group
> <www.amd.com/embeddedprocessors>
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by Oracle Space Sweepstakes
> Want to be the first software developer in space?
> Enter now for the Oracle Space Sweepstakes!
> http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
> 


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-05-19 21:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20050513214055.GA3107@cosmic.amd.com>
2005-05-13 22:50 ` [Linux-fbdev-users] PATCH: vga console tweak James Simmons
2005-05-14  0:20 ` James Simmons
2005-05-16 16:31   ` Jordan Crouse
2005-05-19 21:23     ` James Simmons

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).