wlr export DMA-BUF
通过导出 DMA-BUF 以高效方式捕获表面的接口。
警告!此文件中描述的实验性协议可能会进行向后不兼容的更改。向后兼容的更改可能会与相应的接口版本号提升一起添加。向后不兼容的更改通过提升协议和接口名称中的版本号并重置接口版本来完成。一旦协议被宣布为稳定版本,协议和接口名称中的 'z' 前缀和版本号将被移除,接口版本号将被重置。
此对象是一个管理器,用于从源开始捕获。
capture_output(frame: new_id<zwlr_export_dmabuf_frame_v1>, overlay_cursor: int, output: object<wl_output>)
参数 | 类型 | 描述 |
|---|---|---|
| frame | new_id<zwlr_export_dmabuf_frame_v1> | |
| overlay_cursor | int | include custom client hardware cursor on top of the frame |
| output | object<wl_output> |
捕获整个输出的下一帧。
此对象表示单个 DMA-BUF 帧。
如果捕获成功,合成器将首先发送 "frame" 事件,后跟一个或多个 "object"。当帧可供读取时,发送 "ready" 事件。
如果捕获失败,发送 "cancel" 事件。这可能在 "ready" 事件之前的任何时间发生。
收到 "ready" 或 "cancel" 事件后,客户端应销毁此帧。收到 "object" 事件后,客户端负责关闭关联的文件描述符。
所有帧都是只读的,不得写入或修改。
destroy()
取消引用帧。此请求必须在不再使用时立即调用。
客户端可以在任何时间调用此请求。客户端仍必须关闭已获得的任何文件描述符。
frame(width: uint, height: uint, offset_x: uint, offset_y: uint, buffer_flags: uint, flags: uint<zwlr_export_dmabuf_frame_v1.flags>, format: uint, mod_high: uint, mod_low: uint, num_objects: uint)
参数 | 类型 | 描述 |
|---|---|---|
| width | uint | frame width in pixels |
| height | uint | frame height in pixels |
| offset_x | uint | crop offset for the x axis |
| offset_y | uint | crop offset for the y axis |
| buffer_flags | uint | flags which indicate properties (invert, interlacing), has the same values as zwp_linux_buffer_params_v1:flags |
| flags | uint<zwlr_export_dmabuf_frame_v1.flags> | indicates special frame features |
| format | uint | format of the frame (DRM_FORMAT_*) |
| mod_high | uint | drm format modifier, high |
| mod_low | uint | drm format modifier, low |
| num_objects | uint | indicates how many objects (FDs) the frame has (max 4) |
向客户端提供帧信息的主要事件。如果捕获未失败,此事件总是在任何其他事件之前发出。
此事件后跟 "num_objects" 参数指定的多个 "object"。
参数 | 类型 | 描述 |
|---|---|---|
| index | uint | index of the current object |
| fd | fd | fd of the current object |
| size | uint | size in bytes for the current object |
| offset | uint | starting point for the data in the object's fd |
| stride | uint | line size in bytes |
| plane_index | uint | index of the plane the data in the object applies to |
此事件用于向客户端提供包含每个对象数据的文件描述符。
收到此事件后,客户端必须在完成后立即关闭文件描述符,即使帧失败也是如此。
参数 | 类型 | 描述 |
|---|---|---|
| tv_sec_hi | uint | high 32 bits of the seconds part of the timestamp |
| tv_sec_lo | uint | low 32 bits of the seconds part of the timestamp |
| tv_nsec | uint | nanoseconds part of the timestamp |
帧呈现后立即发送此事件,指示其可供读取。此事件包括呈现发生的时间。
时间戳表示为 tv_sec_hi、tv_sec_lo、tv_nsec 三元组,每个组件为无符号 32 位值。整秒在 tv_sec 中,它是 tv_sec_hi 和 tv_sec_lo 组合的 64 位值,附加的分数部分在 tv_nsec 中以纳秒为单位。因此,对于有效时间戳 tv_nsec 必须在 [0, 999999999] 范围内。秒部分在开始时可能有任意偏移。
收到此事件后,客户端应销毁此对象。
cancel(reason: uint<zwlr_export_dmabuf_frame_v1.cancel_reason>)
参数 | 类型 | 描述 |
|---|---|---|
| reason | uint<zwlr_export_dmabuf_frame_v1.cancel_reason> | indicates a reason for cancelling this frame capture |
如果捕获失败或帧在发出 "frame" 事件后不再有效,此事件将用于通知客户端丢弃帧。
如果失败是暂时的,客户端可以再次捕获同一源。如果失败是永久的,任何进一步尝试捕获同一源都将再次失败。
收到此事件后,客户端应销毁此对象。
合成器支持
Cage | COSMIC | GameScope | Hyprland | Jay | KWin | Labwc | Louvre | Mir | Muffin | Mutter | niri | phoc | river | Sway | Treeland | Wayfire | Weston | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| zwlr_export_dmabuf_manager_v1 | 1 | x | x | x | x | x | 1 | x | x | x | x | x | 1 | 1 | 1 | x | 1 | x |
Copyright
Copyright © 2018 Rostislav Pehlivanov
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.