Tearing control
对于游戏或绘图板等用例,通过使用异步页面翻转(page flip)接受撕裂以降低延迟是有意义的。该全局对象是一个工厂接口,允许客户端通知其 surface 内容适合哪种类型的呈现。
像 EGL 或 Vulkan 这样自行管理 buffer 队列和 wl_surface 提交的图形 API,很可能会在内部使用此扩展。如果客户端正在为 wl_surface 使用这样的 API,则不应直接在该 surface 上使用此扩展,以避免引发 tearing_control_exists 协议错误。
警告!本文件中描述的协议目前处于测试阶段。向后兼容的更改可能会与相应的接口版本提升一起添加。向后不兼容的更改只能通过创建扩展的新主版本来完成。
destroy()
销毁此撕裂控制工厂对象。其他对象,包括由此工厂创建的 wp_tearing_control_v1 对象,不受此请求的影响。
get_tearing_control(id: new_id<wp_tearing_control_v1>, surface: object<wl_surface>)
参数 | 类型 | 描述 |
|---|---|---|
| id | new_id<wp_tearing_control_v1> | |
| surface | object<wl_surface> |
为给定的 wl_surface 实例化一个接口扩展,以请求用于呈现的异步页面翻转。
如果给定的 wl_surface 已经关联了 wp_tearing_control_v1 对象,则引发 tearing_control_exists 协议错误。
error { tearing_control_exists }
参数 | 值 | 描述 |
|---|---|---|
| tearing_control_exists | 0 | surface 已经关联了撕裂对象 |
对 wl_surface 对象的一个附加接口,允许客户端向合成器(compositor)提示 surface 上的内容是否适合使用撕裂进行呈现。 默认的呈现提示是 vsync。有关更多详细信息,请参阅 presentation_hint。
如果关联的 wl_surface 被销毁,此对象将变得惰性(inert)并且应当被销毁。
set_presentation_hint(hint: uint<wp_tearing_control_v1.presentation_hint>)
参数 | 类型 | 描述 |
|---|---|---|
| hint | uint<wp_tearing_control_v1.presentation_hint> |
设置关联 wl_surface 的呈现提示。此状态是双缓冲的,请参阅 wl_surface.commit。
合成器可以自由地根据各种条件(如硬件功能、surface 状态和用户偏好)动态遵守或忽略此提示。
destroy()
销毁此 surface 撕裂对象并将呈现提示恢复为 vsync。该更改将在下一次 wl_surface.commit 时应用。
合成器支持
Cage | COSMIC | GameScope | Hyprland | Jay | KWin | Labwc | Louvre | Mir | Muffin | Mutter | niri | phoc | river | Sway | Treeland | Wayfire | Weston | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wp_tearing_control_manager_v1 | x | x | x | 1 | 1 | 1 | 1 | 1 | x | x | x | x | x | 1 | 1 | x | x | 1 |
Copyright
Copyright © 2021 Xaver Hugl
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.