Commit Graph

972 Commits

Author SHA1 Message Date
Simon Ser 63df2bcbe6 backend/session: don't return FD on failure in open_file
When wlr_session_open_file fails, don't return the FD, otherwise the
caller will think the call succeeded.
2020-11-19 22:47:49 +01:00
Kenny Levinsen fb3bea8014 backend/drm: Use legacy gamma size for legacy backend
We would always return the GAMMA_LUT_SIZE property if available, and
only fall back to legacy gamma size otherwise. This leads to issues if
both are available in differs in size while we use the legacy backend.

Ensure that we only return the legacy size if we're using the legacy
backend.

Closes: https://github.com/swaywm/wlroots/issues/2429
2020-11-19 22:46:25 +01:00
Simon Ser 02df7b7ac8 backend/headless: implement export_dmabuf 2020-11-15 22:54:07 +01:00
Simon Ser 61f8cdfb9e backend/headless: switch to wlr_swapchain 2020-11-15 22:54:07 +01:00
Simon Ser eef8b3dde8 backend/drm: check drm_surface_render_black_frame return value
This avoids hitting an assertion in drm_fb_lock_surface when
we failed to render a black frame.
2020-11-15 22:48:42 +01:00
Simon Ser c881008e1c backend/drm: add support for wlr_swapchain multi-GPU 2020-11-15 22:48:42 +01:00
Simon Ser 8058e338ea backend/drm: get rid of wlr_drm_fb_type
Since all DRM FBs are backed by a wlr_buffer, there's no need for this
anymore.
2020-11-15 22:48:42 +01:00
Simon Ser 68a8d99055 backend/drm: add support for wlr_swapchain buffer age 2020-11-15 22:48:42 +01:00
Simon Ser ef846a8839 backend/drm: use wlr_swapchain 2020-11-15 22:48:42 +01:00
Simon Ser aaa3fcf66f
backend/libinput: require libinput 1.14
We have the policy of requiring up-to-date dependencies instead of
adding conditionals for older versions. libinput 1.14 was published more
than 1 year ago.
2020-11-15 18:57:16 +01:00
Mykola Orliuk 2eae9ec7c8 backend/wayland: Set cursor indivdualy per output 2020-11-12 12:31:32 +01:00
Mykola Orliuk 44531e16e0 backend/wayland: Add active pointer per host seat
Every host seat with pointer capability propagates events to one of
sub-pointer depending which output window we entered.
active_pointer tracks reference to sub-pointer on enter/leave events to
avoid lookup for it on every move events.

Fixes swaywm/wlroots#1499
2020-11-12 12:31:32 +01:00
Mykola Orliuk ce8855ca2a backend/wayland: Bind pointer listener to seat 2020-11-12 12:31:32 +01:00
Mykola Orliuk 07e2e0f60c backend/wayland: Listen to pointers from all seats
This effectively gets swaywm/wlroots#1499 to the point where
functionality somewhat preserved and no crash happens.
We still can have only one cursor, but we can control it from multiple
seats in time-sharing manner by entering/leaving output.
2020-11-12 12:31:32 +01:00
Mykola Orliuk 44c4773d58 backend/wayland: Use seat name in input names 2020-11-12 12:31:32 +01:00
Mykola Orliuk 70ffda3ea3 backend/wayland: Add registering multiple seats 2020-11-12 12:31:32 +01:00
Mykola Orliuk 85b0872650 backend/wayland: Link input devices with seats 2020-11-12 12:31:32 +01:00
Mykola Orliuk 40bfd9f8f7 backend/wayland: Bind seat listener to wlr_wl_seat 2020-11-12 12:31:32 +01:00
Isaac Freund e06c9e43af Remove unneeded includes from wlr_input_device.h
This uncovered many places where we were using things without directly
including them.
2020-11-11 15:40:47 +01:00
Isaac Freund 7693f61d81 Replace wlr_key_state with wl_keyboard_key_state
There's no reason to have duplicate enums
2020-11-11 10:58:38 +01:00
Simon Ser 1328477a82 backend/drm: export pending FB in export_dmabuf, if any
This allows callers to grab the current frame right after committing it,
without having to incur a full vblank worth of latency.
2020-11-05 09:43:42 +01:00
Simon Ser ee43ef3c9d backend/drm: fix "a page-flip is already pending" errors on modeset
When performing a modeset, the DRM backend will request a page-flip
event. However frame_pending wasn't set to true, so any subsequent
wlr_output_schedule_frame calls would imemdiately trigger a synthetic
frame event, asking the compositor to submit a new frame. Committing the
new frame fails with "a page-flip is already pending" error in the DRM
backend.
2020-11-03 08:09:54 +01:00
Marten Ringwelski 85757665e6 backend/drm: Check if output is enabled before sending frame event
When an output is disabled one last pageflip will happen to disable it.
Currently this pageflip causes a frame event.
Since the output is disabled we don't want to send this frame event.
2020-10-30 10:04:54 +01:00
Mykola Orliuk 31aa7f4c95 backend/wayland: fix some keyboard/touch leaks 2020-10-18 21:25:25 +02:00
Mykola Orliuk 009cd634a2 backend/wayland: fix input creation error handling 2020-10-18 21:25:25 +02:00
Mykola Orliuk 41bf1c6871 backend/wayland: add error flow in create_wl_seat 2020-10-18 21:25:25 +02:00
Mykola Orliuk 1ac5257357 backend/wayland: factor out wlr_wl_seat 2020-10-18 16:28:12 +02:00
Mykola Orliuk df417b7e95 backend/wayland: manage cursor for current pointer 2020-10-18 16:28:12 +02:00
Ilia Bozhinov b98522b38f
backend/wayland: add touch support to the wayland backend
Goal currently is to get support working for a single output, thus there is only one touch device created.

