Commit graph

151 commits

Author SHA1 Message Date
Simon Ser
098094c5cb backend/wayland: use the EGL GBM platform
Just like other backends, use the EGL GBM platform. This will make it
easier to move the allocator and renderer initialization out of the
backends.
2021-01-10 11:32:00 +01:00
Simon Zeni
9192c0480a remove unnecessary egl includes 2021-01-07 17:11:22 +01:00
Simon Zeni
b899a412e3 backend: remove wlr_egl from all backends 2021-01-07 17:11:22 +01:00
Simon Ser
07d75c99db render: remove EGL config and visual from wlr_renderer_autocreate
This isn't used anymore by any backend.

Some examples still provide an EGL config to wlr_egl_init, so we can't
drop it yet there.
2021-01-06 12:05:51 +01:00
Simon Ser
3721dbfddb
backend/wayland: remove unnecessary flags from event source
wl_event_loop_add_fd only accepts READABLE and WRITABLE. ERROR and
HANGUP are always implicitly enabled.
2021-01-05 19:54:20 +01:00
Simon Ser
4b03bdc3ab Remove wlr_create_renderer_func_t
This callback allowed compositors to customize the EGL config used by
the renderer. However with renderer v6 EGL configs aren't used anymore.
Instead, buffers are allocated via GBM and GL FBOs are rendered to. So
customizing the EGL config is a no-op.
2020-12-30 17:09:40 +01:00
Simon Ser
defcd9b025 backend/wayland: re-use wl_buffers
Instead of re-importing a buffer each time we submit a new frame, re-use
the wl_buffer objects if possible.
2020-12-21 16:30:47 +01:00
Simon Ser
de896caceb backend/wayland: remove EGL config
We don't use EGLSurface anymore, so we don't need to choose an EGL
config anymore.
2020-12-19 21:11:01 +01:00
Simon Ser
87bd718de5
backend: use fcntl(F_DUPFD_CLOEXEC) instead of dup
This makes sure the CLOEXEC flag is set on the dup'ed FD.
2020-12-15 20:52:53 +01:00
Simon Ser
16a51bbab2 backend/wayland: query render formats 2020-12-13 12:16:28 +01:00
Simon Ser
3923ff005d backend/wayland: use wlr_swapchain for main surface
The cursor surface still uses a wl_egl_window.

References: https://github.com/swaywm/wlroots/issues/1352
2020-12-13 12:16:28 +01:00
Simon Ser
6485fadc16
backend/wayland: don't set EGL visual
The Wayland platform doesn't have visuals. By chance,
WL_SHM_FORMAT_ARGB8888 is zero, which means egl_get_config was ignoring
it and everything worked fine.
2020-11-25 13:52:05 +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
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
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
Antonin Décimo
d9bb792794 Fix incorrect format parameters 2020-07-27 10:49:19 +02:00
Simon Ser
9acca4fc73 backend: set EGL_RENDERABLE_TYPE and EGL_SURFACE_TYPE
Ensure these are set to the correct value.
2020-04-09 00:15:25 +00:00
Simon Ser
802ef9da8a backend/wayland: handle display errors more gracefully
Previously, an error on the remote Wayland display would result in an
infinite loop priting:

    2020-01-09 13:39:03 - [wayland] Source dispatch function returned negative value!
    2020-01-09 13:39:03 - [wayland] This would previously accidentally suppress a follow-up dispatch

This happens when the remote compositor disconnects the client because
of a protocol error, for instance.

Handle wl_display_dispatch and wl_display_dispatch_pending returning -1
by terminating the local display and printing an error.
2020-01-09 07:48:30 -07:00
Simon Ser
e959b882d5 backend/wayland: add support for presentation-time 2019-11-21 11:32:30 -05:00
Simon Ser
cde544de81 backend/wayland: expose remote objects
Expose the remote wl_display, wl_surface and wl_seat used by the Wayland
backend.

