Skip to content

Commit f54b23f

Browse files
committed
feat(client): enable EGFX
Signed-off-by: Marc-André Lureau <[email protected]>
1 parent 3259ed7 commit f54b23f

File tree

3 files changed

+51
-3
lines changed

3 files changed

+51
-3
lines changed

crates/ironrdp-client/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ ironrdp = { workspace = true, features = [
4141
"rdpsnd",
4242
"cliprdr",
4343
"displaycontrol",
44+
"egfx",
4445
"connector"
4546
] }
4647
ironrdp-cliprdr-native.workspace = true

crates/ironrdp-client/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ impl Config {
322322
request_data: None,
323323
pointer_software_rendering: true,
324324
performance_flags: PerformanceFlags::default(),
325-
support_gfx: false,
325+
support_gfx: true,
326326
};
327327

328328
Ok(Self {

crates/ironrdp-client/src/rdp.rs

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ use ironrdp::connector::connection_activation::ConnectionActivationState;
33
use ironrdp::connector::{ConnectionResult, ConnectorResult};
44
use ironrdp::displaycontrol::client::DisplayControlClient;
55
use ironrdp::displaycontrol::pdu::MonitorLayoutEntry;
6+
use ironrdp::egfx::client::{GraphicsPipelineClient, GraphicsPipelineHandler};
7+
use ironrdp::egfx::pdu::{GfxPdu, StartFramePdu};
68
use ironrdp::graphics::image_processing::PixelFormat;
79
use ironrdp::pdu::input::fast_path::FastPathInputEvent;
810
use ironrdp::session::image::DecodedImage;
911
use ironrdp::session::{fast_path, ActiveStage, ActiveStageOutput, GracefulDisconnectReason, SessionResult};
10-
use ironrdp::{cliprdr, connector, rdpdr, rdpsnd, session};
12+
use ironrdp::{cliprdr, connector, egfx, rdpdr, rdpsnd, session};
1113
use ironrdp_core::WriteBuf;
1214
use ironrdp_rdpsnd_native::cpal;
1315
use ironrdp_tokio::{single_sequence_step_read, split_tokio_framed, FramedWrite};
@@ -92,6 +94,49 @@ impl RdpClient {
9294
}
9395
}
9496

97+
struct GraphicsPipeline {
98+
caps: Option<egfx::pdu::CapabilitySet>,
99+
start_frame: Option<StartFramePdu>,
100+
}
101+
102+
impl GraphicsPipeline {
103+
fn new() -> Self {
104+
Self {
105+
caps: None,
106+
start_frame: None,
107+
}
108+
}
109+
}
110+
111+
impl GraphicsPipelineHandler for GraphicsPipeline {
112+
fn capabilities(&self) -> Vec<egfx::pdu::CapabilitySet> {
113+
vec![egfx::pdu::CapabilitySet::V8 {
114+
flags: egfx::pdu::CapabilitiesV8Flags::empty(),
115+
}]
116+
}
117+
118+
fn handle_pdu(&mut self, pdu: GfxPdu) {
119+
trace!(?pdu);
120+
match pdu {
121+
GfxPdu::CapabilitiesConfirm(pdu) => {
122+
trace!(?pdu);
123+
self.caps = Some(pdu.0);
124+
}
125+
GfxPdu::StartFrame(pdu) => {
126+
trace!(?pdu);
127+
self.start_frame = Some(pdu);
128+
}
129+
GfxPdu::EndFrame(pdu) => {
130+
trace!(?pdu);
131+
self.start_frame = None;
132+
}
133+
pdu => {
134+
debug!(?pdu);
135+
}
136+
}
137+
}
138+
}
139+
95140
enum RdpControlFlow {
96141
ReconnectWithNewSize { width: u16, height: u16 },
97142
TerminatedGracefully(GracefulDisconnectReason),
@@ -118,7 +163,9 @@ async fn connect(
118163
let mut connector = connector::ClientConnector::new(config.connector.clone())
119164
.with_server_addr(server_addr)
120165
.with_static_channel(
121-
ironrdp::dvc::DrdynvcClient::new().with_dynamic_channel(DisplayControlClient::new(|_| Ok(Vec::new()))),
166+
ironrdp::dvc::DrdynvcClient::new()
167+
.with_dynamic_channel(DisplayControlClient::new(|_| Ok(Vec::new())))
168+
.with_dynamic_channel(GraphicsPipelineClient::new(Box::new(GraphicsPipeline::new()))),
122169
)
123170
.with_static_channel(rdpsnd::client::Rdpsnd::new(Box::new(cpal::RdpsndBackend::new())))
124171
.with_static_channel(rdpdr::Rdpdr::new(Box::new(NoopRdpdrBackend {}), "IronRDP".to_owned()).with_smartcard(0));

0 commit comments

Comments
 (0)