Commit Graph

414 Commits (2e1f02821051218024626779332685bfbb589c95)

Author SHA1 Message Date
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
Casian Andrei a46d247702 Revert "Merge branch 'color2'"
This merge is incomplete and it does not include the review number of
the associated review request. It should have been pushed as a single
commit, because the merged commits were not intended to be published in
their form.

This reverts commit dcba90263069a221a5489b1915c5cf1ca39d090c, reversing
changes made to 50ae07525c7fde07794e7548c3d6e5a69cb1a89d.

Conflicts:
	kwin/scene_opengl.cpp
	kwin/scene_opengl.h
2012-11-13 22:19:32 +02:00
Martin Gräßlin 9308028fa4 Decoration can announce whether it currently requires an alpha channel
A decoration can provide the AbilityAnnounceAlphaChannel in addition to
AbilityUsesAlphaChannel. If this ability is provided the decoration can
enable/disable the use of the alpha channel through setAlphaEnabled().

The base idea behind this mechanism is to be able to tell the compositor
that currently alpha is not needed. An example is the maximized state in
which the decoration is fully opaque so that there is no need to use the
translucency code path which would render all windows behind the deco.

In addition also the blur effect honors this setting so that behind a
known opaque decoration no blurring is performed.

Oxygen is adjusted to disable translucency in maximized state and Aurorae
is adjusted to allow themes to enable/disable translucency. For Plastik
translucency and with that also blurring is disabled.

REVIEW: 106810
2012-11-09 10:36:43 +01:00
Kai-Uwe Behrmann 479be668d7 Merge branch 'color2'
Conflicts:
	kwin/libkwineffects/kwinglplatform.cpp
2012-11-07 23:54:18 +01:00
Fredrik Höglund e578676f42 kwin: Rename flushBuffer() to present()
This function doesn't flush any buffered commands, it presents or posts
the color buffer to the surface to which the GL context is bound.
2012-10-29 21:31:17 +01:00
Martin Gräßlin 26a9a35b2f Increase runtime requirement to Mesa 8.0
Adjustment to reality. KWin has had a dependency on Mesa 8.0 for quite
some time given that it is what basically all distributions ship.

It is better to clearly state what is required. For KWin Mesa 8.0 is a
more reliable dependency as all DRI drivers which do not support DRI2
have been removed.

Packagers have been informed about this intended change some weeks ago.

REVIEW: 106799
2012-10-25 11:45:36 +02:00
Martin Gräßlin 57c27c2e0b GLPlatform can recommend the compositor to use
During detecting the OpenGL capabilities also a recommended compositor
can be set. This recommendation is honoured by the OpenGL based
compositors. That is the SceneOpenGL2 requires a recommendation for at
least OpenGL2 and the SceneOpenGL1 requires at least a recommendation for
OpenGL1. If the driver recommends XRender compositing the SceneOpenGL
performs the existing fallback to XRender.

With this recommendation the hacks in the Scene are removed, e.g. it is
no longer checked whether the driver is software emulation as that is
provided through the recommendation.

To overrule the recommendation the environment variable KWIN_COMPOSE is
extended by the values O1 and O2 to enforce either OpenGL 1 or OpenGL 2.
This overwrites all other checks. As a side-effect this allows now to run
KWin on the llvmpipe:
LIBGL_ALWAYS_SOFTWARE=1 KWIN_COMPOSE=O2 kwin --replace &

But not that I would recommend to use it :-)

REVIEW: 106741
2012-10-25 11:40:18 +02:00
Martin Gräßlin cf5de22586 Introduce a build option KWIN_BUILD_OPENGL_1_COMPOSITING
If the build option is enabled KWIN_HAVE_OPENGL_1 is passed as a compile
flag when build against OpenGL.

This compile flag is meant to replace the KWIN_HAVE_OPENGLES. So far code
has been ifdefed for special behavior of OpenGL ES 2.0 and to remove
fixed functionality calls which are not available in OpenGL ES 2.0.

With this build flag the fixed functionality calls which are only used in
the OpenGL1 Compositor can be removed and keeping the KWIN_HAVE_OPENGLES
for the real differences between OpenGL 2.x and OpenGL ES 2.0.

E.g. a call like glColor4f should be in an
glColor4f(1.0, 1.0, 1.0, 1.0);

while a call like glPolygonMode should be in an
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

Building for OpenGL ES 2.0 of course implies that KWIN_HAVE_OPENGL_1 is
not defined.
2012-10-25 11:34:12 +02:00
Jurica Vukadin bcdc74f8d6 Fix more C++11 narrowing warnings
REVIEW: 106997
2012-10-24 20:43:19 +02:00
Martin Gräßlin 0d81d1d7c0 Move decoration pixmap handling from Client to PaintRedirector
The only task of the PaintRedirector is to redirect the painting of the
window decorations into Pixmaps. So it should actually do this by also
handling the four pixmaps for the decoration. This simplifies the code
as all the logic concerning redirecting the painting is now grouped
together.

Furthermore the PaintRedirector is now a child of the decoration widget,
which means it gets automatically destroyed whenever the decoration is
destroyed - the Client does not have to care about it.

Also the PaintRedirector gets only created if the Compositor is active as
it is not needed in the non-compositing case.

REVIEW: 106620
2012-10-12 07:45:31 +02:00
Martin Gräßlin a401558a43 Provide OpenGL over Egl
The Egl backend is decoupled from the OpenGL ES build option which makes
it possible to use it as a replacement for glx.

To make this possible a new build flag is added when egl is available at
compile time and any egl specific code is now ifdefed with this flag
instead of the gles flag. In addition at runtime a windowing system enum
value is passed to the various detect methods to have egl/glx specific
detection for e.g. function pointer resolving.

By default egl is used if compiled with OpenGL ES, otherwise glx is used.
But in the non-gles case the windowing system can be selected through the
new environment variable KWIN_OPENGL_INTERFACE. Setting this variable to
"egl" the EglOnXBackend is used.

REVIEW: 106632
2012-10-04 17:17:01 +02:00
Martin Gräßlin c2a4f81927 Introduce a helper class to automatically push/pop Shaders
The ShaderBinder class can be used for the case that a block of code
should be executed with a given Shader being bound. This is useful for
all the cases where there is a if-block for OpenGL2 execution with a
Shader being pushed in the first line to the ShaderManager and popped in
the last line of the block. With the helper this can be simplified to:

ShaderBinder binder(myCustomShader);

or

ShaderBinder binder(ShaderManager::GenericShader);

The ctor of ShaderBinder pushes the given Shader to the stack and once
the helper goes out of scope it will be popped again from the stack.

In addition the helper can take care of OpenGL 1 compositing, that is it
just does nothing. So it can also be used where there is a shared OpenGL1
and OpenGL2 code path where the Shader should only be pushed in OpenGL2.
This basically removes all the checks for the compositing type before
pushing/popping a Shader to the stack.

REVIEW: 106521
2012-09-29 15:33:57 +02:00
Casian Andrei e26cc0a4cf CC: Remove a couple of extraneous empty lines 2012-09-23 15:36:23 +03:00
Casian Andrei f219c108bb CC: Remove unnecessary init/uninit CC methods 2012-09-23 15:32:58 +03:00
Casian Andrei b17071555d CC: Fix blend function, it's different for cc enabled 2012-09-23 15:32:24 +03:00
Casian Andrei 8341d4406b Merge remote-tracking branch 'origin/master' into color2
Results in cleaner changes.
Put all the color correction stuff from SceneOpenGL in SceneOpenGL2.

Conflicts:
	kwin/eglonxbackend.cpp
	kwin/glxbackend.cpp
	kwin/scene.h
	kwin/scene_opengl.cpp
	kwin/scene_opengl.h
2012-09-23 11:57:38 +03:00
Martin Gräßlin 5a6d9400b2 Split SceneOpenGL into a concrete SceneOpenGL1 and SceneOpenGL2
SceneOpenGL turns into an abstract class with two concrete subclasses:
* SceneOpenGL1
* SceneOpenGL2

It provides a factory method which first creates either the GLX or EGL
backend which is passed to a static supported() method in the concrete
sub classes. These method can test whether the backend is sufficient to
be used for the OpenGL version in question. E.g. the OpenGL 2 scene
checks whether the context is direct.

The actual rendering is moved into the subclasses with specific OpenGL 1
and OpenGL 2 code. This should make the code more readable and requires
less checks whether a Shader is bound. This is now known through the
Scene: the OpenGL1 scene will never have a shader bound, the OpenGL2 scene
will always have a shader bound.

To make this more reliable the ShaderManager is extended by a disable
method used by SceneOpenGL1 to ensure that the ShaderManager will never
be used. This also obsoletes the need to read the KWin configuration
whether legacy GL is enabled. The check is moved into the supported
method of the OpenGL2 scene.

REVIEW: 106357
2012-09-16 21:28:11 +02:00
Martin Gräßlin db9368fc26 Merge the code to render Client's and Deleted's decoration in SceneOpenGL
The code was basically copy'n'pasted to handle both Client and Deleted
requiring to cast the Toplevel to both Client and Deleted to test whether
it is one of those.

This is now changed from runtime to compile time polymorphism. A
templated method is used to start the rendering process for the decos.
This on the one hand simplifies the code and on the other does not
require any dynamic casts any more as we use the available check on
Toplevel whether it is a Client or Deleted.
2012-09-16 21:28:06 +02:00
Martin Gräßlin fe440377bb Split SceneOpenGL::Window into specific classes for OpenGL 1 and 2
The Window implementation performed many checks whether the rendering
uses the OpenGL 1 or OpenGL 2 code path and there were quite a few
cludges around to make this work.

So instead of many if-else blocks the specific code has now been moved
into a specific sub class and calls to pure virtual method in the base
class are used to trigger this behavior. Although that adds some overhead
in a rather hot code path it should be better than the many chained
method calls used before to handle OpenGL 1 and 2.

It also makes the code a little bit more readable as all the complete
OpenGL 1 implementation is now in one block ifdefed for OpenGL ES.
2012-09-16 21:28:06 +02:00
Martin Gräßlin 6152cc4fa5 Split out the windowing system related part of SceneOpenGL
The handling for creating and managing the OpenGL context is
split out of the SceneOpenGL into the abstract OpenGLBackend
and it's two subclasses GlxBackend and EglOnXBackend.

The backends take care of creating the OpenGL context on the
windowing system, e.g. on glx an OpenGL context on the overlay
window is created and in the egl case an EGL context is created.
This means that the SceneOpenGL itself does not have to care
about the specific underlying infrastructure.

Furthermore the backend provides the Textures for the specific
texture from pixmap operations. For that in each of the backend
files an additional subclass of the TexturePrivate is defined.
These subclasses hold the EglImage and GLXPixmap respectively.

The backend is able to create such a private texture and for
that the ctor of the Texture is changed to take the backend as
a parameter and the Scene provides a factory method for
creating Textures. To make this work inside Window the Textures
are now hold as pointers which seems a better choice anyway as
to the member functions pointers are passed.
2012-09-16 21:28:05 +02:00
Casian Andrei ba4cd78419 CC: Redo init and uninit, try to avoid fatal IO errors
Additional checks for GL errors.
Attempt to fix transparency issues again.
2012-09-16 16:30:35 +03:00
Casian Andrei 8bec3fda71 CC: Fix color correction init signal connections 2012-09-16 14:29:06 +03:00
Casian Andrei 59d2fa7a10 Merge branch 'master' into color2
Conflicts:
	kwin/scene_opengl.cpp
	kwin/workspace.cpp
2012-09-04 21:55:21 +03:00
Casian Andrei 005ab28ad6 CC: No singleton for ColorCorrection 2012-08-27 17:24:30 +03:00
Casian Andrei 1fbb413daf CC: Tweak lanczos filter member 2012-08-27 15:53:40 +03:00
Casian Andrei 23f3b2a571 CC: Rename performPaint to performPaintWindow and make it non-virtual 2012-08-27 15:41:46 +03:00
Casian Andrei 7d331ea7ff CC: Rename "glColorCorrection" property to "colorCorrected" 2012-08-27 15:29:59 +03:00
Martin Gräßlin 2d954a6bf3 Make the Scene owned by the Compositor
The Scene has always been created and destroyed inside what is
now the split out compositor. Which means it is actually owned
by the Compositor. The static pointer has never been needed
inside KWin core. Access to the Scene is not required for the
Window Manager. The only real usage is in the EffectsHandlerImpl
and in utils.h to provide a convenient way to figure out whether
compositing is currently active (scene != NULL).

The EffectsHandlerImpl gets also created by the Compositor after
the Scene is created and gets deleted just before the Scene gets
deleted. This allows to inject the Scene into the EffectsHandlerImpl
to resolve the static access in this class.

The convenient way to access the compositing() in utils.h had
to go. To provide the same feature the Compositor provides a
hasScene() access which has the same behavior as the old method.
In order to keep the code changes small in Workspace and Toplevel
a new method compositing() is defined which properly resolves
the state. A disadvantage is that this can no longer be inlined
and consists of several method calls and pointer checks.
2012-08-26 20:43:57 +02:00
Casian Andrei a417888b0e Implement color correction support
The implementation consists of a class in libkwineffects.

There are some slight modifications in the compositor. Regions for
different outputs are drawn at different times.

Currently only per output color correction is implemented. However, the
grounds are prepared for implementing per window color correction
easily.

The ColorCorrection class needs to communicate via D-Bus with a KDED
module, KolorServer, which is a part of KolorManager.

The only visible part for the user consists of a check box in the
advanced tab for the compositing KCM.

The actual correction is done by injecting a piece of code in the
fragment shader, code that does a 3D lookup into a special color lookup
texture. The data for these textures is obtained from KolorServer. All
D-Bus calls are async.
2012-08-20 20:37:25 +03:00
Martin Gräßlin c7262e8bd3 Getter/setters for opacity, saturation and brightness in WindowPaintData
The public member variables for opacity, saturation and brightness
are removed in favor for getter and setters. The variables are
moved into a private class. Those are now qreal instead of double.

To make usage inside the effects easier a multiply method is added
which multiplies the current value with passed in factor and returns
the new value in a functional programming style.

This commit is the top-most of a patch series to refactor
ScreenPaintData and WindowPaintData. Other related commits are:
* 0811772
* ebdc7ec
* 2c8dd8d
* 7699726
* 68e0201
* 611cb09

REVIEW: 105141
BUG: 303314
FIXED-IN: 4.10
2012-07-19 18:25:48 +02:00
Martin Gräßlin f723f132ca Drop support for explicit contents opacity from WindowPaintData
No effect has ever made use of contents opacity. Which means it
is not needed. Removing means faster effects as we used to
multiply the value (always 1.0) with the opacity in each frame
for each window.
2012-07-19 18:25:03 +02:00
Martin Gräßlin dd067b075b Split out common part of ScreenPaintData and WindowPaintData
New common d-pointered class PaintData is added which cannot
be instantiated.
2012-07-19 18:25:03 +02:00
Martin Gräßlin a2b0d42916 Replace translation by QVector3D in Screen/Window PaintData 2012-07-19 18:25:03 +02:00
Martin Gräßlin 0eff12eb92 Use QGraphicsScale for scale information in ScreenPaintData 2012-07-19 18:25:03 +02:00
Martin Gräßlin 966047ccd2 Replace custom RotationData with QGraphicsRotation 2012-07-19 18:25:03 +02:00
Thomas Lübking fc665106c9 Swap vsync order, trade in 1frame lag
REVIEW: 103058
2012-05-17 11:41:26 +02:00
Philipp Knechtges 05a8777edf kwin: adding proper clipping for transformed windows
This patch kind of reintroduces the old PaintClipper functionality.

REVIEW: 104397
2012-05-01 23:19:04 +02:00
Philipp Knechtges 93b2674313 kwin: dropping several gl(Push|Pop)(Attrib|Matrix) calls
This makes kwin in OpenGL2 mode more coherent with kwin_gles.
Despite some fullscreen effects they should now make the same
(pure) OpenGL calls.

REVIEW: 103804
2012-04-19 21:01:46 +02:00
Martin Gräßlin 212908ee88 Refactoring of KWin::Options: getter methods instead of public variables 2012-02-27 19:31:58 +01:00
Thomas Lübking ac4a29ceea Merge branch 'KDE/4.8' 2012-02-12 17:29:07 +01:00
Thomas Lübking d39c190c40 fix NPOT + raster decoration
BUG: 282882
2012-02-12 16:33:23 +01:00
Thomas Lübking 7d8ab4c593 fix NPOT shadows
a) fixes the texture offset calculation
b) arranges he shadow pixmaps as border in the texture to avoid interpolation issues.

BUG: 280116
BUG: 282882
CCBUG: 291161
BUG: 293325
REVIEW: 103888
2012-02-09 19:07:35 +01:00
Thomas Lübking a227847efc fix NPOT shadows
a) fixes the texture offset calculation
b) arranges he shadow pixmaps as border in the texture to avoid interpolation issues.

BUG: 280116
BUG: 282882
CCBUG: 291161
BUG: 293325
REVIEW: 103888
2012-02-09 18:11:03 +01:00
Philipp Knechtges ca8484eff7 kwin: avoid unnecessary texture binds
In cases where we do neither update nor render textures
we don't have to bind them.
2012-01-31 23:10:57 +01:00
Philipp Knechtges 050d991cb1 kwin: simplifying paintSimpleScreen
This patch reduces the number of QRegion and WindowQuadList operations
by drawing the opaque and translucent parts of the window within the
same bottom to top pass.

REVIEW: 103671
2012-01-11 18:04:28 +01:00
Martin Gräßlin 6e445fb75c Less unused parameter/variable warnings in kwin
SVN_SILENT
2011-12-31 15:08:54 +01:00
Philipp Knechtges 9e2b6edf02 kwin: bugfix nouveau GLES + loose texture bindings in kwin_gles
There seems to be a problem with nouveau GLES if you want to create an
EGLImageKHR more than once in a frame for the same pixmap. This patch
circumvents the problem in the way that it implements tfp the same way
as the mesa example in
mesa/demos/src/egl/opengles1/texture_from_pixmap.c does it. A nice
side effect of this is that it also avoids the overhead of recreating
the texture for every damaged window.

REVIEW: 103303
2011-12-01 22:38:20 +01:00
Thomas Lübking eedba353d6 simplify opengl shadow building code
REVIEW: 103236
(cherry picked from commit 9ff807b192313c01d2e4d77a2db791bd7b53b680)
2011-11-27 15:03:52 +01:00
Philipp Knechtges e81c68fee8 kwin: fix graphical glitches for the nvidia blob
This is a perliminary fix. Should be fixed properly once we have a real statemachine.
2011-08-25 10:29:23 +02:00
Philipp Knechtges 4f50a8df3c kwin: Implement "use by value" and implicit sharing for GLTexture.
Additionally:
- hide the GLTexture implementation using dpointers
- drop the unused function SceneOpenGL::Texture::optimizeBindDamage()
- Texture::load now loads a new texture and does not update the existing one

