diff --git a/README.md b/README.md index 4b2bb7af..50e65618 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,7 @@ Hosting for Moonlight's Raspberry Pi and L4T package repositories is graciously * To build from the command line for development use, run `qmake moonlight-qt.pro` then `make debug` or `make release` * To create an embedded build for a single-purpose device, use `qmake "CONFIG+=embedded" moonlight-qt.pro` and build normally. * This build will lack windowed mode, Discord/Help links, and other features that don't make sense on an embedded device. + * For platforms with poor GL performance, add `"CONFIG+=glslow"` to prefer direct KMSDRM rendering over EGL/GLES renderers. Direct KMSDRM rendering can use dedicated YUV/RGB conversion and scaling hardware rather than slower GPU shaders for these operations. ## Contribute 1. Fork us diff --git a/app/app.pro b/app/app.pro index e5362c19..402dac7a 100644 --- a/app/app.pro +++ b/app/app.pro @@ -348,6 +348,11 @@ embedded { DEFINES += EMBEDDED_BUILD } +glslow { + message(GL slow build) + + DEFINES += GL_IS_SLOW +} wayland { message(Wayland extensions enabled) diff --git a/app/streaming/video/ffmpeg-renderers/drm.cpp b/app/streaming/video/ffmpeg-renderers/drm.cpp index df42556e..f7aebaa0 100644 --- a/app/streaming/video/ffmpeg-renderers/drm.cpp +++ b/app/streaming/video/ffmpeg-renderers/drm.cpp @@ -1012,12 +1012,7 @@ const char* DrmRenderer::getDrmColorRangeValue(AVFrame* frame) #ifdef HAVE_EGL bool DrmRenderer::canExportEGL() { - if (!m_HwAccelBackend) { - SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, - "Using direct rendering due to non-hwaccel backend"); - return false; - } - else if (qgetenv("DRM_FORCE_DIRECT") == "1") { + if (qgetenv("DRM_FORCE_DIRECT") == "1") { SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Using direct rendering due to environment variable"); return false; diff --git a/app/streaming/video/ffmpeg.cpp b/app/streaming/video/ffmpeg.cpp index 7ef196ea..443095f7 100644 --- a/app/streaming/video/ffmpeg.cpp +++ b/app/streaming/video/ffmpeg.cpp @@ -296,7 +296,7 @@ bool FFmpegVideoDecoder::createFrontendRenderer(PDECODER_PARAMETERS params, bool } #endif -#ifdef HAVE_EGL +#if defined(HAVE_EGL) && !defined(GL_IS_SLOW) if (m_BackendRenderer->canExportEGL()) { m_FrontendRenderer = new EGLRenderer(m_BackendRenderer); if (m_FrontendRenderer->initialize(params)) { @@ -318,7 +318,8 @@ bool FFmpegVideoDecoder::createFrontendRenderer(PDECODER_PARAMETERS params, bool // The backend renderer cannot directly render to the display, so // we will create an SDL or DRM renderer to draw the frames. -#if defined(HAVE_DRM) && defined(GL_IS_SLOW) +#ifdef GL_IS_SLOW +#ifdef HAVE_DRM m_FrontendRenderer = new DrmRenderer(false, m_BackendRenderer); if (m_FrontendRenderer->initialize(params)) { return true; @@ -327,6 +328,20 @@ bool FFmpegVideoDecoder::createFrontendRenderer(PDECODER_PARAMETERS params, bool m_FrontendRenderer = nullptr; #endif +#ifdef HAVE_EGL + // We explicitly skipped EGL in the GL_IS_SLOW case above. + // If DRM didn't work either, try EGL now. + if (m_BackendRenderer->canExportEGL()) { + m_FrontendRenderer = new EGLRenderer(m_BackendRenderer); + if (m_FrontendRenderer->initialize(params)) { + return true; + } + delete m_FrontendRenderer; + m_FrontendRenderer = nullptr; + } +#endif +#endif + m_FrontendRenderer = new SdlRenderer(); if (!m_FrontendRenderer->initialize(params)) { return false;