- Since a lot of functionality is now in smithay's rendering module
we can get rid of shm_load, shaders and the glium dependency.
- glium_drawer becomes drawing and only features some code to get from surfaces
to textures for any(!) renderer.
(Should probably moved into smithay at some point as well.)
- buffer_utils is only necessary to query the buffer size anymore.
- disable egl-buffer support temporarily
- Cursor is not necessary anymore as rendering hardware vs software
cursors just depends on "where" you render the cursor.
- Format is replaced by drm-fourcc and more related to buffers and
therefor the allocator module anyway.
- GL/Glium are replaced by the renderer module.
- Software was unused and very small anyway and can be implemented
with the new renderer api.
- SwapBuffersError is (for now) just moved into the top-level backend module.
This pulls a lot of code from anvil/src/glium_drawer and replaces glium
as glium has too many assumptions about the backend.
(Mostly that a fixed framebuffer exists, see fix bullet point.)
Depending on how picky glium is, we could try to re-introduce glium support
later with a some workarounds, but for now this is actually more
straight-forward to support and test.
- Add a new GL renderer, that only depends on egl as an initialization platform.
In particular do not depend on a surface being available.
Renderers share some basic drawing functions and may bind objects to render upon.
E.g. surfaces or buffers, textures, etc for the gles2 renderer.
- Be explicit about extensions we require and use. Use some very very common ones
to make our lives easier (e.g. BGRA and unpack to read in manditory shm formats).
- Enable GL debug output
- Allow more flexible rendering (e.g. 3D compositors) by allowing user-provided
projection matrices. Also provide helper functions to allow easy-ish handling
of surface and output transformations.
- Add API for renderers to tell the wayland-frontend about supported buffer-types.
- Also incoperate code from anvil/src/shm_load to handle buffer loading in the renderer
(as this is a renderer dependant operation).
- Remove EGLStream code, nvidia support will re-introduced,
when 470 hopefully lands with GBM support this summer.
- Greately simplify the native code by setting exclusively on
`EGL_EXT_platform_base` and its extensions for initialization.
- Remove generic parameters for the underlying objects on `EGLDisplay`
and `EGLSurface` by using trait objects instead.
- Allow creation of `EGLContext`s without a config for surface-less usage.
- Remove the `Device`, `Surface`, `RawDevice` and `RawSurface` traits.
We are not trying to merge the different responsibilities between...
- Drm-Surfaces: crtcs and planes for displaying buffers
- Gbm-Surfaces: allocating and managing front- and back-buffers
- EGL-Surfaces: Load drawing apis.
..anymore.
- Instead unify the legacy and atomic backends into one `DrmDevice` and
a `DrmSurface`, that under the hood dispatches onto the different modules.
- Do not keep a list of surfaces inside the devices. These are reference-counting
nightmares and a frequent issue due to the read-only nature of `Rc` and `Arc` and
thread-safety related problems.
- Surfaces are mostly doing state-tracking independently of each other
and contain some more helper functions.
- Simplify session code, because we do not need to pass the events
through three layers of devices and surfaces anymore.
- Each surface now represents a plane. Rendering to a plane is just like
any other rendering step, including the Cursor-plane.
(Legacy interfaces only have one to avoid dealing with short-comings of the api).
- Add module that deals with different kinds of buffers (memory and external),
their allocation and usage for rendering. Also try to properly support modifiers this time.
- Describe gbm functionality as an allocator (instead of a rendering device/surface).
- Also create a quick-and-dirty dumb buffer allocator for tesing / simpler tasks.
- Add a (current untested) wrapper for dmabufs and some code for converting from gbm for now.
- (also untested) Swapchain helper to manage front/backbuffers for surfaceless rendering.
Xwayland gives us a mapping between X11 window and WlSurface IDs via
special WL_SURFACE_ID messages. This commit uses these messages to find
the corresponding WlSurface. For this, the new client.get_resource API
from wayland-server is needed.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commits adds the necessary magic incantations to become the X11 WM
after Xwayland starts.
This uses the pure-Rust implementation from x11rb, but any other X11
crate could be used as well.
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit adds an xwayland feature to anvil. Right now, this feature
doesn't do much. anvil uses the smithay code to start XWayland, but does
not do anything with it once it is running.
Signed-off-by: Uli Schlachter <psychon@znc.in>
It is not necessary to set the cursor position on winit since the
windowing system already updates the position on its own. Instead, doing
this makes the cursor (almost) stuck and unmovable. Thus, this commit
just removes that code from the winit backend.
Fixes: https://github.com/Smithay/smithay/issues/241
Signed-off-by: Uli Schlachter <psychon@znc.in>
* xwayland: Add LaunchHelper
Calling fork() in a multi-threaded process is a bad idea. I am getting
crashes at exit() and "man fork" says that only async-signal-safe
functions can be called after forking in a multi-threaded process.
exit() is not async-signal safe. Thus, forking needs to happen before
any threads are created.
This commit adds a LaunchHelper to the public API. This is a handle to a
forked child process. So far this does not do much, but the intention is
to use this later instead of fork()ing directly.
Signed-off-by: Uli Schlachter <psychon@znc.in>
* xwayland: Move the fork dance to LaunchHelper
No functional changes intended. This only moves the code over and does
not actually use the LaunchHelper for anything.
Signed-off-by: Uli Schlachter <psychon@znc.in>
* Move checking the launch status to LaunchHelper
This should again have no functional changes, but the error log output
might change slightly, since an IOError instead of a NixError is
returned.
Signed-off-by: Uli Schlachter <psychon@znc.in>
* xwayland: Set $DISPLAY earlier
This way, the WM already gets the correct value of $DISPLAY.
Signed-off-by: Uli Schlachter <psychon@znc.in>
* xwayland: Use the launch helper process
FD passing is now used to give the display number and the sockets to the
launch helper process. That process then forks of the actual process
that spawns Xwayland. Once Xwayland started, this is reported back with
another write on the pipe.
Signed-off-by: Uli Schlachter <psychon@znc.in>
* Add to the comment explaining Xwayland startup
Signed-off-by: Uli Schlachter <psychon@znc.in>
* Please rustfmt
Signed-off-by: Uli Schlachter <psychon@znc.in>
* Make clippy happy
Signed-off-by: Uli Schlachter <psychon@znc.in>
This fixes the following clippy warnings:
error: usage of `Rc<T>` when T is a buffer type
--> src/wayland/dmabuf/mod.rs:265:14
|
265 | formats: Rc<Vec<Format>>,
| ^^^^^^^^^^^^^^^ help: try: `Rc<[Format]>`
|
= note: `-D clippy::rc-buffer` implied by `-D warnings`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#rc_buffer
error: usage of `Rc<T>` when T is a buffer type
--> src/wayland/shm/mod.rs:91:14
|
91 | formats: Rc<Vec<wl_shm::Format>>,
| ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `Rc<[wl_shm::Format]>`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#rc_buffer
Signed-off-by: Uli Schlachter <psychon@znc.in>
When starting xwayland with smithay, the first time I would get the
following output (do not ask what happens with displays 0, 1, 2. That's
not important right now):
Dec 29 14:13:31.031 DEBG Attempting to aquire an X11 display lock, D: 3, smithay_module: XWayland
Dec 29 14:13:31.032 DEBG X11 lock aquired, D: 3, smithay_module: XWayland
Dec 29 14:13:31.032 INFO Initialization completed, starting the main loop.
When killing the process with ctrl-c and starting it again, this
happened:
Dec 29 14:13:29.138 DEBG Attempting to aquire an X11 display lock, D: 3, smithay_module: XWayland
Dec 29 14:13:29.138 DEBG Failed to acquire lock, D: 3, smithay_module: XWayland
Dec 29 14:13:29.138 DEBG Lock was blocked by a defunct X11 server, trying again, D: 3, smithay_module: XWayland
Dec 29 14:13:29.139 DEBG Attempting to aquire an X11 display lock, D: 3, smithay_module: XWayland
Dec 29 14:13:29.139 DEBG X11 lock aquired, D: 3, smithay_module: XWayland
Dec 29 14:13:29.139 INFO Cleaning up X11 lock., smithay_module: XWayland
Dec 29 14:13:29.139 DEBG Attempting to aquire an X11 display lock, D: 4, smithay_module: XWayland
Dec 29 14:13:29.139 DEBG X11 lock aquired, D: 4, smithay_module: XWayland
Dec 29 14:13:29.139 INFO Initialization completed, starting the main loop.
The reason for the above behaviour is the
smithay::xwayland::x11_sockets::open_x11_sockets_for_display() failed.
The code successfully acquired the lock file, but then could not bind
the sockets. More specifically, the concrete socket in /tmp/.X11-unix/
already existed and thus bind() failed with EADDRINUSE.
(The code in X11Lock::grab() would then drop the already acquired
X11Lock and its Drop impl deleted the socket. Thus, when I started
things again, this time it successfully acquired display 3.)
Fix this removing the socket before trying to bind it.
This is also done by wlroots: In xwayland/sockets.x, the function
open_socket() has the same job as smithay's open_socket() function.
However, for non-abstract sockets, it would first unlink the target
before trying to bind:
if (addr->sun_path[0]) {
unlink(addr->sun_path);
}
Signed-off-by: Uli Schlachter <psychon@znc.in>