Commit Graph

402 Commits (0063e2ed2d6f377a0e75530a2b60ca3440929f5c)

Author SHA1 Message Date
Martin Gräßlin 941c02a60f Introduce cross-fading with previous pixmap
Cross fading with previous pixmap is achieved by referencing the old
window pixmap. WindowPaintData has a cross-fade-factor which interpolates
between 0.0 (completely old pixmap) to 1.0 (completely new pixmap).

If a cross fading factor is set and a previous pixmap is valid this one
is rendered on top of the current pixmap with opacity adjusted. This
results in a smoother fading.

To simplify the setup the AnimationEffect is extended and also takes care
about correctly (un)referencing the previous window pixmap. The maximize
effect is adjusted to make use of this new capabilities.

Unfortunately this setup has a huge problem with the case that the window
decoration gets smaller (e.g. from normal to maximized state). In this
situation it can happen that the old window is rendered with parts outside
the content resulting in video garbage being shown. To prevent this a set
of new WindowQuads is generated with normalized texture coordinates in
the safe area which contains real content.

For OpenGL2Window a PreviousContentLeaf is added which is only set up in
case the crass fading factor is set.

REVIEW: 110578
2013-06-05 08:18:28 +02:00
Martin Gräßlin e7ab3adafd New class to encapsulate a Window's Pixmap
The behavior for creating a pixmap for a window is moved from Toplevel
into a dedicated class WindowPixmap. Scene::Window holds a reference to
this class and creates a new WindowPixmap whenever the pixmap needs to be
discarded. In addition it also keeps the old WindowPixmap around for the
case that creating the new pixmap fails. The compositor can in that case
use the previous pixmap which reduces possible flickering. Also this
referencing can be used to improve transition effects like the maximize
windows effect which would benefit from starting with the old pixmap.

For XRender and OpenGL a dedicated sub-class of the WindowPixmap is
created which provides the additional mapping to an XRender picture and
OpenGL texture respectively.

BUG: 319563
FIXED-IN: 4.11
REVIEW: 110577
2013-06-05 08:18:11 +02:00
Fredrik Höglund 57b78daf33 kwin: Use the new API for rendering quads 2013-06-05 00:41:25 +02:00
Fredrik Höglund dbbda21129 kwin: Support quads in makeInterleavedArrays()
A new type parameter is added for specifying the primitive type.
2013-06-05 00:41:24 +02:00
Fredrik Höglund 7c4b736cec kwin: Upload all the vertex data at the same time
With this change we only map the vertex buffer once per window.
The vertex arrays are also only set up once.
2013-06-05 00:41:23 +02:00
Fredrik Höglund 40d6bd66d4 kwin: Refactor SceneOpenGL::Window
Reimplement performPaint() in SceneOpenGL1Window and SceneOpenGL2Window.

The roles between begin/endRenderWindow() and performPaint() are now
reversed; performPaint() contains the specialized code while begin/
endRenderWindow() contains the shared code.

This reduces the state churn in the OpenGL2 backend from the repeated
calls to prepare/restoreStates().
2013-06-05 00:41:23 +02:00
Fredrik Höglund 631769d18f kwin: Rename SceneOpenGL::debug to m_debug and add an accessor 2013-06-05 00:41:23 +02:00
Fredrik Höglund 4f2d12a4a7 kwin: Rename SceneOpenGL::Window::texture to m_texture 2013-06-05 00:41:23 +02:00
Fredrik Höglund 7bac2dd425 kwin: Add new convenience methods in SceneOpenGL
Add a paintRedirector() and a getDecorationTextures() method.
These will be used in an upcoming commit.
2013-06-05 00:41:22 +02:00
Fredrik Höglund 70921b8119 kwin: Make hardwareClipping a member 2013-06-05 00:41:22 +02:00
Fredrik Höglund ac5f1317e9 kwin: Split WindowQuadDecoration into two types
Split WindowQuadDecoration into WindowQuadDecorationLeftRight
and WindowQuadDecorationTopBottom.

This simplifies the code in SceneOpenGL::Window::paintDecoration().
2013-06-05 00:41:22 +02:00
Fredrik Höglund 120e65b2c1 kwin: Use texture atlases for the decorations
Use two textures per window instead of four, storing the left and
right borders in the first texture, and the top and bottom borders
in the second.

This makes it possible to render the whole decoration with only two
calls to glDrawArrays(). It also reduces the number of texture
allocations while resizing a window.
2013-06-05 00:41:22 +02:00
Fredrik Höglund feb6fa3aea kwin: Remove makeDecorationArrays()
There is no longer any reason why the decorations cannot be rendered
with renderQuads().
2013-05-29 18:17:57 +02:00
Fredrik Höglund 5b445b1706 kwin: Set the texcoords in the decoration quads
This way we don't have to compute them in makeDecorationArrays().
2013-05-29 18:17:57 +02:00
Fredrik Höglund 49e78a3507 kwin: Optimize shadow quad selection
Loop over the window quad list once instead of eight times when
selecting the shadow quads.
2013-05-29 18:17:57 +02:00
Fredrik Höglund c8e3d670e7 kwin: Optimize decoration quad selection
Loop directly over the window quad list and check the type instead of
using select(WindowQuadDecoration) when separating the decoration quads.

This avoids the step of creating an intermediate list, and then looping
over that list to separate out the quads that belong to the four sides.
2013-05-29 18:17:57 +02:00
Fredrik Höglund 9c348c9a82 kwin: Refactor the decoration code a bit 2013-05-29 18:17:57 +02:00
Fredrik Höglund 1f6b791f11 kwin: Declare the attribute layout once in SceneOpenGL::Window
The same layout is used for all draw calls in
SceneOpenGL::Window::performPaint().
2013-05-29 18:17:46 +02:00
Fredrik Höglund 9c1833920c kwin: Use the new map() interface in renderQuads()
Write the vertex data directly into the buffer object, instead of
allocating two temporary arrays, coyping the data into them, and
then copying the data from the arrays into the buffer object.

This also makes renderQuads() handle coordinates for rectangular
textures correctly.
2013-05-28 18:13:34 +02:00
Fredrik Höglund 7a00648195 kwin: Use the new map() interface in makeDecorationArrays()
Write the vertex data directly into the buffer object, instead of
allocating two temporary arrays, copying the data into them, and
then copying the data from arrays into the buffer object.
2013-05-28 18:13:34 +02:00
Fredrik Höglund 6891c900b3 kwin: Simplify makeDecorationArrays()
This also fixes coordinate inversion for rectangular textures.
2013-05-28 16:35:37 +02:00
Fredrik Höglund 041be646b5 kwin: Detect and handle graphics resets
Reset compositing when the GL context state has been lost as a result
of a graphics reset.
2013-05-22 23:38:51 +02:00
Thomas Lübking b7e6a334da rebase measuring to nano res + fix vsync padding
REVIEW: 109784
2013-05-20 16:09:27 +02:00
Thomas Lübking 9446abc696 hasWaitSync -> blocksForRetrace and syncsToVBlank
since that's not the same.
also autodetect triple buffering

REVIEW: 109783
2013-05-20 16:09:27 +02:00
Martin Gräßlin 76d96506dc Remove damage argument in Toplevel::resetDamage
We always reset with the complete window geometry, so the subtracting
doesn't make any sense. We can just always set the damage to an empty
region.

REVIEW: 110438
2013-05-17 10:07:45 +02:00
Fredrik Höglund a3d907d748 kwin/glx: Use glBlitFramebuffer() instead of glCopyPixels()
glCopyPixels(), glRasterPos() and glBitmap() are not available
in a core context.
2013-05-08 18:33:03 +02:00
Fredrik Höglund d324ec998a kwin: Create a vertex array object in SceneOpenGL2
Using a vertex array object is not optional in an OpenGL core context.
2013-05-08 18:33:02 +02:00
Martin Gräßlin 4a48325de5 Cleanup and reorder includes in client.h
Removing the workspace include required to include it in many other
places.
2013-04-29 08:42:36 +02:00
Martin Gräßlin 466bef3a6d Adding a DesktopThumbnailItem declarative item
Similar to WindowThumbnailItem for rendering a desktop thumbnail.
Uses the new paintDesktop hook.

FEATURE: 296067
FIXED-IN: 4.11.0
REVIEW: 104441
2013-04-24 11:45:47 +02:00
Ralf Jung c9f852a73f Fix tearing in video playback when using kwin_gles
REVIEW: 109973
2013-04-16 16:16:13 +02:00
Martin Gräßlin edb074cbc2 Split out screen handling from Workspace into own class Screens
Following the approaches of other split out functionality Screens is a
singleton class created by Workspace.

The class takes over the responsibility for:
* screenChanged signal delayed by timer
* number of screens
* geometry of given screen
* active screen
* config option for active screen follows mouse

The class contains a small abstraction layer and has a concrete subclass
wrapping around QDesktopWidget, but the idea is to go more low level and
interact with XRandR directly to get more detailed information.

All over KWin the usage from QDesktopWidget is ported over to the new
Screens class.

REVIEW: 109839
2013-04-15 10:25:10 +02:00
Ralf Jung 0598e6363b move the "copy pixels" code into its own function (it's used twice) 2013-03-26 21:08:38 +01:00
Fredrik Höglund 00c0ad05d3 kwin: Require Xcomposite 0.3 for OpenGL compositing
Remove support for OpenGL compositing without using a composite
overlay window. With this change kwin now also requires a
double-buffered framebuffer configuration.
2013-03-17 18:28:46 +01:00
Ralf Jung 3a6d55b16e Get rid of the unreliable lastMask in the GL backend
REVIEW: 109396
2013-03-12 11:55:28 +01:00
Martin Gräßlin aa549f45d5 OpenGLPaintRedirector updates textures directly
Ownership of decoration textures is moved from SceneOpenGL::Window to
OpenGLPaintRedirector. The PaintRedirector is responsible for updating
the textures whenever they change. For this GLTexture is extended by an
update(QImage, QPoint) method which uses glTexSubImage2D to update only
the changed parts.

The big advantage compared to before is that if e.g. only a button is
animated only the button part is updated instead of the complete deco
part.
2013-03-11 11:21:11 +01:00
Martin Gräßlin fba7504063 Introduce dedicated PaintRedirector subclasses for OpenGL/XRender
PaintRedirector is turned into an abstract class providing a factory
method which returns either an instance of
* OpenGLPaintRedirector
* NativeXRenderPaintRedirector
* RasterXRenderPaintRedirector

OpenGLPaintRedirector is basically doing exactly the same as the parent
class used to do before. Though the idea is to extend the functionality
to have the PaintRedirector write directly into OpenGL textures to limit
copying the complete decorations.

NativeXRenderPaintRedirector is similar to OpenGLPaintRedirector by
rendering into a QPixmap and providing the pictureHandle for the QPixmap
to SceneXRender.

RasterXRenderPaintRedirector is providing the functionality for the case
that the QPixmap/XPixmap relationship is not present. From the QPixmap
containing the pending decoration paint a QImage is created and then the
relevent parts are copied directly into the decoration pixmap.

REVIEW: 109074
2013-03-11 11:19:57 +01:00
Martin Gräßlin 60c42b7a34 s/KLocale/KLocalizedString/g
Many headers included KLocale to use i18n and co. But those methods are
defined in KLocalizedString and not in KLocale.

With KF5 klocale.h does no longer include KLocalizedString causing lots
of compile errors.
2013-03-07 13:59:15 +01:00
Martin Gräßlin b01f5684c5 Remove not needed includes from kwineffect header files
Only include what's actually needed in the headers. This causes of course
some additional needed includes in some implementation files.
2013-03-06 10:23:09 +01:00
Thomas Lübking 9aef5b85a0 support a permanent glSwapBuffer
either by
- forcing fullrepaints unconditionally
- turning a repaint to a full one beyond a threshhold
- completing the the backbuffer from the frontbuffer after the paint

BUG: 307965
FIXED-IN: 4.10
REVIEW: 107198
2013-03-05 19:24:30 +01:00
Martin Gräßlin 53028a6d96 Do not use a WeakPointer for LanczosFilter
No need for a WeakPointer as it's just used only in SceneOpenGL2.

REVIEW: 108853
2013-02-11 14:55:41 +01:00
Yuri Chornoivan cb345dfbd7 Fix spacing 2013-01-24 07:32:54 +02:00
Thomas Lübking 36378925e7 Check max viewport and texture dimensions
REVIEW: 106917
2013-01-23 21:27:46 +01:00
Casian Andrei 7a6e48ef3b Fix premultiplied alpha issue with color correction
When correcting a color that was with premultiplied alpha, the alpha
value was not multiplied back again as a final step. This was breaking
color correction when the blend function was GL_ONE,
GL_ONE_MINUS_SRC_ALPHA. The blend function was changed for normal
windows (a workaround), but not for effect frames, i.e. the effect
frames were broken with color correction enabled.

Removes the blend function workaround.

Removes a useless setupForOutput.

BUG: 311319
REVIEW: 108189
2013-01-13 19:10:54 +02:00
Casian Andrei df034c16ad Abort color correction initialization and disable it in case of errors
Checks are now performed for GL errors and in case of errors everything
is aborted. The error handling mechanism introduced for this purpose
somewhat improves the color correction code.

Fix gl invalid operation in color correction, when first setting up the
lookup texture uniform.

REVIEW: 107754
2013-01-13 19:10:54 +02:00
Martin Gräßlin 67174bbf69 Remove outdated and not very useful comment sections
If a section of comments consists of a list of links and all are broken
it's a sign that nobody has used these comments for a long time...

REVIEW: 107933
2012-12-30 09:52:42 +01:00
Martin Gräßlin e36d9d5165 Do not block OpenGL 2 when build for gles due to driver recommendation
Let's assume a user knows what she is doing when she selects kwin_gles
instead of kwin. Also in gles there is no fallback to OpenGL 1 possible
so blocking is not the proper solution in the first place.

BUG: 311712
FIXED-IN: 4.10 RC 2
REVIEW: 107824
2012-12-22 11:45:19 +01:00
Martin Gräßlin a6f963ec4a Invert logic of init_ok in SceneOpenGL
In case that one of the checks in SceneOpenGL failed the ctor of the
sub-class continued and set init_ok to true although it should have been
set to false.

Now init_ok starts with true and if a check fails it is set to false.
For 4.11 we should consider using an exception here - variables to check
that init code works are just no proper solution.

REVIEW: 107420
2012-11-26 10:14:10 +01:00
Martin Gräßlin feb352c84c Suppress unused variable warning
SVN_SILENT
2012-11-22 14:34:34 +01:00
Casian Andrei 01adbe6dc5 Implement color correction (per output)
Add an option to kcmcompositing in the 'Advanced' tab, to enable or
disable color correction. It is specified that it's experimental and it
needs Kolor Manager.

Before painting for a particular screen, ColorCorrection::setupForOutput
should be called.

A screen property is added for WindowPaintData.

In kwinglutils, The fragment shaders are intercepted before being
compiled and they get a couple of lines of code inserted in order to do
the color correction. This happens only when color correction is enabled, of
course.

For D-Bus communication with KolorServer, everything is async.

The implementation basically manages a set of color lookup tables for
different outputs and for different window regions. These are taken via
D-Bus. Each lookup table has around 700 KB.

This commit reintroduces the changes from the former merge with the
"color2" branch. In this form, it can be easily reverted.

REVIEW: 106141
2012-11-13 22:47:09 +02:00
Casian Andrei 22569f7eb9 Remove forceAlpha uniform, which is no longer needed
This was originally added by d467fc1bdbcf69bd6ef213bd909633c2edfb6878,
to prevent alpha ending up to be 0 with blending disabled. Apparently,
that was a driver issue that is no longer present.

REVIEW: 107090
2012-11-13 22:23:18 +02:00