Commit graph

167 commits

Author SHA1 Message Date
Simon Ser
c59aacf944 backend/x11: query modifiers supported by X11 server 2020-12-13 12:16:52 +01:00
Simon Ser
d79a00bf02 backend/x11: switch to wlr_swapchain 2020-12-13 12:16:52 +01:00
Simon Ser
154fe8696f backend/x11: log unhandled client messages 2020-11-24 14:57:25 +01:00
Simon Ser
f6c36f8881 backend/x11: log unhandled X11 events 2020-11-24 14:57:25 +01:00
Simon Ser
52805feae9 backend/x11: log errors
Register an X11 error handler, and optionally use xcb-errors to print a
detailed message.
2020-11-24 14:57:25 +01: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
9be1af3afb backend/x11: add support for adaptive_sync_enabled
This sets the _VARIABLE_REFRESH window property [1].

[1]: 0616b7ac90/src/vulkan/wsi/wsi_common_x11.c (L1374)
2020-03-06 21:32:58 +01:00
Scott Anderson
685a5a11a9 backend/x11: Revert usage of present extension
This reverts commit 3317134adf.
This reverts commit a3c3b928a3.

There are some serious issues when running this on a real X server, as
opposed to running this on Xwayland, where this was tested.

More investigation needs to be done into why these issues happen and if
our usage of the present extension is correct.
2019-11-19 11:06:38 +01:00
Scott Anderson
3317134adf backend/x11: Drop required present version
We say 1.2, but I don't think we actually use anything that was
introduced past 1.0.
2019-11-18 11:53:17 +01:00
Scott Anderson
a3c3b928a3 backend/x11: Give X11 a real rendering loop
Makes use of the present extension to get notified of vsync, and not
require any stupid timer hacks. Also make use of the present version of
ConfigureNotify, because why not?
2019-11-02 12:43:33 +01: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
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
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
Scott Anderson
d3ee69f76b backend/x11: Hide cursor with Xfixes 2018-11-13 10:55:03 +13:00
Scott Anderson
70ae76304e backend/x11: Remove old input functions
This also allows us to remove xcb-xkb, since Xinput will now give us the
appropriate XKB modifiers with each event.
2018-11-13 10:55:03 +13:00
Scott Anderson
88b2d6fe25 backend/x11: Check for xinput extension 2018-11-13 10:41:37 +13:00
Scott Anderson
9c1b87f210 backend/x11: Move atom initilisation earlier
There isn't any real reason to delay this until the backend is started.
2018-11-13 10:40:52 +13:00
Scott Anderson
ab2c57984b backend/x11: Make header order consistent 2018-11-13 10:40:52 +13:00
Scott Anderson
51a283cbe4 backend/x11: Rename xcb_conn to xcb
When the Xlib connection is removed, this _conn suffix is going to be
pointless. I'm removing this preemtively for that.
2018-11-13 10:39:24 +13:00
emersion
51bfdd620e
Use #if instead of #ifdef for wlroots config data
This prevents some annoying issues when e.g. not including wlr/config.h or
making a typo in the guard name.
2018-11-12 10:12:46 +01:00
emersion
09550032b7
render: correctly set EGL_RENDERABLE_TYPE
This should be set to EGL_OPENGL_ES2_BIT.

Also fixes EGL config attributes in the headless and X11 backends.
2018-11-10 13:20:54 +01:00
emersion
02231554c8 backend/x11: add assertions 2018-09-18 11:06:01 +02:00
random human
7bc2657984
Free unused pointer in x11/backend.c 2018-09-02 20:52:09 +05:30
Drew DeVault
4b096fc114 Revert "Merge pull request #1153 from emersion/include-config"
This reverts commit ef0a6ea4d2, reversing
changes made to 8d03bc9178.
2018-07-21 09:44:20 -04:00
emersion
41094a7df5 Always include config.h 2018-07-21 13:08:23 +01:00
Guido Günther
40fe252c2d x11: make sure event source is drained
Otherwise running under Xvfb will not deliver any events. This results
in e.g. weston-info reporting a 0x0 window size (which results in all
sorts of problems).
2018-07-11 17:34:43 +02:00
Guido Günther
8515b7c65b x11: use correct type for events in wl_event_loop_add_fd 2018-07-11 17:30:45 +02:00
emersion
7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
Dominique Martinet
bcc2c64c1e x11 backend init: fix leak on failed XOpenDisplay
Found through static analysis
2018-06-30 11:38:21 +09: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
62d7337d00
backend/x11: add one pointer per output 2018-04-29 14:46:29 +01:00
emersion
f8e0a03451
backend/x11: correctly destroy input devices 2018-04-28 12:55:36 +01:00
emersion
79da4c175e
backend/headless: remove useless destructor 2018-04-28 12:48:05 +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
Uli Schlachter
e5ab12339f x11 backend: Expose events mean "needs swap"
When the X11 server sends an expose event, that means that "this
rectangle here (the event contains x,y,width,height) has undefined
contents on your window; please redraw that". This means that we need a
swap. However, so far the code does not actually enforce that a swap
happens.

