Commit graph

20 commits

Author SHA1 Message Date
Martin Gräßlin
d1de6899fd Move querying the egl extensions into the AbstractEglBackend
Summary:
Instead of having the egl extensions in the global kwinglutils lib it
becomes private to the AbstractEglBackend. Just like on glx the
glxextensions are moved into the platform.

The extensions are queried from initEglAPI, that is as early as possible
after initializing the EGLDisplay. This ensures that any implementing
subclass can access the extensions early enough.

As a note: the EglOnXBackend had a potentially wrong sequence for
initializing the buffer age extension. It is now moved to the correct
place where the result is needed for the first time.

From the global API eglExtensions are removed from hasGLExtension and
the eglExtensions function is dropped. As by that initEGL did not do
anything it is also dropped.

Test Plan:
Tested nested kwin on Wayland, still works, extensions shown
in debug console

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3396
2016-11-17 13:00:29 +01:00
Martin Gräßlin
d7fa827644 Pass function ptr to resolve glFunctions to initGL
Summary:
KWin still resolves some OpenGL function pointers. For that it needs to
use either eglGetProcAddress or glxGetProcAddress. With other words the
method to resolve needs to know whether it is egl or glx and needs both
a dependency to egl and glx. Especially the dependency to glx is ugly as
that pulls in XLib into our library.

The way so far was to pass an enum value to the initGL method to know
whether it's EGL or GLX. With this change the enum value is removed and
replaced by a function pointer to resolve the methods.

This simplifies the resolve code and allows to completely remove the glx
variant we still had in the library. Thus kwinglutils library is now glx
and XLib free.

Test Plan: nested KWin with OpenGL/EGL still works

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3336
2016-11-16 17:59:26 +01:00
Martin Gräßlin
996ee34e14 Remove the unredirect fullscreen windows functionality
Summary:
Rational: unredirect fullscreen windows is a weird beast. It's intended
to make fullscreen windows "faster" by not compositing that screen. But
that doesn't really work as KWin jumps out of that condition pretty
quickly. E.g. whenever a tooltip window is shown. KWin itself has a
better functionality by supporting to block compositing completely.
The complete code was full of hacks around it to try to ensure that
things don't break.

Overall unredirect fullscreen has always been the odd one. We had it
because a compositor needs to have it, but it never got truly integrated.
E.g. effects don't interact with it properly so that some things randomly
work, others don't. Will it trigger the screenedge, probably yes, but
will it show the highlight: properly no.

By removing the functionality we finally acknowledge that this mode is
not maintained and has not been maintained for years and that we do not
intend to support it better in future. Over the years we tried to make
it more and more hidden: it's disabled for Intel GPUs, because it used
to crash KWin. It's marked as an "expert" option, etc.

It's clearly something we tried to hide from the user that it exists.

For Wayland the whole unredirect infrastructure doesn't make sense
either. There is no such thing as "unredirecting". We might make use
of passing buffers directly to the underlying stack, but that will be
done automatically when we know it can be done, not by some magic is
this a window of specific size.

Test Plan:
Compiles, cannot really test as I am an Intel user who never
had that working.

Reviewers: #kwin, #plasma, #vdg

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2180
2016-08-04 14:48:35 +02:00
Martin Gräßlin
9d7ef58b2b Support restarting the OpenGL compositor on Wayland
Summary:
KWin needs to support restarting the OpenGL compositor in case of a
graphics reset event.

On Wayland the tricky part is that the applications should not notice
this. Most importantly KWin cannot just destroy the EGLDisplay and create
a new one. But this is how a restart works: the complete compositor gets
torn down and recreated - including the EGLDisplay.

This change moves ownership of the EGLDisplay to the Platform.
The AbstractEglBackend subclasses query the Platform whether there is
already an EGLDisplay. Only if there is no EGLDisplay the EGLDisplay is
created and only if no EGLDisplay is registered with Wayland the bind
is performed.

Another change is regarding the destruction: the AbstractEglDisplay does
no longer unbind the Wayland display and does no longer destroy the
EGLDisplay. The EGLDisplay is destroyed by the Platform - so very late
on application exit. The Wayland display is unbound when the Compositor
terminates.

Test Plan:
Limited testing with the added auto-test. This one needs to
be extended to fully verify that OpenGL applications continue to work.
But this requires build.kde.org to support OpenGL on Wayland.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2202
2016-07-20 14:08:23 +02:00
Martin Gräßlin
aa7fb81e00 Properly get error message for eglInitialize
If eglInitialize returns EGL_FALSE we should print a warning and try
to get the error code.
2016-07-15 10:04:39 +02:00
Martin Gräßlin
2b196bfa29 Move the loadTexture for X11 pixmap functionality to the EglOnXBackend
Summary:
To use eglCreateImageKhr for an X11 pixmap we need an EGLDisplay created
for the same XDisplay as the X11 pixmap. This means if we created an
EGLDisplay for a GBM device, we are not allowed to load a texture from
the X11 pixmap and can result in a crash in the driver.

Similar in the nested X11 setup the EGLDisplay is created for the
rendering window, but the X11 pixmaps are from the Xwayland server KWin
started. They don't belong to the same windowing system.

This change addresses this problem by moving the loading of X11 pixmaps
from AbstractEglTexture to EglTexture of the EglOnX11Backend. Thus for
any usage on a non X11 platform we cannot hit the code path any more.
In addition the nested X11 platform can indicate that it doesn't support
it and thus also doesn't go through the code path.

Test Plan: Tested standalone and nested X11 platform

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D1857
2016-06-14 09:10:09 +02:00
Martin Gräßlin
1a166f36e2 Properly update EGL Texture for sub-surface buffers
We need to use the tracked damage instead of Toplevel's damage.
2016-04-07 07:59:28 +02:00
Martin Gräßlin
b383db2e2e Create robust egl context if possible 2015-11-16 09:08:14 +01:00
Martin Gräßlin
6d96b8c4af Move egl context creation into AbstractEglContext
Code was more or less copied into each backend, so it's better to
have a shared implementation.
2015-11-16 09:08:14 +01:00
Martin Gräßlin
f2ad98aa3a Add O2ES as possible value for KWIN_COMPOSE
If KWIN_COMPOSE is set to O2ES, an OpenGL ES context is tried to
be created instead of an OpenGL context.

REVIEW: 125919
2015-11-03 09:30:12 +01:00
Martin Gräßlin
14d943caea Runtime depend on GLES in all egl backends
As we don't have GLPLatform before the backend is fully created
the AbstractEglBackend has a new method isOpenGLES() -> bool
which determines based on QOpenGLContext::openGLModuleType().
2015-11-03 09:29:31 +01:00
Martin Gräßlin
68b7274c5d Initialize AbstractEglTexture::m_image
If not set to EGL_NO_IMAGE_KHR the dtor might call eglDestroyImageKHR
for an image which never got created resulting in undefined behavior.
2015-10-09 12:26:17 +02:00
Martin Gräßlin
c56bbc0ddf Composite windows from a QOpenGLFramebufferObject
This change introduces a mechanism for internal windows to be rendered
to a QOpenGLFramebufferObject to be composited using the texture bound
to the FBO. This is useful for in-process rendering (e.g. QtQuick) and
at the same time bypassing the windowing system.

The OpenGL context of the QOpenGLFramebufferObject needs to be sharing
with the compositing OpenGL context.
2015-08-25 14:33:50 +02:00
Martin Gräßlin
3139dcd3b9 Drop cmakedefine HAVE_WAYLAND
Now a required build dependency.
2015-08-12 11:39:20 +02:00
Martin Gräßlin
a9f1f3d85e [wayland] Properly handle case that EGL_WAYLAND_Y_INVERTED_WL is not supported
According to spec eglQueryWaylandBufferWL returns EGL_FALSE if
EGL_WAYLAND_Y_INVERTED_WL is not supported and in that case we should
treat it as af the value were set to EGL_TRUE.
2015-05-21 15:49:46 +02:00
Martin Gräßlin
79c94d42f3 [wayland] Support shm buffers on GLES 2015-05-11 11:11:16 +02:00
Martin Gräßlin
209b62d522 [wayland] Pass EGLDisplay to KWayland::Server::Display
This allows the Server to calculate the size of a Buffer and we don't
need to use the queryBuffer for the size.
2015-05-08 12:43:44 +02:00
Martin Gräßlin
7c8c1dac0a [SceneOpenGL] Render per DrmOutput in EglGbmBackend
For each DrmOutput a gbm_surface and EglSurface is created. When
rendering per screen the context is made current on each of the
surfaces.

Note: viewport handling needs to be improved by e.g. passing through
the scene to restore to correct viewport after dropping an FBO.

Furthermore it seems like buffer age is not working correctly in this
setup (not overly surprising).

Dynamic changes are not yet supported.
2015-04-24 12:03:20 +02:00
Martin Gräßlin
8d8c6b09ac Fix build without Wayland (try 1) 2015-03-20 15:46:24 +01:00
Martin Gräßlin
dae8eed3a8 Introduce a shared base class for the EGL backends
There's quite some overlap and duplicated code. This AbstractEglBackend
tries to merge the two backends a little bit again.

This also introduces an AbstractEglTexture which supports both X11 and
Wayland "pixmaps" so that EglOnXBackend can support Wayland buffers.
2015-03-20 14:08:54 +01:00