From 919bd4c6891e49451551b023035dc78b3a040467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Thu, 31 Oct 2019 19:21:48 +0100 Subject: [PATCH 1/7] Adjust to wlroots 0.8.1 layer shell changes See sway commit d19f4f7bf866660d2199cb726bc3708eb42f98dd Update git submodule to b81bb2ef3040e5cf3dcffbddcb5389775c879d85 build: Require recent enough wlroots --- meson.build | 2 +- src/layer_shell.c | 12 +++++++----- src/seat.c | 2 +- subprojects/wlroots | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index a583c7f..d365761 100644 --- a/meson.build +++ b/meson.build @@ -56,7 +56,7 @@ if not embed_wlroots.disabled() and wlroots_proj.found() wlroots_conf = wlroots_proj.get_variable('conf_data') wlroots_has_xwayland = wlroots_conf.get('WLR_HAS_XWAYLAND') == 1 else - wlroots = dependency('wlroots') + wlroots = dependency('wlroots', version: '>= 0.8.1') wlroots_has_xwayland = cc.get_define('WLR_HAS_XWAYLAND', prefix: '#include ', dependencies: wlroots) == '1' endif diff --git a/src/layer_shell.c b/src/layer_shell.c index 29931c6..d45238d 100644 --- a/src/layer_shell.c +++ b/src/layer_shell.c @@ -236,9 +236,9 @@ static void change_osk(const struct osk_origin *osk, struct wl_list layers[LAYER wl_list_insert(&layers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &osk->surface->link); } - if (!force_overlay && osk->layer != osk->surface->layer_surface->layer) { + if (!force_overlay && osk->layer != osk->surface->layer_surface->client_pending.layer) { wl_list_remove(&osk->surface->link); - wl_list_insert(&layers[osk->surface->layer_surface->layer], &osk->surface->link); + wl_list_insert(&layers[osk->surface->layer_surface->client_pending.layer], &osk->surface->link); } } @@ -254,7 +254,8 @@ void arrange_layers(struct roots_output *output) { bool osk_force_overlay = false; struct roots_seat *seat; wl_list_for_each(seat, &server->input->seats, link) { - if (seat->focused_layer && seat->focused_layer->layer >= osk_place.surface->layer_surface->layer) { + if (seat->focused_layer && seat->focused_layer->client_pending.layer >= + osk_place.surface->layer_surface->client_pending.layer) { osk_force_overlay = true; break; } @@ -733,7 +734,8 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { wl_container_of(listener, desktop, layer_shell_surface); wlr_log(WLR_DEBUG, "new layer surface: namespace %s layer %d anchor %d " "size %dx%d margin %d,%d,%d,%d", - layer_surface->namespace, layer_surface->layer, layer_surface->layer, + layer_surface->namespace, layer_surface->client_pending.layer, + layer_surface->client_pending.layer, layer_surface->client_pending.desired_width, layer_surface->client_pending.desired_height, layer_surface->client_pending.margin.top, @@ -793,7 +795,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { layer_surface->data = roots_surface; struct roots_output *output = layer_surface->output->data; - wl_list_insert(&output->layers[layer_surface->layer], &roots_surface->link); + wl_list_insert(&output->layers[layer_surface->client_pending.layer], &roots_surface->link); // Temporarily set the layer's current state to client_pending // So that we can easily arrange it diff --git a/src/seat.c b/src/seat.c index 9171ba4..6a3e94e 100644 --- a/src/seat.c +++ b/src/seat.c @@ -1507,7 +1507,7 @@ void roots_seat_set_focus_layer(struct roots_seat *seat, view_activate(prev_focus, false); } seat->has_focus = false; - if (layer->layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP) { + if (layer->current.layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP) { seat->focused_layer = layer; } if (keyboard != NULL) { -- 2.24.1 From 887a258e4b9ab52056d0c0b821d6c38f2582ef0f Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Thu, 12 Dec 2019 18:45:35 +0100 Subject: [PATCH 2/7] Update to new presentation-time API (cherry picked from rootston commit 877fcac37faac1e276a5790ef55dd161d49e23c2) --- src/output.c | 30 ------------------------------ src/output.h | 1 - src/render.c | 3 ++- subprojects/wlroots | 2 +- 4 files changed, 3 insertions(+), 33 deletions(-) diff --git a/src/output.c b/src/output.c index 267944e..d08442f 100644 --- a/src/output.c +++ b/src/output.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -562,7 +561,6 @@ static void output_destroy(struct roots_output *output) { wl_list_remove(&output->enable.link); wl_list_remove(&output->mode.link); wl_list_remove(&output->transform.link); - wl_list_remove(&output->present.link); wl_list_remove(&output->damage_frame.link); wl_list_remove(&output->damage_destroy.link); free(output); @@ -607,32 +605,6 @@ static void output_handle_transform(struct wl_listener *listener, void *data) { arrange_layers(output); } -static void surface_send_presented_iterator(struct roots_output *output, - struct wlr_surface *surface, struct wlr_box *_box, float rotation, - void *data) { - struct wlr_presentation_event *event = data; - wlr_presentation_send_surface_presented(output->desktop->presentation, - surface, event); -} - -static void output_handle_present(struct wl_listener *listener, void *data) { - struct roots_output *output = - wl_container_of(listener, output, present); - struct wlr_output_event_present *output_event = data; - - struct wlr_presentation_event event = { - .output = output->wlr_output, - .tv_sec = (uint64_t)output_event->when->tv_sec, - .tv_nsec = (uint32_t)output_event->when->tv_nsec, - .refresh = (uint32_t)output_event->refresh, - .seq = (uint64_t)output_event->seq, - .flags = output_event->flags, - }; - - output_for_each_surface(output, - surface_send_presented_iterator, &event); -} - void handle_new_output(struct wl_listener *listener, void *data) { PhocDesktop *desktop = wl_container_of(listener, desktop, new_output); @@ -665,8 +637,6 @@ void handle_new_output(struct wl_listener *listener, void *data) { wl_signal_add(&wlr_output->events.mode, &output->mode); output->transform.notify = output_handle_transform; wl_signal_add(&wlr_output->events.transform, &output->transform); - output->present.notify = output_handle_present; - wl_signal_add(&wlr_output->events.present, &output->present); output->damage_frame.notify = output_damage_handle_frame; wl_signal_add(&output->damage->events.frame, &output->damage_frame); diff --git a/src/output.h b/src/output.h index 5ca0544..c4e7824 100644 --- a/src/output.h +++ b/src/output.h @@ -28,7 +28,6 @@ struct roots_output { struct wl_listener enable; struct wl_listener mode; struct wl_listener transform; - struct wl_listener present; struct wl_listener damage_frame; struct wl_listener damage_destroy; }; diff --git a/src/render.c b/src/render.c index ed9d339..03bee6f 100644 --- a/src/render.c +++ b/src/render.c @@ -134,7 +134,8 @@ static void render_surface_iterator(struct roots_output *output, render_texture(wlr_output, output_damage, texture, &box, matrix, rotation, alpha); - wlr_presentation_surface_sampled(output->desktop->presentation, surface); + wlr_presentation_surface_sampled_on_output(output->desktop->presentation, + surface, wlr_output); collect_touch_points(output, surface, box); } -- 2.24.1 From ed638274b2ae0345dddfa7573568d001499f38ca Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Thu, 9 Jan 2020 02:14:24 +0100 Subject: [PATCH 3/7] Update to wlr_output's atomic API and wlroots 0.9.x branch build: Require recent enough wlroots --- meson.build | 2 +- src/desktop.c | 1 + src/output.c | 11 +++++++---- src/render.c | 1 + subprojects/wlroots | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index d365761..9ad5e82 100644 --- a/meson.build +++ b/meson.build @@ -56,7 +56,7 @@ if not embed_wlroots.disabled() and wlroots_proj.found() wlroots_conf = wlroots_proj.get_variable('conf_data') wlroots_has_xwayland = wlroots_conf.get('WLR_HAS_XWAYLAND') == 1 else - wlroots = dependency('wlroots', version: '>= 0.8.1') + wlroots = dependency('wlroots', version: '>= 0.9.0') wlroots_has_xwayland = cc.get_define('WLR_HAS_XWAYLAND', prefix: '#include ', dependencies: wlroots) == '1' endif diff --git a/src/desktop.c b/src/desktop.c index 39c74d3..a1b1064 100644 --- a/src/desktop.c +++ b/src/desktop.c @@ -624,6 +624,7 @@ phoc_desktop_toggle_output_blank (PhocDesktop *self) gboolean enable = !output->wlr_output->enabled; wlr_output_enable (output->wlr_output, enable); + wlr_output_commit (output->wlr_output); if (enable) output_damage_whole(output); } diff --git a/src/output.c b/src/output.c index d08442f..68bef03 100644 --- a/src/output.c +++ b/src/output.c @@ -505,8 +505,9 @@ void handle_output_manager_apply(struct wl_listener *listener, void *data) { wl_list_for_each(config_head, &config->heads, link) { struct wlr_output *wlr_output = config_head->state.output; if (!config_head->state.enabled) { - ok &= wlr_output_enable(wlr_output, false); + wlr_output_enable(wlr_output, false); wlr_output_layout_remove(desktop->layout, wlr_output); + ok &= wlr_output_commit(wlr_output); } } @@ -516,11 +517,11 @@ void handle_output_manager_apply(struct wl_listener *listener, void *data) { if (!config_head->state.enabled) { continue; } - ok &= wlr_output_enable(wlr_output, true); + wlr_output_enable(wlr_output, true); if (config_head->state.mode != NULL) { - ok &= wlr_output_set_mode(wlr_output, config_head->state.mode); + wlr_output_set_mode(wlr_output, config_head->state.mode); } else { - ok &= wlr_output_set_custom_mode(wlr_output, + wlr_output_set_custom_mode(wlr_output, config_head->state.custom_mode.width, config_head->state.custom_mode.height, config_head->state.custom_mode.refresh); @@ -529,6 +530,7 @@ void handle_output_manager_apply(struct wl_listener *listener, void *data) { config_head->state.x, config_head->state.y); wlr_output_set_transform(wlr_output, config_head->state.transform); wlr_output_set_scale(wlr_output, config_head->state.scale); + ok &= wlr_output_commit(wlr_output); } if (ok) { @@ -683,6 +685,7 @@ void handle_new_output(struct wl_listener *listener, void *data) { } wlr_output_layout_add_auto(desktop->layout, wlr_output); } + wlr_output_commit(wlr_output); struct roots_seat *seat; wl_list_for_each(seat, &input->seats, link) { diff --git a/src/render.c b/src/render.c index 03bee6f..8490b5a 100644 --- a/src/render.c +++ b/src/render.c @@ -456,6 +456,7 @@ void output_render(struct roots_output *output) { if (!needs_frame) { // Output doesn't need swap and isn't damaged, skip rendering completely + wlr_output_rollback(wlr_output); goto buffer_damage_finish; } -- 2.24.1 From a1651088b49db442f2dc9c82a74c6a52c6c073a8 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Thu, 9 Jan 2020 06:17:28 +0100 Subject: [PATCH 4/7] layer-shell: Fix incorrect variable passed to debug log --- src/layer_shell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layer_shell.c b/src/layer_shell.c index d45238d..8a19739 100644 --- a/src/layer_shell.c +++ b/src/layer_shell.c @@ -735,7 +735,7 @@ void handle_layer_shell_surface(struct wl_listener *listener, void *data) { wlr_log(WLR_DEBUG, "new layer surface: namespace %s layer %d anchor %d " "size %dx%d margin %d,%d,%d,%d", layer_surface->namespace, layer_surface->client_pending.layer, - layer_surface->client_pending.layer, + layer_surface->client_pending.anchor, layer_surface->client_pending.desired_width, layer_surface->client_pending.desired_height, layer_surface->client_pending.margin.top, -- 2.24.1 From 795ebe8b4b60884caf3f2a2fb0884ca84866db11 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Thu, 9 Jan 2020 06:20:04 +0100 Subject: [PATCH 5/7] layer-shell: Handle layer changes Fixes #92 --- src/layer_shell.c | 11 ++++++++++- src/layers.h | 1 + 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/layer_shell.c b/src/layer_shell.c index 8a19739..3951e47 100644 --- a/src/layer_shell.c +++ b/src/layer_shell.c @@ -360,7 +360,16 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) { update_cursors(layer, &server->input->seats); } - if (memcmp(&old_geo, &layer->geo, sizeof(struct wlr_box)) != 0) { + bool geo_changed = + memcmp(&old_geo, &layer->geo, sizeof(struct wlr_box)) != 0; + bool layer_changed = layer->layer != layer_surface->current.layer; + if (layer_changed) { + wl_list_remove(&layer->link); + wl_list_insert(&output->layers[layer_surface->current.layer], + &layer->link); + layer->layer = layer_surface->current.layer; + } + if (geo_changed || layer_changed) { output_damage_whole_local_surface(output, layer_surface->surface, old_geo.x, old_geo.y); output_damage_whole_local_surface(output, layer_surface->surface, diff --git a/src/layers.h b/src/layers.h index a0bccae..a9afdaa 100644 --- a/src/layers.h +++ b/src/layers.h @@ -25,6 +25,7 @@ struct roots_layer_surface { struct wl_list subsurfaces; // roots_layer_subsurface::link struct wlr_box geo; + enum zwlr_layer_shell_v1_layer layer; }; struct roots_layer_popup { -- 2.24.1 From 85fa0813a1e6e01165d357ab3745708e47c93d90 Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Mon, 13 Jan 2020 21:55:19 +0100 Subject: [PATCH 7/7] CI: Use the CI repo in Buster builds for newer Meson --- .gitlab-ci.yml | 53 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 20e61c0..18bec62 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,7 @@ variables: ALPINE_EDGE_DEPS: | git meson ninja gnome-desktop-dev gobject-introspection-dev libinput-dev wayland-dev wayland-protocols libxkbcommon-dev wlroots-dev + DEB_BUILD_PROFILES: pkg.phoc.embedwlroots .tags: &tags tags: @@ -21,14 +22,28 @@ variables: - ninja -C _build - ninja -C _build install -before_script: - - apt-get -y update - - apt-get -y install $DEPS - - DEB_BUILD_PROFILES=pkg.phoc.embedwlroots apt-get -y build-dep . +.before_script_debian: &before_script_debian + - apt-get -y update + - apt-get -y install $DEPS + - apt-get -y build-dep . + +.before_script_debian_buster: &before_script_debian_buster + # meson in buster is too old + - apt-get -y update + - apt-get -y install wget ca-certificates gnupg + - wget -O- https://ci.puri.sm/ci-repo.key | apt-key add - + - echo "deb https://ci.puri.sm/ scratch librem5" > /etc/apt/sources.list.d/ci.list + - *before_script_debian + +.before_script_alpine: &before_script_alpine + - apk -q add alpine-sdk + - apk -q add $ALPINE_EDGE_DEPS + build-with-xwayland-debian-buster: stage: build image: debian:buster + before_script: *before_script_debian_buster variables: BUILD_ARGS: -Dxwayland=enabled <<: *tags @@ -40,6 +55,7 @@ build-with-xwayland-debian-buster: build-with-xwayland-debian-bullseye: stage: build image: debian:bullseye + before_script: *before_script_debian variables: BUILD_ARGS: -Dxwayland=enabled <<: *tags @@ -48,6 +64,7 @@ build-with-xwayland-debian-bullseye: build-without-xwayland-debian-buster: stage: build image: debian:buster + before_script: *before_script_debian_buster variables: BUILD_ARGS: -Dxwayland=disabled <<: *tags @@ -56,9 +73,7 @@ build-without-xwayland-debian-buster: build-with-xwayland-alpinelinux-edge: stage: build image: alpine:edge - before_script: - - apk -q add alpine-sdk - - apk -q add $ALPINE_EDGE_DEPS + before_script: *before_script_alpine variables: BUILD_ARGS: -Dxwayland=enabled <<: *tags @@ -68,9 +83,7 @@ build-with-xwayland-alpinelinux-edge: build-without-xwayland-alpinelinux-edge: stage: build image: alpine:edge - before_script: - - apk -q add alpine-sdk - - apk -q add $ALPINE_EDGE_DEPS + before_script: *before_script_alpine variables: BUILD_ARGS: -Dxwayland=disabled <<: *tags @@ -84,6 +97,7 @@ unit-test-with-xwayland-debian-buster: image: debian:buster dependencies: - build-with-xwayland-debian-buster + before_script: *before_script_debian_buster script: - xvfb-run ninja -C _build test artifacts: @@ -95,9 +109,10 @@ package-deb-with-wlroots: <<: *tags stage: package image: debian:buster + before_script: *before_script_debian_buster script: - git submodule update --init - - DEB_BUILD_PROFILES=pkg.phoc.embedwlroots dpkg-buildpackage -uc -us + - dpkg-buildpackage -uc -us # Must not be dynamically linked against wlroots - ldd debian/phoc/usr/bin/phoc | grep -qs libwlroots && exit 1 || true - cp ../*.deb . @@ -109,15 +124,9 @@ package-deb-without-wlroots: <<: *tags stage: package image: debian:buster - before_script: - - echo "deb http://deb.debian.org/debian/ experimental main" > /etc/apt/sources.list.d/experimental.list - - apt-get -y update - - apt-get -y install $DEPS - # This pulls in wlroots build-deps and so avoids pulling in e.g. mesa from - # experimental due to pulling wlroots from experimental - # Once we have wlroots in our archive we can drop the build profile - - DEB_BUILD_PROFILES=pkg.phoc.embedwlroots apt-get -y build-dep . - - apt-get -y -t experimental install libwlroots-dev + before_script: *before_script_debian_buster + variables: + DEB_BUILD_PROFILES: "" script: - dpkg-buildpackage -uc -us # Must be dynamically linked against wlroots @@ -126,15 +135,17 @@ package-deb-without-wlroots: artifacts: paths: - "*.deb" + allow_failure: true # temporarily until recent wlroots hits the CI repo package-deb-with-wlroots:arm64: tags: - librem5:arm64 stage: package image: debian:buster + before_script: *before_script_debian_buster script: - git submodule update --init - - DEB_BUILD_PROFILES=pkg.phoc.embedwlroots dpkg-buildpackage -uc -us + - dpkg-buildpackage -uc -us # Must not be dynamically linked against wlroots - ldd debian/phoc/usr/bin/phoc | grep -qs libwlroots && exit 1 || true - cp ../*.deb . -- 2.24.1