This compiles in and enables the new framebuffer codepath in the vga driver, if detected.
--- console-client/Makefile | 3 ++- console-client/vga.c | 48 +++++++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/console-client/Makefile b/console-client/Makefile index b991cd73..711258c7 100644 --- a/console-client/Makefile +++ b/console-client/Makefile @@ -22,7 +22,7 @@ makemode := utilities targets = console CONSOLE_SRCS = console.c timer.c driver.c trans.c -VGA_SO_SRCS = bdf.c vga-dynafont.c vga-dynacolor.c vga-support.c vga.c +VGA_SO_SRCS = bdf.c vga-dynafont.c vga-dynacolor.c vga-support.c vga.c fb.c PC_KBD_SO_SRCS = pc-kbd.c kbd-repeat.c PC_MOUSE_SO_SRCS = pc-mouse.c GENERIC_SPEAKER_SO_SRCS = generic-speaker.c @@ -60,6 +60,7 @@ console: $(CONSOLE_SRCS:.c=.o) \ modules = vga pc_kbd generic_speaker pc_mouse current_vcs vga-CPPFLAGS = -DDEFAULT_VGA_FONT_DIR=\"${datadir}/hurd/\" +fb-CPPFLAGS = -DDEFAULT_VGA_FONT_DIR=\"${datadir}/hurd/\" vga.so.$(hurd-version): $(patsubst %.c,%_pic.o,$(VGA_SO_SRCS)) pc_kbd.so.$(hurd-version): $(patsubst %.c,%_pic.o,$(PC_KBD_SO_SRCS)) \ kdioctlServer_pic.o diff --git a/console-client/vga.c b/console-client/vga.c index e954013d..ec63330c 100644 --- a/console-client/vga.c +++ b/console-client/vga.c @@ -37,6 +37,7 @@ #include "driver.h" #include "timer.h" +#include "fb.h" #include "vga-hw.h" #include "vga-support.h" #include "bdf.h" @@ -132,6 +133,8 @@ struct vga_display struct refchr refmatrix[VGA_DISP_HEIGHT][VGA_DISP_WIDTH]; }; +/* Forward declaration */ +struct driver_ops driver_vga_ops; static void vga_display_invert_border (void) @@ -279,9 +282,12 @@ vga_display_init (void **handle, int no_exit, int argc, char *argv[], int *next) { error_t err; - struct vga_display *disp; + struct vga_display *vgadisp; + struct fb_display *fbdisp; int pos = 1; + fb_get_multiboot_params(); + /* XXX Assert that we are called only once. */ pthread_mutex_init (&vga_display_lock, NULL); timer_clear (&vga_display_timer); @@ -294,18 +300,38 @@ vga_display_init (void **handle, int no_exit, int argc, char *argv[], if (err && err != EINVAL) return err; - /* Create and initialize the display structure as much as - possible. */ - disp = calloc (1, sizeof *disp); - if (!disp) - return ENOMEM; + if (fb_type == MULTIBOOT_FRAMEBUFFER_TYPE_EGA_TEXT) + { + /* EGA text mode */ + vgadisp = calloc (1, sizeof *vgadisp); + if (!vgadisp) + return ENOMEM; + + vgadisp->df_size = vga_display_max_glyphs ? 512 : 256; + vgadisp->df_width = vga_display_font_width; + vgadisp->width = VGA_DISP_WIDTH; + vgadisp->height = VGA_DISP_HEIGHT; + + *handle = vgadisp; + } + else + { + /* Linear framebuffer! */ + fbdisp = calloc (1, sizeof *fbdisp); + if (!fbdisp) + return ENOMEM; + + fbdisp->width = fb_width; + fbdisp->height = fb_height; - disp->df_size = vga_display_max_glyphs ? 512 : 256; - disp->df_width = vga_display_font_width; - disp->width = VGA_DISP_WIDTH; - disp->height = VGA_DISP_HEIGHT; + /* dynamically switch drivers */ + driver_vga_ops.start = fb_display_start; + driver_vga_ops.fini = fb_display_fini; + driver_vga_ops.restore_status = NULL; + + *handle = fbdisp; + } - *handle = disp; return 0; } -- 2.45.2