Commit Graph

202 Commits (0e8b4ffb0cb70d1782ba16b38b72b00af692712d)

Author SHA1 Message Date
Fredrik Höglund 4821c15b97 kwin: Add a function that returns the xcb_connection_t 2012-11-07 22:13:12 +01:00
Fredrik Höglund 6e9901e5c3 Merge branch 'KDE/4.9'
Conflicts:
	kwin/eglonxbackend.cpp
	kwin/glxbackend.cpp
	kwin/libkwineffects/kwinglplatform.cpp
2012-10-30 23:26:06 +01:00
Fredrik Höglund e262d4fde6 kwin: Enable loose binding with the Intel driver 2012-10-30 18:23:06 +01:00
Fredrik Höglund 076ea58732 kwin: Rename numberVertices to vertexCount 2012-10-29 21:31:35 +01:00
Fredrik Höglund 82c1e1168d kwin: Store the usage hint in GLVertexBufferPrivate
..instead of computing it every time setData() is called.
2012-10-29 21:31:35 +01:00
Christophe Giboudeaux 007733f14a Fix include 2012-10-29 17:20:19 +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
Martin Gräßlin e84118d9f8 Add detection support for VMware driver (SVGA3D) to GLPlatform
VMware uses a Gallium driver which means that OpenGL based compositing
works out of the box without any adjustments to GLPlatform.

Just adding recognizing code for the SVGA3D driver.

REVIEW: 106826
2012-10-25 11:27:42 +02:00
Martin Gräßlin 388edab9e5 Add support for OpenGL in VirtualBox
OpenGL is properly working if there is a direct rendering context.
If LIBGL_ALWAYS_INDIRECT is set VirtualBox falls back to Mesa's software
rasterizer. So in order to get OpenGL the driver is now whitelisted in
the opengltest.

GLPlatform is extended to recognize the VirtualBox driver and has new
methods to report whether it is a virtual machine and VirtualBox. The
detection is rather limited as we don't get access to the underlying
hardware, so we do not know whether the features are really supported.
We need to trust the driver here in announcing the right extensions.

The driver does not provide glxQueryDrawable although it is part of
GLX 1.3. A hack is added in the glxbackend to set the function pointer to
NULL. This can unfortunately not be done in glxResolveFunctions() as
QueryDrawable seems not to be provided by an extension (at least not
listed in the OpenGL registry) and getProcAddress resolves a function but
it only prints an OpenGL Warning to stderr.

As a note: the driver reports that it is using XSHM for
GLX_EXT_texture_from_pixmap.

REVIEW: 106821
2012-10-25 11:27:28 +02:00
Martin Gräßlin 711b434970 Detect latest Intel hardware in GLPlatform
Added support for IvyBridge and Haswell.

REVIEW: 106819
2012-10-25 11:27:14 +02:00
Jurica Vukadin bcdc74f8d6 Fix more C++11 narrowing warnings
REVIEW: 106997
2012-10-24 20:43:19 +02:00
Jurica Vukadin e68955866d Fix C++11 narrowing warnings
REVIEW: 106992
2012-10-24 20:42:14 +02:00
Martin Gräßlin e962fd9ce2 Typo--
SVN_SILENT
2012-10-12 08:43:34 +02:00
Martin Gräßlin ba08ff6a14 Fix build error when GLES is not available
Note to me: always rebuild with all possible build options if something
is changed.

Sorry for the inconvenience and thanks to the early report of the issue.

BUG: 307866
FIXED-IN: 4.10
2012-10-06 13:44:12 +02:00
Martin Gräßlin 476adac337 Do not resolve glx functions specified in GLX 1.3
According to the OpenGL ABI for Linux GLX 1.3 is a minimum requirement.
Therefore we do not need to resolve the symbols which are present in that
version.

KWin did always require at least 1.3, for all the resolved functions
there were checks in the Scene, but they might have been incorrect.
Instead now the GLX version is checked and OpenGL compositing is blocked
if there is not at least GLX 1.3.

