Skip to content

Reduce GPU usage by activating VRR optimization only during high-rate input#45369

Merged
as-cii merged 2 commits intomainfrom
lower-gpu-usage
Dec 19, 2025
Merged

Reduce GPU usage by activating VRR optimization only during high-rate input#45369
as-cii merged 2 commits intomainfrom
lower-gpu-usage

Conversation

@as-cii
Copy link
Member

@as-cii as-cii commented Dec 19, 2025

Fixes #29073

This PR reduces unnecessary GPU usage by being more selective about when we present frames to prevent display underclocking (VRR optimization).

Problem

Previously, we would keep presenting frames for 1 second after any input event, regardless of whether it triggered a re-render. This caused unnecessary GPU work when the user was idle or during low-frequency interactions.

Solution

  1. Only track input that triggers re-renders: We now only record input timestamps when the input actually causes the window to become dirty, rather than on every input event.

  2. Rate-based activation: The VRR optimization now only activates when input arrives at a high rate (≥ 60fps over the last 100ms). This means casual mouse movements or occasional keystrokes won't trigger continuous frame presentation.

  3. Sustained optimization: Once high-rate input is detected (e.g., during scrolling or dragging), we sustain frame presentation for 1 second to prevent display underclocking, even if input briefly pauses.

Implementation

Added InputRateTracker which:

  • Tracks input timestamps in a 100ms sliding window
  • Activates when the window contains ≥ 6 events (60fps × 0.1s)
  • Extends a sustain_until timestamp by 1 second each time high rate is detected

Release Notes:

  • Reduced GPU usage when idle by only presenting frames during bursts of high-frequency input.

Only activate the variable refresh rate optimization when input arrives
at a high rate (>= 60fps over the last 100ms). Once activated, sustain
the optimization for 1 second to prevent display underclocking during
active input.
@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 19, 2025
@as-cii as-cii changed the title Lower gpu usage Reduce GPU usage by activating VRR optimization only during high-rate input Dec 19, 2025
@as-cii as-cii merged commit b603372 into main Dec 19, 2025
26 checks passed
@as-cii as-cii deleted the lower-gpu-usage branch December 19, 2025 15:06
rtfeldman pushed a commit that referenced this pull request Jan 5, 2026
… input (#45369)

Fixes #29073

This PR reduces unnecessary GPU usage by being more selective about when
we present frames to prevent display underclocking (VRR optimization).

## Problem

Previously, we would keep presenting frames for 1 second after *any*
input event, regardless of whether it triggered a re-render. This caused
unnecessary GPU work when the user was idle or during low-frequency
interactions.

## Solution

1. **Only track input that triggers re-renders**: We now only record
input timestamps when the input actually causes the window to become
dirty, rather than on every input event.

2. **Rate-based activation**: The VRR optimization now only activates
when input arrives at a high rate (≥ 60fps over the last 100ms). This
means casual mouse movements or occasional keystrokes won't trigger
continuous frame presentation.

3. **Sustained optimization**: Once high-rate input is detected (e.g.,
during scrolling or dragging), we sustain frame presentation for 1
second to prevent display underclocking, even if input briefly pauses.

## Implementation

Added `InputRateTracker` which:
- Tracks input timestamps in a 100ms sliding window
- Activates when the window contains ≥ 6 events (60fps × 0.1s)
- Extends a `sustain_until` timestamp by 1 second each time high rate is
detected

Release Notes:

- Reduced GPU usage when idle by only presenting frames during bursts of
high-frequency input.
@github-project-automation github-project-automation bot moved this from Community PRs to Done in Quality Week – December 2025 Jan 8, 2026
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
… input (zed-industries#45369)

Fixes zed-industries#29073

This PR reduces unnecessary GPU usage by being more selective about when
we present frames to prevent display underclocking (VRR optimization).

## Problem

Previously, we would keep presenting frames for 1 second after *any*
input event, regardless of whether it triggered a re-render. This caused
unnecessary GPU work when the user was idle or during low-frequency
interactions.

## Solution

1. **Only track input that triggers re-renders**: We now only record
input timestamps when the input actually causes the window to become
dirty, rather than on every input event.

2. **Rate-based activation**: The VRR optimization now only activates
when input arrives at a high rate (≥ 60fps over the last 100ms). This
means casual mouse movements or occasional keystrokes won't trigger
continuous frame presentation.

3. **Sustained optimization**: Once high-rate input is detected (e.g.,
during scrolling or dragging), we sustain frame presentation for 1
second to prevent display underclocking, even if input briefly pauses.

## Implementation

Added `InputRateTracker` which:
- Tracks input timestamps in a 100ms sliding window
- Activates when the window contains ≥ 6 events (60fps × 0.1s)
- Extends a `sustain_until` timestamp by 1 second each time high rate is
detected

Release Notes:

- Reduced GPU usage when idle by only presenting frames during bursts of
high-frequency input.
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Jan 20, 2026
… input (zed-industries#45369)

Fixes zed-industries#29073

This PR reduces unnecessary GPU usage by being more selective about when
we present frames to prevent display underclocking (VRR optimization).

## Problem

Previously, we would keep presenting frames for 1 second after *any*
input event, regardless of whether it triggered a re-render. This caused
unnecessary GPU work when the user was idle or during low-frequency
interactions.

## Solution

1. **Only track input that triggers re-renders**: We now only record
input timestamps when the input actually causes the window to become
dirty, rather than on every input event.

2. **Rate-based activation**: The VRR optimization now only activates
when input arrives at a high rate (≥ 60fps over the last 100ms). This
means casual mouse movements or occasional keystrokes won't trigger
continuous frame presentation.

3. **Sustained optimization**: Once high-rate input is detected (e.g.,
during scrolling or dragging), we sustain frame presentation for 1
second to prevent display underclocking, even if input briefly pauses.

## Implementation

Added `InputRateTracker` which:
- Tracks input timestamps in a 100ms sliding window
- Activates when the window contains ≥ 6 events (60fps × 0.1s)
- Extends a `sustain_until` timestamp by 1 second each time high rate is
detected

Release Notes:

- Reduced GPU usage when idle by only presenting frames during bursts of
high-frequency input.
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Feb 15, 2026
… input (zed-industries#45369)

Fixes zed-industries#29073

This PR reduces unnecessary GPU usage by being more selective about when
we present frames to prevent display underclocking (VRR optimization).

## Problem

Previously, we would keep presenting frames for 1 second after *any*
input event, regardless of whether it triggered a re-render. This caused
unnecessary GPU work when the user was idle or during low-frequency
interactions.

## Solution

1. **Only track input that triggers re-renders**: We now only record
input timestamps when the input actually causes the window to become
dirty, rather than on every input event.

2. **Rate-based activation**: The VRR optimization now only activates
when input arrives at a high rate (≥ 60fps over the last 100ms). This
means casual mouse movements or occasional keystrokes won't trigger
continuous frame presentation.

3. **Sustained optimization**: Once high-rate input is detected (e.g.,
during scrolling or dragging), we sustain frame presentation for 1
second to prevent display underclocking, even if input briefly pauses.

## Implementation

Added `InputRateTracker` which:
- Tracks input timestamps in a 100ms sliding window
- Activates when the window contains ≥ 6 events (60fps × 0.1s)
- Extends a `sustain_until` timestamp by 1 second each time high rate is
detected

Release Notes:

- Reduced GPU usage when idle by only presenting frames during bursts of
high-frequency input.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

Development

Successfully merging this pull request may close these issues.

Moving cursor in an active window significantly increases GPU usage

1 participant