Skip to contentSkip to conversation

support console resolutions better than 80x25

RFC Jan Beulich 2 participants 27 messages Aug 2, 2006 – Aug 16, 2006

lore
Share & tools
lore
#0 lore raw

While a poor man's version of this had been posted a long time ago, I'd like to re-raise the issue: On machines either not having a serial port or being too far away from a second machine, debugging must solely rely on the VGA console. On 25 lines one can't, however, display a lot of things - frequently, a simple register and stack dump doesn't even fit. Therefore I have been running with code supporting up to 80x60 for more than the last half year, and prior to that I had been using aforementioned poor man's version supporting 80x30.
Clearly, the most important thing here besides initializing the actual mode is to establish a channel by which the hypervisor can communicate the screen geometry to the guest. Other than in the originally posted version, this is now done without modifying the startup info structure layout; instead, the two (meaningless for dom0) console_* fields are now being (mis-)used for communication size and location of a new console_info structure. That structure contains all the video related information Linux would normally obtain from the BIOS, including the potential of using a VESA (graphics) based console (which would be the next logical step I'm planning to take at some point). If there is a reasonable chance for such code to get merged, I'll put together a patch and post it here for review.

Jan

#1 lore raw
Quoted 9 lines · Jan Beulich

While a poor man's version of this had been posted a long time ago, I'd like to re-raise the issue: On machines either not having a serial port or being too far away from a second machine, debugging must solely rely on the VGA console. On 25 lines one can't, however, display a lot of things - frequently, a simple register and stack dump doesn't even fit. Therefore I have been running with code supporting up to 80x60 for more than the last half year, and prior to that I had been using aforementioned poor man's version supporting 80x30.
Clearly, the most important thing here besides initializing the actual mode is to establish a channel by which the hypervisor can communicate the screen geometry to the guest.

Quoted 8 lines

Other than in the originally posted version, this is now done without modifying the startup info structure layout; instead, the two (meaningless for dom0) console_* fields are now being (mis-)used for communication size and location of a new console_info structure. That structure contains all the video related information Linux would normally obtain from the BIOS, including the potential of using a VESA (graphics) based console (which would be the next logical step I'm planning to take at some point). If there is a reasonable chance for such code to get merged, I'll put together a patch and post it here for review.

Being limited to 80x25 is a pita. I'd be interested in seeing a patch (just a rough one for initial comments if you can do that with less effort).

-- Keir

#2 lore raw
Quoted 3 lines

Being limited to 80x25 is a pita. I'd be interested in seeing a patch (just a rough one for initial comments if you can do that with less effort).

Attached. Jan

linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c renamed from home/jbeulich/src/xen/2006-07-27/linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c +25 -0
@@ -1670,6 +1670,31 @@ void __init setup_arch(char **cmdline_p)
 		screen_info.orig_video_cols = 80;
 		screen_info.orig_video_ega_bx = 3;
 		screen_info.orig_video_points = 16;
+		if (xen_start_info->console_evtchn >= sizeof(console_info_t)) {
+			const console_info_t *console_info = (void *)xen_start_info + xen_start_info->console_mfn;
+
+			screen_info.orig_video_mode = console_info->txt_mode;
+			screen_info.orig_video_isVGA = console_info->video_type;
+			screen_info.orig_video_lines = console_info->video_height;
+			screen_info.orig_video_cols = console_info->video_width;
+			screen_info.orig_video_points = console_info->txt_points;
+			screen_info.lfb_width = console_info->video_width;
+			screen_info.lfb_height = console_info->video_height;
+			screen_info.lfb_depth = console_info->lfb_depth;
+			screen_info.lfb_base = console_info->lfb_base;
+			screen_info.lfb_size = console_info->lfb_size;
+			screen_info.lfb_linelength = console_info->lfb_linelen;
+			screen_info.red_size = console_info->red_size;
+			screen_info.red_pos = console_info->red_pos;
+			screen_info.green_size = console_info->green_size;
+			screen_info.green_pos = console_info->green_pos;
+			screen_info.blue_size = console_info->blue_size;
+			screen_info.blue_pos = console_info->blue_pos;
+			screen_info.rsvd_size = console_info->rsvd_size;
+			screen_info.rsvd_pos = console_info->rsvd_pos;
+		}
+		xen_start_info->console_mfn = 0;
+		xen_start_info->console_evtchn = 0;
 	} else
 		screen_info.orig_video_isVGA = 0;
 
linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c renamed from home/jbeulich/src/xen/2006-07-27/linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c +25 -0
@@ -648,6 +648,31 @@ void __init setup_arch(char **cmdline_p)
 		screen_info.orig_video_cols = 80;
 		screen_info.orig_video_ega_bx = 3;
 		screen_info.orig_video_points = 16;
+		if (xen_start_info->console_evtchn >= sizeof(console_info_t)) {
+			const console_info_t *console_info = (void *)xen_start_info + xen_start_info->console_mfn;
+
+			screen_info.orig_video_mode = console_info->txt_mode;
+			screen_info.orig_video_isVGA = console_info->video_type;
+			screen_info.orig_video_lines = console_info->video_height;
+			screen_info.orig_video_cols = console_info->video_width;
+			screen_info.orig_video_points = console_info->txt_points;
+			screen_info.lfb_width = console_info->video_width;
+			screen_info.lfb_height = console_info->video_height;
+			screen_info.lfb_depth = console_info->lfb_depth;
+			screen_info.lfb_base = console_info->lfb_base;
+			screen_info.lfb_size = console_info->lfb_size;
+			screen_info.lfb_linelength = console_info->lfb_linelen;
+			screen_info.red_size = console_info->red_size;
+			screen_info.red_pos = console_info->red_pos;
+			screen_info.green_size = console_info->green_size;
+			screen_info.green_pos = console_info->green_pos;
+			screen_info.blue_size = console_info->blue_size;
+			screen_info.blue_pos = console_info->blue_pos;
+			screen_info.rsvd_size = console_info->rsvd_size;
+			screen_info.rsvd_pos = console_info->rsvd_pos;
+		}
+		xen_start_info->console_mfn = 0;
+		xen_start_info->console_evtchn = 0;
 	} else
 		screen_info.orig_video_isVGA = 0;
 
