summaryrefslogtreecommitdiffstats
path: root/src/hardwareintegration
Commit message (Collapse)AuthorAgeFilesLines
* Client: Full implementation for frame callbacks (second try)Johan Klokkhammer Helsing2019-04-243-16/+13
| | | | | | | | | | | | | | | | | | | | | | | | | The Wayland plugin now takes full control over delivering update request and implement frame callbacks for both egl and shm. [ChangeLog][QPA plugin] The non-blocking version of eglSwapBuffers is now used, if supported. This fixed a bug where minimized windows would block the event loop. [ChangeLog][QPA plugin] Windows that don't get frame callbacks from the compositor within 100 ms are now set as not exposed. This should stop most clients from rendering unnecessary frames to minimized or hidden windows. Also, when we relied on the QPA version of requestUpdate, we would sometimes deliver one update request while we were waiting for a frame callback. When we implement the fallback timer ourselves we can make sure we only deliver the fallback if there are no pending frame callbacks. QtQuick and other applications often depend on blocking swapBuffers to throttle animations. If the context's surface format has a non-zero swapInterval, try to emulate a blocking swap. Fixes: QTBUG-69077 Change-Id: I3c6964f31a16e9aff70b8ec3c5340e640a30fef2 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Compositor: Call eglUnbindWaylandDisplayWL when destroying the compositorJohan Klokkhammer Helsing2019-03-141-0/+8
| | | | | | | | | | | | | | | If unbind is not called, some drivers may try to do cleanup that depends on a valid wl_display in eglTerminate. Arguably, this could/should also have been fixed in the affected drivers. There is a display_destroy signal that the driver should listen to, to avoid using dangling wl_display and wl_global pointers. However, by using eglUnbindWaylandDisplayWL we can force the cleanup to happen before wl_display_destroy. Which is what this patch does. Change-Id: Id9062de896b723838bcecac3902031e6b172a6de Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Client xdg-shell: Fix crash when switching popupsJohan Klokkhammer Helsing2019-02-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | The call to flushWindowSystemEvents() sometimes caused new popups to be shown in the middle of hiding another. I.e. if multiple events show and hide surfaces, they would be shown/hidden in opposite order of their corresponding events. QMenus sometimes suffered from this (can be seen with the qopenglwidget example from qtbase). When the flush was added 5 years ago in 50f43a0c5, it was to "reduce the chances of seeing a bad frame". I don't see any rendering artifacts, though, and I can't find any bug report on it. So let's hope it's safe to remove the hack. [ChangeLog][QPA plugin] Fixed a crash that sometimes happened when switching popups. Also adds more info to the workaround warning message that appears when a popup grab is attempted and there already is another grabbing popup that is not the parent. Fixes: QTBUG-73524 Change-Id: Ibfcbb48c4bbe295c2be1a30add2d7e05cad398c5 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Fix black client windows when not using window decorations on NVIDIADominik Holland2019-01-081-1/+6
| | | | | | | | | | QWaylandGlContext::makeCurrent() tries to be smart and only call eglMakeCurrent() if really needed. This causes problems on NVIDIA where the call is always needed. Change-Id: I08d881d69f79a0fd4ea83a65780052e269a566be Task-number: QTBUG-71697 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Revert "Client: Full implementation for frame callbacks"Johan Klokkhammer Helsing2019-01-081-7/+15
| | | | | | | | | | | | | | | | This caused regressions because QtQuick depends on swapBuffers for throttling animations. We probably need to emulate a blocking swapBuffers and continue after a timeout, but until we have a patch for this, revert this to avoid releasing a regression. This brings back the bug with a frozen event loop when a surface is waiting for a frame callback, but this is preferable to a regression. This reverts commit 1dc85b95ab0adc1e805d059e2c35c671ef790011. Fixes: QTBUG-72578 Change-Id: If6435a947aae5e9fd775404649a392bfafe9130a Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* wl_eglstream_controller implementation for NVIDIAPaul Olav Tvete2019-01-085-0/+690
| | | | | | | | | | | | | | This adds a new client buffer integration: wayland-eglstream-controller, which contains the EGLStream logic from wayland-egl, and additionally uses NVIDIA's wayland-eglstream-controller protocol to avoid the issue where the stream is not ready at the time of first buffer attach. This is not enabled by default. Can be used like this: QT_WAYLAND_CLIENT_BUFFER_INTEGRATION=wayland-eglstream-controller ./pure-qml Fixes: QTBUG-71697 Change-Id: I73bb2a8fe9852afe1b5807cbb8c35dc4c7624dad Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Client: Full implementation for frame callbacksJohan Klokkhammer Helsing2018-12-131-15/+7
| | | | | | | | | | | | | | | | | | | The Wayland plugin now takes full control over delivering update request and implement frame callbacks for both egl and shm. Fixes two bugs: [ChangeLog][Client] The non-blocking version of eglSwapBuffers is now used. This fixed a bug where minimized windows would block the event loop. Also, when we relied on the QPA version of requestUpdate, we would sometimes deliver one update request while we were waiting for a frame callback. When we implement the fallback timer ourselves we can make sure we only deliver the fallback if there are no pending frame callbacks. Fixes: QTBUG-69077 Change-Id: I2d3a6896c32e63d8520b57448a3601a817816a91 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Specify X11 dependency explicitlyPaul Olav Tvete2018-12-131-1/+1
| | | | | | | Fixing build issue now that XComposite no longer pulls in X11. Change-Id: I4c5e77188cf167716aa64f2575d70ac2ca37608b Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Fix scaling if wrong attached window size is returnedKimmo Ollila2018-12-111-2/+6
| | | | | | | | | | | | | Some drivers may return wrong size from wl_egl_window_get_attached_size and can therefore ignore wl_egl_window_resize calls. This patch introduces a new env variable QT_WAYLAND_DISABLE_RESIZECHECK to skip the size check and to force resizing of egl window on create and resize events. Task-number: QTBUG-70079 Change-Id: I9be97480088c63ae0a6dc3d1d1e026b0683a627e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Clean up ShmServerBuffer's unused and shadowing membersv5.12.0-beta2Johan Klokkhammer Helsing2018-10-092-10/+10
| | | | | Change-Id: I588ccc782f593ec83a87f75bd88d98f873366395 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* 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>
* Add server buffer integration using Linux dma-bufPaul Olav Tvete2018-09-216-0/+772
| | | | | | Fixes: QTBUG-70494 Change-Id: Iaa4990fe9d39a1f9fb81f5e5f19039aa2e52dcac Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Add virtual QtWayland::ServerBuffer::bufferInUse()Paul Olav Tvete2018-09-214-0/+11
| | | | | | | | This allows the compositor to reclaim unused graphics memory when a buffer is no longer used by clients. Change-Id: Ia0269608019c5120da8c091c81e165411b563554 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Don't use members of wl_resourceJohan Klokkhammer Helsing2018-09-181-1/+1
| | | | | | | | | When we switch to only including core wayland headers, wl_resource will be an opaque type. Use the getters and setter functions instead. Task-number: QTBUG-70553 Change-Id: I7d84d48a4ee3586f231a331cd15716686dcee775 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 eglGetError call in error handlingJohan Klokkhammer Helsing2018-09-071-1/+1
| | | | | Change-Id: I215db1d8bb321e0fe9d49d09c8b5f0d2492e901d Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Fix regression in QWaylandGlContext::makeCurrent for offscreen surfacesJohan Klokkhammer Helsing2018-09-042-4/+7
| | | | | | | | | | | | | | | | | | | | | | | [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>
* Fix renderableType of requested wayland surfaceMichal Klocek2018-06-151-1/+1
| | | | | | | | | Commit 815206 fixed renderableType of wayland gl context, keep for sanity also correct renderableType for surface. This is most likely never used, but makes more sense to keep it in sync. Change-Id: I8e8cae1feba20054aac94be246e449ccb0974240 Reviewed-by: Johan Helsing <johan.helsing@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>
* brcm-egl: Add native resources handlers to the client integrationFlorent Revest2018-05-152-0/+30
| | | | | | | | | | This is needed for QtWebEngine's EGL integration when ran as a Wayland client on Broadcom platforms. Task-number: QTBUG-67415 Change-Id: I4ef05073f0b3d9a08570322341fa3b8ef92cdf52 Co-authored-by: Dominik Holland <dominik.holland@pelagicore.com> Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Compositor API: Don't leak OpenGL textures when running multi-threadedJohan Klokkhammer Helsing2018-04-271-2/+15
| | | | | | | | | | | | | | | | If a client destroyed buffers, they would not get deleted because the event would be handled on the GUI thread without a valid OpenGL context. I.e: you would see the following output: QOpenGLTexturePrivate::destroy() called without a current context. Texture has not been destroyed Work around it by keeping a list of buffers that have been orphaned and delete them whenever we have a valid OpenGL context. Change-Id: I31c7c4cff179bd68cd954714b2a8e3e2a74675b2 Reviewed-by: Dominik Holland <dominik.holland@pelagicore.com> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Fix crash when calling setVisible for EGL windows twice within one slotJohan Klokkhammer Helsing2018-03-232-9/+0
| | | | | | Task-number: QTBUG-63411 Change-Id: I56c367a1801d215e93bf195332272cfee300cdd8 Reviewed-by: Paul Olav Tvete <paul.tvete@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 override when applicableJohan Klokkhammer Helsing2018-02-289-15/+15
| | | | | | | | | | Applied automatic fixes using clang-tidy's modernize-use-override. This adds the "override" keyword where it's possible and also removes the "virtual" keyword when redundant. Change-Id: I899950e5cf8782785d30a245a9c69c1720905d50 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Use default member initialization for raw pointersJohan Klokkhammer Helsing2018-02-2820-30/+30
| | | | | | | | 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-2736-128/+62
| | | | | | | | | | | | | | | | | | | | 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>
* Use nullptr instead of 0 or NULLJohan Klokkhammer Helsing2018-02-204-12/+12
| | | | | | | | Applied automatic fixes using clang-tidy's modernize-use-nullptr, and some manual cleanup to prevent QFlag macros to be affected. Change-Id: I88f94390185bc6e6f23693b68723cd5710815ae6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Compositor API: Add support for hardware compositingJohan Klokkhammer Helsing2018-02-093-0/+388
| | | | | | | | | | [ChangeLog][Compositor] Add a tech preview for a plugin-based hardware layer API and a VSP2 implementation (for Renesas R-Car M3 and H3). Task-number: QTBUG-64600 Task-number: QTBUG-64604 Change-Id: Ia4abfb6343cf4f006ba408d293ec9464cd6f31b7 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Fix compilation for Renesas R-Car M3Johan Klokkhammer Helsing2018-02-082-2/+2
| | | | | Change-Id: Ib85001884bb880a18d8aa1241da0eb614a6b58ba Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Merge remote-tracking branch 'qt/5.10' into devPaul Olav Tvete2018-01-314-3/+33
|\ | | | | | | Change-Id: I603cbb164e6015c1bb7796bd8bb055d84dbc3b04
| * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-01-181-1/+1
| |\ | | | | | | | | | Change-Id: I6c201769561f53d88c89f75cce7d9a7b2643d2f6
| | * 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>
| * | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2018-01-073-2/+32
| |\| | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf src/compositor/compositor_api/qwaylandquickitem.cpp Change-Id: Id2f49e8703a67daedcee66db83f006df828d9da0
| | * Fix for big memory leak in Qt based compositorsRobert Griebl2017-12-192-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | The system would leak a complete buffer every time the client attached a new Wayland buffer. For QML applications this will normally happen every time a new animation is started. Change-Id: Ie4981ccbb2e09d702ee291f1144e3b8aa84c0d1d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
| | * wayland-egl: use egl compiler optionsSamuli Piippo2017-12-041-1/+1
| | | | | | | | | | | | | | | Change-Id: I6f8dcadf3cffecc6097ad0ad5e8245831b3ce0c1 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* | | Adapt to qtbase 5.10 API change: qssize_t -> qsizetypeLiang Qi2018-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-65600 Done-with: Thiago Macieira <thiago.macieira@intel.com> Change-Id: I34116dad8eecd01090596270965b9a24f6fe8f39 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | | Automatically change scale when entering a new outputJohan Klokkhammer Helsing2017-11-152-0/+6
| | | | | | | | | | | | | | | | | | Change-Id: I99198d47eac5b2091fe2bfd8fc24646be9c9890a Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io> Reviewed-by: David Edmundson <davidedmundson@kde.org>
* | | Merge remote-tracking branch 'qt/5.10' into devPaul Olav Tvete2017-10-271-44/+75
|\| | | | | | | | | | | Change-Id: I4f885a551093ada07da97fd3d99902e36f98595e
| * | Merge remote-tracking branch 'qt/5.9' into 5.10v5.10.0-beta3Paul Olav Tvete2017-10-251-44/+75
| |\| | | | | | | | | | Change-Id: I6c283081669594b3e8c6b30194bb96e389319cb2
| | * Support threaded rendering for Nvidia EGLStreamsPaul Olav Tvete2017-10-251-44/+75
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Create and update the texture on the GUI thread. Make sure there is a valid context on the GUI thread: create one if necessary, and share it with the global share context. Note: this requires that threaded compositors set the Qt::AA_ShareOpenGLContexts application attribute. Task-number: QTBUG-63039 Change-Id: Ia19af0536f9df319cde84221ed53db1c2ef42293 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* | | Use QImage::sizeInBytes() instead of deprecated QImage::byteCount()Johan Klokkhammer Helsing2017-10-191-1/+1
| | | | | | | | | | | | | | | Change-Id: If3f21fc43d0118c1819d354c8ef43f1b79617c7b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* | | Replace Q_NULLPTR with nullptrKevin Funk2017-09-263-4/+4
|/ / | | | | | | | | | | | | 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>
* | shm-based server buffer for testing on desktopPaul Olav Tvete2017-08-166-0/+506
| | | | | | | | | | Change-Id: I2ea03f3366524d3133a65870abad9d9389dfec9c Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* | Update server buffer integrationPaul Olav Tvete2017-08-158-84/+153
|/ | | | | | | | | Fix crashes, and change the (private) API to be more usable. The libhybris code compiles without warnings, but is untested. Change-Id: I1433daf1ba76d7869d1dfe260642199ce5a1b849 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Set texture size and format in WaylandEglClientBuffer::toOpenGLTextureJohan Klokkhammer Helsing2017-06-221-0/+13
| | | | | Change-Id: I26e3ac4224fb54e1d3fddeef8847f9556effe324 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
* Avoid double deletion of mBufferDonald Carr2017-06-161-0/+1
| | | | | | | | | | | Both WaylandBrcmBuffer and WaylandBuffer were calling wl_buffer_destroy(mBuffer) without the derived class nulling the pointer on deletion Change-Id: I66a553a3d11a1ef90bbfe6ad0fb49f40fe1a0bdb Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Fix missing rename from waylandDisplay to displayJohan Klokkhammer Helsing2017-06-131-1/+1
| | | | | | | | | | QWaylandCompositor::waylandDisplay was previously renamed to display, but the libhybris implementation was not updated. Task-number: QTBUG-61183 Change-Id: I80cacb7eeef93375bebd159b676db1147914e8de Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com> Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
* Fix licensingv5.9.0-beta4Jani Heikkinen2017-05-0419-228/+285
| | | | | | | | | | Currently tests are licensed under GPL-EXCEPT, examples under BSD and src under LGPL so replase old license headers with new & proper ones. Also remove old & unused license files Task-number: QTBUG-57147 Change-Id: Ia6a738798736c275dc309ccfa5b627dc2178d241 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Merge remote-tracking branch 'origin/5.8' into 5.9Liang Qi2017-04-183-9/+3
|\ | | | | | | Change-Id: I436178527be54fd0efa6ffbe39918740d4737478
| * switch to new way to refer to libdl5.8Oswald Buddenhagen2017-04-062-6/+2
| | | | | | | | | | Change-Id: I9269bb0902b0a5b5d8581d79fa9568122ee0641b Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>