Remove dumb-framebuffer handling logic from the VESA driver.

This reverts commit a0db7ef272.
This reverts commit 40cdf7d607.
This reverts commit 2ff22d6734.
This reverts commit b9eacd390d.
This partially reverts commit 5ae7ac5fd9.

This was all added in the run-up to the removal of the framebuffer driver,
or was added since then to enhance framebuffer-only support in that driver.

Change-Id: I32ab8199f22cf6846545ae19e943c98012b2a1d0
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4615
Reviewed-by: waddlesplash <[email protected]>
This commit is contained in:
Augustin Cavalier
2021-10-20 17:12:21 +00:00
committed by waddlesplash
parent f7bd3509e3
commit 66415cd209
6 changed files with 25 additions and 82 deletions
+5 -3
View File
@@ -143,7 +143,8 @@ SYSTEM_NETWORK_PROTOCOLS =
; ;
SYSTEM_ADD_ONS_ACCELERANTS = [ FFilterByBuildFeatures SYSTEM_ADD_ONS_ACCELERANTS = [ FFilterByBuildFeatures
x86,x86_64,riscv64 @{ framebuffer.accelerant
x86,x86_64 @{
vesa.accelerant vesa.accelerant
}@ # x86,x86_64,riscv64 }@ # x86,x86_64,riscv64
riscv64 @{ riscv64 @{
@@ -174,9 +175,10 @@ SYSTEM_ADD_ONS_DRIVERS_AUDIO = ;
SYSTEM_ADD_ONS_DRIVERS_AUDIO_OLD = ; SYSTEM_ADD_ONS_DRIVERS_AUDIO_OLD = ;
SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = [ FFilterByBuildFeatures SYSTEM_ADD_ONS_DRIVERS_GRAPHICS = [ FFilterByBuildFeatures
x86,x86_64,riscv64 @{ framebuffer
x86,x86_64 @{
vesa vesa
}@ # x86,x86_64,riscv64 }@ # x86,x86_64
riscv64 @{ riscv64 @{
radeon_hd radeon_hd
}@ # riscv64 }@ # riscv64
+5 -16
View File
@@ -1,6 +1,5 @@
/* /*
* 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.
*/ */
@@ -67,11 +66,8 @@ init_common(int device, bool isClone)
if (status < B_OK) if (status < B_OK)
return status; return status;
if (gInfo->shared_info->vesa_mode_count == 0) gInfo->vesa_modes = (vesa_mode *)((uint8 *)gInfo->shared_info
gInfo->vesa_modes = NULL; + gInfo->shared_info->vesa_mode_offset);
else
gInfo->vesa_modes = (vesa_mode *)((uint8 *)gInfo->shared_info
+ gInfo->shared_info->vesa_mode_offset);
infoDeleter.Detach(); infoDeleter.Detach();
sharedDeleter.Detach(); sharedDeleter.Detach();
@@ -191,16 +187,9 @@ status_t
vesa_get_accelerant_device_info(accelerant_device_info *info) vesa_get_accelerant_device_info(accelerant_device_info *info)
{ {
info->version = B_ACCELERANT_VERSION; info->version = B_ACCELERANT_VERSION;
strcpy(info->name, "VESA Driver");
// TODO: provide some more insight here... strcpy(info->chipset, "VESA");
if (gInfo->vesa_modes != NULL) { // ToDo: provide some more insight here...
strcpy(info->name, "VESA driver");
strcpy(info->chipset, "VESA");
} else {
strcpy(info->name, "Framebuffer");
strcpy(info->chipset, "");
}
strcpy(info->serial_no, "None"); strcpy(info->serial_no, "None");
#if 0 #if 0
+4 -42
View File
@@ -53,16 +53,6 @@ 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 &current = 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
@@ -85,20 +75,12 @@ 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 = NULL; display_mode* initialModes = (display_mode*)malloc(
if (vesaAvailable) { sizeof(display_mode) * gInfo->shared_info->vesa_mode_count);
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;
@@ -109,28 +91,12 @@ 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;
display_mode &mode = gInfo->shared_info->current_mode;
compute_display_timing(mode.virtual_width, mode.virtual_height,
60, false, &initialModes[0].timing);
fill_display_mode(mode.virtual_width, mode.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, colorSpaces, colorSpaceCount, initialModes, initialModesCount,
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);
@@ -197,10 +163,6 @@ 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_UNSUPPORTED;
// 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
@@ -166,7 +166,7 @@ framebuffer_init(framebuffer_info& info)
info.shared_area = create_area("framebuffer shared info", info.shared_area = create_area("framebuffer shared info",
(void**)&info.shared_info, B_ANY_KERNEL_ADDRESS, (void**)&info.shared_info, B_ANY_KERNEL_ADDRESS,
ROUND_TO_PAGE_SIZE(sharedSize), B_FULL_LOCK, ROUND_TO_PAGE_SIZE(sharedSize), B_FULL_LOCK,
B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_USER_CLONEABLE_AREA); B_KERNEL_READ_AREA | B_KERNEL_WRITE_AREA | B_CLONEABLE_AREA);
if (info.shared_area < 0) if (info.shared_area < 0)
return info.shared_area; return info.shared_area;
@@ -53,7 +53,12 @@ init_hardware(void)
{ {
TRACE((DEVICE_NAME ": init_hardware()\n")); TRACE((DEVICE_NAME ": init_hardware()\n"));
return get_boot_item(FRAME_BUFFER_BOOT_INFO, NULL) != NULL ? B_OK : B_ERROR; // If we don't have the VESA mode info, then we have a
// 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;
} }
@@ -289,13 +289,7 @@ remap_frame_buffer(vesa_info& info, addr_t physicalBase, uint32 width,
if (!info.complete_frame_buffer_mapped) { if (!info.complete_frame_buffer_mapped) {
addr_t base = physicalBase; addr_t base = physicalBase;
size_t size = bytesPerRow * height; size_t size = bytesPerRow * height;
#ifdef __riscv
// HACK: Prevent NULL framebuffer pointers from getting to userland
bool remap = true;
#else
bool remap = !initializing; bool remap = !initializing;
#endif
if (info.physical_frame_buffer_size != 0) { if (info.physical_frame_buffer_size != 0) {
// we can map the complete frame buffer // we can map the complete frame buffer
@@ -408,12 +402,10 @@ vesa_init(vesa_info& info)
memcpy(&sharedInfo.edid_info, edidInfo, sizeof(edid1_info)); memcpy(&sharedInfo.edid_info, edidInfo, sizeof(edid1_info));
} }
if (modes != NULL) { vbe_get_dpms_capabilities(info.vbe_dpms_capabilities,
vbe_get_dpms_capabilities(info.vbe_dpms_capabilities, sharedInfo.dpms_capabilities);
sharedInfo.dpms_capabilities); if (bufferInfo->depth <= 8)
if (bufferInfo->depth <= 8) vbe_set_bits_per_gun(info, 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;
@@ -465,7 +457,6 @@ vesa_set_display_mode(vesa_info& info, uint32 mode)
status = remap_frame_buffer(info, modeInfo.physical_base, modeInfo.width, status = remap_frame_buffer(info, modeInfo.physical_base, modeInfo.width,
modeInfo.height, modeInfo.bits_per_pixel, modeInfo.bytes_per_row, modeInfo.height, modeInfo.bits_per_pixel, modeInfo.bytes_per_row,
false); false);
if (status == B_OK) { if (status == B_OK) {
// Update shared frame buffer information // Update shared frame buffer information
info.shared_info->current_mode.virtual_width = modeInfo.width; info.shared_info->current_mode.virtual_width = modeInfo.width;
@@ -486,9 +477,6 @@ 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);
@@ -526,9 +514,6 @@ 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;