summaryrefslogtreecommitdiff
path: root/examples
AgeCommit message (Collapse)AuthorFilesLines
2015-08-28Merge remote-tracking branch 'origin/5.5' into 5.6v5.5.90+alpha1upstreamLiang Qi1-1/+0
Conflicts: src/client/qwaylandwindow.cpp Change-Id: I80ead87f3e1f36299b1bf9cc9c7db6cd48c0e86f
2015-07-15Add a mechanism to delay unmapping of surfacesGiulio Camuffo1-0/+7
When a client attachs a NULL buffer on a surface we may want to hang on to the old buffer for a bit, e.g. to do a hide animation. Add the QWaylandUnmapLock class to keep a surface mapped after an attach(0) request. Change-Id: I5d5be0b36410a76a58d2b68c1b2ac5e3b875a801 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
2015-07-06Fix possible race condition leading to a dead lockGiulio Camuffo1-1/+0
It is a bit dangerous to call wl_display_dispatch() in the event thread, since it may race with the dispatch called e.g. in QWaylandDisplay's blockingReadEvents() and lead to a dead lock. Instead, use wl_display_prepare_read() and wl_display_read_events() in the event thread, which doesn't block, and only dispatch in QWaylandDisplay. As a result we don't need the additional wayland queue anymore, so remove it. Change-Id: I9fbbe5d2f38d06773beb7847df1a0212cca92c37 Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
2015-04-15Merge remote-tracking branch 'origin/5.4' into 5.5Liang Qi3-18/+4
Conflicts: src/client/qwaylandshmbackingstore.cpp src/client/qwaylandwindow.cpp Change-Id: I795fd08f0fc5d3cb5ed55bf16e724f66b7567723
2015-03-31examples: remove unused windowDestroyed signalOlivier Blin2-15/+0
Unused since commit fc439e40e37f9c0b3108225f951fb19bb3abee80 Rework the way buffers are used and rendered Also remove associated slots that are now empty in server-buffer. Change-Id: I33be0bc6a5e175553d28e9ead54fefd2f0c07ce0 Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
2015-03-29qwindow-compositor: fix rendering shm NPOT textures with OpenGL ES2Olivier Blin1-0/+1
Always use GL_CLAMP_TO_EDGE instead of GL_REPEAT, since OpenGL ES2 doesn't support NPOT textures in combination with GL_REPEAT by default, and repeat is not needed anyway. See also qtbase commits: 8dfeb1c374972f06759a92b4edc5d6a18b96ccec 8ab1323842433fb6b45e7d6f381b4b9710a81da9 72558e810d9b3493dabfc936fa6c8bf3c3f3b49c Change-Id: I01770fe3352da05baf6898d63c091bfae95e7a98 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2015-03-27Fix connecting to surfaceDestroyedOlivier Blin1-3/+3
It was being called with a garbage pointer, since the signal does not have an object argument anymore. This has been changed in commit fc439e40e37f9c0b3108225f951fb19bb3abee80 Rework the way buffers are used and rendered Change-Id: I220c52285909dc93aebd128fc418df3c8a6bd37c Reviewed-by: Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
2015-02-17Update copyright headersJani Heikkinen23-92/+92
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>
2015-02-08Add QWaylandOutput to support multiple outputsPier Luigi Fiorini3-6/+13
Add a new QWaylandOutput class to support multiple outputs. Each QWaylandOutput need a window for rendering. Rename OutputGlobal to Output and Output to OutputResource. Add support for physical size, mode and available geometry. Use better defaults for geometry and refreshRate from the QWindow if available. A window is no longer passed to QWaylandCompositor constructor and all output related methods are removed, however one or more outputs are required for hardware integration. QWaylandCompositor returns a list of outputs and offers an API to add or remove outputs. Hardware integrations can run headless. Change-Id: I742996571ddb78328f7bfa4f79b25a81995279e1 Done-with: Jan Arne Petersen <jan.petersen@kdab.com> Done-with: Jørgen Lind <jorgen.lind@theqtcompany.com> Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
2015-01-29Namespace the platform pluginsGiulio Camuffo3-8/+8
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>
2015-01-13Correctly handle '--invert' parameter in server-buffer compositorSiteshwar Vashisht1-2/+2
Change-Id: I9a3285dc5bddd848ec557287c4641d9edce752a9 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
2014-10-09Move examples into wayland subdirectory.v5.4.0-beta1Friedemann Kleint36-17/+19
Conforming to the Qt project directory structure. Change-Id: I452867fabc88e9594fa26f944b5d3e1ca4ffc720 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2014-10-09Fix the compositor's wayland versioningGiulio Camuffo1-1/+1
We cannot just assume all clients implement the same version of the various interfaces as the compositor does. Keep track of them, and react accordingly when creating a resource or sending an event. Change-Id: I9792433a14d49c5c4df0c892fc1349ce0dfb0d43 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-08-29qwindow-compositor: Rename QOpenGLWindowLaszlo Agocs6-21/+22
That's a public class in Qt 5.4. Use the more appropriate CompositorWindow. Change-Id: Id7de20c7e2d5b373f8ef9fe9a836188dc864479e Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
2014-08-23Explicitly define the interface versionsGiulio Camuffo1-1/+1
Currently a global is bound with the version the interface has in the xml file. This is a problem for apps that explicitly link to libwayland-client because they may link to a newer libwayland, so the version of some interface may be higher than the one that it is actually implemented. Change-Id: Id0dbe6c0f1e05fe91954b9d8d9472d42d2053cdc Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-08-21QWindowCompositor: Prevent double delete.Robin Burchell1-2/+4
With a SHM client, if a null attach happened, then the old buffer would be deleted but left with a dangling pointer which would be deleted again on the destructor. This was revealed by tst_dialog. Change-Id: I89e22487e7ec982789a4b7dfd45e5db7db3222d1 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-08-20Replace custom texture upload with QOpenGLTextureRobin Burchell3-22/+22
Change-Id: Ibf6facdd1fba72c2f9741e49cf2c83f9b4136ffc Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-08-20QWindowCompositor: Getting popups to appear in the right place.Robin Burchell1-8/+15
Change-Id: I6ba4731abbf892f8f7bb0a0d5b30bba8082e67be Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
2014-08-18qwindow-compositor: Fix null pointer dereference.Robin Burchell1-1/+1
setCursorSurface may be invoked with a null surface. This was exposed by tst_QWidget::destroyBackingStore. Change-Id: Iac1ef6d2f17e5ee6a693ddbf3875b743bde2ded1 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
2014-08-18qml-compositor: Error check loading of WindowChrome.Robin Burchell1-0/+4
Change-Id: I76303b8640f013167159d94e8db7d673358c4983 Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
2014-08-18qml-compositor: Clean up some unnecessary logging.Robin Burchell2-4/+4
Change-Id: I1072d6efa059e01d8dcba98c90320bcc242d1c0f Reviewed-by: Giulio Camuffo <giulio.camuffo@jollamobile.com>
2014-08-07Fix namespaced buildGiulio Camuffo4-0/+16
Change-Id: Id73f8ddffe00359f38c634fc88b1f81ac5638653 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2014-07-08Fix creation of custom shellsGiulio Camuffo3-0/+3
The previous virtual method initShell() was not working because it was called from QWaylandCompositor constructor. Replace that with a mthod to create the default shell to be manually called by the compositors if they so choose. Change-Id: I35a1dc0edfaf4237ca47b532645ac0d95752311c Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-04-29Make it possible to have custom shell implementationsGiulio Camuffo1-1/+1
Different compositors may need different shell behaviors, or even different shell protocols. A smartphone compositor, for example, may want to make wl_shell_surface::set_popup or other requests noop, because they don't make sense in the formfactor, or it may even want to not implement wl_shell_surface at all, but some smartphone_shell_surface. A compositor may define its own shell implementation by overriding QWaylandCompositor::initShell(), and creating there its interface instance. The default implementation still creates the built-in wl_shell_surface implementation. Change-Id: I143b0cd4e30e31d4051ada6e562d486d9bf1a751 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-04-29Split QWaylandSurface in a model and view fashionGiulio Camuffo7-103/+84
QtQuick compositors already use a view class (QWaylandSurfaceItem), so add a new QWaylandSurfaceView, which is subclassed by QWaylandSurfaceItem, and move the view related methods of QWaylandSurface there. A QWaylandSurface can have many views. Change-Id: I7e92fe1f7e9d252f5f40a3097feabb5f3318b03a Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-04-29Let the ShellSurface send the mapped and unmapped signals.Giulio Camuffo3-12/+8
A surface without any attached shell surface should never be mapped, so make the latter set the mapped state on the surface. Change-Id: If09bd9eebecd6e0a52f862cb866d85aec403c3a0 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-04-29Rework the way buffers are used and renderedGiulio Camuffo7-133/+135
The current way buffers are handled is sub-optimal. They are hidden inside QtWayland::Surface and the actual renderer, be it QtQuick or anything else, cannot get a direct hold of them, nor it can directly control when the underlying textures are created or deleted. The main additions in this commit are the splitting of the QtQuick code path and the new QWaylandBufferRef and QWaylandBufferAttacher classes. QWaylandBufferRef allows a renderer to retain a reference to a wl_buffer even after the underlying Surface discarded it. That allows the renderer to directly decide when to destroy the texture of the buffer. QWaylandBufferAttacher is a pure virtual class which must be implemented by the renderer. Instances of it will be assigned to the QWaylandSurfaces, created. Its attach() virtual method will then be called when a new buffer is committed to the surface. The renderer can then choose to immediately create a texture or wait for some later time. It is its responsibility to create and destroy the GL texture, it will not happen automatically. This functionality is implemented for QtQuick in the new QWaylandQuickCompositor and QWaylandQuickSurface classes. Change-Id: I674b4e5fb8c65c3b1c582e33ff3a0b0e45f2acc9 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-03-21Remove the QWidget compositor exampleGiulio Camuffo6-652/+0
The QWidget API isn't well fit for a Wayland compositor, and does not have any advantage over a QWindow, which can also draw using QPainter. Besides the current implementation doesn't work properly, and no one seems to be interested in fixing it. Change-Id: Id1c337506af48e1d1fdd8d14f0ed637d299702f3 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-03-11Make the compositor redraw when a surface gets a commit().Giulio Camuffo3-17/+11
It must redraw, even if it doesn't actually redraw anything, irrespective of the fact that a attach/damage has come or not. Just calling frame();commit() is perfectly valid. Change-Id: If298654b8a7cb7c954cfbad8618f23134731cb9f Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-03-11Flush the clients connection after sending the frame callbacksGiulio Camuffo2-2/+2
We want to make sure the events reach the clients asap. Change-Id: I0783c6be4f4412fd5f3665faec1e57d141291ce7 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-03-11Compile ServerBuffer client example on desktop glJorgen Lind3-5/+7
Change-Id: I8efbda3e5266c5668b2461429a21d900e2ecd175 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-03-11Make sure the frame callbacks are sent at the right timeGiulio Camuffo4-0/+11
When there is a rendering thread, like with QtQuick compositors, there is a race condition where the frame callbacks are sent before the last buffer the client sent is released. Assume the following scenario: attach(B1)/frame(F1)/commit()...frame started...attach(B2)/frame(F2)/ commit()...frame finished. On frame finished the callback just installed is emitted before the buffer B2 is being used and B1 released. That forces the client to allocate a third buffer to draw the next frame. Now, do not send out the frame callbacks until a new frame started. The successive draw will release B1, use the new B2 and than send out F2. Change-Id: I5743c7baf9fdd3cde28c5f594ff646c06abb74b7 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-03-11Remove the buffer queue.Giulio Camuffo3-12/+12
A client calling attach(A);commit();attach(B);commit() should result in its back buffer be set to B, and A be discarded. If the client wants to have a queue it should keep it client side or a protocol extension tailored for that purpose should be developed. Change-Id: Ia0048f311504d85821df9f5b9225887801efec71 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-02-19Merge remote-tracking branch 'origin/dev' into stableOswald Buddenhagen5-29/+29
Conflicts: src/compositor/wayland_wrapper/qwlsurface.cpp Change-Id: I3b6a4af41f272d3dc7fc920ba2542f2dd7978175
2014-02-11Making the buffer intgrations privateJorgen Lind3-16/+19
Change-Id: Ifb6e2456c781e80f84e27e68c3e279ea993f9307 Reviewed-by: Andy Nichols <andy.nichols@digia.com>
2014-02-11fixup in serverbuffer compositorJorgen Lind1-8/+5
Change-Id: Idb0ad89c47fdca7249022049c00063a4d0bac95a Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-02-05Improve the frame callbacks handlingGiulio Camuffo4-8/+12
Improve the way wl_surface's frame callbacks are handled. The sooner they are sent the better is for the clients, as they have more time to render the next frame, but reducing the time for the compositor to render its frame. The best compromise is probably to send them out after the compositor has issued its GL calls but before calling eglSwapBuffers(), and before the GPU actually draws anything. Rename the function to send the callbacks to only reflect its purpose, leaving the compositors free to choose when they want to send them. Change-Id: Ifcdfcad9e54b4d07d5c087898123ac724395a194 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-02-05Fix build break in linuxSimo Fält1-0/+3
Fixes build break when built on linux with wayland libs installed via pkg manager. Change-Id: I17be64e702d07e817a2e34e76ddbe8dde064f3d2 Reviewed-by: Andrew Knight <andrew.knight@digia.com>
2014-02-04Merge remote-tracking branch 'origin/stable' into devAndy Nichols4-21/+57
Conflicts: src/client/hardwareintegration/qwaylandclientbufferintegrationplugin_p.h src/client/hardwareintegration/qwaylandserverbufferintegrationplugin_p.h src/compositor/hardware_integration/qwaylandclientbufferintegrationplugin.h src/compositor/hardware_integration/qwaylandserverbufferintegrationplugin.h src/plugins/hardwareintegration/client/brcm-egl/main.cpp src/plugins/hardwareintegration/client/drm-egl-server/main.cpp src/plugins/hardwareintegration/client/wayland-egl/main.cpp src/plugins/hardwareintegration/client/xcomposite-egl/main.cpp src/plugins/hardwareintegration/client/xcomposite-glx/main.cpp src/plugins/hardwareintegration/compositor/brcm-egl/main.cpp src/plugins/hardwareintegration/compositor/drm-egl-server/main.cpp src/plugins/hardwareintegration/compositor/wayland-egl/main.cpp src/plugins/hardwareintegration/compositor/xcomposite-egl/main.cpp src/plugins/hardwareintegration/compositor/xcomposite-glx/main.cpp Change-Id: I9a9b418075970dd334babc3590b9b0315c2afb0d
2014-02-03Server Buffer example draws clients inverse on the x axisJorgen Lind3-5/+5
Change-Id: I888ef46381342af61a48c6e542ec564e67adfe13 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-01-21Fix buffer handling.Gunnar Sletta3-11/+27
The surface now has a distinct back and front buffer. Front means it is on the screen and being used as a texture. Back means it should be put to screen in the next updatePaintNode(). For the purpose of QML and GUI-thread properties, the 'back' buffer is what contains the correct properties as it is what it will eventually be rendered with. For the purpose of rendering, the front buffer contains the right texture. If no back buffer is present, then there was no changes and front buffer applies to both. The Surface's buffer queue has been updated to only fire damage and advance once we swap back buffer to front buffer which happens during updatePaintNode(). The fact that the buffer advancing happens during sync also means that we are releasing buffers back to the client as soon as another buffer is ready to be displayed in the compositor. This is "half a frame" earlier than the current implementation (which releases after the next swap). We consider this safe because: - The compositor has a new buffer to display and does not need the old one. - If the GPU is not done rasterizing the scanout buffer for the previous frame, it should hold a read-lock on the buffer so preventing the client from starting a render to it. If this assumption fails on any hardware we can make the time of buffer-advance optional. Either during "sync" or during "after rendering" as it is today, but "after rendering" will not offer any guarantee, just more time, resulting in a higher chance of the buffers being ready. Aka, without an internal read-lock and no fence mechanism, there is no guarantee. Texture cleanup is now explicit as we have a well defined location to clean up textures, during updatePaintNode(). This avoids cleanup issues which previously existed as buffer cleanup was happening on the GUI thread. Surface and Buffer destruction coming over wayland is queued up in compositor and handled before the next "sync", when it is safe to do so. The change also removes doUpdate, postBuffer and frameSwappedInternal as these are no longer used. Direct rendering will need to be considered in a new light with the new buffering scheme, and anyway needs work. Change-Id: I2db0385b4b8859f96caba374f3530448178e1473 Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-01-16Fix qwindow-compositor with raster surfacesupstream/5.2.1Laszlo Agocs2-10/+28
Using the texture cache is wrong for two reasons: 1) it's a private API 2) we will get new QImages all the time so the caching is effectively useless The main problem here is that the textures were not deleted which embedded systems do not really like. Change-Id: Ia9bafb0df58491f5ceb08ddcd9bf11b7c6137c83 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-01-13Also link wayland-client, as we use bits from it.Robin Burchell1-0/+2
Fixes linking on some toolchains where linkage is a bit more restrictive. Change-Id: I7ec3f2bde009ce6d2e20e4b500a96d234cdcc301 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-01-09Adjust the serverbufferintegrations to use bind texture apiJorgen Lind3-4/+14
It mapps closer to the underlying OpenGL architecture Change-Id: I4e0dca4d54670846488c86df2a0fa0c58d49734d Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-01-06Compile fixes for example compositorsJorgen Lind2-2/+3
Change-Id: I4399681dc91ca20a84177247379cf6eafd2b6a6e Reviewed-by: Robin Burchell <robin+qt@viroteck.net>
2014-01-06Revised createTextureFromBufferLaszlo Agocs1-2/+2
The context is not passed anymore to texture() and similar functions since they have to use the current context anyhow. createTextureFromBuffer() becomes bindTextureToBuffer() which is called with the texture bound. The integration can also provide its own texture in case the one created and managed by the surfacebuffer is not suitable. Change-Id: I1bfc4fe35c0e3db6081b47c551f20f4bca9aa04e Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-01-06Add server buffer exampleJorgen Lind17-0/+1230
Change-Id: I33950ae923f5edba4faeca26cc0656be0255e403 Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2013-12-30Fix ConstrastEffect in qml-compositorPier Luigi Fiorini1-7/+7
Specify precision to make the shader working. Change-Id: I055fe47e1073403dc981274236fa82e091e0eca4 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com> Reviewed-by: Andy Nichols <andy.nichols@digia.com>
2013-12-16QtCompositor: Make ExtensionFlags a QFlagsAndrew Knight3-3/+3
This simplifies the creation and use of ExtensionFlags. Change-Id: Ia72bbc3f712759b231d8543a4f13ef2fdf6260f3 Reviewed-by: Jan Arne Petersen <jan.petersen@kdab.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2013-12-11Enable stencil in qwindow-compositor.Laszlo Agocs1-0/+1
Handy when Quick rendering that needs stencil is performed in-process. Change-Id: Ic6593150ddde217fa0ad257f889eda131fb09095 Reviewed-by: Andrew Knight <andrew.knight@digia.com>