mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-11-04 00:33:12 +00:00
* fix(drm): turn a captured frame only when the plane did not rotate it A compositor rotates an output either in hardware, setting the primary plane's `rotation` property, or in software, drawing the scanout already turned. `wl_output` cannot tell the two apart, and `frame_transform` guessed: 90/270 turned, 180 left alone, which is right for i915 + mutter (rotate-180 in hardware, scanout upright) and wrong wherever the compositor drew the scanout turned, where 180 comes out upside down. Measured before changing it. virtio-gpu (no rotation property, mutter 46): the scanout dump at 180 is the desktop upside down, at 90 and 270 the logical desktop turned inside the native mode framebuffer. i915 + mutter (GNOME 50) at 180: the plane reports rotate-180 and the dump is upright, identical to the unrotated one. amdgpu + KWin 6 at 180: the plane stays at rotate-0 and the dump is upside down. The producer reads `drmtap_plane_rotation()` (libdrmtap 0.5.8, optional symbol) right after each grab and stamps it on the frame, in the dma-buf descriptor and in the CPU frame header, both `serde(default)` so an older producer still parses. A plane that rotated scans out the logical desktop whatever the output transform says: the compositor programs it from the CRTC transform, which also folds in the connector's panel orientation that `wl_output` never carries, so the consumer leaves such a frame alone. A plane at rotate-0 scanned out what the compositor drew, and the frame is turned by the whole output transform. `None` (a library before 0.5.8, or nothing it could read) keeps the previous rule, so nothing changes until the library says otherwise. The session is still sized from the output transform: a plane that rotated 90 in hardware hands over the portrait scanout those dims already name. * build: pin libdrmtap 0.5.8 (rustdesk-org/libdrmtap 95d4d7454) The rotation fix reads drmtap_plane_rotation(), added in libdrmtap 0.5.8. The mirror carries that commit since 2026-09-25, so the pin moves there. * drm: pin the decoding of a frame from a producer older than the plane rotation The root service and the --server are upgraded separately, so a frame header or a dma-buf descriptor without `plane_rotation` must still decode, as None, which keeps the previous rule. The tests built both messages with the field set to None; this one decodes payloads that omit it, and one that carries it (greptile on #16345). Serde already reads a missing Option as None, so what the test pins is the wire name and the None on absence, for both messages. Mutation: renaming the field on the wire, in either message, turns it red. * drm: take the plane rotation right after the grab, not after the copies `drmtap_plane_rotation()` reads the rotation property of the plane the last grab came from at the moment it is called. The cpu path asked only after `DrmReader::grab()` had copied the frame into its buffer and the producer had copied it again into the message, so on a large frame the compositor had time to change the plane and the frame went out with the rotation of the next one; `frame_transform` turns that frame by it with nothing to absorb the skew (zhou, review of 26-sep). `DrmReader` now reads the rotation right after a successful `drmtap_grab_mapped` or `drmtap_grab_desc`, before any copy or release, and `plane_rotation()` returns that snapshot, so both paths stamp a frame with the rotation its own grab saw. Test: a_frame_keeps_the_rotation_its_plane_had_when_it_was_grabbed, in `plane_rotation_tests` (which CI already runs), drives the reader through a fake library whose frame release turns the plane: the rotation read at the grab survives on the cpu grab and on the dma-buf export. Mutations: no snapshot on the cpu grab, none on the export, and the cpu snapshot taken after the release, each turn it red.
80 lines
2.9 KiB
TOML
80 lines
2.9 KiB
TOML
[package]
|
|
name = "scrap"
|
|
description = "Screen capture made easy."
|
|
version = "0.5.0"
|
|
repository = "https://github.com/quadrupleslap/scrap"
|
|
documentation = "https://docs.rs/scrap"
|
|
keywords = ["screen", "capture", "record"]
|
|
license = "MIT"
|
|
authors = ["Ram <quadrupleslap@gmail.com>"]
|
|
edition = "2018"
|
|
|
|
[features]
|
|
wayland = ["gstreamer", "gstreamer-app", "gstreamer-video", "dbus", "tracing", "zbus"]
|
|
# `drm` is a pure runtime-dlopen backend: rustdesk loads `libdrmtap.so.0` at runtime (`drmtap_dl.rs`)
|
|
# and NEVER link-time links it, so the graceful PipeWire fallback when the .so or EGL is absent is
|
|
# preserved and the drm build pulls in no libdrm/seccomp/cap/EGL link-time deps. The .so is pinned by
|
|
# `DRMTAP_SHA` in build.py, which fetches that exact commit (libdrmtap v0.5.8). We deliberately do
|
|
# NOT depend on the `libdrmtap-sys` crate: its build.rs statically compiles the whole libdrmtap C tree
|
|
# and a CAP_SYS_ADMIN helper and emits `-ldrm -lseccomp -lcap`, which would defeat the dlopen model.
|
|
# Depends on `wayland`: the three drm modules live inside the `#[cfg(feature = "wayland")]` arm of
|
|
# common/mod.rs, so `scrap/drm` on its own would compile nothing. The root crate happens to always
|
|
# enable `scrap/wayland`, which is what hid this.
|
|
drm = ["wayland", "base/wayland_probe"]
|
|
mediacodec = ["ndk"]
|
|
linux-pkg-config = ["dep:pkg-config"]
|
|
hwcodec = ["dep:hwcodec"]
|
|
vram = ["hwcodec/vram"]
|
|
|
|
[dependencies]
|
|
cfg-if = "1.0"
|
|
num_cpus = "1.15"
|
|
lazy_static = "1.4"
|
|
hbb_common = { path = "../hbb_common" }
|
|
base = { path = "../base" }
|
|
webm = { git = "https://github.com/rustdesk-org/rust-webm" }
|
|
serde = {version="1.0", features=["derive"]}
|
|
|
|
[dependencies.winapi]
|
|
version = "0.3"
|
|
default-features = true
|
|
features = ["dxgi", "dxgi1_2", "dxgi1_5", "dxgi1_6", "d3d11", "winuser", "winerror", "errhandlingapi", "libloaderapi"]
|
|
|
|
[target.'cfg(target_os = "macos")'.dependencies]
|
|
block = "0.1"
|
|
|
|
[target.'cfg(target_os = "android")'.dependencies]
|
|
android_logger = "0.13"
|
|
jni = "0.21"
|
|
lazy_static = "1.4"
|
|
log = "0.4"
|
|
serde_json = "1.0"
|
|
ndk = { version = "0.7", features = ["media"], optional = true}
|
|
ndk-context = "0.1"
|
|
|
|
[target.'cfg(not(target_os = "android"))'.dev-dependencies]
|
|
repng = "0.2"
|
|
docopt = "1.1"
|
|
quest = "0.3"
|
|
|
|
[build-dependencies]
|
|
target_build_utils = "0.3"
|
|
bindgen = "0.72.1"
|
|
pkg-config = { version = "0.3.27", optional = true }
|
|
|
|
[target.'cfg(target_os = "linux")'.dependencies]
|
|
dbus = { version = "0.9", optional = true }
|
|
tracing = { version = "0.1", optional = true }
|
|
gstreamer = { version = "0.16", optional = true }
|
|
gstreamer-app = { version = "0.16", features = ["v1_10"], optional = true }
|
|
gstreamer-video = { version = "0.16", optional = true }
|
|
zbus = { version = "3.15", optional = true }
|
|
|
|
[dependencies.hwcodec]
|
|
git = "https://github.com/rustdesk-org/hwcodec"
|
|
optional = true
|
|
|
|
[target.'cfg(any(target_os = "windows", target_os = "linux"))'.dependencies]
|
|
nokhwa = { git = "https://github.com/rustdesk-org/nokhwa.git", branch = "fix_from_raw_parts", features = ["input-native"] }
|
|
|