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 5470 - [KMSDRM] Windows with no matching video mode have wrong aspect ratio. Fix included.
Summary: [KMSDRM] Windows with no matching video mode have wrong aspect ratio. Fix inc...
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: 2.0.15
Hardware: All Linux
: P2 normal
Assignee: Manuel Alfayate Corchete
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-16 23:02 UTC by Manuel Alfayate Corchete
Modified: 2021-01-17 20:18 UTC (History)
0 users

See Also:


Attachments
Fix for FULLSCREEN windows so they look right even if no matching videomode is found. (8.04 KB, patch)
2021-01-16 23:02 UTC, Manuel Alfayate Corchete
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Manuel Alfayate Corchete 2021-01-16 23:02:33 UTC
Created attachment 4673 [details]
Fix for FULLSCREEN windows so they look right even if no matching videomode is found.

Hi there,

INTRO: In KMSDRM, SDL_WINDOW_FULLSCREEN windows are shown fullscreen by changing the videomode in the card connector, thus filling the screen to the area that permits their aspect ratio. (No, using PLANES for this is not an option because it breaks compatibility with a lot of hardware).

SMALL PROBLEM: I noticed that games using SDL_WINDOW_FULLSCREEN windows with sizes not having an exact matching mode are shown with the wrong ratio because, until now, I was trying to select an exact resolution, instead of the closest one.

THE SOLUTION: Select a close resolution, instead of an exactly matching one. That way, FULLSCREEN windows are shown as expected, even if they have absurd or obsolete resolutions not supported by the physical display.

That is what this patch does. Please review so I can merge it. Thanks.
Comment 1 Sam Lantinga 2021-01-17 18:09:51 UTC
This patch looks good, commit approved.

In general please put else on the same line as the previous brace to match the rest of the SDL coding style.

e.g.
if ( true ) {
    ...
} else {
    ...
}

Thanks!
Comment 2 Sam Lantinga 2021-01-17 18:10:43 UTC
Also, when you commit this, please reference the bug number so we have historical data on why the change was made, along with any relevant discussion.

Thanks!
Comment 3 Manuel Alfayate Corchete 2021-01-17 20:18:33 UTC
Ok, commit done. Closing this. Thanks!