From a3a0808085a0ea18b3cfb8dbd87091b613a4eb68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Tue, 19 Oct 2004 17:07:01 +0000 Subject: [PATCH] Updates due to the changed frame buffer part in kernel_args. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9414 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../boot/platform/bios_ia32/console.cpp | 6 ++-- src/kernel/boot/platform/bios_ia32/video.cpp | 34 +++++++++++-------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/kernel/boot/platform/bios_ia32/console.cpp b/src/kernel/boot/platform/bios_ia32/console.cpp index d932ab5ab9..c4539ecdad 100644 --- a/src/kernel/boot/platform/bios_ia32/console.cpp +++ b/src/kernel/boot/platform/bios_ia32/console.cpp @@ -1,6 +1,6 @@ /* ** Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. -** Distributed under the terms of the OpenBeOS License. +** Distributed under the terms of the Haiku License. */ @@ -65,7 +65,7 @@ Console::WriteAt(void *cookie, off_t /*pos*/, const void *buffer, size_t bufferS { const char *string = (const char *)buffer; - if (gKernelArgs.fb.enabled) + if (gKernelArgs.frame_buffer.enabled) return bufferSize; for (uint32 i = 0; i < bufferSize; i++) { @@ -89,7 +89,7 @@ Console::WriteAt(void *cookie, off_t /*pos*/, const void *buffer, size_t bufferS void console_clear_screen(void) { - if (gKernelArgs.fb.enabled) + if (gKernelArgs.frame_buffer.enabled) return; for (uint32 i = 0; i < sScreenWidth * sScreenHeight; i++) diff --git a/src/kernel/boot/platform/bios_ia32/video.cpp b/src/kernel/boot/platform/bios_ia32/video.cpp index 5cf47ac42f..357f216191 100644 --- a/src/kernel/boot/platform/bios_ia32/video.cpp +++ b/src/kernel/boot/platform/bios_ia32/video.cpp @@ -39,6 +39,7 @@ static vbe_info_block sInfo; video_mode *sMode; bool sVesaCompatible; struct list sModeList; +static addr_t sFrameBuffer; static void @@ -319,9 +320,9 @@ platform_switch_to_logo(void) if (vesa_set_mode(sMode->mode) != B_OK) return; - gKernelArgs.fb.enabled = 1; + gKernelArgs.frame_buffer.enabled = 1; - if (!gKernelArgs.fb.already_mapped) { + if (gKernelArgs.frame_buffer.physical_buffer.start == 0) { // the graphics memory has not been mapped yet! struct vbe_mode_info modeInfo; if (vesa_get_mode_info(sMode->mode, &modeInfo) != B_OK) { @@ -329,17 +330,19 @@ platform_switch_to_logo(void) return; } - gKernelArgs.fb.x_size = modeInfo.width; - gKernelArgs.fb.y_size = modeInfo.height; - gKernelArgs.fb.bit_depth = modeInfo.bits_per_pixel; - gKernelArgs.fb.mapping.size = gKernelArgs.fb.x_size * gKernelArgs.fb.y_size * (gKernelArgs.fb.bit_depth/8); - gKernelArgs.fb.mapping.start = mmu_map_physical_memory(modeInfo.physical_base, gKernelArgs.fb.mapping.size, 0x03); - gKernelArgs.fb.already_mapped = 1; + gKernelArgs.frame_buffer.width = modeInfo.width; + gKernelArgs.frame_buffer.height = modeInfo.height; + gKernelArgs.frame_buffer.depth = modeInfo.bits_per_pixel; + gKernelArgs.frame_buffer.physical_buffer.size = gKernelArgs.frame_buffer.width + * gKernelArgs.frame_buffer.height * (gKernelArgs.frame_buffer.depth / 8); + gKernelArgs.frame_buffer.physical_buffer.start = modeInfo.physical_base; + sFrameBuffer = mmu_map_physical_memory(modeInfo.physical_base, + gKernelArgs.frame_buffer.physical_buffer.size, 0x03); // clear the video memory // ToDo: this shouldn't be necessary on real hardware (and Bochs), but // at least booting with Qemu looks ugly when this is missing - memset((void *)gKernelArgs.fb.mapping.start, 0, gKernelArgs.fb.mapping.size); + memset((void *)sFrameBuffer, 0, gKernelArgs.frame_buffer.physical_buffer.size); } if (vesa_set_palette((const uint8 *)kPalette, 0, 256) != B_OK) @@ -358,9 +361,12 @@ platform_switch_to_logo(void) #endif // ToDo: this is a temporary hack! - addr_t start = gKernelArgs.fb.mapping.start + gKernelArgs.fb.x_size * (gKernelArgs.fb.y_size - kHeight - 60) * (gKernelArgs.fb.bit_depth/8) + gKernelArgs.fb.x_size - kWidth - 40; + addr_t start = sFrameBuffer + gKernelArgs.frame_buffer.width + * (gKernelArgs.frame_buffer.height - kHeight - 60) + * (gKernelArgs.frame_buffer.depth/8) + gKernelArgs.frame_buffer.width - kWidth - 40; for (int32 i = 0; i < kHeight; i++) { - memcpy((void *)(start + gKernelArgs.fb.x_size * i), &kImageData[i * kWidth], kWidth); + memcpy((void *)(start + gKernelArgs.frame_buffer.width * i), + &kImageData[i * kWidth], kWidth); } } @@ -368,20 +374,20 @@ platform_switch_to_logo(void) extern "C" void platform_switch_to_text_mode(void) { - if (!gKernelArgs.fb.enabled) + if (!gKernelArgs.frame_buffer.enabled) return; bios_regs regs; regs.eax = 3; call_bios(0x10, ®s); - gKernelArgs.fb.enabled = 0; + gKernelArgs.frame_buffer.enabled = 0; } extern "C" status_t platform_init_video(void) { - gKernelArgs.fb.enabled = 0; + gKernelArgs.frame_buffer.enabled = 0; list_init(&sModeList); sVesaCompatible = vesa_init(&sInfo, &sMode) == B_OK;