Commit Graph

562 Commits (9300aa82be77ee23c346b85fb49091ab9728aba0)

Author SHA1 Message Date
Martin Flöser d71792378e Fix rendering issues of subsurfaces by using proper clipping
Summary:
Rendering subsurfaces in the OpenGL compositor has always resulted in
flickering when a subsurface gets repainted and there is a window on top
of it. Looking at the code this is rather obvious: the clipping of the
main window is ignored and the complete subsurface is rendered as is and
thus also rendering above windows where it should not render.

This change passes the clip region and whether hardware clipping is used
to the rendering of subsurfaces which in turn uses it for rendering the
texture.

BUG: 385924
FIXED-IN: 5.11.3

Test Plan:
Opened systemsettings, went to decoration KCM, put a window
partially above and scrolled. Without change: strong flicker, with change:
no flicker.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8369
2017-10-31 10:35:04 +01:00
David Edmundson 69b2c2fcea Set scale on glScissor calls
Summary:
glScissor works on window co-ordinates. i.e not scaled by the viewport
We need to multiply by the scale there.

This fixes a minor visual glitch in animations when using hardware
clipping.

Test Plan:
Hardcoded my minimise animation to be really slow.
Now every frame looks perfect

Reviewers: #kwin

Subscribers: kpiwowarski, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8490
2017-10-26 17:32:47 +01:00
David Edmundson 1783fda30e Make sure OpenGL Context is valid before deleting shader
Summary:
Deleting the lanczos filter deletes it's GLShader, this calls
glDeleteProgram

glFooBar always needs to have an openGL context, we don't know we have
this on a screen changed event as it is called from outside the normal
render methods.

BUG: 384884

Test Plan:
Ran on my wayland session. Switched geometry a lot, couldn't reproduce the crash.
Ran on my desktop session, seemed the same as before

Reviewers: #plasma, graesslin

Reviewed By: #plasma, graesslin

Subscribers: graesslin, plasma-devel, kwin, #kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D7888
2017-09-20 17:46:27 +01:00
Martin Flöser 8015e4e84e Add virtual method to Scene to get the EGL/GLX extensions
Summary:
We had a few places (e.g. DebugConsole, Platform) where the Scene was
cased into a SceneOpenGL to access the backend and get the extensions.

This change simplifies that by adding a virtual method to Scene directly
which is implemented in SceneOpenGL and returns the backend's
extensions.

Thus the casts to SceneOpenGL are no longer required.

Test Plan:
Opened debug console to verify extensions are listed,
triggered Outline to verify the sharing QPA context gets created.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7734
2017-09-12 17:36:03 +02:00
Martin Flöser 3e0e26204f Create SyncManager only when using X11
Summary:
The SyncManager is highly X11 dependent and doesn't make much sense on
Wayland. It should already be guarded by the check for
GL_EXT_x11_sync_object, but better be safe than sorry, so explicit check
for on X11.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7514
2017-09-01 18:05:55 +02:00
Martin Flöser eee2ace6a1 Make Q_FALLTHROUGH code compile with Qt < 5.8
sorry for breaking FreeBSD CI build. I didn't expect Q_FALLTHROUGH being
newer.
2017-07-27 21:51:47 +02:00
Martin Flöser 4b89011099 Fix (incorrect) implicit-fallthrough warnings in gcc7
All cases are annotated that it's an explicit fallthrough, so add
Q_FALLTHROUGH to silence the warning.
2017-07-27 20:46:44 +02:00
Martin Gräßlin 88e56f630b Raise minimum required Mesa version to 10.0
Summary:
The currently minimum required Mesa version was 8.0 and KWin had special
caseing for Mesa 9.1. This is no longer realistic, no distribution
provides such an old Mesa version. So let's increase the version a
little bit.

Overview of Mesa versions supported by distributions:
 * Debian stable (stretch): 13.0
 * Debian oldstable (jessie): 10.3
 * Debian oldstable backports: 13.0
 * Debian oldoldstable (wheezy): 8.0
 * Ubuntu 16.04 LTS: 11.2
 * Ubuntu 16.04 LTS updates: 12.0
 * Ubuntu 17.04: 17.0
 * openSUSE Tumbleweed: 17.1
 * openSUSE Leap 42.2: 11.2
 * openSUSE Leap 42.3: 17.0
 * Arch: 17.1
 * Fedora 24: 12.0
 * Fedora 25: 17.0
 * Fedora 26: 17.1

Test Plan: Compiles

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D6462
2017-07-06 20:45:58 +02:00
Martin Flöser a6d0bc276d Merge branch 'Plasma/5.10' 2017-06-26 22:11:46 +02:00
Oleg Chernovskiy 247ef43f68
Implement software cursor in OpenGL backend
This change is needed for Wayland screen recording apps to work
correctly. With this change the cursor is actually visible using GBM
buffer passing protocol.

Previously OpenGL backend did not support software cursor. If launching
in DRM/OpenGL mode with flicked on software cursor it only rendered
scene, but not the cursor image.

Differential Revision: https://phabricator.kde.org/D6186
2017-06-26 08:46:21 +03:00
David Edmundson b7cb301deb Make shadows work for windows 100% width or height
Summary:
Clients provide shadows as 9 images, which then get split into relevant quads.
To work out the full width we need the size of an item on the left, the middle and the right.

Some elements can be legitiamtely missing so to work out the width of the left edge we need to consider
all 3 of topleft,left,bottomleft.

Currently we checked both corners in case one was missing, but it's legitimate for both to be missing if the shadow
stretches the whole way.

BUG: 380825

Test Plan: Shadow on panel, rest looks the same

Reviewers: #plasma, mart

Reviewed By: #plasma, mart

Subscribers: graesslin, mart, plasma-devel, kwin, #kwin

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6164
2017-06-20 15:48:41 +01:00
David Edmundson 9ce5832e11 Store GLRenderTarget::scale
Summary:
GLRenderTarget already stores the translation from global compositor
space to the render target co-ordinates, we also need a scale factor for
the exact same reasons.

Test Plan: Used in various effects after this patch and it works there.

Reviewers: #plasma

Subscribers: plasma-devel, kwin, #kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D4948
2017-04-28 10:23:13 +01:00
David Edmundson 61bb907bb4 Scale openGL sub surfaces
Test Plan: Opened a module in system settings that uses QtQuick, confirmed it's the right size

Reviewers: #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3503
2017-03-29 20:53:22 +01:00
Martin Gräßlin 17e0bad922 Drop OpenGL based color correction from KWin
Summary:
The feature has always been considered experimental. Unfortunately it is
completely unmaintained and hasn't seen any commits in years. It
requires kolor-manager to function, but that has not seen a release
based on frameworks yet. This makes it difficult to maintain. In fact I
have never been able from the introduction till now to setup a color
corrected system. One needs kolor-manager and oyranos and especially the
latter is hardly available on any linux distribution (e.g. not on the
Debian/Ubuntu systems).

Due to being unmaintained color correction in KWin did not keep up with
recent changes. Neither did it see any updates during the xlib->xcb
port, nor during the Wayland port. Especially the Wayland port with the
rendering changes make it unlikely to function correctly. E.g. Wayland
introduced a proper per-screen rendering, while color correction did a
"fake" per screen rendering. How that is going to work in combination is
something nobody ever tried. Now after the introduction of proper
per-screen rendering the solution would be to port color correction to
the new api, but that never happened.

Color correction also modified the shaders, but a newer shader API got
introduced some time ago. Whether the color correction shader support
that or not, is unknown to me. Also which shader language versions are
supported. I know it was based on 3d texture support, which back on
introduction was partially lacking in OpenGL ES. Nowadays that changed,
but color correction didn't update.

Last but not least it is completely X11 based and there is no work on
how to make it work with Wayland.

Given all the problems, especially the fact that it is unmaintained and
cannot be setup on my system, means to me that the only solution is to
remove it.

I'm open to having it reintroduced in future, but only if the
availability on Linux distributions gets addressed before. As long as
major linux distributions do not ship this feature, it should not be in
KWin. Given that I must say that it was a mistake to add it in the first
place and I need to point out that I was against the merge back then.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3402
2016-11-22 07:16:51 +01:00
Martin Gräßlin 54ca4a9b55 Merge branch 'Plasma/5.8' 2016-10-28 16:43:04 +02:00
Martin Gräßlin 37067f538e Ensure the complete decoration texture gets repainted on recreation
Summary:
When the decoration size changes the textures get recreated and need to
be properly filled. So far KWin used the scheduled repaint geometry in
this situation. If the decoration didn't schedule the complete geometry
for repain there will be an empty area in the decoration texture.

