You can now specify how much memory the chip can use for graphics memory via

a settings file. However, you cannot specify less than the amount taken by
the BIOS (ie. your settings will be ignored if you do).
Just put something like the following into a "intel_extreme" settings file:
	graphics_memory_size 16

To allocate 16 MB in total. Note, whatever value you specify will be rounded
up to the next power of two, ie. if you specify 6 MB, 8 will be taken.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17444 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-05-13 19:48:17 +00:00
parent 63dbc0a8d6
commit 82bca02b9f
@@ -11,6 +11,7 @@
#include "driver.h"
#include "utility.h"
#include <driver_settings.h>
#include <util/kernel_cpp.h>
#include <unistd.h>
@@ -91,6 +92,36 @@ init_overlay_registers(overlay_registers *registers)
}
static size_t
determine_desired_memory_size()
{
size_t size = 8; // 8 MB
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");
if (string != NULL)
specified = atoi(string);
unload_driver_settings(settings);
if (specified != 0) {
// take the next power of two
size_t desired = 1;
while (desired < specified) {
desired *= 2;
}
if (desired < 128)
size = desired;
}
}
return size << 20;
}
static size_t
determine_stolen_memory_size(intel_info &info)
{
@@ -258,14 +289,17 @@ intel_extreme_init(intel_info &info)
// Determine the amount of "stolen" (ie. reserved by the BIOS) graphics memory
// and see if we need to allocate some more.
// TODO: introduce a settings value which you can use to cut down the memory
// requirements, or make it allocate the memory on demand!
// TODO: make it allocate the memory on demand!
size_t totalSize = determine_desired_memory_size();
size_t stolenSize = determine_stolen_memory_size(info);
dprintf(DEVICE_NAME ": detected %ld MB of stolen memory\n", stolenSize / 1024 / 1024);
totalSize = max_c(totalSize, stolenSize);
dprintf(DEVICE_NAME ": detected %ld MB of stolen memory, reserving %ld MB total\n",
stolenSize / 1024 / 1024, totalSize / 1024 / 1024);
AreaKeeper additionalMemoryCreator;
size_t totalSize = max_c(8 * 1024 * 1024, stolenSize);
uint8 *additionalMemory;
if (stolenSize < totalSize) {