Commit Graph

486 Commits (551b3a4c48eeceef562a9e9db7c558b906480aea)

Author SHA1 Message Date
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
Fredrik Höglund 4d738b86ea Add an internalFormat parameter to the GLTexture ctor
This parameter is ignored on GLES.
2014-12-30 21:19:49 +01:00
Fredrik Höglund 5ac159d47e Fix cross-fading
We have to bind a modulation shader when we're cross-fading.

BUG: 341715
2014-12-14 18:33:52 +01:00
Martin Gräßlin 5ceb1b4f75 Merge branch 'Plasma/5.1'
Conflicts:
	CMakeLists.txt
	geometry.cpp
	kcmkwin/kwincompositing/kcmkwineffects.desktop
	kcmkwin/kwincompositing/kwincompositing.desktop
	kcmkwin/kwindecoration/kwindecoration.desktop
	kcmkwin/kwindesktop/desktop.desktop
	kcmkwin/kwinoptions/kwinactions.desktop
	kcmkwin/kwinoptions/kwinadvanced.desktop
	kcmkwin/kwinoptions/kwinfocus.desktop
	kcmkwin/kwinoptions/kwinmoving.desktop
	kcmkwin/kwinoptions/kwinoptions.desktop
	kcmkwin/kwinrules/kwinrules.desktop
	kcmkwin/kwinscreenedges/kwinscreenedges.desktop
	kcmkwin/kwintabbox/kwintabbox.desktop
	scripts/enforcedeco/metadata.desktop
2014-12-10 13:52:27 +01:00
Daniel Pastushchak 0d997b1093 Introduce categorized logging for kwin core
Done by Daniel Pastushchak for KDE during GCI-2014.
2014-12-05 14:27:15 +01:00
Fredrik Höglund f8d1a0868a Test the generated shaders on startup
Compile and bind each shader in turn and render a textured quad.
2014-12-04 19:19:30 +01:00
Fredrik Höglund 99f9d613e9 Change the default shader in SceneOpenGL2
Push a shader that just does texture lookups. This shader is the one
most likely to be used.
2014-12-04 19:19:30 +01:00
Fredrik Höglund d2cb9f9bf6 Add a model-view and a projection matrix in WindowPaintData
Effects currently modify the matrices by reading back the uniform
values from the shader they assume will be used to paint the window,
set new values for the uniforms, call paintWindow(), and then restore
the uniforms to their previous values.

This is both slow and unreliable, and will not work with dynamically
generated shaders.

This patch solves the problem by putting the matrices in
WindowPaintData and making it the responsibility of the paintWindow()
implementation to set the uniforms.
2014-12-04 19:19:30 +01:00
Fredrik Höglund 0d2b2bc8b3 Use the new ShaderManager API in SceneOpenGL2 2014-12-04 19:19:29 +01:00
Martin Gräßlin b5a626c2d7 Introduce a texture cache for DecorationShadows in SceneOpenGLShadow
The DecorationShadow supports the concept of sharing shadows between
multiple Decorations and this is supported by our Shadow class. But
still the created GLTextures were not shared.

This change introduces a sharing mechanismn for all GLTextures created
for a DecorationShadow. Thus if two decorations share the same
DecorationShadow they will also share the same GLTexture.
2014-12-04 10:36:19 +01:00
Fredrik Höglund 4b3fabbfc9 Add support for GL_ARB_buffer_storage
Use a persistently mapped buffer object for the vertex streaming buffer
when GL_ARB_buffer_storage is supported.
2014-12-03 19:50:59 +01:00
Martin Gräßlin c2e53b9a2f Merge branch 'kdecorations2'
Conflicts:
	effects.cpp
	paintredirector.cpp
2014-12-02 08:38:10 +01:00
Martin Gräßlin bf4ba54647 Remove displayWidth and displayHeight from the compositor
Instead of getting size from displayWidth() and displayHeight() use
the information we have from Screens. This means there is only one
place to have the information and by that we can ensure that all
components use the same data to rely on. displayWidth/displayHeight
seem to provide the wrong information when unplugging an output
without disabling the output. This results in rendering artefacts.
But KWin::Screens has the correct information available.
2014-11-27 09:00:19 +01:00
Fredrik Höglund fa52af4765 Remove SceneOpenGL::createTexture(QPixmap)
...and associated code.

It is no longer used.
2014-11-26 22:01:54 +01:00
Fredrik Höglund 34f1408134 Make the EffectFrame textures regular GLTextures
There is valid reason for these textures to be Scene::Texture's.
2014-11-26 22:01:54 +01:00
Fredrik Höglund 6ac7371113 Remove most calls to checkGLError()
...and rely on KHR_debug/GL_ARB_debug_output instead.
2014-11-25 21:57:57 +01:00
Fredrik Höglund c0deadfaad Add support for KHR_debug
Register a callback function for debug output when KHR_debug or
ARB_debug_output is supported.

Only error messages and warnings about undefined behavior are
enabled in release builds, while all debug messages are enabled
in debug builds.
2014-11-25 21:57:15 +01:00
Fredrik Höglund 8d059ae2da Require OpenGL 2.0 in the SceneOpenGL2 constructor
BUG: 340254
FIXED-IN: 5.1.2
2014-11-22 14:19:05 +01:00
Martin Gräßlin 21dca7ac14 Keep a QPointer<DecoratedClientImpl> in Client
This allows to remove the internal access to the DecoratedClientPrivate
in the KDecoration API.
2014-10-21 07:46:44 +02:00
Martin Gräßlin e32da9d9e0 Merge branch 'master' into kdecorations2
Conflicts:
	CMakeLists.txt
	paintredirector.cpp
	scene_opengl.h
	scene_qpainter.h
	scene_xrender.h
2014-10-20 16:04:52 +02:00
Fredrik Höglund 32e9de1e23 Refactor the swap completion interface
Move the buffer-swap-pending state from the compositing backends to
the Compositor class. The Compositor is the only class that needs to
access the state, and this way it to do it without calling through
a chain of virtual functions. This commit adds two new functions to
Compositor; aboutToSwapBuffers() and bufferSwapComplete(). The
backends call these functions to set and reset the buffer-swap-pending
state.

This commit also renames a number of functions and variables to make
their meaning clear.

The act of promoting the contents of the back buffer to become the
contents of the front buffer is referred to as posting the buffer,
presenting the buffer, or swapping the buffers; rendering the buffer
is what paintScreen() does.
2014-09-18 20:21:20 +02:00
Fredrik Höglund 3b4907d060 Add support for explicit command stream synchronization
Create and import X sync fences into GL and use them to synchronize
the kwin command stream with the X command stream.

This prevents damaged windows from being composited by kwin before
the rendering that triggered the damage events have finished on
the GPU.

Requires GL_EXT_x11_sync_object.

Tested-by: Marco Martin <notmart@gmail.com>
2014-09-12 14:50:12 +02:00
Fredrik Höglund 4f9ea5335d Remove SceneOpenGL::Texture::findTarget()
It is no longer used.
2014-09-01 17:45:58 +02:00
Fredrik Höglund 59212e3a79 Remove SceneOpenGL::Texture::load(..., int depth)
The scene always uses the version that takes an xcb_visualid_t.
2014-09-01 17:45:58 +02:00
Fredrik Höglund 88f8078073 glx: Use the X visual when choosing an FBConfig
This adds a SceneOpenGL::Texture::load(..., xcb_visualid_t) overload,
and uses it to bind window pixmaps to textures.

By taking the RGBA masks in the visual into account when choosing an
FBConfig for the GLXPixmap, we are able to disambiguate formats that
have the same depth, such as GL_RGB10_A2 and GL_RGBA8.
2014-09-01 17:45:58 +02:00
Fredrik Höglund fc56ac28fb Remove SceneOpenGL::Texture::update()
The default implementation is a no-op, and none of the current
backends reimplement it.
2014-09-01 17:45:57 +02:00
Fredrik Höglund 210df22b17 Remove SceneOpenGL::Texture::load(QPixmap)
Fold it into the constructor, since that's the only place
where it's called.
2014-09-01 17:45:57 +02:00
Fredrik Höglund 49c8827345 Remove SceneOpenGL::Texture::load(QImage)
It's never called.
2014-09-01 17:45:57 +02:00
Fredrik Höglund ff096e532f Remove the region parameter from Texture::load()
It's never used.
2014-09-01 17:45:57 +02:00
Fredrik Höglund 1c7938e43e Don't pass pixmap handles as const references
But do pass the region in SceneOpenGL::Texture::load() as a const
reference.

This patch also replaces the Xlib types with their xcb equivalents.
2014-09-01 17:45:57 +02:00
Fredrik Höglund 70d35d602f Remove SceneOpenGL2Window::prepare/restoreStates()
Dead code.
2014-08-25 17:09:48 +02:00
Fredrik Höglund 3d3a52c32d Remove SceneOpenGL::Window::renderQuads()
Leftover from the OpenGL 1.x backend.
2014-08-25 17:09:48 +02:00
Fredrik Höglund c9aacbc460 Remove SceneOpenGL::Window::paintDecoration()
Leftover from the OpenGL 1.x backend.
2014-08-25 17:09:48 +02:00
Fredrik Höglund 10120c6d42 Remove SceneOpenGL::Window::paintShadow()
Leftover from the OpenGL 1.x backend.
2014-08-25 17:09:48 +02:00
Martin Gräßlin 2b20aa8bd0 Drop CoordinateMode from Client::layoutDecorationRects
It's unused without the padding.
2014-07-25 14:02:27 +02:00
Martin Gräßlin 08d146de91 Introduce support for DecorationShadow
Surprisingly the DecorationShadow is modelled after the Shadow in KWin.
It provides the same offsets and a QImage exactly like the OpenGL
implementation needs it. This makes it easy to hook it into our existing
Shadow implementation with only a few changes.

Shadow now first tries to create a Shadow from the Decoration and only
if that fails it tries the X11 property. The pixmaps are not initialized
for the DecorationShadow and because of that currently only the OpenGL
backend gets initialized for DecorationShadows. The other backends might
need adjustments and also a transition to just using one image.
2014-07-25 14:02:27 +02:00
Martin Gräßlin c12199a8e0 Pass Decoration::Renderer to Deleted and use it in the Scenes
The Renderer gets reparented to the Deleted. While passing it to
the Deleted the Scene's implementation can ensure that the buffers
are up to date. After passing to Deleted it's no longer allowed to
call the render method.
2014-07-25 14:02:27 +02:00
Martin Gräßlin 0030eb7f84 Initial import of support for new KDecoration2 based decorations
NOTE: this is not working completely yet, lots of code is still ifdefed
other parts are still broken.

The main difference for the new decoration API is that it is neither
QWidget nor QWindow based. It's just a QObject which processes input
events and has a paint method to render the decoration. This means all
the workarounds for the QWidget interception are removed. Also the paint
redirector is removed. Instead each compositor has now its own renderer
which can be optimized for the specific case. E.g. the OpenGL compositor
renders to a scratch image which gets copied into the combined texture,
the XRender compositor copies into the XPixmaps.

Input events are also changed. The events are composed into QMouseEvents
and passed through the decoration, which might accept them. If they are
not accpted we assume that it's a press on the decoration area allowing
us to resize/move the window. Input events are not completely working
yet, e.g. wheel events are not yet processed and double click on deco
is not yet working.

Overall KDecoration2 is way more stateful and KWin core needs more
adjustments for it. E.g. borders are allowed to be disabled at any time.
2014-07-25 14:02:26 +02:00
Fredrik Höglund b1586daab4 Remove the GL_QUADS_KWIN definition
GL_QUADS is always defined now that we're using libepoxy.
2014-07-22 12:56:32 +02:00
Fredrik Höglund aae08b16e9 Add a WindowQuadShadow
And use this type for all the shadow quads in the OpenGL scene.
2014-07-22 12:28:20 +02:00
Martin Gräßlin 7744608a1d Drop SceneOpenGL::Window::textureForType
Dead code.
2014-07-21 15:04:44 +02:00
Fredrik Höglund 6ad4c775d7 Use a single texture atlas for the decoration
The left and right border images are rotated 90° before they are
uploaded into the atlas texture. The images are separated by a row
of transparent texels to minimize artifacts from oversampling.

With this change kwin renders the whole decoration with a single
call to glDrawArrays().
2014-07-17 09:39:17 +02:00
Fredrik Höglund d9c4b77f0f Make the GL extension list a QList<QByteArray>
It doesn't make sense to convert the extension names to QStrings.

This also replaces the QString parameter in hasGLExtension() with
a QByteArray and adjusts all callers.
2014-07-14 12:04:37 +02:00
Martin Gräßlin be33c59c16 Introduce config option for OpenGLPlatformInterface
A new config option "GLPlatformInterface" is added to the Compositing
settings group. Valid values are "glx" and "egl". This config option is
honored by the Scene to decide which backend to create.

The setting gets sanitized by the operation mode (egl for Wayland),
the environment variable KWIN_OPENGL_INTERFACE and the compile time
support. These switches are removed from the Scene to not have them
duplicated.
2014-05-13 09:23:03 +02:00
Burkhard Lück 82b7804b0a rename kcmshell4 to kcmshell5 2014-05-02 17:24:47 +02:00
Martin Gräßlin aa7db138e8 Remove unused variables
Thanks to clang for better warnings than g++.
2014-04-04 13:55:57 +02:00
Martin Gräßlin ca5f8cfe03 [kwin] Remove unused config-workspace.h includes 2014-03-18 09:23:25 +01:00
Martin Gräßlin 92761e9e30 [kwin] Fix ifdefs for Wayland
With the switch to FindWayland from ECM WAYLAND_FOUND was no longer set
thus the ifdef didn't work. Now we use HAVE_WAYLAND and HAVE_WAYLAND_EGL.
2014-03-18 09:00:49 +01:00
Aleix Pol c72e519d9c Remove KDE/ prefix in include directories
It's unneeded and deprecated since KF5.
2014-03-17 16:24:10 +01:00