56 Commits (master)

Author SHA1 Message Date
Vlad Zahorodnii d7b1661e08 Merge libkwineffects into libkwin
libkwineffects was introduced when kwin used to be an executable. It
provided an api to implement effects and shielded from the technical
quirks in kwin.

Over the time, kwin internals had been split and abstractions were
refactored so they can be consumed in scripts or plugins. Besides that,
new ways to implement extensions have been introduced, which use
kwin's internal abstractions.

On the other hand, effects continue using libkwineffects specific apis.
This has a few issues: qtquick effects use both apis and it bites us,
duplicating same apis.

The best solution so far is to merge libkwineffects with libkwin, and
replace libkwineffects abstractions with libkwin abstractions, e.g.
EffectScreen -> Output, etc. This change takes care of adjusting libs.

Obviously, the main disadvantage of doing so is that binary effects
have to be recompiled every time new libkwin is released. But it's
already the case with libkwineffects too.
11 months ago
Laurent Montel bc6116c5a7 There's no QVector anymore, QList is the QVector in Qt6 11 months ago
Xaver Hugl e401f3ff11 libkwineffects: drop gallium detection
It's not used anywhere
1 year ago
Xaver Hugl 6d35a27f90 libkwineffects: drop checks for GLSL and NPOT
Instead, creating contexts that miss these features should fail directly,
making KWin fall back to software rendering.
While this commit also drops workarounds for broken drivers that do software
emulation for features we need, such workarounds belong into these drivers and
the user can still manually turn off compositing if needed.
1 year ago
Xaver Hugl ed02051a4a libkwineffects: move x server version query to xcb utils 1 year ago
Xaver Hugl a5df88b0de libkwineffects: move linux kernel version query out of GLPlatform
It has nothing to do with OpenGL
1 year ago
Xaver Hugl e0c7878357 libkwineffects: move version into its own files 1 year ago
Xaver Hugl 5ce02c6811 libkwineffects: drop limited glsl detection
It's not actually used anywhere
1 year ago
Xaver Hugl 27f90476b4 libkwineffects: rename kwingl* files to gl* 1 year ago
Xaver Hugl 02b996cf9c platformsupport/scenes/opengl: add opengl render query class 1 year ago
Laurent Montel 86c6238cfa Don't use QtTest => use QTest + missing include 1 year ago
Xaver Hugl 57c7eccb32 libkwineffects: extract most useful kwinglplatform bits to a separate class 1 year ago
Vlad Zahorodnii e88a4e34a3 Remove some include_directories()
It seems we've settled on dir/dir/header.h includes, so let's use them
consistently.
2 years ago
Hannah Kiekens 0543949df7 Enable GLSL for Mali (Lima) / PinePhone devices
Commit 88cf8355 changed the behaviour of Mali (Lima) / PinePhone devices by disabling GLSL
88cf8355 got backported in 5.27.1 and broke PinePhone devices (White rectangle on topright quarter of a black screen)