For example, start rootston, switch to another workspace and then switch
back. The rootston window will not be redrawn (before commit
52b058c2a3, it would just be fully white; after that commit it will
show whatever was visible on the old workspace). This is because the
drawing code concludes that nothing needs to be done. However, in fact a
swap is necessary.

This reverts commit e79d924588, because its optimisation is already
done now: wlr_output_update_needs_swap() emits a signal, which is
handled by wlr_output_damage with a call to wlr_output_schedule_frame().
This function does nothing if a frame is already pending. Thus, the
optimisation from commit e79d924588 now happens implicitly.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-04-15 11:41:09 +02:00
Uli Schlachter
e79d924588 x11 backend: Ignore expose if frame is pending
When resizing rootston with the mouse, the result is really slow. One
can see that rootston needs quite a while for drawing the newly visible
area. This is because every single expose event is handled on its own
and causes (apparently) a full repaint or at least a swap.

This commit improves things by only causing a new frame if none is
pending already.

With this change, there is almost no delay in rootston drawing the newly
visible area.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-04-15 11:07:31 +02:00
Uli Schlachter
98f8ec6a08 x11_handle_input_event: Remove return value
handle_x11_event() and x11_handle_input_event() react to different kinds
of events, so it does not make much of a difference if
x11_handle_input_event() signals if it handled an event or not.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-04-15 10:33:53 +02:00
Uli Schlachter
3728abd1fc handle_x11_event: Remove return value
This function always returns "false", so its return type can simply be
changed to void.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-04-15 10:32:30 +02:00
emersion
d2ebbd103c
backend: remove wlr_backend_get_egl 2018-04-08 11:00:56 -04:00
Drew DeVault
8b37e8f67a
Merge pull request #792 from emersion/x11-backend-blank-cursor
backend/x11: hide cursor
2018-04-02 10:21:07 -04:00
emersion
33a2eb4b77
Untie wlr_backend from wlr_renderer 2018-03-31 18:49:43 -04:00
emersion
7b88ace557
backend/x11: hide cursor 2018-03-31 12:10:43 -04:00
emersion
5111f7df84
backend/x11: fix extra output 2018-03-30 23:51:20 -04:00
emersion
aa6ae710f7
backend/x11: fix input events 2018-03-30 23:51:19 -04:00
emersion
0a7a8cbd1c
backend/x11: add WLR_X11_OUTPUTS support 2018-03-30 23:51:19 -04:00
emersion
d4f7ced6e2
backend/x11: refactor, prepare support for multiple outputs 2018-03-30 23:51:16 -04:00
emersion
5dd022da13
Merge pull request #765 from swaywm/transformed-events
Use libinput transformed events instead of width_mm/height_mm
2018-03-28 14:11:39 -04:00
Drew DeVault
a35a5786b0 Remove width_mm from wlr_pointer events 2018-03-28 10:46:50 -04:00
emersion
f033f717a2
backend/x11: make xcb-xkb optional, remove global state 2018-03-28 00:26:15 -04:00
emersion
8d1b5c7600
backend/x11: correctly update keyboard modifiers 2018-03-28 00:04:32 -04:00
Uli Schlachter
c7f8b28d8d Fix use-after-free in x11 backend during shutdown
The xcb_connection_t instance that is used here comes from
XGetXCBConnection(), is created by XOpenDisplay(), and is owned by the
returned Display*. Calling xcb_disconnect() directly on it leads to
various use-after-frees during shutdown, as reported by valgrind. The
first one of the about 30 errors is:

    Invalid read of size 4
       at 0x71F2051: xcb_take_socket (in /usr/lib64/libxcb.so.1.1.0)
       by 0x78551DD: ??? (in /usr/lib64/libX11.so.6.3.0)
       by 0x7855A14: _XFlush (in /usr/lib64/libX11.so.6.3.0)
       by 0x7858504: _XGetRequest (in /usr/lib64/libX11.so.6.3.0)
       by 0x7838966: XFreeGC (in /usr/lib64/libX11.so.6.3.0)
       by 0x783238B: XCloseDisplay (in /usr/lib64/libX11.so.6.3.0)
       by 0x4E680C2: wlr_x11_backend_destroy (backend.c:333)
       by 0x4E57E94: wlr_backend_destroy (backend.c:39)
       by 0x4E629FB: multi_backend_destroy (backend.c:47)
       by 0x4E62B5A: handle_display_destroy (backend.c:90)
       by 0x50B7E9F: ??? (in /usr/lib64/libwayland-server.so.0.1.0)
       by 0x50B8476: wl_display_destroy (in /usr/lib64/libwayland-server.so.0.1.0)
     Address 0xc14dda0 is 0 bytes inside a block of size 21,152 free'd
       at 0x4C2DD18: free (vg_replace_malloc.c:530)
       by 0x4E680A5: wlr_x11_backend_destroy (backend.c:330)
       by 0x4E57E94: wlr_backend_destroy (backend.c:39)
       by 0x4E629FB: multi_backend_destroy (backend.c:47)
       by 0x4E62B5A: handle_display_destroy (backend.c:90)
       by 0x50B7E9F: ??? (in /usr/lib64/libwayland-server.so.0.1.0)
       by 0x50B8476: wl_display_destroy (in /usr/lib64/libwayland-server.so.0.1.0)
       by 0x40C54E: main (main.c:84)
     Block was alloc'd at
       at 0x4C2EA1E: calloc (vg_replace_malloc.c:711)
       by 0x71F0C60: xcb_connect_to_fd (in /usr/lib64/libxcb.so.1.1.0)
       by 0x71F4BD4: xcb_connect_to_display_with_auth_info (in /usr/lib64/libxcb.so.1.1.0)
       by 0x7854AA1: _XConnectXCB (in /usr/lib64/libX11.so.6.3.0)
       by 0x7845481: XOpenDisplay (in /usr/lib64/libX11.so.6.3.0)
       by 0x4E681B6: wlr_x11_backend_create (backend.c:376)
       by 0x4E580EE: wlr_backend_autocreate (backend.c:99)
       by 0x40C27D: main (main.c:35)

