VESA: compare modes by index, instead of contents

We only compared the height, width, and depth of modes to decide if the
mode was already set. However, at boot, we may have these settings right
and other things not properly configured, preventing VESA to set a
working mode unless forced from the boot menu.

Fixes #12918
This commit is contained in:
Adrien Destugues
2016-08-20 16:37:13 +02:00
parent 928f78f5a3
commit e0c25f9892
3 changed files with 8 additions and 8 deletions
@@ -90,6 +90,7 @@ init_common(int device, bool isClone)
gInfo->is_clone = isClone;
gInfo->device = device;
gInfo->current_mode = UINT16_MAX;
// get basic info from driver
@@ -19,6 +19,7 @@ typedef struct accelerant_info {
area_id mode_list_area;
// cloned list of standard display modes
display_mode *mode_list;
uint16 current_mode;
vesa_mode *vesa_modes;
} accelerant_info;
+6 -8
View File
@@ -162,13 +162,6 @@ vesa_set_display_mode(display_mode* _mode)
if (vesa_propose_display_mode(&mode, &mode, &mode) != B_OK)
return B_BAD_VALUE;
if (gInfo->shared_info->current_mode.virtual_width == mode.virtual_width
&& gInfo->shared_info->current_mode.virtual_height
== mode.virtual_height
&& gInfo->shared_info->current_mode.space == mode.space) {
return B_OK;
}
vesa_mode* modes = gInfo->vesa_modes;
for (uint32 i = gInfo->shared_info->vesa_mode_count; i-- > 0;) {
// search mode in VESA mode list
@@ -177,7 +170,12 @@ vesa_set_display_mode(display_mode* _mode)
&& modes[i].height == mode.virtual_height
&& get_color_space_for_depth(modes[i].bits_per_pixel)
== mode.space) {
return ioctl(gInfo->device, VESA_SET_DISPLAY_MODE, &i, sizeof(i));
if (gInfo->current_mode == i)
return B_OK;
status_t result = ioctl(gInfo->device, VESA_SET_DISPLAY_MODE, &i, sizeof(i));
if (result == B_OK)
gInfo->current_mode = i;
return result;
}
}