xen/arch/x86/domain_build.c renamed from home/jbeulich/src/xen/2006-07-27/xen/arch/x86/domain_build.c +8 -2
@@ -12,6 +12,7 @@
 #include <xen/smp.h>
 #include <xen/delay.h>
 #include <xen/event.h>
+#include <xen/console.h>
 #include <xen/elf.h>
 #include <xen/kernel.h>
 #include <xen/domain.h>
@@ -334,8 +335,8 @@ int construct_dom0(struct domain *d,
     vphysmap_start   = round_pgup(vinitrd_end);
     vphysmap_end     = vphysmap_start + (nr_pages * sizeof(unsigned long));
     vstartinfo_start = round_pgup(vphysmap_end);
-    vstartinfo_end   = vstartinfo_start + PAGE_SIZE;
-    vpt_start        = vstartinfo_end;
+    vstartinfo_end   = vstartinfo_start + sizeof(start_info_t) + sizeof(console_info_t);
+    vpt_start        = round_pgup(vstartinfo_end);
     for ( nr_pt_pages = 2; ; nr_pt_pages++ )
     {
         vpt_end          = vpt_start + (nr_pt_pages * PAGE_SIZE);
@@ -770,6 +771,11 @@ int construct_dom0(struct domain *d,
     if ( cmdline != NULL )
         strncpy((char *)si->cmd_line, cmdline, sizeof(si->cmd_line)-1);
 
+    if(fill_console_start_info((void *)(si + 1))) {
+        si->console_mfn = sizeof(start_info_t);
+        si->console_evtchn = sizeof(console_info_t);
+    }
+
     /* Reinstate the caller's page tables. */
     write_ptbase(current);
     local_irq_enable();
xen/drivers/char/Makefile renamed from home/jbeulich/src/xen/2006-07-27/xen/drivers/char/Makefile +4 -0
@@ -1,3 +1,7 @@
 obj-y += console.o
+obj-y += font_8x14.o
+obj-y += font_8x16.o
+obj-y += font_8x8.o
 obj-y += ns16550.o
 obj-y += serial.o
+obj-y += vga.o
xen/drivers/char/console.c renamed from home/jbeulich/src/xen/2006-07-27/xen/drivers/char/console.c +49 -7

100 lines not on this page · raw message

xen/drivers/char/font.h renamed from home/jbeulich/src/xen/2006-07-27/xen/drivers/char/font.h +26 -0
@@ -0,0 +1,26 @@
+/*
+ *  font.h -- `Soft' font definitions
+ *
+ *  Created 1995 by Geert Uytterhoeven
+ *
+ *  This file is subject to the terms and conditions of the GNU General Public
+ *  License.  See the file COPYING in the main directory of this archive
+ *  for more details.
+ */
+
+#ifndef _VIDEO_FONT_H
+#define _VIDEO_FONT_H
+
+struct font_desc {
+    const char *name;
+    unsigned width, height, count;
+    const void *data;
+};
+
+extern const struct font_desc	font_vga_8x8,
+			font_vga_8x14,
+			font_vga_8x16;
+
+int vga_load_font(const struct font_desc *, unsigned rows);
+
+#endif /* _VIDEO_FONT_H */
xen/drivers/char/vga.c renamed from home/jbeulich/src/xen/2006-07-27/xen/drivers/char/vga.c +582 -0

582 lines not on this page · raw message

xen/include/public/xen.h renamed from home/jbeulich/src/xen/2006-07-27/xen/include/public/xen.h +22 -0
@@ -477,6 +477,28 @@ typedef struct start_info {
 #define SIF_PRIVILEGED    (1<<0)  /* Is the domain privileged? */
 #define SIF_INITDOMAIN    (1<<1)  /* Is this the initial control domain? */
 
+typedef struct console_info {
+    uint8_t video_type;
+    uint8_t txt_points;
+    uint16_t txt_mode;
+    uint16_t txt_x;
+    uint16_t txt_y;
+    uint16_t video_width;
+    uint16_t video_height;
+    uint16_t lfb_linelen;
+    uint16_t lfb_depth;
+    unsigned long lfb_base;
+    unsigned long lfb_size;
+    uint8_t red_pos;
+    uint8_t red_size;
+    uint8_t green_pos;
+    uint8_t green_size;
+    uint8_t blue_pos;
+    uint8_t blue_size;
+    uint8_t rsvd_pos;
+    uint8_t rsvd_size;
+} console_info_t;
+
 typedef uint64_t cpumap_t;
 
 typedef uint8_t xen_domain_handle_t[16];
xen/include/xen/console.h renamed from home/jbeulich/src/xen/2006-07-27/xen/include/xen/console.h +2 -0
@@ -9,6 +9,7 @@
 
 #include <xen/spinlock.h>
 #include <xen/guest_access.h>
+#include <public/xen.h>
 
 void set_printk_prefix(const char *prefix);
 
@@ -16,6 +17,7 @@ long read_console_ring(GUEST_HANDLE(char
 
 void init_console(void);
 void console_endboot(void);
+int fill_console_start_info(console_info_t *);
 
 void console_force_unlock(void);
 void console_force_lock(void);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
Quoted 5 lines · Jan Beulich
Quoted 3 lines

Being limited to 80x25 is a pita. I'd be interested in seeing a patch (just a rough one for initial comments if you can do that with less effort).

Attached. Jan

This seems okay to me in principle. If it's cleaned up a bit then there's no reason not to take it -- and getting out of 80x25 mode is very desirable!

A few thoughts:
* Could we put all the vga-related stuff in drivers/char/vga
* Also move the existing vga-specific code into its own file in
drivers/char/vga
* Are the vga files you add pulled from some other project (svgalib)?
If so, are they heavily modified or is it plausible for us to track and port changes from that other project?
* Maybe add a feature or version field to the console_info structure
so we can extend it in future.
* Would the test in linux be better as if (SIF_INITDOMAIN &&
console_evtchn) rather than a somehat arbitrary comparsion against a sizeof()?

-- Keir

#4 lore raw
Quoted 4 lines

A few thoughts:
* Could we put all the vga-related stuff in drivers/char/vga
* Also move the existing vga-specific code into its own file in
drivers/char/vga

Sure, once I know the code is generally acceptable this can be done (till now I simply didn't bother).
As you've seen I omitted the font source files (almost identical clones of the respective linux files) - would you want these in a separate directory then, too?

Quoted 3 lines

* Are the vga files you add pulled from some other project (svgalib)?
If so, are they heavily modified or is it plausible for us to track and port changes from that other project?

Taken from Linux, but heavily modified.

Quoted 2 lines

* Maybe add a feature or version field to the console_info structure
so we can extend it in future.

Can do. But I considered using the size of the structure sufficient, as that basically enforces (with a little discipline) adding to the end of the structure.

Quoted 3 lines

* Would the test in linux be better as if (SIF_INITDOMAIN &&
console_evtchn) rather than a somehat arbitrary comparsion against a sizeof()?

That code already is inside a SIF_INITDOMAIN section. The sizeof() check was just to ensure compatibility; if we'll have a version field, the check can be replaced by a version check (see above, let me know).

Jan

#5 lore raw
Quoted 5 lines · Jan Beulich

Sure, once I know the code is generally acceptable this can be done (till now I simply didn't bother).
As you've seen I omitted the font source files (almost identical clones of the respective linux files) - would you want these in a separate directory then, too?

Yes, I think all vga stuff can go in its own subdirectory.

Quoted 5 lines
Quoted 3 lines

* Are the vga files you add pulled from some other project (svgalib)?
If so, are they heavily modified or is it plausible for us to track and port changes from that other project?

Taken from Linux, but heavily modified.

Fair enough. I suppose this code is unlikely to change much.

Quoted 6 lines
Quoted 2 lines

* Maybe add a feature or version field to the console_info structure
so we can extend it in future.

Can do. But I considered using the size of the structure sufficient, as that basically enforces (with a little discipline) adding to the end of the structure.

Ok, makes sense.

To make the code clearer we can put {store,console}_{mfn,evtchn} inside a union something like:

union {
    struct {
        store, console info
    } normal;
    struct {
        vga offset, length
    } init;

} domain;

Changes the API a bit, but not the ABI.

-- Keir

#6 lore raw
In reply to Keir Fraser
Quoted 1 line
Quoted 1 line
Quoted 1 line

Being limited to 80x25 is a pita. I'd be interested in seeing a

patch

Quoted 1 line
Quoted 1 line
Quoted 1 line

(just a rough one for initial comments if you can do that with

less

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

effort).

Attached. Jan

This seems okay to me in principle. If it's cleaned up a bit then there's no reason not to take it -- and getting out of 80x25 mode is very desirable!

Here's the full, restructured patch. There are two remaining issues with it
that I'm not sure how to deal with:
1) It'll probably break ia64 and ppc builds.
2) On all ATI cards I tested the font loading code on so far there is a
(hardware) flaw that doesn't permit loading the font into other than font
slot zero; the code, however, defaults to load the font into slot 2, which
means that on ATI cards this currently only works with an additional command line option "fontslot=0". The purpose of loading into slot 2 is
to preserve the (BIOS provided) font in slot 0 (perhaps slots 0 and 1),
as would Linux do if it didn't set BROKEN_GRAPHICS_PROGRAMS (almost) unconditionally (in include/linux/vt_kern.h).

xen/arch/x86/domain_build.c +8 -2
@@ -12,6 +12,7 @@
 #include <xen/smp.h>
 #include <xen/delay.h>
 #include <xen/event.h>
+#include <xen/console.h>
 #include <xen/elf.h>
 #include <xen/kernel.h>
 #include <xen/domain.h>
@@ -334,8 +335,8 @@ int construct_dom0(struct domain *d,
     vphysmap_start   = round_pgup(vinitrd_end);
     vphysmap_end     = vphysmap_start + (nr_pages * sizeof(unsigned long));
     vstartinfo_start = round_pgup(vphysmap_end);
-    vstartinfo_end   = vstartinfo_start + PAGE_SIZE;
-    vpt_start        = vstartinfo_end;
+    vstartinfo_end   = vstartinfo_start + sizeof(start_info_t) + sizeof(console_info_t);
+    vpt_start        = round_pgup(vstartinfo_end);
     for ( nr_pt_pages = 2; ; nr_pt_pages++ )
     {
         vpt_end          = vpt_start + (nr_pt_pages * PAGE_SIZE);
@@ -770,6 +771,11 @@ int construct_dom0(struct domain *d,
     if ( cmdline != NULL )
         strncpy((char *)si->cmd_line, cmdline, sizeof(si->cmd_line)-1);
 
+    if ( fill_console_start_info((void *)(si + 1)) ) {
+        si->con_info_offs = sizeof(start_info_t);
+        si->con_info_size = sizeof(console_info_t);
+    }
+
     /* Reinstate the caller's page tables. */
     write_ptbase(current);
     local_irq_enable();
xen/drivers/Makefile +1 -0
@@ -1,2 +1,3 @@
 subdir-y += char
 subdir-$(HAS_ACPI) += acpi
+subdir-y += video
xen/drivers/char/console.c +50 -94

201 lines not on this page · raw message

xen/drivers/video/Makefile +4 -0
@@ -0,0 +1,4 @@
+obj-y += font_8x14.o
+obj-y += font_8x16.o
+obj-y += font_8x8.o
+obj-y += vga.o
xen/drivers/video/font_8x14.c +4118 -0

2,764 lines not on this page · raw message

xen/drivers/video/font_8x16.c +4630 -0

4,630 lines not on this page · raw message

xen/drivers/video/font_8x8.c +2582 -0

2,582 lines not on this page · raw message

xen/drivers/video/vga.c +554 -0

554 lines not on this page · raw message

xen/include/public/xen.h +31 -2

Lines of this file are not shown. View the raw message.

xen/include/xen/console.h +3 -0

Lines of this file are not shown. View the raw message.

xen/include/xen/font.h +24 -0

Lines of this file are not shown. View the raw message.

xen/include/xen/vga.h +19 -0

Lines of this file are not shown. View the raw message.

linux-2.6-xen-sparse/arch/i386/kernel/setup-xen.c +26 -0

Lines of this file are not shown. View the raw message.

linux-2.6-xen-sparse/arch/x86_64/kernel/setup-xen.c +26 -0

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Part of the diff is not shown here. View the raw message.

#7 lore raw
Quoted 5 lines · Jan Beulich

2) On all ATI cards I tested the font loading code on so far there is a
(hardware) flaw that doesn't permit loading the font into other than font
slot zero; the code, however, defaults to load the font into slot 2,

Quoted 8 lines

which
means that on ATI cards this currently only works with an additional command line option "fontslot=0". The purpose of loading into slot 2 is
to preserve the (BIOS provided) font in slot 0 (perhaps slots 0 and 1),
as would Linux do if it didn't set BROKEN_GRAPHICS_PROGRAMS (almost) unconditionally (in include/linux/vt_kern.h).

Sounds like it'd be better to make slot 0 the default and require override if the user really cares about the BIOS font data. That sounds a lot less likely than someone trying to use the higher-res text mode on an ATI adapter and getting confused when it doesn't work!

It'd be nice if we could also have the Linux-style linearfb code, so we could use the higher res graphics modes. I suppose that would be a lot more work though, and should fit in the framework that this patch provides (in particular, the info structure passed to domain0 should be able to support that, right)?

Thanks!
Keir

#8 lore raw
Quoted 10 lines · Keir Fraser

Sounds like it'd be better to make slot 0 the default and require override if the user really cares about the BIOS font data. That sounds a lot less likely than someone trying to use the higher-res text mode on an ATI adapter and getting confused when it doesn't work!

It'd be nice if we could also have the Linux-style linearfb code, so we could use the higher res graphics modes. I suppose that would be a lot more work though, and should fit in the framework that this patch provides (in particular, the info structure passed to domain0 should be able to support that, right)?

Also, the union in start_info would be clearer as (assuming this doesn't change the offset/size of any fields, which I don't think it does):

 union {
    struct {
       console_mfn/evtchn
    } normal;
    struct {
       con_info_ofs/size
    } init;

} domain;

Apart from being clearer, the Sun compiler doesn't like anonymous unions so we try to avoid them.

By the way: please just send further patches against your previous mega-patch. :-)

-- Keir

#24 lore raw
In reply to Jan Beulich
Quoted 1 line · Jan Beulich

1) It'll probably break ia64 and ppc builds.

It'd be good if the ia64/powerpc people could send patches (against this patch) to fix any issues they have. I'd like to get this better vga support into the tree soon. Maybe before 3.0.3.

-- Keir

#11 lore raw
In reply to Keir Fraser
Quoted 1 line

Sounds like it'd be better to make slot 0 the default and require

override

Quoted 1 line

if the user really cares about the BIOS font data. That sounds a lot

less

Quoted 1 line

likely than someone trying to use the higher-res text mode on an ATI

adapter

Quoted 1 line

and getting confused when it doesn't work!

I can certainly change it that way.

Quoted 1 line

It'd be nice if we could also have the Linux-style linearfb code, so

we

Quoted 1 line

could use the higher res graphics modes. I suppose that would be a lot

more

Quoted 1 line

work though, and should fit in the framework that this patch provides

(in

Quoted 1 line

particular, the info structure passed to domain0 should be able to

support

Quoted 1 line

that, right)?

Yes, that was the plan for the next step. It'll work on VESA 3.0 BIOSes only
as far as I can tell at this point, so some set of machines will be excluded.

Jan

#9 lore raw
In reply to Keir Fraser
Quoted 1 line

Also, the union in start_info would be clearer as (assuming this

doesn't

Quoted 11 lines

change the offset/size of any fields, which I don't think it does):

union {
   struct {
      console_mfn/evtchn
   } normal;
   struct {
      con_info_ofs/size
   } init;
} domain;

Apart from being clearer, the Sun compiler doesn't like anonymous

unions so

Quoted 1 line

we try to avoid them.

I know you suggested doing it that way, but since the amount of follow-up changes (to account for the changed naming) would be higher, I didn't want to do this ...

Quoted 2 lines

By the way: please just send further patches against your previous mega-patch. :-)

... in the already too large patch. So it should probably be a follow-up
adjustment...

Jan

#12 lore raw
In reply to Jan Beulich
Quoted 4 lines · Jan Beulich

Yes, that was the plan for the next step. It'll work on VESA 3.0 BIOSes only
as far as I can tell at this point, so some set of machines will be excluded.

Could we drop back into real mode and run Linux's bootloader vga code? 8->

I think GRUB has code for switching modes, which we could steal. Although the Linux code is pretty grim, it is well tested and should work on anything.

-- Keir

#10 lore raw
In reply to Jan Beulich
Quoted 8 lines · Jan Beulich
Quoted 1 line

Apart from being clearer, the Sun compiler doesn't like anonymous

unions so

Quoted 1 line

we try to avoid them.

I know you suggested doing it that way, but since the amount of follow-up changes (to account for the changed naming) would be higher, I didn't want to do this ...

Quoted 6 lines
Quoted 2 lines

By the way: please just send further patches against your previous mega-patch. :-)

... in the already too large patch. So it should probably be a follow-up
adjustment...

Fair enough. I can do that myself anyway.

-- Keir

#13 lore raw
In reply to Keir Fraser
Quoted 1 line
Quoted 1 line

Yes, that was the plan for the next step. It'll work on VESA 3.0

BIOSes

Quoted 5 lines
Quoted 3 lines

only
as far as I can tell at this point, so some set of machines will be excluded.

Could we drop back into real mode and run Linux's bootloader vga code?

8->

Quoted 2 lines

I think GRUB has code for switching modes, which we could steal.

Although

Quoted 2 lines

the Linux code is pretty grim, it is well tested and should work on anything.

We could try to use it, though I'd be hesitant adding code like this unless
really needed. Of course, in order to get other real mode stuff working
(i.e. to support Linux' edd module), this would be good to have.

Jan

#22 lore raw
In reply to Keir Fraser
Quoted 1 line
Quoted 1 line

2) On all ATI cards I tested the font loading code on so far there

is

Quoted 2 lines
Quoted 2 lines

a
(hardware) flaw that doesn't permit loading the font into other

than

Quoted 2 lines
Quoted 2 lines

font
slot zero; the code, however, defaults to load the font into slot

2,

Quoted 2 lines
Quoted 2 lines

which
means that on ATI cards this currently only works with an

additional

Quoted 1 line
Quoted 1 line

command line option "fontslot=0". The purpose of loading into slot

2

Quoted 7 lines
Quoted 5 lines

is
to preserve the (BIOS provided) font in slot 0 (perhaps slots 0 and 1),
as would Linux do if it didn't set BROKEN_GRAPHICS_PROGRAMS (almost) unconditionally (in include/linux/vt_kern.h).

Sounds like it'd be better to make slot 0 the default and require

override

Quoted 1 line

if the user really cares about the BIOS font data. That sounds a lot

less

Quoted 1 line

likely than someone trying to use the higher-res text mode on an ATI

adapter

Quoted 1 line

and getting confused when it doesn't work!

So would you want me to send an updated patch, or will you do the one line change once you commit the whole thing?

Jan

#23 lore raw
Quoted 10 lines · Jan Beulich
Quoted 1 line

Sounds like it'd be better to make slot 0 the default and require

override

Quoted 1 line

if the user really cares about the BIOS font data. That sounds a lot

less

Quoted 1 line

likely than someone trying to use the higher-res text mode on an ATI

adapter

Quoted 1 line

and getting confused when it doesn't work!

So would you want me to send an updated patch, or will you do the one line change once you commit the whole thing?

I can manage this one. :-)

-- Keir

#14 lore raw
In reply to Jan Beulich
Quoted 5 lines · Jan Beulich
Quoted 1 line

Could we drop back into real mode and run Linux's bootloader vga code?

8->

Quoted 2 lines

I think GRUB has code for switching modes, which we could steal.

Although

Quoted 8 lines
Quoted 2 lines

the Linux code is pretty grim, it is well tested and should work on anything.

We could try to use it, though I'd be hesitant adding code like this unless
really needed. Of course, in order to get other real mode stuff working
(i.e. to support Linux' edd module), this would be good to have.

It's true the Linux video.S is mainly supporting some truly ancient video cards. Is vesa3 very prevalent nowadays? Could we make do with vesa2?

-- Keir

#15 lore raw
Quoted 1 line

It's true the Linux video.S is mainly supporting some truly ancient

video

Quoted 1 line

cards. Is vesa3 very prevalent nowadays? Could we make do with vesa2?

If you're intending to use real mode, then VESA 2.x is sufficient, and I
haven't seen any machines with only VESA 1.x in the past few years. VESA 3.0 seems to be less common (the [few] machines I checked the versions on were about 50:50 2.x and 3.0 respectively).

Jan

#16 lore raw
Quoted 9 lines · Jan Beulich
Quoted 1 line

It's true the Linux video.S is mainly supporting some truly ancient

video

Quoted 1 line

cards. Is vesa3 very prevalent nowadays? Could we make do with vesa2?

If you're intending to use real mode, then VESA 2.x is sufficient, and I
haven't seen any machines with only VESA 1.x in the past few years. VESA 3.0 seems to be less common (the [few] machines I checked the versions on were about 50:50 2.x and 3.0 respectively).

As you say, we're probably going to have to bite the bullet and support switch back to real mode at some point anyway. An approach which leaves 50% of video cards out in the cold isn't great.

-- Keir

#25 lore raw
In reply to Jan Beulich
Quoted 1 line · Jan Beulich

Here's the full, restructured patch.

Is there really a need for vga_cursor_off() to be called from cls()? Couldn't we call it once at the end of init_vga(), or even fold it into one of setup_vga or vga_load_font?

-- Keir

#26 lore raw
Quoted 2 lines

Is there really a need for vga_cursor_off() to be called from cls()? Couldn't we call it once at the end of init_vga(), or even fold it

into one

Quoted 1 line

of setup_vga or vga_load_font?

Certainly; I didn't know why it was there in the original code, so I simply kept it. I would even think that it wouldn't be wrong to leave it out altogether.

Jan

#17 lore raw
In reply to Jan Beulich
Quoted 11 lines · Jan Beulich
Quoted 1 line

It'd be nice if we could also have the Linux-style linearfb code, so

we

Quoted 1 line

could use the higher res graphics modes. I suppose that would be a lot

more

Quoted 1 line

work though, and should fit in the framework that this patch provides

(in

Quoted 1 line

particular, the info structure passed to domain0 should be able to

support

Quoted 1 line

that, right)?

Yes, that was the plan for the next step.

Looking at the console_info structure some more, I wonder if it could do with some cleaning up. Currently it seems to be a halfway house between being a duplicate of the Linux screen_info structure and an independent structure in its own right. Hence the meaning of some of the fields is unclear.

Here are some comments we should address before we fork 3.0.3 this week:
* What do the values of the video_type and txt_mode fields mean? Do we need
to provide enumerations, or refer to VESA type codes?
* txt_points might be better named txt_font_height?
* txt_x/txt_y aren't written by Xen nor are they read by Linux -- can we
kill the fields?
* video_width/height is used to initialise *both* text cols/rows and lfb
width/height in Linux. Is this okay (since only one or the other is valid) or should we provide two sets of fields in console_info (perhaps txt_x/y were intended for this purpose)?
* rsvd_pos/size is obviously cribbed from the Linux structure. Perhaps they
should be renamed as transp_pos/size or, since I think they're not used on x86 at least, just be removed for now?

Also, what about the screen_info fields that don't have a console_info equivalent -- e.g., orig_video_page, pages, vesa_attributes -- do these not matter?

-- Keir

#18 lore raw
Quoted 2 lines

* What do the values of the video_type and txt_mode fields mean? Do we need to provide enumerations, or refer to VESA type codes?

video_type is the equivalent of Linux' orig_video_isVGA (which is namely used to distinguish between VGA text and VESA lfb based screen setups), whereas txt_mode is the equivalent of Linux' orig_video_mode, representing the specific (BIOS INT 10) mode that was in effect when booting.
While clearly these could be combined into a single field, keeping things the Linux way seemed simpler to me.

Quoted 1 line

* txt_points might be better named txt_font_height?

Yes, if you like this better. The naming was just following Linux'.

Quoted 2 lines

* txt_x/txt_y aren't written by Xen nor are they read by Linux -- can we kill the fields?

Linux actually uses orig_y (in earlyprintk.c), so I'd like to keep them and at some point properly fill them so Linux can propagate these values. You'll note that currently I simply set orig_y to the end of the screen, since Xen is virtually guaranteed to push out at least a screenful of information before starting Linux.
The problem here is that these fields cannot be set in fill_console_info, but would need to be set once it is certain that there is not going to be any more (non-debug) output from Xen.

Quoted 4 lines

* video_width/height is used to initialise *both* text cols/rows and lfb width/height in Linux. Is this okay (since only one or the other is valid) or should we provide two sets of fields in console_info (perhaps txt_x/y were intended for this purpose)?

I intentionally combined the two (redundant) Linux fields into one; video_type disambiguates them.

Quoted 5 lines

* rsvd_pos/size is obviously cribbed from the Linux structure. Perhaps they should be renamed as transp_pos/size or, since I think they're not used on x86 at least, just be removed for now?

From Linux, and they in turn inherited it from VESA. Renaming it seems okay

(as transparency is the only known possible meaning for them), but I'd like to keep the fields.

Quoted 3 lines

Also, what about the screen_info fields that don't have a console_info equivalent -- e.g., orig_video_page, pages, vesa_attributes -- do these not matter?

For these I didn't see their usefulness; pages and vesa_attributes (and then also capabilities) could potentially be of use (though in a pure lfb setup pages at least shouldn't matter).

Jan

#19 lore raw
Quoted 11 lines · Jan Beulich
Quoted 2 lines

* What do the values of the video_type and txt_mode fields mean? Do we need to provide enumerations, or refer to VESA type codes?

video_type is the equivalent of Linux' orig_video_isVGA (which is namely used to distinguish between VGA text and VESA lfb based screen setups), whereas txt_mode is the equivalent of Linux' orig_video_mode, representing the specific
(BIOS INT 10) mode that was in effect when booting.
While clearly these could be combined into a single field, keeping things the Linux
way seemed simpler to me.

Could video_type just be a is_lfb boolean? Do we think we'll ever support anything other than vga text modes and lfb gfx modes? That's all Linux's video.S seems to support as values for the isVGA field.

We don't seem to really use txt_mode. We always set it to 3: that can't be the right value for all the different text modes we support, can it? Anyway, if it represents an int10 mode value then it's really a vga_mode rather than just a txt_mode, isn't it? Given this field is hardly used in Linux (just to gate setup of vgacon.c afaics) it seems this field could simply be removed.

-- Keir

#20 lore raw
In reply to Jan Beulich
Quoted 11 lines · Jan Beulich
Quoted 2 lines

* txt_x/txt_y aren't written by Xen nor are they read by Linux -- can we kill the fields?

Linux actually uses orig_y (in earlyprintk.c), so I'd like to keep them and at some point properly fill them so Linux can propagate these values. You'll note that currently I simply set orig_y to the end of the screen, since Xen is virtually guaranteed to push out at least a screenful of information before starting Linux.
The problem here is that these fields cannot be set in fill_console_info, but would need to be set once it is certain that there is not going to be any more (non-debug) output from Xen.

How will Linux know when we start filling them in properly? (0,0) would be a valid setting!

We should set them to the conservative (bottom-of-screen) value in Xen and read the values from console_info in Linux, rather than initialising from hardcoded values in Linux.

-- Keir

#21 lore raw
Quoted 12 lines
Quoted 11 lines
Quoted 2 lines

* txt_x/txt_y aren't written by Xen nor are they read by Linux -- can we kill the fields?

Linux actually uses orig_y (in earlyprintk.c), so I'd like to keep them and at some point properly fill them so Linux can propagate these values. You'll note that currently I simply set orig_y to the end of the screen, since Xen is virtually guaranteed to push out at least a screenful of information before starting Linux.
The problem here is that these fields cannot be set in fill_console_info, but would need to be set once it is certain that there is not going to be any more (non-debug) output from Xen.

Quoted 6 lines

How will Linux know when we start filling them in properly? (0,0) would be a valid setting!

We should set them to the conservative (bottom-of-screen) value in Xen and read the values from console_info in Linux, rather than initialising from hardcoded values in Linux.

That's fine with me.

Jan