This allows compositors to customize the Wayland backend and to have
more freedom. For instance a compositor might want to handle clipboard
and drag-and-drop from the remote Wayland compositor. Another compositor
might want to setup pointer constraints.
2019-11-13 10:15:28 -05:00
Simon Ser
1e568d84df backend/wayland: add support for relative-pointer-unstable-v1
We just send relative motion events alongside absolute motion events.
Compositors can figure out how absolute and relative events are related
(e.g. whether they have been triggered by the same logical event) with
the frame event.
2019-11-13 10:15:19 -05:00
Simon Ser
5bddb5a909 backend/wayland: add support for direct scan-out
Closes: https://github.com/swaywm/wlroots/issues/1830
2019-10-16 09:40:26 -04:00
Markus Ongyerth
ebeef0fbe8 Clean up wayland backend tablet support
Mostly address feedback from emersion on PR #1694
Remove const qualifier from char *name, to allow free() call
2019-09-26 19:41:19 +03:00
Markus Ongyerth
2285e36b0c Add zwp-tablet-unstable-v2 client support
This allows wlroots based compositors to properly use graphic tablets
with the wayland backend.
This should be a decent quality of life improvement when working on
tablet related features.
2019-09-26 19:41:19 +03:00
Simon Ser
ca45f4490c Remove all wayland-server.h includes
The documentation for wayland-server.h says:

> Use of this header file is discouraged. Prefer including
> wayland-server-core.h instead, which does not include the server protocol
> header and as such only defines the library PI, excluding the deprecated API
> below.

Replacing wayland-server.h with wayland-server-core.h allows us to drop the
WL_HIDE_DEPRECATED declaration.
2019-07-27 15:49:32 -04:00
Greg V
d80acadfd8 Support pointer-gestures on Wayland backend 2019-06-21 14:43:28 -04: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
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
emersion
5de26ad8ed
pointer: add a frame event
Frame events group logically connected pointer events. It makes sense to make
the backend responsible for sending frame events, since once the events are
split (ie. once the frame events are stripped) it's not easy to figure out
which events belongs to which frame again.

This is also how Weston handles frame events.

Fixes https://github.com/swaywm/wlroots/issues/1468
2019-01-26 11:04:05 +01:00
Drew DeVault
97af2464b7 Update Wayland backend to xdg-shell stable 2019-01-10 09:17:14 -05:00
emersion
180151ed09
backend/wayland: handle WL_EVENT_WRITABLE for Wayland socket
We need to flush when the connection is writable again. This is important in
case the write buffer becomes full. This is also what Weston does [1].

[1]: https://gitlab.freedesktop.org/wayland/weston/blob/master/libweston/compositor-wayland.c#L2593
2018-11-11 21:14:15 +01:00
Scott Anderson
aaff4b8c00 backend/wayland: Make header order consistent 2018-11-11 22:29:35 +13:00
Scott Anderson
bbce92a923 backend/wayland: Move initilisation code earlier
The renderer redesign is going to need the render fd before the backend
is fully started, so we have to move the wl registry code to when the
backend is created instead of when it is started.

We also need to stash the wl_keyboard and emit it to library users
later, once they've added their listeners and started the backend.
2018-11-11 18:11:56 +13:00
Scott Anderson
47545cf550 backend/wayland: Use specific wl_global versions
Explicitly use the version we support instead of accepting the
compositor's version.
2018-11-11 18:11:56 +13:00
Scott Anderson
4e03802057 backend/wayland: Move registry into backend
Registry was a very small file, and is heavily related to the backend,
so there is not point in keeping them separate.
2018-11-11 18:11:56 +13:00
emersion
e98cb7c5ab backend/wayland: add assertions 2018-09-18 11:06:01 +02:00
emersion
7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
Ilia Bozhinov
24cf70ae96 backends: implement custom EGL and renderer initialization
Compositors now have more control over how the backend creates its
renderer. Currently all backends create an EGL/GLES2 renderer, so
the necessary attributes for creating the context are passed to a
user-provided callback function. It is responsible for initializing
provided wlr_egl and to return a renderer. On fail, return 0.

Fixes #987
2018-05-25 14:56:52 +03:00
emersion
9e3dd6b560
backend/wayland: fix segfault when destroying backend before starting it 2018-05-19 09:34:16 +01:00
emersion
225d182765
output: always use hardware cursors if available
This changes the `wlr_output_impl.set_cursor` function to take a
`wlr_texture` instead of a byte buffer. This simplifies the
DRM and Wayland backends since they were creating textures from
the byte buffer anyway.

