VirtualBox

Changeset 104842 in vbox


Ignore:
Timestamp:
Jun 5, 2024 1:02:34 AM (11 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
163435
Message:

DevVGA,DevPCI,Main: Increased the max VRAM size to 1GB. Experimental. bugref:10687

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/graphics.h

    r104786 r104842  
    4242
    4343/** The default amount of VGA VRAM (in bytes). */
    44 # define VGA_VRAM_DEFAULT           (_4M)
     44#define VGA_VRAM_DEFAULT            (_4M)
    4545/** The minimum amount of VGA VRAM (in bytes). */
    46 # define VGA_VRAM_MIN               (_1M)
    47 /** The maximum amount of VGA VRAM (in bytes). Limited by VBOX_MAX_ALLOC_PAGE_COUNT. */
    48 # define VGA_VRAM_MAX               (256 * _1M)
     46#define VGA_VRAM_MIN                (_1M)
     47/** The maximum amount of VGA VRAM (in bytes). */
     48#define VGA_VRAM_MAX                (_1G)
    4949
    5050/** The minimum amount of SVGA VRAM (in bytes). */
  • trunk/src/VBox/Devices/Bus/DevPCI.cpp

    r103502 r104842  
    682682                                     * needed for legacy guest drivers. */
    683683                                    if (fPrefetch)
     684                                    {
    684685                                        paddr = &uPciBiosSpecialVRAM;
     686
     687                                        /* Hack alert! Workaround for VRAM sizes higher than 256MB (absolute max is 1GB). */
     688                                        if (   u32Size > 0x10000000  /* 256MB (what we can stuff at 0xe0000000) */
     689                                            && uPciBiosSpecialVRAM == 0xe0000000)
     690                                            uPciBiosSpecialVRAM = u32Size > 0x20000000 /*512MB*/ ? 0x80000000 : 0xc0000000;
     691                                    }
    685692                                }
    686693                            }
     
    694701                            || uNew + u32Size - 1 >= UINT32_C(0xfec00000))
    695702                        {
    696                             LogRel(("PCI: no space left for BAR%u of device %u/%u/%u (vendor=%#06x device=%#06x)\n",
    697                                     i, pBus->iBus, pPciDev->uDevFn >> 3, pPciDev->uDevFn & 7, vendor_id, device_id)); /** @todo make this a VM start failure later. */
     703                            LogRel(("PCI: no space left for BAR%u (type=%#x size=%#RX32) of device %u/%u/%u (vendor=%#06x device=%#06x) - uNew=%#RX32 (*paddr=%#RX32)\n",
     704                                    i, u8ResourceType, u32Size, pBus->iBus, pPciDev->uDevFn >> 3, pPciDev->uDevFn & 7,
     705                                    vendor_id, device_id, uNew, *paddr)); /** @todo make this a VM start failure later. */
    698706                            /* Undo the mapping mess caused by the size probing. */
    699707                            devpciR3SetDWord(pDevIns, pPciDev, u32Address, UINT32_C(0));
  • trunk/src/VBox/Main/src-client/ConsoleImplConfigX86.cpp

    r104702 r104842  
    433433    ComPtr<IPlatform> platform;
    434434    pMachine->COMGETTER(Platform)(platform.asOutParam());                                   H();
     435
     436    /* We have to increase the RAM hole if lots of VRAM is assigned. We stupidly
     437       have to do this before the MCFG region is subtracted, even if there
     438       should be ample space for it after the VRAM due to alignment. See
     439       assumptions in ich9pciFakePCIBIOS(). */
     440    ComPtr<IGraphicsAdapter> ptrGraphicsAdapter;
     441    hrc = pMachine->COMGETTER(GraphicsAdapter)(ptrGraphicsAdapter.asOutParam());            H();
     442    ULONG cVRamMBs = 0;
     443    hrc = ptrGraphicsAdapter->COMGETTER(VRAMSize)(&cVRamMBs);                               H();
     444    if (cVRamMBs > 256)
     445    {
     446        uint32_t cVRamMBsPowerOfTwo = RT_MIN(cVRamMBs, 1024); /* 1GB is the absolute max given PCI alignment. */
     447        if (!RT_IS_POWER_OF_TWO(cVRamMBsPowerOfTwo))
     448            cVRamMBsPowerOfTwo = RT_BIT_32(ASMBitFirstSetU32(cVRamMBsPowerOfTwo)); /* returns [1..32] */
     449        if (cbRamHole / _1M < cVRamMBsPowerOfTwo * 2)
     450        {
     451            cbRamHole = cVRamMBsPowerOfTwo * 2 * _1M; /* We must double the VRAM size due to PCI alignment. */
     452/** @todo sort out the MCFG placement to better use available physical memory. */
     453            //if (uMcfgBase)
     454            //    uMcfgBase = _4G - cbRamHole + cVRamMBsPowerOfTwo * _1M;
     455        }
     456    }
    435457
    436458    ChipsetType_T chipsetType;
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette