diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md index 3c6f588..05dce2c 100644 --- a/doc/CHANGELOG.md +++ b/doc/CHANGELOG.md @@ -5,6 +5,7 @@ - Bug fixes - Additional unit tests - Now possible to test the application inside the docker container +- Allow to use render drivers with hardware acceleration ``` ## v1.3 diff --git a/doc/HOWTO.md b/doc/HOWTO.md index c0bd928..1623153 100644 --- a/doc/HOWTO.md +++ b/doc/HOWTO.md @@ -16,7 +16,7 @@ - In below sections, has to be replaced with the current version of the binary. - Another path to Main.xml config file can be specified using -f option\ ``` - E.g.: $ ./out/mmstreamer/bin/mmstreamer- -f /tmp/Main.xml + E.g.: ./out/mmstreamer/bin/mmstreamer- -f /tmp/Main.xml ``` - In case a "bitsPerPixel" different from the active framebuffer's depth is specified in Graphics.xml, mmstreamer will try to change depth. To make it work, "root" permission is required (E.g. Run mmstreamer as root) - If mmstreamer failed to start, please, see [TROUBLESHOOT](TROUBLESHOOT.md) diff --git a/src/graphics/drawers/Drawer2.c b/src/graphics/drawers/Drawer2.c index 9e3cc66..cbf1878 100755 --- a/src/graphics/drawers/Drawer2.c +++ b/src/graphics/drawers/Drawer2.c @@ -1323,7 +1323,8 @@ static enum drawer_error_e initWindowAndRenderer_f(struct drawer_s *obj, enum gf ; } - // Create window + // Create a window usable with OpenGL context + windowFlags |= SDL_WINDOW_OPENGL; *window = SDL_CreateWindow(windowCaption, windowPos.x, windowPos.y, windowPos.w, windowPos.h, windowFlags); if (!(*window)) { @@ -1338,16 +1339,16 @@ static enum drawer_error_e initWindowAndRenderer_f(struct drawer_s *obj, enum gf } // Create renderer - // FIXME : Make renderer work with HW acceleration (SDL_RENDERER_ACCELERATED) - // The issue is that the UI becomes weird once one starts playing with - // some buttons. + // - A render driver that supports HW acceleration is used when available + // - Otherwise a render driver supporting software fallback is selected // - // Once fixed, replace - // uint32_t rendererFlags = SDL_RENDERER_TARGETTEXTURE|SDL_RENDERER_SOFTWARE; - // with - // uint32_t rendererFlags = SDL_RENDERER_TARGETTEXTURE; + // IMPORTANT: Note that the created window must be usable with OpenGL context + // i.e SDL_WINDOW_OPENGL is set. If not, you might experiment an + // issue (artifacts, weird UI) which seems to be reproducible when + // "opengles2" has been selected as the render driver (rather than + // "opengl" or "software" for example). SDL_RendererInfo renderDriverInfo; - uint32_t rendererFlags = SDL_RENDERER_TARGETTEXTURE|SDL_RENDERER_SOFTWARE; + uint32_t rendererFlags = SDL_RENDERER_TARGETTEXTURE; int32_t nbRenderDrivers = SDL_GetNumRenderDrivers(), index = 0; while (index < nbRenderDrivers) { if (SDL_GetRenderDriverInfo(index, &renderDriverInfo) == 0) { @@ -1355,6 +1356,7 @@ static enum drawer_error_e initWindowAndRenderer_f(struct drawer_s *obj, enum gf && ((renderDriverInfo.flags & SDL_RENDERER_ACCELERATED) == SDL_RENDERER_ACCELERATED)) { Logd("Using render driver with HW acceleration: %s", renderDriverInfo.name); rendererFlags |= SDL_RENDERER_ACCELERATED; + SDL_SetHint(SDL_HINT_RENDER_DRIVER, renderDriverInfo.name); break; } }