[Help] I want to expand maximum VRAM to 1024M Bytes

Discussions related to using the OSE version of VirtualBox.
Post Reply
LuChang123
Posts: 4
Joined: 16. Aug 2017, 10:56

[Help] I want to expand maximum VRAM to 1024M Bytes

Post by LuChang123 »

Hello, In Virtualbox 5.1.26, the maximum Video RAM is 128MB, and I want to expand it to 1024MB, so how should I edit the source code ?
-----------------
Here is what I found in the function of vgaR3Construct, in the file of "src/VBox/Devices/Graphics/DevVGA.cpp"

/**************************************************************************/
........

/*
* Allocate the VRAM and map the first 512KB of it into GC so we can speed up VGA support.
*/
#ifdef VBOX_WITH_VMSVGA
int iPCIRegionVRAM = (pThis->fVMSVGAEnabled) ? 1 : 0;

if (pThis->fVMSVGAEnabled)
{
/*
* Allocate and initialize the FIFO MMIO2 memory.
*/
rc = PDMDevHlpMMIO2Register(pDevIns, 2 /*iRegion*/, VMSVGA_FIFO_SIZE, 0 /*fFlags*/, (void **)&pThis->svga.pFIFOR3, "VMSVGA-FIFO");
if (RT_FAILURE(rc))
return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS,
N_("Failed to allocate %u bytes of memory for the VMSVGA device"), VMSVGA_FIFO_SIZE);
pThis->svga.pFIFOR0 = (RTR0PTR)pThis->svga.pFIFOR3;
pThis->svga.cbFIFO = VMSVGA_FIFO_SIZE;
}
#else
int iPCIRegionVRAM = 0;
#endif
rc = PDMDevHlpMMIO2Register(pDevIns, iPCIRegionVRAM, pThis->vram_size, 0, (void **)&pThis->vram_ptrR3, "VRam");
AssertLogRelMsgRCReturn(rc, ("PDMDevHlpMMIO2Register(%#x,) -> %Rrc\n", pThis->vram_size, rc), rc);
pThis->vram_ptrR0 = (RTR0PTR)pThis->vram_ptrR3; /** @todo @bugref{1865} Map parts into R0 or just use PGM access (Mac only). */

if (pThis->fGCEnabled)
{
RTRCPTR pRCMapping = 0;
rc = PDMDevHlpMMHyperMapMMIO2(pDevIns, iPCIRegionVRAM, 0 /* off */, VGA_MAPPING_SIZE, "VGA VRam", &pRCMapping);
AssertLogRelMsgRCReturn(rc, ("PDMDevHlpMMHyperMapMMIO2(%#x,) -> %Rrc\n", VGA_MAPPING_SIZE, rc), rc);
pThis->vram_ptrRC = pRCMapping;
# ifdef VBOX_WITH_VMSVGA
/* Don't need a mapping in RC */
# endif
}
........

/***************************************************************************************************/

I note in the function PDMDevHlpMMIO2Register, the third param is just like trans from Frontends. Does this means that
what I should do is only to edit the maximum value of VRAM slider in frontends from 128MB to 1024MB , and Virtualbox will do properly with rest works,
and it DO has 1024MB VRAM available to allocate for the applications ?

----------------------------------
Sorry for repeating that what I need is that expanding maxium value of VRAM value from 128MB to 1024MB, and the application CAN actually malloc so much VRAM

THANKS for reading and/or help my questions, thanks very much because I'm NOT familiar with source code of virutalbox yet.
I will be very GRATEFUL if somebody give me the edited source code tar file.
Here is my email, 514005989 @ qq . com
Last edited by LuChang123 on 16. Aug 2017, 11:28, edited 1 time in total.
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: [Help] I want to expand maximum VRAM to 1024M Bytes

Post by mpack »

Why?

Btw. This is not a "Linux Hosts" question. Moving to "OSE" forum.
LuChang123
Posts: 4
Joined: 16. Aug 2017, 10:56

Re: [Help] I want to expand maximum VRAM to 1024M Bytes

Post by LuChang123 »

mpack wrote:Why?

Btw. This is not a "Linux Hosts" question. Moving to "OSE" forum.
How to move to another forum ?

I do not find the move button. :oops: :oops:
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: [Help] I want to expand maximum VRAM to 1024M Bytes

Post by mpack »

I already moved it. You'll note that the forum is no longer "Linux Hosts".

So, my original question. What are you trying to do which you think will be helped by increasing VRAM to 1024MB?
LuChang123
Posts: 4
Joined: 16. Aug 2017, 10:56

Re: [Help] I want to expand maximum VRAM to 1024M Bytes

Post by LuChang123 »

mpack wrote:I already moved it. You'll note that the forum is no longer "Linux Hosts".

So, my original question. What are you trying to do which you think will be helped by increasing VRAM to 1024MB?
Because it's our customer's demand. It could well be that they want to run some big software that need much VRAM in guest os.

yesterday one of my workmate had build a version with the maxium value of VRAM slider which is 1024MB, but we are not sure if there
is actually so many VRAM allocated in host OS. Maybe the 1024MB VRAM in guest OS is virtual, mapped to only 128MB VRAM in the host OS. :oops:
------------------------------
Thank you very much !
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: [Help] I want to expand maximum VRAM to 1024M Bytes

Post by mpack »

LuChang123 wrote: Because it's our customer's demand.
Unless these are Oracle customers then I doubt that answer will suffice.

Programs, no matter how large, don't require virtual graphics cards to have lots of VRAM, and please bear in mind that in a VM this is simulated VRAM, using normal RAM from the host - and it has absolutely nothing to do with the actual VRAM in actual host graphics cards (which is not even directly accessible to apps in the host, never mind in the guest).
LuChang123
Posts: 4
Joined: 16. Aug 2017, 10:56

Re: [Help] I want to expand maximum VRAM to 1024M Bytes

Post by LuChang123 »

mpack wrote:
LuChang123 wrote: Because it's our customer's demand.
Unless these are Oracle customers then I doubt that answer will suffice.

Programs, no matter how large, don't require virtual graphics cards to have lots of VRAM, and please bear in mind that in a VM this is simulated VRAM, using normal RAM from the host - and it has absolutely nothing to do with the actual VRAM in actual host graphics cards (which is not even directly accessible to apps in the host, never mind in the guest).
Sorry for my greedy. I will try to solve this on my own.

So my question is now, can I make VirutalBox malloc 1024MB RAM in host to used as VRAM in guest by alter maximum VRAM to 1024MB in frontends ?

Thank you.
michaln
Oracle Corporation
Posts: 2973
Joined: 19. Dec 2007, 15:45
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Any and all
Contact:

Re: [Help] I want to expand maximum VRAM to 1024M Bytes

Post by michaln »

LuChang123 wrote:Because it's our customer's demand.
That, however, is completely irrelevant on this forum, unless there is some Oracle customer involved.

Anyway, increasing the VRAM limit is not as simple as changing some constant somewhere. Allocating lots of memory is easy, mapping it to the PCI space is not. At any rate, increasing the VRAM size for a VM is unlikely to solve any actual problems.
Post Reply