REVIEW: 101999
2011-08-14 17:08:54 +02:00
Martin Gräßlin 987bc837d9 Remove define KWIN_HAVE_OPENGL_COMPOSITING
Due to changes in build system we have always either OpenGL or OpenGL ES.
This allows to remove the KWIN_HAVE_OPENGL_COMPOSITING define. In the
effects the define is kept as KWIN_HAVE_OPENGL which can be used in
future to build also an XRender only effect system.
2011-08-13 16:46:43 +02:00
Martin Gräßlin f72f465c13 Fix Typos
Krazy--
SVN_SILENT
2011-08-03 08:25:10 +02:00
Martin Gräßlin 3232c2cb2a Remove duplicate includes
Krazy--
SVN_SILENT
2011-08-03 08:25:10 +02:00
Arthur Arlt d8072be54d Move OverlayWindow from Workspace to its own class
All the functionality of Overlay Window is moved to its own class
OverlayWindow. It is created and owned by class Scene, since almost
all function calls are called from this class.

REVIEW: 101866
2011-07-09 19:08:48 +02:00
Philipp Knechtges 8a9725a68b kwin: update the decoration texture although we dont paint the decoration
We have to update the texture because the next time client->decorationPixmapRequiresRepaint()
might return false.
2011-07-06 17:24:07 +02:00
Martin Gräßlin c4cd4e8c96 Replace getYInverted by the new isYInverted of parent class 2011-07-05 20:42:45 +02:00
Martin Gräßlin a360d59f7e Remove intersection of region with visible rect
No longer needed as the splitting into quads will perform the
intersection.
2011-07-05 20:18:21 +02:00
Martin Gräßlin 55c1f3ae96 Include transformed windows in quad transition
Only transformed quads may not be changed, so we skip those.
2011-07-05 20:18:20 +02:00
Martin Gräßlin 76eb3c3391 Remove clipping against the bounding rect of paint region 2011-07-05 20:18:19 +02:00
Martin Gräßlin cd82616ece Remove PaintClipper from OpenGL Scene rendering
Construct window quads which will end on the screen instead of
rendering the windows several times and using scissoring to
restrict to the area which will end on screen.

REVIEW: 101765
2011-07-05 20:17:29 +02:00
Martin Gräßlin bb8b92f93d Don't render shadows if there are no quads 2011-07-05 20:15:11 +02:00
Arthur Arlt 02e08be5bd Merge signals clientClosed() and unmanagedClosed() to windowClosed()
This commit merges the two signals clientClosed() and unmanagedClosed() to windowClosed() which
is now provided by Toplevel.
The approriate slots in effects.h and effects.cpp were merges as well, since they did the
same.
The direct method calls of the method windowClosed() in SceneOpenGL and SceneXRender were
removed and are now connected to the appropriate signal in windowAdded().
2011-07-05 11:46:13 +02:00
Arthur Arlt 859dacb8b5 Make Scene::windowClosed() a Q_SLOT
This commit just makes the declaration of windowClosed() in Class Scene be a Q_SLOT.
The inheriting classes SceneOpenGL and SceneXRender are updated as well.
2011-07-05 11:46:13 +02:00
Arthur Arlt b63c9c1af8 Make mothod windowGeometryShapeChanged() a slot
The method windowGeometryShapeChanged() from the class Scene is now a slot. It is now connected to the signal geometryShapeChanged() which is sent from Toplevel instances Client and Unmanaged.
All direct method calls were deleted.
2011-07-05 11:34:12 +02:00
Arthur Arlt 59a8aac752 Make windowOpacityChanged() a slot
The method windowOpacityChanged is now a protected slot in class Scene. The implementations in the subclasses SceneOpenGL and SceneXRender are the same. The slots are connected to the singal opacityChanged() from Toplevel. The connection is done in the method windowAdded() in both SceneOpenGL and SceneXRender.
2011-07-05 11:34:12 +02:00
Martin Gräßlin b837a3fca1 Render Shadow with only one GL texture
Copies the shadow parts into one image and creates a GLTexture
from the image, so that we can render the complete shadow with
just one texture and one painting pass.

Should remove most of the overhead involved when rendering the new Shadows.

As a side effect this should fix missing shadows with non-NPOT GPUs and
a rendering glitch reported with NVIDIA.

REVIEW: 101742
2011-07-03 09:24:28 +02:00
Martin Gräßlin f978d7b97d Fix decoration rendering with GL_TEXTURE_RECTANGLE_ARB
When using graphicssystem native the texture may be using
GL_TEXTURE_RECTANGLE_ARB instead of GL_TEXTURE_2D. This
needs to be honoured in order to make KWin work reliable
with e.g. R300 chipsets.

BUG: 274607
CCBUG: 276622
FIXED-IN: 4.7.0
2011-07-01 18:04:15 +02:00
Martin Gräßlin b470ef52a9 Fix major window rendering regression with NPOT textures
The adjusted code for generating texture coordinates did not
take care of GL_TEXTURE_RECTANGLE_ARB textures causing the
generation of wrong texcoords.

BUG: 276622
FIXED-IN: 4.7.0
2011-06-30 17:47:06 +02:00
Martin Gräßlin a05ad98896 Remove textureWidth/textureHeight from all Shaders
The uniforms textureWidth and textureHeight were only needed for
normal windows. For everything else it was just 1.0/1.0, that is
normalized.

The makeArrays method is changed to produce normalized texcoords
obsoleting the need for these uniforms. So two uniforms less, one
calculation in vertex shaders less and many many lines of code
removed.

At the same time makeArrays is also adjusted to take care of
yInverted of the texture, which is needed as we no longer can use
the enableUnnormalizedTexCoords which did the yInverted transformation.

REVIEW: 101646
2011-06-19 20:54:13 +02:00
Thomas Lübking 3af7395ab8 avoid calling QPixmap::paintEngine() in scene rendering
by checking the graphicssystem at startup
also avoid pixmap and memory leaking on the xrender backend, validate some pointers
on deletion in SceneOpnGL and avoid attempts to render ::isNull pixmaps
2011-06-11 15:23:03 +02:00
Philipp Knechtges 5577cc769b kwin: bug fix for crash when using the raster backend
It seems to be possible to generate a QPixmap that is not null,
but doesnt have a paintEngine.
2011-05-19 21:41:30 +02:00
Philipp Knechtges da82739301 kwin: Make SceneOpenGL::makeDecorationArrays aware of Texture::y_inverted 2011-05-18 21:09:59 +02:00
Martin Gräßlin 234ec644d2 KWin supports graphicssystem Raster
With raster a QPixmap is no longer a XPixmap which fails all code
which assumes that an QPixmap is an XPixmap. Depending on were in
the codebase we either convert such pixmaps to images (OpenGL) or
create a XPixmap and use QPixmap::fromX11Pixmap to get a "real"
pixmap.

It is possible that there are more code pathes were we would need
a XPixmap. Currently tested is basic functionality of no-compositing,
XRender compositing, OpenGl/GLX and OpenGL ES/EGL compositing.

For OpenGL compositing raster might result in performance improvements,
for XRender it is possible that there are regressions when using raster.
By default KWin uses whatever is the default of the system, so we just
no longer enforce native.

Of course it is a bad idea to use graphicssystem OpenGL. As that
is broken anyways in Qt, we do not check for it.

Many thanks to Philipp Knechtges for bringing up the issue, convincing
me that we need it and providing most of the patch.

REVIEW: 101132
CCMAIL: Philipp.Knechtges@rwth-aachen.de
2011-05-12 18:52:38 +02:00
Martin Gräßlin 264fcfa49f Remove selfcheck code from OpenGL
Execution was ifdefed, if we want it again we have a VCS.
2011-05-12 17:59:57 +02:00
Martin Gräßlin 022d7a32a0 Remove binding of selection to styled EffectFrame
This allows to just set the selection on a None EffectFrame so
that only the selection is rendered without blurring the background
and so on.
2011-04-28 13:49:22 +02:00
Martin Gräßlin 001b9da6d8 Perform glFlush before deleting the EffectFrame's pixmaps
On NVIDIA it is possible that the actual rendering gets delayed to
after the deletion of the pixmap during the end of fullscreen effects.
This was causing freezes. By using glFlush before deleting the pixmaps
we can ensure that the pixmap is not needed anymore after the pixmaps
are deleted.

BUG: 261323
FIXED-IN: 4.6.3
2011-04-24 20:24:04 +02:00
Martin Gräßlin 38e9ab9a4e Move ownership on Shadow from Toplevel to Scene::Window
The Shadow is clearly an aspect of the compositor. Therefore the
Shadow has to be owned and controlled by the Scene::Window.
Nevertheless Toplevel needs to know about the Shadow cause of reading
the property.
2011-04-03 11:31:33 +02:00
Martin Gräßlin ea17b3562c Add debug rendering for shadow code 2011-03-30 20:33:08 +02:00
Martin Gräßlin 0667076fab Shadow texcoords are normalized
Set texture width/height to 1.0, so that we see the shadow.
2011-03-30 20:33:08 +02:00
Martin Gräßlin 12220a0d59 Initial implementation of new Shadows in KWin
For a complete documentation of new functionality refer to:
http://community.kde.org/KWin/Shadow

The current implementation includes a new Shadow class and Toplevel
holds a pointer to an instance of this class. The Shadow class reads
the data from the X11 Property. There is one extended class located
in SceneOpenGL to render the shadow.

Compositor is adjusted to include the shadow region into the painting
passes.

Implementation for XRender still missing and Shadow needs to respond
to size changes of the Toplevel to update cached shadow region and
WindowQuads.
2011-03-27 12:33:07 +02:00
Jammy Zhou 9a8d5c88ae Fix GL error when do texture from pixmap
This problem happens on Freescale imx51 ARM platform

CCMAIL: patches@linaro.org
2011-03-11 09:04:01 +08:00
Martin Gräßlin 57d11c134a Move kwineffects library into own directory
Second part of cleaning up the lib directory: the effects library
now lives in libkwineffects/ directory.

For existing effects nothing changes as the install path is unchanged.
The change obsoletes the lib/ directory.

As glplatform.h has not yet been exported I dared to export it and
adjust the places where it is used.
CCMAIL: kwin@kde.org
2011-02-19 10:01:31 +01:00
Fredrik Höglund d2078d4b9b kwin: Refactor the screen transformation code
Move the code that computes the transformation matrix to its
own method, and rewrite it to improve readability.
2011-02-17 19:19:40 +01:00
Fredrik Höglund 90f6cbfa5e kwin: Fix the clip intersection code
The code that intersected the clip region with the window region
appears to have been accidentally lost in 5ce3c6b8.
2011-02-16 00:08:47 +01:00
Fredrik Höglund 5d29307f58 kwin: Refactor the window transformation code
Move the code that computes the transformation matrix into its own
method, and rewrite it to improve readability.
2011-02-15 23:02:21 +01:00
Fredrik Höglund 423cd29afa kwin: Simplify the code for updating the texture filter 2011-02-15 23:02:21 +01:00
Fredrik Höglund 73be6657ea kwin: Replace brightness and opacity with a modulation constant
This makes it possible to adjust both brightness and opacity
at the same time with one multiplication in the fragment shader.
2011-02-12 01:45:38 +01:00
Fredrik Höglund 2fa966e0f9 kwin: Use the new setUniform() overloads in kwin core 2011-02-10 19:37:51 +01:00
Fredrik Höglund 6a72efea96 kwin: Fix a typo in a setUniform() call 2011-02-10 18:47:52 +01:00