[wayland] Treat monitor physical width/height of 0 as invalid #25135
+3
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This change prevents Kodi from using a physical size of the output where one of the dimensions is 0. Otherwise, we risk dividing by 0 e.g. in
COutput::GetPixelRatioForMode()
.Motivation and context
On my laptop, KWin reports the physical size of the built-in display as 790x0 mm. Kodi currently accepts such dimensions (it only checks for negative values) and it must lead to some bogus calculations down the road, as evidenced by corrupted rendering of images (see screenshot). The screenshot comes from my distro's Kodi package -- when I build Kodi myself (debug and release), it immediately crashes on a failed assertion (see below).
How has this been tested?
Without this PR, both debug and release builds of both master and Omega branches crash on a failed assertion:
With this PR, both debug and release builds of both master and Omega branches no longer crash due to the assertion and don't show the glitches.
What is the effect on users?
This change affects users whose Wayland compositor reports a monitor physical size with exactly 1 dimension equal to 0. For those users, this change should reduce rendering artifacts.
Screenshots (if appropriate):
Types of change
Checklist: