diff --git a/app/streaming/video/ffmpeg-renderers/drm.cpp b/app/streaming/video/ffmpeg-renderers/drm.cpp index 6ba52b48..de4c293b 100644 --- a/app/streaming/video/ffmpeg-renderers/drm.cpp +++ b/app/streaming/video/ffmpeg-renderers/drm.cpp @@ -31,6 +31,7 @@ DrmRenderer::DrmRenderer() m_DrmFd(-1), m_SdlOwnsDrmFd(false), m_SupportsDirectRendering(false), + m_Main10Hdr(false), m_ConnectorId(0), m_EncoderId(0), m_CrtcId(0), @@ -96,6 +97,8 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params) { int i; + m_Main10Hdr = (params->videoFormat == VIDEO_FORMAT_H265_MAIN10); + #if SDL_VERSION_ATLEAST(2, 0, 15) SDL_SysWMinfo info; @@ -278,7 +281,7 @@ bool DrmRenderer::initialize(PDECODER_PARAMETERS params) if (plane != nullptr) { bool matchingFormat = false; for (uint32_t j = 0; j < plane->count_formats && !matchingFormat; j++) { - if (params->videoFormat == VIDEO_FORMAT_H265_MAIN10) { + if (m_Main10Hdr) { switch (plane->formats[j]) { case DRM_FORMAT_P010: case DRM_FORMAT_P030: @@ -567,6 +570,16 @@ bool DrmRenderer::canExportEGL() { "Using direct rendering due to environment variable"); return false; } + else if (qgetenv("DRM_FORCE_EGL") == "1") { + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, + "Using EGL rendering due to environment variable"); + return true; + } + else if (m_SupportsDirectRendering && m_Main10Hdr) { + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, + "Using direct rendering for HDR support"); + return false; + } SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "DRM backend supports exporting EGLImage"); diff --git a/app/streaming/video/ffmpeg-renderers/drm.h b/app/streaming/video/ffmpeg-renderers/drm.h index a788e910..c79a743b 100644 --- a/app/streaming/video/ffmpeg-renderers/drm.h +++ b/app/streaming/video/ffmpeg-renderers/drm.h @@ -32,6 +32,7 @@ private: int m_DrmFd; bool m_SdlOwnsDrmFd; bool m_SupportsDirectRendering; + bool m_Main10Hdr; uint32_t m_ConnectorId; uint32_t m_EncoderId; uint32_t m_CrtcId;