Closed jankammerath closed 6 years ago
Use gprof for analysis.
Here are some good tips for SDL: http://forums.libsdl.org/viewtopic.php?p=30505
The root of all evil is in the overlay rendering of the PNG into the SDL window. Rethinking the whole rendering style or design is probably necessary.
Some fixes are done now, but the _cairo_surfacet should be written directly onto the _SDLSurface without the use of PNG rendering. That could give slightly more performance.
from https://cairographics.org/manual/cairo-cairo-surface-t.html, example 1, get data/width/height/stride of your cairo surface, and create your SDL_Surface or SDL_Texture with those information, for instance, with SDL_CreateRGBSurfaceWithFormatFrom() or SDL_UpdateTexture()."
Source: https://discourse.libsdl.org/t/webkit-surface-on-sdl-using-cairo-directly-instead-of-png/23688/2
Switch rendering to directfb: http://sdl.beuc.net/sdl.wiki/SDL_envvars
hardware acceleration?
@vlelin hardware acceleration?
HW acceleration to a certain extent is in the master branch and switched on by default. It can be configured using the render configuration setting. The major issue with performance at the moment is that the transfer of the PNG data from the overlay to the SDL rendering can create minor, almost not noticable, but present glitches. Furthermore the rendring engine (e.g. DirectFB) should be configurable.
Latest commit hard forces "directfb" when render is set to "hw"
I am closing this issue now as latest commit has reduced CPU utilisation from 58-64% to now about 24%-35% on my development machine with debug-compile. The PNG data is now only written when WebKit sends a "draw" signal (connected by g_signal_connect). Furthermore in the drawing loop for SDL the PNG is only read when it's timestamp is updated (in milliseconds) to prevent too much PNG reading. The cairo_surface_t conversion to SDL_Surface will not provide much for gain, so that is ignored.
With all these changes, all required performance improvements from this issue are not fixed.
There are minor glitches in rendering performance even with hardware support. These are hard to realise, but if one looks closely at the video there is evidence that certain frames are dropped.