Commit graph

13053 commits

Author SHA1 Message Date
Martin Gräßlin
b2f5873a28 [wayland] X11WindowedBackend anounces input support by itself
It's the one knowing what it supports, no need to do it outside.
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
8ff394a020 [wayland] Dedicate logging category for each of the backends 2015-05-05 17:47:03 +02:00
Martin Gräßlin
767ca8d357 [wayland] Don't call into X11WindowedBackend from EglOnXBackend
Instead of having a ctor which takes the backend, it's a ctor which
takes all the information needed from the backend.
2015-05-05 15:35:12 +02:00
Martin Gräßlin
d80984beab [wayland] Move X11WindowedQPainterBackend into backends/x11 2015-05-05 15:23:53 +02:00
Martin Gräßlin
f7bf7cb7ba [wayland] Move WaylandQPainterBackend into backends/wayland 2015-05-05 15:13:36 +02:00
Martin Gräßlin
df6221ae4a [wayland] Move FramebufferQPainterBackend into backends/fbdev 2015-05-05 15:07:01 +02:00
Martin Gräßlin
06d8206192 [wayland] Move DrmQPainterBackend into backends/drm 2015-05-05 13:32:33 +02:00
Martin Gräßlin
72db1e63a3 [wayland] Move backend implementations into a backends/<name> directory
The aim is to be able to create a plugin for each of the backends.
The following directories are created:
* backends/drm
* backends/fbdev
* backends/wayland
* backends/x11
2015-05-05 13:05:37 +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
Sergio Martins
e283bda8e5 Fix unintentional no-op, unite() doesn't change the object
REVIEW: 123618
2015-05-03 22:31:23 +01:00
l10n daemon script
b4c8fa64b8 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"
2015-04-28 13:46:57 +00:00
Martin Gräßlin
b50d6d487b Add modelines to OutputInterfaces in DrmBackend
Each available mode on the connector is added to the
KWayland::Server::OutputInterface for the DrmOutput.

The logic to calculate the refreshRate is highly inspired from Weston's
implementation in compositor-drm.c.
2015-04-28 08:16:07 +02:00
l10n daemon script
dc19c0ed02 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"
2015-04-27 10:23:00 +00:00
Martin Gräßlin
6d3fa98e09 Read EDID in DrmBackend
Documentation for the wonderful EDID format can be found at:
http://read.pudn.com/downloads110/ebook/456020/E-EDID%20Standard.pdf

In case the link breaks: wikipedia also has a good section on it.

We read out the following information:
* EISA code (3 characters)
* serial number
* monitor name (up to 12 characters)
* physical size (stored in cm)

Unfortunately the EDID information cannot be trusted at all.
My 24" screen reports a sice of 16x9 cm. So we need to provide users
a way to overwrite the broken data in an easy way through kwinrc

[EdidOverwrite][EISA code/maker name][monitor name][serial number]
PhysicalSize=trueWidthInMM,trueHeightInMM

