Implemented "fail_safe_video_mode" boot option; if you're using it, the app_server

will not load any graphics driver (other than VESA).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21310 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2007-06-03 20:20:19 +00:00
parent 7d7550a04b
commit b2ed0e7acf
5 changed files with 77 additions and 36 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2004-2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_SAFEMODE_H
@ -17,6 +17,7 @@
#define B_SAFEMODE_DISABLE_ACPI "disable_acpi"
#define B_SAFEMODE_DISABLE_SMP "disable_smp"
#define B_SAFEMODE_DISABLE_HYPER_THREADING "disable_hyperthreading"
#define B_SAFEMODE_FAIL_SAFE_VIDEO_MODE "fail_safe_video_mode"
#ifdef __cplusplus

View File

@ -22,6 +22,8 @@
#include "ServerProtocol.h"
#include "SystemPalette.h"
#include "safemode.h"
#include <Accelerant.h>
#include <Cursor.h>
#include <FindDirectory.h>
@ -47,13 +49,18 @@ using std::nothrow;
#endif
// This call updates the frame buffer used by the on-screen KDL
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
// This call updates the frame buffer used by the on-screen KDL
extern "C" status_t _kern_frame_buffer_update(void *baseAddress,
int32 width, int32 height,
int32 depth, int32 bytesPerRow);
int32 width, int32 height, int32 depth, int32 bytesPerRow);
// This call retrieves the system's safemode options
extern "C" status_t _kern_get_safemode_option(const char* parameter,
char* buffer, size_t* _size);
#endif
const int32 kDefaultParamsCount = 64;
bool
operator==(const display_mode& a, const display_mode& b)
@ -61,9 +68,31 @@ operator==(const display_mode& a, const display_mode& b)
return memcmp(&a, &b, sizeof(display_mode)) == 0;
}
const int32 kDefaultParamsCount = 64;
// constructor
bool
use_fail_safe_video_mode()
{
char buffer[B_FILE_NAME_LENGTH];
size_t size = sizeof(buffer);
status_t status = _kern_get_safemode_option(
B_SAFEMODE_FAIL_SAFE_VIDEO_MODE, buffer, &size);
if (status == B_OK) {
if (!strncasecmp(buffer, "true", size)
|| !strncasecmp(buffer, "yes", size)
|| !strncasecmp(buffer, "on", size)
|| !strncasecmp(buffer, "enabled", size)) {
return true;
}
}
return false;
}
// #pragma mark -
AccelerantHWInterface::AccelerantHWInterface()
: HWInterface(),
fCardFD(-1),
@ -185,35 +214,36 @@ AccelerantHWInterface::_OpenGraphicsDevice(int deviceNumber)
if (!directory)
return -1;
// ToDo: the former R5 "stub" driver is called "vesa" under Haiku; however,
// we do not need to avoid this driver this way when is has been ported
// to the new driver architecture - the special case here can then be
// removed.
int count = 0;
struct dirent *entry;
int device = -1;
char path[PATH_MAX];
while (count < deviceNumber && (entry = readdir(directory)) != NULL) {
if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..") ||
!strcmp(entry->d_name, "stub") || !strcmp(entry->d_name, "vesa"))
continue;
int count = 0;
if (!use_fail_safe_video_mode()) {
// ToDo: the former R5 "stub" driver is called "vesa" under Haiku; however,
// we do not need to avoid this driver this way when is has been ported
// to the new driver architecture - the special case here can then be
// removed.
struct dirent *entry;
char path[PATH_MAX];
while (count < deviceNumber && (entry = readdir(directory)) != NULL) {
if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..") ||
!strcmp(entry->d_name, "stub") || !strcmp(entry->d_name, "vesa"))
continue;
if (device >= 0) {
close(device);
device = -1;
if (device >= 0) {
close(device);
device = -1;
}
sprintf(path, "/dev/graphics/%s", entry->d_name);
device = open(path, B_READ_WRITE);
if (device >= 0)
count++;
}
sprintf(path, "/dev/graphics/%s", entry->d_name);
device = open(path, B_READ_WRITE);
if (device >= 0)
count++;
}
// Open VESA driver if we were not able to get a better one
if (count < deviceNumber) {
if (deviceNumber == 1) {
sprintf(path, "/dev/graphics/vesa");
device = open(path, B_READ_WRITE);
device = open("/dev/graphics/vesa", B_READ_WRITE);
fVGADevice = device;
// store the device, so that we can access the planar blitter
} else {

View File

@ -1,7 +1,7 @@
SubDir HAIKU_TOP src servers app drawing ;
UseLibraryHeaders agg ;
UsePrivateHeaders app graphics interface shared ;
UsePrivateHeaders app graphics kernel interface shared ;
UseHeaders [ FDirName $(HAIKU_TOP) src servers app ] ;
UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter ] ;

View File

@ -1,5 +1,5 @@
/*
* Copyright 2004-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
@ -23,6 +23,11 @@ platform_add_menus(Menu *menu)
item->SetTarget(video_mode_hook);
break;
case SAFE_MODE_MENU:
menu->AddItem(item = new(nothrow) MenuItem("Use fail-safe video mode"));
item->SetType(MENU_ITEM_MARKABLE);
item->SetData(B_SAFEMODE_FAIL_SAFE_VIDEO_MODE);
item->SetHelpText("The system will use VESA mode and won't try to open any video graphics driver");
smp_add_safemode_menus(menu);
menu->AddItem(item = new(nothrow) MenuItem("Don't call the BIOS"));

View File

@ -1,5 +1,5 @@
/*
* Copyright 2004-2006, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Copyright 2004-2007, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
* Distributed under the terms of the MIT License.
*/
@ -73,8 +73,10 @@ print_item_at(int32 line, MenuItem *item, bool clearHelp = true)
if (line < 0 || line >= menu_height())
return;
console_color background = selected ? kSelectedItemBackgroundColor : kItemBackgroundColor;
console_color foreground = selected ? kSelectedItemColor : kItemColor;
console_color background = selected
? kSelectedItemBackgroundColor : kItemBackgroundColor;
console_color foreground = selected
? kSelectedItemColor : kItemColor;
if (!item->IsEnabled())
foreground = kDisabledColor;
@ -199,14 +201,15 @@ draw_menu(Menu *menu)
print_centered(2, "Haiku Boot Loader");
console_set_color(kCopyrightColor, kBackgroundColor);
print_centered(4, "Copyright 2004-2006 Haiku Inc.");
print_centered(4, "Copyright 2004-2007 Haiku Inc.");
if (menu->Title()) {
console_set_cursor(kOffsetX, kFirstLine - 2);
console_set_color(kTitleColor, kTitleBackgroundColor);
printf(" %s", menu->Title());
print_spacing(console_width() - 1 - strlen(menu->Title()) - 2*kOffsetX);
print_spacing(console_width() - 1
- strlen(menu->Title()) - 2 * kOffsetX);
}
MenuItemIterator iterator = menu->ItemIterator();
@ -372,11 +375,13 @@ run_menu(Menu *menu)
break;
case TEXT_CONSOLE_KEY_PAGE_UP:
case TEXT_CONSOLE_KEY_LEFT:
selected = select_previous_valid_item(menu, selected - menu_height() + 1);
selected = select_previous_valid_item(menu,
selected - menu_height() + 1);
break;
case TEXT_CONSOLE_KEY_PAGE_DOWN:
case TEXT_CONSOLE_KEY_RIGHT:
selected = select_next_valid_item(menu, selected + menu_height() - 1);
selected = select_next_valid_item(menu,
selected + menu_height() - 1);
break;
case TEXT_CONSOLE_KEY_HOME:
selected = first_selectable_item(menu);