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:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2004-2005, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2004-2007, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _KERNEL_SAFEMODE_H
|
#ifndef _KERNEL_SAFEMODE_H
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
#define B_SAFEMODE_DISABLE_ACPI "disable_acpi"
|
#define B_SAFEMODE_DISABLE_ACPI "disable_acpi"
|
||||||
#define B_SAFEMODE_DISABLE_SMP "disable_smp"
|
#define B_SAFEMODE_DISABLE_SMP "disable_smp"
|
||||||
#define B_SAFEMODE_DISABLE_HYPER_THREADING "disable_hyperthreading"
|
#define B_SAFEMODE_DISABLE_HYPER_THREADING "disable_hyperthreading"
|
||||||
|
#define B_SAFEMODE_FAIL_SAFE_VIDEO_MODE "fail_safe_video_mode"
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
#include "ServerProtocol.h"
|
#include "ServerProtocol.h"
|
||||||
#include "SystemPalette.h"
|
#include "SystemPalette.h"
|
||||||
|
|
||||||
|
#include "safemode.h"
|
||||||
|
|
||||||
#include <Accelerant.h>
|
#include <Accelerant.h>
|
||||||
#include <Cursor.h>
|
#include <Cursor.h>
|
||||||
#include <FindDirectory.h>
|
#include <FindDirectory.h>
|
||||||
@@ -47,13 +49,18 @@ using std::nothrow;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
// This call updates the frame buffer used by the on-screen KDL
|
|
||||||
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
|
#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,
|
extern "C" status_t _kern_frame_buffer_update(void *baseAddress,
|
||||||
int32 width, int32 height,
|
int32 width, int32 height, int32 depth, int32 bytesPerRow);
|
||||||
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
|
#endif
|
||||||
|
|
||||||
|
const int32 kDefaultParamsCount = 64;
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
operator==(const display_mode& a, const display_mode& b)
|
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;
|
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()
|
AccelerantHWInterface::AccelerantHWInterface()
|
||||||
: HWInterface(),
|
: HWInterface(),
|
||||||
fCardFD(-1),
|
fCardFD(-1),
|
||||||
@@ -185,35 +214,36 @@ AccelerantHWInterface::_OpenGraphicsDevice(int deviceNumber)
|
|||||||
if (!directory)
|
if (!directory)
|
||||||
return -1;
|
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;
|
int device = -1;
|
||||||
char path[PATH_MAX];
|
int count = 0;
|
||||||
while (count < deviceNumber && (entry = readdir(directory)) != NULL) {
|
if (!use_fail_safe_video_mode()) {
|
||||||
if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..") ||
|
// ToDo: the former R5 "stub" driver is called "vesa" under Haiku; however,
|
||||||
!strcmp(entry->d_name, "stub") || !strcmp(entry->d_name, "vesa"))
|
// we do not need to avoid this driver this way when is has been ported
|
||||||
continue;
|
// 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) {
|
if (device >= 0) {
|
||||||
close(device);
|
close(device);
|
||||||
device = -1;
|
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
|
// Open VESA driver if we were not able to get a better one
|
||||||
if (count < deviceNumber) {
|
if (count < deviceNumber) {
|
||||||
if (deviceNumber == 1) {
|
if (deviceNumber == 1) {
|
||||||
sprintf(path, "/dev/graphics/vesa");
|
device = open("/dev/graphics/vesa", B_READ_WRITE);
|
||||||
device = open(path, B_READ_WRITE);
|
|
||||||
fVGADevice = device;
|
fVGADevice = device;
|
||||||
// store the device, so that we can access the planar blitter
|
// store the device, so that we can access the planar blitter
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
SubDir HAIKU_TOP src servers app drawing ;
|
SubDir HAIKU_TOP src servers app drawing ;
|
||||||
|
|
||||||
UseLibraryHeaders agg ;
|
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 ] ;
|
||||||
UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter ] ;
|
UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing Painter ] ;
|
||||||
|
|||||||
@@ -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.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -23,6 +23,11 @@ platform_add_menus(Menu *menu)
|
|||||||
item->SetTarget(video_mode_hook);
|
item->SetTarget(video_mode_hook);
|
||||||
break;
|
break;
|
||||||
case SAFE_MODE_MENU:
|
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);
|
smp_add_safemode_menus(menu);
|
||||||
|
|
||||||
menu->AddItem(item = new(nothrow) MenuItem("Don't call the BIOS"));
|
menu->AddItem(item = new(nothrow) MenuItem("Don't call the BIOS"));
|
||||||
|
|||||||
@@ -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.
|
* 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())
|
if (line < 0 || line >= menu_height())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
console_color background = selected ? kSelectedItemBackgroundColor : kItemBackgroundColor;
|
console_color background = selected
|
||||||
console_color foreground = selected ? kSelectedItemColor : kItemColor;
|
? kSelectedItemBackgroundColor : kItemBackgroundColor;
|
||||||
|
console_color foreground = selected
|
||||||
|
? kSelectedItemColor : kItemColor;
|
||||||
|
|
||||||
if (!item->IsEnabled())
|
if (!item->IsEnabled())
|
||||||
foreground = kDisabledColor;
|
foreground = kDisabledColor;
|
||||||
@@ -199,14 +201,15 @@ draw_menu(Menu *menu)
|
|||||||
print_centered(2, "Haiku Boot Loader");
|
print_centered(2, "Haiku Boot Loader");
|
||||||
|
|
||||||
console_set_color(kCopyrightColor, kBackgroundColor);
|
console_set_color(kCopyrightColor, kBackgroundColor);
|
||||||
print_centered(4, "Copyright 2004-2006 Haiku Inc.");
|
print_centered(4, "Copyright 2004-2007 Haiku Inc.");
|
||||||
|
|
||||||
if (menu->Title()) {
|
if (menu->Title()) {
|
||||||
console_set_cursor(kOffsetX, kFirstLine - 2);
|
console_set_cursor(kOffsetX, kFirstLine - 2);
|
||||||
console_set_color(kTitleColor, kTitleBackgroundColor);
|
console_set_color(kTitleColor, kTitleBackgroundColor);
|
||||||
|
|
||||||
printf(" %s", menu->Title());
|
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();
|
MenuItemIterator iterator = menu->ItemIterator();
|
||||||
@@ -372,11 +375,13 @@ run_menu(Menu *menu)
|
|||||||
break;
|
break;
|
||||||
case TEXT_CONSOLE_KEY_PAGE_UP:
|
case TEXT_CONSOLE_KEY_PAGE_UP:
|
||||||
case TEXT_CONSOLE_KEY_LEFT:
|
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;
|
break;
|
||||||
case TEXT_CONSOLE_KEY_PAGE_DOWN:
|
case TEXT_CONSOLE_KEY_PAGE_DOWN:
|
||||||
case TEXT_CONSOLE_KEY_RIGHT:
|
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;
|
break;
|
||||||
case TEXT_CONSOLE_KEY_HOME:
|
case TEXT_CONSOLE_KEY_HOME:
|
||||||
selected = first_selectable_item(menu);
|
selected = first_selectable_item(menu);
|
||||||
|
|||||||
Reference in New Issue
Block a user