FS#11834 - Increase speed of SDL screen updates

Attached to Project: Rockbox
Opened by Thomas Jarosch (thomasjfox) - Friday, 24 December 2010, 13:52 GMT
Last edited by Thomas Martitz (kugel.) - Monday, 27 December 2010, 22:09 GMT
Task Type Patches
Category Simulator
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Release 3.7.1
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No



attached is a patch to greatly speed up SDL screen updates
used by the simulator and RaaA (f.e. on the Nokia N900 ;)).

The current code calls SDL_FillRectangle() for every pixel, which is very slow.

We can speed things up greatly by using SDL_BlitSurface()
if the LCD_DEPTH is >= 8 and the pixel format is normal RGB.

Also don't call SDL_LockSurface() in the pixel-by-pixel code
as it's only needed if we are manipulating pixels directly.

Things to note:
- Right now it only works for LCD_DEPTH >= 8 and LCD_PIXELFORMAT == RGB565
- LCD_SoftStretch used for zooming is marked as unstable in the SDL API.

Best regards,
This task depends upon

Closed by  Thomas Martitz (kugel.)
Monday, 27 December 2010, 22:09 GMT
Reason for closing:  Accepted
Additional comments about closing:  r28914. Thanks
Comment by Thomas Jarosch (thomasjfox) - Friday, 24 December 2010, 18:43 GMT
The #if statement in lcd-sdl.c should be like this:

#if LCD_DEPTH >= 8 && (LCD_PIXELFORMAT == RGB565) \
&& !defined(LCD_STRIDEFORMAT) && !defined(HAVE_LCD_SPLIT)

The previous version had a bug so it took the slow path on the N900.