Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package xdg-desktop-portal-wlr for
openSUSE:Factory checked in at 2021-11-15 15:26:27
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/xdg-desktop-portal-wlr (Old)
and /work/SRC/openSUSE:Factory/.xdg-desktop-portal-wlr.new.1890 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "xdg-desktop-portal-wlr"
Mon Nov 15 15:26:27 2021 rev:5 rq:931294 version:0.5.0
Changes:
--------
---
/work/SRC/openSUSE:Factory/xdg-desktop-portal-wlr/xdg-desktop-portal-wlr.changes
2021-06-02 22:12:34.288103953 +0200
+++
/work/SRC/openSUSE:Factory/.xdg-desktop-portal-wlr.new.1890/xdg-desktop-portal-wlr.changes
2021-11-15 15:28:04.133851535 +0100
@@ -1,0 +2,6 @@
+Fri Nov 5 17:08:46 UTC 2021 - Arnav Singh <[email protected]>
+
+- Update to 0.5.0
+ * Bugfixes and minor internal improvements
+
+-------------------------------------------------------------------
Old:
----
xdg-desktop-portal-wlr-0.4.0.tar.gz
xdg-desktop-portal-wlr-0.4.0.tar.gz.sig
New:
----
xdg-desktop-portal-wlr-0.5.0.tar.gz
xdg-desktop-portal-wlr-0.5.0.tar.gz.sig
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ xdg-desktop-portal-wlr.spec ++++++
--- /var/tmp/diff_new_pack.GboA3H/_old 2021-11-15 15:28:04.609851668 +0100
+++ /var/tmp/diff_new_pack.GboA3H/_new 2021-11-15 15:28:04.613851669 +0100
@@ -17,7 +17,7 @@
Name: xdg-desktop-portal-wlr
-Version: 0.4.0
+Version: 0.5.0
Release: 0
Summary: An xdg-desktop-portal backend for wlroots
License: MIT
@@ -41,9 +41,8 @@
%description
xdg-desktop-portal backend for wlroots.
-Make sure `XDG_CURRENT_DESKTOP=sway` is set.
-
-When correctly installed, xdg-desktop-portal should automatically invoke
xdg-desktop-portal-wlr when needed.
+Make sure the `XDG_CURRENT_DESKTOP` env var is set in the D-Bus user session
+to one of the UseIn values in wlr.portal
%prep
%setup -q
++++++ xdg-desktop-portal-wlr-0.4.0.tar.gz ->
xdg-desktop-portal-wlr-0.5.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/xdg-desktop-portal-wlr-0.4.0/.builds/freebsd.yml
new/xdg-desktop-portal-wlr-0.5.0/.builds/freebsd.yml
--- old/xdg-desktop-portal-wlr-0.4.0/.builds/freebsd.yml 2021-05-26
08:35:38.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.5.0/.builds/freebsd.yml 2021-11-05
16:25:28.000000000 +0100
@@ -11,9 +11,6 @@
- scdoc
sources:
- https://github.com/emersion/xdg-desktop-portal-wlr
-environment:
- C_INCLUDE_PATH: /usr/local/include
- LIBRARY_PATH: /usr/local/lib
tasks:
- setup: |
cd xdg-desktop-portal-wlr
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/xdg-desktop-portal-wlr-0.4.0/include/pipewire_screencast.h
new/xdg-desktop-portal-wlr-0.5.0/include/pipewire_screencast.h
--- old/xdg-desktop-portal-wlr-0.4.0/include/pipewire_screencast.h
2021-05-26 08:35:38.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.5.0/include/pipewire_screencast.h
2021-11-05 16:25:28.000000000 +0100
@@ -6,6 +6,7 @@
#define XDPW_PWR_BUFFERS 1
#define XDPW_PWR_ALIGN 16
+void pwr_update_stream_param(struct xdpw_screencast_instance *cast);
void xdpw_pwr_stream_create(struct xdpw_screencast_instance *cast);
void xdpw_pwr_stream_destroy(struct xdpw_screencast_instance *cast);
int xdpw_pwr_context_create(struct xdpw_state *state);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/xdg-desktop-portal-wlr-0.4.0/include/screencast_common.h
new/xdg-desktop-portal-wlr-0.5.0/include/screencast_common.h
--- old/xdg-desktop-portal-wlr-0.4.0/include/screencast_common.h
2021-05-26 08:35:38.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.5.0/include/screencast_common.h
2021-11-05 16:25:28.000000000 +0100
@@ -92,11 +92,12 @@
uint32_t seq;
uint32_t node_id;
bool pwr_stream_state;
+ uint32_t framerate;
// wlroots
struct zwlr_screencopy_frame_v1 *frame_callback;
struct xdpw_wlr_output *target_output;
- uint32_t framerate;
+ uint32_t max_framerate;
struct zwlr_screencopy_frame_v1 *wlr_frame;
struct xdpw_frame simple_frame;
bool with_cursor;
@@ -121,8 +122,8 @@
};
void randname(char *buf);
-enum spa_video_format xdpw_format_pw_from_wl_shm(
- struct xdpw_screencast_instance *cast);
+int anonymous_shm_open(void);
+enum spa_video_format xdpw_format_pw_from_wl_shm(enum wl_shm_format format);
enum spa_video_format xdpw_format_pw_strip_alpha(enum spa_video_format format);
enum xdpw_chooser_types get_chooser_type(const char *chooser_type);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/xdg-desktop-portal-wlr-0.4.0/meson.build
new/xdg-desktop-portal-wlr-0.5.0/meson.build
--- old/xdg-desktop-portal-wlr-0.4.0/meson.build 2021-05-26
08:35:38.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.5.0/meson.build 2021-11-05
16:25:28.000000000 +0100
@@ -1,7 +1,7 @@
project(
'xdg-desktop-portal-wlr',
'c',
- version: '0.3.0',
+ version: '0.5.0',
license: 'MIT',
meson_version: '>=0.50.0',
default_options: ['c_std=c11', 'warning_level=2', 'werror=true'],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/xdg-desktop-portal-wlr-0.4.0/src/core/config.c
new/xdg-desktop-portal-wlr-0.5.0/src/core/config.c
--- old/xdg-desktop-portal-wlr-0.4.0/src/core/config.c 2021-05-26
08:35:38.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.5.0/src/core/config.c 2021-11-05
16:25:28.000000000 +0100
@@ -106,9 +106,12 @@
static char *get_config_path(void) {
const char *home = getenv("HOME");
- size_t size_fallback = 1 + strlen(home) + strlen("/.config");
- char *config_home_fallback = calloc(size_fallback, sizeof(char));
- snprintf(config_home_fallback, size_fallback, "%s/.config", home);
+ char *config_home_fallback = NULL;
+ if (home != NULL && home[0] != '\0') {
+ size_t size_fallback = 1 + strlen(home) + strlen("/.config");
+ config_home_fallback = calloc(size_fallback, sizeof(char));
+ snprintf(config_home_fallback, size_fallback, "%s/.config",
home);
+ }
const char *config_home = getenv("XDG_CONFIG_HOME");
if (config_home == NULL || config_home[0] == '\0') {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/xdg-desktop-portal-wlr-0.4.0/src/core/main.c
new/xdg-desktop-portal-wlr-0.5.0/src/core/main.c
--- old/xdg-desktop-portal-wlr-0.4.0/src/core/main.c 2021-05-26
08:35:38.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.5.0/src/core/main.c 2021-11-05
16:25:28.000000000 +0100
@@ -196,6 +196,19 @@
goto error;
}
+ if (pollfds[EVENT_LOOP_DBUS].revents & POLLHUP) {
+ logprint(INFO, "event-loop: disconnected from dbus");
+ break;
+ }
+ if (pollfds[EVENT_LOOP_WAYLAND].revents & POLLHUP) {
+ logprint(INFO, "event-loop: disconnected from wayland");
+ break;
+ }
+ if (pollfds[EVENT_LOOP_PIPEWIRE].revents & POLLHUP) {
+ logprint(INFO, "event-loop: disconnected from
pipewire");
+ break;
+ }
+
if (pollfds[EVENT_LOOP_DBUS].revents & POLLIN) {
logprint(TRACE, "event-loop: got dbus event");
do {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/xdg-desktop-portal-wlr-0.4.0/src/screencast/pipewire_screencast.c
new/xdg-desktop-portal-wlr-0.5.0/src/screencast/pipewire_screencast.c
--- old/xdg-desktop-portal-wlr-0.4.0/src/screencast/pipewire_screencast.c
2021-05-26 08:35:38.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.5.0/src/screencast/pipewire_screencast.c
2021-11-05 16:25:28.000000000 +0100
@@ -5,6 +5,8 @@
#include <spa/param/props.h>
#include <spa/param/format-utils.h>
#include <spa/param/video/format-utils.h>
+#include <sys/mman.h>
+#include <unistd.h>
#include "wlr_screencast.h"
#include "xdpw.h"
@@ -26,6 +28,37 @@
return;
}
+static struct spa_pod *build_format(struct spa_pod_builder *b, enum
spa_video_format format,
+ uint32_t width, uint32_t height, uint32_t framerate) {
+ struct spa_pod_frame f[1];
+
+ enum spa_video_format format_without_alpha =
xdpw_format_pw_strip_alpha(format);
+
+ spa_pod_builder_push_object(b, &f[0], SPA_TYPE_OBJECT_Format,
SPA_PARAM_EnumFormat);
+ spa_pod_builder_add(b, SPA_FORMAT_mediaType,
SPA_POD_Id(SPA_MEDIA_TYPE_video), 0);
+ spa_pod_builder_add(b, SPA_FORMAT_mediaSubtype,
SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw), 0);
+ /* format */
+ if (format_without_alpha == SPA_VIDEO_FORMAT_UNKNOWN) {
+ spa_pod_builder_add(b, SPA_FORMAT_VIDEO_format,
SPA_POD_Id(format), 0);
+ } else {
+ spa_pod_builder_add(b, SPA_FORMAT_VIDEO_format,
+ SPA_POD_CHOICE_ENUM_Id(3, format, format,
format_without_alpha), 0);
+ }
+ spa_pod_builder_add(b, SPA_FORMAT_VIDEO_size,
+ SPA_POD_Rectangle(&SPA_RECTANGLE(width, height)),
+ 0);
+ // variable framerate
+ spa_pod_builder_add(b, SPA_FORMAT_VIDEO_framerate,
+ SPA_POD_Fraction(&SPA_FRACTION(0, 1)), 0);
+ spa_pod_builder_add(b, SPA_FORMAT_VIDEO_maxFramerate,
+ SPA_POD_CHOICE_RANGE_Fraction(
+ &SPA_FRACTION(framerate, 1),
+ &SPA_FRACTION(1, 1),
+ &SPA_FRACTION(framerate, 1)),
+ 0);
+ return spa_pod_builder_pop(b, &f[0]);
+}
+
static void pwr_on_event(void *data, uint64_t expirations) {
struct xdpw_screencast_instance *cast = data;
struct pw_buffer *pw_buf;
@@ -54,15 +87,6 @@
h->dts_offset = 0;
}
- d[0].type = SPA_DATA_MemPtr;
- d[0].maxsize = cast->simple_frame.size;
- d[0].mapoffset = 0;
- d[0].chunk->size = cast->simple_frame.size;
- d[0].chunk->stride = cast->simple_frame.stride;
- d[0].chunk->offset = 0;
- d[0].flags = 0;
- d[0].fd = -1;
-
writeFrameData(d[0].data, cast->simple_frame.data,
cast->simple_frame.height,
cast->simple_frame.stride, cast->simple_frame.y_invert);
@@ -87,7 +111,7 @@
logprint(INFO, "pipewire: stream state changed to \"%s\"",
pw_stream_state_as_string(state));
- logprint(INFO, "pipewire: node id is %d", cast->node_id);
+ logprint(INFO, "pipewire: node id is %d", (int)cast->node_id);
switch (state) {
case PW_STREAM_STATE_STREAMING:
@@ -101,6 +125,7 @@
static void pwr_handle_stream_param_changed(void *data, uint32_t id,
const struct spa_pod *param) {
+ logprint(TRACE, "pipewire: stream parameters changed");
struct xdpw_screencast_instance *cast = data;
struct pw_stream *stream = cast->stream;
uint8_t params_buffer[1024];
@@ -113,6 +138,7 @@
}
spa_format_video_raw_parse(param, &cast->pwr_format);
+ cast->framerate = (uint32_t)(cast->pwr_format.max_framerate.num /
cast->pwr_format.max_framerate.denom);
params[0] = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
@@ -120,7 +146,8 @@
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
SPA_PARAM_BUFFERS_size, SPA_POD_Int(cast->simple_frame.size),
SPA_PARAM_BUFFERS_stride,
SPA_POD_Int(cast->simple_frame.stride),
- SPA_PARAM_BUFFERS_align, SPA_POD_Int(XDPW_PWR_ALIGN));
+ SPA_PARAM_BUFFERS_align, SPA_POD_Int(XDPW_PWR_ALIGN),
+
SPA_PARAM_BUFFERS_dataType,SPA_POD_CHOICE_FLAGS_Int(1<<SPA_DATA_MemFd));
params[1] = spa_pod_builder_add_object(&b,
SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
@@ -130,12 +157,96 @@
pw_stream_update_params(stream, params, 2);
}
+static void pwr_handle_stream_add_buffer(void *data, struct pw_buffer *buffer)
{
+ struct xdpw_screencast_instance *cast = data;
+ struct spa_data *d;
+
+ logprint(TRACE, "pipewire: add buffer event handle");
+
+ d = buffer->buffer->datas;
+
+ // Select buffer type from negotiation result
+ if ((d[0].type & (1u << SPA_DATA_MemFd)) > 0) {
+ d[0].type = SPA_DATA_MemFd;
+ } else {
+ logprint(ERROR, "pipewire: unsupported buffer type");
+ cast->err = 1;
+ return;
+ }
+
+ logprint(TRACE, "pipewire: selected buffertype %u", d[0].type);
+ // Prepare buffer for choosen type
+ if (d[0].type == SPA_DATA_MemFd) {
+ d[0].maxsize = cast->simple_frame.size;
+ d[0].mapoffset = 0;
+ d[0].chunk->size = cast->simple_frame.size;
+ d[0].chunk->stride = cast->simple_frame.stride;
+ d[0].chunk->offset = 0;
+ d[0].flags = 0;
+ d[0].fd = anonymous_shm_open();
+
+ if (d[0].fd == -1) {
+ logprint(ERROR, "pipewire: unable to create anonymous
filedescriptor");
+ cast->err = 1;
+ return;
+ }
+
+ if (ftruncate(d[0].fd, d[0].maxsize) < 0) {
+ logprint(ERROR, "pipewire: unable to truncate
filedescriptor");
+ close(d[0].fd);
+ d[0].fd = -1;
+ cast->err = 1;
+ return;
+ }
+
+ // mmap buffer, so we can use the data_ptr in on_process
+ d[0].data = mmap(NULL, d[0].maxsize, PROT_READ | PROT_WRITE,
MAP_SHARED, d[0].fd, d[0].mapoffset);
+ if (d[0].data == MAP_FAILED) {
+ logprint(ERROR, "pipewire: unable to mmap memory");
+ cast->err = 1;
+ return;
+ }
+ }
+}
+
+static void pwr_handle_stream_remove_buffer(void *data, struct pw_buffer
*buffer) {
+ logprint(TRACE, "pipewire: remove buffer event handle");
+
+ struct spa_data *d = buffer->buffer->datas;
+ switch (d[0].type) {
+ case SPA_DATA_MemFd:
+ munmap(d[0].data, d[0].maxsize);
+ close(d[0].fd);
+ break;
+ default:
+ break;
+ }
+}
+
static const struct pw_stream_events pwr_stream_events = {
PW_VERSION_STREAM_EVENTS,
.state_changed = pwr_handle_stream_state_changed,
.param_changed = pwr_handle_stream_param_changed,
+ .add_buffer = pwr_handle_stream_add_buffer,
+ .remove_buffer = pwr_handle_stream_remove_buffer,
};
+void pwr_update_stream_param(struct xdpw_screencast_instance *cast) {
+ logprint(TRACE, "pipewire: stream update parameters");
+ struct pw_stream *stream = cast->stream;
+ uint8_t params_buffer[1024];
+ struct spa_pod_builder b =
+ SPA_POD_BUILDER_INIT(params_buffer, sizeof(params_buffer));
+ const struct spa_pod *params[1];
+
+ enum spa_video_format format =
xdpw_format_pw_from_wl_shm(cast->simple_frame.format);
+
+ params[0] = build_format(&b, format,
+ cast->simple_frame.width, cast->simple_frame.height,
cast->framerate);
+
+ pw_stream_update_params(stream, params, 1);
+}
+
void xdpw_pwr_stream_create(struct xdpw_screencast_instance *cast) {
struct xdpw_screencast_context *ctx = cast->ctx;
struct xdpw_state *state = ctx->state;
@@ -163,37 +274,10 @@
pw_loop_add_event(state->pw_loop, pwr_on_event, cast);
logprint(DEBUG, "pipewire: registered event %p", cast->event);
- enum spa_video_format format = xdpw_format_pw_from_wl_shm(cast);
- enum spa_video_format format_without_alpha =
- xdpw_format_pw_strip_alpha(format);
-
- struct spa_pod_frame f;
- spa_pod_builder_push_object(&b, &f, SPA_TYPE_OBJECT_Format,
SPA_PARAM_EnumFormat);
- spa_pod_builder_add(&b, SPA_FORMAT_mediaType,
SPA_POD_Id(SPA_MEDIA_TYPE_video), 0);
- spa_pod_builder_add(&b, SPA_FORMAT_mediaSubtype,
SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw), 0);
- if (format_without_alpha != SPA_VIDEO_FORMAT_UNKNOWN) {
- spa_pod_builder_add(&b, SPA_FORMAT_VIDEO_format,
- SPA_POD_CHOICE_ENUM_Id(3, format, format,
format_without_alpha), 0);
- } else {
- spa_pod_builder_add(&b, SPA_FORMAT_VIDEO_format,
- SPA_POD_CHOICE_ENUM_Id(2, format, format), 0);
- }
- spa_pod_builder_add(&b, SPA_FORMAT_VIDEO_size,
- SPA_POD_CHOICE_RANGE_Rectangle(
- &SPA_RECTANGLE(cast->simple_frame.width,
cast->simple_frame.height),
- &SPA_RECTANGLE(1, 1),
- &SPA_RECTANGLE(4096, 4096)),
- 0);
- // variable framerate
- spa_pod_builder_add(&b, SPA_FORMAT_VIDEO_framerate,
- SPA_POD_Fraction(&SPA_FRACTION(0, 1)), 0);
- spa_pod_builder_add(&b, SPA_FORMAT_VIDEO_maxFramerate,
- SPA_POD_CHOICE_RANGE_Fraction(
- &SPA_FRACTION(cast->framerate, 1),
- &SPA_FRACTION(1, 1),
- &SPA_FRACTION(cast->framerate, 1)),
- 0);
- const struct spa_pod *param = spa_pod_builder_pop(&b, &f);
+ enum spa_video_format format =
xdpw_format_pw_from_wl_shm(cast->simple_frame.format);
+
+ const struct spa_pod *param = build_format(&b, format,
+ cast->simple_frame.width, cast->simple_frame.height,
cast->framerate);
pw_stream_add_listener(cast->stream, &cast->stream_listener,
&pwr_stream_events, cast);
@@ -202,7 +286,7 @@
PW_DIRECTION_OUTPUT,
PW_ID_ANY,
(PW_STREAM_FLAG_DRIVER |
- PW_STREAM_FLAG_MAP_BUFFERS),
+ PW_STREAM_FLAG_ALLOC_BUFFERS),
¶m, 1);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/xdg-desktop-portal-wlr-0.4.0/src/screencast/screencast.c
new/xdg-desktop-portal-wlr-0.5.0/src/screencast/screencast.c
--- old/xdg-desktop-portal-wlr-0.4.0/src/screencast/screencast.c
2021-05-26 08:35:38.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.5.0/src/screencast/screencast.c
2021-11-05 16:25:28.000000000 +0100
@@ -19,20 +19,30 @@
static const char interface_name[] = "org.freedesktop.impl.portal.ScreenCast";
void exec_with_shell(char *command) {
- pid_t pid = fork();
- if (pid < 0) {
+ pid_t pid1 = fork();
+ if (pid1 < 0) {
perror("fork");
- } else if (pid == 0) {
- char *const argv[] = {
- "sh",
- "-c",
- command,
- NULL,
- };
- execvp("sh", argv);
-
- perror("execvp");
- exit(127);
+ return;
+ } else if (pid1 == 0) {
+ pid_t pid2 = fork();
+ if (pid2 < 0) {
+ perror("fork");
+ } else if (pid2 == 0) {
+ char *const argv[] = {
+ "sh",
+ "-c",
+ command,
+ NULL,
+ };
+ execvp("sh", argv);
+ perror("execvp");
+ _exit(127);
+ }
+ _exit(0);
+ }
+ int stat;
+ if (waitpid(pid1, &stat, 0) < 0) {
+ perror("waitpid");
}
}
@@ -50,9 +60,16 @@
cast->ctx = ctx;
cast->target_output = out;
- cast->framerate = out->framerate;
+ if (ctx->state->config->screencast_conf.max_fps > 0) {
+ cast->max_framerate =
ctx->state->config->screencast_conf.max_fps < (uint32_t)out->framerate ?
+ ctx->state->config->screencast_conf.max_fps :
(uint32_t)out->framerate;
+ } else {
+ cast->max_framerate = (uint32_t)out->framerate;
+ }
+ cast->framerate = cast->max_framerate;
cast->with_cursor = with_cursor;
cast->refcount = 1;
+ cast->node_id = SPA_ID_INVALID;
logprint(INFO, "xdpw: screencast instance %p has %d references", cast,
cast->refcount);
wl_list_insert(&ctx->screencast_instances, &cast->link);
logprint(INFO, "xdpw: %d active screencast instances",
@@ -261,9 +278,9 @@
}
if (strcmp(key, "multiple") == 0) {
- bool multiple;
+ int multiple;
sd_bus_message_read(msg, "v", "b", &multiple);
- logprint(INFO, "dbus: option multiple: %x", multiple);
+ logprint(INFO, "dbus: option multiple: %d", multiple);
} else if (strcmp(key, "types") == 0) {
uint32_t mask;
sd_bus_message_read(msg, "v", "u", &mask);
@@ -413,7 +430,7 @@
start_screencast(cast);
}
- while (cast->node_id == 0) {
+ while (cast->node_id == SPA_ID_INVALID) {
int ret = pw_loop_iterate(state->pw_loop, 0);
if (ret != 0) {
logprint(ERROR, "pipewire_loop_iterate failed: %s",
spa_strerror(ret));
@@ -426,6 +443,7 @@
return ret;
}
+ logprint(DEBUG, "dbus: start: returning node %d", (int)cast->node_id);
ret = sd_bus_message_append(reply, "ua{sv}", PORTAL_RESPONSE_SUCCESS, 1,
"streams", "a(ua{sv})", 1,
cast->node_id, 2,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/xdg-desktop-portal-wlr-0.4.0/src/screencast/screencast_common.c
new/xdg-desktop-portal-wlr-0.5.0/src/screencast/screencast_common.c
--- old/xdg-desktop-portal-wlr-0.4.0/src/screencast/screencast_common.c
2021-05-26 08:35:38.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.5.0/src/screencast/screencast_common.c
2021-11-05 16:25:28.000000000 +0100
@@ -1,5 +1,10 @@
#include "screencast_common.h"
#include <assert.h>
+#include <fcntl.h>
+#include <string.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <unistd.h>
void randname(char *buf) {
struct timespec ts;
@@ -12,9 +17,27 @@
}
}
-enum spa_video_format xdpw_format_pw_from_wl_shm(
- struct xdpw_screencast_instance *cast) {
- switch (cast->simple_frame.format) {
+int anonymous_shm_open(void) {
+ char name[] = "/xdpw-shm-XXXXXX";
+ int retries = 100;
+
+ do {
+ randname(name + strlen(name) - 6);
+
+ --retries;
+ // shm_open guarantees that O_CLOEXEC is set
+ int fd = shm_open(name, O_RDWR | O_CREAT | O_EXCL, S_IRUSR |
S_IWUSR);
+ if (fd >= 0) {
+ shm_unlink(name);
+ return fd;
+ }
+ } while (retries > 0 && errno == EEXIST);
+
+ return -1;
+}
+
+enum spa_video_format xdpw_format_pw_from_wl_shm(enum wl_shm_format format) {
+ switch (format) {
case WL_SHM_FORMAT_ARGB8888:
return SPA_VIDEO_FORMAT_BGRA;
case WL_SHM_FORMAT_XRGB8888:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/xdg-desktop-portal-wlr-0.4.0/src/screencast/wlr_screencast.c
new/xdg-desktop-portal-wlr-0.5.0/src/screencast/wlr_screencast.c
--- old/xdg-desktop-portal-wlr-0.4.0/src/screencast/wlr_screencast.c
2021-05-26 08:35:38.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.5.0/src/screencast/wlr_screencast.c
2021-11-05 16:25:28.000000000 +0100
@@ -52,7 +52,7 @@
return ;
}
- uint64_t delay_ns = fps_limit_measure_end(&cast->fps_limit,
cast->ctx->state->config->screencast_conf.max_fps);
+ uint64_t delay_ns = fps_limit_measure_end(&cast->fps_limit,
cast->framerate);
if (delay_ns > 0) {
xdpw_add_timer(cast->ctx->state, delay_ns,
(xdpw_event_loop_timer_func_t) xdpw_wlr_register_cb,
cast);
@@ -61,25 +61,6 @@
}
}
-static int anonymous_shm_open(void) {
- char name[] = "/xdpw-shm-XXXXXX";
- int retries = 100;
-
- do {
- randname(name + strlen(name) - 6);
-
- --retries;
- // shm_open guarantees that O_CLOEXEC is set
- int fd = shm_open(name, O_RDWR | O_CREAT | O_EXCL, S_IRUSR |
S_IWUSR);
- if (fd >= 0) {
- shm_unlink(name);
- return fd;
- }
- } while (retries > 0 && errno == EEXIST);
-
- return -1;
-}
-
static struct wl_buffer *create_shm_buffer(struct xdpw_screencast_instance
*cast,
enum wl_shm_format fmt, int width, int height, int stride,
void **data_out) {
@@ -127,6 +108,11 @@
cast->simple_frame.size = stride * height;
cast->simple_frame.format = format;
wlr_frame_buffer_destroy(cast);
+
+ if (cast->pwr_stream_state) {
+ logprint(DEBUG, "wlroots: request pipewire param change");
+ pwr_update_stream_param(cast);
+ }
}
static void wlr_frame_linux_dmabuf(void *data,
@@ -144,7 +130,7 @@
zwlr_screencopy_frame_v1_copy_with_damage(frame,
cast->simple_frame.buffer);
logprint(TRACE, "wlroots: frame copied");
- fps_limit_measure_start(&cast->fps_limit,
cast->ctx->state->config->screencast_conf.max_fps);
+ fps_limit_measure_start(&cast->fps_limit, cast->framerate);
}
static void wlr_frame_buffer(void *data, struct zwlr_screencopy_frame_v1
*frame,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/xdg-desktop-portal-wlr-0.4.0/src/screenshot/screenshot.c
new/xdg-desktop-portal-wlr-0.5.0/src/screenshot/screenshot.c
--- old/xdg-desktop-portal-wlr-0.4.0/src/screenshot/screenshot.c
2021-05-26 08:35:38.000000000 +0200
+++ new/xdg-desktop-portal-wlr-0.5.0/src/screenshot/screenshot.c
2021-11-05 16:25:28.000000000 +0100
@@ -83,14 +83,14 @@
}
if (strcmp(key, "interactive") == 0) {
- bool mode;
+ int mode;
sd_bus_message_read(msg, "v", "b", &mode);
- logprint(DEBUG, "dbus: option interactive: %x", mode);
+ logprint(DEBUG, "dbus: option interactive: %d", mode);
interactive = mode;
} else if (strcmp(key, "modal") == 0) {
- bool modal;
+ int modal;
sd_bus_message_read(msg, "v", "b", &modal);
- logprint(DEBUG, "dbus: option modal: %x", modal);
+ logprint(DEBUG, "dbus: option modal: %d", modal);
} else {
logprint(WARN, "dbus: unknown option %s", key);
sd_bus_message_skip(msg, "v");