DRMBackend: Carry pending mode to composite path when direct scanout fails#2135
Open
nfraprado wants to merge 1 commit into
Open
Conversation
…fails
CDRMBackend::Present first attempts to do direct scanout and if that
fails it falls back to full compositing. In the case that direct scanout
configuration fails, in drm_prepare(), drm_rollback() is called, which
overwrites drm->pending with drm->current, discarding any pending mode
if there was one, which will now not be applied as part of the full
composite commit.
In other words, if for some reason no working direct scanout
configuration can be found, no display mode changes will be applied.
Fix this by saving pending.mode_id before the direct scanout
drm_prepare() attempt and restoring it on failure when needs_modeset
is set.
This was observed on the SteamDeck OLED when displaying an application
with resolution 3840x2160 to the internal display, which requires a
greater scaling ratio than what the kernel commit abc0ad6d0844
("drm/amd/display: Limit Scaling Ratio on DCN3.01") [1] allows,
resulting in the atomic check failing for the direct scanout path. Under
these circumstances, the application is always composited, but only when
the "Force Composite" setting is enabled do changes in the panel
frequency take effect, since only in that case is direct scanout not
even attempted.
[1] torvalds/linux@abc0ad6
Assisted-by: Claude:claude-sonnet-4.6
Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
|
Wouldn't it be cleaner to encapsulate that logic in |
Author
|
@oSoMoN The problem with that is that there are 3 calls to |
|
That makes sense, and I now realize that this was already quite clearly explained in the description. Not actually tested, but the change looks sensible to me. |
oSoMoN
approved these changes
May 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
CDRMBackend::Present first attempts to do direct scanout and if that fails it falls back to full compositing. In the case that direct scanout configuration fails, in drm_prepare(), drm_rollback() is called, which overwrites drm->pending with drm->current, discarding any pending mode if there was one, which will now not be applied as part of the full composite commit.
In other words, if for some reason no working direct scanout configuration can be found, no display mode changes will be applied.
Fix this by saving pending.mode_id before the direct scanout drm_prepare() attempt and restoring it on failure when needs_modeset is set.
This was observed on the SteamDeck OLED when displaying an application with resolution 3840x2160 to the internal display, which requires a greater scaling ratio than what the kernel commit abc0ad6d0844 ("drm/amd/display: Limit Scaling Ratio on DCN3.01") [1] allows, resulting in the atomic check failing for the direct scanout path. Under these circumstances, the application is always composited, but only when the "Force Composite" setting is enabled do changes in the panel frequency take effect, since only in that case is direct scanout not even attempted.
[1] torvalds/linux@abc0ad6
Assisted-by: Claude:claude-sonnet-4.6