From e0c25f9892404842a8457561bc9bc67a82e366b6 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 20 Aug 2016 15:14:51 +0200 Subject: [PATCH] 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 --- src/add-ons/accelerants/vesa/accelerant.cpp | 1 + src/add-ons/accelerants/vesa/accelerant.h | 1 + src/add-ons/accelerants/vesa/mode.cpp | 14 ++++++-------- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/add-ons/accelerants/vesa/accelerant.cpp b/src/add-ons/accelerants/vesa/accelerant.cpp index 77875efd37..886d249657 100644 --- a/src/add-ons/accelerants/vesa/accelerant.cpp +++ b/src/add-ons/accelerants/vesa/accelerant.cpp @@ -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 diff --git a/src/add-ons/accelerants/vesa/accelerant.h b/src/add-ons/accelerants/vesa/accelerant.h index 51bf68cd40..a820d1c4af 100644 --- a/src/add-ons/accelerants/vesa/accelerant.h +++ b/src/add-ons/accelerants/vesa/accelerant.h @@ -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; diff --git a/src/add-ons/accelerants/vesa/mode.cpp b/src/add-ons/accelerants/vesa/mode.cpp index 054fc0368f..8dedbcd6fa 100644 --- a/src/add-ons/accelerants/vesa/mode.cpp +++ b/src/add-ons/accelerants/vesa/mode.cpp @@ -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; } }