Re: HalAllocateCommonBuffer and virtual addresses
- From: "Dean Ramsier" <ramsiernospam@xxxxxxxxxx>
- Date: Mon, 27 Feb 2006 09:06:13 -0500
This memory is ONLY shared if the size you allocate is greater than 2MB (far
greater than the required size of the frame buffer). That is because
virtual memory allocations of size greater than 2MB come from shared memory
space instead of the local process space.
That little tidbit is not obvious from the code snippet or comments.
--
Dean Ramsier - eMVP
BSQUARE Corporation
"Aigor" <Aigor@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:48E00D07-348B-4395-8FD2-4F49B14E1B93@xxxxxxxxxxxxxxxx
Maybe this will help you.
This is code from pxa27x_lcd2 driver:
g_DisplayBaseVirtual = (DWORD)HalAllocateCommonBuffer(&Adapter,
DISPLAY_BUFFER_SIZE, &PhysAddr, FALSE);
g_DisplayBasePhysical = PhysAddr.LowPart;
if (!g_DisplayBaseVirtual)
{
Cleanup();
return FALSE;
}
// map shared virtual memory, and set the virtual ptr to that address
rather than local process
// address; from this point on, all processes (including DDraw apps)
will be able to access the
// display region using g_DisplayBaseVirtual
g_DisplayBaseVirtual = (DWORD)VirtualAlloc(NULL, DISPLAY_BUFFER_SIZE,
MEM_RESERVE, PAGE_NOACCESS);
if(!VirtualCopy((LPVOID)g_DisplayBaseVirtual, (LPVOID)((unsigned
long)g_DisplayBasePhysical >> 8), DISPLAY_BUFFER_SIZE, (PAGE_READWRITE |
PAGE_NOCACHE | PAGE_PHYSICAL)))
{
RETAILMSG(1,(TEXT("CRITICAL ERROR: display SDRAM region allocation
failed")));
}
bye.
"marco" wrote:
what I need is to use that buffer also from another process
is it possible ?
what do I have to map the same buffer into the virtual range of the
second
process ?
that is , I have the lcd driver (that is in process of gwes.exe) that
calls
the HalAllocateCommonBuffer for the frame buffer of the lcd, while I
would
like to read/write the frame buffer from an exe program .
what address value do I have to use with VirtualCopy in this second
process ?
maybe do I need the virtual uncached address ?
how can I translate the PhysAddr.LowPart value to a virtual uncached
addree ?
Marco
.
- References:
- Re: HalAllocateCommonBuffer and virtual addresses
- From: Steve Maillet \(eMVP\)
- Re: HalAllocateCommonBuffer and virtual addresses
- Prev by Date: Re: IXP4xx Processors
- Next by Date: Re: Stop REATILMSG O/P at application Level
- Previous by thread: Re: HalAllocateCommonBuffer and virtual addresses
- Next by thread: Re: Can NOT go into System Idle Mode ??
- Index(es):
Relevant Pages
|