[vbox-dev] IFramebuffer - requestResize vram question

Ivo Smits Ivo at UFO-Net.nl
Fri Apr 27 13:12:21 GMT 2012


Op 27-4-2012 14:48, Klaus Espenlaub schreef:
> On 27.04.2012 08:56, Jaikumar G wrote:
>> On Thu, Apr 26, 2012 at 10:48 PM, Klaus Espenlaub
>> <klaus.espenlaub at oracle.com<mailto:klaus.espenlaub at oracle.com>>  wrote:
>>
>>      On 27.04.2012 02<tel:27.04.2012%2002>:43, Jaikumar G wrote:
>>        >  Is my understanding of the API incorrect ? If I want to have the
>>      display
>>       >  in another process - can I access the vram pointer directly -
>>      instead of
>>       >  creating a shared buffer and passing it in the IFramebuffer
>>      implementation ?
>>
>>      This interface method isn't directly intended for using shared memory
>>      (but it might work if the VM frontend knows how to handle it), and it
>>      can only be used by the VM frontend itself, as pointers make no sense
>>      across processes.
>>
>>
>> So whats the recommended way of sharing the display buffer if the
>> frontend is running in another process ?
> There is no recommended way so far - we didn't have the need for moving
> the display buffer into another process, and others didn't need it
> either. Heard of several people who rolled their own VM frontend (some
> even in VisualBasic), keeping the display buffer local. It's the most
> efficient solution, as it keeps the screen updates (which need a very
> high bandwidth with a low latency to give a good interactive
> performance) withing the process.
>
> If you really want to go there you're the pioneer.
No, he's not. I have an IFramebuffer implementation that uses shared 
memory (a sufficiently large memory mapped file, on Windows) and passes 
this pointer to VirtualBox as the framebuffer address. The shared memory 
is then displayed/read in another process (update/resize events are 
passed using the standard input/output pipes). This works quite well. A 
funny side effect is that you can actually read the file as a (raw 
bitmap) image file.

One important thing: memory pointers are in the context of the process. 
If you want to share memory between processes, you will somehow have to 
obtain a pointer to the actual region in memory, in both processes. A 
common and convenient way to do so is by mapping a file into memory, in 
both processes.

Ivo




More information about the vbox-dev mailing list