Repository navigation
drm/virtio: validate host modes and keep the console scanout - #124
Merged
Merged
Conversation
The connector published whatever the host returned: a short or failed EDID read was treated as an absent display, mode sizes were trusted up to unbounded values, and the initial modeset only walked the connector mode list in registration order, so a bogus host mode could be picked over the monitor's preferred one. Validate the EDID reply before parsing it, keep the EDID modes for the boot chain with the preferred timing first, reject host scanout geometry outside 0..8192, and order the initial modeset by EDID preferred, remaining EDID modes, host scanout modes, the bootloader geometry and finally the configured default. The plane atomic check rejects modes and layouts the 2D scanout cannot scale or address, and a failed initial modeset now fails KMS init instead of leaving a half-configured pipeline. Signed-off-by: MicroFish <2609948707@qq.com>
Closing the last DRM client disabled the host scanout even though the kernel console still draws into that framebuffer, leaving the display blank until another modeset or flip put a scanout back. The close path now clears the client cursor and flips the console framebuffer back onto the scanout instead of disabling it. Pin the console framebuffer at the initial modeset so rmfb cannot free the buffer the console draws into, detach the console flush hooks when KMS is torn down, and let a console flush reclaim the scanout if a client flipped its own buffer onto it. A dirty update from the committed primary framebuffer also takes the scanout back, and the flip error paths report which step failed. Signed-off-by: MicroFish <2609948707@qq.com>
The control and cursor wait loops took the wait-queue path whenever the scheduler was up, even when interrupts were disabled or the completion IRQ was unavailable. The timed wait then has no timer tick or completion IRQ left to wake it, so the caller can sleep with no wakeup event instead of polling the queue. Only defer to the wait queue when the timer tick and the completion IRQ can both run, and only yield between polls in that state; otherwise keep polling to the deadline. Each log reason also declared a static ratelimit state with the same name in the same switch scope, which is a redefinition. Give every reason its own state so the file builds with the driver enabled and each failure keeps its own log budget. Signed-off-by: MicroFish <2609948707@qq.com>
FengHeting
force-pushed
the
fix/drm-virtio
branch
from
November 2, 2026 20:12
c38a8a3 to
a5eacf9
Compare
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.
Summary
rmfbcannot free it, the flush hooks detach when KMS is torn down, and a console flush or a dirty update from the committed primary takes the scanout back if a client flipped its own buffer. Flip error paths report which step failed.virtgpu_vq.cfail to build withCONFIG_VIRTIO_GPU=y.Dependencies
Stacked on the
drmcore PR: its three commits appear in this branch until that PR merges, after which this PR reduces to the three virtio commits.Testing
Builds with
CONFIG_VIRTIO=y,CONFIG_VIRTIO_PCI=yandCONFIG_VIRTIO_GPU=y.