vesa: fold framebuffer driver into vesa driver.
* The app_server isn't designed to support two fallback drivers, so on systems using UEFI to boot, the framebuffer driver will often win when other drivers would likely work on those systems.
This commit is contained in:
@@ -144,7 +144,7 @@ SYSTEM_NETWORK_PROTOCOLS =
|
|||||||
|
|
||||||
SYSTEM_ADD_ONS_ACCELERANTS = [ FFilterByBuildFeatures
|
SYSTEM_ADD_ONS_ACCELERANTS = [ FFilterByBuildFeatures
|
||||||
x86,x86_64 @{
|
x86,x86_64 @{
|
||||||
framebuffer.accelerant vesa.accelerant
|
vesa.accelerant
|
||||||
}@ # x86,x86_64
|
}@ # x86,x86_64
|
||||||
] ;
|
] ;
|
||||||
|
|
||||||
@@ -172,7 +172,7 @@ SYSTEM_ADD_ONS_DRIVERS_AUDIO_OLD = ;
|
|||||||
|
|
||||||
SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = [ FFilterByBuildFeatures
|
SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = [ FFilterByBuildFeatures
|
||||||
x86,x86_64 @{
|
x86,x86_64 @{
|
||||||
framebuffer vesa
|
vesa
|
||||||
}@ # x86,x86_64
|
}@ # x86,x86_64
|
||||||
] ;
|
] ;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2008, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2005-2008, Axel Dörfler, [email protected]. All rights reserved.
|
||||||
|
* Copyright 2016-207, Jessica Hamilton, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -111,8 +112,11 @@ init_common(int device, bool isClone)
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
gInfo->vesa_modes = (vesa_mode *)((uint8 *)gInfo->shared_info
|
if (gInfo->shared_info->vesa_mode_count == 0)
|
||||||
+ gInfo->shared_info->vesa_mode_offset);
|
gInfo->vesa_modes = NULL;
|
||||||
|
else
|
||||||
|
gInfo->vesa_modes = (vesa_mode *)((uint8 *)gInfo->shared_info
|
||||||
|
+ gInfo->shared_info->vesa_mode_offset);
|
||||||
|
|
||||||
sharedCloner.Keep();
|
sharedCloner.Keep();
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -53,6 +53,16 @@ is_mode_supported(display_mode* mode)
|
|||||||
{
|
{
|
||||||
vesa_mode* modes = gInfo->vesa_modes;
|
vesa_mode* modes = gInfo->vesa_modes;
|
||||||
|
|
||||||
|
if (modes == NULL) {
|
||||||
|
// we're a UEFI framebuffer, just confirm it's our current mode
|
||||||
|
const display_mode ¤t = gInfo->shared_info->current_mode;
|
||||||
|
return mode->virtual_width == current.virtual_width
|
||||||
|
&& mode->virtual_height == current.virtual_height
|
||||||
|
&& mode->h_display_start == current.h_display_start
|
||||||
|
&& mode->v_display_start == current.v_display_start
|
||||||
|
&& mode->space == current.space;
|
||||||
|
}
|
||||||
|
|
||||||
for (uint32 i = gInfo->shared_info->vesa_mode_count; i-- > 0;) {
|
for (uint32 i = gInfo->shared_info->vesa_mode_count; i-- > 0;) {
|
||||||
// search mode in VESA mode list
|
// search mode in VESA mode list
|
||||||
// TODO: list is ordered, we could use binary search
|
// TODO: list is ordered, we could use binary search
|
||||||
@@ -75,12 +85,20 @@ create_mode_list(void)
|
|||||||
{
|
{
|
||||||
const color_space kVesaSpaces[] = {B_RGB32_LITTLE, B_RGB24_LITTLE,
|
const color_space kVesaSpaces[] = {B_RGB32_LITTLE, B_RGB24_LITTLE,
|
||||||
B_RGB16_LITTLE, B_RGB15_LITTLE, B_CMAP8};
|
B_RGB16_LITTLE, B_RGB15_LITTLE, B_CMAP8};
|
||||||
|
const color_space kUefiSpaces[] = {
|
||||||
|
(color_space)gInfo->shared_info->current_mode.space
|
||||||
|
};
|
||||||
|
|
||||||
uint32 initialModesCount = 0;
|
uint32 initialModesCount = 0;
|
||||||
|
bool vesaAvailable = gInfo->vesa_modes != NULL;
|
||||||
|
|
||||||
// Add initial VESA modes.
|
// Add initial VESA modes.
|
||||||
display_mode* initialModes = (display_mode*)malloc(
|
display_mode* initialModes = NULL;
|
||||||
sizeof(display_mode) * gInfo->shared_info->vesa_mode_count);
|
if (vesaAvailable) {
|
||||||
|
initialModes = (display_mode*)malloc(
|
||||||
|
sizeof(display_mode) * gInfo->shared_info->vesa_mode_count);
|
||||||
|
}
|
||||||
|
|
||||||
if (initialModes != NULL) {
|
if (initialModes != NULL) {
|
||||||
initialModesCount = gInfo->shared_info->vesa_mode_count;
|
initialModesCount = gInfo->shared_info->vesa_mode_count;
|
||||||
vesa_mode* vesaModes = gInfo->vesa_modes;
|
vesa_mode* vesaModes = gInfo->vesa_modes;
|
||||||
@@ -91,12 +109,27 @@ create_mode_list(void)
|
|||||||
fill_display_mode(vesaModes[i].width, vesaModes[i].height,
|
fill_display_mode(vesaModes[i].width, vesaModes[i].height,
|
||||||
&initialModes[i]);
|
&initialModes[i]);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
// UEFI doesn't give us any VESA modes
|
||||||
|
initialModes = (display_mode*)malloc(sizeof(display_mode));
|
||||||
|
if (initialModes != NULL) {
|
||||||
|
initialModesCount = 1;
|
||||||
|
|
||||||
|
compute_display_timing(initialModes[0].virtual_width,
|
||||||
|
initialModes[0].virtual_height, 60, false,
|
||||||
|
&initialModes[0].timing);
|
||||||
|
fill_display_mode(initialModes[0].virtual_width,
|
||||||
|
initialModes[0].virtual_height, &initialModes[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const color_space *colorSpaces = vesaAvailable ? kVesaSpaces : kUefiSpaces;
|
||||||
|
size_t colorSpaceCount = vesaAvailable ?
|
||||||
|
sizeof(kVesaSpaces) / sizeof(kVesaSpaces[0]) : 1;
|
||||||
|
|
||||||
gInfo->mode_list_area = create_display_modes("vesa modes",
|
gInfo->mode_list_area = create_display_modes("vesa modes",
|
||||||
gInfo->shared_info->has_edid ? &gInfo->shared_info->edid_info : NULL,
|
gInfo->shared_info->has_edid ? &gInfo->shared_info->edid_info : NULL,
|
||||||
initialModes, initialModesCount,
|
initialModes, initialModesCount, colorSpaces, colorSpaceCount,
|
||||||
kVesaSpaces, sizeof(kVesaSpaces) / sizeof(kVesaSpaces[0]),
|
|
||||||
is_mode_supported, &gInfo->mode_list, &gInfo->shared_info->mode_count);
|
is_mode_supported, &gInfo->mode_list, &gInfo->shared_info->mode_count);
|
||||||
|
|
||||||
free(initialModes);
|
free(initialModes);
|
||||||
@@ -163,6 +196,10 @@ vesa_set_display_mode(display_mode* _mode)
|
|||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
vesa_mode* modes = gInfo->vesa_modes;
|
vesa_mode* modes = gInfo->vesa_modes;
|
||||||
|
if (modes == NULL)
|
||||||
|
return B_BAD_VALUE;
|
||||||
|
// UEFI has no VESA modes
|
||||||
|
|
||||||
for (uint32 i = gInfo->shared_info->vesa_mode_count; i-- > 0;) {
|
for (uint32 i = gInfo->shared_info->vesa_mode_count; i-- > 0;) {
|
||||||
// search mode in VESA mode list
|
// search mode in VESA mode list
|
||||||
// TODO: list is ordered, we could use binary search
|
// TODO: list is ordered, we could use binary search
|
||||||
|
|||||||
@@ -53,12 +53,7 @@ init_hardware(void)
|
|||||||
{
|
{
|
||||||
TRACE((DEVICE_NAME ": init_hardware()\n"));
|
TRACE((DEVICE_NAME ": init_hardware()\n"));
|
||||||
|
|
||||||
// If we don't have the VESA mode info, then we have a
|
return get_boot_item(FRAME_BUFFER_BOOT_INFO, NULL) != NULL ? B_OK : B_ERROR;
|
||||||
// dumb framebuffer, in which case we bail, and leave it
|
|
||||||
// up to the framebuffer driver to handle.
|
|
||||||
return (get_boot_item(VESA_MODES_BOOT_INFO, NULL) != NULL
|
|
||||||
&& get_boot_item(FRAME_BUFFER_BOOT_INFO, NULL) != NULL)
|
|
||||||
? B_OK : B_ERROR;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -402,10 +402,12 @@ vesa_init(vesa_info& info)
|
|||||||
memcpy(&sharedInfo.edid_info, edidInfo, sizeof(edid1_info));
|
memcpy(&sharedInfo.edid_info, edidInfo, sizeof(edid1_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
vbe_get_dpms_capabilities(info.vbe_dpms_capabilities,
|
if (modes != NULL) {
|
||||||
sharedInfo.dpms_capabilities);
|
vbe_get_dpms_capabilities(info.vbe_dpms_capabilities,
|
||||||
if (bufferInfo->depth <= 8)
|
sharedInfo.dpms_capabilities);
|
||||||
vbe_set_bits_per_gun(info, 8);
|
if (bufferInfo->depth <= 8)
|
||||||
|
vbe_set_bits_per_gun(info, 8);
|
||||||
|
}
|
||||||
|
|
||||||
dprintf(DEVICE_NAME ": vesa_init() completed successfully!\n");
|
dprintf(DEVICE_NAME ": vesa_init() completed successfully!\n");
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -477,6 +479,9 @@ vesa_get_dpms_mode(vesa_info& info, uint32& mode)
|
|||||||
mode = B_DPMS_ON;
|
mode = B_DPMS_ON;
|
||||||
// we always return a valid mode
|
// we always return a valid mode
|
||||||
|
|
||||||
|
if (info.modes == NULL)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
// Prepare BIOS environment
|
// Prepare BIOS environment
|
||||||
bios_state* state;
|
bios_state* state;
|
||||||
status_t status = vbe_call_prepare(&state);
|
status_t status = vbe_call_prepare(&state);
|
||||||
@@ -514,6 +519,9 @@ out:
|
|||||||
status_t
|
status_t
|
||||||
vesa_set_dpms_mode(vesa_info& info, uint32 mode)
|
vesa_set_dpms_mode(vesa_info& info, uint32 mode)
|
||||||
{
|
{
|
||||||
|
if (info.modes == NULL)
|
||||||
|
return B_ERROR;
|
||||||
|
|
||||||
// Only let supported modes through
|
// Only let supported modes through
|
||||||
mode &= info.shared_info->dpms_capabilities;
|
mode &= info.shared_info->dpms_capabilities;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user