Commit graph

13 commits

Author SHA1 Message Date
Martin Gräßlin
a67ccc3529 [platforms/drm] Pass ownership of gbm_device to Platform
Just like 4e7392b907:
the ownership of the gbm_device must be passed to the Platform as
the ownership of the EGLDisplay is also passed to the Platform and
we may not destroy the gbm_device for an EGLDisplay we are still using.

With this change I could restart the OpenGL compositor successfully
and switch from OpenGL 3.1 to OpenGL 2 without a crash or rendering
issues.
2016-08-19 16:09:18 +02:00
Martin Gräßlin
44e37aacdf Set initial count of screens before calling Screens::init
Screens::init sets up a Qt::QueuedConnection connect from countChanged
to changed. This means that when first setting up the connection a
changed signal will be delivered in the next event cycle. This can mess
with other code. E.g. WaylandServer recreating outputs which can make
Xwayland crash or KWin internally crash.

To solve this problem we just need to make sure to set the output count
to the initial value before performing the init.

Reviewed-By: bshah
2016-08-05 09:59:22 +02:00
Martin Gräßlin
9d7ef58b2b Support restarting the OpenGL compositor on Wayland
Summary:
KWin needs to support restarting the OpenGL compositor in case of a
graphics reset event.

On Wayland the tricky part is that the applications should not notice
this. Most importantly KWin cannot just destroy the EGLDisplay and create
a new one. But this is how a restart works: the complete compositor gets
torn down and recreated - including the EGLDisplay.

This change moves ownership of the EGLDisplay to the Platform.
The AbstractEglBackend subclasses query the Platform whether there is
already an EGLDisplay. Only if there is no EGLDisplay the EGLDisplay is
created and only if no EGLDisplay is registered with Wayland the bind
is performed.

Another change is regarding the destruction: the AbstractEglDisplay does
no longer unbind the Wayland display and does no longer destroy the
EGLDisplay. The EGLDisplay is destroyed by the Platform - so very late
on application exit. The Wayland display is unbound when the Compositor
terminates.

Test Plan:
Limited testing with the added auto-test. This one needs to
be extended to fully verify that OpenGL applications continue to work.
But this requires build.kde.org to support OpenGL on Wayland.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2202
2016-07-20 14:08:23 +02:00
Martin Gräßlin
1c275a02c8 [platforms/drm] Add better warnings in DrmBuffer if things fail
For virtual machines with Cirrus device the drmModeAddFB fails. So
far there was no error message at all, we only saw it failed.

With this change the drmModeAddFB is checked for error and a warning
is shown. Also further debug messages are added for other cases where
things can fail.

Reviewed-By: Eike Hein
2016-07-15 08:37:17 +02:00
Martin Gräßlin
cd9a0afafa [platforms/drm] Properly handle case that mapping the blank buffer fails
Summary:
If it's not possible to create a buffer to blank the output, KWin won't
be able to render to the output. In that case the output should not be
added to the list of outputs.

To support this DrmOutput::blank and DrmOutput::init return bool to
indicate whether they succeeded. DrmBackend handles this situation and
doesn't add the output to the list of outputs if init failed.

If after init there are no outputs KWin is in a state where it won't
be functional. Thus the platform emits the initFailed signal to
terminate.

BUG: 365242
FIXED-IN: 5.7.2

Test Plan: No hardware to reproduce the condition

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2135
2016-07-13 09:37:38 +02:00
Martin Gräßlin
7ea84cd346 [platforms/drm] If mapping a DrmBuffer for a cursor fails, fallback to software cursor
Summary:
So far the drm platform did not verify whether creating and mapping a
DrmBuffer for a cursor works. This could result in a crash in the worst
case.

This change verfies whether mapping the two cursor buffers works, if
not software cursor is enabled. The code is adjusted to ensure that
none of the cursor buffers is accessed in case software cursor are
enabled.

Please note that right now the drm platform's rendering does not
support software cursors. Thus currently this change results in no
cursor at all. This will be addressed by following patches.

BUG: 364740
FIXED-IN: 5.7

Test Plan:
Verfied that it properly falls back to software cursor,
but could not verify that the crash is actually fixed.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2026
2016-06-29 08:49:17 +02:00
Martin Gräßlin
f5b83d18b8 [platforms/drm] Apply new global position on DrmOutput for a changeset
Summary:
When we get a configuration request, we also need to update the global
position on the DrmOutput, otherwise Wayland will know about the new
position, but KWin internally does not.

In addition we also need to trigger the changed signal on KWin::Screens,
so that internally code can react on the change.

With this change configuring layout of connected screens in KScreen
does work also in KWin.

Reviewers: #kwin, #plasma_on_wayland, sebas

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1858
2016-06-14 13:42:25 +02:00
David Fort
935f8875fe [drm] correctly initialize the second cursor
Summary: There were a trivial copy'n paste error.

Reviewers: graesslin

Reviewed By: graesslin

Subscribers: graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D1806
2016-06-09 17:00:07 +02:00
Martin Gräßlin
b5b2adc5a2 [platforms/drm] Only show cursor if a pointer device is available
Summary:
When the pointer device gets plugged off the cursor is hidden, when
a pointer device gets plugged in the cursor is shown again.

This allows to easily turn a tablet into a proper system by showing
the cursor only when it makes sense.

Test Plan: Tested on exopc with external mouse

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1682
2016-05-25 12:14:00 +02:00
Sebastian Kügler
8e36d9c8e1 add override to bufferForScreen
Summary: This seems to just have been forgotten here.

Test Plan: Builds

Reviewers: graesslin

Reviewed By: graesslin

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1499
2016-05-02 14:50:23 +02:00
Martin Gräßlin
2ecd097e87 [plugins/drm] Drop dependency on VirtualTerminal
Only integrates with Logind to find out when the session is active.
2016-04-22 14:18:56 +02:00
Martin Gräßlin
b4b0b100df [plugins/platforms/drm] Fix includes
Incorrect includes resulted in build without GBM to fail.
2016-04-13 14:10:25 +02:00
Martin Gräßlin
2bff90976e Move backends/ to plugins/platforms/
Summary:
Source code reorganization:
The base class AbstractBackend got renamed to Platform, thus the
"backends" are "platforms" now. As they are plugins they should go
together with other KWin plugins which are nowadays in the folder
plugins.

So new location is plugins/platforms/

Reviewers: #plasma, sebas

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1353
2016-04-12 08:01:27 +02:00