Skip to content

Fix Makefile; replace surface by renderer API

Michael Hamann requested to merge michitux:master into master

This contains one major and two small fixes (please tell me if you want separate PRs):

  • In the Makefile, the {obj,bin} notation did not work under Alpine Linux which lead to a failing build. This replaces it by two lines.
  • According to the documentation of SDL_GetWindowSurface, the surface API and the renderer API must not be used at the same time. For me, this lead to errors because the function to create a renderer was called twice on the same window and the second call failed. I have fixed this by replacing the use of the surface API by the renderer API. This only concerns drawing the background which was trivial to replace.
  • I do not see the advantage of using the software renderer when a hardware renderer like DirectFB is available. For me, the hint to use software rendering leads to having two renderers initialized: directfb and software. Removing the hint, the software renderer seems to not be used anymore. Unfortunately, the DirectFB renderer is not in the renderer list by default. This needs the following patch to SDL2:
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 8cd3a7b..eacc7e2 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -89,9 +89,7 @@ static const SDL_RenderDriver *render_drivers[] = {
 #if SDL_VIDEO_RENDER_OGL_ES
     &GLES_RenderDriver,
 #endif
-#if SDL_VIDEO_RENDER_DIRECTFB
     &DirectFB_RenderDriver,
-#endif
 #if SDL_VIDEO_RENDER_METAL
     &METAL_RenderDriver,
 #endif

Unfortunately, I couldn't figure out how to initialize the DirectFB_RenderDriver on my device (Samsung Note 8.0 (WiFi) n5110) without that patch. Unfortunately, there is also no way to set this define using the configure script (there are flags for some of the other renderers). If you don't have a better idea I would suggest to try to either get this patch into the Alpine package or alternatively to try to upstream a change that adds a flag to cleanly enable it using the configure script. Note that the directfb renderer is always compiled when directfb is enabled, it is only missing from the list of renderer drivers. Manually e.g. setting it e.g. as first item of the array using gdb also works.

Merge request reports