summaryrefslogtreecommitdiffstats
path: root/src/client/qwaylandshmbackingstore.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Client: Don't attach buffers to unexposed windowsJohan Klokkhammer Helsing2018-10-261-2/+1
| | | | | | | | | | | | | | | | | QBackingStore::flush is sometimes called with an unxeposed window, in that case, don't attach the buffer to the wl_surface immediately, as that causes protocol errors with xdg_shell. Flushed buffers are instead stored until we get the first configure event. [ChangeLog][QPA plugin][xdg-shell] Fixed a bug where buffers were sometimes attached and committed before the first configure event, causing protocol errors. Fixes: QTBUG-71345 Change-Id: If9409d97bd25f6b13940c56141920a664c349c8e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: David Edmundson <davidedmundson@kde.org>
* Don't commit same buffer multiple timesPaul Olav Tvete2018-08-081-5/+12
| | | | | | | | | | | | | | | | In Qt we call flush() when we think the window might need to be updated. It is also possible to trigger a flush while painting. Two fixes: 1) If there are attempted flushes between beginPaint() and endPaint, queue them up, and do them in endPaint(). 2) Make sure we only commit the buffer once: after that the compositor owns the buffer, and it can repaint on its own. Change-Id: Ibf61068fa95760eb67dbc0b1d0534854114ea528 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Proper naming for backingstore logging categoryPaul Olav Tvete2018-07-091-3/+3
| | | | | | | | The logging category is exported, so the name should be specific. Change-Id: Iffdc89875ef9e3091009780edc614fee10c05532 Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Suppress warning about MFD_CLOEXEC being redefinedThiago Macieira2018-05-231-1/+3
| | | | | | | | | glibc 2.27 #defined it as just "1U" instead of the kernel "0x0001U". Same value, but because the tokens are different, this triggers a warning. Change-Id: I052407b777ec43f78378fffd153112449de8cf4f Reviewed-by: Johan Helsing <johan.helsing@qt.io>
* Init variables where they are declared when possible (clang-tidy)Johan Klokkhammer Helsing2018-02-271-6/+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>
* Use nullptr instead of 0 or NULLJohan Klokkhammer Helsing2018-02-201-8/+8
| | | | | | | | 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>
* 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>
* Use QImage::sizeInBytes() instead of deprecated QImage::byteCount()Johan Klokkhammer Helsing2017-10-191-4/+4
| | | | | Change-Id: If3f21fc43d0118c1819d354c8ef43f1b79617c7b Reviewed-by: Allan Sandfeld Jensen <allan.jensen@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>
* QWaylandShmBuffer: use a memfd if we can for a simple memory bufferv5.10.0-alpha1Thiago Macieira2017-08-261-7/+28
| | | | | | | | which has a file descriptor we can also use to share with Change-Id: I8d96dea9955d4c749b99fffd14cd61628c616b30 Reviewed-by: Johan Helsing <johan.helsing@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QWaylandShmBuffer: use QTemporaryFileThiago Macieira2017-07-311-20/+12
| | | | | | | | | | | | | | | Instead of using mkstemp. Even current glibc versions do not open the file with O_CLOEXEC, so this code is not thread-safe. QTemporaryFile is. And since Qt 5.10, it will also use O_TMPFILE on Linux, so the file will not actually exists on disk. Take this opportunity to use the runtime directory instead of /tmp. There's no guarantee that the /tmp filesystem can support mmap'ing, while XDG_RUNTIME_DIR has that guarantee. It's also usually a tmpfs, so no data will be leaked to disk. Change-Id: I8d96dea9955d4c749b99fffd14cd5335d1114cef Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
* Translucent background supportTasuku Suzuki2017-06-191-1/+9
| | | | | | Change-Id: I6e7b5869097f579020c7a4439441a63a0771e955 Task-number: QTBUG-55956 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Use new feature system, part 2Lars Knoll2016-11-231-2/+2
| | | | | | | | | Convert all uses of QT_NO_FOO to proper QT_CONFIG(foo) checks. Change-Id: Id0f0b3325c246567a43d6b2d71b0d69e5535e648 Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* Create and destroy the shell surface when showing and hidingGiulio Camuffo2016-11-171-7/+1
| | | | | | | | | | | | | | | | | | This changes the shell surface handling for windows, and instead of creating the shell surface at initialization time, and then attaching a null buffer to hide it, it creates the shell surface on setVisible(true), and destroys it on setVisible(false). This fixes hiding when using xdg_shell, as that interface defines that attaching a null buffer to an xdg_surface is an error. Also this should help with bugged EGL drivers which attach a buffer after eglSwapBuffers() returns, which used to cause a newly hidden window to get a new valid buffer after we attached a null one, showing it again. Task-number: QTBUG-47902 Change-Id: I8e0a0442319a98cc1361803ea7be1d079b36fc8c Reviewed-by: Johan Helsing <johan.helsing@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Remove useless method QWaylandShmBackingStore::hiddenJohan Klokkhammer Helsing2016-11-111-4/+0
| | | | | | Change-Id: I8e28d3c1dc2c2bbff4517ffe3b2f63c2ac86b95f Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com> Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-011-10/+18
|\ | | | | | | Change-Id: I75a8ddc0652f3c6f438ef98e940c9357450d29c6
| * Fix high-DPI scaling of window decorations for shared memory buffersJohan Klokkhammer Helsing2016-07-111-10/+18
| | | | | | | | | | Change-Id: I6833ab86ffdb4e37dad5108baddb7a54cfb5e9fa Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
* | Merge remote-tracking branch 'qt/5.6' into 5.7Paul Olav Tvete2016-03-081-107/+69
|\| | | | | | | Change-Id: Iada0e076ee33e8d39ecc4f40edfd9764ba610c03
| * Fix SHM drawing logicGiulio Camuffo2016-03-071-86/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old logic didn't care to listen for wl_buffer.release events so it always drew in the same buffer, potentially resulting in tearing if the compositor was scanning out the buffer at the same time. Instead properly cycle between a few buffers and don't reuse the same one until the release event was received. The old code also used to throttle the redraws, unless the buffer was changing, that is unless the window was getting resized. This is now lost, and no throttling is ever done. Doing it properly, by waiting for the frame callback before committing the new buffer shows very noticeable lags with many applications when resizing, because they paint many times per resize event, so they fall behind the cursor. A proper fix will be to implement the support for requestUpdate(), and using it in the applications. Change-Id: I02732c34769a5c75a6ad68c095bae916e4b274d3 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* | 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>
* | Support non-blocking flush for shm subsurfacesMikko Levonmaa2015-11-281-12/+31
| | | | | | | | | | | | Change-Id: I6cc8d5214c905d6b2e9f0c2eebb07d1cb897f74a Reviewed-by: Giulio Camuffo <giuliocamuffo@gmail.com> Reviewed-by: Mikko Levonmaa <mikko.levonmaa@bitfactor.fi>
* | Add QWayland::shm object to clientMikko Levonmaa2015-09-251-3/+3
|/ | | | | | | | | | Allows more flexibility for the client to determine additional shm formats supported by the compositor in addition to the standard types. For example YUV formats. Change-Id: Ib4a47c1d5bbeed9314d5ad5f5f8e1551c1dd71e4 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com> Reviewed-by: Mikko Levonmaa <mikko.levonmaa@bitfactor.fi>
* Merge remote-tracking branch 'origin/5.4' into 5.5Liang Qi2015-04-151-4/+8
|\ | | | | | | | | | | | | | | Conflicts: src/client/qwaylandshmbackingstore.cpp src/client/qwaylandwindow.cpp Change-Id: I795fd08f0fc5d3cb5ed55bf16e724f66b7567723
| * Fix shm buffers init and destruction on failureOlivier Blin2015-03-271-4/+8
| | | | | | | | | | | | | | | | | | | | Some pointers need to be initialized in QWaylandBuffer and QWaylandShmBuffer, and checked at destruction. This avoids crashes when shm surface creation fails. Change-Id: I6f6afa3cc6c67533b5130700cbc27b271764109e Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.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>
* | Add a SHM format converter classJorgen Lind2015-02-051-1/+5
| | | | | | | | | | | | | | | | | | This class helps keeing one lookuptable for server and client It relies on that wayland-(client|server)-protocol.h being included before the qwaylandshmformathelper.h Change-Id: I12158126a80c8fef5c52427d35792f33716020f1 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.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>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2014-12-291-0/+3
|\| | | | | | | | | | | | | | | Conflicts: .qmake.conf src/compositor/compositor_api/qwaylandsurface.cpp Change-Id: I3ee40153c959dbe31ea685571c5a8bb1ae36606e
| * Fix possible double free when hiding a windowGiulio Camuffo2014-12-061-0/+3
| | | | | | | | | | | | | | | | | | There was a race condition between the gui and the wayland event thread which could lead to double freeing the QWaylandShmBackingStore's frame callback. Protect the wl_callback_destroy calls using a mutex. Change-Id: Ia70ebac208a6d4450328ba5254a850be26d84d6d Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Implement high-dpi supportMorten Johan Sorvig2014-12-171-6/+12
|/ | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix -no-opengl buildsLaszlo Agocs2014-10-141-0/+2
| | | | | | Task-number: QTBUG-41677 Change-Id: I039ec581e960eb70eb04aed6e65add70c563ba77 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Fix shm windows sometimes not showing after being hiddenGiulio Camuffo2014-10-061-0/+11
| | | | | | | | | | | | | | | QWaylandShmBackingStore installs a frame callback on flush, and subsequent flushes will not attach a new buffer until the callback is fired. If the window is hidden while we're waiting for the callback, we attach a NULL buffer, so the compositor will not redraw the surface and will not fire the frame callback. When showing the window again the backing store's flush() will wait indefinitely for the frame callback to attach its buffer. To fix it destroy the frame callback when the window is hidden. This was easily noticeable when fast switching between popup menus. Change-Id: Ic0c71ed79e2fab9faf452f63b05bc4576ea9a3ba Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Rename QWaylandDecoration => QWaylandAbstractDecorationRobin Burchell2014-09-231-2/+2
| | | | | | | This is in preparation for decoration plugins. Change-Id: Idb322a7a5cbc2eb5bf2cce019073f9f4fb46297f Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Support RasterGLSurface windowsLaszlo Agocs2014-08-251-17/+30
| | | | | | | | | | | | | | | | | In an attempt to make QOpenGLWidget and QQuickWidget working on Wayland. Since Qt 5.3 all widget windows are of type RasterGLSurface (given that the plugin reports this capability which wayland will, with this patch). Such a window can behave either like a raster or an OpenGL window. This concept maps badly to platform plugins that have a rigid separation between raster and OpenGL platform window implementations. From now on, the OpenGL window implementation, that is used pretty much always, except for raw RasterSurface windows, must be prepared to behave like a raster window too, which involves having a backingstore. Change-Id: I0226704b8d5893843fcae68059c5fe9ad2f5e761 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
* Reduce headers inter-dependency in the QPA pluginGiulio Camuffo2014-06-161-0/+18
| | | | | Change-Id: I8b810e54531453b6a80250555c21bb0b1e6e76cc Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
* Make classes in client privateJorgen Lind2013-12-271-5/+5
| | | | | Change-Id: Ibf400b32f78a6a0fcf0991914d2d9ad684483979 Reviewed-by: Andy Nichols <andy.nichols@digia.com>
* Move wayland into a client directory not under the plugins src folderJorgen Lind2013-12-271-0/+322
And make wayland common files into a library, exporting all classes. Now there is no need to do bulild hacks to make your own version of the wayland plugin. Change-Id: Ib4872863dfb5ab3f2bc0f4a94ae16fc1e7b63b88 Reviewed-by: Andy Nichols <andy.nichols@digia.com>