Commit graph

43 commits

Author SHA1 Message Date
Martin Gräßlin
7f3b349ab3 Recommend OpenGL2 compositor for virtualbox and vmware
This ensures that those compositors are not forced to XRender.

BUG: 337560
FIXED-IN: 5.0.1
2014-07-22 13:21:23 +02:00
Martin Gräßlin
e8241313fc [libkwineffects] Require strict binding for intel driver
According to driver devs it's a "buggy micro-optimisation", see
https://bugs.freedesktop.org/show_bug.cgi?id=80349#c1

BUG: 336589
REVIEW: 118893
2014-06-24 09:26:46 +02:00
Martin Gräßlin
b09dd0d7f1 [kwinglutils] Add ::platformInterface() to GLPlatform
The used platform interface is passed to the ::detect method as an
argument. The value is now cached in the GLPlatform instance so that
there is an easy way to figure out which platform interface is currently
used.
2014-05-13 09:23:03 +02:00
Martin Gräßlin
c837ffddf4 Add a cleanup() method to GLPlatform
Adds a cleanup() method to GLPLatform which deletes the static instance.
It gets invoked from cleanupGL() in kwinglutils on tear-down of the
OpenGL backend. Thus the backend doesn't leave incorrect GL info around.

E.g. if KWin starts with llvmpipe the recommended compositor is XRender.
So the backend and the platform is created. Now KWin starts the XRender
Compositor and the GLPlatform is still valid and when trying to load the
Blur or Contrast effect this will succeed as the GLPlatform data would
allow it. But on first try to use the Effect it will fail due to no
valid OpenGL context and even crash.

REVIEW: 117480
2014-04-14 08:31:39 +02:00
Bhushan Shah
27deaa2d46 Try using OpenGL2 compositor on the Intel i915 and newer chipsets.
If it causes problem it can be still reverted

REVIEW: 117053
2014-03-28 22:25:10 +05:30
Martin Gräßlin
89c2688f74 [kwin] Drop direct rendering detection from GLPlatform
It's no longer needed as the OpenGLBackend has a direct rendering
detection and the remaining OpenGL2 backend aborts if the backend
uses indirect rendering. Thus the GLPlatform must always have a
direct rendering context.

REVIEW: 116829
2014-03-17 10:58:59 +01:00
Martin Gräßlin
c7d986c7fe [kwin] Remove the legacy OpenGL 1 compositing backend
KWin already has a de facto OpenGL 2 dependency through QML. Combined
with the fact that the OpenGL 1 backend is basically unmaintained and
also unused, it's better to remove it for the new major release.

This change includes:
 * Removal of cmake option KWIN_BUILD_OPENGL_1_COMPOSITING
 * Removal of KWIN_HAVE_OPENGL_1 compile option and all code
   ifdef'ed with it (partially removal of if-else constructs)
 * Removal of CompositingType::OpenGL1Compositing (flags are kept
   as a core flag should get introduced)
 * Driver recommendation for OpenGL1Compositing changed to XRender
   (should be evaluated whether the drivers can provide GL2)
 * Removal of configuration option "GLLegacy"
 * Removal of fooMatrix function in kwinglutils
 * Removal of ARBBlurShader
 * Removal of legacy code path in GLVertexBuffer
 * Removal of GLShaderManager::disable
 * if-blocks with ShaderManager::instance()->isValid() removed

REVIEW: 116042
2014-03-10 08:59:11 +01:00
Martin Gräßlin
0d6dfd83a1 Drop workaround for QTBUG-34898
Fixed as of 91e2c5d749e38eed93e91b14151faa549e70080f in
qtdeclarative module. Part of at 5.2.1.
2014-03-08 14:41:12 +01:00
Martin Gräßlin
416898ecfa Remove kwinglobals.h include where not needed any more
Most headers only included kwinglobals.h just for the KWIN_EXPORT
macro. As that's not used any more, we don't need that include any
more.
2013-12-02 07:56:16 +01:00
Martin Gräßlin
2e3eb5402b Fallback to XRender if scene-graph uses GUI thread for OpenGL rendering
This is a workaround fo QTBUG-34898 and affects the VirtualBox driver
and SandyBridge Mobile. OpenGL compositing is just not possible and
crashes as soon as there is anything rendered with QtQuick. This change
should be reverted once the Qt bug is fixed.

To nevertheless use OpenGL one can as always use the KWIN_COMPOSE env
variable, though this will result in crashes. An alternative is to set
QT_OPENGL_NO_SANITY_CHECK which forces Qt into using the threaded
rendering. At least for Sandybridge this seems to be a workable solution
as it's only causing flickering in fullscreen and KWin doesn't use any
fullscreen QtQuick elements.
2013-11-23 10:54:41 +01:00
Martin Gräßlin
969e6b85e7 Merge branch 'master' into frameworks-scratch
Conflicts:
	CMakeLists.txt
	kwin/client.cpp
	kwin/effects/highlightwindow/highlightwindow.cpp
	kwin/libkwineffects/kwingltexture.cpp
	kwin/libkwineffects/kwinxrenderutils.cpp
	kwin/scene_opengl.cpp
	kwin/workspace.cpp
	plasma/desktop/applets/kickoff/CMakeLists.txt
	plasma/desktop/applets/taskmanager/package/contents/code/tools.js
	plasma/desktop/applets/taskmanager/package/contents/ui/Task.qml
	plasma/desktop/applets/taskmanager/package/contents/ui/main.qml
	plasma/desktop/applets/taskmanager/package/metadata.desktop
	plasma/desktop/applets/taskmanager/plugin/textlabel.h
	plasma/desktop/applets/tasks/CMakeLists.txt
	plasma/desktop/applets/tasks/package/metadata.desktop
	plasma/desktop/applets/tasks/tasks.cpp
	plasma/desktop/toolboxes/plasma-toolbox-desktoptoolbox.desktop
	plasma/generic/applets/activitybar/activitybar.cpp
	plasma/generic/wallpapers/color/plasma-wallpaper-color.desktop
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
2013-09-24 11:28:38 +02:00
Thomas Lübking
3859f67862 glsl is not supported on indirect contexts
and fglrx yells an invalid_enum error when being asked
for the version

BUG: 323527
FIXED-IN: 4.11.2
REVIEW: 112419
2013-09-08 23:43:04 +02:00
Martin Gräßlin
9291b18cee Merge branch 'master' into frameworks-scratch
Conflicts:
	CMakeLists.txt
	kwin/effects.cpp
	kwin/effects/logout/logout.cpp
	kwin/effects/presentwindows/main.qml
	kwin/effects/presentwindows/presentwindows.cpp
	kwin/effects/presentwindows/presentwindows.h
	kwin/effects/zoom/zoom_config.cpp
	kwin/libkwineffects/kwinglutils_funcs.cpp
	kwin/libkwineffects/kwinxrenderutils.cpp
	kwin/nvidiahack.cpp
	kwin/xcbutils.h
	plasma/desktop/containments/desktop/plasma-containment-desktop.desktop
	plasma/generic/wallpapers/image/image.cpp
	plasma/generic/wallpapers/image/plasma-wallpaper-image.desktop
2013-08-07 10:10:06 +02:00
Martin Gräßlin
330d40f425 Fix no cast to/from ASCII intrduced issues
* "" needs to be wrapped in QStringLiteral
* QString::fromUtf8 needed for const char* and QByteArray
* QByteArray::constData() needed to get to the const char*
2013-07-24 09:58:33 +02:00
Fredrik Höglund
9de4c490ba kwin: Add GLPlatform::preferBufferSubData()
This method returns true when glMapBufferRange() is likely to perform
worse than glBufferSubData() when updating an unused range in a buffer
object.

This is the case with the NVIDIA driver, where glMapBufferRange()
will force thread serialization. The driver tracks which ranges of
the buffer are in use, so calls to glBufferSubData() should not
cause a pipeline stall.
2013-07-08 01:23:37 +02:00
Fredrik Höglund
2b00beecd2 kwin: Don't require GL_ARB_shading_language_100
This version of GLSL is not supported in a core context.
2013-05-08 18:33:02 +02:00
Fredrik Höglund
63e0d32706 kwin: Fix extension list query for core contexts
Use glGetStringi() to list the extensions when the GL version is 3.0
or greater. glGetString() does not accept the GL_EXTENSIONS token
in an OpenGL core context.
2013-05-08 18:33:01 +02: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
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
Kai-Uwe Behrmann
479be668d7 Merge branch 'color2'
Conflicts:
	kwin/libkwineffects/kwinglplatform.cpp
2012-11-07 23:54:18 +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
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
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
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
Casian Andrei
2dcf424d63 CC: Enable cc with OpenGL ES >= 3 (should support 3d textures) 2012-09-23 12:40:20 +03: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
Martin Gräßlin
e8a038d66f More getters for GlPlatform
A few more getters for parsed information are added to GlPlatform.
This includes the driver information retrieved through glGetString
and information like direct rendering and loose binding.

Additionally the methods to convert version, driver and chipClass
to string are added to the public interface.

These changes allow parts outside GlPlatform to get the same debug
information about the GL system.
2012-03-04 15:21:10 +01:00
Martin Gräßlin
90e59121dc Properly detect SandyBridge chipsets in GLPlattorm 2012-02-04 11:24:18 +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
Fredrik Höglund
d858df569c kwin: Update a quirk for Gallium drivers in Mesa 7.10
The bug that prevented loose binding from working should be
fixed in Mesa 7.10.1.
2011-11-09 18:02:06 +01:00
Martin Gräßlin
f5a187d224 Remove KWIN_HAVE_OPENGL from kwingl(es)utils
Yes building an OpenGL support library requires OpenGL...
2011-08-13 16:46:43 +02:00
Martin Gräßlin
9f78276dc7 Detect Driver "Software Rasterizer"
Fixes a major regression which allowed OpenGL
compositing to be used with software rasterizer, which
either did not work or crashed directly.

Cherry-picked from cf2f572 in branch KDE/4.7.
2011-08-03 20:02:15 +02:00
Fredrik Höglund
8c430e22b6 kwin: Add the Sumo and Cayman chipsets 2011-07-15 18:56:15 +02:00
Fredrik Höglund
31ea6ff0b8 kwin: Reorder the Evergreen chipsets to match the order in r600g 2011-07-15 18:51:54 +02:00
Fredrik Höglund
7f4709b4ea kwin: Whitespace fixes 2011-07-15 18:47:52 +02:00
Martin Gräßlin
1dd614ee4b Improved detection of OpenGL software emulation
Adding a new method to retrieve whether the OpenGL implementation
uses any kind of software emulation and no software emulation can
provide GLSL support, even if it claims so.

Thanks to Maurel for testing again and again proposed patches.

BUG: 271166
2011-05-06 18:16:38 +02:00
Jammy Zhou
d9d97a471b Integrate patch for gles and glsl-es version detection
Integrate Martin Gräßlin's commit b578d in http://gitweb.kde.org/scratch/graesslin/kwin-gles.git
to support GLES and GLSL-ES version detection.
2011-02-24 09:42:03 +08:00
Jammy Zhou
f970eab391 return correct GLSL version 2011-02-19 21:03:04 +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
Renamed from lib/kwinglplatform.cpp (Browse further)