Commit Graph

3817 Commits

Author SHA1 Message Date
Simon Ser e516ea4c79 backend/drm: check format when scanning out DMA-BUF 2019-06-07 09:06:11 -04:00
emersion 96d6fde5dc backend/drm: add basic support for direct scan-out 2019-06-07 09:06:11 -04:00
Simon Ser 3dec88e455 Remove orbital screenshooter and gamma-control
These are undocumented, outdated protocols that have a better wlr-protocols
equivalent.
2019-06-02 09:30:47 -04:00
Scott Anderson abddd7b4db
Merge pull request #1713 from Emantor/fix/legacy_null_modeset
drm: legacy: issue a NULL modeset on disable
2019-06-02 08:28:47 +00:00
Rouven Czerwinski 96e9c0f9c8 drm: legacy: issue a NULL modeset on disable
The DRM subsystem needs a NULL modeset for connectors which disappear
from the system to disable the hardware pipes, otherwise the pixels get
rendered but are sent nowhere.

The atomic backend does the equivalent by removing the properties and
issuing a commit.

Fixes #1706
2019-06-02 09:50:40 +02:00
Brian Ashworth 6dfe238ff1 zwp_virtual-keyboard: fix mmap error handling
If mmap fails, it will return MAP_FAILED not NULL. Since the error
handling was incorrectly checking for NULL, MAP_FAILED was being passed
to xkb_keymap_new_from_string, on mmap failure, causing a segfault.
This just fixes the error checking.
2019-05-31 07:58:31 +03:00
Rouven Czerwinski a5e32f652b wlr_output: remove idle_done on output destroy
If an output is destroyed while an idle_done event is scheduled, it
results in the following Address Sanitizer Output:

==1469==ERROR: AddressSanitizer: heap-use-after-free on address 0x6170000bb668 at pc 0x7f49aaa0c348 bp 0x7ffed5da35b0 sp 0x7ffed5da35a0
WRITE of size 8 at 0x6170000bb668 thread T0
    #0 0x7f49aaa0c347 in schedule_done_handle_idle_timer ../subprojects/wlroots/types/wlr_output.c:265
    #1 0x7f49aa2f875b in wl_event_loop_dispatch_idle (/usr/lib/libwayland-server.so.0+0xa75b)
    #2 0x7f49aa2f8815 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xa815)
    #3 0x7f49aa2f739b in wl_display_run (/usr/lib/libwayland-server.so.0+0x939b)
    #4 0x556622dadd51 in server_run ../sway/server.c:216
    #5 0x556622dac25d in main ../sway/main.c:397
    #6 0x7f49aa0d0ce2 in __libc_start_main (/usr/lib/libc.so.6+0x23ce2)
    #7 0x556622d8d09d in _start (/usr/local/bin/sway+0x3909d)

0x6170000bb668 is located 488 bytes inside of 672-byte region [0x6170000bb480,0x6170000bb720)
freed by thread T0 here:
    #0 0x7f49aabc8f89 in __interceptor_free /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:66
    #1 0x7f49aa968fc2 in drm_connector_destroy ../subprojects/wlroots/backend/drm/drm.c:829
    #2 0x7f49aaa0cc52 in wlr_output_destroy ../subprojects/wlroots/types/wlr_output.c:357
    #3 0x7f49aa96d2e9 in scan_drm_connectors ../subprojects/wlroots/backend/drm/drm.c:1265
    #4 0x7f49aa961a59 in drm_invalidated ../subprojects/wlroots/backend/drm/backend.c:135
    #5 0x7f49aaa2e1e9 in wlr_signal_emit_safe ../subprojects/wlroots/util/signal.c:29
    #6 0x7f49aa98319f in udev_event ../subprojects/wlroots/backend/session/session.c:52
    #7 0x7f49aa2f87f1 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xa7f1)