Normally, one would expect this to crash during XCloseDisplay() when
xcb_disconnect() is called again and frees the same data again (glibc would
detect a double free). However, XCloseDisplay() tries to clean up some internal
caches first for which it has to send requests to the X11 server (e.g. the
XFreeGC() above). This fails since the file descriptor was already closed,
which causes an IO error. Xlib's _XDefaultIOError() handles this by printing an
error message and calling exit(1).

Thus, the only symptom of this problem was compositors exiting
mid-shutdown and printing an error message:

    XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0"
          after 6 requests (6 known processed) with 0 events remaining.

Fixes: https://github.com/swaywm/wlroots/issues/745
Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-03-26 10:48:30 +02:00
Dominique Martinet
b0c2bbebd1 x11 backend: fix various leaks
- xcb_query_pointer_reply return value needs to be freed
 - call XCloseDisplay
 - remove wl event_source
2018-03-22 21:25:41 +01:00
Scott Anderson
3c9fc7c68e Add const to x11 and input interfaces 2018-03-06 21:16:18 +13:00
Scott Anderson
902d6cc240 Use xcb atoms properly 2018-03-06 21:15:47 +13:00
Guido Günther
9716aa9b92 x11: parse vendor and model out of xcb setup information 2018-02-23 09:52:56 +01:00
Drew DeVault
1d9be89e2d
Revert "ELF Visibility" 2018-02-19 18:01:27 -05:00
Drew DeVault
868ad5af69
Merge pull request #647 from ascent12/elf_visibility
ELF Visibility
2018-02-18 21:49:23 -05:00
Scott Anderson
86269052eb Explicitly export EFL symbols 2018-02-19 14:26:40 +13:00
Guido Günther
15afef6cbc x11 backend: set window title
This makes windows identifiable in the window list
2018-02-18 23:42:04 +01: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
10ecf871f2
Remove wlr_backend.events.{output_remove,device_remove} 2018-02-12 10:36:43 +01:00
emersion
5e58d46cc1
Add wlr_signal_emit_safe 2018-02-12 09:12:31 +01:00
emersion
bf6d245400
Swap buffers with damage 2018-02-09 22:54:14 +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
51c22d39a4
Merge remote-tracking branch 'upstream/master' into output-damage 2018-01-29 23:24:09 +01:00
emersion
8d58ed502b
output: add wlr_output_schedule_frame 2018-01-26 22:39:23 +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
emersion
0365b587f0
output: add damage tracking via buffer age 2018-01-21 00:06:35 +01:00
emersion
78c13ead16
backend/x11: force rendering the whole output 2018-01-20 18:10:11 +01:00
emersion
771263380c
Add wlr_output::enabled 2018-01-04 12:46:15 +01:00
Dominique Martinet
fcd7062542 x11 backend: add wlr_input_device_is_x11 2017-12-19 20:40:36 +01:00
Dominique Martinet
f83b16bc17 x11 backend: add wlr_output_is_x11 2017-12-19 20:13:49 +01:00
Tony Crisci
b5686355f3 add some input device cleanup to x11 backend 2017-12-18 15:54:49 -05:00
emersion
b99d1f4fcc
Refactor wlr_egl_init to accept config_attribs 2017-12-17 23:51:04 +01:00
emersion
0256de0002
Add full refresh rate support to custom modes 2017-12-17 18:02:55 +01:00
emersion
75ef7860bb
Merge branch 'master' into display-destroy 2017-12-14 20:29:30 +01:00
emersion
3b4b8953d9
Update output layout when scale or transform changes 2017-12-12 21:58:00 +01:00
emersion
c67a5824b8
Merge branch 'master' into display-destroy 2017-12-11 16:14:03 +01:00
emersion
529675b7b0
Add wlr_output_set_custom_mode 2017-12-11 12:14:23 +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
2c63aa2056
Destroy x11 output with backend 2017-10-31 14:21:12 +01:00
Tony Crisci
9cc5166905 bug: free x11 backend output in destroy 2017-10-30 19:23:24 -04:00
Tony Crisci
875a5b446f remove time usec 2017-10-30 15:43:06 -04:00
Tony Crisci
a224e74fad refactor input time_sec to time_msec 2017-10-30 06:40:06 -04:00
emersion
eea532911a
Send output current mode when changed 2017-10-23 21:03:00 +02:00
Scott Anderson
822a9f65a4 Add pointer to backend inside wlr_output 2017-10-22 10:36:07 +13:00
Scott Anderson
9b984253e2 Move egl.h to render/egl.h 2017-10-22 10:36:07 +13:00
D.B
7cdc19d57f Fix duplicated pointer axis events
In pointer.c, some axis event was emitted even if the event pointer did not have
current axis.

In X11 backend pointer scroll events seem to be composed of both BUTTON_PRESS
and BUTTON_RELEASE. Therefore we should skip one of them (RELEASE) to avoid
event duplication.
2017-10-14 07:29:23 +02:00
Greg V
a5fe9aa736 Add FreeBSD compatibility 2017-10-11 00:07:21 +03:00
Drew DeVault
2f36e78de1 Merge pull request #240 from acrisci/feature/x11-backend-axis
x11-backend: axis events
2017-10-08 10:01:22 -04:00
Tony Crisci
2f2392c39e x11-backend: create wlr output global 2017-10-08 09:53:53 -04:00
Tony Crisci
6d9b4f330e x11-backend: axis events 2017-10-08 09:28:23 -04:00
Tony Crisci
4f848000af Merge branch 'master' into feature/xdg-popup 2017-10-07 13:04:04 -04:00
Versus Void
568b270cdf Use xkb_state_update_mask() with Wayland backend
Fix #158
2017-10-06 22:02:29 +00:00