With this commit, performance should be improved when moving the
cursor since outputs don't need to be re-rendered anymore.
2018-05-01 21:38:04 +01:00
emersion
9f8a7c8fc4
backend/wayland: create one virtual pointer per output 2018-04-29 14:30:13 +01:00
emersion
57c36ddcb3
backend/wayland: add proper error handling to wlr_wl_backend_create 2018-04-28 12:38:03 +01:00
Drew DeVault
fecb971518
Merge pull request #902 from emersion/various-memory-leaks
Various memory leaks
2018-04-26 11:34:49 +02:00
emersion
cd9f25711c
backend: destroy renderer when destroying backend 2018-04-25 23:53:43 +01:00
emersion
625a7a48dc
Don't use the wlr_ prefix for static functions 2018-04-25 23:51:00 +01:00
emersion
71ca45e2c0
Make sure we don't use others' prefixes 2018-04-25 23:24:58 +01:00
emersion
b0d99f5c67
Remove wlr_ prefix from local symbols 2018-04-25 23:00:46 +01:00
emersion
d2ebbd103c
backend: remove wlr_backend_get_egl 2018-04-08 11:00:56 -04:00
emersion
33a2eb4b77
Untie wlr_backend from wlr_renderer 2018-03-31 18:49:43 -04:00
Drew DeVault
1d9be89e2d
Revert "ELF Visibility" 2018-02-19 18:01:27 -05:00
Scott Anderson
86269052eb Explicitly export EFL symbols 2018-02-19 14:26:40 +13:00
emersion
c2e1474010
Reformat all #include directives 2018-02-12 21:29:23 +01:00
emersion
36ead80cd1
Make wlr_signal_emit_safe private 2018-02-12 19:52:47 +01:00
emersion
5e58d46cc1
Add wlr_signal_emit_safe 2018-02-12 09:12:31 +01:00
emersion
babdd6ccf7
backend: fix use-after-free when destroying backends
The backend destroy signal is emitted before the output_remove
signal is. When the destroy signal is emitted listeners remove
their output_remove listener, so the output_remove signal is never
received and listeners have an invalid output pointer.

The correct way to solve this would be to remove the output_remove
signal completely and use the wlr_output.events.destroy signal
instead. This isn't yet possible because wl_signal_emit is unsafe
and listeners cannot be removed in listeners.
2018-01-30 19:45:57 +01:00
emersion
4fa90b0511
Backport screenshooter fixes from the renderer redesign v1
This backports some changes to #319 to fix the screenshooter data
format. This also adds wlr_backend_get_renderer which will be
useful to support multiple renderers.
2018-01-23 22:06:54 +01:00
Johannes Schramm
dcc743047b style: include brackets for if/while/for, even if it's a single statement 2018-01-21 16:28:21 +01:00
Markus Ongyerth
c00e9d1416 adds remote argument to wayland backend create
Add a remote display name argument to wlr_wl_backend_create.
If NULL is passed to the wayland backend at all times, creating a
wayland backend *after* the compositor was started up, would require
changing the WAYLAND_DISPLAY environment variable.
2018-01-13 21:20:15 +01:00
emersion
b99d1f4fcc
Refactor wlr_egl_init to accept config_attribs 2017-12-17 23:51:04 +01:00
emersion
75ef7860bb
Merge branch 'master' into display-destroy 2017-12-14 20:29:30 +01:00
emersion
a1302cc4a5
Fix pointer events with multiple outputs in wayland backend 2017-12-13 22:32:22 +01:00
emersion
18eb1eee3f
Listen to display destroy in xwayland, rename wlr_egl_free 2017-12-08 00:59:37 +01:00
emersion
9d43adaafa
Listen to display destroy in backends 2017-12-07 23:44:59 +01:00
emersion
7d847efe40
Terminate local display on remote X11 server error 2017-11-16 09:38:24 +01:00
emersion
73c48f2f35
Terminate local display on remote Wayland display error 2017-11-16 09:33:47 +01:00
Drew DeVault
16f35ecbea Merge branch 'master' into heghe/wl_list 2017-10-21 22:03:48 -04:00
Scott Anderson
9b984253e2 Move egl.h to render/egl.h 2017-10-22 10:36:07 +13:00
Heghedus Razvan
d3f0878d71 Replace list_t with wl_list in wlr_wl_backend
Now wlr_backend->outputs is a list of wlr_wl_backend_output instead of
wlr_output.

