[gnome-remote-desktop] rdp: Get rid of the grd_session_rdp_resize_framebuffer() API



commit 88529f068d2a76b5630afd033c242f81c1798936
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Tue Sep 28 09:29:08 2021 +0200

    rdp: Get rid of the grd_session_rdp_resize_framebuffer() API
    
    Currently, when the PipeWire stream parameters of the monitor content
    change, grd_session_rdp_resize_framebuffer() is called.
    However, this call is not necessary and can be delayed right before the
    next graphics update.
    In addition to that, this also allows to easily run do_render() later
    in a different thread, as no order of graphics output buffer resizes
    and frame updates needs to be considered.
    
    So, remove the grd_session_rdp_resize_framebuffer() API from the
    session-rdp header file and make this function private.
    Call this private function then at the beginning of
    grd_session_rdp_take_buffer() to ensure that the graphics output buffer
    is correctly resized.

 src/grd-rdp-pipewire-stream.c | 7 -------
 src/grd-session-rdp.c         | 9 +++++----
 src/grd-session-rdp.h         | 4 ----
 3 files changed, 5 insertions(+), 15 deletions(-)
---
diff --git a/src/grd-rdp-pipewire-stream.c b/src/grd-rdp-pipewire-stream.c
index 4bba33d..1d4a5a2 100644
--- a/src/grd-rdp-pipewire-stream.c
+++ b/src/grd-rdp-pipewire-stream.c
@@ -177,8 +177,6 @@ on_stream_param_changed (void                 *user_data,
   GrdRdpPipeWireStream *stream = GRD_RDP_PIPEWIRE_STREAM (user_data);
   uint8_t params_buffer[1024];
   struct spa_pod_builder pod_builder;
-  int width;
-  int height;
   const struct spa_pod *params[3];
 
   if (!format || id != SPA_PARAM_Format)
@@ -188,11 +186,6 @@ on_stream_param_changed (void                 *user_data,
 
   pod_builder = SPA_POD_BUILDER_INIT (params_buffer, sizeof (params_buffer));
 
-  width = stream->spa_format.size.width;
-  height = stream->spa_format.size.height;
-
-  grd_session_rdp_resize_framebuffer (stream->session_rdp, width, height);
-
   params[0] = spa_pod_builder_add_object (
     &pod_builder,
     SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
diff --git a/src/grd-session-rdp.c b/src/grd-session-rdp.c
index deeb777..3385530 100644
--- a/src/grd-session-rdp.c
+++ b/src/grd-session-rdp.c
@@ -214,10 +214,10 @@ grd_session_rdp_notify_graphics_pipeline_ready (GrdSessionRdp *session_rdp)
   g_source_set_ready_time (session_rdp->pending_encode_source, 0);
 }
 
-void
-grd_session_rdp_resize_framebuffer (GrdSessionRdp *session_rdp,
-                                    uint32_t       width,
-                                    uint32_t       height)
+static void
+maybe_resize_graphics_output_buffer (GrdSessionRdp *session_rdp,
+                                     uint32_t       width,
+                                     uint32_t       height)
 {
   freerdp_peer *peer = session_rdp->peer;
   rdpSettings *rdp_settings = peer->settings;
@@ -247,6 +247,7 @@ grd_session_rdp_take_buffer (GrdSessionRdp *session_rdp,
   cairo_region_t *region;
 
   g_clear_pointer (&rdp_surface->pending_frame, g_free);
+  maybe_resize_graphics_output_buffer (session_rdp, width, height);
 
   if (is_rdp_peer_flag_set (session_rdp, RDP_PEER_ALL_SURFACES_INVALID))
     {
diff --git a/src/grd-session-rdp.h b/src/grd-session-rdp.h
index 6e3c592..0a525af 100644
--- a/src/grd-session-rdp.h
+++ b/src/grd-session-rdp.h
@@ -49,10 +49,6 @@ void grd_session_rdp_notify_graphics_pipeline_ready (GrdSessionRdp *session_rdp)
 int grd_session_rdp_get_stride_for_width (GrdSessionRdp *session_rdp,
                                           int            width);
 
-void grd_session_rdp_resize_framebuffer (GrdSessionRdp *session_rdp,
-                                         uint32_t       width,
-                                         uint32_t       height);
-
 void grd_session_rdp_take_buffer (GrdSessionRdp *session_rdp,
                                   void          *data,
                                   uint16_t       width,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]