Commit graph

29 commits

Author SHA1 Message Date
Martin Gräßlin
56bd1e7194 [wayland] Add support for initial output count for nested compositors
Added to x11 backend which creates one window per output.

New command line option is called --output-count=<int>.
2015-11-26 08:33:07 +01:00
Martin Gräßlin
ee7f70afc8 [wayland] BasicScreens can serve multiple screens
For this AbstractBackend has a new virtual screenGeometries() method
which returns a QVector<QRect>. By default it's just one QRect at 0/0
with the size of the one screenSize().
2015-11-26 08:33:07 +01:00
Martin Gräßlin
fb4d59abb7 [wayland] Add a base implementation for Screens in a basic setup
X11, Wayland, virtual, Framebuffer and hwcomposer have extremely
similar screens implementations. Let's add a base implementation
for them as a BasicScreens.
2015-11-17 10:39:39 +01:00
Martin Gräßlin
f2bdb4818a [wayland] Disable Compositor during tear-down
Prevents rendering an incomplete state and as well prevents from
running performCompositing() which could access Workspace and crash.
2015-11-12 15:12:01 +01:00
Martin Gräßlin
4f1033f17b [wayland] AbstractBackend indicates whether outputs are enabled
By default Outputs are considered to be enabled. This allows a
concrete backend implementation to mark outputs as disabled (e.g.
if dpms has put outputs into powersaving mode). This allows the
Compositor to disable itself if outputs are not visible anyway.
2015-09-10 14:31:46 +02:00
Martin Gräßlin
d837830661 [wayland] AbstractBackend announces whether a surface less context is possible
In an own QPA plugin we want to make the OpenGL context sharing with
our compositing context and bypass the windowing system for OpenGL
windows. In order to achieve this we need a surfaceless context.

The AbstractBackend now forwards whether such a context can be created on
the EGLDisplay used by the Compositor.
2015-08-25 14:33:50 +02:00
Martin Gräßlin
b9d7726f7a [wayland] Forward EGLDisplay and EGLContext from Scene to Backend
AbstractBackend can forward the egl display and context, so that
it can be used from other parts.
2015-08-25 14:33:50 +02:00
Martin Gräßlin
06fc00b4a9 [wayland] Support pointer warping in the backends
The X11 backend can warp the pointer.
2015-06-06 17:43:13 +02:00
Martin Gräßlin
735ffc8ab2 [wayland] Improve getting cursor image from theme
We don't need to queue the method invokation any more to ensure the
Wayland server connection is flushed since we have the dispatch method
in waylandServer().
2015-06-06 17:43:12 +02:00
Martin Gräßlin
d6700ff9f9 [backends/hwcomposer] Forward input events to main thread
Libhybris input events are generated in a different thread, but we want
them in the main thread (InputRedirection and KWayland are not (yet)
thread safe). Thus all events need to be send to the main thread using
QMetaObject::invokeMethod.
2015-05-11 15:43:30 +02:00
Martin Gräßlin
2220ae44c4 Create a plugin for each of the wayland backends
Each of the backends becomes a plugin. This allows kwin_wayland to load
the requested plugin and kwin itself doesn't need to link all the
libraries needed. E.g. libdrm is no longer linked if running kwin_x11.
Also this allows to create backends for the non-standard EGL platforms
(examples could be raspberrypi or Android devices).
2015-05-06 10:31:39 +02:00
Martin Gräßlin
33fb763e37 [wayland] Introduce a deviceIdentifier in AbstractBackend
To be used by the concrete backends for e.g. framebuffer device name,
DISPLAY or WAYLAND_DISPLAY variable.
2015-05-06 09:38:18 +02:00
Martin Gräßlin
d45cf6ee8d [wayland] Add an initialWindowSize to AbstractBackend
Useful for windowed backends like X11 and Wayland.
2015-05-06 09:26:51 +02:00
Martin Gräßlin
17d5839580 [wayland] AbstractBackend can emit an initFailed signal
Replaces the custom handling for Wayland and X11 Backend. Now they can
just emit the initFailed signal.
2015-05-06 09:26:51 +02:00
Martin Gräßlin
0782252f72 [wayland] AbstractBackend provides signal screensQueried
With this change all backends need to emit the screensQueried signal
at some point. So far only x11 backend did not provide the signal,
wayland had a comparable delayed init mechanism. Now all backends use
the same mechanism.
2015-05-06 09:05:37 +02:00
Martin Gräßlin
c4f8bed815 [wayland] Use a pure virtual AbstractBackend::init method
Two backends already used an init method, let's make that the same
in all backends to be able to have shared startup code.
2015-05-06 08:34:26 +02:00
Martin Gräßlin
2afaa60dc5 [wayland] A backend can mark whether it is ready
Replaces the functionality of the WaylandBackend and makes it available
to all backends by providing the functionality directly in
AbstractBackend. By default a backend is not ready and the implementation
must call setReady(true) to indicate that setup has finished
successfully. The compositor won't start till the backend indicates that
it is ready.
2015-05-05 19:05:31 +02:00
Martin Gräßlin
300a576d32 [wayland] Split out WaylandCursorTheme into own header/implementation
It's used by both the WaylandBackend and AbstractBackend. By splitting
it out the AbstractBackend doesn't need to depend on an implementation.
2015-05-05 13:05:04 +02:00
Martin Gräßlin
79b5685b7a [wayland] Add protected AbstractBackend::repaint(const QRect&)
Allows to trigger a repaint in the Compositor. This way the
implementation does not need to call into Compositor.
2015-05-05 11:39:18 +02:00
Martin Gräßlin
8be38dc4f6 [wayland] Don't call into InputRedirection from AbstractBackend implementations
Instead the AbstractBackend provides methods which delegate into
InputRedirection.
2015-05-05 11:37:59 +02:00
Martin Gräßlin
603844cf98 [wayland] Allow the AbstractBackend subclasses to manage OutputInterfaces
This gives the backend more control without needing to provide all
information in Screens.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
38b676d809 Add support for hardware cursors in DrmBackend
Creates two buffers with the size queried through the drm capabilities.
The actual cursor image is retrieved using the software cursor
functionality from the AbstractBackend and rendered into the shared
memory buffer. The the buffer is set as the new cursor image and the
rendering buffer for the cursor is swapped.

