Skip to contentSkip to conversation

Multiple monitors

DISCUSSION Simon Hay 10 participants 15 messages Sep 3, 2001 – Sep 13, 2001 Char and misc drivers

lore
Share & tools
lore

Simon Hay

author
#0 lore raw

Hi all,

Apologies in advance if this is a question that's already been answered somewhere... I'm looking for a way to install multiple (or rather, two) PCI/AGP cards in a machine and connect a monitor to each one, and use them both *in console mode* - preferably with some nice way to say 'assign virtual console 2 to the first screen, and 5 to the second' - that way you could have one tailing log files, showing 'top', whatever. A quick search of the web/newsgroups turned up various patches that looked ideal, but a closer inspection revealed that they either relied on you having a Hercules mono card, or only applied against kernel <0.99, or both... I was just wondering if anyone's thought about/written a similar patch for more recent hardware/versions? I was using a console Linux machine running BB (ASCII art demo -
http://aa-project.sourceforge.net/) just to attract attention to our stand today and was thinking it would be really neat to have one machine driving several screens...

Simon

#1 lore raw
Quoted 17 lines · Simon Hay

Hi all,

Apologies in advance if this is a question that's already been answered somewhere... I'm looking for a way to install multiple (or rather, two) PCI/AGP cards in a machine and connect a monitor to each one, and use them both *in console mode* - preferably with some nice way to say 'assign virtual console 2 to the first screen, and 5 to the second' - that way you could have one tailing log files, showing 'top', whatever. A quick search of the web/newsgroups turned up various patches that looked ideal, but a closer inspection revealed that they either relied on you having a Hercules mono card, or only applied against kernel <0.99, or both... I was just wondering if anyone's thought about/written a similar patch for more recent hardware/versions? I was using a console Linux machine running BB (ASCII art demo -
http://aa-project.sourceforge.net/) just to attract attention to our stand today and was thinking it would be really neat to have one machine driving several screens...

XFree86 has pretty good support for multiple heads.

If you tie an xterm to the root window, I guess you would get something pretty close to what you're looking for. Or, configure some window manager properly to do exactly what you want.

Signature · 6 lines
................................................................
:   [email protected]   : And I see the elder races,         :
:.........................: putrid forms of man                :
:   Jakob Østergaard      : See him rise and claim the earth,  :
:        OZ9ABN           : his downfall is at hand.           :
:.........................:............{Konkhra}...............:
author
#2 lore raw
Quoted 6 lines · Jakob Østergaard

XFree86 has pretty good support for multiple heads.

If you tie an xterm to the root window, I guess you would get something pretty close to what you're looking for. Or, configure some window manager properly to do exactly what you want.

I had considered doing that - I believe that some of the framebuffer code supports multiple heads as well(?) - but in this particular case it wasn't appropriate - the whole point was to demonstrate what could be achieved using only a command line ;-) Also, though, on dedicated servers etc. I'd rather not be running X if I didn't have to. Would this be a particularly difficult thing to implement as a kernel patch? I'd like to try to get involved in kernel development at some point and am looking for something to ease myself in slowly - preferably something useful but unimportant ;-) Are there any show stoppers involved here - or does anyone have any other ideas?

Thanks in advance,

Simon

#3 lore raw
In reply to Jakob Østergaard
Quoted 7 lines
Quoted 6 lines

XFree86 has pretty good support for multiple heads.

If you tie an xterm to the root window, I guess you would get something pretty close to what you're looking for. Or, configure some window manager properly to do exactly what you want.

Quoted 10 lines

I had considered doing that - I believe that some of the framebuffer code supports multiple heads as well(?) - but in this particular case it wasn't appropriate - the whole point was to demonstrate what could be achieved using only a command line ;-) Also, though, on dedicated servers etc. I'd rather not be running X if I didn't have to. Would this be a particularly difficult thing to implement as a kernel patch? I'd like to try to get involved in kernel development at some point and am looking for something to ease myself in slowly - preferably something useful but unimportant ;-) Are there any show stoppers involved here - or does anyone have any other ideas?

