-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use wlr_render_pass #7552
Use wlr_render_pass #7552
Conversation
This lets us easily add rendering state that we need in the future
84e5e79
to
76300be
Compare
Hm, it seems like with a 90-degree output rotation and scale=1.5 swaybar renders clipped somehow… Doesn't seem to be a damage issue… |
I think I worked through all the transform issues combined with scale |
It seems like the cursor is getting chopped off still when hovering swaybar with an output set to scale=1.5 transform=90. |
Ah, this is reproducible with scene, so unrelated to this patch! |
The cursor??!! The rendering there isn't done by us. It's done by our fabulous friend |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
The new wlr_render_pass API provides src_box, dst_box and clip parameters for texture rendition. Rather than clipping the dst_box, which control the projection matrix and leads to compression, intersect the damage and clip box and pass these as a clip parameter. Fixes: swaywm#7579 Regressed by: swaywm#7552
Clear was done using the untransformed output dimensions, leading to issues when output scaling was in use. Use the transformed resolution instead. Regressed by: swaywm#7552
Clear was done using sway_output's logical dimensions, instead of the wlr_output physical dimensions. This meant that when output scaling was applied, only a part of the screen would be cleared. Use the transformed resolution instead. Regressed by: swaywm#7552
Clear was done using sway_output's logical dimensions, instead of the wlr_output physical dimensions. This meant that when output scaling was applied, only a part of the screen would be cleared. Use the wlr_output dimensions instead. Regressed by: swaywm#7552
Clear was done using sway_output's logical dimensions, instead of the wlr_output physical dimensions. This meant that when output scaling was applied, only a part of the screen would be cleared. Use the wlr_output dimensions instead. Regressed by: #7552
We need to provide an unclipped dst_box. Fixes: swaywm#7573 Regressed by: swaywm#7552
We need to provide an unclipped dst_box. Fixes: swaywm#7573 Regressed by: swaywm#7552
* root: Try to preserve relative positions of floating containers This makes the behavior of floating containers more consistent with i3. The coordinates of the container are scaled when the size of the workspace it is on changes or when the container is moved between workspaces on different outputs. For scratchpad containers, add a new state that preserves the dimensions of the last output the window appeared on. This is necessary because after a container is hidden in the scratchpad, we expect it to be in the same relative position on the output when it reappears. We can't just use the container's attached workspace because that workspace's dimensions might have been changed or the workspace as a whole could have been destroyed. * root: Set inactive focus when scratchpad is moved to new workspace Fixes an issue where an already visible scratchpad window being moved due to 'scratchpad show' leaves the entire workspace at the top of the focus stack in the old workspace. Moving by 'focus output' back to the old workspace would focus the entire workspace instead of just the last active container. * Init the damage_ring bounds on output creation Otherwise the initial bounds would be `INT_MAX` until `handle_mode` or `handle_commit` is called :) * man: deprecate seat cursor move/set/press/release The Wayland protocol better serves this purpose, and is supported by more compositors. * Add a .mailmap file * ipc: add LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM entry This was introduced in the last libinput release. Fixes the following error: ../sway/ipc-json.c:928:17: error: enumeration value 'LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM' not handled in switch [-Werror=switch] 928 | switch (libinput_device_config_accel_get_profile(device)) { | ^~~~~~ * swaybar: Set opaque region properly The opaque region is set incorrectly if updated on-the-fly if switching from an opaque to a non opaque background. * swaybar: Lift background clearing out of main rendering function This avoids us from using a bogus background_color value that mutates as swaybar renders things and deciding opacity depending on that. Also remove a redundant full surface clear. Just directly write our desired background color. * Fix damage-ring bounds not being set when unplugging -> plugging in monitor swaywm#7524 was a partial fix. Seems like this is still an issue when unplugging and plugging the monitor back in. Closes: swaywm#7528 * Remove duplicate wlr_damage_ring_set_bounds() call We already do this in handle_commit(). * Chase wlroots!4067 * Pass version to wlr_compositor_create() References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3696 * Skip direct scan-out commit when damage is empty When there is no damage, no need to perform an output commit, even when direct scan-out is used. * Set output damage during direct scan-out During direct scan-out, pass the damaged region to the wlroots backend. * Fix old style function definitions Signed-off-by: Elyes Haouas <ehaouas@noos.fr> * Introduce output_match_name_or_id() Reduces code duplication. * Use all_output_by_name_or_id() in merge_id_on_name() No need to iterate over the outputs manually. * Use output_match_name_or_id() in apply_output_config_to_outputs() * Use output_match_name_or_id() in workspace functions * Add format_str() and vformat_str() Simple helpers to allocate and format a string. * pango: add printf attribute This allows the compiler to catch mismatches between the format string and the arguments passed in. Need to add -Wno-format-zero-length because we pass an empty string on purpose in swaybar/render.c. * commands/floating_minmax_size: fix error strings cmd_results_new() does not take the command name as argument. * commands: add printf attribute to cmd_results_new() And fix the resulting build failures. * config: add printf attribute to config_add_swaynag_warning() * swaynag: add printf attribute to swaynag_log() * common/gesture: use format_str() We already had a similar function in there. * Use format_str() throughout * xdg_shell: Fix crash if popup generates while toplevel is in the scratchpad * render: pass rendering state together in a struct This lets us easily add rendering state that we need in the future * render: Don't pass matrix into render_texture * render: Use wlr_render_pass * Don't crash if there is no damage during render * Add support for touch cancel events * handle_touch_cancel: fix begin default I forgot to call seatop_begin_default in e8f7551. * swaybar: always subscribe to mode and workspace always subscribe to mode and workspace events, since we might need them after bar config updates even if we don't need them initially. * render: Apply clip to rendered texture correctly The new wlr_render_pass API provides src_box, dst_box and clip parameters for texture rendition. Rather than clipping the dst_box, which control the projection matrix and leads to compression, intersect the damage and clip box and pass these as a clip parameter. Fixes: swaywm#7579 Regressed by: swaywm#7552 * render: Clear using wlr_output dimensions Clear was done using sway_output's logical dimensions, instead of the wlr_output physical dimensions. This meant that when output scaling was applied, only a part of the screen would be cleared. Use the wlr_output dimensions instead. Regressed by: swaywm#7552 * render: fix titlebar texture clipping We need to provide an unclipped dst_box. Fixes: swaywm#7573 Regressed by: swaywm#7552 * seatop_down: Call seatop_begin_default after sending touch events This is consistent with pointer tablet and button events. Fixes swaywm#7577. * Fix layer old damage not being offset by the monitor layout coords * xwayland: don't rely on event source being data This pattern is being slowly removed from wlroots. * chore: chase wlroots map logic unification * lock: listen to the correct map signal * xwayland: fix mapped state check in OR handlers * chase wlroots wlr_renderer_begin_buffer_pass change https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4159 > ../sway/desktop/output.c:618:47: error: too few arguments to function 'wlr_renderer_begin_buffer_pass' > 618 | struct wlr_render_pass *render_pass = wlr_renderer_begin_buffer_pass( > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Add support for wlr-layer-shell ON_DEMAND keyboard interactivity This allows for layer shell surfaces to receive focus while the surface is explicitly focused, i.e allowing text fields to receive keyboard input just like a regular surface. * Handle gamma-control-v1 set_gamma events References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4046 * desktop/output: use detached output state for page-flips This avoids relying on the implicit wlr_output.pending state. * desktop/output: fix damage bitfield in wlr_output_state * man: add --inhibited and --no-repeat to bindsym and bindcode usage * Fix `bindsym --to-code` not respecting input configs Fixes swaywm#7535 * gamma_control_v1: Reset dirty flag * gamma_control_v1: handle destroyed output In case a display is unplugged, the sway output may be removed from the userdata before the gamma_control can be reset. In this case we can't schedule a commit on the output, simply return within the function. backtrace full: #0 handle_gamma_control_set_gamma (listener=0x4856a8 <server+616>, data=0x7ffce1ed59c0) at ../sway/desktop/output.c:1105 server = 0x485440 <server> event = 0x7ffce1ed59c0 output = 0x0 #1 0x00007f430d1dca0c in wl_signal_emit_mutable () from /nix/store/ky1g6ylzr2m4bq8fy0gzrnqmjr6948k5-wayland-1.22.0/lib/libwayland-server.so.0 No symbol table info available. #2 0x00007f430d142370 in gamma_control_destroy (gamma_control=0x29eb9b0) at ../types/wlr_gamma_control_v1.c:37 manager = 0x27e33e0 output = 0x2a10770 event = {output = 0x2a10770, control = 0x0} #3 0x00007f430d14239b in gamma_control_handle_output_destroy (listener=<optimized out>, data=<optimized out>) at ../types/wlr_gamma_control_v1.c:59 gamma_control = <optimized out> #4 0x00007f430d1dca0c in wl_signal_emit_mutable () from /nix/store/ky1g6ylzr2m4bq8fy0gzrnqmjr6948k5-wayland-1.22.0/lib/libwayland-server.so.0 No symbol table info available. #5 0x00007f430d12a0e0 in wlr_output_destroy (output=output@entry=0x2a10770) at ../types/output/output.c:384 cursor = <optimized out> tmp_cursor = <optimized out> layer = <optimized out> tmp_layer = <optimized out> #6 0x00007f430d114ecf in disconnect_drm_connector (conn=conn@entry=0x2a10770) at ../backend/drm/drm.c:1757 __PRETTY_FUNCTION__ = "disconnect_drm_connector" #7 0x00007f430d117078 in scan_drm_connectors (drm=drm@entry=0x1eebab0, event=event@entry=0x7ffce1ed5c1c) at ../backend/drm/drm.c:1597 c = <optimized out> wlr_conn = 0x2a10770 drm_conn = 0x2e760d0 conn_id = <optimized out> index = 4 i = 4 res = 0x2e761f0 seen_len = 5 seen = {true, true, true, true, true, false} new_outputs_len = 0 new_outputs = 0x7ffce1ed5ab0 conn = <optimized out> tmp_conn = <optimized out> index = <optimized out> #8 0x00007f430d113425 in handle_dev_change (listener=0x1eebbb0, data=0x7ffce1ed5c18) at ../backend/drm/backend.c:157 drm = 0x1eebab0 change = 0x7ffce1ed5c18 #9 0x00007f430d1dca0c in wl_signal_emit_mutable () from /nix/store/ky1g6ylzr2m4bq8fy0gzrnqmjr6948k5-wayland-1.22.0/lib/libwayland-server.so.0 No symbol table info available. #10 0x00007f430d111696 in handle_udev_event (fd=<optimized out>, mask=<optimized out>, data=<optimized out>) at ../backend/session/session.c:213 event = {type = WLR_DEVICE_HOTPLUG, {hotplug = {connector_id = 0, prop_id = 0}}} devnum = <optimized out> dev = 0x1ed9460 session = <optimized out> udev_dev = 0x2e70db0 sysname = 0x2e73c60 "card0" devnode = <optimized out> action = 0x7f430d6677b5 "change" seat = <optimized out> __PRETTY_FUNCTION__ = "handle_udev_event" #11 0x00007f430d1de8e2 in wl_event_loop_dispatch () from /nix/store/ky1g6ylzr2m4bq8fy0gzrnqmjr6948k5-wayland-1.22.0/lib/libwayland-server.so.0 No symbol table info available. #12 0x00007f430d1dc445 in wl_display_run () from /nix/store/ky1g6ylzr2m4bq8fy0gzrnqmjr6948k5-wayland-1.22.0/lib/libwayland-server.so.0 No symbol table info available. #13 0x000000000041daa5 in server_run (server=server@entry=0x485440 <server>) at ../sway/server.c:338 No locals. #14 0x000000000041cf4d in main (argc=<optimized out>, argv=0x7ffce1ed5fe8) at ../sway/main.c:415 verbose = false debug = false validate = false allow_unsupported_gpu = false config_path = 0x0 c = <optimized out> where event->output->data is NULL: (gdb) p event->output->data $5 = (void *) 0x0 * input/libinput: add scroll_button_lock method Closes swaywm#6987 Co-authored-by: JJGadgets <git@jjgadgets.tech> Co-authored-by: DeltaWhy <mike5713@gmail.com> * render: Use wlroots scale filter * Use wlr_cursor_set_xcursor() wlr_xcursor_manager_set_cursor_image() is deprecated. References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4170 * Use wlr_cursor_unset_image() A bit cleaner. References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4209 * idle-inhibit-v1: simplify with server global We only have a single running server, no need to keep track of multiple server instances. Also no need to support multiple idle inhibit managers. * swaybar: remove the argument of StatusNotifierHostRegistered According to https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierWatcher/ there is no argument for the StatusNotifierHostRegistered signal. * Use "default" XCursor instead of "left_ptr" "left_ptr" is the legacy XCursor name. "default" is the cursor spec name. * input: Move wlr_pointer_gestures_v1 to sway_input_manager On multi-seat configurations a zwp_pointer_gestures_v1 global was created for every seat. Instead, create the global once in the input manager, to be shared across all seats. * swaybar: don't set current workspace as not visible When `wrap_scroll yes` is configured and there's only one workspace open, swaybar will mark it as not visible if the user scrolls on it and eventually incorrectly fail the `active->visible` assert. Fix this by making sure that new and current workspace aren't the same. * swaybar: handle wayland-cursor failures Updating the cursor is not essential, so this change prints a warning when wl_cursor_theme_load or wl_cursor_theme_get_cursor fail instead of crashing or exiting. * Send wl_surface.preferred_buffer_scale References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3696 * Calculate tiled resize amount relative to parent container sway should shrinks/grows tiled windows according to parent container for ppt unit for i3 compatibility. Resolves: swaywm#7593 * chase wlroots 'presentation-time: add separate helper for zero-copy ' https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/67447d6cb407ac5b6405b4dbae01a38567feb111 * swaynag: handle wayland-cursor failures Same as 92244c8 ("swaybar: handle wayland-cursor failures") but for swaynag. Closes: swaywm#7671 * Deprecate seat idle_wake Sway has two knobs to control idling: - seat idle_inhibit: when the seat is active (ie. not idle), this extends the active state. When the seat is idle, this is ignored. - seat idle_wake: when the seat is idle, this wakes up the seat. When the seat is active, this is ignored. The motivation for the deprecation is two-fold: - The concept of "seat idle state" is ill-defined. Each idle-notify-v1 client will pass a different idle timeout. With the old logic, a seat was declared idle if and only if all idle-notify-v1 timeouts have expired. However, if only a portion of the timeouts have expired, then some clients would wake up, and the rest would stay active. This is inconsistent with the definition of idle_inhibit/idle_wake: idle_inhibit was used for clients which are waking up. - It never worked properly with the new idle-notify-v1 protocol and no-one noticed. Only the legacy KDE idle protocol is taken into account, but that protocol is not used anymore. * Add Georgian README I am a native Georgian speaker. I have translated sway's README.md * fix crash when resizing tiled scratchpad windows Splitting and then hiding a scratchpad container results in a segfault. fixes swaywm#6693 * Add support for cursor-shape-v1 References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4106 * swaybar: Implement wp_cursor_shape_v1 * swaynag: Implement wp_cursor_shape_v1 * desktop/output: drop logic to handle backend-applied mode The wlroots backends no longer magically apply output modes behind the compositor's back. * desktop/output: drop handle_mode() We already perform the exact same logic on transform/scale change. * desktop/output: fix output manager enabled state With recent wlroots changes, backends which don't support output modes can now support being disabled. We were always marking mode-less outputs as disabled. Stop doing that, check whether the output takes up some space in the layout instead. * output: drop current_mode This is now unused. * Rebase all cursors in handle_surface_map Fix swaylock showing transient cursor after locked. * Move contrib/ to separate repository User-contributed scripts are being moved over to this repository: https://github.com/OctopusET/sway-contrib * chase wlroots!4316 References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4316 * chore: chase wlroots xdg-surface role rework * Fix typo * Hide xwayland_shell_v1 from regular clients Regular clients are not allowed to use this interface. wlroots already sends a protocol error if a non-Xwayland client tries to use this interface, but let's remove all temptation by hiding it completely. * view: update wlr_toplevel size on client resizes If a floating client resizes itself, sway updates several of its internal dimensions to match but not wlr_toplevel. This means that the next time wlroots sends a toplevel configure event, it can have wrong coordinates that resize the client back to its old size. To fix this, let's just use wlr_xdg_toplevel_set_size so the wlr_toplevel has the same dimensions as sway. Fixes swaywm#5266. * Revert "view: update wlr_toplevel size on client resizes" This isn't the right fix for this issue because the xwayland code also uses this function and updating the wlr_toplevel there doesn't make sense and also causes problems. Fixes swaywm#7722. This reverts commit bf44690. * xdg_shell: update wlr_toplevel size on client resizes If a floating client resizes itself, sway updates several of its internal dimensions to match but not wlr_toplevel. This means that the next time wlroots sends a toplevel configure event, it can have wrong coordinates that resize the client back to its old size. To fix this, let's just use wlr_xdg_toplevel_set_size so the wlr_toplevel has the same dimensions as sway. Exactly the same as 0183b9d but the logic is onlly applied to xdg_shell and not xwayland. * Added support for 'set_from_resource' command * Made fallback value for set_from_resource optional * Replaced reference of 'resdb' with 'trawldb' * Renamed sway to sway-regolith * Add and adapt debian packaging from https://salsa.debian.org/swaywm-team/sway * Package rename in changelog * Remove applied patch * Add libtrawldb dependency --------- Signed-off-by: Elyes Haouas <ehaouas@noos.fr> Co-authored-by: Ankit Pandey <anpandey@protonmail.com> Co-authored-by: Erik Reider <35975961+ErikReider@users.noreply.github.com> Co-authored-by: Simon Ser <contact@emersion.fr> Co-authored-by: Ronan Pigott <ronan@rjp.ie> Co-authored-by: Alexander Orzechowski <orzechowski.alexander@gmail.com> Co-authored-by: Elyes Haouas <ehaouas@noos.fr> Co-authored-by: Alexander Orzechowski <alex@ozal.ski> Co-authored-by: hrdl <31923882+hrdl-github@users.noreply.github.com> Co-authored-by: Mukundan314 <30190448+Mukundan314@users.noreply.github.com> Co-authored-by: Kenny Levinsen <kl@kl.wtf> Co-authored-by: Kirill Primak <vyivel@eclair.cafe> Co-authored-by: Artturin <Artturin@artturin.com> Co-authored-by: Shaked Flur <fshaked@gmail.com> Co-authored-by: 33KK <marko@pepega.club> Co-authored-by: Rouven Czerwinski <rouven@czerwinskis.de> Co-authored-by: Cezary Drożak <cezary@drozak.net> Co-authored-by: JJGadgets <git@jjgadgets.tech> Co-authored-by: DeltaWhy <mike5713@gmail.com> Co-authored-by: Hodong <111117126+hodong-kim@users.noreply.github.com> Co-authored-by: Mark Bolhuis <mark@bolhuis.dev> Co-authored-by: llyyr <llyyr.public@gmail.com> Co-authored-by: Manuel Stoeckl <code@mstoeckl.com> Co-authored-by: nukoseer <uygarkoseer@gmail.com> Co-authored-by: Nick Kipshidze <96648005+NickKipshidze@users.noreply.github.com> Co-authored-by: bretello <bretello@distruzione.org> Co-authored-by: ookami <mail@ookami.one> Co-authored-by: Leonardo Hernández Hernández <leohdz172@proton.me> Co-authored-by: luzpaz <luzpaz@users.noreply.github.com> Co-authored-by: Dudemanguy <random342@airmail.cc> Co-authored-by: Soumya Ranjan Patnaik <soumyaranjan1812@gmail.com> Co-authored-by: Regolith Linux <regolith.linux@gmail.com>
Ref: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3631