[gnome-remote-desktop] rdp: Allow using custom GMainContext for RDPGFX GSources
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-remote-desktop] rdp: Allow using custom GMainContext for RDPGFX GSources
- Date: Thu, 14 Oct 2021 14:42:42 +0000 (UTC)
commit 1aa0507b4318abe26022e27f2dfa33ed825e954b
Author: Pascal Nowack <Pascal Nowack gmx de>
Date: Mon Aug 23 19:06:39 2021 +0200
rdp: Allow using custom GMainContext for RDPGFX GSources
The usage of a custom GMainContext for all RDPGFX specific GSources is
a required step in order to be able to run all graphics operations in a
separate thread.
src/grd-rdp-gfx-surface.c | 3 ++-
src/grd-rdp-gfx-surface.h | 1 +
src/grd-rdp-graphics-pipeline.c | 12 ++++++++----
src/grd-rdp-graphics-pipeline.h | 1 +
src/grd-session-rdp.c | 1 +
5 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/src/grd-rdp-gfx-surface.c b/src/grd-rdp-gfx-surface.c
index 74f08e1..39af4ec 100644
--- a/src/grd-rdp-gfx-surface.c
+++ b/src/grd-rdp-gfx-surface.c
@@ -331,6 +331,7 @@ static GSourceFuncs pending_encode_source_funcs =
GrdRdpGfxSurface *
grd_rdp_gfx_surface_new (GrdRdpGraphicsPipeline *graphics_pipeline,
GrdSessionRdp *session_rdp,
+ GMainContext *pipeline_context,
GrdRdpSurface *rdp_surface,
uint16_t surface_id,
uint32_t serial)
@@ -356,7 +357,7 @@ grd_rdp_gfx_surface_new (GrdRdpGraphicsPipeline *graphics_pipeline,
g_source_set_callback (gfx_surface->pending_encode_source,
maybe_encode_pending_frame, gfx_surface, NULL);
g_source_set_ready_time (gfx_surface->pending_encode_source, -1);
- g_source_attach (gfx_surface->pending_encode_source, NULL);
+ g_source_attach (gfx_surface->pending_encode_source, pipeline_context);
return gfx_surface;
}
diff --git a/src/grd-rdp-gfx-surface.h b/src/grd-rdp-gfx-surface.h
index a2b57a2..295cf8b 100644
--- a/src/grd-rdp-gfx-surface.h
+++ b/src/grd-rdp-gfx-surface.h
@@ -31,6 +31,7 @@ G_DECLARE_FINAL_TYPE (GrdRdpGfxSurface, grd_rdp_gfx_surface,
GrdRdpGfxSurface *grd_rdp_gfx_surface_new (GrdRdpGraphicsPipeline *graphics_pipeline,
GrdSessionRdp *session_rdp,
+ GMainContext *pipeline_context,
GrdRdpSurface *rdp_surface,
uint16_t surface_id,
uint32_t serial);
diff --git a/src/grd-rdp-graphics-pipeline.c b/src/grd-rdp-graphics-pipeline.c
index 685d009..0ed3857 100644
--- a/src/grd-rdp-graphics-pipeline.c
+++ b/src/grd-rdp-graphics-pipeline.c
@@ -71,6 +71,7 @@ struct _GrdRdpGraphicsPipeline
uint32_t initial_version;
GrdSessionRdp *session_rdp;
+ GMainContext *pipeline_context;
GrdRdpNetworkAutodetection *network_autodetection;
wStream *encode_stream;
RFX_CONTEXT *rfx_context;
@@ -879,7 +880,8 @@ ensure_rtt_receivement (GrdRdpGraphicsPipeline *graphics_pipeline)
g_timeout_source_new (ENC_TIMES_CHECK_INTERVAL_MS);
g_source_set_callback (graphics_pipeline->rtt_pause_source, maybe_slow_down_rtts,
graphics_pipeline, NULL);
- g_source_attach (graphics_pipeline->rtt_pause_source, NULL);
+ g_source_attach (graphics_pipeline->rtt_pause_source,
+ graphics_pipeline->pipeline_context);
}
void
@@ -910,8 +912,8 @@ grd_rdp_graphics_pipeline_refresh_gfx (GrdRdpGraphicsPipeline *graphics_pipeline
if (!rdp_surface->gfx_surface)
{
rdp_surface->gfx_surface = grd_rdp_gfx_surface_new (
- graphics_pipeline, session_rdp, rdp_surface,
- get_next_free_surface_id (graphics_pipeline),
+ graphics_pipeline, session_rdp, graphics_pipeline->pipeline_context,
+ rdp_surface, get_next_free_surface_id (graphics_pipeline),
get_next_free_serial (graphics_pipeline));
map_surface_to_output (graphics_pipeline, rdp_surface->gfx_surface);
}
@@ -1203,6 +1205,7 @@ grd_rdp_graphics_pipeline_maybe_init (GrdRdpGraphicsPipeline *graphics_pipeline)
GrdRdpGraphicsPipeline *
grd_rdp_graphics_pipeline_new (GrdSessionRdp *session_rdp,
+ GMainContext *pipeline_context,
HANDLE vcm,
HANDLE stop_event,
rdpContext *rdp_context,
@@ -1221,6 +1224,7 @@ grd_rdp_graphics_pipeline_new (GrdSessionRdp *session_rdp,
graphics_pipeline->rdpgfx_context = rdpgfx_context;
graphics_pipeline->stop_event = stop_event;
graphics_pipeline->session_rdp = session_rdp;
+ graphics_pipeline->pipeline_context = pipeline_context;
graphics_pipeline->network_autodetection = network_autodetection;
graphics_pipeline->encode_stream = encode_stream;
graphics_pipeline->rfx_context = rfx_context;
@@ -1504,7 +1508,7 @@ grd_rdp_graphics_pipeline_init (GrdRdpGraphicsPipeline *graphics_pipeline)
g_source_set_callback (protocol_reset_source, reset_protocol,
graphics_pipeline, NULL);
g_source_set_ready_time (protocol_reset_source, -1);
- g_source_attach (protocol_reset_source, NULL);
+ g_source_attach (protocol_reset_source, graphics_pipeline->pipeline_context);
graphics_pipeline->protocol_reset_source = protocol_reset_source;
}
diff --git a/src/grd-rdp-graphics-pipeline.h b/src/grd-rdp-graphics-pipeline.h
index 78fea3a..9571be7 100644
--- a/src/grd-rdp-graphics-pipeline.h
+++ b/src/grd-rdp-graphics-pipeline.h
@@ -31,6 +31,7 @@ G_DECLARE_FINAL_TYPE (GrdRdpGraphicsPipeline, grd_rdp_graphics_pipeline,
GRD, RDP_GRAPHICS_PIPELINE, GObject);
GrdRdpGraphicsPipeline *grd_rdp_graphics_pipeline_new (GrdSessionRdp *session_rdp,
+ GMainContext *pipeline_context,
HANDLE vcm,
HANDLE stop_event,
rdpContext *rdp_context,
diff --git a/src/grd-session-rdp.c b/src/grd-session-rdp.c
index 3385530..17a37f9 100644
--- a/src/grd-session-rdp.c
+++ b/src/grd-session-rdp.c
@@ -1626,6 +1626,7 @@ rdp_peer_post_connect (freerdp_peer *peer)
rdp_peer_context->graphics_pipeline =
grd_rdp_graphics_pipeline_new (session_rdp,
+ NULL,
rdp_peer_context->vcm,
session_rdp->stop_event,
peer->context,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]