wlr export DMA-BUF

低开销屏幕内容捕获协议

通过导出 DMA-BUF 以高效方式捕获表面的接口。

警告!此文件中描述的实验性协议可能会进行向后不兼容的更改。向后兼容的更改可能会与相应的接口版本号提升一起添加。向后不兼容的更改通过提升协议和接口名称中的版本号并重置接口版本来完成。一旦协议被宣布为稳定版本,协议和接口名称中的 'z' 前缀和版本号将被移除,接口版本号将被重置。

用于通知客户端并开始捕获的管理器

此对象是一个管理器,用于从源开始捕获。

capture_output(frame: new_id<zwlr_export_dmabuf_frame_v1>, overlay_cursor: int, output: object<wl_output>)
参数
类型
描述
framenew_id<zwlr_export_dmabuf_frame_v1>
overlay_cursorint
include custom client hardware cursor on top of the frame
outputobject<wl_output>
从输出捕获一帧

捕获整个输出的下一帧。

destroy()
销毁管理器

管理器创建的所有对象仍将保持有效,直到调用适当的销毁请求。


DMA-BUF 帧

此对象表示单个 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)
参数
类型
描述
widthuint
frame width in pixels
heightuint
frame height in pixels
offset_xuint
crop offset for the x axis
offset_yuint
crop offset for the y axis
buffer_flagsuint
flags which indicate properties (invert, interlacing), has the same values as zwp_linux_buffer_params_v1:flags
flagsuint<zwlr_export_dmabuf_frame_v1.flags>
indicates special frame features
formatuint
format of the frame (DRM_FORMAT_*)
mod_highuint
drm format modifier, high
mod_lowuint
drm format modifier, low
num_objectsuint
indicates how many objects (FDs) the frame has (max 4)
帧描述

向客户端提供帧信息的主要事件。如果捕获未失败,此事件总是在任何其他事件之前发出。

此事件后跟 "num_objects" 参数指定的多个 "object"。

object(index: uint, fd: fd, size: uint, offset: uint, stride: uint, plane_index: uint)
参数
类型
描述
indexuint
index of the current object
fdfd
fd of the current object
sizeuint
size in bytes for the current object
offsetuint
starting point for the data in the object's fd
strideuint
line size in bytes
plane_indexuint
index of the plane the data in the object applies to
对象描述

此事件用于向客户端提供包含每个对象数据的文件描述符。

收到此事件后,客户端必须在完成后立即关闭文件描述符,即使帧失败也是如此。

ready(tv_sec_hi: uint, tv_sec_lo: uint, tv_nsec: uint)
参数
类型
描述
tv_sec_hiuint
high 32 bits of the seconds part of the timestamp
tv_sec_louint
low 32 bits of the seconds part of the timestamp
tv_nsecuint
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] 范围内。秒部分在开始时可能有任意偏移。

收到此事件后,客户端应销毁此对象。

参数
类型
描述
reasonuint<zwlr_export_dmabuf_frame_v1.cancel_reason>
indicates a reason for cancelling this frame capture
指示帧不再有效

如果捕获失败或帧在发出 "frame" 事件后不再有效,此事件将用于通知客户端丢弃帧。

如果失败是暂时的,客户端可以再次捕获同一源。如果失败是永久的,任何进一步尝试捕获同一源都将再次失败。

收到此事件后,客户端应销毁此对象。

flags { transient } 
参数
描述
transient0x1
客户端应在处理前复制帧
帧标志

客户端应遵守的特殊标志。

cancel_reason { temporary, permanent, resizing } 
参数
描述
temporary0
暂时错误,源将产生更多帧
permanent1
致命错误,源将不会产生帧
resizing2
暂时错误,源将产生更多帧
取消原因

指示取消帧的原因。


合成器支持

Cage
Cage
0.2.0
COSMIC
COSMIC
1.0.0~beta.8
GameScope
GameScope
3.15.14
Hyprland
Hyprland
0.52.1
Jay
1.12.0
KWin
KWin
6.6
Labwc
Labwc
0.9.2
Louvre
Louvre
2.14.1
Mir
Mir
2.26
Muffin
Muffin
6.6.0
Mutter
Mutter
49.2
niri
niri
25.11
phoc
phoc
0.52
river
river
0.3.13
Sway
Sway
1.11
Treeland
Treeland
0.8.0
Wayfire
Wayfire
0.9.0
Weston
Weston
14.0.2
zwlr_export_dmabuf_manager_v1
1
x
x
x
x
x
1
x
x
x
x
x
1
1
1
x
1
x

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.

Footer

© 2026 Wayland Explorer

本网站与 Wayland 官方项目无任何关联。网站所有内容均根据 Wayland 协议 XML 文件自动生成。

本网站使用的 Visual Studio Code - Codicons 遵循 CC BY 4.0 许可。