I thought of doing something like this but using a matrox g400 or g450 dual head card. primary would be for X, secondary would be a console. Not sure if that's more difficult or not. Something I'd like to have, however.

Signature · 1 line
 Lab tests show that use of micro$oft causes cancer in lab animals
author
#4 lore raw
Quoted 4 lines · Wakko Warner

I thought of doing something like this but using a matrox g400 or g450 dual head card. primary would be for X, secondary would be a console. Not sure if that's more difficult or not. Something I'd like to have, however.

I don't know how the Matrox cards work so I couldn't comment, although presumably having code to support multiple monitors on multiple cards would at least make it _easier_ to support dual head video adaptors. Also, presumably if you could assign virtual consoles to either monitor and they both behaved like the standard primary console there'd be no particular reason why X shouldn't run on one or both as normal...

Simon

#5 lore raw
In reply to Wakko Warner
Quoted 4 lines

I thought of doing something like this but using a matrox g400 or g450 dual head card. primary would be for X, secondary would be a console. Not sure if that's more difficult or not. Something I'd like to have, however.

I have a setup at work like this. I have X running on ATI rage 128 card and a G400 as a console. I myself sometime ago got 2 independent X servers running on a multidesktop system (2 monitors, 2 keybaords and 2 mice). In this case you need to make sure you start the second X server with the -vt option.

#6 lore raw
In reply to Jakob Østergaard

Wakko Warner wrote:
: I thought of doing something like this but using a matrox g400 or g450 dual : head card. primary would be for X, secondary would be a console. Not sure : if that's more difficult or not. Something I'd like to have, however. :
FWIW, I was able to run my computer in dual-head setup with two
keyboards and two mice (the second kbd and mouse on USB). I have Matrox G450 as one head, and S3 ViRGE/VX as the second one. I dont use it as a text console, though. I use it through a gdm login in X. I've followed the steps at http://139.82.28.40/multiuser/index.html with some minor tweaks.

-Yenya

Signature · 5 lines
\ Jan "Yenya" Kasprzak <kas at fi.muni.cz>       http://www.fi.muni.cz/~kas/
\\ PGP: finger kas at aisa.fi.muni.cz   0D99A7FB206605D7 8B35FCDE05B18A5E //
\\\             Czech Linux Homepage:  http://www.linux.cz/              ///
And quite frankly, if your disk can push 50MB/s through a 1kB non-contiguous
filesystem, then my name is Bugs Bunny.                     --Linus Torvalds
#7 lore raw
In reply to Jakob Østergaard
Quoted 2 lines · Simon Hay

Also, though, on dedicated servers etc. I'd rather not be running X if I didn't have to.

You may find that a full screen xterm, with no window manager, actually runs much faster than the console and looks identical. It is certainly the case on several of my machines.

This is most pronounced if X can do hardware acceleration on your video card, although it is true even without acceleration because of xterm's nice jump scroll capability. (Btw, I prefer gnome-terminal because of the Linux-console colour emulation :-).

On one 686 class machine, I saw text mode take nearly two seconds to scroll the screen, when all but one line of the screen was being scrolled (so it had to copy everything). This was in pure text mode, not even a framebuffer! In X it was invisibly fast.

Also you may get a better refresh rate and higher resolution fonts out of X, which is nice on a big display.

-- Jamie

#8 lore raw
In reply to Jakob Østergaard

Hi!

Quoted 12 lines
Quoted 2 lines

Also, though, on dedicated servers etc. I'd rather not be running X if I didn't have to.

You may find that a full screen xterm, with no window manager, actually runs much faster than the console and looks identical. It is certainly the case on several of my machines.

This is most pronounced if X can do hardware acceleration on your video card, although it is true even without acceleration because of xterm's nice jump scroll capability. (Btw, I prefer gnome-terminal because of the Linux-console colour emulation :-).

