From f7d98b0923817ad675be677ea2e42ed706f23ff7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Wed, 13 Jul 2011 23:28:33 +0000 Subject: [PATCH] * The VESA accelerant now always makes sure that all supported resolutions are added to the mode list (in 60 Hz, but that doesn't really matter). * It does this by iterating over the modes found, and computes the display_timings from them using the GTF code. * This should help with one of the problems of ticket #7751. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42421 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/accelerants/vesa/mode.cpp | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/add-ons/accelerants/vesa/mode.cpp b/src/add-ons/accelerants/vesa/mode.cpp index 795c514f78..c269d2f1f8 100644 --- a/src/add-ons/accelerants/vesa/mode.cpp +++ b/src/add-ons/accelerants/vesa/mode.cpp @@ -1,11 +1,13 @@ /* - * Copyright 2005-2009, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2005-2011, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ +#include #include +#include #include #include "accelerant_protos.h" @@ -74,11 +76,29 @@ create_mode_list(void) const color_space kVesaSpaces[] = {B_RGB32_LITTLE, B_RGB24_LITTLE, B_RGB16_LITTLE, B_RGB15_LITTLE, B_CMAP8}; + // Create the initial list from the support mode list + // TODO: filter by monitor timing constraints! + display_mode* initialModes = (display_mode*)malloc( + sizeof(display_mode) * gInfo->shared_info->vesa_mode_count); + if (initialModes != NULL) { + vesa_mode* vesaModes = gInfo->vesa_modes; + + for (uint32 i = gInfo->shared_info->vesa_mode_count; i-- > 0;) { + compute_display_timing(vesaModes[i].width, vesaModes[i].height, 60, + false, &initialModes[i].timing); + fill_display_mode(&initialModes[i]); + } + } + gInfo->mode_list_area = create_display_modes("vesa modes", gInfo->shared_info->has_edid ? &gInfo->shared_info->edid_info : NULL, - NULL, 0, kVesaSpaces, sizeof(kVesaSpaces) / sizeof(kVesaSpaces[0]), + initialModes, gInfo->shared_info->vesa_mode_count, + kVesaSpaces, sizeof(kVesaSpaces) / sizeof(kVesaSpaces[0]), is_mode_supported, &gInfo->mode_list, &gInfo->shared_info->mode_count); - if (gInfo->mode_list_area < B_OK) + + free(initialModes); + + if (gInfo->mode_list_area < 0) return gInfo->mode_list_area; gInfo->shared_info->mode_list_area = gInfo->mode_list_area;