Multi-output support is left for later.
2020-10-18 15:33:03 +02:00
Simon Ser 45c1a3621c backend/libinput: improve logger callback
- Add a prefix to make it clear log messages come from libinput
- Properly convert libinput log priority to wlroots'
2020-10-10 10:51:32 -04:00
Simon Ser 87836dcb55 backend: remove check for _WAYLAND_DISPLAY
I'm not sure what this was used for, but it's not used by libwayland.
Setting _WAYLAND_DISPLAY would result in the Wayland backend being
picked but would ignore the actual value of the env variable.
2020-09-16 15:53:14 -04:00
nerdopolis e44bed0c2b Accommodate for CONFIG_VT=0, all TTYs are in seat0, but not all
seat0s have TTYs
2020-09-04 11:46:54 +02:00
Patrick Steinhardt fa05d3cde6 session: Don't refuse unprivileged creation of "direct" backend
When starting a compositor that's using the "direct" session backend,
wlroots needs to handle calls to `drmSetMaster()` and `drmDropMaster()`.
As both calls used to require `CAP_SYS_ADMIN`, wlroots thus simply
refused starting in case the process doesn't enjoy evelated privileges.

Permission rules have changed since linux.git commit 45bc3d26c95a (drm:
rework SET_MASTER and DROP_MASTER perm handling, 2020-03-19). As a
result, starting with Linux v5.8, both ioctls will now also succeed if
the process is currently or has been the DRM master. And as the first
process to open render nodes will become the DRM master automatically,
this effectively means that process elevation is not strictly required
in all setups anymore.

So let's drop the `geteuid() != 0` permission check to allow those new
rules to do their magic.
2020-09-04 11:39:25 +02:00
Ilia Bozhinov efe6414640 wayland: emit relative pointer events only for current pointer 2020-09-04 10:13:35 +02:00
Ryan Walklin 28cedb5623 Quieten failure to set login session type
(almost certainly due to systemd version <246)
2020-09-02 11:35:32 +02:00
Simon Ser 971de474f0 backend/session/libseat: register log handler
Route libseat errors through wlroots logging infrastructure.

This requires libseat 0.2.0.
2020-09-01 12:09:25 +02:00
Kenny Levinsen 330c50b48d session: Add missing init to direct-freebsd
bad1e9afa8 ("session: Add libseat backend") introduced a change to to
how session backends initialize, but failed to update the FreeBSD
specific version of the direct backend accordingly.

Closes: https://github.com/swaywm/wlroots/issues/2376
2020-08-26 22:56:54 +02:00
Simon Ser 297354f847 Remove unnecessary wl_display_dispatch calls
wl_display_roundtrip already takes care of dispatching the display.
2020-08-24 07:55:35 -06:00
Kenny Levinsen bad1e9afa8 session: Add libseat backend 2020-08-24 11:13:55 +02:00
Ilia Bozhinov 9feeb2738d
backend/wayland: destroy relative pointer when output is disconnected
Fixes #2243
Fixes #2106
2020-08-17 11:33:57 +02:00
Ryan Walklin 7e990a2991 Don't set XDG_SESSION_TYPE unless logind SetType succeeds 2020-08-07 19:15:25 +02:00
Ryan Walklin e81d2086c0 Also set XDG_SESSION_TYPE 2020-08-07 19:15:25 +02:00
Ryan Walklin f0d03fb892 Implement logind session SetType method to change session type to wayland 2020-08-07 19:15:25 +02:00
Devin J. Pohly aaf490d794 drm: fix uninitialized read
get_drm_prop_blob does not set path_len if it returns NULL.  Check the
return value before path_len to avoid reading uninitialized memory.

(Granted, this doesn't change the logic at all, but it does make
Valgrind a bit happier.)
2020-07-31 09:32:14 +02:00
Antonin Décimo d9bb792794 Fix incorrect format parameters 2020-07-27 10:49:19 +02:00
Simon Ser b6377b59ff backend/drm: check drm_surface_make_current return value
drm_connector_set_cursor wasn't checking the return value of the
drm_surface_make_current call. On failure, this results in a failed
assertion in wlr_renderer_begin (because no rendering context is
current).
2020-07-07 11:18:07 -06:00
Simon Ser cccca368c5
backend/drm: fix typo in drm_surface_make_current arg 2020-07-07 17:36:51 +02:00
Simon Ser f82a27f55a backend/drm: fix DPMS on legacy interface
This mirrors what the atomic code does in create_mode_blob.

Closes: https://github.com/swaywm/wlroots/issues/2312
2020-07-02 09:39:41 -06:00
Simon Ser c930160286 backend/noop: add missing rollback_render output impl
3c5dbfd97c ("output: make rollback_render mandatory") makes a no-op
output init fail without this function.
2020-06-19 13:07:24 -06:00
Simon Ser bf93d2e67c output: rename impl->rollback to rollback_render
The output backend API is now mostly state-less thanks to the atomic
hooks (commit and test). There is one exception though: attach_render.
This function makes the rendering context current. However sometimes the
compositor might decide not to render after attach_render (e.g. when
there's nothing new to render to the back buffer). Thus
wlr_output_rollback has been introduced to revert the pending state.

Because the output backend API is mostly state-less, the only thing
wlr_output_impl.rollback needs to do is revert the current rendering
context. Rename the function to rollback_render to make this clear. Add
a check in the common wlr_output code to only call rollback_render when
attach_buffer has been previously called.

On the long term, we'll be able to remove attach_render and
rollback_render together.
2020-06-19 11:50:42 -06:00