Author: axeld Date: 2011-07-14 01:28:33 +0200 (Thu, 14 Jul 2011) New Revision: 42421 Changeset: https://dev.haiku-os.org/changeset/42421 Ticket: https://dev.haiku-os.org/ticket/7751 Modified: haiku/trunk/src/add-ons/accelerants/vesa/mode.cpp Log: * 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. Modified: haiku/trunk/src/add-ons/accelerants/vesa/mode.cpp =================================================================== --- haiku/trunk/src/add-ons/accelerants/vesa/mode.cpp 2011-07-13 23:26:26 UTC (rev 42420) +++ haiku/trunk/src/add-ons/accelerants/vesa/mode.cpp 2011-07-13 23:28:33 UTC (rev 42421) @@ -1,11 +1,13 @@ /* - * Copyright 2005-2009, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx + * Copyright 2005-2011, Axel Dörfler, axeld@xxxxxxxxxxxxxxxxx * Distributed under the terms of the MIT License. */ +#include <stdlib.h> #include <string.h> +#include <compute_display_timing.h> #include <create_display_modes.h> #include "accelerant_protos.h" @@ -74,11 +76,29 @@ 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;