diff --git a/src/add-ons/accelerants/nvidia/engine/nv_general.c b/src/add-ons/accelerants/nvidia/engine/nv_general.c
index c967440680..814e00c404 100644
--- a/src/add-ons/accelerants/nvidia/engine/nv_general.c
+++ b/src/add-ons/accelerants/nvidia/engine/nv_general.c
@@ -92,7 +92,7 @@ status_t nv_general_powerup()
{
status_t status;
- LOG(1,("POWERUP: Haiku nVidia Accelerant 0.97 running.\n"));
+ LOG(1,("POWERUP: Haiku nVidia Accelerant 0.98 running.\n"));
/* log VBLANK INT usability status */
if (si->ps.int_assigned)
diff --git a/src/add-ons/accelerants/nvidia/engine/nv_info.c b/src/add-ons/accelerants/nvidia/engine/nv_info.c
index ce76e45c1a..1431a46bd4 100644
--- a/src/add-ons/accelerants/nvidia/engine/nv_info.c
+++ b/src/add-ons/accelerants/nvidia/engine/nv_info.c
@@ -3233,6 +3233,7 @@ static void getRAMsize_arch_nv10_20_30_40(void)
{
uint32 dev_manID = CFGR(DEVID);
uint32 strapinfo = NV_REG32(NV32_NV10STRAPINFO);
+ uint32 mem_size;
switch (dev_manID)
{
@@ -3243,44 +3244,19 @@ static void getRAMsize_arch_nv10_20_30_40(void)
LOG(8,("INFO: nVidia GPU with UMA detected\n"));
break;
default:
+ LOG(8,("INFO: kerneldriver mapped %3.3fMb framebuffer memory\n",
+ (si->ps.memory_size / (1024.0 * 1024.0))));
LOG(8,("INFO: (Memory detection) Strapinfo value is: $%08x\n", strapinfo));
- switch ((strapinfo & 0x3ff00000) >> 20)
- {
- case 2:
- si->ps.memory_size = 2 * 1024 * 1024;
- break;
- case 4:
- si->ps.memory_size = 4 * 1024 * 1024;
- break;
- case 8:
- si->ps.memory_size = 8 * 1024 * 1024;
- break;
- case 16:
- si->ps.memory_size = 16 * 1024 * 1024;
- break;
- case 32:
- si->ps.memory_size = 32 * 1024 * 1024;
- break;
- case 64:
- si->ps.memory_size = 64 * 1024 * 1024;
- break;
- case 128:
- si->ps.memory_size = 128 * 1024 * 1024;
- break;
- case 256:
- si->ps.memory_size = 256 * 1024 * 1024;
- break;
- case 512:
- si->ps.memory_size = 512 * 1024 * 1024;
- break;
- default:
- si->ps.memory_size = 16 * 1024 * 1024;
+ mem_size = (strapinfo & 0x3ff00000);
+ if (!mem_size) {
+ mem_size = 16 * 1024 * 1024;
LOG(8,("INFO: NV10/20/30 architecture chip with unknown RAM amount detected;\n"));
LOG(8,("INFO: Setting 16Mb\n"));
- break;
}
+ /* don't attempt to adress memory not mapped by the kerneldriver */
+ if (si->ps.memory_size > mem_size) si->ps.memory_size = mem_size;
}
}
diff --git a/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html b/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
index a37f0b9c5a..19d65c65bf 100644
--- a/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
+++ b/src/add-ons/kernel/drivers/graphics/nvidia/UPDATE.html
@@ -4,7 +4,7 @@
Changes done for each driverversion:
-head (SVN 0.97, Rudolf)
+head (SVN 0.98, Rudolf)
- Fixed driver assuming enabling AGP mode succeeded on some occasions if it did not block it itself. Blocking AGP mode completely via the AGP busmanager (option 'block_agp') resulted in a crashing acceleration engine because it was setup for AGP transfers instead of using PCI transfers. Error was solved with help from user kraton.
- Fixed shared_info struct problem occuring when 3D 'accelerant' is used (tested Alpha 4.1): the TVencoder type definition list apparantly gets some memory assigned these days when done inside the definition of shared_info. Moved encoder list outside the shared_info definition.
@@ -24,7 +24,8 @@
- Modified GPU PTimer programming which according to the Nouveau project fixes LVDS panel programming in some cases.
- Corrected/Added detection of third I2C bus on cards that support it. The old detection method for a third and (non-existing) fourth bus was faulty. The driver uses I2C channels for monitor DDC/EDID and TVencoder communications.
- DDC/EDID fetching now also works on GCC4 binaries due to a fixed fault in the accelerants/common code (which is used for that function);
-
- Added support for Haiku specific driverhook GET_PREFERRED_DISPLAY_MODE. Laptops should now also startup in native mode automatically at first system boot.
+
- Added support for Haiku specific driverhook GET_PREFERRED_DISPLAY_MODE. Laptops should now also startup in native mode automatically at first system boot;
+
- Rewrote framebuffer memory detection. Accelerant now only uses the amount of RAM mapped by the kerneldriver as maximum. This fixes black screen at app_server startup on a number of GF7xxx cards.
nv_driver 0.80 (Rudolf)
diff --git a/src/add-ons/kernel/drivers/graphics/nvidia/driver.c b/src/add-ons/kernel/drivers/graphics/nvidia/driver.c
index 83be459924..743a89ddcf 100644
--- a/src/add-ons/kernel/drivers/graphics/nvidia/driver.c
+++ b/src/add-ons/kernel/drivers/graphics/nvidia/driver.c
@@ -4,7 +4,7 @@
Other authors:
Mark Watson;
- Rudolf Cornelissen 3/2002-6/2009.
+ Rudolf Cornelissen 3/2002-8/2009.
*/
@@ -681,6 +681,10 @@ map_device(device_info *di)
/* remember the DMA address of the frame buffer for BDirectWindow?? purposes */
si->framebuffer_pci = (void *) di->pcii.u.h0.base_registers_pci[frame_buffer];
+ /* note the amount of memory mapped by the kerneldriver so we can make sure we
+ * don't attempt to adress more later on */
+ si->ps.memory_size = di->pcii.u.h0.base_register_sizes[frame_buffer];
+
// remember settings for use here and in accelerant
si->settings = sSettings;
@@ -851,6 +855,7 @@ open_hook(const char* name, uint32 flags, void** cookie)
physical_entry map[1];
size_t net_buf_size;
void *unaligned_dma_buffer;
+ uint32 mem_size;
/* find the device name in the list of devices */
/* we're never passed a name we didn't publish */
@@ -946,21 +951,32 @@ open_hook(const char* name, uint32 flags, void** cookie)
* wrongly identify the INT request coming from us! */
si->ps.secondary_head = false;
+ /* map the device */
+ result = map_device(di);
+ if (result < 0) goto free_shared_and_alldma;
+
+ /* we will be returning OK status for sure now */
+ result = B_OK;
+
/* note the amount of system RAM the system BIOS assigned to the card if applicable:
* unified memory architecture (UMA) */
switch ((((uint32)(si->device_id)) << 16) | si->vendor_id)
{
case 0x01a010de: /* Nvidia GeForce2 Integrated GPU */
/* device at bus #0, device #0, function #1 holds value at byte-index 0x7C */
- si->ps.memory_size = 1024 * 1024 *
+ mem_size = 1024 * 1024 *
(((((*pci_bus->read_pci_config)(0, 0, 1, 0x7c, 4)) & 0x000007c0) >> 6) + 1);
+ /* don't attempt to adress memory not mapped by the kerneldriver */
+ if (si->ps.memory_size > mem_size) si->ps.memory_size = mem_size;
/* last 64kB RAM is used for the BIOS (or something else?) */
si->ps.memory_size -= (64 * 1024);
break;
case 0x01f010de: /* Nvidia GeForce4 MX Integrated GPU */
/* device at bus #0, device #0, function #1 holds value at byte-index 0x84 */
- si->ps.memory_size = 1024 * 1024 *
+ mem_size = 1024 * 1024 *
(((((*pci_bus->read_pci_config)(0, 0, 1, 0x84, 4)) & 0x000007f0) >> 4) + 1);
+ /* don't attempt to adress memory not mapped by the kerneldriver */
+ if (si->ps.memory_size > mem_size) si->ps.memory_size = mem_size;
/* last 64kB RAM is used for the BIOS (or something else?) */
si->ps.memory_size -= (64 * 1024);
break;
@@ -970,13 +986,6 @@ open_hook(const char* name, uint32 flags, void** cookie)
break;
}
- /* map the device */
- result = map_device(di);
- if (result < 0) goto free_shared_and_alldma;
-
- /* we will be returning OK status for sure now */
- result = B_OK;
-
/* disable and clear any pending interrupts */
//fixme:
//distinquish between crtc1/crtc2 once all heads get seperate driver instances!