The position is updated whenever the cursor image changes or the mouse
position changes.
2015-04-24 12:03:19 +02:00
Martin Gräßlin
2b185fa7e0 [wayland] Set internal cursor through WaylandCursorTheme in AbstractBackend
Getting the cursor image from the cursor theme is unfortunately not
straight forward. We have three different libraries and all have
drawbacks:
* XCursor - we just kicked it out
* xcb-util/cursor - only provides xcb_cursor_t, so a dependency on X
* wayland-cursor - only a client side API

The picked solution is using wayland-cursor. It provides the cursor in a
wl_buffer. Unfortunately the client side API does not easily allow to
a) read it back
b) init without a wl_shm_pool

Thus we need to work this around:
* create an internal connection
* get a ShmPool on it
* init WaylandCursorTheme with this ShmPool
* get the cursor wl_buffer from the theme
* trigger a roundtrip
* get the corresponding BufferInterface for the buffer
* set the content as the software cursor
2015-04-02 14:37:23 +02:00
Martin Gräßlin
c5693270db [wayland] Add support for a "software" cursor
At least the framebuffer backend does not have support for an overlay
cursor. Thus the cursor needs to be rendered by the scene. This change
allows a backend to set that it needs a software cursor which triggers
tracking in the AbstractBackend. A repaint for the old cursor region is
triggered whenever the cursor pos changes.

So far only the QPainter/framebuffer scene is adjusted to render the
software cursor. This is done after rendering a frame with the up to
date cursor position.

There is one problem, though: the KWin internal cursors don't work
as we need to get it from the theme. Using wayland-cursor doesn't help
as it gives us a (client) wl_buffer* and we cannot read the memory back.
2015-04-01 15:36:40 +02:00
Martin Gräßlin
2b0a837340 [wayland] Create QPainterBackend through the AbstractBackend
SceneQPainter delegates creation to the AbstractBackend removing the
casting logic.
2015-04-01 11:05:45 +02:00
Martin Gräßlin
e1ae0b8bc4 [wayland] Create OpenGLBackend through the AbstractBackend
Replaces casting logic in the SceneOpenGL. Now the create is delegated
to the backend allowing also to move the ifdef logic to where it belongs.
2015-04-01 11:05:45 +02:00
Martin Gräßlin
65839e1617 [wayland] Create Screens through the AbstractBackend
The AbstractBackend provides a virtual method to create the Screens.
A concrete backend can implement this method to create the backend
specific Screens instance.

This removes the casting logic from Screens::create.
2015-04-01 11:05:45 +02:00
Martin Gräßlin
49f58059c6 [wayland] Backends are no longer singletons
They are installed in the WaylandServer, thus we don't need an explicit
singleton accessor. If we need to differentiate we can cast.
2015-03-23 14:29:07 +01:00
Martin Gräßlin
9a0fd94013 Introduce AbstractBackend as base class for Wayland and X11Windowed backend
The AbstractBackend registers itself in the WaylandServer allowing
external users to easily get to the backend and not needing to test
manually which backend is used.
2015-03-20 14:41:03 +01:00