This change ensures that the complete texture gets repainted when they
are recreated. Thus the decoration rendering is more fault tolerant
towards potential bugs in the decoration. With no-compositing and XRender
compositing this problem was not reproducable and already fault tolerant,
so OpenGL just catches up with the other modes.

BUG: 371735
FIXED-IN: 5.8.3

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3186
2016-10-28 16:06:57 +02:00
Martin Gräßlin f792c82528 Call GLRenderTarget::setVirtualScreenGeometry prior to self test
Summary:
The shader self test uses GLRenderTarget and restores the viewport. Due
to the setVirtualScreenGeometry not being set the calculated viewport is
incorrect and any rendering breaks. This is a regression introduced with
1708278a45 which only affects Wayland
backends which do not perform per screen rendering.

The glxbackend was not affected as it sets the viewport on screen
geometry change.

Reviewers: bshah, #plasma_on_wayland, #kwin

Reviewed By: bshah, #plasma_on_wayland, #kwin

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3155
2016-10-25 14:14:25 +05:30
Martin Gräßlin 359224a5dc Pass the current output geometry to ScreenPaintData
Summary:
On Wayland per output rendering is performed and paintScreen is invoked
for every output. Some effects need the information which output is
currently being rendered as otherwise e.g. FBO access could fail.

This change adds the current output geometry to ScreenPaintData. On X11
(all outputs one geometry) this information is not set and a null rect
is returned. That way the effects can also easily check which rendering
mode is used.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3058
2016-10-17 09:02:30 +02:00
Martin Gräßlin 4e9a1eeb50 Fix glBlitFramebuffer for per-output rendering
Summary:
This is similar to ff6e042c7f just for
GLRenderTarget instead of GLVertexBuffer. The reasoning is the same: on
Wayland KWin has one native window per screen and needs to adjust the
blit target depending on the area.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3056
2016-10-17 09:01:45 +02:00
Martin Gräßlin ff6e042c7f Fix scissoring of VBO rendering in multi-screen setup on Wayland
Summary:
On Wayland in multi-screen a "window" is used to render to per screen.
In OpenGL every "window" is at 0/0 and scissoring is in respect to the
window geometry. The rendering geometry passed to VBO rendering, which
performs the scissoring, is in virtual combined screen geometry space.
Thus the scissoring always removes any rendering on the second screen.
This results in e.g. wobbly windows not working on any additional screen
on Wayland.

This change makes the VBO rendering multi-screen aware by passing the
current virtual window geometry in each rendering pass. That replaces
the so far used virtual screen size. For single screen rendering or
multi-screen rendering on X11 this doesn't change anything as there is
always only one OpenGL window and the screen geoemetry starts at 0/0.
Thus the subtracting of x/y geometry do not affect the scissoring at
all.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2955
2016-10-06 13:30:04 +02:00
Martin Gräßlin 0bb1f2e7bf Make WindowPixmap::isValid virtual and override in concrete implementation
Summary:
If a buffer gets destroyed the texture created from it is still valid.
In such a situation the OpenGLWindowPixmap should return true for isValid
and not false as it did. Similar in QPainter compositor the pixmap is
valid if there is an image copied from the buffer.

This change ensures that for example minimizing an XWayland window
still has a texture during the minimize animation.

BUG: 368440

Test Plan:
Minimize animation plays for X windows and minimized windows
are shown in present windows.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2724
2016-09-14 10:23:35 +02:00
Martin Gräßlin 142aab2e24 Introduce an EffectsHandler::animationsSupported -> bool
Summary:
A new method to tell the effects system whether the compositor scene
is able to drive animations. E.g. on software emulation (llvmpipe) it's
better to not do any animations at all.

This information can be used by effects to adjust their behavior, e.g.
PresentWindows could skip transitions or effects can use it in their
supported check to completely disable themselves.

As a first step all scripted effects are considered to be unsupported
if animations are not supported. They inherit AnimationEffect and are
all about driving animations.

The information whether animations are supported comes from the Scene.
It's implemented in the following way:
 * XRender: animations are always supported
 * QPainter: animations are never supported
 * OpenGL: animations are supported, except for software emulation

