792 Commits (85d04cf60d5203cf08a8d11fcca4d727f647b5cc)

Author SHA1 Message Date
David Edmundson 85d04cf60d Add ftrace markers
This logs to a tracefs filesystem which can be viewed in tools such as
gpuvis to see precise timings of activities in relation to other trace
markers in X or graphic drivers.

This patch is loosely based on D23114. Though modified with thread
safety, support for string building, and a RAII pattern for durations.
Ultimately that expanded it somewhat.
4 years ago
Vlad Zahorodnii 5bf421ef83 cmake: Specify min version for wayland-protocols 4 years ago
Vlad Zahorodnii 5302094f30 cmake: Link against imported Xinput target 4 years ago
Vlad Zahorodnii b67f743795 cmake: Drop libkwin's unused Xlib dependencies 4 years ago
Vlad Zahorodnii ad5f8c5c59 Introduce RenderJournal
Currently, we estimate the expected render time purely based on the
latency policy.

The problem with doing so is that the real render time might be larger,
this can result in frame drops.

In order to avoid frame drops, we need to take into account previous
render times while estimating the next render time. For now, we just
measure how long it takes to record rendering commands on the CPU.

In the future, we might want consider using OpenGL timer queries for
measuring the real render time, but for now, it's good enough.
4 years ago
Vlad Zahorodnii b8a70e62d5 Introduce RenderLoop
At the moment, our frame scheduling infrastructure is still heavily
based on Xinerama-style rendering. Specifically, we assume that painting
is driven by a single timer, etc.

This change introduces a new type - RenderLoop. Its main purpose is to
drive compositing on a specific output, or in case of X11, on the
overlay window.

With RenderLoop, compositing is synchronized to vblank events. It
exposes the last and the next estimated presentation timestamp. The
expected presentation timestamp can be used by effects to ensure that
animations are synchronized with the upcoming vblank event.

On Wayland, every outputs has its own render loop. On X11, per screen
rendering is not possible, therefore the platform exposes the render
loop for the overlay window. Ideally, the Scene has to expose the
RenderLoop, but as the first step towards better compositing scheduling
it's good as is for the time being.

The RenderLoop tries to minimize the latency by delaying compositing as
close as possible to the next vblank event. One tricky thing about it is
that if compositing is too close to the next vblank event, animations
may become a little bit choppy. However, increasing the latency reduces
the choppiness.

Given that, there is no any "silver bullet" solution for the choppiness
issue, a new option has been added in the Compositing KCM to specify the
amount of latency. By default, it's "Medium," but if a user is not
satisfied with the upstream default, they can tweak it.
4 years ago
Nate Graham 3800181ac2 Revert "cmake: Remove redundant include_directories()"
This reverts commit 9b1ea1c7f7.

This breaks compilation; apparently the include is not implicit and is
thus needed after all.
4 years ago
Vlad Zahorodnii 26b249061e cmake: Remove FindUDev.cmake
It's in extra-cmake-modules now.
4 years ago
Vlad Zahorodnii 9b1ea1c7f7 cmake: Remove redundant include_directories()
libkwin is linked against imported XKB::XKB target. Thus the
include_directories() is redundant.
4 years ago
Vlad Zahorodnii 7e5c16989e Drop hwcomposer backend
Plasma Mobile announced that they plan to drop support for Halium
devices, see the announcement blog post [1] for the reasons that led to
such a decision.

But just to summarize, here are some of the key points from the post:

 * Some of our team members no longer have access to reference LG Nexus
   5X device anymore
 * After KDE Neon switched to using Ubuntu 20.04 we no longer are
   updating the rootfs for halium devices
 * After several important architecture changes in upstream KWin, the
   hwcomposer backend might be broken and we have no way of verifying it

If the community members are interested in reviving the hwcomposer
backend,

  * it pretty much needs rewrite/re-thinking given differences of hwc1
    and hwc2 API for hwcomposer part of it, see also [2]
  * It also needs removal of Android 5 based libhardware API as we don't
    think code can be kept sane with 3 different levels of ifdefs
  * This backend needs better way of fixing difference between
    CAF/non-CAF devices then just recompiling with different headers,
    maybe env vars?
  * This backend does not support various things like transformation/
    rotation etc, and is not exactly feature complete as the DRM backend

[1] https://www.plasma-mobile.org/2020/12/14/plasma-mobile-technical-debt.html
[2] 83f563c339
4 years ago
Vlad Zahorodnii ccfaf1a1d6 cmake: Rework how tabbox is conditionally compiled into libkwin
In modern CMake code, it is highly advised to avoid using variables. One
should instead try to use targets and properties more extensively.
4 years ago
Vlad Zahorodnii 9af78c0e7f cmake: Rework how activities support is compiled into libkwin
In modern CMake code, it is highly advised to avoid using variables. One
should instead try to use targets and properties more extensively.
4 years ago
Vlad Zahorodnii d16c15301f cmake: Rework Findepoxy.cmake
This makes Findepoxy.cmake more upstreamable and easier to use.
4 years ago
Vlad Zahorodnii 79ca5ccd26 Merge OutputScreens into Screens
Since all platforms have been ported to AbstractOutput, OutputScreens
can be merged into Screens. This simplifies the class hierarchy.
4 years ago
Vlad Zahorodnii 64ad9a61d8 Introduce ColorManager component
This change introduces a new component - ColorManager that is
responsible for color management stuff.

