Fix: Display Output config being applied to wrong output#2020
Fix: Display Output config being applied to wrong output#2020stoorps wants to merge 2 commits intopop-os:masterfrom
Conversation
| // Backward-compatible lookup: older `outputs.ron` files won't have `serial_number`. | ||
| // If a strict match fails, retry with serial numbers ignored. | ||
| // This prevents bricking a users config and resetting to default. | ||
| let mut used_fallback_key = false; | ||
| let mut infos_key = infos.clone(); | ||
| let mut configs_ref_opt = outputs_config.config.get(&infos); | ||
| if configs_ref_opt.is_none() { | ||
| let mut infos_no_serial = infos.clone(); | ||
| for info in &mut infos_no_serial { | ||
| info.serial_number = None; | ||
| } | ||
| infos_no_serial.sort(); | ||
| if let Some(cfgs) = outputs_config.config.get(&infos_no_serial) { | ||
| infos_key = infos_no_serial; | ||
| configs_ref_opt = Some(cfgs); | ||
| used_fallback_key = true; | ||
| } | ||
| } |
There was a problem hiding this comment.
Optional backwards compatibility. Can be removed and a default display configuration will be created.
|
|
||
| // One-time migration: if we only found a config by ignoring serial numbers, | ||
| // persist the now-known serial-aware key and remove the old key. | ||
| if used_fallback_key && applied_config_ok { | ||
| let mut outputs_mut = self.dynamic_conf.outputs_mut(); | ||
| outputs_mut.config.remove(&infos_key); | ||
| } |
There was a problem hiding this comment.
Optional backwards compatibility. Can be removed and a default display configuration will be created.
I have a pair of Viewsonic monitors that report the same serial number, but can be distinguished by manufacture date. So I don't think comparing just serial number will work. We should compare all the EDID info. We already have an (KDE, for comparison, just MD5 hashes the whole EDID data, and compares that, which serves the same purpose.) |
|
Apologies @hojjatabdollahi! I didn't see your PR otherwise I wouldn't have submitted mine. @ids1024 That is a strange thing for them to do, it kind of defeats the purpose of a serial 😆 I'll close this and my cosmic-randr change down now. I'm on the popos mattermost under the same user if you want anything :) |
Problem
Displays of the same make & model can confuse cosmic-randr & cosmic-comp, leading to the wrong configuration being applied. This presents as one display's rotation, scaling, position, etc. being applied to another. This occurs (at least in my experience) on ~50% of boots & re-connections of outputs.
Cause
The order of Display adapters is not guaranteed upon boot/connection, and therefore the names that are derived from this order (eg.
DP-1orHDMI-2) are not actually tied to a physical port, and can switch.Solution
When restoring configuration from KDL, try to match via
output.serial_numberfirst, and fallback to name matching if serials are not present.Changes
serial_numbertooutputs.ronconfigurationoutputs.ronfilesDependencies
Test Plan
serial-number)Outstanding Decisions
There is a decision to make around backwards compatibility. Do we:
outputs.ronfiles, meaning that users facing this issue will have to change/delete their display config for the fix to have any effectI have opted for option 1 at the moment (see suggestion in mod.rs), but will defer to maintainers to make the final decision.