REVIEW: 106704
2012-10-04 17:17:51 +02:00
Martin Gräßlin 15d714d82c Do not resolve glBlendColor
glBlendColor has been added to OpenGL 1.2 which means it is part of
the OpenGL ABI defined for Linux.

See http://www.opengl.org/registry/ABI/ section 3.4.
2012-10-04 17:17:45 +02:00
Martin Gräßlin cf35c26396 Rework the resolving of OpenGL function pointers
The macro GL_RESOLVE_WITH_EXT was fundamentally broken as it tried to
resolve a symbol first by it's name and then by the extension name if
the returned pointer is null.

From GLX spec:
"A non-NULL return value for glXGetProcAddress does not guarantee that an
extension function is actually supported at runtime. The client must also query
glGetString(GL EXTENSIONS) or glXQueryExtensionsString to determine if an
extension is supported by a particular context."

This macro is now reworked to be used only in case the symbol name does
not match our function name. E.g. glUniform1f vs glUniform1fARB.

The resolving itself also had quite some issues as:
* in same cases function pointers are not nulled
* in same cases only the arb or only the ext is checked
* in same cases the wrong extension is checked

This is now reworked to always check first the ARB extension if available
then the EXT extension and if both are not available the pointers are set
to NULL.
2012-10-04 17:17:45 +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
Martin Gräßlin f9a2ecbf33 Do not use ShaderManager::isValid to check for OpenGL2 compositing
The main usage of ShaderManager::isValid was to have OpenGL2 specific
code pathes. Now we have an actual OpenGL2Compositing type and we know
that the ShaderManager is valid if we have this compositing type and we
know that it is not valid on OpenGL1Compositing. This gives us a much
better check and allows us to use the isValid method just for where we
want to check whether the shaders compiled successfully.

In addition some effects require OpenGL2, so we do not need to check
again that the ShaderManager is valid. Such usages are removed.
2012-09-29 15:33:57 +02:00
Martin Gräßlin 6d2dfe06e7 Introduce dedicated OpenGL1 and OpenGL2 compositing types
The CompositingType enum turns into flags and two new values are
introduced: OpenGL1Compositing and OpenGL2Compositing.

Those new values are or-ed to OpenGLCompositing so that a simple check
for the flag OpenGLCompositing works in case of one of those two new
values. To make the generic check for OpenGL compositing easier a method
in EffectsHandler is introduced to just check for this.

The scenes now return either OpenGL1Compositing or OpenGL2Compositing
depending on which Scene implementation. None returns OpenGLCompositing.
2012-09-29 15:33:57 +02: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
Fredrik Höglund f21ef431c4 kwin: Don't enable/disable texturing when using shaders
This state has no affect on the programmable pipeline.
2012-09-13 22:54:09 +02:00
Martin Gräßlin f775229a80 Don't use GL Matrix Stack on OpenGL 2 backend
Currently the GL Matrix Stack is also used with OpenGL 2.
That is pushMatrix, multMatrix and popMatrix are executed
although this does not influence the rendering at all. The
OpenGL 1 matrices are not passed to the shaders.

With this change the calls to the matrix stack are no longer
executed if the Shader based backend is used. This means we
have a few less matrix multiplications in the rendering.

Mostly affects a few effects which have not yet completely be
ported over to OpenGL 2.

BUG: 303093
FIXED-IN: 4.10
REVIEW: 105455
2012-07-22 10:17:12 +02: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
Martin Gräßlin 30bb8be037 Add activity support to Workspace Script Wrapper and Effects
New properties for the current activity and the available
activities plus related signals in scripts. Signals added to
effects.

BUG: 302060
FIXED-IN: 4.9.0
2012-06-24 18:35:56 +02:00
Martin Gräßlin 13fcc29d40 Reset error flag in checkGLError
From API doc:
glGetError should always be called in a loop, until it returns
GL_NO_ERROR.

REVIEW: 105127
2012-06-24 18:34:47 +02:00
Thomas Lübking 759eed1d62 remove (broken) mimpmap support check, disable use of mipmaps and align texture filter
BUG: 296289
FIXED-IN: 4.9
REVIEW: 105249
2012-06-18 22:11:28 +02:00
Martin Gräßlin a210b75009 Initialize variables in GLPlatform
m_textureNPOT and m_limitedNPOT have not been initialized in the ctor resulting in
m_limitedNPOT being incorrectly being true sometimes for Intel drivers. For other
drivers the value had been set.
2012-06-13 09:19:27 +02:00
Andre Woebbeking 6cde471ec8 -pedantic 2012-06-07 00:38:13 +02:00
Martin Gräßlin 812c310dcf Fix unused variable warnings
SVN_SILENT
2012-05-27 16:35:04 +02:00
Thomas Lübking fc665106c9 Swap vsync order, trade in 1frame lag
REVIEW: 103058
2012-05-17 11:41:26 +02:00
Thomas Lübking 41a39a9928 add clipping support to AnimationEffect
REVIEW: 104898
2012-05-10 19:35:13 +02:00
Martin Gräßlin f3443a6b07 Add CMake variable to rename kwin binaries
A CMake variable is used to specify the name of the binary.
By default this is "kwin" but building for PA changes the
name to "kwinactive". The variable adjusts all names, e.g.
kwinnvidiahack becomes kwinactivenvidiahack.

The remaining usage of kwinrc in core and libs is replaced
by a cmakedefine for the configuration name and all data
installations are moved to the defined name. Dynamic loading
for scripts & co is adjusted for loading based on defined name.

This change allows the side-by-side installation of both kwin
for desktop and kwin for Plasma Desktop without the known
issues like conflicts in config files or missing build options
if kwin desktop is used for Plasma Active.

Likewise the KCMs are not adjusted as they are not intended to
be used for kwinactive.

REVIEW: 104299
BUG: 296084
FIXED-IN: 4.9.0
CCMAIL: active@kde.org
2012-05-10 10:25:15 +02:00
Ghislain MARY c66c78f1d2 Key Bindings for Switching between Windows of current Application
Additional TabBox Mode which allows to switch between all open
windows of the current selected application. By default Alt+tilde
is used which is on qwerty just one key above tab. For non-qwerty
layouts the shortcut is unfortunately not convenient.

REVIEW: 104730
FEATURE: 299308
FIXED-IN: 4.9.0
2012-05-10 09:53:10 +02:00
Thomas Lübking a332bf183b add desktopChanged signal to effects that carries the optionally changing widget
CCBUG: 213847
FIXED-IN: 4.9
2012-05-03 22:56:27 +02:00
Thomas Lübking 3a6095726e Only reserve required electric borders for ElectricAlways
CCBUG: 293011
REVIEW: 104073
2012-05-03 19:48:20 +02:00
Thomas Lübking c67ba0fafb change animationEnded signature 2012-05-03 17:53:02 +02:00
Thomas Lübking 590d9b42d8 restrict animationeffect repaints
REVIEW: 103932
2012-05-03 17:52:49 +02:00
Martin Gräßlin eb5aa92746 Revert 236d4c8 for EffectsHanlder::effectConfig
EffectConfig is used also in the config modules which
means kwinrc needs to be explicitly specified.

BUG: 299163
REVIEW: 104808
2012-05-02 17:44:55 +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
Martin Gräßlin bb5dce0e3b Use KGlobal::config() instead of specifying kwinrc
Inside KWin we can just use the global configuration
instead of manually opening kwinrc which is just the
same.

REVIEW: 104754
2012-04-29 21:55:45 +02:00
Martin Gräßlin ed7d612ef3 Ensure that Extension::init() is only performed once
And call init from Workspace ctor before it gets called
somewhere else (e.g. in the compositor).

REVIEW: 104578
2012-04-22 22:29:17 +02:00