[SDL] Porting SDL to new hardware

Ryan C. Gordon icculus at icculus.org
Tue May 1 17:27:07 PDT 2007


> Unfortunately there's not any video API that already works with this
> hardware.  :(

I don't know anything about fbcon internals, but you might find it's 
easier to write a Linux fbcon driver and not make changes to SDL at all. 
That might be way harder, though, I don't really know...just wanted to 
give you options for where you can dig in.

> I did manage to get it somewhat working, but I still don't understand
> everything.  For instance, what does UpdateRects() do?  The only parameters are
> an array of SDL_Rects() and the number of rects.  I've looked at a few of the

UpdateRects assumes you have a single screen surface that was previously 
  configured in your SetVideoMode implementation...that surface's 
"pixels" field will be the framebuffer the app writes pixel data to (or 
where SDL  puts data if it had to convert between the app and your 
driver)...in your UpdateRects implementation, you need to get data from 
that "pixels" buffer to the screen in whatever way the hardware allows. 
The rectangles are the portions of the framebuffer to put to the screen:

static void MYDRIVER_UpdateRects(_THIS, int numrects, SDL_Rect *rects)
{
     for (i = 0; i < numrects; i++) {
         const SDL_Rect *r = &rects[i];
         // put r->w by r->h pixels, where r->x r->y is the top
         //  left corner, to the hardware.
     }
}

--ryan.



More information about the SDL mailing list