video: Fix missing terminal deinitialisation before changing into final video mode

This commit is contained in:
mintsuki 2021-04-04 18:05:18 +02:00
parent 98fdd625c4
commit bfc613bcbb
6 changed files with 16 additions and 0 deletions

View File

@ -7,6 +7,8 @@
#include <lib/gterm.h>
void term_vbe(uint32_t *colours, int margin, int margin_gradient, struct image *background) {
term_backend = NOT_READY;
if (!gterm_init(&term_rows, &term_cols, colours, margin, margin_gradient, background)) {
#if defined (bios)
// Failed to set VBE properly, default to text mode

View File

@ -21,6 +21,8 @@ void term_vbe(uint32_t *colours, int margin, int margin_gradient, struct image *
void term_textmode(void);
void term_write(const char *buf, size_t count);
void term_deinit(void);
extern int term_rows, term_cols;
enum {

View File

@ -27,6 +27,8 @@ int term_rows, term_cols;
#if defined (bios)
void term_textmode(void) {
term_backend = NOT_READY;
init_vga_textmode(&term_rows, &term_cols, true);
raw_putchar = text_putchar;
@ -45,6 +47,10 @@ void term_textmode(void) {
}
#endif
void term_deinit(void) {
term_backend = NOT_READY;
}
static void term_putchar(uint8_t c);
void term_write(const char *buf, size_t count) {

View File

@ -482,6 +482,8 @@ void linux_load(char *config, char *cmdline) {
// Video
///////////////////////////////////////
term_deinit();
mtrr_restore();
struct screen_info *screen_info = &boot_params->screen_info;

View File

@ -157,6 +157,8 @@ void stivale_load(char *config, char *cmdline) {
stivale_struct.epoch = time();
print("stivale: Current epoch: %U\n", stivale_struct.epoch);
term_deinit();
if (stivale_hdr.flags & (1 << 0)) {
int req_width = stivale_hdr.framebuffer_width;
int req_height = stivale_hdr.framebuffer_height;

View File

@ -261,6 +261,8 @@ void stivale2_load(char *config, char *cmdline, bool pxe, void *efi_system_table
// Create framebuffer struct tag
//////////////////////////////////////////////
{
term_deinit();
struct stivale2_header_tag_framebuffer *hdrtag = get_tag(&stivale2_hdr, STIVALE2_HEADER_TAG_FRAMEBUFFER_ID);
if (hdrtag != NULL) {