From fe3375770eb2b3b09e6a5d24aaf80d7895b5943b Mon Sep 17 00:00:00 2001 From: SuperPrower Date: Thu, 4 Apr 2019 23:46:15 +0300 Subject: [PATCH] intel_extreme.accelerant: create display modes list from VBT using create_display_modes() For cases when EDID is not available but VBT information was retrieved, previous code generated display mode list manually, potentially incorrectly, causing the black screen during boot. This commit fixes this by using a dedicated function, used for the case where EDID is available (or VBT is not available). Fixes #14280. Change-Id: I95cfc5313260f0b9a01a98ba78e300b4383b6e32 Reviewed-on: https://review.haiku-os.org/c/1370 Reviewed-by: waddlesplash --- .../accelerants/intel_extreme/mode.cpp | 36 +++++++------------ 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/src/add-ons/accelerants/intel_extreme/mode.cpp b/src/add-ons/accelerants/intel_extreme/mode.cpp index 4bf08e792a..257ce266ce 100644 --- a/src/add-ons/accelerants/intel_extreme/mode.cpp +++ b/src/add-ons/accelerants/intel_extreme/mode.cpp @@ -315,6 +315,8 @@ set_frame_buffer_base() status_t create_mode_list(void) { + CALLED(); + for (uint32 i = 0; i < gInfo->port_count; i++) { if (gInfo->ports[i] == NULL) continue; @@ -324,37 +326,25 @@ create_mode_list(void) gInfo->has_edid = true; } + display_mode* list; + uint32 count = 0; + // If no EDID, but have vbt from driver, use that mode if (!gInfo->has_edid && gInfo->shared_info->got_vbt) { // We could not read any EDID info. Fallback to creating a list with // only the mode set up by the BIOS. // TODO: support lower modes via scaling and windowing - size_t size = (sizeof(display_mode) + B_PAGE_SIZE - 1) - & ~(B_PAGE_SIZE - 1); - - display_mode* list; - area_id area = create_area("intel extreme modes", - (void**)&list, B_ANY_ADDRESS, size, B_NO_LOCK, - B_READ_AREA | B_WRITE_AREA); - if (area < 0) - return area; - - memcpy(list, &gInfo->shared_info->panel_mode, sizeof(display_mode)); - - gInfo->mode_list_area = area; - gInfo->mode_list = list; - gInfo->shared_info->mode_list_area = gInfo->mode_list_area; - gInfo->shared_info->mode_count = 1; - return B_OK; + gInfo->mode_list_area = create_display_modes("intel extreme modes", + NULL, &gInfo->shared_info->panel_mode, 1, NULL, 0, NULL, + &list, &count); + } else { + // Otherwise return the 'real' list of modes + gInfo->mode_list_area = create_display_modes("intel extreme modes", + gInfo->has_edid ? &gInfo->edid_info : NULL, NULL, 0, NULL, 0, NULL, + &list, &count); } - // Otherwise return the 'real' list of modes - display_mode* list; - uint32 count = 0; - gInfo->mode_list_area = create_display_modes("intel extreme modes", - gInfo->has_edid ? &gInfo->edid_info : NULL, NULL, 0, NULL, 0, NULL, - &list, &count); if (gInfo->mode_list_area < B_OK) return gInfo->mode_list_area;