Hyprland Tearing Control for Gaming: How Low-Latency Rendering Works
Hyprland prevents screen tearing by default and exposes a tearing control Wayland protocol that lets applications request asynchronous presentation when the compositor, monitor, and window all permit it.
Hyprland tearing control for gaming provides a flexible, standards-compliant pipeline for reducing input latency in fast-paced titles. As implemented in the hyprwm/Hyprland source code, the compositor defaults to a tear-free VSync-locked path and exposes per-monitor and per-window toggles that games can use to request asynchronous buffer swaps. Understanding how the CTearingControl protocol, monitor state checks, and configuration options interact is essential for optimizing frame delivery on a Hyprland desktop.
How the Tearing Control Pipeline Works
The tearing pipeline in Hyprland is evaluated every frame and spans several components across the codebase. It begins with a global user setting, proceeds through monitor capability checks, and ends with a per-window presentation hint that determines whether the renderer waits for VSync.
Per-Monitor Tearing State
In src/output/Monitor.hpp, Hyprland stores tearing state directly on each CMonitor instance through three boolean fields: canTear, nextRenderTorn, and activelyTearing.
canTearindicates whether the monitor’s DRM backend supports asynchronous page flips.nextRenderTorntracks whether a frame was already scheduled while the monitor is busy.activelyTearingsignals whether tearing is currently active for the current render cycle.
These fields provide the compositor with a concise, per-output view of whether tearing is legally possible at any given moment.
The Central Gate: isTearingBlocked
In src/output/Monitor.cpp, the CMonitor::isTearingBlocked method acts as the central gatekeeper for every tearing commit. The function enumerates all conditions that would block a tear, including the user disabling the feature globally, a monitor zoom factor not equal to one, a backend that lacks DRM tearing support, the presence of a hardware cursor, and solitary window states.
If any blocker is present, the method returns true and the compositor falls back to the normal VSync-locked render path, guaranteeing no visual artifacts.
Frame Scheduling with updateTearing
Each frame, Hyprland invokes CMonitor::updateTearing in src/output/Monitor.cpp to re-evaluate the tearing block list via isTearingBlocked(). When no blockers are present, the method sets activelyTearing to true and clears nextRenderTorn, signaling the renderer to swap buffers without waiting for the next VBlank. This asynchronous presentation is what delivers the lower latency that many competitive gaming scenarios demand.
The Wayland Tearing Control Protocol
Hyprland implements the wp_tearing_control_v1 Wayland protocol so that clients can explicitly opt into asynchronous presentation rather than relying on global behavior alone.
Client Hints and CTearingControl
The CTearingControl class, declared in src/protocols/TearingControl.hpp and implemented in src/protocols/TearingControl.cpp, handles the server side of the protocol. When a game or other client sends WP_TEARING_CONTROL_V1_PRESENTATION_HINT_ASYNC, the CTearingControl::onHint handler records that preference and updates the target CWindow’s m_tearingHint field.
This per-window hint lets the compositor decide tearing on a per-surface basis, keeping the global policy intact while allowing individual applications to request lower-latency rendering.
Window Rules and Overrides
Users can override protocol-level hints through Hyprland’s window rule system. In src/desktop/view/Window.cpp, the compositor reads the global configuration and any matching window rule to determine the final tearing state for a surface. This design means an administrator can leave tearing disabled globally while still forcing it for a specific game, or override a misbehaving client that requests tearing inappropriately.
Enabling Tearing in Your Hyprland Configuration
Before any window can tear, the master toggle must be enabled. The boolean option general:allow_tearing is declared in src/config/values/ConfigValues.cpp and defaults to false, which means the entire tearing pipeline is inactive unless explicitly switched on.
The sample configuration in example/hyprland.lua demonstrates the syntax:
-- ~/.config/hypr/hyprland.conf or hyprland.lua
general = {
allow_tearing = true,
}
After enabling the global switch, games that support the protocol can request asynchronous presentation at runtime. Developers can also request tearing from a Wayland client in C:
struct wp_tearing_control_v1 *tc = wp_tearing_control_manager_v1_get_tearing_control(
manager, surface, 0);
wp_tearing_control_v1_set_presentation_hint(
tc, WP_TEARING_CONTROL_V1_PRESENTATION_HINT_ASYNC);
If a game does not natively support the protocol, you can force tearing for that window alone by using a window rule in your configuration:
windowrule = ,tear,true
When all conditions pass and activelyTearing is true, the renderer swaps buffers without waiting for VSync. If any step in the chain fails, Hyprland immediately reverts to the tear-free VSync-locked path.
Summary
- Hyprland tearing control for gaming is governed by the
general:allow_tearingmaster toggle declared insrc/config/values/ConfigValues.cpp; it defaults to false. - Per-monitor tearing capability and active state are tracked in
src/output/Monitor.hppand updated each frame byCMonitor::updateTearinginsrc/output/Monitor.cpp. CMonitor::isTearingBlockedinsrc/output/Monitor.cppenforces gatekeeper checks such as zoom factor, hardware cursor presence, and DRM backend support.- The
CTearingControlprotocol insrc/protocols/TearingControl.hppandsrc/protocols/TearingControl.cpptranslatesWP_TEARING_CONTROL_V1_PRESENTATION_HINT_ASYNCclient hints into per-windowm_tearingHintvalues. - Window rules in
src/desktop/view/Window.cppallow users to override protocol hints and force tearing for specific game windows.
Frequently Asked Questions
What is Hyprland tearing control for gaming?
Hyprland tearing control for gaming is a Wayland protocol implementation that lets applications request asynchronous buffer presentation to reduce input latency. According to the hyprwm/Hyprland source code, the compositor defaults to a tear-free VSync path and only permits tearing when the global allow_tearing option is true, the monitor supports it, and the window sends an async hint.
How do I enable tearing in Hyprland?
Set general = { allow_tearing = true } in your hyprland.conf or Lua configuration file, as shown in example/hyprland.lua. This master toggle, declared in src/config/values/ConfigValues.cpp, is required before any monitor or window can enter a tearing state.
Why is tearing blocked even after I enable it?
If CMonitor::isTearingBlocked in src/output/Monitor.cpp detects an unsupported zoom factor, a hardware cursor, a solitary window layout, or a monitor lacking DRM tearing support, it forces the compositor back to the VSync-locked path. Verify that your display backend reports canTear = true and that no external blockers are active.
Can I force tearing for a specific game window without a global setting?
You must enable the global allow_tearing switch first because the master toggle activates the entire tearing pipeline. Once enabled, you can force tearing on a per-window basis by adding windowrule = ,tear,true to your configuration; this rule is evaluated in src/desktop/view/Window.cpp and overrides the default protocol hint for that surface.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →