summaryrefslogtreecommitdiffstats
path: root/src/hardwareintegration/client/wayland-egl/qwaylandglcontext.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Client: Fix deadlock for xdg-shell when makeCurrent is called earlyJohan Klokkhammer Helsing2018-09-261-1/+2
| | | | | | | | | | | | If makeCurrent was called before the window was exposed, it would disable resizing, which would block the window from applying the configure which the client needs to ack in order to be exposed. Fixes the issue by locking resizing only if the window is exposed. Change-Id: I0e6b30bc4b08886fb95d502cac0b735d4bb732d2 Fixes: QTBUG-70646 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Workaround for crash in QWaylandGlContext::makeCurrentv5.12.0-alpha1Johan Klokkhammer Helsing2018-09-121-0/+3
| | | | | | | | | | QOpenGLContext::makeCurrent no longer sets the current context before calling the platform function. Task-number: QTBUG-70511 Change-Id: I67766d43b1142b0742f655b5c2728f4c87fbfb5f Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Fix regression in QWaylandGlContext::makeCurrent for offscreen surfacesJohan Klokkhammer Helsing2018-09-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | [ChangeLog][QPA plugin] Fixed a bug where offscreen surfaces would get surfaceless EGL contexts. Fixes a regression in in bf09c7a1. The call, window->updateSurface(window->isExposed()), is problematic because offscreen textures are never exposed, and consequently, eglSurface will be EGL_NO_SURFACE, which will then create a surfaceless context in the call: eglMakeCurrent(m_eglDisplay, eglSurface, eglSurface, m_context) This reverts to the old behavior of always trying to create an EGL surface, unless the window doesn't have a valid wl_surface, in which case it doesn't make sense (which is what bf09c7a1 fixed, QTBUG-65553). Task-number: QTBUG-70242 Task-number: QTBUG-68605 Task-number: QTBUG-67601 Change-Id: I44b07bb8bf4b33c73c6379a1de8e9e5cfd220b51 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Respect requested surface when creating gl contextMichal Klocek2018-06-131-1/+1
| | | | | | | | | | | When creating gl context with egl pass reference format [ChangeLog][QPA plugin] Fixed a bug where QSurfaceFormat::renderableType() was ignored when creating an OpenGL context. Change-Id: Id7ae55413b8b515e344e9147345631186bef6d6c Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Don't try to create compatibility GL context when profile is unsetv5.11.0-beta2Johan Klokkhammer Helsing2018-03-091-4/+12
| | | | | | | | Context creation would sometimes fail because of this. Change-Id: Icf73a42ee2bb984ebfc09b7ed98f094d544134b8 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Use default member initialization for raw pointersJohan Klokkhammer Helsing2018-02-281-3/+3
| | | | | | | | Initialize to nullptr to prevent undefined behavior. Change-Id: I7753c0be77a886d62ecb1cd7b86fc8c98340b0b8 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Init variables where they are declared when possible (clang-tidy)Johan Klokkhammer Helsing2018-02-271-3/+0
| | | | | | | | | | | | | | | | | | | | clang-tidy -p compile_commands.json $file \ -checks='-*,modernize-use-default-member-init,readability-redundant-member-init' \ -config='{CheckOptions: [{key: modernize-use-default-member-init.UseAssignment, value: "1"}]}' \ -header-filter='qtwayland' \ -fix Afterwards I ran search and replace on the diff to clean up some whitespace errors: - Replaced '(\n\+[^:\n]*)(:\s+\+\s+)' with '$1: ' - Replaced '(\n\+[^,\n]*)(,\s+\+\s+)' with '$1, ' - Replaced '\n\+\s*\n' with '\n' I also had to do some manual edits, because for some reason, this particular clang-tidy check doesn't trigger for some files. Change-Id: I3b3909bac4bf20108bbe8ad1e01bcc54236dae1b Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'qt/5.10' into devPaul Olav Tvete2018-01-311-1/+1
|\ | | | | | | Change-Id: I603cbb164e6015c1bb7796bd8bb055d84dbc3b04
| * Don't recreate hidden egl surfacesDavid Edmundson2018-01-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QWaylandEglWindow deletes surfaces when a window changes from hidden to visible, presumably as a result of us not having a valid wl_surface object. By extension it doesn't make sense to create a surface whilst a window is still hidden. This fixes a crash where a QQuickWindow hides and then is destroyed. In QQuickWindow destruction we have to create a valid context in order to delete any textures/assets owned by the scene graph; as the wl_surface has gone this causes an error in the EGL libs when we create an EGL surface. Task-number: QTBUG-65553 Change-Id: I9b37a86326bf2cd7737c4e839c1aa8c74cf08116 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* | Replace Q_NULLPTR with nullptrKevin Funk2017-09-261-1/+1
|/ | | | | | | Change-Id: I9699a957430b8d3574ce29acb91b7ada9ea6209b Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com> Reviewed-by: Johan Helsing <johan.helsing@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Fix crashing in non-core GLES functions on some systemsLaszlo Agocs2016-11-291-2/+7
| | | | | | | | | | | | The 5.7 refactoring for QOpenGLFunctions introduced new requirements for the QPlatformGLContext::getProcAddress implementations. Implementations outside of qtbase were unfortunately forgotten. QtWayland's implementation does not derive from the common EGL version so it needs its own patch. Task-number: QTBUG-57326 Change-Id: Ie2ad22bf5986870aac74adc1e4c654c616091034 Reviewed-by: Risto Avila <risto.avila@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* use modularized platformsupport modulesv5.8.0-beta1Oswald Buddenhagen2016-10-221-1/+1
| | | | | Change-Id: I7883470e22deb089240d86df7dc2d625a107a53e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-301-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/client/qwaylandinputcontext_p.h src/hardwareintegration/client/brcm-egl/qwaylandbrcmglcontext.h src/hardwareintegration/client/wayland-egl/qwaylandglcontext.h src/hardwareintegration/client/xcomposite-glx/qwaylandxcompositeglxcontext.h Change-Id: Iac517e1985e4e67d7ca00ca4c10dcda9dd9079f9
| * Fix content positioning relative to decoration on scaled outputsJohan Klokkhammer Helsing2016-06-081-1/+1
| | | | | | | | | | | | | | | | | | Only the width and height were scaled previously, causing an incorrect offset from the lower left corner, resulting in a small transparent gap to form between the decoration and the content on the right and top. Change-Id: I0b253c05c9b260d9ff3a6ab5f8aea42370561959 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
* | Use getProcAddress(const char*) to work with updates in QOpenGLContextErik Larsson2016-03-021-2/+2
| | | | | | | | | | | | | | | | | | QOpenGLContext changed the getProcAddress overload to use const char* instead of QByteArray in commit (qtbase 29d8159c4478a5275d2ea102daf270a91ed7e92e). Change-Id: Idce613ebd06daeb111fd76ebee89a82182d028d5 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
* | Updated license headersAntti Kokko2016-01-201-14/+20
| | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I76ae5d3e64f096eb3163d6163a38d68c7c1ca756 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge branch 'wip-compositor-api' into devPaul Olav Tvete2015-12-021-1/+1
|\ \ | | | | | | | | | | | | | | | | | | This introduces the new compositor API, removing the old API (which was never officially supported). Change-Id: I1dc01f0fb4edc749e34ed8356e56ad87d7d64913
| * | Make sure to update the content fbo for QWaylandGLContextJørgen Lind2015-08-281-1/+1
| |/ | | | | | | Change-Id: I09f34fe3ea6bb3b57e49c63284f48d8af908ec1a
* / Make swap buffer call non-blocking for subsurfacesMikko Levonmaa2015-11-121-1/+29
|/ | | | | | | | | Allows clients that use subsurfaces in synchronized mode to continue processing the event loop even in cases where a frame callback is not delivered from the compositor pending a parent surface commit Change-Id: I7df38afc4080546b60184dacecde321ba8062fac Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
* Fix threaded OpenGL rendering on Mesa and possibly other EGLsGiulio Camuffo2015-05-141-3/+13
| | | | | | | | | eglBindAPI's docs says "defines the current rendering API for EGL in the thread it is called from". We were instead just calling it in the thread the context was created in, not in the thread used for rendering. Change-Id: Iba8ffe75a6f4f8b9d1bba59c0e7cce34499e9c48 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-171-22/+14
| | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Change-Id: I5a74d32515c3f1fe7aa1916f4241c92832510f8c Reviewed-by: Antti Kokko <antti.kokko@theqtcompany.com>
* Namespace the platform pluginsGiulio Camuffo2015-01-291-0/+4
| | | | | | | | | | | | There currently is a QWaylandInputDevice class both in the wayland QPA plugin and in the QtCompositor API. This causes the qwindow-compositor example to crash when running nested in a wayland session due to a mismatch between the two classes. By namespacing all the plugin code we make sure that name clashes will not happen anymore. Change-Id: I17497cff697599200bea68bf01dfde474526390f Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Implement high-dpi supportMorten Johan Sorvig2014-12-171-2/+3
| | | | | | | | | | | | | | | | | | | | | | | Wayland 1.2 added support for display scaling, where wl_output has a "scale" event informing the the client that the compositor will scale the output surfaces by the given factor. The client then has the option of providing large surfaces to match the target pixel densety and bypass the compositor's scaling. This is done by calling wl_surface::set_buffer_scale. Re-use the current high-dpi support in Qt by implementing devicePixelRatio() for QWaylandScreen and QWaylandWindow. Provide high resolution buffers both for raster and OpenGL graphics. Introduce a new coordinate system: buffer coordinates, which is related to the window coordinate system via an "int scale" scale factor. This scale factor corresponds to Qts qreal devicePixelRatio, but we keep the name and the type in the QtWayland implementation. Change-Id: Ie10d7e5b4833480a9a25d96a26ad02150eb6e83f Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
* Support the creation of >= 3.x OpenGL contextsGiulio Camuffo2014-09-301-107/+267
| | | | | | | | | Use the EGL_KHR_create_context extension if available to create modern gl contexts. We disable window decorations on core profiles because that mandates a VAO to be used. Change-Id: Id6044e64f6736244ae9d593af4d68c4000a31de6 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Rename QWaylandDecoration => QWaylandAbstractDecorationRobin Burchell2014-09-231-1/+1
| | | | | | | This is in preparation for decoration plugins. Change-Id: Idb322a7a5cbc2eb5bf2cce019073f9f4fb46297f Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Fix window decorations for GL appsLaszlo Agocs2014-09-061-2/+7
| | | | | | | | | | | | You cannot have rounded corners with an alpha-less config. To make OpenGL applications appearing with the correct decoration, alpha must be enabled. With this fix the OpenGL apps' decoration will now look identical to the SHM apps'. Change-Id: I24431ddab63146f7f697c85277f00f41e5c55e85 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com> Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Warn when EGLContext could not be created.Gunnar Sletta2014-08-291-0/+4
| | | | | Change-Id: Id840ace3d762e47c0076745301e8012755077770 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
* Fix build with desktop OpenGLGiulio Camuffo2014-08-231-15/+19
| | | | | Change-Id: I6a21f447f31e9eeeafed81275c33b0c2c79e1c8a Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Save and restore the state when doing decorationsLaszlo Agocs2014-08-221-15/+126
| | | | | | | | | | | | | | | The idea that swapBuffers() randomly changes the state is ridiculous and breaks even Qt's own OpenGL examples. An application, that has full control over its context and rendering, is not necessarily prepared for random state changes in its context. To overcome this, save and restore all the interesting state. This is fragile and applications can break it in different ways by setting all sorts of exotic state, esp. when using modern OpenGL. For GLES2 level stuff it should be sufficient, though. Change-Id: I52e7ba4072b241eb92f5f04b81d707ad5bc68f6d Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Do not request the highest color buffer sizeLaszlo Agocs2014-08-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | That third parameter is dangerous and should never be set to true, unless you know what you are doing. eglfs does not set this flag either. Do the same in wayland-egl, otherwise certain context/window creation patterns (in particular with QOffscrenSurface, which is often created with an existing context's format()) will end up with incompatible contexts and surfaces on systems that offer both 565 and 888 configs. Long story short, setting the flag ignores the extra check in the EGL config selection logic that ensures that you get a config you asked for, i.e. that a 888 config will not be returned (unless there is no other choice) if 565 was explicitly requested in the input QSurfaceFormat. The result is that we may get a 888 config even when explicitly asking for 565. However asking for unspecified will give 565. In the QOffscreenSurface case this means having an 565 context and a 888 window -> bad match. Not setting the flag brings the expected behavior: not specifying the color buffer sizes chooses the lower buffer size (565), explicitly specifying 565 chooses 565, while explicitly specifying 888 prioritizes 888 configs. Change-Id: Ia78086a9f255f2933cda7de4f5787d71d58a1356 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Avoid allocating and (failing to) manage our own texture cacheGunnar Sletta2014-08-201-6/+2
| | | | | | | | | | There is no reason we should be allocating and managing our own set of window decorations. This is only going to add to the total texture memory used and because it is managed as a shared GL resource, it would have needed some care during cleanup to clean it up correctly. Change-Id: I19651837da6b3dfde0f78a964982f3f67e577493 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Don't create an invalidated surface when not neededGiulio Camuffo2014-05-211-1/+1
| | | | | | | | After invalidateSurface() is called we don't want to recreate the EGLSurface on setGeometry() until makeCurrent is called Change-Id: Ide10ecf3bff40a01fa1ed249986a631c77c2bf63 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Show the correct function name when makeCurrent failsLaszlo Agocs2014-05-121-1/+1
| | | | | Change-Id: I0fb0dcdf9d9691bbda602a7cf6cd04ce2e094769 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
* Egl surfaces can now be invalidated, make sure to recreate themGiulio Camuffo2014-04-221-0/+4
| | | | | | Change-Id: Ifae97cc4538989bc45641bda5ce2ec8a7d8980ce Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
* Fix NPOT decoration texture bindingCedric Chedaleux2014-03-121-0/+4
| | | | | | | | If the context does not support the NPOTTextureRepeat (i.e. GL_OES_texture_npot extension), wrapping must be set to CLAMP_TO_EDGE to prevent invalid texture mapping. Change-Id: I3ededccc14a32188986529c14fa91161fb383cfc Reviewed-by: Jørgen Lind <jorgen.lind@digia.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Make classes in client privateJorgen Lind2013-12-271-3/+3
| | | | | Change-Id: Ibf400b32f78a6a0fcf0991914d2d9ad684483979 Reviewed-by: Andy Nichols <andy.nichols@digia.com>
* Move to new hardware structure for the platform pluginsJorgen Lind2013-12-271-0/+261
Change-Id: I0d383e4cdd59c4e4eae5506c814f0c80ecbf58ae Reviewed-by: Andy Nichols <andy.nichols@digia.com>