previously allocated by thread T0 here:
    #0 0x7f49aabc95a1 in __interceptor_calloc /build/gcc/src/gcc/libsanitizer/asan/asan_malloc_linux.cc:95
    #1 0x7f49aa96b7a2 in scan_drm_connectors ../subprojects/wlroots/backend/drm/drm.c:1114
    #2 0x7f49aa961a59 in drm_invalidated ../subprojects/wlroots/backend/drm/backend.c:135
    #3 0x7f49aaa2e1e9 in wlr_signal_emit_safe ../subprojects/wlroots/util/signal.c:29
    #4 0x7f49aa98319f in udev_event ../subprojects/wlroots/backend/session/session.c:52
    #5 0x7f49aa2f87f1 in wl_event_loop_dispatch (/usr/lib/libwayland-server.so.0+0xa7f1)

SUMMARY: AddressSanitizer: heap-use-after-free ../subprojects/wlroots/types/wlr_output.c:265 in schedule_done_handle_idle_timer
Shadow bytes around the buggy address:
  0x0c2e8000f670: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e8000f680: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e8000f690: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e8000f6a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e8000f6b0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
=>0x0c2e8000f6c0: fd fd fd fd fd fd fd fd fd fd fd fd fd[fd]fd fd
  0x0c2e8000f6d0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c2e8000f6e0: fd fd fd fd fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e8000f6f0: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e8000f700: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c2e8000f710: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb

Remove the idle_done idle timer when the output is destroyed
2019-05-30 09:14:46 +03:00
Scott Anderson 0ab1bb623e
Merge pull request #1705 from rindeal/patch-2
session/logind: check for XDG_SESSION_ID first
2019-05-22 23:42:46 +00:00
Jan Chren 151b7d1d94 session/logind: check for XDG_SESSION_ID first
In order to support compositors running as systemd user units without display manager,
a mechanism for specifying session ID exactly must exist.

Checking for `XDG_SESSION_ID` mimics loginctl behaviour e95be7def2/src/login/loginctl.c (L856).
2019-05-22 15:43:07 +02:00
Scott Anderson aa39dbd1e7
Merge pull request #1704 from rindeal/patch-2
session/logind: specify seat exactly
2019-05-22 12:50:47 +00:00
Jan Chren e04e1ba197
session/logind: specify seat exactly
"/org/freedesktop/login1/seat/self" path triggers seat-finding code path in logind,
which currently relies on getting the session based on caller's PID.
This behaviour is deprecated in logind as it doesn't work eg. with systemd user units,
which run outside of user session.

We check for "seat0" in logind_change_vt() already as introduced in 47985d2dc5,
so hard-coding it here is not a problem, otherwise sd_session_get_seat() could be used.
2019-05-22 14:43:13 +02:00
Silvan Jegen 461c4f58a6 rootston: remove duplicated include 2019-05-19 19:50:14 +03:00
Scott Anderson 522ddd93f1
Merge pull request #1696 from RedSoxFan/logind-stay-active-on-gone
session/logind: keep active for pause_device gone
2019-05-15 04:34:08 +00:00
Michiel a68c7c0c8d Fixes #1689 RDP RemoteFX crash
When using the rdp backend and connecting with xfreerdp ... --rfx, wlroots
crashes in backend/rdp/output.c while attempting to realloc(..., 0).

