refactor(server)!: use bytes, allowing shareable bitmap data

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau
2025-03-31 18:11:03 +02:00
committed by Benoît Cortier
parent 7f57817805
commit 3c43fdda76
5 changed files with 7 additions and 4 deletions
Generated
+1
View File
@@ -2673,6 +2673,7 @@ version = "0.5.0"
dependencies = [
"anyhow",
"async-trait",
"bytes",
"ironrdp-acceptor",
"ironrdp-ainput",
"ironrdp-async",
+2 -2
View File
@@ -15,7 +15,7 @@ pub fn rfx_enc_tile_bench(c: &mut Criterion) {
width: NonZero::new(64).unwrap(),
height: NonZero::new(64).unwrap(),
format: ironrdp_server::PixelFormat::ARgb32,
data: vec![0; 64 * 64 * 4],
data: vec![0; 64 * 64 * 4].into(),
stride: 64 * 4,
};
c.bench_function("rfx_enc_tile", |b| b.iter(|| rfx_enc_tile(&bitmap, &quant, algo, 0, 0)));
@@ -30,7 +30,7 @@ pub fn rfx_enc_bench(c: &mut Criterion) {
width: NonZero::new(2048).unwrap(),
height: NonZero::new(2048).unwrap(),
format: ironrdp_server::PixelFormat::ARgb32,
data: vec![0; 2048 * 2048 * 4],
data: vec![0; 2048 * 2048 * 4].into(),
stride: 64 * 4,
};
c.bench_function("rfx_enc", |b| b.iter(|| rfx_enc(&bitmap, &quant, algo)));
+1
View File
@@ -45,6 +45,7 @@ tracing = { version = "0.1", features = ["log"] }
x509-cert = { version = "0.2.5", optional = true }
rustls-pemfile = { version = "2.2.0", optional = true }
rayon = { version = "1.10.0", optional = true }
bytes = "1"
[dev-dependencies]
tokio = { version = "1", features = ["sync"] }
+2 -1
View File
@@ -1,6 +1,7 @@
use core::num::NonZeroU16;
use anyhow::Result;
use bytes::Bytes;
use ironrdp_displaycontrol::pdu::DisplayControlMonitorLayout;
use ironrdp_pdu::pointer::PointerPositionAttribute;
@@ -67,7 +68,7 @@ pub struct BitmapUpdate {
pub width: NonZeroU16,
pub height: NonZeroU16,
pub format: PixelFormat,
pub data: Vec<u8>,
pub data: Bytes,
pub stride: usize,
}
+1 -1
View File
@@ -183,7 +183,7 @@ impl RdpServerDisplayUpdates for DisplayUpdates {
width,
height,
format: PixelFormat::BgrA32,
data,
data: data.into(),
stride: usize::from(width.get()).checked_mul(4).unwrap(),
};
Some(DisplayUpdate::Bitmap(bitmap))