We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4800

Summary: [PATCH] SDL_EGL_ChooseConfig: don't fall through if no matching format exists
Product: SDL Reporter: Conn O'Griofa <connogriofa>
Component: videoAssignee: Ryan C. Gordon <icculus>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: icculus
Version: HG 2.1Keywords: target-2.0.14
Hardware: All   
OS: Linux   
Attachments: [PATCH] SDL_EGL_ChooseConfig: don't fall through if no matching format exists

Description Conn O'Griofa 2019-09-11 10:40:30 UTC
Created attachment 3964 [details]
[PATCH] SDL_EGL_ChooseConfig: don't fall through if no matching format exists

On Raspberry Pi 3 via the VC4 driver in firmware KMS mode, none of the
found configs match the desired format, causing the function to fall through
without any config being selected.

Fix by first iterating over the found configs, and if no match exists,
don't exclude the non-matching configs. This should fix RPI3 and possibly other
targets without breaking targets that have a matching native format (such as RPI4).
Comment 1 Conn O'Griofa 2019-09-11 10:46:48 UTC
This is a follow-up to the fix posted for bug 4349. Although the patch for that issue did fix EGL config selection for Raspberry Pi 4, it caused a regression for the VC4 driver of Raspberry Pi 3 (using firmware KMS mode). The reason appears to be that if the driver have an exact match for the underlying format, the function will fall through due to no config being selected (it doesn't even reach the part where a close match is determined).

This problem doesn't affect all SDL2 applications, but can be reproduced via lzdoom (https://github.com/drfrag666/gzdoom) or mupen64plus when using the GLideN64 plugin (https://github.com/gonetz/GLideN64). There are probably a lot more examples, but those are two that I can recall off-hand.
Comment 2 Conn O'Griofa 2019-09-11 10:47:54 UTC
*if the driver does not have an exact match for the underlying format

(apologies for the comment spam)
Comment 3 Ryan C. Gordon 2020-04-13 18:50:11 UTC
This patch is now https://hg.libsdl.org/SDL/rev/877c5d06c09e, thanks!

--ryan.