This commit guards against that and instead returns true, resulting in
no rfx message being sent. This prevents the crash and appears to work, but
it's not obvious if this is correct from a specification perspective.
2019-05-13 23:30:38 +03:00
Ilia Bozhinov 03346cb28f output: clear output->damage on successful commit 2019-05-13 18:45:22 +03:00
Brian Ashworth 90c284bded session/logind: keep active for pause_device gone
This appears to be a quick fix for compositors freezing when a dock is
disconnected. Disconnection of the dock is causing `pause_device` for
the DRM devices associated with the dock. Since these devices major
number is `DRM_MAJOR`, the session was being set to inactive. This just
makes it so the session is not set to inactive when the device's state
is `gone`.
2019-05-13 10:43:35 -04:00
Simon Ser 107a1789ea render/gles2: print GL_RENDERER
This is often the name of the GPU and can help debugging graphics issues.
2019-05-07 10:51:52 -06:00
Simon Ser 947d5ff481 backend/wayland: remove wl_shm
We bind to it but never use it.
2019-05-06 20:51:57 +03:00
Simon Ser 292d20e4c1 backend/wayland: use xdg-decoration-unstable-v1
This allows the toplevel to have proper decorations on compositors that support
xdg-decoration-unstable-v1.
2019-05-06 10:34:41 -06:00
Jan Beich 6ae6b5dbb6 Test RDP backend on FreeBSD as well 2019-05-03 20:00:45 +03:00
Drew DeVault c0305f4f86 Update version to 0.6.0 2019-05-03 11:55:46 -04:00
Simon Ser cf3b083c32 ci: enable Meson auto features
This makes it so we don't miss build failures because the CI misses a
dependency.
2019-04-29 10:49:05 -06:00
Simon Ser 937e0e7937 backend/noop: disallow rendering
Closes: https://github.com/swaywm/wlroots/issues/1662
2019-04-29 10:48:51 -06:00
Jan Beich 27a87ac586 Switch to system epoll-shim.pc in FreeBSD build 2019-04-29 18:51:47 +03:00
Ilia Bozhinov 22dd7d3731 examples: add fullscreening to foreign-toplevel.c 2019-04-29 00:00:53 +03:00
Ilia Bozhinov 8cc0859814 rootston: add support for foreign-toplevel fullscreening 2019-04-29 00:00:53 +03:00
Ilia Bozhinov 4e6c17a7c9 foreign-toplevel: support fullscreen state and request 2019-04-29 00:00:53 +03:00
Simon Ser a656e486f4 seat: fallback to v6 if libwayland 1.17 isn't available
See https://github.com/swaywm/wlroots/pull/1675#issuecomment-487300445
2019-04-27 11:26:34 -06:00
Simon Ser d7ef3a1f38 xdg-output: schedule a wl_output.done event on update
Xwayland expects an xdg_output.done event to always be sent with a
wl_output.done event.
2019-04-27 10:02:21 -06:00
Simon Ser bde5a1f4ea output: introduce wlr_output_schedule_done
This commit introduces wlr_output_schedule_done and refactors the mechanism
used to send wl_output events to clients.

wlr_output_schedule_done schedules a wl_output.done event. This allows clients
to see wlr_output property changes as atomic.

This function is also useful for add-on interfaces like xdg_output which need
to trigger a wl_output.done event to apply their new state.
2019-04-27 10:02:21 -06:00
Simon Ser 8b1220f5a3 rootston: fix damage tracking debug mode
We want to damage the whole output in this mode. However if we overwrite the
damaged region after it's useless.

Fixes: 57d32d03a8
2019-04-27 09:59:01 -06:00
Simon Ser 1dbece74fb output: disambiguate the two types of damage
See https://github.com/swaywm/wlroots/issues/1665
2019-04-26 10:08:08 -06:00
Simon Ser 57d32d03a8 rootston: don't submit too much damage
We only need to damage the parts of the screen that changed since last frame,
we don't need to accumulate damage from previous buffers.

We still need to re-render the accumulated damage.

Fixes https://github.com/swaywm/wlroots/issues/1665
2019-04-26 10:08:08 -06:00
Simon Ser d6e250b389 render/egl: fix swapping with no damage
According to the spec:

> If <n_rects> is 0 then <rects> is ignored and the entire
> surface is implicitly damaged and the behaviour is equivalent
> to calling eglSwapBuffers.

When we want to swap with an empty damage region, set the damage to a single
empty rectangle.
2019-04-26 10:08:08 -06:00
Drew DeVault 736632ad4e Remove wlr_wl_shell 2019-04-26 18:23:25 +03:00
Scott Anderson a671fc51d2 Advertise wl_seat version 7
This does not require any code changes, as we already copy the keymap
data separately for each client.

