From 68cdc8a1fa6e22c17922ebdb64b6b99de57f9761 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Mon, 29 May 2006 12:21:04 +0000 Subject: [PATCH] * Somehow it occurs to me that I shouldn't delete the area of additional graphics memory even before use (this fixes the sudden but visually appealing crash you got when you needed to use that memory ;-)). * Made the additional graphics memory contiguous which shouldn't be strictly necessary, but shouldn't harm either: when an overlay is spread over the BIOS allocated memory and the additional memory, there were some visual problems when the overlay was shown on screen. Might need to investigate that a bit more. * Added a boolean option "ignore_bios_allocated_memory" to the settings. * Reverted stippi's accidental changes. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17628 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../graphics/intel_extreme/intel_extreme.cpp | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp index 0b454a9b90..9960242b4a 100644 --- a/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp +++ b/src/add-ons/kernel/drivers/graphics/intel_extreme/intel_extreme.cpp @@ -93,20 +93,25 @@ init_overlay_registers(overlay_registers *registers) static void -read_settings(size_t &memorySize, bool &hardwareCursor) +read_settings(size_t &memorySize, bool &hardwareCursor, bool &ignoreAllocated) { size_t size = 8; // 8 MB hardwareCursor = true; + ignoreAllocated = false; void *settings = load_driver_settings("intel_extreme"); if (settings != NULL) { size_t specified = 0; - const char *string = get_driver_parameter(settings, "graphics_memory_size", "0", "0"); + const char *string = get_driver_parameter(settings, + "graphics_memory_size", "0", "0"); if (string != NULL) specified = atoi(string); - hardwareCursor = get_driver_boolean_parameter(settings, "hardware_cursor", - true, true); + hardwareCursor = get_driver_boolean_parameter(settings, + "hardware_cursor", true, true); + + ignoreAllocated = get_driver_boolean_parameter(settings, + "ignore_bios_allocated_memory", false, false); unload_driver_settings(settings); @@ -129,7 +134,6 @@ read_settings(size_t &memorySize, bool &hardwareCursor) static size_t determine_stolen_memory_size(intel_info &info) { -#if 0 // read stolen memory from the PCI configuration of the PCI bridge uint16 memoryConfig = gPCI->read_pci_config(0, 0, 0, INTEL_GRAPHICS_MEMORY_CONTROL, 2); size_t memorySize = 1 << 20; // 1 MB @@ -172,10 +176,6 @@ determine_stolen_memory_size(intel_info &info) } return memorySize; -#endif -// stippi: das sorgt dafür, daß er den Speicher vom BIOS komplett -// wegwirft - return 0; } @@ -298,15 +298,16 @@ intel_extreme_init(intel_info &info) // evaluate driver settings, if any + bool ignoreBIOSAllocated; bool hardwareCursor; size_t totalSize; - read_settings(totalSize, hardwareCursor); + read_settings(totalSize, hardwareCursor, ignoreBIOSAllocated); // Determine the amount of "stolen" (ie. reserved by the BIOS) graphics memory // and see if we need to allocate some more. // TODO: make it allocate the memory on demand! - size_t stolenSize = determine_stolen_memory_size(info); + size_t stolenSize = ignoreBIOSAllocated ? 0 : determine_stolen_memory_size(info); totalSize = max_c(totalSize, stolenSize); dprintf(DEVICE_NAME ": detected %ld MB of stolen memory, reserving %ld MB total\n", @@ -318,9 +319,11 @@ intel_extreme_init(intel_info &info) if (stolenSize < totalSize) { // Every device should have at least 8 MB - we could also allocate them // on demand only, but we're lazy here... + // TODO: overlay seems to have problem when the memory pages are too + // far spreaded - that's why we're using B_CONTIGUOUS for now. info.additional_memory_area = additionalMemoryCreator.Create("intel additional memory", (void **)&additionalMemory, B_ANY_KERNEL_ADDRESS, - totalSize - stolenSize, B_FULL_LOCK | B_CONTIGUOUS, 0); + totalSize - stolenSize, B_CONTIGUOUS /*B_FULL_LOCK*/, 0); if (info.additional_memory_area < B_OK) return info.additional_memory_area; } else @@ -388,6 +391,7 @@ intel_extreme_init(intel_info &info) // no errors, so keep areas and mappings sharedCreator.Detach(); + additionalMemoryCreator.Detach(); graphicsMapper.Detach(); mmioMapper.Detach();