Commit Graph

534 Commits (4ef07494bd9c46ce945f665af4adce6048b28909)

Author SHA1 Message Date
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
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
Aleix Pol 6f345f4915 Clean debug output
Removes endl in the end of qDebug.
Removes the \n in the end of opengl output.

REVIEW: 124320
2015-07-20 13:36:27 +02:00
Rohan Garg c22fdcf146 Return unless glDebugMessageCallback resolves on GLES
REVIEW: 124135
2015-06-26 12:43:08 +02:00
Thomas Lübking ff2590ac52 fix compilation on older gcc (at least 4.8.3)
thanks to Hrvoje Senjan for bringing this up
REVIEW: 123936
2015-06-10 08:50:17 +02:00
Thomas Lübking 9f13e9b260 WORKAROUND for nvidia VBO failures
When switching virtual terminals,
suspending to ram and resizing the
screen (GL viewport) at least the
nvidia driver moves VBO data between
the video RAM and the system heap -
and something about this isn't reliable:

An often perceived resulted are scattered
windows but it may also be the cause for
entirely black screens reported for same
occasions.

As a workaround, we hook into the GL debug
messages and filter them for the suspicious
message, then re-init VBOs

TODO:
figure whether that's our fault or nvidias

REVIEW: 123936
CCBUG: 344326

Patch applies to KWin 5.4
2015-06-03 21:38:55 +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 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 e1ae0b8bc4 [wayland] Create OpenGLBackend through the AbstractBackend
Replaces casting logic in the SceneOpenGL. Now the create is delegated
to the backend allowing also to move the ifdef logic to where it belongs.
2015-04-01 11:05:45 +02:00
Martin Gräßlin 219946edce Fix build with HAVE_WAYLAND and HAVE_X11_XCB but no HAVE_WAYLAND_EGL
Let's try again.
2015-03-24 10:50:46 +01:00
Martin Gräßlin 2d1622ea09 Fix build without Wayland, but with HAVE_X11_XCB
Build error in SceneOpenGL.
2015-03-24 10:43:48 +01:00
Martin Gräßlin 49f58059c6 [wayland] Backends are no longer singletons
They are installed in the WaylandServer, thus we don't need an explicit
singleton accessor. If we need to differentiate we can cast.
2015-03-23 14:29:07 +01:00
Simeon Bird 1de1e80d50 Fix hang on nvidia hardware when deleting sync objects
When a sync object is deleted, the fence it is connected to must already
be signalled, or the driver will busy-wait forever.
Signal fences before deleting syncs to avoid this.

BUG: 343551
FIXED-IN: 5.3
REVIEW: 123090
2015-03-22 23:55:48 -04:00
Martin Gräßlin a1642a85d3 Allow using EGLOnXBackend with X11WindowedBackend
Mostly refactoring to not take the global X11 information (connection,
display, etc.). Adds a dedicated ctor overload which takes the
X11WindowedBackend.

SceneOpenGL is adjusted to create an EGLOnXBackend instead of Wayland one
if the X11WindowedBackend is used.
2015-03-20 14:08:54 +01:00
Martin Gräßlin 147af71f8a Drop Workspace dependency from Scene
Only used for one connect which can also be done outside of Scene.
Subclasses got the singleton pointer and just passed to the parent.
2015-03-17 10:20:19 +01:00
Martin Gräßlin a0b2a938aa [wayland] Support creating Texture from Wayland shm buffer
EglWaylandBackend gains support for creating textures from a
BufferInterface. At the same time it loses the possibility to use
the Xcb shm extension to load the texture. That is Xwayland is
required.

In order to support it in a better way the WindowPixmap is passed
to the Texture for loading and updating. Which is then passed to the
backend specific implementation.
2015-03-17 10:08:27 +01:00
Martin Gräßlin 7bbb68aad6 Check GL version and/or extension for using texture format GL_R8
BUG: 344301
FIXED-IN: 5.2.1
REVIEW: 122615
2015-02-18 09:09:50 +01:00
Tobias C. Berner ef3f0f753b Add <array> include where needed, to make it build on FreeBSD.
REVIEW: 122090
2015-01-17 15:22:11 +02:00
Fredrik Höglund 2cebf523aa Store shadows in GL_R8 textures when possible 2014-12-30 21:22:04 +01:00