[vid] Prepare for VESA implementation.
This commit is contained in:
parent
bf1011e2ba
commit
fb8f35719d
@ -282,6 +282,7 @@ extern int detect_cpu();
|
||||
/* Video Drivers */
|
||||
/* BOCHS / QEMU VBE Driver */
|
||||
extern void graphics_install_bochs(uint16_t, uint16_t);
|
||||
extern void graphics_install_vesa(uint16_t x, uint16_t y);
|
||||
extern void bochs_set_csr(int x, int y);
|
||||
extern int bochs_get_csr_x();
|
||||
extern int bochs_get_csr_y();
|
||||
|
@ -56,17 +56,19 @@ parse_args(
|
||||
|
||||
if (!strcmp(argp[0],"vid")) {
|
||||
if (argc < 2) { kprintf("vid=?\n"); continue; }
|
||||
uint16_t x, y;
|
||||
if (argc < 4) {
|
||||
x = 1024;
|
||||
y = 768;
|
||||
} else {
|
||||
x = atoi(argp[2]);
|
||||
y = atoi(argp[3]);
|
||||
}
|
||||
if (!strcmp(argp[1],"qemu")) {
|
||||
/* Bochs / Qemu Video Device */
|
||||
uint16_t x, y;
|
||||
if (argc < 4) {
|
||||
x = 1024;
|
||||
y = 768;
|
||||
} else {
|
||||
x = atoi(argp[2]);
|
||||
y = atoi(argp[3]);
|
||||
}
|
||||
graphics_install_bochs(x,y);
|
||||
} else if (!strcmp(argp[1],"vesa")) {
|
||||
graphics_install_vesa(x,y);
|
||||
} else {
|
||||
kprintf("Unrecognized video adapter: %s\n", argp[1]);
|
||||
}
|
||||
|
@ -151,6 +151,19 @@ bochs_install_wallpaper(char * filename) {
|
||||
free(bufferb);
|
||||
}
|
||||
|
||||
static void finalize_graphics(uint16_t x, uint16_t y) {
|
||||
bochs_resolution_x = x;
|
||||
bochs_resolution_y = y;
|
||||
bochs_resolution_b = PREFERRED_B;
|
||||
|
||||
term_width = bochs_resolution_x / 8;
|
||||
term_height = bochs_resolution_y / 12;
|
||||
|
||||
/* Buffer contains characters, fg (of 256), bg (same), flags (one byte) */
|
||||
term_buffer = (uint8_t *)malloc(sizeof(uint8_t) * 4 * term_width * term_height);
|
||||
ansi_init(&bochs_write, 128, 64, &bochs_set_colors, &bochs_set_csr, &bochs_get_csr_x, &bochs_get_csr_y, &bochs_set_cell, &bochs_term_clear, &bochs_redraw_cursor);
|
||||
}
|
||||
|
||||
void
|
||||
graphics_install_bochs(uint16_t resolution_x, uint16_t resolution_y) {
|
||||
outports(0x1CE, 0x00);
|
||||
@ -206,16 +219,30 @@ graphics_install_bochs(uint16_t resolution_x, uint16_t resolution_y) {
|
||||
}
|
||||
|
||||
mem_found:
|
||||
bochs_resolution_x = resolution_x;
|
||||
bochs_resolution_y = resolution_y;
|
||||
bochs_resolution_b = PREFERRED_B;
|
||||
finalize_graphics(resolution_x, resolution_y);
|
||||
}
|
||||
|
||||
term_width = bochs_resolution_x / 8;
|
||||
term_height = bochs_resolution_y / 12;
|
||||
void
|
||||
graphics_install_vesa(uint16_t x, uint16_t y) {
|
||||
kprintf("VESA graphics mode not yet supported.\n");
|
||||
return;
|
||||
|
||||
/* Buffer contains characters, fg (of 256), bg (same), flags (one byte) */
|
||||
term_buffer = (uint8_t *)malloc(sizeof(uint8_t) * 4 * term_width * term_height);
|
||||
ansi_init(&bochs_write, 128, 64, &bochs_set_colors, &bochs_set_csr, &bochs_get_csr_x, &bochs_get_csr_y, &bochs_set_cell, &bochs_term_clear, &bochs_redraw_cursor);
|
||||
uint16_t actual_x, actual_y;
|
||||
|
||||
/*
|
||||
* TODO: Vesa initialization and mode setting; match requested
|
||||
* or prompt with available modes.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* TODO: Activate DMA paging records for the graphics region.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Finalize the graphics setup with the actual selected resolution.
|
||||
*/
|
||||
finalize_graphics(actual_x,actual_y);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user