[PR #3461] [MERGED] HDR: Auto Paper White and Peak Brightness, from what the compositor reports #4995

Closed
opened 2026-11-03 05:09:28 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/3461
Author: @senjinthedragon
Created: 10/29/2026
Status: ✅ Merged
Merged: 10/29/2026
Merged by: @levzzz5154

Base: main ← Head: hdr-wayland


📝 Commits (10+)

  • 8ebcf6c WIP HDR: ask the compositor for the window's luminances (log only)
  • dc418c7 HDR: Auto peak brightness from what the compositor reports
  • 7ef092f HDR: Auto paper white, at the desktop's SDR white
  • 31ead52 HDR: follow the compositor's changes while the game runs
  • 25e00a0 Merge remote-tracking branch 'origin/main' into hdr-wayland
  • 8202f02 HDR: log what the compositor reports once per change
  • cd70f51 HDR Auto: what Hyprland 0.57 reports, in the docs and the code comment
  • a0964a8 Merge remote-tracking branch 'origin/main' into hdr-wayland
  • fe47804 Merge main into hdr-wayland: display_changed beside main's TAA set_world_post
  • 20a3c3e Merge main, #3176 and #3203 into hdr-wayland: Auto beside Black Level and UI Brightness

📊 Changes

10 files changed (+479 additions, -18 deletions)

View changed files

📝 Cargo.lock (+3 -0)
📝 crates/horizon-client-render/src/gfx.rs (+129 -0)
📝 crates/horizon-client-render/src/graphics.rs (+66 -7)
📝 crates/horizon-client-render/src/graphics_ui.rs (+35 -8)
📝 crates/horizon-client/src/game.rs (+3 -0)
📝 crates/horizon-client/src/game/options.rs (+2 -2)
📝 crates/horizon-hdr/Cargo.toml (+6 -0)
📝 crates/horizon-hdr/src/lib.rs (+3 -0)
➕ crates/horizon-hdr/src/wayland.rs (+231 -0)
📝 docs/graphics.md (+1 -1)

📄 Description

🤖 Opened by Senjin's AI agent (Claude Code), not by Senjin.

What and why

Follows #2021, part of #1441. Paper White and Peak Brightness are numbers most players can't know: the box of a
display rarely says its real peak, and the right paper white depends on the desktop it sits next to. On Linux the
compositor already knows both. KWin even says so: its developer asks applications to read the compositor's
preferred image description instead of keeping HDR settings of their own
(On brightness, and calibrating your displays).
Plasma has its own HDR calibration, and KWin reports what the player set there.

  • Paper White and Peak Brightness get an Auto step, and Auto is the default. It's the lowest step of each
    slider ("Auto (500 nits)"); the numbers above it stay as they were. A value someone already saved stays theirs.
  • Where the values come from: on Wayland, horizon-hdr's new wayland.rs asks for the window surface's
    preferred image description (wp_color_management_v1: surface feedback, get_preferred, get_information). It
    runs on winit's own connection, on an event queue of its own, so winit's events are left alone.
  • In HDR output's scale: KWin maps content's reference white (203 nits in PQ, BT.2408) onto its own, so Auto
    puts Paper White at 203 (the desktop's white) and Peak Brightness at the target's maximum times 203 over the
    reference. On my display KWin reports reference 430 and 0.005..1060 nits, so Auto lands on 500, the peak I had
    found by testing. The peak is kept within 200..10 000, so the HDR metadata never ends below the black level (a
    minimum at or above the maximum makes KWin drop the client, see ValveSoftware/Proton#9672).
  • It follows changes while the game runs. The renderer keeps the surface feedback and looks at it every frame
    (only events winit's loop already read; no waiting). On preferred_changed it asks again and the settings are
    applied again, so moving the window to another output, or recalibrating the desktop, applies at once.
  • Where nothing is reported (X11, Windows and macOS for now, a compositor without the protocol), Auto is 203
    and 1000 nits, as the defaults were.
  • New dependencies of horizon-hdr on Linux: wayland-backend (client_system), wayland-client and
    wayland-protocols (staging). All three were already in Cargo.lock through winit; the lock only gains the
    three edges.

What's checked, and what isn't. Tested on KWin 6 (Plasma, NVIDIA, an AW3423DW): the reported values, Auto, and
the live update when Plasma's HDR brightness changes. Mutter and wlroots compositors also implement
wp_color_management_v1, but I haven't checked that they map reference white the way KWin does; if one doesn't,
Auto would be off there, and the log line below says what it got:

Horizon renderer: the compositor shows this window with reference white 430 nits, 0.005..1060 nits: peak 500 nits in HDR output's scale

Windows (DXGI's luminances and the SDR content brightness) and macOS (EDR headroom) can feed the same Auto later.

#3203 moves these sliders to their own screen; whichever of the two lands later, I'll update the other.

Vanilla reference

Horizon-only (Horizon's graphics settings). Vanilla's Video Settings are unchanged.

Self-check

pr_ready (tools/pr_ready.py --quick on 181936e305c3, against origin/main at 791d8b895, 2 min 39 s)

Check Result
Scope ✅ 10 files, +426 −19
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅
Python tests ✅ 408 passed (34 s)
rustfmt ✅ (8 s)
clippy ✅ (1 s)
tests: workspace ❌ 1984 passed, 1 failed (1 min 47 s)
doc tests ✅ 2 passed (4 s)
content root tests ✅ 5 passed
launcher rustfmt ✅ (1 s)
launcher clippy ✅ (1 s)
launcher tests ✅ 245 passed (3 s)
Parity ➖ 348 affected, to run in CI (--quick)

The one failure is horizon-server's lists::tests::edits_the_lists_while_stopped, which looks up a Minecraft
account online; my checks run without network. Unrelated to this change.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/3461 **Author:** [@senjinthedragon](https://github.com/senjinthedragon) **Created:** 10/29/2026 **Status:** ✅ Merged **Merged:** 10/29/2026 **Merged by:** [@levzzz5154](https://github.com/levzzz5154) **Base:** `main` ← **Head:** `hdr-wayland` --- ### 📝 Commits (10+) - [`8ebcf6c`](https://github.com/horizon-rust/horizon/commit/8ebcf6c13d33350c66f7a53b66ef52101138d253) WIP HDR: ask the compositor for the window's luminances (log only) - [`dc418c7`](https://github.com/horizon-rust/horizon/commit/dc418c762399a9c524990522df24047b8b398b5d) HDR: Auto peak brightness from what the compositor reports - [`7ef092f`](https://github.com/horizon-rust/horizon/commit/7ef092fabcfe607eb49b9e0d68ec8306fda0c08e) HDR: Auto paper white, at the desktop's SDR white - [`31ead52`](https://github.com/horizon-rust/horizon/commit/31ead52d21c57e7d8300f566653a1a61dc6a180f) HDR: follow the compositor's changes while the game runs - [`25e00a0`](https://github.com/horizon-rust/horizon/commit/25e00a0ecf35846fc7350db19ce3885f1b57d968) Merge remote-tracking branch 'origin/main' into hdr-wayland - [`8202f02`](https://github.com/horizon-rust/horizon/commit/8202f02f4e6faa752e10342ee609a0143a5210d1) HDR: log what the compositor reports once per change - [`cd70f51`](https://github.com/horizon-rust/horizon/commit/cd70f518e9b2fc3ec8659873548e66627b93d97d) HDR Auto: what Hyprland 0.57 reports, in the docs and the code comment - [`a0964a8`](https://github.com/horizon-rust/horizon/commit/a0964a80104fbb4b12de35f4773d06339fb56299) Merge remote-tracking branch 'origin/main' into hdr-wayland - [`fe47804`](https://github.com/horizon-rust/horizon/commit/fe47804f2840c35fab89041db2f602b115067053) Merge main into hdr-wayland: display_changed beside main's TAA set_world_post - [`20a3c3e`](https://github.com/horizon-rust/horizon/commit/20a3c3e3997f586d60958a2b1be201fd27a2047d) Merge main, #3176 and #3203 into hdr-wayland: Auto beside Black Level and UI Brightness ### 📊 Changes **10 files changed** (+479 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+3 -0) 📝 `crates/horizon-client-render/src/gfx.rs` (+129 -0) 📝 `crates/horizon-client-render/src/graphics.rs` (+66 -7) 📝 `crates/horizon-client-render/src/graphics_ui.rs` (+35 -8) 📝 `crates/horizon-client/src/game.rs` (+3 -0) 📝 `crates/horizon-client/src/game/options.rs` (+2 -2) 📝 `crates/horizon-hdr/Cargo.toml` (+6 -0) 📝 `crates/horizon-hdr/src/lib.rs` (+3 -0) ➕ `crates/horizon-hdr/src/wayland.rs` (+231 -0) 📝 `docs/graphics.md` (+1 -1) </details> ### 📄 Description > 🤖 Opened by Senjin's AI agent (Claude Code), not by Senjin. ## What and why Follows #2021, part of #1441. Paper White and Peak Brightness are numbers most players can't know: the box of a display rarely says its real peak, and the right paper white depends on the desktop it sits next to. On Linux the compositor already knows both. KWin even says so: its developer asks applications to read the compositor's preferred image description instead of keeping HDR settings of their own ([On brightness, and calibrating your displays](https://planet.kde.org/xavers-blog-2025-03-31-on-brightness-and-calibrating-your-displays/)). Plasma has its own HDR calibration, and KWin reports what the player set there. - **Paper White and Peak Brightness get an Auto step, and Auto is the default.** It's the lowest step of each slider ("Auto (500 nits)"); the numbers above it stay as they were. A value someone already saved stays theirs. - **Where the values come from:** on Wayland, `horizon-hdr`'s new `wayland.rs` asks for the window surface's preferred image description (`wp_color_management_v1`: surface feedback, `get_preferred`, `get_information`). It runs on winit's own connection, on an event queue of its own, so winit's events are left alone. - **In HDR output's scale:** KWin maps content's reference white (203 nits in PQ, BT.2408) onto its own, so Auto puts Paper White at 203 (the desktop's white) and Peak Brightness at the target's maximum times 203 over the reference. On my display KWin reports reference 430 and 0.005..1060 nits, so Auto lands on 500, the peak I had found by testing. The peak is kept within 200..10 000, so the HDR metadata never ends below the black level (a minimum at or above the maximum makes KWin drop the client, see ValveSoftware/Proton#9672). - **It follows changes while the game runs.** The renderer keeps the surface feedback and looks at it every frame (only events winit's loop already read; no waiting). On `preferred_changed` it asks again and the settings are applied again, so moving the window to another output, or recalibrating the desktop, applies at once. - **Where nothing is reported** (X11, Windows and macOS for now, a compositor without the protocol), Auto is 203 and 1000 nits, as the defaults were. - New dependencies of `horizon-hdr` on Linux: `wayland-backend` (`client_system`), `wayland-client` and `wayland-protocols` (`staging`). All three were already in Cargo.lock through winit; the lock only gains the three edges. **What's checked, and what isn't.** Tested on KWin 6 (Plasma, NVIDIA, an AW3423DW): the reported values, Auto, and the live update when Plasma's HDR brightness changes. Mutter and wlroots compositors also implement `wp_color_management_v1`, but I haven't checked that they map reference white the way KWin does; if one doesn't, Auto would be off there, and the log line below says what it got: ``` Horizon renderer: the compositor shows this window with reference white 430 nits, 0.005..1060 nits: peak 500 nits in HDR output's scale ``` Windows (DXGI's luminances and the SDR content brightness) and macOS (EDR headroom) can feed the same Auto later. #3203 moves these sliders to their own screen; whichever of the two lands later, I'll update the other. ## Vanilla reference Horizon-only (Horizon's graphics settings). Vanilla's Video Settings are unchanged. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on 181936e305c3, against origin/main at 791d8b895, 2 min 39 s) | Check | Result | | --- | --- | | Scope | ✅ 10 files, +426 −19 | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ | | Python tests | ✅ 408 passed (34 s) | | rustfmt | ✅ (8 s) | | clippy | ✅ (1 s) | | tests: workspace | ❌ 1984 passed, 1 failed (1 min 47 s) | | doc tests | ✅ 2 passed (4 s) | | content root tests | ✅ 5 passed | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ✅ (1 s) | | launcher tests | ✅ 245 passed (3 s) | | Parity | ➖ 348 affected, to run in CI (--quick) | The one failure is `horizon-server`'s `lists::tests::edits_the_lists_while_stopped`, which looks up a Minecraft account online; my checks run without network. Unrelated to this change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 05:09:28 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4995
No description provided.