Signed-off-by: Heghedus Razvan <heghedus.razvan@gmail.com>
2017-10-20 19:44:59 +03:00
Scott Anderson
517ba0bc16 Change egl_get_config to always use visual id 2017-09-29 16:15:09 +13:00
Drew DeVault
0699aa62d8 Initial pass on roots_input 2017-09-23 10:13:05 -04:00
Drew DeVault
b6d7c3ed8e Initialize display, backend; add frame handling 2017-09-23 00:30:39 -04:00
Dominique Martinet
062d923b0a wayland backend: wl_event_source_remove on destroy 2017-08-19 09:31:06 +02:00
Dominique Martinet
577d2f6fcd wayland backend: switch to xdg shell
Closes #72 and #96.
2017-08-17 10:24:27 +02:00
Drew DeVault
41e735242d Remove wlr_output_state, update backends 2017-08-13 11:38:03 -04:00
Drew DeVault
4386816889 wlr_backend_init -> wlr_backend_start
Also renames create to init. We'll use create for anything that
allocates and init for anything that takes a pointer and initializes it.
2017-08-13 10:19:57 -04:00
Dominique Martinet
f2e2794365 wayland backend: do not watch wayland fd for writable
Wayland fd is always writable and will busy-loop.
The dispatch function gets called with 0-mask when we need to flush
display anyway, so this saves CPU at no visible impact.
2017-08-13 07:53:33 +02:00
Drew DeVault
81cd90297d Refactor out wlr_backend_state from wl/multi 2017-08-12 11:43:36 -04:00
Dominique Martinet
3ea878b76e wayland backend: free seatName 2017-08-12 01:19:45 +02:00
Drew DeVault
c24351681f Refactor EGL handling 2017-08-10 22:15:37 -04:00
nyorain
67369173aa Implement drm (egl) buffer attaching 2017-08-10 10:59:58 +02:00
nyorain
272030652a Implement absolute motion events for wayland 2017-06-22 17:55:00 +02:00
nyorain
c1520077b6 Implement wayland backend input events 2017-06-22 16:53:48 +02:00
Drew DeVault
f4453d104d Reorganize wlr-common 2017-06-21 12:10:07 -04:00
Drew DeVault
fd91244e83 Update everyone to use new headers 2017-06-21 10:27:45 -04:00
Drew DeVault
c2d0090ad7 Support multiple wl backend outputs 2017-06-20 18:22:21 -04:00
Drew DeVault
b9d36c8149 Add dynamic output resizing for Wayland backend
This allows outputs to:
- Not support modesetting
- Resize themselves
2017-06-20 17:51:45 -04:00
nyorain
51f35e7af0 Cleanup some leaks/incorrect destructions 2017-06-20 19:01:20 +02:00
nyorain
50ce35e9da Implement wayland backend output 2017-06-20 18:27:05 +02:00
nyorain
e22626ef6a Adapt codestyle 2017-06-19 22:39:20 +02:00
nyorain
792d535225 Rework wayland backend output implementation 2017-06-19 22:36:40 +02:00
nyorain
10526de444 Fix furhter wayland backend issues 2017-06-19 19:40:58 +02:00
nyorain
8fbf1ca3ff Continue wayland backend update
Update wayland backend to new api.
Start to use the input interfaces.
Compiling now, not tested.
2017-06-19 19:05:10 +02:00
nyorain
904739c405 Start to fix wayland backend
Starts to update the wayland backend to the new backend api.
Not yet updated to libinput branch (not yet compiling).
2017-06-19 17:46:50 +02:00
Drew DeVault
1aed987301 Add free functions for allocated resources 2017-04-25 21:26:29 -04:00
Drew DeVault
5ca9d612f4 Flesh out wayland backend registry 2017-04-25 19:19:21 -04:00
Drew DeVault
de01e654ce Flesh out wayland backend somewhat, add example 2017-04-25 15:06:58 -04:00