Quoted 4 lines

On one 686 class machine, I saw text mode take nearly two seconds to scroll the screen, when all but one line of the screen was being scrolled (so it had to copy everything). This was in pure text mode, not even a framebuffer! In X it was invisibly fast.

2 seconds on vga console is way too much. It could happen with framebuffer + usb hogging PCI...
Pavel

Signature · 2 lines
I'm [email protected]. "In my country we have almost anarchy and I don't care."
Panos Katsaloulis describing me w.r.t. patents at [email protected]
#9 lore raw
In reply to Jakob Østergaard
Quoted 7 lines · Pavel Machek
Quoted 4 lines

On one 686 class machine, I saw text mode take nearly two seconds to scroll the screen, when all but one line of the screen was being scrolled (so it had to copy everything). This was in pure text mode, not even a framebuffer! In X it was invisibly fast.

2 seconds on vga console is way too much. It could happen with framebuffer + usb hogging PCI...

No, this was in 1996 on a Pentium Pro machine, with no USB or x86 framebuffer drivers even written then :-) It was plain 80x50 text mode, really.

I still have the patch I wrote in March 1997 (attached for reference), and this patch made a _huge_ difference to text mode Emacs on those machines. An equivalent fix seems to have been incorporated in console.c by now.

enjoy,
-- Jamie

drivers/char/console.c renamed from drivers/char/console.c.dist +61 -76
@@ -592,15 +592,22 @@
 	__set_origin(__real_origin);
 }
 