At the moment, it's very naive. It is useful only for updating gamma
ramps. But in the future, it will be extended with more CMS-related
features.

The ColorManager depends on lcms2 library. This is an optional
dependency. If lcms2 is not installed, the color manager won't be built.

This also fixes the issue where colord and nightcolor overwrite each
other's gamma ramps. With this change, the ColorManager will resolve the
conflict between two.
4 years ago
Vlad Zahorodnii b06fb6b060 Drop redundant find_package(Qt5Multimedia)
We need the multimedia component only to play preview videos in a KCM.

The find_package(Qt5Multimedia) is not needed because we already check
if Qt5Multimedia QML module is present using ecm_find_qmlmodule().

The main motivation behind this change is to work around constant build
failures caused by buggy config file of the Qt5::Multimedia component.
4 years ago
Aleix Pol 2c6bfdf0b8 --warning
Set -DLIBINPUT_HAS_TOTEM per file rather than per target so that all
targets that build it have the define.
This particular file is also used by some tests and this fixes the
warning that this ifdef resolves at once for all targets.
4 years ago
Vlad Zahorodnii 6b2e6cfd53 Prevent EGL headers from including Xlib headers
One of the annoying things about EGL headers is that they include
platform headers by default, e.g. on X11, it's Xlib.h, etc.

The problem with Xlib.h is that it uses the define compiler directive to
declare constants and those constants have very generic names, e.g.
'None', which typically conflict with enums, etc.

In order to work around bad things coming from Xlib.h, we include
fixx11.h file that contains some workarounds to redefine some Xlib's
types.

There's a flag or rather two flags (EGL_NO_PLATFORM_SPECIFIC_TYPES and
EGL_NO_X11) that are cross-vendor and they can be used to prevent EGL
headers from including platform specific headers, such as Xlib.h [1]

The benefit of setting those two flags is that you can simply include
EGL/egl.h or epoxy/egl.h and the world won't explode due to Xlib.h

MESA_EGL_NO_X11_HEADERS is set to support older versions of Mesa.

[1] https://github.com/KhronosGroup/EGL-Registry/pull/111
4 years ago
Vlad Zahorodnii bdfb946267 Convert Night Color into a plugin
Night Color adjusts the color temperature based on the current time in
your location. It's not a generic color correction module per se.

We need a central component that can be used by both night color and
colord integration to tweak gamma ramps and which will be able to
resolve conflicts between the two. The Night Color manager cannot be
such a thing because of its very specific usecase.

This change converts Night Color into a plugin to prepare some space for
such a component.

The tricky part is that the dbus api of Night Color has "ColorCorrect"
in its name. I'm afraid we cannot do that much about it without breaking
API compatibility.
4 years ago
Vlad Zahorodnii 8f6edea521 Turn krunner integration into a plugin
krunner stuff doesn't really belong in kwin, it has nothing to do with
compositing or any other things that are the domain of compositors.
Given that, being as a plugin suits the krunner integration stuff best.
4 years ago
Vlad Zahorodnii f037a69f1c Introduce colord integration
This change introduces basic colord integration in wayland session. It
is implemented as a binary plugin.

If an output is connected, the plugin will create the corresponding
colord device using the D-Bus API and start monitoring the device for
changes.

When a colord devices changes, the plugin will read the VCGT tag of the
current ICC color profile and apply it.
4 years ago
Vlad Zahorodnii c766e5da6d Introduce infrastructure for compositor extensions
The scripting api is not suitable for implementing all features that
should not be implemented in libkwin. For example, the krunner
integration or screencasting are the things that don't belong to be
compiled right into kwin and yet we don't have any other choice.

This change introduces a quick and dirty plugin infrastructure that
can be used to implement things such as colord integration, krunner
integration, etc.
4 years ago
Vlad Zahorodnii 70393eec6f Consistently name some KF5 integration plugins 4 years ago
Vlad Zahorodnii 0dd2f787ae wayland: Link statically against KIdleTime integration plugin
The main motivation behind this change is to improve startup time. The
Poller class was renamed to avoid potential name conflicts in the future.
4 years ago
Vlad Zahorodnii f3a902911a wayland: Link statically KWindowSystem integration plugin
Without the KWindowSystem integration plugin, Wayland experience will be
negatively affected because windows created by kwin itself won't behave
as desired. Therefore it makes little sense to load this plugin at runtime.
4 years ago
Vlad Zahorodnii 49e0b84d84 wayland: Link statically KGlobalAccel integration plugin
Without the KGlobalAccel integration plugin, Wayland experience will be
negatively affected. Therefore it makes little sense to load it at run-
time.
4 years ago
David Edmundson 5e60e64a5d Bundle QPA plugin directly
On wayland, we know we're always going to load our internal QPA. Instead
of shipping a plugin and loading it dynamically we can use Qt static
plugins.

