Actually retreive stride/pitch info

This commit is contained in:
K. Lange 2018-07-21 11:57:20 +09:00
parent 3da02638d1
commit 8f5d2b3172
2 changed files with 4 additions and 2 deletions

View File

@ -268,7 +268,7 @@ done_video:
multiboot_header.framebuffer_addr = low;
multiboot_header.framebuffer_width = gfx->Mode->Info->HorizontalResolution;
multiboot_header.framebuffer_height = gfx->Mode->Info->VerticalResolution;
multiboot_header.framebuffer_pitch = 0;
multiboot_header.framebuffer_pitch = gfx->Mode->Info->PixelsPerScanLine * 4;
print_("Mode information passed to multiboot:\n");
print_(" Address: 0x"); print_hex_(multiboot_header.framebuffer_addr); print_("\n");

View File

@ -324,12 +324,14 @@ mem_found:
static void graphics_install_preset(uint16_t w, uint16_t h) {
debug_print(NOTICE, "Graphics were pre-configured (thanks, bootloader!), locating video memory...");
uint16_t b = 32; /* If you are 24 bit, go away, we really do not support you. */
uint32_t s = 0;
if (mboot_ptr && (mboot_ptr->flags & (1 << 12))) {
/* hello world */
lfb_vid_memory = (void *)mboot_ptr->framebuffer_addr;
w = mboot_ptr->framebuffer_width;
h = mboot_ptr->framebuffer_height;
s = mboot_ptr->framebuffer_pitch;
debug_print(WARNING, "Mode was set by bootloader: %dx%d bpp should be 32, framebuffer is at 0x%x", w, h, (uintptr_t)lfb_vid_memory);
@ -383,7 +385,7 @@ static void graphics_install_preset(uint16_t w, uint16_t h) {
debug_print(WARNING, "Failed to locate video memory. This could end poorly.");
mem_found:
finalize_graphics(w,h,b,w*4);
finalize_graphics(w,h,b,s ? s : w * 4);
}