-void scrup(int currcons, unsigned int t, unsigned int b)
+static void scrup(int currcons, unsigned int t, unsigned int b, unsigned int nr)
 {
 	int hardscroll = hardscroll_enabled;
 
-	if (b > video_num_lines || t >= b)
+	if (b > video_num_lines || t >= b || nr == 0)
 		return;
+	if (nr > b - t)
+		nr = b - t;
 	if (t || b != video_num_lines)
 		hardscroll = 0;
 	if (hardscroll) {
+		if (nr != 1) {
+			while (nr--)
+				scrup (currcons, t, b, 1);
+			return;
+		}
 		origin += video_size_row;
 		pos += video_size_row;
 		scr_end += video_size_row;
@@ -639,14 +646,14 @@
 		set_origin(currcons);
 	} else {
 		unsigned short * d = (unsigned short *) (origin+video_size_row*t);
-		unsigned short * s = (unsigned short *) (origin+video_size_row*(t+1));
-		unsigned int count = (b-t-1) * video_num_columns;
+		unsigned short * s = (unsigned short *) (origin+video_size_row*(t+nr));
+		unsigned int count = (b-t-nr) * video_num_columns;
 
 		while (count) {
 			count--;
 			scr_writew(scr_readw(s++), d++);
 		}
-		count = video_num_columns;
+		count = nr*video_num_columns;
 		while (count) {
 			count--;
 			scr_writew(video_erase_char, d++);
@@ -654,27 +661,28 @@
 	}
 }
 
-void
-scrdown(int currcons, unsigned int t, unsigned int b)
+static void
+scrdown(int currcons, unsigned int t, unsigned int b, unsigned int nr)
 {
 	unsigned short *d, *s;
 	unsigned int count;
 
-	if (b > video_num_lines || t >= b)
+	if (b > video_num_lines || t >= b || nr == 0)
 		return;
+	if (nr > b - t)
+		nr = b - t;
 	d = (unsigned short *) (origin+video_size_row*b);
-	s = (unsigned short *) (origin+video_size_row*(b-1));
-	count = (b-t-1)*video_num_columns;
+	s = (unsigned short *) (origin+video_size_row*(b-nr));
+	count = (b-t-nr)*video_num_columns;
 	while (count) {
 		count--;
 		scr_writew(scr_readw(--s), --d);
 	}
-	count = video_num_columns;
+	count = nr*video_num_columns;
 	while (count) {
 		count--;
 		scr_writew(video_erase_char, --d);
 	}
-	has_scrolled = 1;
 }
 
 static void lf(int currcons)
@@ -683,7 +691,7 @@
 	 * if below scrolling region
 	 */
     	if (y+1 == bottom)
-		scrup(currcons,top,bottom);
+		scrup(currcons,top,bottom,1);
 	else if (y < video_num_lines-1) {
 	    	y++;
 		pos += video_size_row;
@@ -697,7 +705,7 @@
 	 * if above scrolling region
 	 */
 	if (y == top)
-		scrdown(currcons,top,bottom);
+		scrdown(currcons,top,bottom,1);
 	else if (y > 0) {
 		y--;
 		pos -= video_size_row;
@@ -1171,84 +1179,61 @@
 	}
 }
 
-static void insert_char(int currcons)
+static void insert_chars(int currcons, unsigned int nr)
 {
-	unsigned int i = x;
-	unsigned short tmp, old = video_erase_char;
+	unsigned int count;
 	unsigned short * p = (unsigned short *) pos;
 
-	while (i++ < video_num_columns) {
-		tmp = scr_readw(p);
-		scr_writew(old, p);
-		old = tmp;
-		p++;
+	if (nr >= video_num_columns - x)
+		nr = video_num_columns - x;
+	if (nr == 0)
+		return;
+
+	p += video_num_columns - x;
+	count = video_num_columns - x - nr;
+	while (count--) {
+		p--;
+		scr_writew(scr_readw(p-nr), p);
 	}
+	count = nr;
+	while (count--)
+		scr_writew(video_erase_char, --p);
+
 	need_wrap = 0;
 }
 
-static void insert_line(int currcons)
+static inline void insert_lines(int currcons, unsigned int nr)
 {
-	scrdown(currcons,y,bottom);
+	scrdown(currcons,y,bottom,nr);
 	need_wrap = 0;
 }
 
-static void delete_char(int currcons)
+static void delete_chars(int currcons, unsigned int nr)
 {
-	unsigned int i = x;
+	unsigned int count;
 	unsigned short * p = (unsigned short *) pos;
 
-	while (++i < video_num_columns) {
-		scr_writew(scr_readw(p+1), p);
+	if (nr >= video_num_columns - x)
+		nr = video_num_columns - x;
+	if (nr == 0)
+		return;
+
+	count = video_num_columns - x - nr;
+	while (count--) {
+		scr_writew(scr_readw(p+nr), p);
 		p++;
 	}
-	scr_writew(video_erase_char, p);
-	need_wrap = 0;
-}
+	count = nr;
+	while (count--)
+		scr_writew(video_erase_char, p++);
 
-static void delete_line(int currcons)
-{
-	scrup(currcons,y,bottom);
 	need_wrap = 0;
 }
 
-static void csi_at(int currcons, unsigned int nr)
-{
-	if (nr > video_num_columns)
-		nr = video_num_columns;
-	else if (!nr)
-		nr = 1;
-	while (nr--)
-		insert_char(currcons);
-}
-
-static void csi_L(int currcons, unsigned int nr)
-{
-	if (nr > video_num_lines)
-		nr = video_num_lines;
-	else if (!nr)
-		nr = 1;
-	while (nr--)
-		insert_line(currcons);
-}
-
-static void csi_P(int currcons, unsigned int nr)
-{
-	if (nr > video_num_columns)
-		nr = video_num_columns;
-	else if (!nr)
-		nr = 1;
-	while (nr--)
-		delete_char(currcons);
-}
-
-static void csi_M(int currcons, unsigned int nr)
+static inline void delete_lines(int currcons, unsigned int nr)
 {
-	if (nr > video_num_lines)
-		nr = video_num_lines;
-	else if (!nr)
-		nr=1;
-	while (nr--)
-		delete_line(currcons);
+	scrup(currcons,y,bottom,nr);
+	need_wrap = 0;
 }
 
 static void save_cur(int currcons)
@@ -1468,7 +1453,7 @@
 				lf(currcons);
 			}
 			if (decim)
-				insert_char(currcons);
+				insert_chars(currcons, 1);
 			scr_writew( video_mode_512ch ?
 			   ((attr & 0xf7) << 8) + ((tc & 0x100) << 3) +
 			   (tc & 0x0ff) : (attr << 8) + tc,
@@ -1707,13 +1692,13 @@
 						csi_K(currcons,par[0]);
 						continue;
 					case 'L':
-						csi_L(currcons,par[0]);
+						insert_lines(currcons,(par[0] ? par[0] : 1));
 						continue;
 					case 'M':
-						csi_M(currcons,par[0]);
+						delete_lines(currcons,(par[0] ? par[0] : 1));
 						continue;
 					case 'P':
-						csi_P(currcons,par[0]);
+						delete_chars(currcons,(par[0] ? par[0] : 1));
 						continue;
 					case 'c':
 						if (!par[0])
@@ -1762,7 +1747,7 @@
 						csi_X(currcons, par[0]);
 						continue;
 					case '@':
-						csi_at(currcons,par[0]);
+						insert_chars(currcons,(par[0] ? par[0] : 1));
 						continue;
 					case ']': /* setterm functions */
 						setterm_command(currcons);
drivers/char/vt.c renamed from drivers/char/vt.c.dist +4 -2
@@ -28,6 +28,7 @@
 #include "vt_kern.h"
 #include "diacr.h"
 #include "selection.h"
+#include "console_struct.h"	/* for `vc_has_scrolled' */
 
 extern char vt_dont_switch;
 extern struct tty_driver console_driver;
@@ -299,9 +300,10 @@
 		/*
 		 * explicitly blank/unblank the screen if switching modes
 		 */
-		if (arg == KD_TEXT)
+		if (arg == KD_TEXT) {
+			vc_cons[console].d->vc_has_scrolled = 1;
 			do_unblank_screen();
-		else
+		} else
 			do_blank_screen(1);
 		return 0;
 
#10 lore raw
In reply to Simon Hay
Quoted 17 lines · Simon Hay

Hi all,

Apologies in advance if this is a question that's already been answered somewhere...I'm looking for a way to install multiple (or rather, two) PCI/AGP cards in a machine and connect a monitor to each one, and use them both *in console mode* - preferably with some nice way to say 'assign virtual console 2 to the first screen, and 5 to the second' - that way you could have one tailing log files, showing 'top', whatever. A quick search of the web/newsgroups turned up various patches that looked ideal, but a closer inspection revealed that they either relied on you having a Hercules mono card, or only applied against kernel <0.99, or both...I was just wondering if anyone's thought about/written a similar patch for more recent hardware/versions?I was using a console Linux machine running BB (ASCII art demo -
http://aa-project.sourceforge.net/) just to attract attention to our stand today and was thinking it would be really neat to have one machine driving several screens...

If you want only textmode, look at nvvgacon
http://www.arava.co.il/matan/misc/
this module enables text console on secondary nvidia cards. I think it only works on riva128 now, but it should be easy to add support for tnt and later. If you also want to use a second keyboard, There is also ps2key, usb2key, to emulate a second console (from user space) with a keyboard connected to usb or to ps/2 mouse port.

Signature · 1 line
Matan Ziv-Av.                         [email protected]
#11 lore raw
In reply to Simon Hay

"Simon Hay" Said:

Quoted 4 lines

Apologies in advance if this is a question that's already been answered somewhere... I'm looking for a way to install multiple (or rather, two) PCI/AGP cards in a machine and connect a monitor to each one, and use them both *in console mode* -

this already exist in the current kernels, as long as you use video boards that can be initialised independently
from the bios .
the 1st head can be whatever you want, but the next heads have to be carefully chosen (matrox boards comes to mind)

then disable software scrollback as there are issues with multihead . (append="video:scrollback:0")

Quoted 3 lines

preferably with some nice way to say
'assign virtual console 2 to the first screen, and 5 to the second' - that way you could have one tailing log files, showing 'top', whatever.

this is "con2fb":

to assign 2nd Virtual console to 2nd head :
con2fb /dev/fb1 /dev/tty2

ghoz

#12 lore raw
In reply to Simon Hay
Quoted 16 lines

Apologies in advance if this is a question that's already been answered somewhere... I'm looking for a way to install multiple (or rather, two) PCI/AGP cards in a machine and connect a monitor to each one, and use them both *in console mode* - preferably with some nice way to say 'assign virtual console 2 to the first screen, and 5 to the second' - that way you could have one tailing log files, showing 'top', whatever. A quick search of the web/newsgroups turned up various patches that looked ideal, but a closer inspection revealed that they either relied on you having a Hercules mono card, or only applied against kernel <0.99, or both... I was just wondering if anyone's thought about/written a similar patch for more recent hardware/versions? I was using a console Linux machine running BB (ASCII art demo -
http://aa-project.sourceforge.net/) just to attract attention to our stand today and was thinking it would be really neat to have one machine driving several screens...

Hi!

Tkae a look at the linux console project.

http://www.sf.net/projects/linuxconsole.

I pretty much have rewritten the console system. I have been running a
multidesktop system for some time now. It needs some more work but the core of it is their.

#13 lore raw
In reply to Simon Hay

Check the http://ylabs.igreconline.com ... Is a mingetty patch for framebuffer .

Adrian Stanila

Quoted 25 lines · Simon Hay

Hi all,

Apologies in advance if this is a question that's already been answered somewhere... I'm looking for a way to install multiple (or rather, two) PCI/AGP cards in a machine and connect a monitor to each one, and use them both *in console mode* - preferably with some nice way to say 'assign virtual console 2 to the first screen, and 5 to the second' - that way you could have one tailing log files, showing 'top', whatever. A quick search of the web/newsgroups turned up various patches that looked ideal, but a closer inspection revealed that they either relied on you having a Hercules mono card, or only applied against kernel <0.99, or both... I was just wondering if anyone's thought about/written a similar patch for more recent hardware/versions? I was using a console Linux machine running BB (ASCII art demo -
http://aa-project.sourceforge.net/) just to attract attention to our stand today and was thinking it would be really neat to have one machine driving several screens...

Simon
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#14 lore raw

Hi,

Only now I read the whole tread about 'Multiple monitors' :)) For console mode you can try my patch for mingetty (see
http://ylabs.igreconline.com is working very well.. for example at my home I run a fbtv on another monitor and in another monitor I work) or you can try fbgetty . And for X use xinerama .

Adrian Stanila
P.S. is working for all combination of video cards. :))

Quoted 40 lines · On Wed, 5 Sep 2001 [email protected] wrote:

Check the http://ylabs.igreconline.com ... Is a mingetty patch for framebuffer .

Adrian Stanila

Quoted 18 lines · Simon Hay

Hi all,

Apologies in advance if this is a question that's already been answered somewhere... I'm looking for a way to install multiple (or rather, two) PCI/AGP cards in a machine and connect a monitor to each one, and use them both *in console mode* - preferably with some nice way to say 'assign virtual console 2 to the first screen, and 5 to the second' - that way you could have one tailing log files, showing 'top', whatever. A quick search of the web/newsgroups turned up various patches that looked ideal, but a closer inspection revealed that they either relied on you having a Hercules mono card, or only applied against kernel <0.99, or both... I was just wondering if anyone's thought about/written a similar patch for more recent hardware/versions? I was using a console Linux machine running BB (ASCII art demo -
http://aa-project.sourceforge.net/) just to attract attention to our stand today and was thinking it would be really neat to have one machine driving several screens...

Quoted 7 lines

Simon
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/