Commit graph

82 commits

Author SHA1 Message Date
Martin Gräßlin
ace506b5ca [platforms/x11] Fix init of EGL/X11
Incorrect variable naming.
2016-07-21 09:42:01 +02:00
Martin Gräßlin
56ce6689fd [platforms/virtual] Use rendernode or vgem device if available for egl
Summary:
The egl implementation for the virtual platform tries to use a render
node if available. If there is no render node it looks for a virtual
(kernel driver vgem) device, which unfortunately does not create a
render node in mainline kernel (there are patches in ChromiumOS).

For this the Udev wrapper is extended to search for renderNode devices
and for virtual dri devices.

If either render node or vgem dri device is found, it is tried to be
opened (without logind escalation) and on success a gbm device is
created on it. If any step of this fails the so far default behavior
of default device is tried for creating the EGLDisplay.

All of this is compile optional, so that the virtual platform does not
hard depend on udev and/or gbm.

Test Plan:
Auto tests which need OpenGL executed and verified that they
use the render node or vgem device.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2216
2016-07-21 09:13:57 +02:00
Martin Gräßlin
50645e8dbd [platforms/x11] Properly reposition nested windows on resize events
Summary:
The position of the output being resized was adjusted instead of only
the other outputs.

Test Plan: Resized windows, verified xrandr

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2235
2016-07-20 14:17:50 +02:00
Martin Gräßlin
44843f462f [plugins/qpa] Support SharingPlatformContext on the existing eglSurface and eglconfig
Summary:
So far SharingPlatformContext was only used if the OpenGL context
supports EGL_KHR_surfaceless_context. If not supported, KWin tried to
create a context through the Wayland API. Unfortunately on hwcomposer
platform this results in a crash as libhybris only supports the init
of EGLDisplay for one native platform.

This change tries to also use the SharingPlatformContext if there is
an OpenGL context in general. It reuses the native EGLSurface created
for the compositing scene and makes its own OpenGL context current on
that surface, too. As KWin creates an FBO, it never renders to it, so
it shouldn't matter at all.

In order to prevent EGL_BAD_MATCH errors when making Qt's OpenGL context
current also the EGLConfig from the scene is used to create the context.

Test Plan: Tested on Nexus5 with qtvirtualkeyboard in KWin

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2231
2016-07-20 14:17:11 +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
d0c488f4a2 Announce output changes to Wayland for platforms not handling outputs
Summary:
Most platforms like the nested and virtual do not handle the outputs
themselves and WaylandServer announces the Outputs to Wayland.

So far this was static: at startup it got announced once to Wayland
and any changes were not catched.

This change makes WaylandServer listen to changes to the Screens and
sync them to Wayland.

Unfortunately KWin's internal Screen information is not sufficient to
properly synchronize this to Wayland and also Wayland by not supporting
adding/removing modes does not help.

Thus the solution implemented here is to add new outputs reflecting the
changes and then removing the old ones. This creates situations with more
outputs being present than actually there, but prevents that there are
no outputs at all.

Test Plan: Auto test added which verifies this for the virtual platform

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2233
2016-07-20 13:53:02 +02:00
Martin Gräßlin
a95be71ec1 [plugins/hwcomposer] Use an RGBA_8888 format for rendering surface
Summary:
When sharing surface and config used by the compositor scene with
QtQuick's OpenGL context an RGBA surface makes Qt way more happy.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2232
2016-07-20 13:51:46 +02:00
Martin Gräßlin
bec69b5705 [platforms/wayland] Use XdgShell if available and prefer it
Summary:
With this change the Wayland platform plugin uses the XdgShell to
create the window if available. This allows to close the window and
thus quit the nested kwin_wayland properly.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2201
2016-07-20 07:43:59 +02:00
Martin Gräßlin
5dcaad7fe8 [plugins/qpa] Add debug output in configFromGLFormat
We might need to know what kind of EGLConfig Qt wants.
2016-07-19 08:13:22 +02:00
Martin Gräßlin
54126e4571 [plugins/qpa] Check egl error after a failure of eglMakeCurrent
This hopefully helps to figure out why eglMakeCurrent fails on
hwcomposer platform.
2016-07-18 20:50:56 +02:00
Martin Gräßlin
dce3ea6a20 [plugins/qpa] Add debug output for the KWin internal QPA plugin
Reviewed-By: bshah
2016-07-18 16:34:03 +02:00
Martin Gräßlin
d443e54901 Merge branch 'Plasma/5.7' 2016-07-15 10:05:43 +02:00
Martin Gräßlin
70167b748d [platforms/x11] Add more warning on failure to create EGL context
Some error conditions did not have a warning, so all we got is
"Could not initialize rendering context". Which is not helpful to
figure out what is going wrong.
2016-07-15 08:44:31 +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
57cc02096b Merge branch 'Plasma/5.7' 2016-07-14 13:52:41 +02:00
Martin Gräßlin
f0aeda0738 [platforms/fbdev] Handle error conditions more gracefully
Summary:
So far if the framebuffer platform run into an error on initialization
it did not continue and caused the system to freeze. With this change
it properly emits the initFailed signal in all error conditions which
causes kwin_wayland to terminate. This is a much better situation than
just staying in a running, but frozen state.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2149
2016-07-13 10:11:38 +02:00
Martin Gräßlin
76fa3026dd Merge branch 'Plasma/5.7' 2016-07-13 10:00:35 +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
aaf8ce16df [platforms/fbdev] Properly detect a BGR image format
Summary:
If the format of the framebuffer is BGR we cannot create an RGB image
format from it - the rendering is incorrect. Unfortunately QImage does
not support a BGR image format.

