From 517b684f856315744fb34aa5411db4e24a4e3837 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 27 Sep 2023 01:31:01 -0500 Subject: [PATCH] Handle EGL driver returning no supported formats or modifiers for DMA-BUF import --- .../video/ffmpeg-renderers/eglimagefactory.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/streaming/video/ffmpeg-renderers/eglimagefactory.cpp b/app/streaming/video/ffmpeg-renderers/eglimagefactory.cpp index a0f63a38..22c742c5 100644 --- a/app/streaming/video/ffmpeg-renderers/eglimagefactory.cpp +++ b/app/streaming/video/ffmpeg-renderers/eglimagefactory.cpp @@ -443,6 +443,11 @@ bool EglImageFactory::supportsImportingFormat(EGLDisplay dpy, EGLint format) "eglQueryDmaBufFormatsEXT() #1 failed: %d", eglGetError()); return false; } + else if (numFormats == 0) { + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, + "eglQueryDmaBufFormatsEXT() returned no supported formats!"); + return false; + } EGLint formats[numFormats]; if (!m_eglQueryDmaBufFormatsEXT(dpy, numFormats, formats, &numFormats)) { @@ -480,6 +485,11 @@ bool EglImageFactory::supportsImportingModifier(EGLDisplay dpy, EGLint format, E "eglQueryDmaBufModifiersEXT() #1 failed: %d", eglGetError()); return false; } + else if (numModifiers == 0) { + SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, + "eglQueryDmaBufModifiersEXT() returned no supported modifiers!"); + return false; + } EGLuint64KHR modifiers[numModifiers]; if (!m_eglQueryDmaBufModifiersEXT(dpy, format, numModifiers, modifiers, nullptr, &numModifiers)) {