In addition - for easier testing - there is a new env variable
KWIN_EFFECTS_FORCE_ANIMATIONS to overwrite the selection.

Reviewers: #kwin, #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2386
2016-08-15 17:38:33 +02:00
David Edmundson 62d09fad12 Fix shadow rendering calculations
BUG: 365097

Reviewers: #plasma

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2100
2016-07-06 13:16:18 +01:00
Martin Gräßlin c211268b35 Verify that windowPixmap<>() does not return a nullptr before accessing the children
windowPixmap() is allowed to return a nullptr, thus we need to verify
that the returned pointer is not null. If it is null it's the same as
if there are no child WindowPixmaps.
2016-06-20 17:01:15 +02:00
Martin Gräßlin 2cc47004c3 Fix calculation of the shadow size in the OpenGL compositor
Summary:
This change addresses the problem of the incorrectly rendered shadows
when opening a window (e.g. Kickoff) a second time. In case of e.g.
Kickoff not all elements are set, thus e.g. left might be 0, but right
has a value. So for calculating the height the maximum of the values
must be used.

Test Plan: Opened Kickoff and systray a few times

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1792
2016-06-07 15:56:26 +02:00
Martin Gräßlin d16d77f7fe Verify that the Shadow has a valid size before trying to create it
Summary:
The problem of the badly rendered shadows in case of opening kickoff
twice on Wayland is related to this. In that situation both the
width and height are 0. The rendering to the image fails and creating
the texture fails. This causes the flickering we see during rendering.

This change now discards such a shadow with an invalid size. This is
not fixing the actual problem of the shadow, but rather the symptom.

Nevertheless it's an important change as it makes it at least not
look fully broken.

Reviewers: #kwin, #plasma_on_wayland

Differential Revision: https://phabricator.kde.org/D1790
2016-06-07 14:25:55 +02:00
Martin Gräßlin e64450c807 Merge branch 'Plasma/5.6' 2016-04-26 13:13:17 +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
Martin Gräßlin 0df4406c2c Fix crash on repainting an invalid sizes decoration
Summary:
If a window has an invalid size the decoration also has an invalid
size. This results in the texture used by the
SceneOpenGLDecorationRenderer to be invalid and being reset to null.
Of course we shouldn't try to use this texture to render to.

The change comes with a test case to simulate the situation. We cannot
simulate it with Wayland clients as the geometry can never be empty.
Thus we create an X11 client, resize it to an empty size and unmap it.

This is the first integration test case which creates an X11 Client!
It's also a test case which needs the OpenGL compositor. This will most
likely not work on build.kde.org yet - we need to see what to do about
it. Will need adjustments to get it at least skip on build.kde.org.

BUG: 361551
FIXED-IN: 5.6.3

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1383
2016-04-14 07:35:51 +02:00
Ivan Čukić f06dff3390 Checking whether the m_textTexture is not null before dereferencing it
Summary:
It can be null even after updateTextTexture() if there is not text
to generate the texture from:

        if (m_effectFrame->text().isEmpty())
            return;

Reviewers: graesslin

Reviewed By: graesslin

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1347
2016-04-08 09:26:17 +02:00
Martin Gräßlin d31e9e88b4 Rename abstract_backend.(h|cpp) to platform.(h|cpp)
Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1340
2016-04-07 16:18:12 +02:00
Martin Gräßlin 146af48f22 waylandServer()->backend() replaced by kwinApp()->platform() 2016-04-07 15:00:11 +02:00
Martin Gräßlin 54be622958 Render sub-surfaces in OpenGL compositor
This is more a hack than an actual implementation. It just renders
all sub-surfaces after the main window got rendered. But it does not:
* use window quads (e.g. splitting not supported)
* is not combined with rendering of the main surface
* does not support previous pixmap

Still it renders, which is the main goal at the moment.
2016-04-07 07:59:28 +02:00
Martin Gräßlin baca72a9c4 Create sub OpenGLWindowPixmap for sub-surfaces 2016-04-07 07:59:28 +02:00
Thomas Lübking cae90bb035 catch nullptr effects when deleting shadows
the shadow can be deleted deferred from an update
there's a slight chance, to be eg. triggered by clients
blocking compositing, that the compositor is suspended in the same
cycle and the effects pointer (and scene and context) thus gone