To solve this problem we still use an RGB image format but on rendering
the front buffer is rgbSwapped to convert the RGB image to a BGR image.

BUG: 365243
FIXED-IN: 5.7.2

Test Plan: Tested on a neon kvm

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2134
2016-07-13 09:37:02 +02:00
Martin Gräßlin
4bc0c75df2 Merge branch 'Plasma/5.7' 2016-06-29 09:02:49 +02:00
Martin Gräßlin
758d41d6bf Paint the software cursor directly in SceneQPainter
Summary:
No need to delegate the painting of the software cursor into the backend.
The core has enough information to perform the rendering itself.

This change means less code duplication and all platforms which might use
a software cursor in QPainter compositor gain support for it without any
further adjustments.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2028
2016-06-29 08:50:46 +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
feadcea6ce [platforms] Call setSoftWareCursor in init instead of ctor
Summary:
Platform::setSoftWareCursor creates connections to the Cursor in order
to trigger repaints whenever the cursor position changes. The Cursor is
created before Platform::init is called, but after the Platform is
created. Thus the call needs to happen in init, otherwise the cursor
is not rendered correctly.

BUG: 356328
FIXED-IN: 5.7.0

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2025
2016-06-29 08:48:24 +02:00
Martin Gräßlin
9355d605a0 Drop specifying the default debug areas
Summary: Relict from KDebug times.

Test Plan: Compiles

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D1981
2016-06-28 11:37:22 +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
Martin Gräßlin
2b196bfa29 Move the loadTexture for X11 pixmap functionality to the EglOnXBackend
Summary:
To use eglCreateImageKhr for an X11 pixmap we need an EGLDisplay created
for the same XDisplay as the X11 pixmap. This means if we created an
EGLDisplay for a GBM device, we are not allowed to load a texture from
the X11 pixmap and can result in a crash in the driver.

Similar in the nested X11 setup the EGLDisplay is created for the
rendering window, but the X11 pixmaps are from the Xwayland server KWin
started. They don't belong to the same windowing system.

This change addresses this problem by moving the loading of X11 pixmaps
from AbstractEglTexture to EglTexture of the EglOnX11Backend. Thus for
any usage on a non X11 platform we cannot hit the code path any more.
In addition the nested X11 platform can indicate that it doesn't support
it and thus also doesn't go through the code path.

Test Plan: Tested standalone and nested X11 platform

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1857
2016-06-14 09:10:09 +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
5344bf1619 [plugins/qpa] Handle case that qtvirtualkeyboard plugin is not available more gracefully
We didn't check whether creating the QPlatfromInputContext worked and
accessed the m_inputContext unconditionally which obviously crashed.

Now the connects related to QInputMethods are not setup if we failed
to create the QPlatfromInputContext.

Reviewed-By: bshah
2016-06-02 15:25:31 +02:00
Martin Gräßlin
f26f2fe181 Integrate QtVirtualKeyboard into KWin/Wayland
Summary:
The idea is to have KWin provide a virtual keyboard. To support this
KWin uses the QT_IM_MODULE qtvirtualkeyboard and makes sure that the
QPA plugin loads it.

KWin has a new class VirtualKeyboard which acts as the focus object and
the "proxy" for input methods. The QPA plugin ensures that this is the
focusObject, so that all input method related events are sent to this
class. From there it will be possible to delegate to other applications
through the Wayland interfaces.

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1638
2016-06-02 11:26:53 +02:00
Martin Gräßlin
d0a6aa0836 [platforms/virtual] Support setting random screen geometries
A signal is added to the VirtualBackend to change all screen geometries.
This can be used from auto tests to change the screens. But it's not yet
correctly reflected in other areas. E.g. not forwarded to Wayland Output,
etc.
2016-06-02 09:28:02 +02:00
l10n daemon script
0990566c63 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2016-05-31 11:06:54 +00: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
Martin Gräßlin
7c822fadee Move the OpenGL unsafe check into the Platform
Summary:
A new virtual method createOpenGLSafePoint is added to Platform.
This is invoked through the Compositor with a PreInit and a PostInit
argument pre and post creating the SceneOpenGL.

