Commit timing protocol
当合成器(compositor)锁定新的内容更新时,它会检查可用内容更新的任意数量要求(例如所有缓冲区的同步栅栏均已触发),以认为更新已就绪。
此协议提供了一种为 surface(表面)内容添加时间约束的方法。此约束向合成器指示内容更新应尽可能接近但不早于指定的时间进行呈现(presentation)。
此协议不改变 Wayland 内容更新按接收顺序应用(apply)的属性,即使某些内容更新包含时间戳而其他不包含。
要提供时间戳,必须使用此全局工厂接口(global factory interface)为 surface 获取一个 `wp_commit_timing_v1` 对象,然后可将其用于为提交(commits)提供时间戳信息。
警告!此文件中描述的协议目前处于测试阶段。向后兼容的更改可能会与相应的接口版本提升一起添加。向后不兼容的更改只能通过创建此扩展的新主版本来完成。
destroy()
通知服务器客户端将不再使用此协议对象。由此对象创建的现有对象不受影响。
get_timer(id: new_id<wp_commit_timer_v1>, surface: object<wl_surface>)
参数 | 类型 | 描述 |
|---|---|---|
| id | new_id<wp_commit_timer_v1> | |
| surface | object<wl_surface> |
为 surface 建立时序控制器(timing controller)。
一个 surface 只能创建一个提交计时器(commit timer),否则将生成 `commit_timer_exists` 协议错误。
error { commit_timer_exists }
参数 | 值 | 描述 |
|---|---|---|
| commit_timer_exists | 0 | surface 已存在提交计时器 |
用于为 surface 上的内容更新设置时间约束的对象。
参数 | 类型 | 描述 |
|---|---|---|
| tv_sec_hi | uint | high 32 bits of the seconds part of target time |
| tv_sec_lo | uint | low 32 bits of the seconds part of target time |
| tv_nsec | uint | nanoseconds part of target time |
为 surface 内容更新提供时序约束。
可以在 `wl_surface.commit` 之前发出 `set_timestamp` 请求,以告知合成器该内容旨在尽可能接近但不早于指定时间进行呈现(presentation)。时间处于合成器 presentation 时钟的域内。
对于无效的 `tv_nsec`,将生成 `invalid_timestamp` 错误。
如果在没有新内容更新的情况下提供了时间戳,将生成 `no_update` 错误。
destroy()
销毁计时器对象。由于此对象设置的计时器状态是双缓冲的(double-buffered),因此销毁计时器对象可以在提交时间戳之前移除由该计时器对象设置的挂起(pending)且未提交(uncommitted)的时间戳。
error { invalid_timestamp, timestamp_exists, surface_destroyed }
参数 | 值 | 描述 |
|---|---|---|
| invalid_timestamp | 0 | 无效的时间戳 |
| timestamp_exists | 1 | 时间戳已存在 |
| surface_destroyed | 2 | 关联的 surface 已不存在 |
合成器支持
Cage | COSMIC | GameScope | Hyprland | Jay | KWin | Labwc | Louvre | Mir | Muffin | Mutter | niri | phoc | river | Sway | Treeland | Wayfire | Weston | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wp_commit_timing_manager_v1 | x | x | x | 1 | 1 | x | x | x | x | x | 1 | x | x | x | x | x | x | x |
Copyright
Copyright © 2023 Valve Corporation
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.