Commit graph

135 commits

Author SHA1 Message Date
Ilia Mirkin
7bc8dbb991 backend/x11: keep track of exposed rects, add them to damage regions
When we receive an Expose event, that means that we must redraw that
region of the X11 window. Keep track of these regions with pixman
regions, and merge them with the additional output damaged regions.

Fixes #2670
2021-01-21 15:14:54 +01:00
Ilia Mirkin
922b7f415d backend/x11: skip events we don't care about
These are ones I see log messages about in my setup.
2021-01-21 15:14:54 +01:00
Ilia Mirkin
966e653935 backend/x11: set a blank cursor rather than hiding globally
This actually simplifies the logic since we no longer have to wait for
enter/leave events, and also improves the UX when e.g. handling a crash
with gdb attached.

See #2659
2021-01-18 21:07:11 +01:00
Simon Ser
e537382991 backend/x11: add support for DRI3 1.0
Add fallbacks when DRI3 1.2 isn't supported.

Closes: https://github.com/swaywm/wlroots/issues/2586
2021-01-17 12:08:40 +01:00
Simon Ser
284233c34f backend/x11: log DRM node name 2021-01-17 10:28:12 +01:00
Simon Ser
5373187186 backend/x11: log when creating X11 backend 2021-01-17 10:28:12 +01:00
Simon Zeni
e128e6c08d render: drop egl parameters from wlr_renderer_autocreate 2021-01-16 08:57:42 +01:00
Simon Ser
6dfc8ce00b backend/x11: implement get_drm_fd 2021-01-16 08:57:42 +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
4ffd537d2d
backend/x11: print version on extension error 2020-12-31 20:17:31 +01:00
Simon Ser
1491ec42da backend/x11: always open render node
If we get an authenticated primary node from the X11 server, don't use
it because we can't authenticate our Wayland clients with it. Instead,
open a render node.

Closes: https://github.com/swaywm/wlroots/issues/2576
2020-12-30 19:37:19 +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
caeed70f28 backend/x11: create per-window present event contexts
The Present protocol states:

> An event context is associated with a specific window; using an existing
> event context with a different window generates a Match error.

Instead of a global event context, use a per-window event context to fix
this error:

    [backend/x11/backend.c:608] X11 error: op Present (SelectInput), code Match (no extension), sequence 63, value 4194307

Closes: https://github.com/swaywm/wlroots/issues/2577
2020-12-28 16:57:56 +01:00
Simon Ser
94fda895ac backend/x11: use DRI3Open to get DRM FD
Instead of relying on EGL to retrieve the DRM FD, query it from the
DRI3 extension.

Use the EGL GBM platform, and drop the EGL config.
2020-12-18 10:12:55 +01:00
Simon Ser
0dcdb5e7a1 backend/x11: fix DRI3 formats not used
We queried DRI3 formats, but we weren't using them. Because of a typo,
only render formats were used.

Fixes: c59aacf944 ("backend/x11: query modifiers supported by X11 server")
Closes: https://github.com/swaywm/wlroots/issues/2552
2020-12-17 17:02:09 +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
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