The Platform plugin can implement this and use it for detecting whether
creating the OpenGL compositor on this platform crashed in the past.
Thus it's the base for the openGLIsBroken platform check.

The x11 standalone plugin is the first to implement this functionality
using the previous code which was designed for X11.

This also means that a crash of the OpenGL compositor during init on
Wayland won't result in OpenGL being disabled.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1582
2016-05-17 14:29:29 +02:00
Martin Gräßlin
48e69b77d9 If glx is not available try to create egl backend
Summary:
So far the OpenGL is unsafe check functionality in Compositor disabled
OpenGL compositing if glx is not available and we are in standalone X11
mode.

This is technically no longer correct for quite some time. Just because
GLX is not available doesn't mean that OpenGL doesn't work. We have an
EGL backend. So let's try to use that if glx is not available.

This change removes the check completely from Compositor. Instead the
standalone x11 plugin checks whether glx is available prior to createing
the glx backend. If not available it falls through to the egl backend.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1581
2016-05-17 14:25:33 +02:00
Martin Gräßlin
d15d3a5ff1 Provide functionality of CompositingPrefs through Platform
Summary:
CompositingPrefs is only relevant for X11 standalone. It had some
"hacks" to make it not block Compositing on Wayland. Thus it was in
its current form not really useful.

Now all the functionality is provided through Platform with a default
implementation which is sensible for Wayland platforms.

The X11 standalone platform implements the new methods with the
Wayland checks removed.

In addition all calls to CompositingPrefs now go through the platform
directly and CompositingPrefs is completely dropped.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1576
2016-05-17 13:59:52 +02:00
Martin Gräßlin
c45942a70c Move requiresCompositing from Application to Platform
Summary:
This change reduces the windowing system specific code pathes. Instead
of checking whether we are on X11 or Wayland to decide whether
compositing is required, we just ask the Platform.

The default is true, only x11 standalone allows to not require
compositing.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1575
2016-05-17 13:59:32 +02:00
Martin Gräßlin
1350653d44 [plugins/qpa] Add support for QT_WAYLAND_FORCE_DPI env variable
Summary:
If a user specifies the QT_WAYLAND_FORCE_DPI env variable, KWin uses
it to force a logicalDPI, just like QtWayland.

Test Plan: Normally sized window decorations

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1605
2016-05-17 07:32:30 +02:00
Martin Gräßlin
8d7d51e4ef Merge branch 'Plasma/5.6'
dont_crash_aurorae_destroy_deco.cpp is adjusted to Platform.
2016-05-12 16:43:12 +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
64f7de4024 [platforms/hwcomposer] Remove integration with VirtualTerminal
The hwcomposer plugin doesn't need it. It was only created for the
need of libinput relying on it. As libinput doesn't need it any more,
hwcomposer doesn't need to integrate with VirtualTerminal.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1444
2016-04-22 14:18:56 +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
l10n daemon script
21f246c279 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2016-04-21 10:02:53 +00:00
l10n daemon script
93034e04cf SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2016-04-20 09:37:30 +00:00
Martin Gräßlin
e73a86d420 Create screen edge through the Platform
Removes a diversion between X11 and Wayland. The base class Platform
creates an instance of class Edge with plugin implementations being
able to create a different type.

The X11StandalonePlugin does that and creates a WindowBasedEdge. For
this the implementation of WindowBasedEdge is moved from screenedges
into the plugin.

Unfortunately an ifdef is needed to make the screenedge test still
work as expected. This should be improved in future, e.g. have a good
way to load the platform plugin from the tests.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1419
2016-04-19 13:29:55 +02:00
l10n daemon script
1309b8c8a0 SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2016-04-16 09:59:16 +00:00
Martin Gräßlin
e4c333a372 Move clients/ to plugins/kdecorations/
Summary:
KWin's plugins are now all in a plugins subdirectory. This is a good
argument to also move the window decoration plugins there. The name
clients was not really good anyway and makes it difficult for people
not familiar with the code base to find it. Having it under plugins
is the more expectable location.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1414
2016-04-15 15:21:03 +02:00
Martin Gräßlin
702b84b925 Move the EglOnXBackend to the x11 platforms
Summary:
The EglOnXBackend is no longer needed in the core. It's only needed by
the two x11 platform plugins. To best share it, it's moved into a common
directory and compiled into a static library which in turn is linked by
the two plugins.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1413
2016-04-15 09:15:20 +02:00
Martin Gräßlin
248991223b Move glxbackend to x11 standalone plugin
Summary:
It's only needed by the standalone x11 variant. This allows us to
simplify the creation of the OpenGLBackend: it's created by the
platform plugin - we don't need custom complex logic.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1392
2016-04-15 07:46:02 +02:00
l10n daemon script
a3cd28a87e SVN_SILENT made messages (.desktop file) - always resolve ours
In case of conflict in i18n, keep the version of the branch "ours"
To resolve a particular conflict, "git checkout --ours path/to/file.desktop"
2016-04-14 09:57:09 +00: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