# Re: Mapping the framebuffer into kernel space

- From: James Simmons \<hidden\>
- Date: 2005-05-12 00:38:32 
- List: linux-fbdev
- Page: https://ratatoskr.run/linux-fbdev/2005/05/13455032
- Thread: https://ratatoskr.run/linux-fbdev/2005/05/13455032/t.md

```text

> > It can be done but not without difficulty.  A few drivers use sections of
> > the framebuffer space for the cursor, DMA buffer and whatever.  So
> > when fbcon starts mapping the framebuffer space, it must make sure
> > that it does not overlap with the driver's, or the space left to the driver
> > is of the correct size and alignment.
> 
> We have to start transitioning to a new model. 512MB cards are
> shipping today. There is only 1GB of x86 kernel address space and the
> kernel has to fit into it too. Blindly mapping the entire VRAM into
> kernel space has to be replaced with a scheme that only maps what is
> required.

This can be done. I was moving that way using fb_pixmap. See my 
resource.diff patch I posted some time ago. Using request_region we should
be able to lock down a area so no one else can use it.

> Space for the cursor, DMA buffer, etc doesn't have to stay mapped. The
> driver can map it in, write the cursor and then map it out. DMA
> buffers don't need to be mapped in.

The cursor is really small memory. Mapping and unmapping it would be 
expensive with fbconsole because it flashs the cursor. As for DMA that
can be mapped and unmapped. 
 
> Another issue is multihead cards. For two heads it makes sense to put
> the two scanout buffers at either end of VRAM. But these buffers can
> change size. A better model might be:
> 
> cursor
> head 1 scanout
> free VRAM
> head 2 scanout
> cursor
> 
> The location of these items would be pointed to by a field in fb_info.

Each struct fb_info represent each displayable surface with a cursor[s].
It has the data the fbcon needs to function. The function check_var
needs to valided if changing one head can safely affect the other.
The function set_par would handle doing the moving around of resources.

> What's the least painful way to start a transition?

Design a clean buffer implementation that dri and fb would use.


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click
```
