Expose glslow config option

This commit is contained in:
Cameron Gutman 2023-03-26 20:27:03 -05:00
parent 21cda8141d
commit f16b5cd337
4 changed files with 24 additions and 8 deletions

View file

@ -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

View file

@ -348,6 +348,11 @@ embedded {
DEFINES += EMBEDDED_BUILD
}
glslow {
message(GL slow build)
DEFINES += GL_IS_SLOW
}
wayland {
message(Wayland extensions enabled)

View file

@ -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;

View file

@ -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;