This should result in slightly faster load times, but also reduce the
number of moving pieces for kwin.

This also prevents anyone outside kwin loading our QPA which wouldn't
have made any sense and just crashed.
4 years ago
Benjamin Port cf4335ca62 Add windows runner
Move windows runner from plasma-workspace to kwin (convert it to dbus runner)

This will allow to interract with windows on wayland too
4 years ago
Vlad Zahorodnii 9c20df5030 screencast: Use fences to avoid stalling the graphics pipeline
Currently, we use glFinish() to ensure that stream consumers don't see
corrupted or rather incomplete buffers. This is a serious issue because
glFinish() not only prevents the gpu from processing new GL commands,
but it also blocks the compositor.

This change addresses the blocking issue by using native fences. With
the proposed change, after finishing recording a frame, a fence is
inserted in the command stream. When the native fence is signaled, the
pending pipewire buffer will be enqueued.

If the EGL_ANDROID_native_fence_sync extension is not supported, we'll
fall back to using glFinish().
4 years ago
Benjamin Port 4acea54272 KCM: Adapt to KCMUtils change 4 years ago
Benjamin Port 7546af6b4c KCM KWin Decoration: Add module data
depends on https://invent.kde.org/frameworks/kcmutils/-/merge_requests/19
4 years ago
Bhushan Shah 474d0344ca autotests: rename to testInputMethod
Relevant class got renamed, also update the test name

Related: plasma/kwin!302
4 years ago
Bhushan Shah 222b558b04 virtualkeyboard: rename class to InputMethod
VirtualKeyboard class does not implement the relevant VirtualKeyboard
protocol but rather implements the InputMethod protcol and can in theory
be used by other input method like e.g. ibus.

Make class name consistent with what it does to avoid confusion in
future.

For now only rename of main class is done and dbus service is kept as-is
to provide retro-compatibility, when input method protocol is
implemented fully, we can think of what to do wrt the dbus interface
later when we fully implement zwp_input_method_unstable_v1 protocol.
4 years ago
Carson Black 02b1e11758 Bump up minimum C++ version to C++17 4 years ago
Bhushan Shah fd917b4e00 Update version number for 5.20.80
GIT_SILENT
4 years ago
Bhushan Shah c5a90a158c Update version number for 5.19.90
GIT_SILENT
4 years ago
Bhushan Shah 8ae28df622 Update qt5 version requirement to 5.15.0
GIT_SILENT
4 years ago
Bhushan Shah b416e204ee Update kf5 version requirement to 5.74
GIT_SILENT
4 years ago
Laurent Montel 07763229eb Remove explicit ECM_KDE_MODULE_DIR 4 years ago
Vlad Zahorodnii 7e9bec6fd7 Use consistent naming pattern for wayland shell integrations
This change intends to fix a minor inconsistency regarding how shell
integration classes are named.
4 years ago
Vlad Zahorodnii 88829de9dd wayland: Refactor creation of input panel clients
This change introduces a shell integration class for input panel
surfaces. This effectively breaks the direct dependency between our
virtual keyboard component in kwin and the input_panel protocol,
which means that an input method server could use the layer-shell
protocol instead of the input_panel protocol.
4 years ago
Vlad Zahorodnii d3cca65d39 Implement the layer-shell v1 protocol
The layer-shell protocol allows wayland clients to create surfaces that
can be used for building desktop environment components such as panels,
notifications, etc.

The support for the plasma-shell protocol will be dropped once plasma in
all its entirety is ported to the layer-shell protocol.
4 years ago
Vlad Zahorodnii 848f7f3177 Revert "plugins/drm: Link against Wayland::Server"
This reverts commit efb9e0edb2.

libwayland-server is now in the link interface of kwayland-server.
4 years ago
Vlad Zahorodnii efb9e0edb2 plugins/drm: Link against Wayland::Server
We need to link against Wayland::Server because the EGL Streams protocol
wrapper uses wl_array in its public API.
4 years ago
Vlad Zahorodnii bfcf312e37 Drop unused libwayland-cursor dependency
KWin doesn't need libwayland-cursor since cb7a9456c0.
4 years ago
Marco Martin 97f4712f29 Fix size restore upon keyboard close in XdgSurfaceClient
in XdgSurfaceClient setFrameGeometry is async,
so we can't rely on it having the final value immediately.
make setVirtualKeyboardGeometry a virtual.
in the implementation on setVirtualKeyboardGeometry
use requestedFrameGeometry() instead of frameGeometry()
4 years ago
Aleix Pol 7aabd45df9 Integrate input-method-unstable-v1 4 years ago
Vlad Zahorodnii 5aef9da884 Lower message severity for KWIN_XWL
When the Xwayland process crashes, we will print a warning message, but
that warning message won't show up anywhere in the terminal because the
current message severity for KWIN_XWL is way too high.

This patch lowers the message severity for the KWIN_XWL logging category
so warning messages can be seen from the terminal.
4 years ago
David Edmundson 405841caf2 Install service files for kwin 4 years ago
Vlad Zahorodnii 2103b999e7 screencast: Address minor issues 4 years ago