Ticket #6105: 0004-OpenFirmware-Add-frame-buffer-support.2.patch
File 0004-OpenFirmware-Add-frame-buffer-support.2.patch, 4.4 KB (added by , 14 years ago) |
---|
-
src/system/boot/platform/openfirmware/Jamfile
From 85ffb73ec345d7f66db9be6771806ce9c1bb51b0 Mon Sep 17 00:00:00 2001 From: Andreas Faerber <andreas.faerber@web.de> Date: Tue, 1 Jun 2010 19:15:59 +0200 Subject: [PATCH 4/7] OpenFirmware: Add frame buffer support --- src/system/boot/platform/openfirmware/Jamfile | 12 +++- src/system/boot/platform/openfirmware/video.cpp | 77 ++++++++++++++++++++++- 2 files changed, 84 insertions(+), 5 deletions(-) diff --git a/src/system/boot/platform/openfirmware/Jamfile b/src/system/boot/platform/openfirmware/Jamfile index 00c2b6d..bf3785c 100644
a b SubDir HAIKU_TOP src system boot platform openfirmware ; 2 2 3 3 SubDirC++Flags -D_BOOT_MODE -fno-rtti ; 4 4 5 local genericPlatformSources = 6 text_menu.cpp 7 video_blit.cpp 8 video_splash.cpp 9 video_rle.cpp 10 ; 11 5 12 KernelMergeObject boot_platform_openfirmware.o : 6 13 console.cpp 7 14 debug.c … … KernelMergeObject boot_platform_openfirmware.o : 19 26 openfirmware.cpp 20 27 openfirmware_devices.cpp 21 28 22 # generic 23 text_menu.cpp 29 $(genericPlatformSources) 24 30 : 25 31 : boot_platform_openfirmware_$(TARGET_ARCH).a 26 32 ; 27 33 28 SEARCH on [ FGristFiles text_menu.cpp]34 SEARCH on [ FGristFiles $(genericPlatformSources) ] 29 35 = [ FDirName $(HAIKU_TOP) src system boot platform generic ] ; 30 36 SEARCH on [ FGristFiles openfirmware.cpp openfirmware_devices.cpp ] 31 37 = [ FDirName $(HAIKU_TOP) src system kernel platform openfirmware ] ; -
src/system/boot/platform/openfirmware/video.cpp
diff --git a/src/system/boot/platform/openfirmware/video.cpp b/src/system/boot/platform/openfirmware/video.cpp index a2ff181..4b7575f 100644
a b 1 1 /* 2 2 * Copyright 2004, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 3 * Copyright 2010, Andreas Färber <andreas.faerber@web.de> 3 4 * Distributed under the terms of the MIT License. 4 5 */ 5 6 6 7 7 8 #include <boot/stage2.h> 8 9 #include <boot/platform.h> 10 #include <boot/platform/generic/video.h> 11 #include <platform/openfirmware/openfirmware.h> 12 13 14 static int sScreen; 15 16 17 void 18 platform_blit4(addr_t frameBuffer, const uint8 *data, 19 uint16 width, uint16 height, uint16 imageWidth, uint16 left, uint16 top) 20 { 21 if (!data) 22 return; 23 // TODO 24 } 25 26 27 extern "C" void 28 platform_set_palette(const uint8 *palette) 29 { 30 switch (gKernelArgs.frame_buffer.depth) { 31 case 8: 32 if (of_call_method(sScreen, "set-colors", 3, 0, 33 256, 0, palette) == OF_FAILED) { 34 for (int index = 0; index < 256; index++) { 35 of_call_method(sScreen, "color!", 4, 0, index, 36 palette[index * 3 + 2], 37 palette[index * 3 + 1], 38 palette[index * 3 + 0]); 39 } 40 } 41 break; 42 default: 43 break; 44 } 45 } 9 46 10 47 11 48 extern "C" void … … platform_switch_to_logo(void) 15 52 if ((platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) != 0) 16 53 return; 17 54 18 // ToDo: implement me 55 sScreen = of_open("screen"); 56 if (sScreen == OF_FAILED) 57 return; 58 int package = of_instance_to_package(sScreen); 59 if (package == OF_FAILED) 60 return; 61 int width, height; 62 if (of_call_method(sScreen, "dimensions", 0, 2, &height, &width) 63 == OF_FAILED) { 64 if (of_getprop(package, "width", &width, sizeof(int)) == OF_FAILED) 65 return; 66 if (of_getprop(package, "height", &height, sizeof(int)) == OF_FAILED) 67 return; 68 } 69 int depth; 70 if (of_getprop(package, "depth", &depth, sizeof(int)) == OF_FAILED) 71 return; 72 int lineBytes; 73 if (of_getprop(package, "linebytes", &lineBytes, sizeof(int)) 74 == OF_FAILED) 75 return; 76 uint32 address; // always 32 bit 77 if (of_getprop(package, "address", &address, sizeof(uint32)) == OF_FAILED) 78 return; 79 gKernelArgs.frame_buffer.physical_buffer.start = address; 80 gKernelArgs.frame_buffer.physical_buffer.size = lineBytes * height; 81 gKernelArgs.frame_buffer.width = width; 82 gKernelArgs.frame_buffer.height = height; 83 gKernelArgs.frame_buffer.depth = depth; 84 gKernelArgs.frame_buffer.bytes_per_row = lineBytes; 85 86 dprintf("video mode: %ux%ux%u\n", gKernelArgs.frame_buffer.width, 87 gKernelArgs.frame_buffer.height, gKernelArgs.frame_buffer.depth); 88 89 gKernelArgs.frame_buffer.enabled = true; 90 91 // the memory will be identity-mapped already 92 video_display_splash(gKernelArgs.frame_buffer.physical_buffer.start); 19 93 } 20 94 21 95 … … platform_init_video(void) 34 108 { 35 109 gKernelArgs.frame_buffer.enabled = 0; 36 110 37 // ToDo: implement me38 111 return B_OK; 39 112 } 40 113