Skip to content

Commit

Permalink
feat(web): use softbuffer to draw into the canvas (#191)
Browse files Browse the repository at this point in the history
Instead of copying and sending image buffers to JavaScript, the WASM
module now draws into the canvas by itself. This removes some overhead
associated with the previous approach and open the door for further
optimizations.

In order to achieve good performance, the newest API of
`softbuffer@0.3.0` is used: the "owned buffer" that can be written into
by us with direct access and `present_with_damage` to apply partial
updates. The presentation itself is currently not yet "no-copy" in
the case of the web backend because the current API of `softbuffer` is
expecting a pixel buffer in the BGRX format while the underlying canvas
can only takes RGBA pixels. There is an open issue for this.

There was a bug with the `present_with_damage` implementation for the
web backend. I fixed the issue and opened a PR to upstream the patch.
The cargo dependency patch will be removed once the fix is published
on crates.io.

Issue: ARC-164
  • Loading branch information
CBenoit authored Sep 8, 2023
1 parent 783167f commit 9d33cad
Show file tree
Hide file tree
Showing 22 changed files with 337 additions and 277 deletions.
179 changes: 149 additions & 30 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ keywords = ["rdp", "remote-desktop", "network", "client", "protocol"]
categories = ["network-programming"]

[workspace.dependencies]
ironrdp-acceptor = { version = "0.1", path = "crates/ironrdp-acceptor" }
ironrdp-async = { version = "0.1", path = "crates/ironrdp-async" }
ironrdp-cliprdr = { version = "0.1", path = "crates/ironrdp-cliprdr" }
ironrdp-connector = { version = "0.1", path = "crates/ironrdp-connector" }
ironrdp-acceptor = { version = "0.1", path = "crates/ironrdp-acceptor" }
ironrdp-dvc = { version = "0.1", path = "crates/ironrdp-dvc" }
ironrdp-error = { version = "0.1", path = "crates/ironrdp-error" }
ironrdp-futures = { version = "0.1", path = "crates/ironrdp-futures" }
Expand All @@ -36,13 +36,13 @@ ironrdp-pdu = { version = "0.1", path = "crates/ironrdp-pdu" }
ironrdp-rdcleanpath = { version = "0.1", path = "crates/ironrdp-rdcleanpath" }
ironrdp-rdpdr = { version = "0.1", path = "crates/ironrdp-rdpdr" }
ironrdp-rdpsnd = { version = "0.1", path = "crates/ironrdp-rdpsnd" }
ironrdp-server = { version = "0.1", path = "crates/ironrdp-server" }
ironrdp-session-generators = { path = "crates/ironrdp-session-generators" }
ironrdp-session = { version = "0.1", path = "crates/ironrdp-session" }
ironrdp-svc = { version = "0.1", path = "crates/ironrdp-svc" }
ironrdp-testsuite-core = { path = "crates/ironrdp-testsuite-core" }
ironrdp-tls = { version = "0.1", path = "crates/ironrdp-tls" }
ironrdp-tokio = { version = "0.1", path = "crates/ironrdp-tokio" }
ironrdp-server = { version = "0.1", path = "crates/ironrdp-server" }
ironrdp = { version = "0.5", path = "crates/ironrdp" }

expect-test = "1"
Expand All @@ -63,3 +63,6 @@ lto = true
inherits = "release"
opt-level = "s"
lto = true

[patch.crates-io]
softbuffer = { git = "https://github.com/CBenoit/softbuffer.git", rev = "8a9e7f95e054f9af5752682aa5f27890aeb1b094" }
4 changes: 2 additions & 2 deletions crates/ironrdp-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ ironrdp-tls.workspace = true
ironrdp-tokio.workspace = true
sspi = { workspace = true, features = ["network_client", "dns_resolver"] } # enable additional features

# GUI
softbuffer = "0.3"
# Windowing and rendering
winit = "0.28"
softbuffer = "0.3"

# CLI
clap = { version = "4.2", features = ["derive", "cargo"] }
Expand Down
Loading

0 comments on commit 9d33cad

Please sign in to comment.