CCBUG: 356938
FIXED-IN: 5.6
REVIEW: 126441
2016-02-16 13:59:22 +01:00
Martin Gräßlin 54870d5e14 [libkwinglutils] Cleanup Shader API: removal of ShaderType
As all effects are ported to the ShaderTraits API the old ShaderType
API can be completely removed.
2016-01-26 09:42:49 +01:00
Martin Gräßlin 84b73ab2b3 Drop remaining old shader API usage from SceneOpenGL
No effect uses old API, so we don't need to setup the old shaders
any more.
2016-01-25 14:11:54 +01:00
Martin Gräßlin d76f08e359 Render effect frame with shader trait API 2016-01-25 14:11:54 +01:00
Martin Gräßlin 0d1da1c583 Always set mvp on shader in SceneOpenGL2Window::performPaint
Makes it possible to pass in a shader with a custom fragment shader,
but a normal vertex shader which needs the mvp matrix to be set.
2016-01-25 14:11:54 +01:00
Martin Gräßlin f284ef814c Pass projection matrix to ScreenPaintData
With this change a new ctor overload is added to ScreenPaintData
which allows passing a projection matrix through the effects. This
allows effects to put up custom shaders with a shared projection matrix
and without having to calculate it themselves.

The projection matrix is a read-only information for the effects. There
is no way to change or overwrite it.
2016-01-25 14:11:54 +01:00
Martin Gräßlin 5657405d32 Use ShaderTraits based shader for paint background
Little bit less usage of old Shader API.
2016-01-25 14:11:54 +01:00
Martin Gräßlin ad7246e010 Create the new projection matrix at start of frame rendering
For both simple and generic rendering the projection is actually the
same. So let's create it at the start of the frame rendering which
allows us to also pass it through the effects.
2016-01-25 14:11:54 +01:00
Martin Gräßlin 401efc28a8 SceneOpenGL::Window::getDecorationTexture() operates on AbstractClient 2015-12-18 16:41:49 +01:00
Martin Gräßlin 1758db337f DecoratedClientImpl::client returns AbstractClient* instead of Client* 2015-12-18 16:41:49 +01:00
Martin Gräßlin 03909b9d58 Allow rendering of input method windows also if screen is locked and OpenGL is used
Needed to get maliit keyboard above the greeter window.

Reviewed-By: Bhushan Shah
2015-12-04 16:37:54 +01:00
Martin Gräßlin b1914b4b2c Add pure virtual OpenGLBackend::init() method
All backends already have an init method so far called from the ctor.
This change moves the call to init out of the OpenGL backends and makes
it the responsibility of the creating code to also call init on the
backend.

This change makes it easier to have virtual methods being called during
the initialization.
2015-11-26 08:33:07 +01:00
Martin Gräßlin 38cde38edf Ensure Scene doesn't render non lock screen windows while screen is locked
The last stage for window rendering is triggered by
Scene::finalDrawWindow. Adding a security check there if screen is locked
no non-lock screen window should be rendered.

Unfortunately this method is virtual so the check needs to be done in the
base and all implementing child methods (currently only OpenGL).

REVIEW: 126144
2015-11-26 08:30:57 +01:00
Martin Gräßlin 416d8060cf Don't query for GL_CONTEXT_FLAGS if not at least OpenGL 3.0
Patch by Thomas Lübking.

BUG: 355522
2015-11-19 11:20:33 +01:00
Martin Gräßlin 01451eea36 Revert "Handle conflicts between epoxy and manually resolved function pointers"
This reverts commit ac1dbac8b1.
2015-11-17 14:58:59 +01:00
Martin Gräßlin 5d416a0f69 Introduce additional safety checks for init debug output in SceneOpenGL
There are slight differences between GL_ARB_debug_output and GL_KHR_debug
affecting how it works on GLES. With GL_KHR_debug the context should be
created with a debug flag. With the ARB extension there is no such
requirement. Empirical data (Mali) shows that it doesn't work if the
context is not created with the flag, although the spec seems to allows
it.

So:
* if we have GL_ARB_debug_output we assume it works
* if we only have GL_KHR_debug we check whether the context is created
  with debug support (which we don't do yet, but maybe should?)
* on GLES we can only query with version 3.2 (which we don't request yet)
* with anything older we just assume it's not enabled (which is correct
  given that we don't enable the debug flag)

REVIEW: 126053
2015-11-16 09:09:34 +01:00