tty: Extract time and refresh_interval higher
Browse files at this commit8ef5cc2297c18063907ab1d4d690162b5a58e54dParent: 46308bb1 changed file +11 -6
- src/backend/tty.rs +11 -6
src/backend/tty.rsmodified+11 -6
| @@ -1625,6 +1625,14 @@ impl Tty { | ||
| 1625 | 1625 | return; |
| 1626 | 1626 | }; |
| 1627 | 1627 | |
| 1628 | + let refresh_interval = output_state.frame_clock.refresh_interval(); | |
| 1629 | + | |
| 1630 | + let time = if presentation_time.is_zero() { | |
| 1631 | + now | |
| 1632 | + } else { | |
| 1633 | + presentation_time | |
| 1634 | + }; | |
| 1635 | + | |
| 1628 | 1636 | let redraw_needed = match mem::replace(&mut output_state.redraw_state, RedrawState::Idle) { |
| 1629 | 1637 | RedrawState::WaitingForVBlank { redraw_needed } => redraw_needed, |
| 1630 | 1638 | state @ (RedrawState::Idle |
| @@ -1647,7 +1655,7 @@ impl Tty { | ||
| 1647 | 1655 | // Mark the last frame as submitted. |
| 1648 | 1656 | match surface.compositor.frame_submitted() { |
| 1649 | 1657 | Ok(Some((mut feedback, target_presentation_time))) => { |
| 1650 | - let refresh = match output_state.frame_clock.refresh_interval() { | |
| 1658 | + let refresh = match refresh_interval { | |
| 1651 | 1659 | Some(refresh) => { |
| 1652 | 1660 | if output_state.frame_clock.vrr() { |
| 1653 | 1661 | Refresh::Variable(refresh) |
| @@ -1663,12 +1671,9 @@ impl Tty { | ||
| 1663 | 1671 | let mut flags = wp_presentation_feedback::Kind::Vsync |
| 1664 | 1672 | | wp_presentation_feedback::Kind::HwCompletion; |
| 1665 | 1673 | |
| 1666 | - let time = if presentation_time.is_zero() { | |
| 1667 | - now | |
| 1668 | - } else { | |
| 1674 | + if !presentation_time.is_zero() { | |
| 1669 | 1675 | flags.insert(wp_presentation_feedback::Kind::HwClock); |
| 1670 | - presentation_time | |
| 1671 | - }; | |
| 1676 | + } | |
| 1672 | 1677 | |
| 1673 | 1678 | feedback.presented::<_, smithay::utils::Monotonic>(time, refresh, seq, flags); |
| 1674 | 1679 |