Skip to contentSkip to conversation

Framebuffer using system memory

DISCUSSION Alessio Sangalli 2 participants 5 messages Apr 25, 2009 – Apr 26, 2009 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

Hi I am working on a framebuffer that uses the system memory.

What I mean here is that I need to pass mem=120M to a system that has 128MB to "reserve" 8MB of memory for the framebuffer; then I program the hardware to use that region of memory.

The reason I do this is that it seems impossible to kmalloc more that 4MB of contiguos physical memory with the Linux Kernel.

Bottom line, I do not know how to map those 8MB back to userspace. If userspace opens mmaps /dev/mem and writes to the appropriate location it can access the fb perfectly.

Any hints? All of this is on ARM9.

Thank you
Alessio

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects

#1 lore raw
Quoted 6 lines · Alessio Sangalli

Hi I am working on a framebuffer that uses the system memory.

What I mean here is that I need to pass mem=120M to a system that has 128MB to "reserve" 8MB of memory for the framebuffer; then I program the hardware to use that region of memory.

Quoted 8 lines

The reason I do this is that it seems impossible to kmalloc more that 4MB of contiguos physical memory with the Linux Kernel.

Bottom line, I do not know how to map those 8MB back to userspace. If userspace opens mmaps /dev/mem and writes to the appropriate location it can access the fb perfectly.

Any hints? All of this is on ARM9.

Alternatively, you could use__alloc_bootmem() in the early platform code to reserve
the memory, cfr. arch/powerpc/platforms/ps3/setup.c

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects

#2 lore raw
Quoted 3 lines · Geert Uytterhoeven

Alternatively, you could use__alloc_bootmem() in the early platform code to reserve
the memory, cfr. arch/powerpc/platforms/ps3/setup.c

Yeah thanks, that example is pretty complete. I will try that. Anyway, for my personal curiosity, is it possible at all to map memory not managed by the kernel to userspace?

bye
as

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects

#3 lore raw
In reply to Geert Uytterhoeven
Quoted 3 lines · Geert Uytterhoeven

Alternatively, you could use__alloc_bootmem() in the early platform code to reserve
the memory, cfr. arch/powerpc/platforms/ps3/setup.c

So the usage patter seems to be:

- I use __alloc_bootmem() to reserve memory
- I export a structure that contains data about this memory (location and size mainly)
- In the init of my framebuffer driver I use the data in that structure to configure the hardware
- I map that area of memory to userspace when they try to mmap() this fb device

Can you comment on this?

bye
Alessio

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects

#4 lore raw
Quoted 17 lines · Alessio Sangalli
Quoted 3 lines · Geert Uytterhoeven

Alternatively, you could use__alloc_bootmem() in the early platform code to reserve
the memory, cfr. arch/powerpc/platforms/ps3/setup.c

So the usage patter seems to be:

- I use __alloc_bootmem() to reserve memory
- I export a structure that contains data about this memory (location and size mainly)
- In the init of my framebuffer driver I use the data in that structure to configure the hardware
- I map that area of memory to userspace when they try to mmap() this fb device

Quoted 1 line

Can you comment on this?

That's correct. Note that you don't have to do anything special for mmap() (i.e. you do not need your own device-specific fb_mmap()), as the default one should work fine.

If you use a platform device, you can store the memory location and size in the platform device's platform data.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial Check out the new simplified licensign option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects