Commit Graph

497 Commits (c46c92e20460f8450aa291b35710da8c7010899b)

Author SHA1 Message Date
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
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