summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2025-01-23 17:38:31 +0100
committerAnna (navi) Figueiredo Gomes <navi@vlhl.dev>2025-01-23 17:38:31 +0100
commit8f5c35ca6c049072776da67b90d884aee54728df (patch)
tree026eeeb6893e0c75dcd0661ebf8f7371e024c4be
parent592c43846be3eb499c5976b9b2f2d273199102c9 (diff)
downloadenomicon-8f5c35ca6c049072776da67b90d884aee54728df.tar.xz
gui-wm/sommelier: new package, add 0.12_p20241015
-rw-r--r--gui-wm/sommelier/Manifest1
-rw-r--r--gui-wm/sommelier/files/sommelier-0.12-dont-call-fixup_plane0.patch33
-rw-r--r--gui-wm/sommelier/files/sommelier-0.12-enforce-16k-alignment.patch58
-rw-r--r--gui-wm/sommelier/files/sommelier-0.12-no-unused-wl-assert.patch33
-rw-r--r--gui-wm/sommelier/files/sommelier-0.12-revert-cross-domain-identifiers.patch34
-rw-r--r--gui-wm/sommelier/sommelier-0.12_p20241015.ebuild67
6 files changed, 226 insertions, 0 deletions
diff --git a/gui-wm/sommelier/Manifest b/gui-wm/sommelier/Manifest
new file mode 100644
index 0000000..bfc4c29
--- /dev/null
+++ b/gui-wm/sommelier/Manifest
@@ -0,0 +1 @@
+DIST sommelier-0.12_p20241015.tar.gz 274302 BLAKE2B 12a36f36e201ef8814033e078245900b3299a038d5111b31c1ad36d07e2ccda0dc74c215ba6b75631f0b70dd72f9c6607ae42d4f36e82bd086e106a71444acd8 SHA512 5b4ac5fcfe5835e09b8fbecde7c56f66e671a3ee5a40dc092fc91170d50f52b28d5c523778420f40310a99c273bf0adb69557673fa7c2cdae3f5b0d0b9c63e58
diff --git a/gui-wm/sommelier/files/sommelier-0.12-dont-call-fixup_plane0.patch b/gui-wm/sommelier/files/sommelier-0.12-dont-call-fixup_plane0.patch
new file mode 100644
index 0000000..7d6a68b
--- /dev/null
+++ b/gui-wm/sommelier/files/sommelier-0.12-dont-call-fixup_plane0.patch
@@ -0,0 +1,33 @@
+From ff0ef08925dbf0216ed4a40fcd1f360c30223061 Mon Sep 17 00:00:00 2001
+From: Sergio Lopez <slp@redhat.com>
+Date: Wed, 4 Sep 2024 14:30:37 +0200
+Subject: [PATCH 3/3] vm_tools: sommelier: don't call to fixup_plane0
+
+The function sl_linux_dmabuf_fixup_plane0_params relies on the
+DRM_IOCTL_VIRTGPU_RESOURCE_INFO_CROS ioctl which is only available on
+Chrome OS kernel + userspace.
+
+Avoid calling it and assume our hw buffers are always virtgpu buffers.
+
+Signed-off-by: Sergio Lopez <slp@redhat.com>
+---
+ compositor/sommelier-drm.cc | 3 +--
+ 1 file changed, 1 insertion(+), 2 deletions(-)
+
+diff --git a/compositor/sommelier-drm.cc b/compositor/sommelier-drm.cc
+index 1ed50394e9..67a6a35f15 100644
+--- a/compositor/sommelier-drm.cc
++++ b/compositor/sommelier-drm.cc
+@@ -98,8 +98,7 @@ static void sl_drm_create_prime_buffer(struct wl_client* client,
+ uint32_t host_modifier_lo = DRM_FORMAT_MOD_INVALID & 0xFFFFFFFF;
+ bool is_virtgpu_buffer = false;
+ if (ctx->gbm) {
+- is_virtgpu_buffer = sl_linux_dmabuf_fixup_plane0_params(
+- ctx->gbm, name, &host_stride0, &host_modifier_hi, &host_modifier_lo);
++ is_virtgpu_buffer = true;
+ }
+
+ zwp_linux_buffer_params_v1_add(buffer_params, name, 0, offset0, host_stride0,
+--
+2.45.1
+
diff --git a/gui-wm/sommelier/files/sommelier-0.12-enforce-16k-alignment.patch b/gui-wm/sommelier/files/sommelier-0.12-enforce-16k-alignment.patch
new file mode 100644
index 0000000..7795fa5
--- /dev/null
+++ b/gui-wm/sommelier/files/sommelier-0.12-enforce-16k-alignment.patch
@@ -0,0 +1,58 @@
+Upstream: no
+
+From 10056fbb3f09d448a00748fea48dc6c630948d90 Mon Sep 17 00:00:00 2001
+From: Johannes Nixdorf <johannes@nixdorf.dev>
+Date: Wed, 29 May 2024 21:20:53 +0200
+Subject: [PATCH] Import the 16k alignment patch hidden in the copr sources
+
+---
+ sommelier-seat.cc | 4 +++-
+ virtualization/virtgpu_channel.cc | 4 +++-
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/sommelier-seat.cc b/sommelier-seat.cc
+index 3a056ca00ea8..c8dc85fcacb1 100644
+--- a/sommelier-seat.cc
++++ b/sommelier-seat.cc
+@@ -286,6 +286,8 @@ static void sl_host_keyboard_release(struct wl_client* client,
+ static const struct wl_keyboard_interface sl_keyboard_implementation = {
+ sl_host_keyboard_release};
+
++#define ALIGN_POT(x, pot_align) (((x) + (pot_align) - 1) & ~((pot_align) - 1))
++
+ static void sl_keyboard_keymap(void* data,
+ struct wl_keyboard* keyboard,
+ uint32_t format,
+@@ -297,7 +299,7 @@ static void sl_keyboard_keymap(void* data,
+ wl_keyboard_send_keymap(host->resource, format, fd, size);
+
+ if (format == WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1) {
+- void* data = mmap(nullptr, size, PROT_READ, MAP_SHARED, fd, 0);
++ void* data = mmap(nullptr, ALIGN_POT(size, 16384), PROT_READ, MAP_SHARED, fd, 0);
+
+ assert(data != MAP_FAILED);
+
+diff --git a/virtualization/virtgpu_channel.cc b/virtualization/virtgpu_channel.cc
+index ff4c07cffbf4..fcfbb8c7707c 100644
+--- a/virtualization/virtgpu_channel.cc
++++ b/virtualization/virtgpu_channel.cc
+@@ -617,13 +617,15 @@ int32_t VirtGpuChannel::channel_poll() {
+ return 0;
+ }
+
++#define ALIGN_POT(x, pot_align) (((x) + (pot_align) - 1) & ~((pot_align) - 1))
++
+ int32_t VirtGpuChannel::create_host_blob(uint64_t blob_id,
+ uint64_t size,
+ int& out_fd) {
+ int32_t ret;
+ struct drm_virtgpu_resource_create_blob drm_rc_blob = {};
+
+- drm_rc_blob.size = size;
++ drm_rc_blob.size = ALIGN_POT(size, 16384);
+ drm_rc_blob.blob_mem = VIRTGPU_BLOB_MEM_HOST3D;
+ drm_rc_blob.blob_flags =
+ VIRTGPU_BLOB_FLAG_USE_MAPPABLE | VIRTGPU_BLOB_FLAG_USE_SHAREABLE;
+--
+2.45.1
+
diff --git a/gui-wm/sommelier/files/sommelier-0.12-no-unused-wl-assert.patch b/gui-wm/sommelier/files/sommelier-0.12-no-unused-wl-assert.patch
new file mode 100644
index 0000000..15bcf93
--- /dev/null
+++ b/gui-wm/sommelier/files/sommelier-0.12-no-unused-wl-assert.patch
@@ -0,0 +1,33 @@
+From df91ff20f05375d3695f13f48980cd0c81bdee72 Mon Sep 17 00:00:00 2001
+From: Janne Grunau <janne-fdr@jannau.net>
+Date: Wed, 2 Oct 2024 00:29:20 +0200
+Subject: [PATCH 4/4] vm_tools: sommelier: Do not assert on unsued wayland
+ interfaces
+
+When sommelier is used with general purpose wayland compositors it must
+not assert on the removal of unused wayland interfaces since compositors
+as kwin_wayland implement interfaces not used by sommelier.
+Fixes an abort() after DPMS when using kwin_wayland.
+---
+ sommelier.cc | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/sommelier.cc b/sommelier.cc
+index afbca339..4b3ad73e 100644
+--- a/sommelier.cc
++++ b/sommelier.cc
+@@ -953,7 +953,10 @@ void sl_registry_remover(void* data,
+ }
+
+ // Not reached.
+- assert(0);
++ // Do not assert on the removal on unknown / unbound globals
++ // On general purpose Linux systems compositors may offer interfaces
++ // not used by sommelier.
++ // assert(0);
+ }
+
+ const struct wl_registry_listener sl_registry_listener = {sl_registry_handler,
+--
+2.46.2
+
diff --git a/gui-wm/sommelier/files/sommelier-0.12-revert-cross-domain-identifiers.patch b/gui-wm/sommelier/files/sommelier-0.12-revert-cross-domain-identifiers.patch
new file mode 100644
index 0000000..1f3d224
--- /dev/null
+++ b/gui-wm/sommelier/files/sommelier-0.12-revert-cross-domain-identifiers.patch
@@ -0,0 +1,34 @@
+From 80a5c1f9a015f1a41a76fb6c7ef56837ad192264 Mon Sep 17 00:00:00 2001
+From: Sergio Lopez <slp@redhat.com>
+Date: Wed, 4 Sep 2024 13:05:58 +0200
+Subject: [PATCH 1/3] Revert "sommelier: bump up CROSS_DOMAIN_MAX_IDENTIFIERS"
+
+This reverts commit 6497ca3c47ec85ceee6140d1c90ea20d415f0a82.
+
+This change needs to be coordinated with rutabaga and libkrun. Let's
+revert it until then, since it shouldn't have an impact on our current
+use cases.
+
+Signed-off-by: Sergio Lopez <slp@redhat.com>
+---
+ .../sommelier/virtualization/virtgpu_cross_domain_protocol.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/virtualization/virtgpu_cross_domain_protocol.h b/virtualization/virtgpu_cross_domain_protocol.h
+index 55dff23c9c..067b79593f 100644
+--- a/virtualization/virtgpu_cross_domain_protocol.h
++++ b/virtualization/virtgpu_cross_domain_protocol.h
+@@ -20,8 +20,8 @@
+ #define CROSS_DOMAIN_CHANNEL_TYPE_WAYLAND 0x0001
+ #define CROSS_DOMAIN_CHANNEL_TYPE_CAMERA 0x0002
+
+-// The maximum number of identifiers.
+-#define CROSS_DOMAIN_MAX_IDENTIFIERS 28
++// The maximum number of identifiers (value based on wp_linux_dmabuf)
++#define CROSS_DOMAIN_MAX_IDENTIFIERS 4
+
+ // virtgpu memory resource ID. Also works with non-blob memory resources,
+ // despite the name.
+--
+2.45.1
+
diff --git a/gui-wm/sommelier/sommelier-0.12_p20241015.ebuild b/gui-wm/sommelier/sommelier-0.12_p20241015.ebuild
new file mode 100644
index 0000000..edf60da
--- /dev/null
+++ b/gui-wm/sommelier/sommelier-0.12_p20241015.ebuild
@@ -0,0 +1,67 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+PYTHON_COMPAT=( python3_{11,12,13} )
+
+inherit meson python-any-r1
+
+DESCRIPTION="Nested Wayland compositor with support for X11 forwarding"
+HOMEPAGE="https://chromium.googlesource.com/chromiumos/platform2/+/refs/heads/main/vm_tools/sommelier/"
+
+SRC_URI="
+ https://github.com/WhatAmISupposedToPutHere/sommelier/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
+"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64"
+
+PATCHES="
+ ${FILESDIR}/${PN}-0.12-revert-cross-domain-identifiers.patch
+ ${FILESDIR}/${PN}-0.12-dont-call-fixup_plane0.patch
+ ${FILESDIR}/${PN}-0.12-no-unused-wl-assert.patch
+"
+# ${FILESDIR}/${PN}-0.12-enforce-16k-alignment.patch
+
+IUSE="test"
+
+RESTRICT="!test? ( test )"
+
+BDEPEND="
+ dev-util/wayland-scanner
+ $(python_gen_any_dep '
+ dev-python/jinja2[${PYTHON_USEDEP}]
+ ')
+"
+
+DEPEND="
+ media-libs/mesa
+ x11-libs/libdrm
+ x11-libs/pixman
+ x11-libs/libxcb
+ x11-libs/libxkbcommon
+ dev-libs/wayland
+ test? (
+ dev-cpp/gtest
+ )
+"
+
+RDEPEND="
+ ${DEPEND}
+ x11-base/xwayland
+"
+
+python_check_deps() {
+ python_has_version "dev-python/jinja2[${PYTHON_USEDEP}]"
+}
+
+src_configure() {
+ local emesonargs=(
+ -Dxwayland_path="${BROOT}"/usr/bin/Xwayland
+ -Dxwayland_gl_driver_path="${EPREFIX}/usr/$(get_libdir)/dri"
+ -Dwith_tests=$(usex test true false)
+ )
+ meson_src_configure
+}