Skip to content

Improve UEFI GOP framebuffer mode selection - #585

Open
lava-404 wants to merge 6 commits into
rust-osdev:mainfrom
lava-404:fix/issue-534-gop-mode-selection
Open

lava-404 wants to merge 6 commits into
rust-osdev:mainfrom
lava-404:fix/issue-534-gop-mode-selection

Conversation

@lava-404

Copy link
Copy Markdown

Summary

  • Replace the order-dependent UEFI GOP framebuffer mode selection with a deterministic best-fit resolution selection algorithm.
  • Introduce configurable preferred framebuffer dimensions, defaulting to 1280×800 when no preference is specified.
  • Add maximum framebuffer width and height constraints.
  • Preserve existing minimum framebuffer dimension configuration.
  • Select the closest available resolution that satisfies the configured constraints.
  • Fall back to the highest available resolution within the maximum constraints when no mode satisfies the minimum requirements.
  • Add unit tests covering default selection, preferred resolutions, minimum and maximum constraints, fallback behavior, and unavailable modes.

Implementation Details

The new resolution selection logic is isolated in uefi/src/mode_selection.rs and integrated into the UEFI framebuffer initialization.

The selection algorithm:

  1. Filters out modes exceeding configured maximum dimensions.
  2. Finds the best-fitting mode based on distance from the target resolution while satisfying minimum dimensions.
  3. Falls back to the largest remaining valid mode if minimum constraints cannot be satisfied.

Preferred dimensions can be configured independently, allowing users to request arbitrary target resolutions without introducing predefined resolution presets.

Scope

This change addresses deterministic mode selection and framebuffer resolution configuration. Aspect-ratio filtering, predefined resolution presets, and EDID-based selection are intentionally left out of scope.

Closes/Addresses #534

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant