tty: Move HDR property reset to session resume
Browse files at this commitdb32f52ce6627e246e49f58c3b5aea13e7ef1646Parent: 978aace1 changed file +11 -12
- src/backend/tty.rs +11 -12
src/backend/tty.rsmodified+11 -12
| @@ -466,6 +466,17 @@ impl Tty { | ||
| 466 | 466 | // Apply pending gamma changes and restore our existing gamma. |
| 467 | 467 | let device = self.devices.get_mut(&node).unwrap(); |
| 468 | 468 | for (crtc, surface) in device.surfaces.iter_mut() { |
| 469 | + if let Ok(props) = | |
| 470 | + ConnectorProperties::try_new(&device.drm, surface.connector) | |
| 471 | + { | |
| 472 | + match reset_hdr(&props) { | |
| 473 | + Ok(()) => (), | |
| 474 | + Err(err) => debug!("couldn't reset HDR properties: {err:?}"), | |
| 475 | + } | |
| 476 | + } else { | |
| 477 | + warn!("failed to get connector properties"); | |
| 478 | + }; | |
| 479 | + | |
| 469 | 480 | if let Some(ramp) = surface.pending_gamma_change.take() { |
| 470 | 481 | let ramp = ramp.as_deref(); |
| 471 | 482 | let res = if let Some(gamma_props) = &mut surface.gamma_props { |
| @@ -1977,18 +1988,6 @@ impl Tty { | ||
| 1977 | 1988 | continue; |
| 1978 | 1989 | } |
| 1979 | 1990 | |
| 1980 | - if let Ok(props) = ConnectorProperties::try_new(&device.drm, surface.connector) { | |
| 1981 | - match reset_hdr(&props) { | |
| 1982 | - Ok(()) => (), | |
| 1983 | - Err(err) => debug!( | |
| 1984 | - "output {:?}: couldn't reset HDR properties: {err:?}", | |
| 1985 | - surface.name.connector | |
| 1986 | - ), | |
| 1987 | - } | |
| 1988 | - } else { | |
| 1989 | - warn!("failed to get connector properties"); | |
| 1990 | - }; | |
| 1991 | - | |
| 1992 | 1991 | // Check if we need to change the mode. |
| 1993 | 1992 | let Some(connector) = device.drm_scanner.connectors().get(&surface.connector) |
| 1994 | 1993 | else { |