diff --git a/0001-vnc-pipewire-stream-Handle-stride-mismatch.patch b/0001-vnc-pipewire-stream-Handle-stride-mismatch.patch new file mode 100644 index 0000000..59bc460 --- /dev/null +++ b/0001-vnc-pipewire-stream-Handle-stride-mismatch.patch @@ -0,0 +1,73 @@ +From 78c5bcb181fe2b0b9fc17eea696feac8b504df54 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Jonas=20=C3=85dahl?= +Date: Thu, 7 May 2020 15:48:22 +0200 +Subject: [PATCH] vnc/pipewire-stream: Handle stride mismatch + +The VNC server framebuffer assumes a particular stride; but there is no +guarantee that we'll get the same from PipeWire. Handle this gracefully +by coping row by row instead of the whole buffer. +--- + src/grd-vnc-pipewire-stream.c | 23 +++++++++++++++-------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +diff --git a/src/grd-vnc-pipewire-stream.c b/src/grd-vnc-pipewire-stream.c +index 88c07be..261292a 100644 +--- a/src/grd-vnc-pipewire-stream.c ++++ b/src/grd-vnc-pipewire-stream.c +@@ -187,8 +187,6 @@ on_stream_param_changed (void *user_data, + struct spa_pod_builder pod_builder; + int width; + int height; +- int stride; +- int size; + const struct spa_pod *params[3]; + + if (!format || id != SPA_PARAM_Format) +@@ -203,14 +201,9 @@ on_stream_param_changed (void *user_data, + + grd_session_vnc_queue_resize_framebuffer (stream->session, width, height); + +- stride = grd_session_vnc_get_framebuffer_stride (stream->session); +- size = stride * height; +- + params[0] = spa_pod_builder_add_object ( + &pod_builder, + SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers, +- SPA_PARAM_BUFFERS_size, SPA_POD_Int (size), +- SPA_PARAM_BUFFERS_stride, SPA_POD_Int (stride), + SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int (8, 1, 8), + 0); + +@@ -319,6 +312,10 @@ process_buffer (GrdVncPipeWireStream *stream, + size_t size; + uint8_t *map; + void *src_data; ++ int src_stride; ++ int dst_stride; ++ int height; ++ int y; + struct spa_meta_cursor *spa_meta_cursor; + g_autofree GrdVncFrame *frame = NULL; + +@@ -359,7 +356,17 @@ process_buffer (GrdVncPipeWireStream *stream, + return NULL; + } + +- frame->data = g_memdup (src_data, buffer->datas[0].maxsize); ++ src_stride = buffer->datas[0].chunk->stride; ++ dst_stride = grd_session_vnc_get_framebuffer_stride (stream->session); ++ height = stream->spa_format.size.height; ++ ++ frame->data = g_malloc (height * dst_stride); ++ for (y = 0; y < height; y++) ++ { ++ memcpy (((uint8_t *) frame->data) + y * dst_stride, ++ ((uint8_t *) src_data) + y * src_stride, ++ dst_stride); ++ } + + if (map) + { +-- +2.26.2 + diff --git a/gnome-remote-desktop.spec b/gnome-remote-desktop.spec index 82dab45..4ff22e3 100644 --- a/gnome-remote-desktop.spec +++ b/gnome-remote-desktop.spec @@ -2,7 +2,7 @@ Name: gnome-remote-desktop Version: 0.1.8 -Release: 1%{?dist} +Release: 2%{?dist} Summary: GNOME Remote Desktop screen share service License: GPLv2+ @@ -12,6 +12,8 @@ Source0: https://gitlab.gnome.org/jadahl/gnome-remote-desktop/uploads/20e # Adds encryption support (requires patched LibVNCServer) Patch0: anon-tls-support.patch +Patch1: 0001-vnc-pipewire-stream-Handle-stride-mismatch.patch + BuildRequires: git BuildRequires: gcc BuildRequires: meson >= 0.36.0 @@ -69,6 +71,9 @@ GNOME desktop environment. %changelog +* Mon Jun 1 2020 Felipe Borges - 0.1.8-2 +- Fix black screen issue in remote connections on Wayland + * Wed Mar 11 2020 Jonas Ã…dahl - 0.1.8-1 - Update to 0.1.8