This patch restores the behaviour of 5.27.0
2 years ago
Vlad Zahorodnii 10df3b0eb0 Remove Qt 5 specific code 2 years ago
Vlad Zahorodnii d9f5d432be Port to KF6 2 years ago
Tomasz Paweł Gajc 88cf83554f add support for Lima, V3D, VC4 (based on https://github.com/OpenMandrivaAssociation/kwin/blob/master/kwin-5.21.4-add-support-for-panfrost-driver.patch made by Bernhard Rosenkraenzer) and update list of supported devices for Panfrost 2 years ago
Vlad Zahorodnii 7fffe99328 build: Add -Wno-unused-parameter compiler option
Due to being a compositor, kwin has to conform to some certain
interfaces. It means a lot of virtual functions and function tables to
integrate with C APIs. Naturally, we not always want to use every
argument in such functions.

Since we get -Wunused-parameter from -Wall, we have to plumb those
unused arguments in order to suppress compiler warnings at the moment.

However, I don't think that extra work is worth it. We cannot change or
alter prototypes in any way to fix the warning the desired way. Q_UNUSED
and similar macros are not good indicators of whether an argument is
used too, we tend to overlook putting or removing those macros. I've
also noticed that Q_UNUSED are not used to guide us with the removal no
longer needed parameters.

Therefore, I think it's worth adding -Wno-unused-parameter compiler
option to stop the compiler producing warnings about unused parameters.
It changes nothing except that we don't need to put Q_UNUSED anymore,
which can be really cumbersome sometimes. Note that it doesn't affect
unused variables, you'll still get a -Wunused-variable compiler warning
if a variable is unused.
2 years ago
Vlad Zahorodnii 495e127d07 autotests: Fix windowquadlist with Qt 6
In Qt 6, container.count() returns a qsizetype, on the other hand
expectedCount is int. That type difference makes QTEST panic.
2 years ago
Vlad Zahorodnii f3b291bce0 Make TimeLine API ergonomic with presentation timestamps
Currently, if you want to use TimeLine, you need to track the last
presentation timestamp which boils down to carrying some boilerplate
code.

The current situation can be improved by making TimeLine work with
presentation timestamps.

Part-of: <https://invent.kde.org/plasma/kwin/-/merge_requests/2473>
2 years ago
Vlad Zahorodnii e293972eaa Run clang-tidy with -checks=readability-braces-around-statements fixit
This fixes style issues in old code.
3 years ago
Vlad Zahorodnii 7096e3ead8 Run clang-format
The .clang-format file is based on the one in ECM except the following
style options:

 - AlwaysBreakBeforeMultilineStrings
 - BinPackArguments
 - BinPackParameters
 - ColumnLimit
 - BreakBeforeBraces
 - KeepEmptyLinesAtTheStartOfBlocks
3 years ago
Volker Krause 57e0119d23 Adapt to Qt6's removal of Qt::X11Extras 3 years ago
Vlad Zahorodnii b494efb23e autotests: Fix kwinglplatformtest
OpenGL2Compositing enum was replaced with OpenGLCompositing.
3 years ago
Vlad Zahorodnii 4af9d6c234 kwineffects: Remove unused WindowVertex and WindowQuad props
Since window quads are no longer passed in prePaintWindow(), we don't
need to track original vertex coords. This results in smaller memory
footprint.
3 years ago
Vlad Zahorodnii 29cc319455 kwineffects: Remove WindowQuadType
The window quad type has become irrelevant.
3 years ago
Vlad Zahorodnii 811beb94e0 Remove Xrender backend
The Xrender backend was added at the time when OpenGL drivers were not
particularly stable. Nowadays though, it's a totally different situation.

The OpenGL render backend has been the default one for many years. It's
quite stable, and it allows implementing many advanced features that
other render backends don't.

Many features are not tested with it during the development cycle; the
only time when it is noticed is when changes in other parts of kwin break
the build in the xrender backend. Effectively, the xrender backend is
unmaintained nowadays.

Given that the xrender backend is effectively unmaintained and our focus
being shifted towards wayland, this change drops the xrender backend in
favor of the opengl backend.

Besides being de-facto unmaintained, another issue is that QtQuick does
not support and most likely will never support the Xrender API. This
poses a problem as we want thumbnail items to be natively integrated in
the qtquick scene graph.
3 years ago
Vlad Zahorodnii 6a57fa286e autotests: Fix a few typos in kwinglplatformtest 3 years ago
Tomasz Paweł Gajc e9fcd9584e effects: add support Panfrost Mali driver 3 years ago
Vlad Zahorodnii 93e0265e4e Move source code to src/ directory
Once in a while, we receive complaints from other fellow KDE developers
about the file organization of kwin. This change addresses some of those
complaints by moving all of source code in a separate directory, src/,
thus making the project structure more traditional. Things such as tests
are kept in their own toplevel directories.

This change may wreak havoc on merge requests that add new files to kwin,
but if a patch modifies an already existing file, git should be smart
enough to figure out that the file has been relocated.

We may potentially split the src/ directory further to make navigating
the source code easier, but hopefully this is good enough already.
4 years ago
Vlad Zahorodnii cfb212e470 Detect more Intel GPUs
This allows detecting Intel GPUs up to Xe graphics.
4 years ago
Nicolas Fella 99947c8bd8 Use versionless Qt cmake target
This makes it easier to build against both Qt5 and Qt6

GIT_SILENT
4 years ago
Vlad Zahorodnii 3305089ab3 kwineffects: Fix detection of Radeon GPUs 4 years ago
Vlad Zahorodnii 7301564e4f Use bilinear interpolation to compute texture coords of subquads
On Wayland, a surface must be displayed the same way no matter how the
attached buffer is transformed. In order to guarantee that, we build the
surface-to-buffer matrix, which is used to compute the texture coords.

The surface-to-buffer matrix represents an affine transformation. Thus,
performing linear interpolation between texture coordinates won't end up
in corrupted rendered results. This is the main assumption that we make
during generation of contents window quads. After creating a sub-quad,
the new quad's texture coordinates are computed by interpolating between
the source quad's texture coords.

However, WindowQuad::makeSubQuad() makes a concrete assumption about the
order of texture coords, which might be false if the attached wayland
buffer is rotated 90 or 270 degrees.

This issue went unnoticed after merging the viewporter patches because
the developer who was working on it had been using primarily nested
kwin_wayland for testing purposes. And it appears like kwin schedules
full screen repaints even though it supports buffer age. It still needs
some investigation why that happens.

BUG: 428003
4 years ago
Fabian Vogt 96635ea29c Detect softpipe and llvmpipe on Mesa 20.2+
It seems like the vendor string changed from "VMware Inc." to "Mesa/X.org".
4 years ago
Vlad Zahorodnii 4ce853e8e4 Prettify license headers 4 years ago
Vlad Zahorodnii 1fb9f6f13a Switch to SPDX license markers
The main advantage of SPDX license identifiers over the traditional
license headers is that it's more difficult to overlook inappropriate
licenses for kwin, for example GPL 3. We also don't have to copy a
lot of boilerplate text.

In order to create this change, I ran licensedigger -r -c from the
toplevel source directory.
4 years ago
Vlad Zahorodnii ab9a9c8428 [libkwineffects] Detect AMD Navi GPUs
Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27168
5 years ago
Vlad Zahorodnii 55b4912004 Update my email address 5 years ago
Martin Flöser 92197242ce Add support for virgl in GLPlatform
Summary:
This change adds detection support for virgl (Mesa gallium virtio guest driver).
Results in proper detection in supportInformation and debug console.

Test Plan: Modified test passes, run KWin_Wayland in kvm with virgl and verified supportInformation

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25056
5 years ago
Vlad Zahorodnii f93875535c Update my last name 5 years ago
Vlad Zagorodniy 9b9d97db2b [libkwineffects] Detect modern Radeon GPUs
Summary:
Currently, KWin is not able to detect Radeon GPUs with GCN architecture.
This patch tries to address that.

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: graesslin, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D17715
6 years ago
Vlad Zagorodniy e02573263f [libkwineffects] Introduce timeline redirect modes
Summary:
The redirect modes control behavior of the timeline when its direction
is changed at the start or target position. For example, consider the
following piece of code:

    TimeLine timeLine(1000ms, TimeLine::Forward);
    timeLine.setDirection(TimeLine::Backward);

What should happen when the direction of the timeline was changed to go
backward? Should the current value of the timeline go from 1 to 0, or
should the timeline stop its "execution"?

In the relaxed mode, the timeline will go from 1 to 0.
In the strict mode, the timeline will stop its execution.

Different effects may prefer different modes for source and target
positions. For example, most C++ effect would prefer relaxed mode for
source position, and strict mode for target position. On the other side,
scripted effects(AnimationEffect) would prefer strict mode for source
position, and relaxed mode for target position(because of set).

Reviewers: #kwin, graesslin

Reviewed By: #kwin, graesslin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16447
6 years ago
Vlad Zagorodniy ee88951b17 [libkwineffects] Add TimeLine helper
Summary:
Most effects use QTimeLine in the following manner

```lang=cpp
if (...) {
    m_timeline->setCurrentTime(m_timeline->currentTime() + time);
} else {
    m_timeline->setCurrentTime(m_timeline->currentTime() - time);
}
```

Because effects do not rely on a timer that QTimeLine has, they can't
toggle direction of the QTimeLine, which makes somewhat harder to write
effects. In some cases that's obvious what condition to use to figure
out whether to add or subtract `time`, but there are cases when it's
not. In addition to that, setCurrentTime allows to have negative
currentTime, which in some cases causes bugs.

And overall, the way effects use QTimeLine is really hack-ish. It makes
more sense just to use an integer accumulator(like the Fall Apart
effect is doing) than to use QTimeLine.

Another problem with QTimeLine is that it's a QObject and some effects
do

```lang=cpp
class WindowInfo
{
public:
    ~WindowInfo();

    QTimeLine *timeLine;
};

WindowInfo::~WindowInfo()
{
    delete timeLine;
}

// ...

QHash<EffectWindow*, WindowInfo> m_windows;
```

which is unsafe.

This change adds the TimeLine class. The TimeLine class is a timeline
helper that designed specifically for needs of effects.

Demo

```lang=cpp
TimeLine timeLine(1000, TimeLine::Forward);
timeLine.setEasingCurve(QEasingCurve::Linear);

timeLine.value(); // 0.0
timeLine.running(); // false
timeLine.done(); // false

timeLine.update(420);
timeLine.value(); // 0.42
timeLine.running(); // true
timeLine.done(); // false

timeLine.toggleDirection();
timeLine.value(); // 0.42
timeLine.running(); // true
timeLine.done(); // false

timeLine.update(100);
timeLine.value(); // 0.32
timeLine.running(); // true
timeLine.done(); // false

timeLine.update(1000);
timeLine.value(); // 0.0
timeLine.running(); // false
timeLine.done(); // true
```

Test Plan: Ran tests.

Reviewers: #kwin, davidedmundson, graesslin

Reviewed By: #kwin, davidedmundson, graesslin

Subscribers: romangg, graesslin, anthonyfieroni, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13740
6 years ago
David Edmundson a3cff85e7a Remove Qt module declarations in includes
Summary:
Test Plan: Compiles

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D13359
6 years ago
Fabian Vogt e302f87598 Properly detect Gallium drivers with newer Mesa
Summary:
The renderer string does not contain "Gallium 0.4 on" anymore,
instead it directly contains the gallium driver's name.
So assume that every unknown renderer is a gallium driver.

Test Plan: Added a testcase, it succeeds only with this patch.

Reviewers: #plasma, graesslin

Subscribers: kwin, plasma-devel, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D9495
7 years ago
Martin Flöser 1c61e61119 [autotests] Support new way to run the tests without need to install
Summary:
KWin was quite good in ensuring that you don't need to install by
passing paths to the tests. The new way is much nicer, so code is
adjusted for the new way. Also if we require a newer ECM in future we
need to support the new way.

No guarantee that the tests don't pick something up from the system env,
that needs more testing.

References: https://community.kde.org/Guidelines_and_HOWTOs/Making_apps_run_uninstalled

Test Plan: The tests which loaded helpers pass

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7543
7 years ago
Martin Gräßlin 356510b0aa [libkwineffects] Port getXServerVersion from X11 to xcb
Removes one of the last pure XLib usages and also means that in theory
we can detect the Xwayland version number. In practice that only works
when restarting the compositor as detect is invoked before the XWayland
connection is created.
8 years ago
Martin Gräßlin 83d8181675 [libkwinglutils] Revert version hack for Qualcomm Adreno on libhybris
The idea to set proper version is good, but it results in epoxy
thinking it does not have the entry points and terminating KWin.
8 years ago
Martin Gräßlin a5c8356d40 [libkwineffects] Add detection code for Qualcomm Adreno to GLPlatform
Summary:
The Qualcom Adreno classes are recognized and a version detection
workaround is added for libhybris which only announces GLES version 2
although GLES version 3 is supported. KWin at least used to work with
GLES version 3 which gives us e.g. framebuffer blit.

Reviewers: #kwin, bshah

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2415
8 years ago