Update wlroots to the latest release
cover Update wlroots to the latest release
Hi,
This is a small patch set which brings wlroots library to its most recent version, fixing the cage compositor with a backported patch (as there is no newer release yet). I am adding one additional patch that enables the new Vulkan renderer when any of Mesa's Vulkan drivers is selected, too.
I don't expect the two first patches of the set to be controversial, but dunno about the Vulkan one. If there are doubts, I suppose the first two could be merged anyway, leaving the other out for further discussion.
One more thing: With wlroots 0.15.x it is finally possible to disable building the accelerated renderers (GLESv2, Vulkan) and have only the software based one (Pixman) built into wlroots. Currently I do not have the need for such a configuration, and therefore I am not planning to send a patch to allow that for now. On the other hand, if anyone wanted to try writing the patch, I would be more than happy to review it :-)
Cheers,
-Adrian
Adrian Perez de Castro (3):
package/wlroots: bump to version 0.15.1 package/cage: add upstream patch for wlroots 0.15.x package/wlroots: enable vulkan renderer if possible
.../cage/0001-Upgrade-to-wlroots-0.15.patch | 312 ++++++++++++++++++ package/wlroots/Config.in | 2 +- package/wlroots/wlroots.hash | 4 +- package/wlroots/wlroots.mk | 29 +- 4 files changed, 332 insertions(+), 15 deletions(-) create mode 100644 package/cage/0001-Upgrade-to-wlroots-0.15.patch
Signature · 6 lines
2.36.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 1/3 package/wlroots: bump to version 0.15.1
Update to version 0.15.1, and adapt to upstream changes:
- Adapted from the old -Dfoo-backend Meson option to the new -Dbackends one, which is an array. The set of always enabled backends matches the previous selection: drm+libinput always enabled, x11 only if selected.
- Removed the libpng and ffmpeg dependency, which are no longer needed with examples disabled (which is always the case for Buildroot).
- Changed homepage and download site URLs to the FreeDesktop.org GitLab.
This release changes the API/ABI, and applications which use wlroots must be adapted and rebuilt. Currently in Buildroot we have only the cage compositor, to be updated in a follow-up patch.
--- package/wlroots/Config.in | 2 +- package/wlroots/wlroots.hash | 4 ++-- package/wlroots/wlroots.mk | 19 ++++++++----------- 3 files changed, 11 insertions(+), 14 deletions(-)
package/wlroots/Config.in +1 -1
@@ -27,7 +27,7 @@ config BR2_PACKAGE_WLROOTS wlroots is a modular Wayland library for building compositors which implements many of their common features. - https://github.com/swaywm/wlroots + https://gitlab.freedesktop.org/wlroots/wlroots if BR2_PACKAGE_WLROOTS
package/wlroots/wlroots.hash +2 -2
@@ -1,5 +1,5 @@ -# Generated locally, after checking https://github.com/swaywm/wlroots/releases/download/0.14.1/wlroots-0.14.1.tar.gz.sig -sha256 448a83d579ac280357c8a4e902b9477bacbab81cc4d9c140e443642d458869db wlroots-0.14.1.tar.gz +# Generated locally, after checking https://gitlab.freedesktop.org/wlroots/wlroots/-/releases/0.15.1/downloads/wlroots-0.15.1.tar.gz.sig +sha256 5b92f11a52d978919ed1306e0d54c9d59f1762b28d44f0a2da3ef3b351305373 wlroots-0.15.1.tar.gz # Hashes for license files: sha256 ffd3737a478b83a8b51b42757d3bf909ef36694508355879722e11fc1fa6736b LICENSE
package/wlroots/wlroots.mk +8 -11
@@ -4,8 +4,8 @@ # ################################################################################ -WLROOTS_VERSION = 0.14.1 -WLROOTS_SITE = https://github.com/swaywm/wlroots/releases/download/$(WLROOTS_VERSION) +WLROOTS_VERSION = 0.15.1 +WLROOTS_SITE = https://gitlab.freedesktop.org/wlroots/wlroots/-/releases/$(WLROOTS_VERSION)/downloads WLROOTS_LICENSE = MIT WLROOTS_LICENSE_FILES = LICENSE WLROOTS_INSTALL_STAGING = YES
@@ -25,19 +25,16 @@ WLROOTS_DEPENDENCIES = \ WLROOTS_CONF_OPTS = -Dexamples=false -Dxcb-errors=disabled -Drenderers=gles2 -ifeq ($(BR2_PACKAGE_FFMPEG),y) -WLROOTS_DEPENDENCIES += ffmpeg -endif - -ifeq ($(BR2_PACKAGE_LIBPNG),y) -WLROOTS_DEPENDENCIES += libpng -endif +WLROOTS_BACKENDS = libinput drm ifeq ($(BR2_PACKAGE_WLROOTS_X11),y) -WLROOTS_CONF_OPTS += -Dx11-backend=enabled -Dxwayland=enabled +WLROOTS_BACKENDS += x11 +WLROOTS_CONF_OPTS += -Dxwayland=enabled WLROOTS_DEPENDENCIES += libxcb xcb-util-wm xcb-util-renderutil xlib_libX11 else -WLROOTS_CONF_OPTS += -Dx11-backend=disabled -Dxwayland=disabled +WLROOTS_CONF_OPTS += -Dxwayland=disabled endif +WLROOTS_CONF_OPTS += -Dbackends=$(subst $(space),$(comma),$(strip $(WLROOTS_BACKENDS))) + $(eval $(meson-package))
Signature · 6 lines
2.36.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Re: [Buildroot] [PATCH 1/3] package/wlroots: bump to version 0.15.1
Quoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Adrian" == Adrian Perez de Castro <[email protected]> writes:
Update to version 0.15.1, and adapt to upstream changes:
- Adapted from the old -Dfoo-backend Meson option to the new -Dbackends one, which is an array. The set of always enabled backends matches the previous selection: drm+libinput always enabled, x11 only if selected.
- Removed the libpng and ffmpeg dependency, which are no longer needed with examples disabled (which is always the case for Buildroot).
- Changed homepage and download site URLs to the FreeDesktop.org GitLab.
Quoted 5 lines
This release changes the API/ABI, and applications which use wlroots must be adapted and rebuilt. Currently in Buildroot we have only the cage compositor, to be updated in a follow-up patch.
Signed-off-by Adrian Perez de Castro <[email protected]>
Old patch, but while testing the recently added sway package I notice that wlroots fails to build with X11 support:
Found CMake: /usr/bin/cmake (3.18.4)
Run-time dependency xwayland found: NO (tried pkgconfig and cmake) Program Xwayland found: NO
How is this supposed to work? We don't have a Xwayland package in Buildroot, so no pkgconfig file. I see there is some fallback logic in wlroots to look for an Xwayland binary (on the host presumably), but that doesn't work for hosts without it and will again fail at runtime.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 2/3 package/cage: add upstream patch for wlroots 0.15.x
In reply to Adrian Perez de CastroAdd a backported patch from the upstream repository which makes cage usable with wlroots 0.15.x.
--- .../cage/0001-Upgrade-to-wlroots-0.15.patch | 312 ++++++++++++++++++ 1 file changed, 312 insertions(+) create mode 100644 package/cage/0001-Upgrade-to-wlroots-0.15.patch
package/cage/0001-Upgrade-to-wlroots-0.15.patch new file +312 -0
@@ -0,0 +1,312 @@ +From e51bef3fdad649d453276717294cc6177666cf5a Mon Sep 17 00:00:00 2001 +From: Simon Ser <[email protected]> +Date: Wed, 11 Aug 2021 11:31:14 +0200 +Subject: [PATCH] Upgrade to wlroots 0.15 + +- Update wlr_box includes to util/box.h: the wlroots header has + been moved upstream. +- Subsurface fields have been moved +- Create renderer and allocator, stop using wlr_backend_get_renderer +- Initalize output rendering + +Signed-off-by: Adrian Perez de Castro <[email protected]> +Upstream status: https://github.com/Hjdskes/cage/commit/395189fb051ed722c7b10b6cb11caa8f6904079c +--- + cage.c | 21 +++++++++++++++++---- + meson.build | 2 +- + output.c | 5 +++++ + render.c | 26 ++++++++------------------ + server.h | 2 ++ + util.c | 2 -- + util.h | 2 +- + view.c | 5 ++--- + view.h | 2 +- + xdg_shell.c | 1 - + xwayland.c | 1 - + 11 files changed, 37 insertions(+), 32 deletions(-) + +diff --git a/cage.c b/cage.c +index 5392535..f9db7a9 100644 +--- a/cage.c ++++ b/cage.c +@@ -19,6 +19,7 @@ + #include <unistd.h> + #include <wayland-server-core.h> + #include <wlr/backend.h> ++#include <wlr/render/allocator.h> + #include <wlr/render/wlr_renderer.h> + #include <wlr/types/wlr_compositor.h> + #include <wlr/types/wlr_data_device.h> +@@ -261,7 +262,6 @@ main(int argc, char *argv[]) + struct wl_event_source *sigint_source = NULL; + struct wl_event_source *sigterm_source = NULL; + struct wl_event_source *sigchld_source = NULL; +- struct wlr_renderer *renderer = NULL; + struct wlr_compositor *compositor = NULL; + struct wlr_data_device_manager *data_device_manager = NULL; + struct wlr_server_decoration_manager *server_decoration_manager = NULL; +@@ -316,8 +316,21 @@ main(int argc, char *argv[]) + goto end; + } + +- renderer = wlr_backend_get_renderer(server.backend); +- wlr_renderer_init_wl_display(renderer, server.wl_display); ++ server.renderer = wlr_renderer_autocreate(server.backend); ++ if (!server.renderer) { ++ wlr_log(WLR_ERROR, "Unable to create the wlroots renderer"); ++ ret = 1; ++ goto end; ++ } ++ ++ server.allocator = wlr_allocator_autocreate(server.backend, server.renderer); ++ if (!server.allocator) { ++ wlr_log(WLR_ERROR, "Unable to create the wlroots allocator"); ++ ret = 1; ++ goto end; ++ } ++ ++ wlr_renderer_init_wl_display(server.renderer, server.wl_display); + + wl_list_init(&server.views); + wl_list_init(&server.outputs); +@@ -329,7 +342,7 @@ main(int argc, char *argv[]) + goto end; + } + +- compositor = wlr_compositor_create(server.wl_display, renderer); ++ compositor = wlr_compositor_create(server.wl_display, server.renderer); + if (!compositor) { + wlr_log(WLR_ERROR, "Unable to create the wlroots compositor"); + ret = 1; +diff --git a/meson.build b/meson.build +index 3a84794..f2e5428 100644 +--- a/meson.build ++++ b/meson.build +@@ -34,7 +34,7 @@ if is_freebsd + ) + endif + +-wlroots = dependency('wlroots', version: '>= 0.14.0') ++wlroots = dependency('wlroots', version: '>= 0.15.0') + wayland_protos = dependency('wayland-protocols', version: '>=1.14') + wayland_server = dependency('wayland-server') + pixman = dependency('pixman-1') +diff --git a/output.c b/output.c +index d8da3b9..e8b3a22 100644 +--- a/output.c ++++ b/output.c +@@ -442,6 +442,11 @@ handle_new_output(struct wl_listener *listener, void *data) + struct cg_server *server = wl_container_of(listener, server, new_output); + struct wlr_output *wlr_output = data; + ++ if (!wlr_output_init_render(wlr_output, server->allocator, server->renderer)) { ++ wlr_log(WLR_ERROR, "Failed to initialize output rendering"); ++ return; ++ } ++ + struct cg_output *output = calloc(1, sizeof(struct cg_output)); + if (!output) { + wlr_log(WLR_ERROR, "Failed to allocate output"); +diff --git a/render.c b/render.c +index 166a088..ffa960f 100644 +--- a/render.c ++++ b/render.c +@@ -10,11 +10,11 @@ + #include <wayland-server-core.h> + #include <wlr/backend.h> + #include <wlr/render/wlr_renderer.h> +-#include <wlr/types/wlr_box.h> + #include <wlr/types/wlr_matrix.h> + #include <wlr/types/wlr_output.h> + #include <wlr/types/wlr_output_layout.h> + #include <wlr/types/wlr_surface.h> ++#include <wlr/util/box.h> + #include <wlr/util/log.h> + #include <wlr/util/region.h> + +@@ -27,8 +27,6 @@ + static void + scissor_output(struct wlr_output *output, pixman_box32_t *rect) + { +- struct wlr_renderer *renderer = wlr_backend_get_renderer(output->backend); +- + struct wlr_box box = { + .x = rect->x1, + .y = rect->y1, +@@ -41,7 +39,7 @@ scissor_output(struct wlr_output *output, pixman_box32_t *rect) + enum wl_output_transform transform = wlr_output_transform_invert(output->transform); + wlr_box_transform(&box, &box, transform, output_width, output_height); + +- wlr_renderer_scissor(renderer, &box); ++ wlr_renderer_scissor(output->renderer, &box); + } + + struct render_data { +@@ -52,8 +50,6 @@ static void + render_texture(struct wlr_output *wlr_output, pixman_region32_t *output_damage, struct wlr_texture *texture, + const struct wlr_box *box, const float matrix[static 9]) + { +- struct wlr_renderer *renderer = wlr_backend_get_renderer(wlr_output->backend); +- + pixman_region32_t damage; + pixman_region32_init(&damage); + pixman_region32_union_rect(&damage, &damage, box->x, box->y, box->width, box->height); +@@ -66,7 +62,7 @@ render_texture(struct wlr_output *wlr_output, pixman_region32_t *output_damage, + pixman_box32_t *rects = pixman_region32_rectangles(&damage, &nrects); + for (int i = 0; i < nrects; i++) { + scissor_output(wlr_output, &rects[i]); +- wlr_render_texture_with_matrix(renderer, texture, matrix, 1.0f); ++ wlr_render_texture_with_matrix(wlr_output->renderer, texture, matrix, 1.0f); + } + + damage_finish: +@@ -134,13 +130,7 @@ output_render(struct cg_output *output, pixman_region32_t *damage) + struct cg_server *server = output->server; + struct wlr_output *wlr_output = output->wlr_output; + +- struct wlr_renderer *renderer = wlr_backend_get_renderer(wlr_output->backend); +- if (!renderer) { +- wlr_log(WLR_DEBUG, "Expected the output backend to have a renderer"); +- return; +- } +- +- wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height); ++ wlr_renderer_begin(server->renderer, wlr_output->width, wlr_output->height); + + if (!pixman_region32_not_empty(damage)) { + wlr_log(WLR_DEBUG, "Output isn't damaged but needs a buffer swap"); +@@ -149,7 +139,7 @@ output_render(struct cg_output *output, pixman_region32_t *damage) + + #ifdef DEBUG + if (server->debug_damage_tracking) { +- wlr_renderer_clear(renderer, (float[]){1.0f, 0.0f, 0.0f, 1.0f}); ++ wlr_renderer_clear(server->renderer, (float[]){1.0f, 0.0f, 0.0f, 1.0f}); + } + #endif + +@@ -158,7 +148,7 @@ output_render(struct cg_output *output, pixman_region32_t *damage) + pixman_box32_t *rects = pixman_region32_rectangles(damage, &nrects); + for (int i = 0; i < nrects; i++) { + scissor_output(wlr_output, &rects[i]); +- wlr_renderer_clear(renderer, color); ++ wlr_renderer_clear(server->renderer, color); + } + + // TODO: render only top view, possibly use focused view for this, see #35. +@@ -178,8 +168,8 @@ renderer_end: + /* Draw software cursor in case hardware cursors aren't + available. This is a no-op when they are. */ + wlr_output_render_software_cursors(wlr_output, damage); +- wlr_renderer_scissor(renderer, NULL); +- wlr_renderer_end(renderer); ++ wlr_renderer_scissor(server->renderer, NULL); ++ wlr_renderer_end(server->renderer); + + int output_width, output_height; + wlr_output_transformed_resolution(wlr_output, &output_width, &output_height); +diff --git a/server.h b/server.h +index 817637b..74970c5 100644 +--- a/server.h ++++ b/server.h +@@ -25,6 +25,8 @@ struct cg_server { + struct wl_display *wl_display; + struct wl_list views; + struct wlr_backend *backend; ++ struct wlr_renderer *renderer; ++ struct wlr_allocator *allocator; + + struct cg_seat *seat; + struct wlr_idle *idle; +diff --git a/util.c b/util.c +index 95de499..714c7e3 100644 +--- a/util.c ++++ b/util.c +@@ -6,8 +6,6 @@ + * See the LICENSE file accompanying this file. + */ + +-#include <wlr/types/wlr_box.h> +- + #include "util.h" + + int +diff --git a/util.h b/util.h +index db6bc7d..b6281f3 100644 +--- a/util.h ++++ b/util.h +@@ -1,7 +1,7 @@ + #ifndef CG_UTIL_H + #define CG_UTIL_H + +-#include <wlr/types/wlr_box.h> ++#include <wlr/util/box.h> + + /** Apply scale to a width or height. */ + int scale_length(int length, int offset, float scale); +diff --git a/view.c b/view.c +index 3f3b0ed..33b59b4 100644 +--- a/view.c ++++ b/view.c +@@ -12,7 +12,6 @@ + #include <stdlib.h> + #include <string.h> + #include <wayland-server-core.h> +-#include <wlr/types/wlr_box.h> + #include <wlr/types/wlr_output.h> + #include <wlr/types/wlr_surface.h> + +@@ -235,10 +234,10 @@ view_map(struct cg_view *view, struct wlr_surface *surface) + view->wlr_surface = surface; + + struct wlr_subsurface *subsurface; +- wl_list_for_each (subsurface, &view->wlr_surface->subsurfaces_below, parent_link) { ++ wl_list_for_each (subsurface, &view->wlr_surface->current.subsurfaces_below, current.link) { + subsurface_create(view, subsurface); + } +- wl_list_for_each (subsurface, &view->wlr_surface->subsurfaces_above, parent_link) { ++ wl_list_for_each (subsurface, &view->wlr_surface->current.subsurfaces_above, current.link) { + subsurface_create(view, subsurface); + } + +diff --git a/view.h b/view.h +index cd16e42..87477d0 100644 +--- a/view.h ++++ b/view.h +@@ -5,9 +5,9 @@ + + #include <stdbool.h> + #include <wayland-server-core.h> +-#include <wlr/types/wlr_box.h> + #include <wlr/types/wlr_surface.h> + #include <wlr/types/wlr_xdg_shell.h> ++#include <wlr/util/box.h> + #if CAGE_HAS_XWAYLAND + #include <wlr/xwayland.h> + #endif +diff --git a/xdg_shell.c b/xdg_shell.c +index 2e42347..d676552 100644 +--- a/xdg_shell.c ++++ b/xdg_shell.c +@@ -9,7 +9,6 @@ + #include <stdbool.h> + #include <stdlib.h> + #include <wayland-server-core.h> +-#include <wlr/types/wlr_box.h> + #include <wlr/types/wlr_xdg_shell.h> + #include <wlr/util/log.h> + +diff --git a/xwayland.c b/xwayland.c +index 2aae0f9..ebd8e54 100644 +--- a/xwayland.c ++++ b/xwayland.c +@@ -9,7 +9,6 @@ + #include <stdbool.h> + #include <stdlib.h> + #include <wayland-server-core.h> +-#include <wlr/types/wlr_box.h> + #include <wlr/util/log.h> + #include <wlr/xwayland.h> + +-- +2.36.0 +
Signature · 6 lines
2.36.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
PATCH 3/3 package/wlroots: enable vulkan renderer if possible
In reply to Adrian Perez de CastroEnable the wlroots' Vulkan renderer if a suitable driver is being built. Currently only Mesa provides Vulkan drivers, so gating the feature on BR2_PACKAGE_MESA3D_VULKAN_DRIVER seems reasonable at the moment (and is done at least by one other package already: pipewire).
--- package/wlroots/wlroots.mk | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
package/wlroots/wlroots.mk +10 -2
@@ -23,8 +23,9 @@ WLROOTS_DEPENDENCIES = \ wayland \ wayland-protocols -WLROOTS_CONF_OPTS = -Dexamples=false -Dxcb-errors=disabled -Drenderers=gles2 +WLROOTS_CONF_OPTS = -Dexamples=false -Dxcb-errors=disabled +WLROOTS_RENDERERS = gles2 WLROOTS_BACKENDS = libinput drm ifeq ($(BR2_PACKAGE_WLROOTS_X11),y)
@@ -35,6 +36,13 @@ else WLROOTS_CONF_OPTS += -Dxwayland=disabled endif -WLROOTS_CONF_OPTS += -Dbackends=$(subst $(space),$(comma),$(strip $(WLROOTS_BACKENDS))) +ifeq ($(BR2_PACKAGE_MESA3D_VULKAN_DRIVER),y) +WLROOTS_RENDERERS += vulkan +WLROOTS_DEPENDENCIES += mesa3d +endif + +WLROOTS_CONF_OPTS += \ + -Dbackends=$(subst $(space),$(comma),$(strip $(WLROOTS_BACKENDS))) \ + -Drenderers=$(subst $(space),$(comma),$(strip $(WLROOTS_RENDERERS))) $(eval $(meson-package))
Signature · 6 lines
2.36.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 18 lines · Adrian Perez de Castro
Hi,
This is a small patch set which brings wlroots library to its most recent version, fixing the cage compositor with a backported patch (as there is no newer release yet). I am adding one additional patch that enables the new Vulkan renderer when any of Mesa's Vulkan drivers is selected, too.
I don't expect the two first patches of the set to be controversial, but dunno about the Vulkan one. If there are doubts, I suppose the first two could be merged anyway, leaving the other out for further discussion.
One more thing: With wlroots 0.15.x it is finally possible to disable building the accelerated renderers (GLESv2, Vulkan) and have only the software based one (Pixman) built into wlroots. Currently I do not have the need for such a configuration, and therefore I am not planning to send a patch to allow that for now. On the other hand, if anyone wanted to try writing the patch, I would be more than happy to review it :-)
Quoted 8 lines
Cheers,
-AdrianAdrian Perez de Castro (3):
package/wlroots: bump to version 0.15.1 package/cage: add upstream patch for wlroots 0.15.x package/wlroots: enable vulkan renderer if possible
Series applied to master, thanks.
Regards,
Arnout
Quoted 8 lines
.../cage/0001-Upgrade-to-wlroots-0.15.patch | 312 ++++++++++++++++++ package/wlroots/Config.in | 2 +- package/wlroots/wlroots.hash | 4 +- package/wlroots/wlroots.mk | 29 +- 4 files changed, 332 insertions(+), 15 deletions(-)create mode 100644
package/cage/0001-Upgrade-to-wlroots-0.15.patch
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot