Commit Graph

551 Commits (9265d9fae72f56a84872a7f7728d73746a6ee9a1)

Author SHA1 Message Date
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
Martin Gräßlin ac1dbac8b1 Handle conflicts between epoxy and manually resolved function pointers
For the functions from GL_FOO_robustness we want to resolve it by
ourselves in order to add a custom implementation if it's not available.
Unfortunately once epoxy.h is included this breaks as epoxy defines the
names and so through the preprocessor epoxy always wins.

So we need different names: all functions from robustness get a "kwin"
prefix and the usage is changed everywhere in kwin source code.

REVIEW: 125883
2015-11-11 08:04:29 +01:00
Nick Shaforostoff 3a8d7d866a optimize string operations
-use qstringliteral only when necessary (i.e. not in concat or comparison)
-use qbytearray instead of qstring when dealing with latin1 input and output (glplatform)
-use qstringref to extract numbers from strings (glplatform)
-define qt_use_qstringbuilder to optimize all string concatenations
-anidata: use ctor init lists, add windowType member initialization

REVIEW: 125933
2015-11-05 14:14:06 +00:00
Martin Gräßlin c50da5bdee Fix compile with libepoxy < 1.3
Compile failure on KDE CI:
error: ‘GL_GUILTY_CONTEXT_RESET’ was not declared in this scope

It's not defined in libepoxy 1.2, so let's define it to the values
it has in 1.3.
2015-11-03 10:12:55 +01:00
Martin Gräßlin f2ad98aa3a Add O2ES as possible value for KWIN_COMPOSE
If KWIN_COMPOSE is set to O2ES, an OpenGL ES context is tried to
be created instead of an OpenGL context.

REVIEW: 125919
2015-11-03 09:30:12 +01:00
Martin Gräßlin 4f64b32aba Runtime depend on GLES in SceneOpenGL
Thanks to epoxy for allowing us to get rid of some additional GL/GLES
specific defines.
2015-11-03 09:29:31 +01:00
Martin Gräßlin 03231942bb Bind building of glx support on whether epoxy has a glx header
So far it was bound to whether we build for GLES. But this is
semantically wrong. It might be possible that even on desktop gl
epoxy is built without GLX support, thus we need to reflect this.

This change ensures that epoxy/glx.h is only included if available,
that relevant code is bound to it and that checks are in place to
enforce EGL if not build with glx support.

In addtion the glxbackend.cpp is now only included in the build set
if available.
2015-11-03 09:29:31 +01:00
Martin Gräßlin 0fc1142ca2 Allow OpenGLBackend to hold a surfaceless context
For a virtual rendering backend a surfaceless context is needed. Such
a context may not call glDrawBuffer as that results in a GL error.

This change allows the OpenGLBackend to announce that it's context is
surfaceless.
2015-10-08 15:54:24 +02:00
Martin Gräßlin f84b4758f2 Fix incorrect static_casts to Client
Replace by better dynamic_casts to AbstractClient.
2015-09-16 13:54:48 +02:00
Martin Gräßlin 3139dcd3b9 Drop cmakedefine HAVE_WAYLAND
Now a required build dependency.
2015-08-12 11:39:20 +02:00
Martin Gräßlin c24e315a9b Drop build option KWIN_BUILD_EGL
It doesn't make much sense any more as we do no longer link EGL since the
switch to epoxy. And epoxy pulls it in at runtime if needed.
Even more on Wayland it's just plain stupid to have EGL disabled. So
removing the option just simplifies our code base without any
disadvantages.

REVIEW: 124695
2015-08-11 11:15:25 +02:00
Martin Gräßlin 53004b95ff Port left over qDebug to qCDebug 2015-07-31 13:25:51 +02:00