static adv_error vgaline_mode_generate_text(vgaline_video_mode* mode, const adv_crtc* crtc, unsigned flags) { mode->is_text = 1; mode->crtc = *crtc; if (crtc->hde % 9 == 0 && crtc->hrs % 9 == 0 && crtc->hre % 9 == 0 && crtc->ht % 9 == 0) { mode->font_x = 9; } else if (crtc->hde % 8 == 0 && crtc->hrs % 2 == 0 && crtc->hre % 2 == 0 && crtc->ht % 2 == 0) { mode->font_x = 8; } else { error_nolog_set("Unsupported horizontal crtc values. Only multiple of 8 or 9 pixels are supported.\n"); return -1; } if (video_mode_generate_check("vgaline", vgaline_flags(), 1, 1024, crtc, flags)!=0) return -1; mode->font_y = crtc->vde / 25; if (mode->font_y >= 16) mode->font_y = 16; else if (mode->font_y >= 14) mode->font_y = 14; else mode->font_y = 8; return 0; }
static adv_error none_mode_generate(none_video_mode* mode, const adv_crtc* crtc, unsigned flags) { assert(none_is_active()); if (video_mode_generate_check("none", none_flags(), 8, 2048, crtc, flags) != 0) return -1; mode->crtc = *crtc; mode->index = flags & MODE_FLAGS_INDEX_MASK; return 0; }
static adv_error vgaline_mode_generate_graphics(vgaline_video_mode* mode, const adv_crtc* crtc, unsigned flags) { if (video_mode_generate_check("vgaline", vgaline_flags(), 2, 1024, crtc, flags)!=0) return -1; if (crtc->hde * crtc->vde > 64 * 1024) { error_nolog_set("Mode to big for the VGA memory.\n"); return -1; } mode->is_text = 0; mode->crtc = *crtc; mode->font_x = 0; mode->font_y = 0; return 0; }
adv_error fb_mode_generate(fb_video_mode* mode, const adv_crtc* crtc, unsigned flags) { assert(fb_is_active()); if (crtc_is_fake(crtc)) { error_nolog_set("Not programmable modes are not supported.\n"); return -1; } if (video_mode_generate_check("fb", fb_flags(), 8, 2048, crtc, flags)!=0) return -1; mode->crtc = *crtc; mode->index = flags & MODE_FLAGS_INDEX_MASK; return 0; }