public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: dev-libs/weston/, dev-libs/weston/files/
@ 2021-05-20 21:22 James Le Cuirot
  0 siblings, 0 replies; 5+ messages in thread
From: James Le Cuirot @ 2021-05-20 21:22 UTC (permalink / raw
  To: gentoo-commits

commit:     9031e022859acdbe2709b60451a0a6e4f797463d
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Thu May 20 21:22:12 2021 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Thu May 20 21:22:12 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9031e022

dev-libs/weston: Patch 9.0.0 to build with pipewire 0.3

Closes: https://bugs.gentoo.org/790236
Package-Manager: Portage-3.0.18, Repoman-3.0.2
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 dev-libs/weston/files/weston-pipewire-0.3.patch | 373 ++++++++++++++++++++++++
 dev-libs/weston/weston-9.0.0.ebuild             |   4 +
 2 files changed, 377 insertions(+)

diff --git a/dev-libs/weston/files/weston-pipewire-0.3.patch b/dev-libs/weston/files/weston-pipewire-0.3.patch
new file mode 100644
index 00000000000..a38250d8c8f
--- /dev/null
+++ b/dev-libs/weston/files/weston-pipewire-0.3.patch
@@ -0,0 +1,373 @@
+https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/456
+
+diff --git a/pipewire/meson.build b/pipewire/meson.build
+index 67db61f0777325695864db2bc6cf94145ed5564d..944b2259f146e07abdbd4773223f4bdb76dfa45a 100644
+--- a/pipewire/meson.build
++++ b/pipewire/meson.build
+@@ -5,17 +5,25 @@ if get_option('pipewire')
+ 		error('Attempting to build the pipewire plugin without the required DRM backend. ' + user_hint)
+ 	endif
+ 
+-	depnames = [
+-		'libpipewire-0.2', 'libspa-0.1'
+-	]
+ 	deps_pipewire = [ dep_libweston_private ]
+-	foreach depname : depnames
+-		dep = dependency(depname, required: false)
+-		if not dep.found()
+-			error('Pipewire plugin requires @0@ which was not found. '.format(depname) + user_hint)
+-		endif
+-		deps_pipewire += dep
+-	endforeach
++
++	dep_libpipewire = dependency('libpipewire-0.3', required: false)
++	if not dep_libpipewire.found()
++		dep_libpipewire = dependency('libpipewire-0.2', required: false)
++	endif
++	if not dep_libpipewire.found()
++		error('Pipewire plugin requires libpipewire which was not found. ' + user_hint)
++	endif
++	deps_pipewire += dep_libpipewire
++
++	dep_libspa = dependency('libspa-0.2', required: false)
++	if not dep_libspa.found()
++		dep_libspa = dependency('libspa-0.1', required: false)
++	endif
++	if not dep_libspa.found()
++		error('Pipewire plugin requires libspa which was not found. ' + user_hint)
++	endif
++	deps_pipewire += dep_libspa
+ 
+ 	plugin_pipewire = shared_library(
+ 		'pipewire-plugin',
+diff --git a/pipewire/pipewire-plugin.c b/pipewire/pipewire-plugin.c
+index fe7eb1d654d5ec67f7a3287532bb21c19ad9eac5..2c65f502c2917c23290a51bf1c24eac8d50129f1 100644
+--- a/pipewire/pipewire-plugin.c
++++ b/pipewire/pipewire-plugin.c
+@@ -34,20 +34,27 @@
+ #include <errno.h>
+ #include <unistd.h>
+ 
++#include <pipewire/pipewire.h>
++
+ #include <spa/param/format-utils.h>
+ #include <spa/param/video/format-utils.h>
+ #include <spa/utils/defs.h>
+ 
+-#include <pipewire/pipewire.h>
++#if PW_CHECK_VERSION(0, 2, 90)
++#include <spa/buffer/meta.h>
++#include <spa/utils/result.h>
++#endif
+ 
+ #define PROP_RANGE(min, max) 2, (min), (max)
+ 
++#if !PW_CHECK_VERSION(0, 2, 90)
+ struct type {
+ 	struct spa_type_media_type media_type;
+ 	struct spa_type_media_subtype media_subtype;
+ 	struct spa_type_format_video format_video;
+ 	struct spa_type_video_format video_format;
+ };
++#endif
+ 
+ struct weston_pipewire {
+ 	struct weston_compositor *compositor;
+@@ -60,12 +67,19 @@ struct weston_pipewire {
+ 	struct pw_loop *loop;
+ 	struct wl_event_source *loop_source;
+ 
++#if PW_CHECK_VERSION(0, 2, 90)
++	struct pw_context *context;
++#endif
+ 	struct pw_core *core;
+ 	struct pw_type *t;
++#if PW_CHECK_VERSION(0, 2, 90)
++	struct spa_hook core_listener;
++#else
+ 	struct type type;
+ 
+ 	struct pw_remote *remote;
+ 	struct spa_hook remote_listener;
++#endif
+ };
+ 
+ struct pipewire_output {
+@@ -100,6 +114,7 @@ struct pipewire_frame_data {
+ 	struct wl_event_source *fence_sync_event_source;
+ };
+ 
++#if !PW_CHECK_VERSION(0, 2, 90)
+ static inline void init_type(struct type *type, struct spa_type_map *map)
+ {
+ 	spa_type_media_type_map(map, &type->media_type);
+@@ -107,6 +122,7 @@ static inline void init_type(struct type *type, struct spa_type_map *map)
+ 	spa_type_format_video_map(map, &type->format_video);
+ 	spa_type_video_format_map(map, &type->video_format);
+ }
++#endif
+ 
+ static void
+ pipewire_debug_impl(struct weston_pipewire *pipewire,
+@@ -141,6 +157,7 @@ pipewire_debug_impl(struct weston_pipewire *pipewire,
+ 	free(logstr);
+ }
+ 
++#if !PW_CHECK_VERSION(0, 2, 90)
+ static void
+ pipewire_debug(struct weston_pipewire *pipewire, const char *fmt, ...)
+ {
+@@ -150,6 +167,7 @@ pipewire_debug(struct weston_pipewire *pipewire, const char *fmt, ...)
+ 	pipewire_debug_impl(pipewire, NULL, fmt, ap);
+ 	va_end(ap);
+ }
++#endif
+ 
+ static void
+ pipewire_output_debug(struct pipewire_output *output, const char *fmt, ...)
+@@ -185,7 +203,9 @@ pipewire_output_handle_frame(struct pipewire_output *output, int fd,
+ 	const struct weston_drm_virtual_output_api *api =
+ 		output->pipewire->virtual_output_api;
+ 	size_t size = output->output->height * stride;
++#if !PW_CHECK_VERSION(0, 2, 90)
+ 	struct pw_type *t = output->pipewire->t;
++#endif
+ 	struct pw_buffer *buffer;
+ 	struct spa_buffer *spa_buffer;
+ 	struct spa_meta_header *h;
+@@ -203,7 +223,12 @@ pipewire_output_handle_frame(struct pipewire_output *output, int fd,
+ 
+ 	spa_buffer = buffer->buffer;
+ 
++#if PW_CHECK_VERSION(0, 2, 90)
++	if ((h = spa_buffer_find_meta_data(spa_buffer, SPA_META_Header,
++				     sizeof(struct spa_meta_header)))) {
++#else
+ 	if ((h = spa_buffer_find_meta(spa_buffer, t->meta.Header))) {
++#endif
+ 		h->pts = -1;
+ 		h->flags = 0;
+ 		h->seq = output->seq++;
+@@ -375,18 +400,40 @@ pipewire_set_dpms(struct weston_output *base_output, enum dpms_enum level)
+ static int
+ pipewire_output_connect(struct pipewire_output *output)
+ {
++#if !PW_CHECK_VERSION(0, 2, 90)
+ 	struct weston_pipewire *pipewire = output->pipewire;
+ 	struct type *type = &pipewire->type;
++#endif
+ 	uint8_t buffer[1024];
+ 	struct spa_pod_builder builder =
+ 		SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
+ 	const struct spa_pod *params[1];
++#if !PW_CHECK_VERSION(0, 2, 90)
+ 	struct pw_type *t = pipewire->t;
++#endif
+ 	int frame_rate = output->output->current_mode->refresh / 1000;
+ 	int width = output->output->width;
+ 	int height = output->output->height;
+ 	int ret;
+ 
++#if PW_CHECK_VERSION(0, 2, 90)
++	params[0] = spa_pod_builder_add_object(&builder,
++		SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
++		SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video),
++		SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
++		SPA_FORMAT_VIDEO_format, SPA_POD_Id(SPA_VIDEO_FORMAT_BGRx),
++		SPA_FORMAT_VIDEO_size, SPA_POD_Rectangle(&SPA_RECTANGLE(width, height)),
++		SPA_FORMAT_VIDEO_framerate, SPA_POD_Fraction(&SPA_FRACTION (0, 1)),
++		SPA_FORMAT_VIDEO_maxFramerate,
++		SPA_POD_CHOICE_RANGE_Fraction(&SPA_FRACTION(frame_rate, 1),
++			&SPA_FRACTION(1, 1),
++			&SPA_FRACTION(frame_rate, 1)));
++
++	ret = pw_stream_connect(output->stream, PW_DIRECTION_OUTPUT, SPA_ID_INVALID,
++				(PW_STREAM_FLAG_DRIVER |
++				 PW_STREAM_FLAG_MAP_BUFFERS),
++				params, 1);
++#else
+ 	params[0] = spa_pod_builder_object(&builder,
+ 		t->param.idEnumFormat, t->spa_format,
+ 		"I", type->media_type.video,
+@@ -406,6 +453,7 @@ pipewire_output_connect(struct pipewire_output *output)
+ 				(PW_STREAM_FLAG_DRIVER |
+ 				 PW_STREAM_FLAG_MAP_BUFFERS),
+ 				params, 1);
++#endif
+ 	if (ret != 0) {
+ 		weston_log("Failed to connect pipewire stream: %s",
+ 			   spa_strerror(ret));
+@@ -482,26 +530,42 @@ pipewire_output_stream_state_changed(void *data, enum pw_stream_state old,
+ }
+ 
+ static void
++#if PW_CHECK_VERSION(0, 2, 90)
++pipewire_output_stream_param_changed(void *data, uint32_t id, const struct spa_pod *format)
++#else
+ pipewire_output_stream_format_changed(void *data, const struct spa_pod *format)
++#endif
+ {
+ 	struct pipewire_output *output = data;
++#if !PW_CHECK_VERSION(0, 2, 90)
+ 	struct weston_pipewire *pipewire = output->pipewire;
++#endif
+ 	uint8_t buffer[1024];
+ 	struct spa_pod_builder builder =
+ 		SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
+ 	const struct spa_pod *params[2];
++#if !PW_CHECK_VERSION(0, 2, 90)
+ 	struct pw_type *t = pipewire->t;
++#endif
+ 	int32_t width, height, stride, size;
+ 	const int bpp = 4;
+ 
+ 	if (!format) {
+ 		pipewire_output_debug(output, "format = None");
++#if PW_CHECK_VERSION(0, 2, 90)
++		pw_stream_update_params(output->stream, NULL, 0);
++#else
+ 		pw_stream_finish_format(output->stream, 0, NULL, 0);
++#endif
+ 		return;
+ 	}
+ 
++#if PW_CHECK_VERSION(0, 2, 90)
++	spa_format_video_raw_parse(format, &output->video_format);
++#else
+ 	spa_format_video_raw_parse(format, &output->video_format,
+ 				   &pipewire->type.format_video);
++#endif
+ 
+ 	width = output->video_format.size.width;
+ 	height = output->video_format.size.height;
+@@ -510,6 +574,21 @@ pipewire_output_stream_format_changed(void *data, const struct spa_pod *format)
+ 
+ 	pipewire_output_debug(output, "format = %dx%d", width, height);
+ 
++#if PW_CHECK_VERSION(0, 2, 90)
++	params[0] = spa_pod_builder_add_object(&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(4, 2, 8),
++		SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
++
++	params[1] = spa_pod_builder_add_object(&builder,
++		SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
++		SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header),
++		SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header)));
++
++	pw_stream_update_params(output->stream, params, 2);
++#else
+ 	params[0] = spa_pod_builder_object(&builder,
+ 		t->param.idBuffers, t->param_buffers.Buffers,
+ 		":", t->param_buffers.size,
+@@ -527,12 +606,17 @@ pipewire_output_stream_format_changed(void *data, const struct spa_pod *format)
+ 		":", t->param_meta.size, "i", sizeof(struct spa_meta_header));
+ 
+ 	pw_stream_finish_format(output->stream, 0, params, 2);
++#endif
+ }
+ 
+ static const struct pw_stream_events stream_events = {
+ 	PW_VERSION_STREAM_EVENTS,
+ 	.state_changed = pipewire_output_stream_state_changed,
++#if PW_CHECK_VERSION(0, 2, 90)
++	.param_changed = pipewire_output_stream_param_changed,
++#else
+ 	.format_changed = pipewire_output_stream_format_changed,
++#endif
+ };
+ 
+ static struct weston_output *
+@@ -560,7 +644,11 @@ pipewire_output_create(struct weston_compositor *c, char *name)
+ 	if (!head)
+ 		goto err;
+ 
++#if PW_CHECK_VERSION(0, 2, 90)
++	output->stream = pw_stream_new(pipewire->core, name, NULL);
++#else
+ 	output->stream = pw_stream_new(pipewire->remote, name, NULL);
++#endif
+ 	if (!output->stream) {
+ 		weston_log("Cannot initialize pipewire stream\n");
+ 		goto err;
+@@ -704,6 +792,14 @@ weston_pipewire_loop_handler(int fd, uint32_t mask, void *data)
+ 	return 0;
+ }
+ 
++#if PW_CHECK_VERSION(0, 2, 90)
++static void
++weston_pipewire_error(void *data, uint32_t id, int seq, int res,
++			      const char *error)
++{
++	weston_log("pipewire remote error: %s\n", error);
++}
++#else
+ static void
+ weston_pipewire_state_changed(void *data, enum pw_remote_state old,
+ 			      enum pw_remote_state state, const char *error)
+@@ -725,12 +821,20 @@ weston_pipewire_state_changed(void *data, enum pw_remote_state old,
+ 		break;
+ 	}
+ }
++#endif
+ 
+ 
++#if PW_CHECK_VERSION(0, 2, 90)
++static const struct pw_core_events core_events = {
++	PW_VERSION_CORE_EVENTS,
++	.error = weston_pipewire_error,
++};
++#else
+ static const struct pw_remote_events remote_events = {
+ 	PW_VERSION_REMOTE_EVENTS,
+ 	.state_changed = weston_pipewire_state_changed,
+ };
++#endif
+ 
+ static int
+ weston_pipewire_init(struct weston_pipewire *pipewire)
+@@ -745,10 +849,19 @@ weston_pipewire_init(struct weston_pipewire *pipewire)
+ 
+ 	pw_loop_enter(pipewire->loop);
+ 
++#if PW_CHECK_VERSION(0, 2, 90)
++	pipewire->context = pw_context_new(pipewire->loop, NULL, 0);
++#else
+ 	pipewire->core = pw_core_new(pipewire->loop, NULL);
+ 	pipewire->t = pw_core_get_type(pipewire->core);
+ 	init_type(&pipewire->type, pipewire->t->map);
++#endif
+ 
++#if PW_CHECK_VERSION(0, 2, 90)
++	pw_core_add_listener(pipewire->core,
++			       &pipewire->core_listener,
++			       &core_events, pipewire);
++#else
+ 	pipewire->remote = pw_remote_new(pipewire->core, NULL, 0);
+ 	pw_remote_add_listener(pipewire->remote,
+ 			       &pipewire->remote_listener,
+@@ -777,6 +890,7 @@ weston_pipewire_init(struct weston_pipewire *pipewire)
+ 			goto err;
+ 		}
+ 	}
++#endif
+ 
+ 	loop = wl_display_get_event_loop(pipewire->compositor->wl_display);
+ 	pipewire->loop_source =
+@@ -786,12 +900,14 @@ weston_pipewire_init(struct weston_pipewire *pipewire)
+ 				     pipewire);
+ 
+ 	return 0;
++#if !PW_CHECK_VERSION(0, 2, 90)
+ err:
+ 	if (pipewire->remote)
+ 		pw_remote_destroy(pipewire->remote);
+ 	pw_loop_leave(pipewire->loop);
+ 	pw_loop_destroy(pipewire->loop);
+ 	return -1;
++#endif
+ }
+ 
+ static const struct weston_pipewire_api pipewire_api = {

diff --git a/dev-libs/weston/weston-9.0.0.ebuild b/dev-libs/weston/weston-9.0.0.ebuild
index 0cd0e4d86e4..85cdf01cd44 100644
--- a/dev-libs/weston/weston-9.0.0.ebuild
+++ b/dev-libs/weston/weston-9.0.0.ebuild
@@ -92,6 +92,10 @@ BDEPEND="
 	virtual/pkgconfig
 "
 
+PATCHES=(
+	"${FILESDIR}"/${PN}-pipewire-0.3.patch
+)
+
 src_configure() {
 	local emesonargs=(
 		$(meson_use drm backend-drm)


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/weston/, dev-libs/weston/files/
@ 2022-05-21  8:58 James Le Cuirot
  0 siblings, 0 replies; 5+ messages in thread
From: James Le Cuirot @ 2022-05-21  8:58 UTC (permalink / raw
  To: gentoo-commits

commit:     f2288b8b1eaa0b1c6267d6aa07af610585bb72a1
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Sat May 21 08:57:50 2022 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sat May 21 08:57:50 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f2288b8b

dev-libs/weston: Drop old 9.0.0-r2

Closes: https://bugs.gentoo.org/830946
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 dev-libs/weston/Manifest                        |   1 -
 dev-libs/weston/files/weston-pipewire-0.3.patch | 373 ------------------------
 dev-libs/weston/weston-9.0.0-r2.ebuild          | 152 ----------
 3 files changed, 526 deletions(-)

diff --git a/dev-libs/weston/Manifest b/dev-libs/weston/Manifest
index 1d2bf61666d9..ff35a7d9ebb6 100644
--- a/dev-libs/weston/Manifest
+++ b/dev-libs/weston/Manifest
@@ -1,2 +1 @@
 DIST weston-10.0.0.tar.xz 1774600 BLAKE2B b2b8fa4f7542aba03970ca8abf504f340f8f8da9f9581c16ceac5c702eac355f5d4244778393a8804017f39dff490431e26a48580746033158bd2d2b721437f8 SHA512 77e05530751e4f743eebf015ab5b78a1fcc66b774713b5e296cfffc488be84e459f811c85ac4280b7b63eebf4ff5c958dd7306376ab343e6b80feae16c8c35a4
-DIST weston-9.0.0.tar.xz 1555212 BLAKE2B 6c5feb3959ebe894861c6dc0817633b23e8518baf1c359c2967f111c071e9d4f166ef1421ad6465b036b3f1c485cab5f442476e7a44e3ec722cff576dea73852 SHA512 ccc263f8279b7b23e5c593b4a8a023de2c3dc178b1b8d6593599171770bcfe97608de9fcb77aa1cab39255451d289d323e51c317dae190c7641282e085b84f90

diff --git a/dev-libs/weston/files/weston-pipewire-0.3.patch b/dev-libs/weston/files/weston-pipewire-0.3.patch
deleted file mode 100644
index a38250d8c8f2..000000000000
--- a/dev-libs/weston/files/weston-pipewire-0.3.patch
+++ /dev/null
@@ -1,373 +0,0 @@
-https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/456
-
-diff --git a/pipewire/meson.build b/pipewire/meson.build
-index 67db61f0777325695864db2bc6cf94145ed5564d..944b2259f146e07abdbd4773223f4bdb76dfa45a 100644
---- a/pipewire/meson.build
-+++ b/pipewire/meson.build
-@@ -5,17 +5,25 @@ if get_option('pipewire')
- 		error('Attempting to build the pipewire plugin without the required DRM backend. ' + user_hint)
- 	endif
- 
--	depnames = [
--		'libpipewire-0.2', 'libspa-0.1'
--	]
- 	deps_pipewire = [ dep_libweston_private ]
--	foreach depname : depnames
--		dep = dependency(depname, required: false)
--		if not dep.found()
--			error('Pipewire plugin requires @0@ which was not found. '.format(depname) + user_hint)
--		endif
--		deps_pipewire += dep
--	endforeach
-+
-+	dep_libpipewire = dependency('libpipewire-0.3', required: false)
-+	if not dep_libpipewire.found()
-+		dep_libpipewire = dependency('libpipewire-0.2', required: false)
-+	endif
-+	if not dep_libpipewire.found()
-+		error('Pipewire plugin requires libpipewire which was not found. ' + user_hint)
-+	endif
-+	deps_pipewire += dep_libpipewire
-+
-+	dep_libspa = dependency('libspa-0.2', required: false)
-+	if not dep_libspa.found()
-+		dep_libspa = dependency('libspa-0.1', required: false)
-+	endif
-+	if not dep_libspa.found()
-+		error('Pipewire plugin requires libspa which was not found. ' + user_hint)
-+	endif
-+	deps_pipewire += dep_libspa
- 
- 	plugin_pipewire = shared_library(
- 		'pipewire-plugin',
-diff --git a/pipewire/pipewire-plugin.c b/pipewire/pipewire-plugin.c
-index fe7eb1d654d5ec67f7a3287532bb21c19ad9eac5..2c65f502c2917c23290a51bf1c24eac8d50129f1 100644
---- a/pipewire/pipewire-plugin.c
-+++ b/pipewire/pipewire-plugin.c
-@@ -34,20 +34,27 @@
- #include <errno.h>
- #include <unistd.h>
- 
-+#include <pipewire/pipewire.h>
-+
- #include <spa/param/format-utils.h>
- #include <spa/param/video/format-utils.h>
- #include <spa/utils/defs.h>
- 
--#include <pipewire/pipewire.h>
-+#if PW_CHECK_VERSION(0, 2, 90)
-+#include <spa/buffer/meta.h>
-+#include <spa/utils/result.h>
-+#endif
- 
- #define PROP_RANGE(min, max) 2, (min), (max)
- 
-+#if !PW_CHECK_VERSION(0, 2, 90)
- struct type {
- 	struct spa_type_media_type media_type;
- 	struct spa_type_media_subtype media_subtype;
- 	struct spa_type_format_video format_video;
- 	struct spa_type_video_format video_format;
- };
-+#endif
- 
- struct weston_pipewire {
- 	struct weston_compositor *compositor;
-@@ -60,12 +67,19 @@ struct weston_pipewire {
- 	struct pw_loop *loop;
- 	struct wl_event_source *loop_source;
- 
-+#if PW_CHECK_VERSION(0, 2, 90)
-+	struct pw_context *context;
-+#endif
- 	struct pw_core *core;
- 	struct pw_type *t;
-+#if PW_CHECK_VERSION(0, 2, 90)
-+	struct spa_hook core_listener;
-+#else
- 	struct type type;
- 
- 	struct pw_remote *remote;
- 	struct spa_hook remote_listener;
-+#endif
- };
- 
- struct pipewire_output {
-@@ -100,6 +114,7 @@ struct pipewire_frame_data {
- 	struct wl_event_source *fence_sync_event_source;
- };
- 
-+#if !PW_CHECK_VERSION(0, 2, 90)
- static inline void init_type(struct type *type, struct spa_type_map *map)
- {
- 	spa_type_media_type_map(map, &type->media_type);
-@@ -107,6 +122,7 @@ static inline void init_type(struct type *type, struct spa_type_map *map)
- 	spa_type_format_video_map(map, &type->format_video);
- 	spa_type_video_format_map(map, &type->video_format);
- }
-+#endif
- 
- static void
- pipewire_debug_impl(struct weston_pipewire *pipewire,
-@@ -141,6 +157,7 @@ pipewire_debug_impl(struct weston_pipewire *pipewire,
- 	free(logstr);
- }
- 
-+#if !PW_CHECK_VERSION(0, 2, 90)
- static void
- pipewire_debug(struct weston_pipewire *pipewire, const char *fmt, ...)
- {
-@@ -150,6 +167,7 @@ pipewire_debug(struct weston_pipewire *pipewire, const char *fmt, ...)
- 	pipewire_debug_impl(pipewire, NULL, fmt, ap);
- 	va_end(ap);
- }
-+#endif
- 
- static void
- pipewire_output_debug(struct pipewire_output *output, const char *fmt, ...)
-@@ -185,7 +203,9 @@ pipewire_output_handle_frame(struct pipewire_output *output, int fd,
- 	const struct weston_drm_virtual_output_api *api =
- 		output->pipewire->virtual_output_api;
- 	size_t size = output->output->height * stride;
-+#if !PW_CHECK_VERSION(0, 2, 90)
- 	struct pw_type *t = output->pipewire->t;
-+#endif
- 	struct pw_buffer *buffer;
- 	struct spa_buffer *spa_buffer;
- 	struct spa_meta_header *h;
-@@ -203,7 +223,12 @@ pipewire_output_handle_frame(struct pipewire_output *output, int fd,
- 
- 	spa_buffer = buffer->buffer;
- 
-+#if PW_CHECK_VERSION(0, 2, 90)
-+	if ((h = spa_buffer_find_meta_data(spa_buffer, SPA_META_Header,
-+				     sizeof(struct spa_meta_header)))) {
-+#else
- 	if ((h = spa_buffer_find_meta(spa_buffer, t->meta.Header))) {
-+#endif
- 		h->pts = -1;
- 		h->flags = 0;
- 		h->seq = output->seq++;
-@@ -375,18 +400,40 @@ pipewire_set_dpms(struct weston_output *base_output, enum dpms_enum level)
- static int
- pipewire_output_connect(struct pipewire_output *output)
- {
-+#if !PW_CHECK_VERSION(0, 2, 90)
- 	struct weston_pipewire *pipewire = output->pipewire;
- 	struct type *type = &pipewire->type;
-+#endif
- 	uint8_t buffer[1024];
- 	struct spa_pod_builder builder =
- 		SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
- 	const struct spa_pod *params[1];
-+#if !PW_CHECK_VERSION(0, 2, 90)
- 	struct pw_type *t = pipewire->t;
-+#endif
- 	int frame_rate = output->output->current_mode->refresh / 1000;
- 	int width = output->output->width;
- 	int height = output->output->height;
- 	int ret;
- 
-+#if PW_CHECK_VERSION(0, 2, 90)
-+	params[0] = spa_pod_builder_add_object(&builder,
-+		SPA_TYPE_OBJECT_Format, SPA_PARAM_EnumFormat,
-+		SPA_FORMAT_mediaType, SPA_POD_Id(SPA_MEDIA_TYPE_video),
-+		SPA_FORMAT_mediaSubtype, SPA_POD_Id(SPA_MEDIA_SUBTYPE_raw),
-+		SPA_FORMAT_VIDEO_format, SPA_POD_Id(SPA_VIDEO_FORMAT_BGRx),
-+		SPA_FORMAT_VIDEO_size, SPA_POD_Rectangle(&SPA_RECTANGLE(width, height)),
-+		SPA_FORMAT_VIDEO_framerate, SPA_POD_Fraction(&SPA_FRACTION (0, 1)),
-+		SPA_FORMAT_VIDEO_maxFramerate,
-+		SPA_POD_CHOICE_RANGE_Fraction(&SPA_FRACTION(frame_rate, 1),
-+			&SPA_FRACTION(1, 1),
-+			&SPA_FRACTION(frame_rate, 1)));
-+
-+	ret = pw_stream_connect(output->stream, PW_DIRECTION_OUTPUT, SPA_ID_INVALID,
-+				(PW_STREAM_FLAG_DRIVER |
-+				 PW_STREAM_FLAG_MAP_BUFFERS),
-+				params, 1);
-+#else
- 	params[0] = spa_pod_builder_object(&builder,
- 		t->param.idEnumFormat, t->spa_format,
- 		"I", type->media_type.video,
-@@ -406,6 +453,7 @@ pipewire_output_connect(struct pipewire_output *output)
- 				(PW_STREAM_FLAG_DRIVER |
- 				 PW_STREAM_FLAG_MAP_BUFFERS),
- 				params, 1);
-+#endif
- 	if (ret != 0) {
- 		weston_log("Failed to connect pipewire stream: %s",
- 			   spa_strerror(ret));
-@@ -482,26 +530,42 @@ pipewire_output_stream_state_changed(void *data, enum pw_stream_state old,
- }
- 
- static void
-+#if PW_CHECK_VERSION(0, 2, 90)
-+pipewire_output_stream_param_changed(void *data, uint32_t id, const struct spa_pod *format)
-+#else
- pipewire_output_stream_format_changed(void *data, const struct spa_pod *format)
-+#endif
- {
- 	struct pipewire_output *output = data;
-+#if !PW_CHECK_VERSION(0, 2, 90)
- 	struct weston_pipewire *pipewire = output->pipewire;
-+#endif
- 	uint8_t buffer[1024];
- 	struct spa_pod_builder builder =
- 		SPA_POD_BUILDER_INIT(buffer, sizeof(buffer));
- 	const struct spa_pod *params[2];
-+#if !PW_CHECK_VERSION(0, 2, 90)
- 	struct pw_type *t = pipewire->t;
-+#endif
- 	int32_t width, height, stride, size;
- 	const int bpp = 4;
- 
- 	if (!format) {
- 		pipewire_output_debug(output, "format = None");
-+#if PW_CHECK_VERSION(0, 2, 90)
-+		pw_stream_update_params(output->stream, NULL, 0);
-+#else
- 		pw_stream_finish_format(output->stream, 0, NULL, 0);
-+#endif
- 		return;
- 	}
- 
-+#if PW_CHECK_VERSION(0, 2, 90)
-+	spa_format_video_raw_parse(format, &output->video_format);
-+#else
- 	spa_format_video_raw_parse(format, &output->video_format,
- 				   &pipewire->type.format_video);
-+#endif
- 
- 	width = output->video_format.size.width;
- 	height = output->video_format.size.height;
-@@ -510,6 +574,21 @@ pipewire_output_stream_format_changed(void *data, const struct spa_pod *format)
- 
- 	pipewire_output_debug(output, "format = %dx%d", width, height);
- 
-+#if PW_CHECK_VERSION(0, 2, 90)
-+	params[0] = spa_pod_builder_add_object(&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(4, 2, 8),
-+		SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
-+
-+	params[1] = spa_pod_builder_add_object(&builder,
-+		SPA_TYPE_OBJECT_ParamMeta, SPA_PARAM_Meta,
-+		SPA_PARAM_META_type, SPA_POD_Id(SPA_META_Header),
-+		SPA_PARAM_META_size, SPA_POD_Int(sizeof(struct spa_meta_header)));
-+
-+	pw_stream_update_params(output->stream, params, 2);
-+#else
- 	params[0] = spa_pod_builder_object(&builder,
- 		t->param.idBuffers, t->param_buffers.Buffers,
- 		":", t->param_buffers.size,
-@@ -527,12 +606,17 @@ pipewire_output_stream_format_changed(void *data, const struct spa_pod *format)
- 		":", t->param_meta.size, "i", sizeof(struct spa_meta_header));
- 
- 	pw_stream_finish_format(output->stream, 0, params, 2);
-+#endif
- }
- 
- static const struct pw_stream_events stream_events = {
- 	PW_VERSION_STREAM_EVENTS,
- 	.state_changed = pipewire_output_stream_state_changed,
-+#if PW_CHECK_VERSION(0, 2, 90)
-+	.param_changed = pipewire_output_stream_param_changed,
-+#else
- 	.format_changed = pipewire_output_stream_format_changed,
-+#endif
- };
- 
- static struct weston_output *
-@@ -560,7 +644,11 @@ pipewire_output_create(struct weston_compositor *c, char *name)
- 	if (!head)
- 		goto err;
- 
-+#if PW_CHECK_VERSION(0, 2, 90)
-+	output->stream = pw_stream_new(pipewire->core, name, NULL);
-+#else
- 	output->stream = pw_stream_new(pipewire->remote, name, NULL);
-+#endif
- 	if (!output->stream) {
- 		weston_log("Cannot initialize pipewire stream\n");
- 		goto err;
-@@ -704,6 +792,14 @@ weston_pipewire_loop_handler(int fd, uint32_t mask, void *data)
- 	return 0;
- }
- 
-+#if PW_CHECK_VERSION(0, 2, 90)
-+static void
-+weston_pipewire_error(void *data, uint32_t id, int seq, int res,
-+			      const char *error)
-+{
-+	weston_log("pipewire remote error: %s\n", error);
-+}
-+#else
- static void
- weston_pipewire_state_changed(void *data, enum pw_remote_state old,
- 			      enum pw_remote_state state, const char *error)
-@@ -725,12 +821,20 @@ weston_pipewire_state_changed(void *data, enum pw_remote_state old,
- 		break;
- 	}
- }
-+#endif
- 
- 
-+#if PW_CHECK_VERSION(0, 2, 90)
-+static const struct pw_core_events core_events = {
-+	PW_VERSION_CORE_EVENTS,
-+	.error = weston_pipewire_error,
-+};
-+#else
- static const struct pw_remote_events remote_events = {
- 	PW_VERSION_REMOTE_EVENTS,
- 	.state_changed = weston_pipewire_state_changed,
- };
-+#endif
- 
- static int
- weston_pipewire_init(struct weston_pipewire *pipewire)
-@@ -745,10 +849,19 @@ weston_pipewire_init(struct weston_pipewire *pipewire)
- 
- 	pw_loop_enter(pipewire->loop);
- 
-+#if PW_CHECK_VERSION(0, 2, 90)
-+	pipewire->context = pw_context_new(pipewire->loop, NULL, 0);
-+#else
- 	pipewire->core = pw_core_new(pipewire->loop, NULL);
- 	pipewire->t = pw_core_get_type(pipewire->core);
- 	init_type(&pipewire->type, pipewire->t->map);
-+#endif
- 
-+#if PW_CHECK_VERSION(0, 2, 90)
-+	pw_core_add_listener(pipewire->core,
-+			       &pipewire->core_listener,
-+			       &core_events, pipewire);
-+#else
- 	pipewire->remote = pw_remote_new(pipewire->core, NULL, 0);
- 	pw_remote_add_listener(pipewire->remote,
- 			       &pipewire->remote_listener,
-@@ -777,6 +890,7 @@ weston_pipewire_init(struct weston_pipewire *pipewire)
- 			goto err;
- 		}
- 	}
-+#endif
- 
- 	loop = wl_display_get_event_loop(pipewire->compositor->wl_display);
- 	pipewire->loop_source =
-@@ -786,12 +900,14 @@ weston_pipewire_init(struct weston_pipewire *pipewire)
- 				     pipewire);
- 
- 	return 0;
-+#if !PW_CHECK_VERSION(0, 2, 90)
- err:
- 	if (pipewire->remote)
- 		pw_remote_destroy(pipewire->remote);
- 	pw_loop_leave(pipewire->loop);
- 	pw_loop_destroy(pipewire->loop);
- 	return -1;
-+#endif
- }
- 
- static const struct weston_pipewire_api pipewire_api = {

diff --git a/dev-libs/weston/weston-9.0.0-r2.ebuild b/dev-libs/weston/weston-9.0.0-r2.ebuild
deleted file mode 100644
index 27fdbecfc4af..000000000000
--- a/dev-libs/weston/weston-9.0.0-r2.ebuild
+++ /dev/null
@@ -1,152 +0,0 @@
-# Copyright 1999-2022 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-if [[ ${PV} = 9999* ]]; then
-	EGIT_REPO_URI="https://gitlab.freedesktop.org/wayland/weston.git"
-	GIT_ECLASS="git-r3"
-	EXPERIMENTAL="true"
-fi
-
-inherit meson readme.gentoo-r1 xdg-utils ${GIT_ECLASS}
-
-DESCRIPTION="Wayland reference compositor"
-HOMEPAGE="https://wayland.freedesktop.org/ https://gitlab.freedesktop.org/wayland/weston"
-
-if [[ ${PV} = *9999* ]]; then
-	SRC_URI="${SRC_PATCHES}"
-else
-	SRC_URI="https://wayland.freedesktop.org/releases/${P}.tar.xz"
-	KEYWORDS="amd64 arm arm64 ppc64 ~riscv x86"
-fi
-
-LICENSE="MIT CC-BY-SA-3.0"
-SLOT="0"
-
-IUSE="colord +desktop +drm editor examples fbdev fullscreen +gles2 headless ivi jpeg kiosk +launch lcms pipewire rdp remoting +resize-optimization screen-sharing +suid systemd test wayland-compositor webp +X xwayland"
-RESTRICT="!test? ( test )"
-
-REQUIRED_USE="
-	colord? ( lcms )
-	drm? ( gles2 )
-	pipewire? ( drm )
-	remoting? ( drm gles2 )
-	screen-sharing? ( rdp )
-	test? ( desktop headless xwayland )
-	wayland-compositor? ( gles2 )
-	|| ( drm fbdev headless rdp wayland-compositor X )
-"
-
-RDEPEND="
-	>=dev-libs/libinput-0.8.0
-	>=dev-libs/wayland-1.17.0
-	>=dev-libs/wayland-protocols-1.18
-	lcms? ( media-libs/lcms:2 )
-	media-libs/libpng:0=
-	webp? ( media-libs/libwebp:0= )
-	jpeg? ( virtual/jpeg:0= )
-	>=x11-libs/cairo-1.11.3
-	>=x11-libs/libdrm-2.4.68
-	>=x11-libs/libxkbcommon-0.5.0
-	>=x11-libs/pixman-0.25.2
-	x11-misc/xkeyboard-config
-	fbdev? (
-		>=sys-libs/mtdev-1.1.0
-		>=virtual/udev-136
-	)
-	colord? ( >=x11-misc/colord-0.1.27 )
-	drm? (
-		>=media-libs/mesa-17.1[gbm(+)]
-		>=sys-libs/mtdev-1.1.0
-		>=virtual/udev-136
-	)
-	editor? ( x11-libs/pango )
-	examples? ( x11-libs/pango )
-	gles2? (
-		media-libs/mesa[gles2,wayland]
-	)
-	pipewire? ( >=media-video/pipewire-0.2:= )
-	rdp? ( >=net-misc/freerdp-2.0.0_rc2:= )
-	remoting? (
-		media-libs/gstreamer:1.0
-		media-libs/gst-plugins-base:1.0
-	)
-	systemd? (
-		sys-auth/pambase[systemd]
-		>=sys-apps/dbus-1.6
-		>=sys-apps/systemd-209[pam]
-	)
-	launch? ( sys-auth/pambase )
-	X? (
-		>=x11-libs/libxcb-1.9
-		x11-libs/libX11
-	)
-	xwayland? (
-		x11-base/xwayland
-		x11-libs/cairo[X,xcb(+)]
-		>=x11-libs/libxcb-1.9
-		x11-libs/libXcursor
-	)
-"
-DEPEND="${RDEPEND}"
-BDEPEND="
-	virtual/pkgconfig
-"
-
-PATCHES=(
-	"${FILESDIR}"/${PN}-pipewire-0.3.patch
-)
-
-src_configure() {
-	local emesonargs=(
-		$(meson_use drm backend-drm)
-		-Dbackend-drm-screencast-vaapi=false
-		$(meson_use headless backend-headless)
-		$(meson_use rdp backend-rdp)
-		$(meson_use screen-sharing screenshare)
-		$(meson_use wayland-compositor backend-wayland)
-		$(meson_use X backend-x11)
-		$(meson_use fbdev backend-fbdev)
-		-Dbackend-default=auto
-		$(meson_use gles2 renderer-gl)
-		$(meson_use launch weston-launch)
-		$(meson_use xwayland)
-		$(meson_use systemd)
-		$(meson_use remoting)
-		$(meson_use pipewire)
-		$(meson_use desktop shell-desktop)
-		$(meson_use fullscreen shell-fullscreen)
-		$(meson_use ivi shell-ivi)
-		$(meson_use kiosk shell-kiosk)
-		$(meson_use lcms color-management-lcms)
-		$(meson_use colord color-management-colord)
-		$(meson_use systemd launcher-logind)
-		$(meson_use jpeg image-jpeg)
-		$(meson_use webp image-webp)
-		-Dtools=debug,info,terminal
-		$(meson_use examples demo-clients)
-		-Dsimple-clients=$(usex examples damage,dmabuf-v4l,im,shm,touch$(usex gles2 ,dmabuf-egl,egl "") "")
-		$(meson_use resize-optimization resize-pool)
-		-Dtest-junit-xml=false
-		-Dtest-gl-renderer=false
-		"${myconf[@]}"
-	)
-	meson_src_configure
-}
-
-src_test() {
-	xdg_environment_reset
-
-	# devices test usually fails.
-	cd "${BUILD_DIR}" || die
-	meson test $(meson test --list | grep -Fxv devices) || die
-}
-
-src_install() {
-	meson_src_install
-	if use launch && use suid; then
-		chmod u+s "${ED}"/usr/bin/weston-launch || die
-	fi
-	readme.gentoo_create_doc
-}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/weston/, dev-libs/weston/files/
@ 2023-07-16 23:58 Mike Gilbert
  0 siblings, 0 replies; 5+ messages in thread
From: Mike Gilbert @ 2023-07-16 23:58 UTC (permalink / raw
  To: gentoo-commits

commit:     7489e5ffc8b97cc7bed5b7a9c5c32b65d406a8a2
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 16 23:54:56 2023 +0000
Commit:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
CommitDate: Sun Jul 16 23:54:56 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7489e5ff

dev-libs/weston: backport fix for crash on startup

weston: ../weston-12.0.1/libweston/output-capture.c:398: weston_output_pull_capture_task: Assertion `csi->width == width' failed

Signed-off-by: Mike Gilbert <floppym <AT> gentoo.org>

 dev-libs/weston/files/weston-12.0.1-issue757.patch | 183 +++++++++++++++++++++
 ...eston-12.0.1.ebuild => weston-12.0.1-r1.ebuild} |   4 +
 2 files changed, 187 insertions(+)

diff --git a/dev-libs/weston/files/weston-12.0.1-issue757.patch b/dev-libs/weston/files/weston-12.0.1-issue757.patch
new file mode 100644
index 000000000000..c36647e22446
--- /dev/null
+++ b/dev-libs/weston/files/weston-12.0.1-issue757.patch
@@ -0,0 +1,183 @@
+https://gitlab.freedesktop.org/wayland/weston/-/issues/757
+https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/1257
+
+From 6d8e3c569cf7e9ad80569768871e1ed30bf4d2a8 Mon Sep 17 00:00:00 2001
+From: Leandro Ribeiro <leandro.ribeiro@collabora.com>
+Date: Thu, 1 Jun 2023 18:51:34 -0300
+Subject: [PATCH 1/3] drm: drop disable_planes being false as a condition to
+ support writeback
+
+In 2d70bdfdcdb236ee3e466b1a24df494da43c8a68 "drm-backend: add support to
+output capture writeback source" we've ensured that disable_planes
+should be false in order to support writeback capture tasks.
+
+But this was wrong; disable_planes is transient (it is true when
+there's some sort of content recording happening), and we enable/disable
+that during compositor's lifetime.
+
+This is dangerous and may result in a crash. Imagine the following
+sequence:
+
+        1. screen recording starts, disable_planes is set to true.
+
+        2. for whatever reason the output size changes, and we end up
+        not updating capture info because we think that writeback is not
+        supported by the device.
+
+        3. screen recording stops, disable_planes is set to false.
+
+        4. user tries to take a writeback screenshot, and the
+        DRM-backend will pull a writeback capture task with
+        weston_output_pull_capture_task().
+
+        5. this function has an assert to ensure that the DRM-backend
+        did not forget to update the capture info, and we hit that
+        assert.
+
+With this patch we drop disable_planes being false as a condition to
+support writeback. So now we keep the capture info up-to-date even when
+screen recording is happening, and we gracefully fail writeback tasks.
+
+Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
+---
+ libweston/backend-drm/drm.c | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index 1078b89bf..a1e61df8c 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -561,6 +561,12 @@ drm_output_pick_writeback_capture_task(struct drm_output *output)
+ 
+ 	assert(output->device->atomic_modeset);
+ 
++	if (output->base.disable_planes > 0) {
++		msg = "drm: KMS planes usage is disabled for now, so " \
++		      "writeback capture tasks are rejected";
++		goto err;
++	}
++
+ 	wb = drm_output_find_compatible_writeback(output);
+ 	if (!wb) {
+ 		msg = "drm: could not find writeback connector for output";
+@@ -948,7 +954,7 @@ drm_output_apply_mode(struct drm_output *output)
+ 		}
+ 	}
+ 
+-	if (device->atomic_modeset && !output->base.disable_planes)
++	if (device->atomic_modeset)
+ 		weston_output_update_capture_info(&output->base,
+ 						  WESTON_OUTPUT_CAPTURE_SOURCE_WRITEBACK,
+ 						  output->base.current_mode->width,
+@@ -2138,7 +2144,7 @@ drm_output_enable(struct weston_output *base)
+ 	output->base.switch_mode = drm_output_switch_mode;
+ 	output->base.set_gamma = drm_output_set_gamma;
+ 
+-	if (device->atomic_modeset && !base->disable_planes)
++	if (device->atomic_modeset)
+ 		weston_output_update_capture_info(base, WESTON_OUTPUT_CAPTURE_SOURCE_WRITEBACK,
+ 						  base->current_mode->width,
+ 						  base->current_mode->height,
+-- 
+GitLab
+
+
+From 3226417573ac12e7d41823335bcb3036bf442cbc Mon Sep 17 00:00:00 2001
+From: Leandro Ribeiro <leandro.ribeiro@collabora.com>
+Date: Fri, 2 Jun 2023 14:44:44 -0300
+Subject: [PATCH 2/3] drm: do not pull writeback task if KMS atomic API is not
+ supported
+
+Since 2d70bdfdcdb236ee3e466b1a24df494da43c8a68 "drm-backend: add support
+to output capture writeback source", the DRM-backend was broken for KMS
+devices that do not support the atomic API. This fixes that.
+
+We don't support writeback screenshots without atomic modeset support.
+So for such devices, we never update the output capture info
+(weston_output_update_capture_info()) for the writeback source.
+
+The function that we use to pull writeback tasks
+(weston_output_pull_capture_task()) asserts that the capture providers
+(renderers, DRM-backend) did not forget to update the capture info
+(size/format) if something changed. But as we've never updated the
+capture info for such devices, it is zeroed, leading to an assert hit.
+
+With this patch we only pull the capture task for KMS devices that
+support the atomic API.
+
+Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
+---
+ libweston/backend-drm/drm.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c
+index a1e61df8c..b43791db5 100644
+--- a/libweston/backend-drm/drm.c
++++ b/libweston/backend-drm/drm.c
+@@ -553,14 +553,14 @@ drm_output_pick_writeback_capture_task(struct drm_output *output)
+ 	int32_t height = output->base.current_mode->height;
+ 	uint32_t format = output->format->format;
+ 
++	assert(output->device->atomic_modeset);
++
+ 	ct = weston_output_pull_capture_task(&output->base,
+ 					     WESTON_OUTPUT_CAPTURE_SOURCE_WRITEBACK,
+ 					     width, height, pixel_format_get_info(format));
+ 	if (!ct)
+ 		return;
+ 
+-	assert(output->device->atomic_modeset);
+-
+ 	if (output->base.disable_planes > 0) {
+ 		msg = "drm: KMS planes usage is disabled for now, so " \
+ 		      "writeback capture tasks are rejected";
+@@ -642,7 +642,8 @@ drm_output_repaint(struct weston_output *output_base, pixman_region32_t *damage)
+ 	if (drm_output_ensure_hdr_output_metadata_blob(output) < 0)
+ 		goto err;
+ 
+-	drm_output_pick_writeback_capture_task(output);
++	if (device->atomic_modeset)
++		drm_output_pick_writeback_capture_task(output);
+ 
+ 	drm_output_render(state, damage);
+ 	scanout_state = drm_output_state_get_plane(state,
+-- 
+GitLab
+
+
+From cf64fbe7847859ca11d4722f056d2ebfa8d10177 Mon Sep 17 00:00:00 2001
+From: Leandro Ribeiro <leandro.ribeiro@collabora.com>
+Date: Thu, 1 Jun 2023 17:04:56 -0300
+Subject: [PATCH 3/3] tests: assert that capture info was received before
+ trying screenshot
+
+If the source is not supported, we won't receive the capture
+information. So the capture info (size/format) will be zeroed, and we
+fail while trying to create a buffer for the screenshot with size/format
+zeroed.
+
+With this patch we fail if we don't receive the capture info, what makes
+the failure reason more explicit.
+
+Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
+---
+ tests/weston-test-client-helper.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/tests/weston-test-client-helper.c b/tests/weston-test-client-helper.c
+index 3e24a0310..2a7f938d3 100644
+--- a/tests/weston-test-client-helper.c
++++ b/tests/weston-test-client-helper.c
+@@ -1705,6 +1705,9 @@ client_capture_output(struct client *client,
+ 
+ 	client_roundtrip(client);
+ 
++	assert(capt.width != 0 && capt.height != 0 && capt.drm_format != 0 &&
++	       "capture source not available");
++
+ 	buf = create_shm_buffer(client,
+ 				capt.width, capt.height, capt.drm_format);
+ 
+-- 
+GitLab
+

diff --git a/dev-libs/weston/weston-12.0.1.ebuild b/dev-libs/weston/weston-12.0.1-r1.ebuild
similarity index 98%
rename from dev-libs/weston/weston-12.0.1.ebuild
rename to dev-libs/weston/weston-12.0.1-r1.ebuild
index 684694b47195..35a02ce6cc88 100644
--- a/dev-libs/weston/weston-12.0.1.ebuild
+++ b/dev-libs/weston/weston-12.0.1-r1.ebuild
@@ -92,6 +92,10 @@ BDEPEND="
 	virtual/pkgconfig
 "
 
+PATCHES=(
+	"${FILESDIR}/weston-12.0.1-issue757.patch"
+)
+
 src_configure() {
 	local emesonargs=(
 		$(meson_use drm backend-drm)


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/weston/, dev-libs/weston/files/
@ 2024-05-12 16:02 James Le Cuirot
  0 siblings, 0 replies; 5+ messages in thread
From: James Le Cuirot @ 2024-05-12 16:02 UTC (permalink / raw
  To: gentoo-commits

commit:     6a29d4138555d7ae5af4d024c9ff9b8d4541b13b
Author:     Haelwenn (lanodan) Monnier <contact <AT> hacktivis <DOT> me>
AuthorDate: Thu May  9 11:40:32 2024 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Sun May 12 16:00:57 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6a29d413

dev-libs/weston: Fix building with musl 1.2.5 (missing libgen.h)

Signed-off-by: Haelwenn (lanodan) Monnier <contact <AT> hacktivis.me>
Closes: https://github.com/gentoo/gentoo/pull/36615
Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 dev-libs/weston/files/weston-musl-basename.patch | 73 ++++++++++++++++++++++++
 dev-libs/weston/weston-13.0.1.ebuild             |  1 +
 2 files changed, 74 insertions(+)

diff --git a/dev-libs/weston/files/weston-musl-basename.patch b/dev-libs/weston/files/weston-musl-basename.patch
new file mode 100644
index 000000000000..57b91331055f
--- /dev/null
+++ b/dev-libs/weston/files/weston-musl-basename.patch
@@ -0,0 +1,73 @@
+From dbd134ca5a3c639819c6fd503de7e2c72762ada0 Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Thu, 14 Dec 2023 09:13:54 -0800
+Subject: [PATCH] libweston,tools: Include libgen.h for basename signature
+Upstream: https://gitlab.freedesktop.org/wayland/weston/-/commit/dbd134ca5a3c639819c6fd503de7e2c72762ada0
+Upstream-Status: Merged in main branch
+
+Latest musl has removed the declaration from string.h [1] as it only
+implements POSIX version alone and string.h in glibc implements GNU
+version of basename. This now results in compile errors on musl.
+
+This might be a warning with older compilers but it is error with
+Clang-17+ as it treats -Wimplicit-function-declaration as error
+
+Switch the use in backlight_init function to use POSIX version
+
+[1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ libweston/backend-drm/libbacklight.c | 8 +++++---
+ tools/zunitc/src/zunitc_impl.c       | 1 +
+ 2 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/libweston/backend-drm/libbacklight.c b/libweston/backend-drm/libbacklight.c
+index ca7f2d6806..973d15ff8c 100644
+--- a/libweston/backend-drm/libbacklight.c
++++ b/libweston/backend-drm/libbacklight.c
+@@ -41,6 +41,7 @@
+ #include <drm.h>
+ #include <fcntl.h>
+ #include <malloc.h>
++#include <libgen.h>
+ #include <string.h>
+ #include <errno.h>
+ 
+@@ -167,7 +168,7 @@ struct backlight *backlight_init(struct udev_device *drm_device,
+ 	DIR *backlights = NULL;
+ 	struct dirent *entry;
+ 	enum backlight_type type = 0;
+-	char buffer[100];
++	char buffer[100], basename_buffer[100];
+ 	struct backlight *backlight = NULL;
+ 	int ret;
+ 
+@@ -186,9 +187,10 @@ struct backlight *backlight_init(struct udev_device *drm_device,
+ 	free(path);
+ 	if (ret < 0)
+ 		return NULL;
+-
++	strncpy(basename_buffer, buffer, ret);
+ 	buffer[ret] = '\0';
+-	pci_name = basename(buffer);
++	basename_buffer[ret] = '\0';
++	pci_name = basename(basename_buffer);
+ 
+ 	if (connector_type <= 0)
+ 		return NULL;
+diff --git a/tools/zunitc/src/zunitc_impl.c b/tools/zunitc/src/zunitc_impl.c
+index 18f030158e..9b460fa03b 100644
+--- a/tools/zunitc/src/zunitc_impl.c
++++ b/tools/zunitc/src/zunitc_impl.c
+@@ -27,6 +27,7 @@
+ 
+ #include <errno.h>
+ #include <fcntl.h>
++#include <libgen.h>
+ #include <stdarg.h>
+ #include <stdbool.h>
+ #include <stdio.h>
+-- 
+GitLab
+

diff --git a/dev-libs/weston/weston-13.0.1.ebuild b/dev-libs/weston/weston-13.0.1.ebuild
index 40b3bd77eef2..801ef005cb3b 100644
--- a/dev-libs/weston/weston-13.0.1.ebuild
+++ b/dev-libs/weston/weston-13.0.1.ebuild
@@ -95,6 +95,7 @@ BDEPEND="
 
 PATCHES=(
 	"${FILESDIR}"/${PN}-neatvnc-0.8.patch
+	"${FILESDIR}"/${PN}-musl-basename.patch
 )
 
 python_check_deps() {


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: dev-libs/weston/, dev-libs/weston/files/
@ 2024-09-06 22:21 James Le Cuirot
  0 siblings, 0 replies; 5+ messages in thread
From: James Le Cuirot @ 2024-09-06 22:21 UTC (permalink / raw
  To: gentoo-commits

commit:     34b36c694557dedd9c88f2ec102292a5cb63fea3
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Fri Sep  6 22:20:21 2024 +0000
Commit:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
CommitDate: Fri Sep  6 22:20:21 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=34b36c69

dev-libs/weston: Version bump to 14.0.0

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>

 dev-libs/weston/Manifest                           |  1 +
 dev-libs/weston/files/weston-kiosk-test.patch      | 53 ++++++++++++++++++++++
 .../{weston-9999.ebuild => weston-14.0.0.ebuild}   | 13 ++++--
 dev-libs/weston/weston-9999.ebuild                 |  9 ++--
 4 files changed, 68 insertions(+), 8 deletions(-)

diff --git a/dev-libs/weston/Manifest b/dev-libs/weston/Manifest
index a95d2f4929c6..4dc524fdf4d3 100644
--- a/dev-libs/weston/Manifest
+++ b/dev-libs/weston/Manifest
@@ -1,2 +1,3 @@
 DIST weston-13.0.0.tar.xz 1986520 BLAKE2B df0e73e451e39b329ed327c370f42bcae01eb5b8fad67711f069fa8f24900ac0c9a9e69b9a6445b67c76ab0ce441dcd2a5a1a8aa3ac0d89a647b9661d575a917 SHA512 8c656cdf24ec9429c76c64ebd2d58351991f5990a6d4b5900ac913243ad8e2c9c0fb1a748f018d177fbfd7e0a8836d0434d97acec287a8f977d47335ae30eacc
 DIST weston-13.0.3.tar.xz 1986952 BLAKE2B cc3e2be9f1fbcbfd45c9e75a9a34bbb7cd75256d851129e0d29cc0079cbaf4e35eb40b302f557ffe7b89edbc094b1823d667a54d44a9af765945e3ca541068fc SHA512 60e655b57cf418902ec6e4371883354165241d9a99a712aabe2165e11ac190dec22836fd885f5178def5416dc5f00e70042b022c96a8e0aa74827bbd4563f9cb
+DIST weston-14.0.0.tar.xz 2043020 BLAKE2B 1a92e3b04677f3ba1f2c02f15aba64511774dd08738c2a490135a1ca7200a846c1b5102349a36c76e2dd6a9e39bd041cd25c2552958741e96f8291fd3029046e SHA512 8bdeed91befd5cbb0bde0f1860ff7775c1835a5fa8c3bf26e99d2f0c16e81255fcf35bf338ae02d7826463d0efdf41ba3fe78e38e4c27787831dfa331acafc08

diff --git a/dev-libs/weston/files/weston-kiosk-test.patch b/dev-libs/weston/files/weston-kiosk-test.patch
new file mode 100644
index 000000000000..7fe340a75bb3
--- /dev/null
+++ b/dev-libs/weston/files/weston-kiosk-test.patch
@@ -0,0 +1,53 @@
+From 4d5224027c941224eb9a7aaa71c949558f2b4796 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Fri, 6 Sep 2024 23:15:05 +0100
+Subject: [PATCH] tests: Make the kiosk test dependent on the shell-kiosk
+ option
+
+Signed-off-by: James Le Cuirot <chewi@gentoo.org>
+---
+ tests/meson.build | 21 +++++++++++++--------
+ 1 file changed, 13 insertions(+), 8 deletions(-)
+
+diff --git a/tests/meson.build b/tests/meson.build
+index 45b475c3..4b52cb29 100644
+--- a/tests/meson.build
++++ b/tests/meson.build
+@@ -180,14 +180,6 @@ tests = [
+ 			input_timestamps_unstable_v1_protocol_c,
+ 		],
+ 	},
+-	{
+-		'name': 'kiosk-shell',
+-		'sources': [
+-			'kiosk-shell-test.c',
+-			xdg_shell_client_protocol_h,
+-			xdg_shell_protocol_c,
+-		],
+-        },
+ 	{
+ 		'name': 'linux-explicit-synchronization',
+ 		'sources': [
+@@ -427,6 +419,19 @@ if get_option('shell-ivi')
+ 	]
+ endif
+ 
++if get_option('shell-kiosk')
++	tests += [
++		{
++			'name': 'kiosk-shell',
++			'sources': [
++				'kiosk-shell-test.c',
++				xdg_shell_client_protocol_h,
++				xdg_shell_protocol_c,
++			],
++		},
++	]
++endif
++
+ test_config_h = configuration_data()
+ test_config_h.set_quoted('WESTON_TEST_REFERENCE_PATH', meson.current_source_dir() + '/reference')
+ test_config_h.set_quoted('WESTON_MODULE_MAP', env_modmap)
+-- 
+2.46.0
+

diff --git a/dev-libs/weston/weston-9999.ebuild b/dev-libs/weston/weston-14.0.0.ebuild
similarity index 93%
copy from dev-libs/weston/weston-9999.ebuild
copy to dev-libs/weston/weston-14.0.0.ebuild
index 3df7fd4b2e1c..17020667a9de 100644
--- a/dev-libs/weston/weston-9999.ebuild
+++ b/dev-libs/weston/weston-14.0.0.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} = *9999* ]]; then
 	SRC_URI="${SRC_PATCHES}"
 else
 	SRC_URI="https://gitlab.freedesktop.org/wayland/${PN}/-/releases/${PV}/downloads/${P}.tar.xz"
-	KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~loong ~riscv ~x86"
+	KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~loong ~ppc64 ~riscv ~x86"
 fi
 
 LICENSE="MIT CC-BY-SA-3.0"
@@ -49,14 +49,14 @@ RDEPEND="
 	>=x11-libs/pixman-0.25.2
 	x11-misc/xkeyboard-config
 	drm? (
-		=media-libs/libdisplay-info-0.1*
+		<media-libs/libdisplay-info-0.3.0:=
 		>=media-libs/mesa-17.1[gbm(+)]
 		>=sys-libs/mtdev-1.1.0
 		>=virtual/udev-136
 	)
 	editor? ( x11-libs/pango )
 	examples? ( x11-libs/pango )
-	gles2? ( media-libs/mesa[gles2(+),wayland] )
+	gles2? ( media-libs/libglvnd )
 	jpeg? ( media-libs/libjpeg-turbo:0= )
 	lcms? ( >=media-libs/lcms-2.9:2 )
 	pipewire? ( >=media-video/pipewire-0.3:= )
@@ -85,7 +85,7 @@ RDEPEND="
 	)
 "
 DEPEND="${RDEPEND}
-	>=dev-libs/wayland-protocols-1.24
+	>=dev-libs/wayland-protocols-1.33
 "
 BDEPEND="
 	${PYTHON_DEPS}
@@ -94,6 +94,10 @@ BDEPEND="
 	$(python_gen_any_dep 'dev-python/setuptools[${PYTHON_USEDEP}]')
 "
 
+PATCHES=(
+	"${FILESDIR}"/${PN}-kiosk-test.patch
+)
+
 python_check_deps() {
 	python_has_version "dev-python/setuptools[${PYTHON_USEDEP}]"
 }
@@ -126,6 +130,7 @@ src_configure() {
 		$(meson_use examples demo-clients)
 		-Dsimple-clients=$(usex examples damage,dmabuf-v4l,im,shm,touch$(usex gles2 ,dmabuf-egl,egl "") "")
 		$(meson_use resize-optimization resize-pool)
+		$(meson_use test tests)
 		-Dtest-junit-xml=false
 		"${myconf[@]}"
 	)

diff --git a/dev-libs/weston/weston-9999.ebuild b/dev-libs/weston/weston-9999.ebuild
index 3df7fd4b2e1c..62c8cc6c4eac 100644
--- a/dev-libs/weston/weston-9999.ebuild
+++ b/dev-libs/weston/weston-9999.ebuild
@@ -19,7 +19,7 @@ if [[ ${PV} = *9999* ]]; then
 	SRC_URI="${SRC_PATCHES}"
 else
 	SRC_URI="https://gitlab.freedesktop.org/wayland/${PN}/-/releases/${PV}/downloads/${P}.tar.xz"
-	KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~loong ~riscv ~x86"
+	KEYWORDS="~amd64 ~arm ~arm64 ~ia64 ~loong ~ppc64 ~riscv ~x86"
 fi
 
 LICENSE="MIT CC-BY-SA-3.0"
@@ -49,14 +49,14 @@ RDEPEND="
 	>=x11-libs/pixman-0.25.2
 	x11-misc/xkeyboard-config
 	drm? (
-		=media-libs/libdisplay-info-0.1*
+		<media-libs/libdisplay-info-0.3.0:=
 		>=media-libs/mesa-17.1[gbm(+)]
 		>=sys-libs/mtdev-1.1.0
 		>=virtual/udev-136
 	)
 	editor? ( x11-libs/pango )
 	examples? ( x11-libs/pango )
-	gles2? ( media-libs/mesa[gles2(+),wayland] )
+	gles2? ( media-libs/libglvnd )
 	jpeg? ( media-libs/libjpeg-turbo:0= )
 	lcms? ( >=media-libs/lcms-2.9:2 )
 	pipewire? ( >=media-video/pipewire-0.3:= )
@@ -85,7 +85,7 @@ RDEPEND="
 	)
 "
 DEPEND="${RDEPEND}
-	>=dev-libs/wayland-protocols-1.24
+	>=dev-libs/wayland-protocols-1.33
 "
 BDEPEND="
 	${PYTHON_DEPS}
@@ -126,6 +126,7 @@ src_configure() {
 		$(meson_use examples demo-clients)
 		-Dsimple-clients=$(usex examples damage,dmabuf-v4l,im,shm,touch$(usex gles2 ,dmabuf-egl,egl "") "")
 		$(meson_use resize-optimization resize-pool)
+		$(meson_use test tests)
 		-Dtest-junit-xml=false
 		"${myconf[@]}"
 	)


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-09-06 22:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-20 21:22 [gentoo-commits] repo/gentoo:master commit in: dev-libs/weston/, dev-libs/weston/files/ James Le Cuirot
  -- strict thread matches above, loose matches on Subject: below --
2022-05-21  8:58 James Le Cuirot
2023-07-16 23:58 Mike Gilbert
2024-05-12 16:02 James Le Cuirot
2024-09-06 22:21 James Le Cuirot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox