Handle EGL driver returning no supported formats or modifiers for DMA-BUF import

This commit is contained in:
Cameron Gutman 2023-09-27 01:31:01 -05:00
parent 39465f6d8a
commit 517b684f85

View file

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