Commit Graph

55 Commits (1be3a7a9f074ddaf95a120ed72a3aac94a137042)

Author SHA1 Message Date
Martin Gräßlin b28effff23 A Scene doesn't need to use an X11 Overlay Window
Only the X based Scenes need an overlay window, so the Compositor doesn't
need to check for it in the Wayland case.

OverlayWindow is moved from OpenGLBackend to the sub classes which need
to provide it.
2014-01-08 09:22:40 +01:00
Martin Gräßlin afbc5222e1 Merge branch 'KDE/4.11' into master
Conflicts:
	CMakeLists.txt
	doc/kcontrol/screensaver/index.docbook
	kcontrol/krdb/krdb.cpp
	kscreensaver/kblank_screensaver/kblank.desktop
	kscreensaver/krandom_screensaver/krandom.desktop
	kscreensaver/libkscreensaver/main.cpp
	ksplash/ksplashqml/SplashApp.cpp
	kstyles/oxygen/config/main.cpp
	kstyles/oxygen/demo/main.cpp
	kstyles/oxygen/oxygenstylehelper.cpp
	kwin/clients/oxygen/config/oxygenexceptiondialog.cpp
	kwin/clients/oxygen/config/ui/oxygenconfigurationui.ui
	kwin/clients/oxygen/config/ui/oxygenexceptiondialog.ui
	kwin/clients/oxygen/demo/main.cpp
	kwin/clients/oxygen/oxygenconfigdata.kcfg
	kwin/egl_wayland_backend.cpp
	kwin/eglonxbackend.h
	kwin/glxbackend.cpp
	kwin/glxbackend.h
	kwin/kcmkwin/kwinoptions/kwinactions.desktop
	kwin/scene_opengl.cpp
	kwin/scene_opengl.h
	plasma/desktop/applets/pager/pager.cpp
	plasma/desktop/shell/activitymanager/activitymanager.cpp
	plasma/desktop/shell/activitymanager/activitymanager.h
	plasma/desktop/shell/controllerwindow.cpp
	plasma/desktop/shell/data/plasma-desktop.desktop
	plasma/generic/dataengines/geolocation/geolocation.cpp
	plasma/generic/dataengines/nowplaying/plasma-dataengine-nowplaying.desktop
	plasma/generic/wallpapers/color/plasma-wallpaper-color.desktop
	plasma/generic/wallpapers/image/image.cpp
	plasma/generic/wallpapers/image/image.h
2014-01-07 09:36:11 +01:00
Fredrik Höglund eeb309c149 kwin: Add support for EXT_buffer_age
This patch adds support for GLX_EXT_buffer_age, and
EGL_EXT_buffer_age on X11.
2013-12-12 01:36:46 +01:00
Fredrik Höglund c25b2939b1 kwin: Prepare the backend interface for EXT_buffer_age
Allow prepareRenderingFrame() to return a region that will be
repainted in addition to the damaged region.

Pass both the damaged region and the repainted region, which
may be larger, as parameters to endRenderingFrame().
2013-12-12 01:36:45 +01:00
Fredrik Höglund 12446c9b4c kwin: Don't call glFlush() unnecessarily in endRenderingFrame()
We should only call glFlush() here if we're deferring the posting
of the back buffer to the next prepareRenderingFrame() call.
2013-12-12 01:36:44 +01:00
Martin Gräßlin b7be3cb621 Better handling for making the compositing OpenGL context current
With QtQuick2 it's possible that the scene graph rendering context either
lives in an own thread or uses the main GUI thread. In the latter case
it's the same thread as our compositing OpenGL context lives in. This
means our basic assumption that between two rendering passes the context
stays current does not hold.

The code already ensured that before we start a rendering pass the
context is made current, but there are many more possible cases. If we
use OpenGL in areas not triggered by the rendering loop but in response
to other events the context needs to be made current. This includes the
loading and unloading of effects (some effects use OpenGL in the static
effect check, in the ctor and dtor), background loading of texture data,
lazy loading after first usage invoked by shortcut, etc. etc.

To properly handle these cases new methods are added to EffectsHandler
to make the compositing OpenGL context current. These calls delegate down
into the scene. On non-OpenGL scenes they are noop, but on OpenGL they go
into the backend and make the context current. In addition they ensure
that Qt doesn't think that it's QOpenGLContext is current by calling
doneCurrent() on the QOpenGLContext::currentContext(). This unfortunately
causes an additional call to makeCurrent with a null context, but there
is no other way to tell Qt - it doesn't notice when a different context
is made current with low level API calls. In the multi-threaded
architecture this doesn't matter as ::currentContext() returns null.

A short evaluation showed that a transition to QOpenGLContext doesn't
seem feasible. Qt only supports either GLX or EGL while KWin supports
both and when entering the transition phase for Wayland, it would become
extremely tricky if our native platform is X11, but we want a Wayland
EGL context. A future solution might be to have a "KWin-QPA plugin" which
uses either xcb or Wayland and hides everything from Qt.

The API documentation is extended to describe when the effects-framework
ensures that an OpenGL context is current. The effects are changed to
make the context current in cases where it's not guaranteed. This has
been done by looking for creation or deletion of GLTextures and Shaders.
If there are other OpenGL usages outside the rendering loop, ctor/dtor
this needs to be changed, too.
2013-11-23 10:54:41 +01:00
Martin Gräßlin 324aae916a [kwin] Drop testapp for detecting whether direct rendering works on glx
The main purpose of the opengl testapp was to set the environment
variable LIBGL_ALWAYS_INDIRECT if direct rendering is not supported
before glx gets initialized.

With Qt5 we may no longer set this environment variable. QtQuick
requires direct rendering. On IvyBridge QtQuick is crashing if the
variable is set. Thus we are no longer allowed to set it and thus the
complete test becomes pointless.

The test app basically whitelisted most drivers anyway, the only
drivers which were problematic are the proprietary Catalyst drivers.
It that's still a problem we can also disable OpenGL compositing on
those drivers through the recommendation in the GLPlatform.

This also means that the KWIN_DIRECT_GL variable is no longer useful.
2013-11-05 14:48:40 +01:00
Martin Gräßlin c2aacca735 Ensure that our compositing context is current when starting to render
With QtQuick2 KWin is no longer the only one having an OpenGL context
thus we need to ensure that our context is current. If not it results in
highly interesting crashes when our code is executed on the QtQuick
context.

The context is made current before we swap and before we start to render
a frame. During rendering a frame it's not made current again based on
the assumption that while we render there is no interference. If this
assumption doesn't hold, we need a more sophisticated solution at the
moment it seems to fix the crashes.
2013-09-26 11:13:40 +02:00
Thomas Lübking 3594550b14 Merge branch 'KDE/4.11'
Conflicts:
	kwin/eglonxbackend.cpp
	kwin/glxbackend.cpp
2013-09-25 23:21:36 +02:00
Thomas Lübking e63e5f5712 fix scheduling the repaints
repaints caused by effects so far polluted the timing calculations
since they started the timer on the old vsync offset
This (together with undercut timing) lead to multiple frames in
the buffer queue, and ultimately to a blocking swap

For unsynced painting, it simply caused wrong timings - leading to
"well, kinda around 60Hz - could be 75 as just well".

REVIEW: 112368
CCBUG: 322060
that part is fixed in 4.11.2
2013-09-25 23:09:18 +02: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
Antonio Larrosa f9109a3d4b Make kwin not crash under qemu due to failing glx call
This fixes a kwin crash that happened under qemu when running kwin for
the first time (subsequent runs had glx already disabled)
2013-09-17 19:06:40 +02:00
Antonio Larrosa 48057b33a8 Make kwin not crash under qemu due to failing glx call
This fixes a kwin crash that happened under qemu when running kwin for
the first time (subsequent runs had glx already disabled)
2013-09-17 18:07:17 +02:00
Martin Gräßlin 85ea66f736 Port remainind XSync calls to XCB variant 2013-09-10 15:30:11 +02:00
Martin Gräßlin 57905c0cc2 And we got rid of KDebug
Usages of kBacktrace got dropped.
2013-09-02 13:14:39 +02:00
Fredrik Höglund 3363f4f9ed kwin: Don't set the forward-compatible bit
This flag seems to be ignored by several OpenGL implementations,
so don't set it for now.  Mesa may also stop accepting this flag
until forward-compatible contexts are fully supported.
2013-08-07 23:14:06 +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 5d0433f20b Drop some no longer needed includes
Less warnings
2013-08-06 11:38:52 +02:00
Thomas Lübking ac32664dc1 keep buffer swap pref automatic until GPU detected
enforce to "e" (cheap) when driver is still unknown after
detection must be assumed to have run, so a sane value is available
when the context is up

BUG: 322355
FIXED-IN: 4.11
REVIEW: 111548
2013-08-02 22:03:54 +02:00
Thomas Lübking 50e3e909da prevent yield/swap cpu overhead on nvidia
CCBUG: 322060
REVIEW: 111663
2013-08-02 22:00:33 +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
Martin Gräßlin e479cfb156 Enable C++11 globally 2013-07-24 09:46:54 +02:00
Thomas Lübking 7f858da008 ignore unredirection configuration on intel
the only thing it does on these systems is cause users
trouble because usually when there's a client where
unredirection makes sense, that uses OpenGL - and then
things break in the driver.

CCBUG: 252817
REVIEW: 111476
2013-07-19 21:20:12 +02:00
Thomas Lübking 3ad47552d0 non-empty attrib_list for glXCreateContextAttribsARB
empty list is legal but causes bogus context on at least i915

BUG: 321843
REVIEW: 111355
FIXED-IN: 4.11
2013-07-08 18:53:37 +02:00
Fredrik Höglund 209e44cad2 kwin/glx: Relax the GLX_CONFIG_CAVEAT requirement
Allow drawable configs with caveats. The ARGB32 visual is marked as
non-conformant in the Catalyst driver.

BUG: 317972
2013-06-11 20:47:59 +02:00
Thomas Lübking 175f117af3 drop malicious waitSync
REVIEW: 110558
2013-06-05 14:11:00 +02:00
Thomas Lübking 6c998fc668 manage triple buffering
REVIEW: 110556
2013-06-05 14:10:59 +02:00
Fredrik Höglund 7a99b8c0ef kwin: Add GLTexture::matrix()
This method returns a matrix that transforms normalized or un-normalized
texture coordinates, taking the texture target and y-inversion flag into
account.
2013-05-28 16:35:36 +02:00
Fredrik Höglund 7f0d0436e9 kwin/glx: Add support for GLX_ARB_create_context_robustness
Request a context with robust buffer access behavior, and set the reset
notification strategy to GLX_LOSE_CONTEXT_ON_RESET_ARB.
2013-05-22 23:37:15 +02:00
Thomas Lübking 69ef2f9c16 tidy up
REVIEW: 109785
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
Fredrik Höglund 26f23b656b kwin/glx: Try to create an OpenGL 3.1 core context 2013-05-08 18:33:01 +02:00
Fredrik Höglund 84ad2585e1 kwin: Use glXCreateContextAttribsARB() when it's supported 2013-05-08 18:32:58 +02:00
Ralf Jung 72db0e5e71 remove GlVSync option (it has no UI anymore)
Based on (revision 2 of) https://git.reviewboard.kde.org/r/109086/ by Thomas Lübking

REVIEW: 109086
2013-03-28 19:05:52 +01:00
Ralf Jung eff856e8ef Re-add code I accidentally removed 2013-03-26 21:49:59 +01: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
Martin Gräßlin d021bf35c1 Skip framebuffer configs for depth 32 with no alpha
Fixes another problem on NVIDIA that RGBA windows were rendered
incorrectly.
2013-03-21 15:52:43 +01:00
Martin Gräßlin 0c4c16e93f Fix typo
Makes KWin work with NVIDIA again.
2013-03-21 12:40:49 +01:00
Fredrik Höglund 9c658a752c kwin: Simplify GLXBackend::initDrawableConfigs()
Use glXChooseFBConfig() instead of glXGetFBConfigs(), and prefer
the first usable configuration instead of the last.
2013-03-17 18:28:46 +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
Fredrik Höglund baeeb1b90b kwin: Simplify GLXBackend::initRenderingContext()
glXCreateNewContext() is supposed to return NULL on failure, so let's
assume that it does. Don't try to create an indirect context when
creating a direct context failed. glXCreateNewContext() should return
an indirect context when a direct context cannot be created.
2013-03-17 18:27:41 +01:00
Fredrik Höglund 96ed29497c kwin: Simplify GLXBackend::initBufferConfigs()
Use glXChooseFBConfig() instead of glXGetFBConfigs(), and prefer
the first usable configuration instead of the last.

Also rename initBufferConfigs() to initFbConfig().
2013-03-17 18:13:36 +01:00
Fredrik Höglund 8a14a0d610 kwin: Move some debug output to where it belongs 2013-03-17 18:08:54 +01:00
Fredrik Höglund 8446912502 kwin: Remove some left over support for GLX < 1.3
We require GLX_EXT_texture_from_pixmap which in turn requires GLX 1.3.
2013-03-17 18:01:52 +01:00
Fredrik Höglund e393cc9069 kwin: Rename some variables in GLXBackend
ctxbuffer       → ctx
glxbuffer       → glxDrawable
buffer          → drawable
fbcbuffer       → fbconfig
fbcbuffer_db    → fbconfig_db
fbcbuffer_nondb → fbconfig_nondb
2013-03-17 17:53:38 +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
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
Thomas Lübking 69b2804a12 Initialize some variables and check on destruction
BUG: 313911
REVIEW: 108604
2013-01-30 10:45:21 +01:00
Ralf Jung 96bc979ca8 Fix buffer swap prototypes
BUG: 309647
REVIEW: 107302
2012-11-18 12:50:31 +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