Unfortunately monitor name is not a sufficient enough identifier, that's
why serial number is also used. This makes automatic distribution of
overwrites difficult. But in the example above the monitor name is
"SyncMaster" which is a rather broad field in Samsung :-(

The extracted information from EDID is also used to set the corresponding
fields in KWayland::Server::OutputInterface.
2015-04-27 11:06:04 +02:00
l10n daemon script
f4e2e0e2e9 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"
2015-04-25 10:26:32 +00:00
Martin Gräßlin
c52f542261 Fix build of DrmBackend with gbm dependency 2015-04-24 15:14:53 +02:00
Martin Gräßlin
389d81731b DrmOutput creates OutputInterface on init
This automatically announces the OutputInterface when it gets created
and removes it when it gets destroyed again.
2015-04-24 12:03:20 +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
f775e13c6e Improve tracking of DrmBuffers in DrmBackend
We need to prevent double deletions from the gbm callback. Therefore
we track all buffers in DrmBackend and pass the DrmBackend as user
data.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
843bfb8052 React on DrmOutput removed/added in EglGbmBackend
Creates a new gbmsurface and eglsurface, respectively deletes it.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
e298c2d584 React on DrmOutput added/removed in DrmQPainterBackend
For a new DrmOutput a new buffer needs to be created, for a removed
one the existing buffers need to be deleted.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
3a05e4b535 Update ScreensDrm whenever the screens got queried in the DrmBackend
Requires to move the screensQueried signal and disconnect during
Application startup.

As Screens only hold the geometry of each screen and the overall
geometry, there is no need (yet) to update in more detail when a
DrmOutput is added or removed. The overall queried is sufficient.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
7aee69a6b2 Support hotplug events for outputs in DrmBackend
The DrmBackend installs a UdevMonitor to listen for output hotplug
events. Whenever a hotplug event occurrs the resources are queried
again and a signal is emitted for each removed and added output.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
d9a29f3a49 [udev] Add wrapper for udev_monitor 2015-04-24 12:03:20 +02:00
Martin Gräßlin
cf27a056b8 [udev] Read property on UdevDevice 2015-04-24 12:03:20 +02:00
Martin Gräßlin
2a64755b76 Improve the rendering per output in SceneOpenGL/EglGbmBackend
The complete rendering is now splitted per output including present which
means that we only need to make the context per output current once per
rendering.

Unfortunately our architecture does not properly support gathering the
damage for multiple outputs. In fact the damage information is lost after
the first output got rendered. Thus we currently only support buffer age
for the first output, on other outputs full repaints are caused.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
c33a74ae58 [drm] Drop DrmBackend::present without DrmOutput*
Only the variant taking both buffer and output are used now.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
e650eef323 [drm] Find correct crtc/encoder/connector combination
We need to verify that a given crtc is not used already for one of
the created DrmOutputs.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
7c8c1dac0a [SceneOpenGL] Render per DrmOutput in EglGbmBackend
For each DrmOutput a gbm_surface and EglSurface is created. When
rendering per screen the context is made current on each of the
surfaces.

Note: viewport handling needs to be improved by e.g. passing through
the scene to restore to correct viewport after dropping an FBO.

Furthermore it seems like buffer age is not working correctly in this
setup (not overly surprising).

Dynamic changes are not yet supported.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
5c79f777a4 [SceneQPainter] Render per DrmOutput in DrmQPainterBackend
For each DrmOutput a set of buffers is created and presented. The
renderig is still in one go and not synced to the individual screens.

Dynamic changes are not yet supported.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
9133c0f9d5 [SceneQPainter] Per-Screen rendering
The backend can indicate that the rendering needs to be split per screen.
In that case it has to provide a different rendering buffer per screen.
The painting in the scene is adjusted to either take a splitted path
or the existing path for all screens in one go.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
600b3cd2c1 Allow presenting a DrmBuffer on a dedicated DrmOutput 2015-04-24 12:03:20 +02:00
Martin Gräßlin
fcc895180b [drm] Better support for multiple outputs in DrmScreens
We get the DrmOutputs from the backend to properly set count, size and
geometry of the outputs.

Dynamic changes are not yet supported.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
6d6c951402 Set the drm mode again when stride changed compared to previous buffer
Includes better error handling for when page flip failed. If it fails,
we shouldn't set the current buffer as otherwise each new attempt to
present a buffer will fail, too.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
8278ae8487 Handle session deactivate and restore in DRM backend
* blocks compositor while session is inactive
* prevents page flips while session is inactive
* restores modes when going to inactive
* hides cursor when going to inactive
* blanks screens when going active
* shows cursor again when going active
* triggers a repaint when going active
2015-04-24 12:03:20 +02:00
Martin Gräßlin
3a9adcac91 Connect to Logind's PauseDevice signal
If it emits a "pause" signal, we must acknowledge that we paused the
device.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
2c5337074f First deactivate VirtualTerminal, then notify kernel that we are ready to switch 2015-04-24 12:03:19 +02:00
Martin Gräßlin
9efada5bb6 Set VirtualTerminal into KD_GRAPHICS mode 2015-04-24 12:03:19 +02:00
Martin Gräßlin
efa0500313 [libinput] Bind libinput support to VirtualTerminal
This change is motivated by the fact that we need to suspend libinput
before switching the virtual terminal. Also we don't want to take over
libinput if we do not have a VirtualTerminal created - in windowed mode
we don't want libinput to be started. So binding it to the backends which
create the VirtualTerminal makes sense.

The KWin::Application gains a new signal virtualTerminalCreated which is
emitted from VirtualTerminal once it's properly setup. This is used by
Input to create Libinput integration instead of binding it to logind.

Furthermore Libinput gets suspended when the VirtualTerminal reports that
it is no longer active. For re-activation we still just use logind's
session active property.
2015-04-24 12:03:19 +02:00
Martin Gräßlin
2f312f35c9 Add a DrmOutput class to be used by the DrmBackend
The DrmOutput corresponds to one output we perform mode setting on.
This implies that page flip is now performed on the DrmOutput. As our
compositor cannot drive multiple outputs yet, we only use the first one
and call into bufferSwapComplete and aboutToBufferSwap when either all
page flips are completed or respectivly the first one is performed.

Setting cursor is also handled on each DrmOutput.

When the DrmOutput is initialized it is blanked with a black buffer which
gets destroyed once the first page flip event has occurred (meanig the
buffer is no longer needed). Before setting the black buffer we store the
current buffer which will be set back on tear down. Because of that
tearing down the DrmBackend needs to wait till all page flips ended.
2015-04-24 12:03:19 +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
877c33fe7d Initial implementation of EglGbmBackend
Uses EGL_MESA_platform_gbm to get an EglDisplay from a gbm_device.
The DrmBackend can provide a DrmBuffer for a gbm_surface and present
it.

Unfortunately buffer age seems to be slightly broken and we still have
artefacts.
2015-04-24 12:03:19 +02:00
Martin Gräßlin
3a7d0c395e Page flip event support in drm backend 2015-04-24 12:03:19 +02:00
Martin Gräßlin
c759551340 [wayland] Add a basic drm/kms backend
Introduces a new (optional) dependency: libdrm.

The DrmBackend currently supports finding the first connected output.
It can create shared memory buffers which are used by SceneQPainter to
do double buffered rendering.

There is still lots to do, the following things are not yet working:
* multiple outputs
* page flip
* OpenGL (through gbm)
* restoring mode setting to start value
2015-04-24 12:03:19 +02:00
Martin Gräßlin
da3f7914f7 [framebuffer_backend] Delay VirtualTerminal::init till we have logind control 2015-04-24 12:03:19 +02:00
Martin Gräßlin
f135d92c00 [udev] Find the primary gpu by iterating drm devices 2015-04-24 12:03:19 +02:00