For details, see 905c0a341d
2019-04-26 07:57:37 -06:00
Simon Ser 8d3369d70f output-damage: fix segfault after destroy
Fixes: 5e6766a165
2019-04-25 11:39:51 +03:00
Simon Ser 933208837d backend/wayland: fix wlr_wl_pointer use-after-free 2019-04-23 14:36:12 -06:00
Simon Ser f42816ce3f render/egl: fix zero-length VLA 2019-04-23 14:36:02 -06:00
Simon Ser 20690346c7 output: rename needs_commit to needs_frame
This new name makes more sense, since it is a request from the backend to get
a new frame. In the future a commit may not convey a new frame.
2019-04-23 14:34:30 -06:00
Simon Ser 5e6766a165 output-damage: refactor API
wlr_output_damage_make_current has been renamed to
wlr_output_damage_attach_render, since it's just a wrapper for
wlr_output_attach_render.

wlr_output_damage_swap_buffers has been removed completely. Instead,
wlr_output_damage now listens to successful wlr_output commits and updates its
internal state accordingly.
2019-04-23 14:34:30 -06:00
Simon Ser 31dcecbfa9 output: rename swap_buffers event to precommit
Also remove damage from the event data since it's no longer tied to commits.
2019-04-23 14:34:30 -06:00
Simon Ser 9a0f8a194c output: refactor backend API
This updates the backend part of the output API. This is mostly renaming:
make_current becomes attach_render and swap_buffers becomes commit.

This also fixes the RDP backend to support NULL damage.
2019-04-23 14:34:30 -06:00
Simon Ser 23e37e7b1d output: refactor frame submission API
This is necessary for direct scan-out and other upcoming features. This patch
changes the output API to look like the wl_surface API.

Outputs now have some double-buffered state: the frame to be submitted
(currently only wlr_renderer frames are supported) and the damaged region.
To attach a pending frame, use wlr_output_attach_render. To set the pending
damaged region, use wlr_output_set_damage.

To submit the pending state, call wlr_output_commit. This will submit the
pending frame to the backend.

To migrate from the old API to the new one:

- Replace wlr_output_make_current calls by wlr_output_attach_render
- Replace wlr_output_swap_buffers calls by wlr_output_set_damage and
  wlr_output_commit
2019-04-23 14:34:30 -06:00
Simon Ser 56ceed38bf rootston: use wlr_output_preferred_mode
Also fix rootston setting the preferred mode when another mode is specified in
the config file.
2019-04-22 11:15:38 -06:00
Simon Ser 8acbf449cc output: introduce wlr_output_preferred_mode 2019-04-22 11:15:38 -06:00
Alyssa Ross 95b22619e0 Fix missing headers when building without X11
The deleted includes are redundant, because other headers will include
the necessary files. Additionally, they cause build failures, because
including EGL/egl.h or EGL/eglext.h directly, instead of through
wlr/render/egl.h or wlr/render/interface.h, will mean that
MESA_EGL_NO_X11_HEADERS will not have been defined, and so the EGL
headers will attempt to pull in unnecessary X11 headers that may not
exist on the system.

For the headers produced by glgen.sh, the includes couldn't simply be
deleted, because no other header would include the EGL headers. Neither
wlr/render/egl.h or wlr/render/interface.h felt appropriate to include,
so I opted instead to copy the MESA_EGL_NO_X11_HEADERS definition before
the EGL includes.
2019-04-22 00:04:08 +03:00
Simon Ser 4207f05030 data-device: ignore accept for selection offers
It doesn't make sense for clients to send "accept" requests to offers that
aren't drag-and-drop. I discussed with Daniel Stone to make it a protocol
error [1] but too many clients send it (e.g. GTK+). Let's just log it for now.

[1]: https://gitlab.freedesktop.org/wayland/wayland/merge_requests/11#note_149710
2019-04-19 13:24:41 -06:00
Ilia Bozhinov d6615e0e84 idle: enable the compositors to add custom idle timeouts (#1655)
* idle: enable the compositors to add custom idle timeouts

* idle: add a private constructor which also creates the resource

* idle: move resource creation to the idle implementation callback
2019-04-17 08:48:43 +03:00
Ilia Bozhinov dc5d1d08ef output: do nothing in output_set_image if backend has no renderer
This is useful when using the noop backend for example.
2019-04-14 19:35:23 +03:00