summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbbackingstore.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix a regression when painting CMYK over ARGB32_PremultipliedAllan Sandfeld Jensen2024-04-041-1/+1
| | | | | | | | | | With the introduction of CMYK32 the old logic of assuming depth meant compatible alpha version no longer works. So change the logic to more explicitly return compatible opaque or alpha versions and remove the now invalid qt_maybeAlphaVersionWithSameDepth. Change-Id: Ib1f7b76b0ce0eae7d49a0dfe369918a746bbe2b4 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Handle device loss for texture widgetsDavid Redondo2023-03-171-2/+4
| | | | | | | | | | | | Previously the widget stayed black and we printed "QBackingStoreDefaultCompositor: the QRhi has changed unexpectedly, this should not happen". To make it work the compositor is recreated in addition to the rhi and the widgets are informed with the internal events. Change-Id: I982d08bd3530478fe0f827080154c008a92a812e Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Make rhiFlush() support custom source DPRMorten Sørvig2022-06-141-1/+2
| | | | | | | | | | | | | | | | | | | | | | | The rhiFlush() implementation currently assumes that QWindow->devicePixelRatio() is the correct scale factor for transforming device independent window geometry to source geometry. However, this assumption does not hold if/when we add support for drawing to a rounded-up DPR, with a downscale later in the rhiFlush implementation. Fix this by adding a sourceDevicePixelRatio argument to rhiFlush(), which is set to either QWindow::devicePixelRatio() or QWidget::devicePixelRatio(), depending on from where it is used. Change deviceRect() and friends in qbackingstoredefualtcompositor.cpp to be scale*() functions instead which take a scale factor instead of a QWindow. Update call sites to use srouceDevicePixelRatio where that makes sense. Pick-to: 6.4 Change-Id: Idb7b1e2f36816a201e00f0defe100d2dc079cb17 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Don't blit individual rects of region when when scrolling backingstoreTor Arne Vestbø2022-04-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | The QPlatformBackingStore::scroll() API takes a QRegion as input, but we have no guarantee that the individual source and destination rects of the region will not overlap each other when applying the scroll offset, so we can't naively iterate the rects and call qt_scrollRectInImage for each one. The reason this didn't cause any issues in practice was that the QWidget repaint manager was always passing in a single rect as the region. On the other hand, the client has requested a scroll of the given region, so it might assume any other part of the backing store is preserved as is. Scrolling the bounding rect of the region violates this assumption. Amends 19ef76b0606621f189d3bc56549d200f2f5ebb25. Pick-to: 6.2 6.3 Change-Id: I27934dd6685311c0b53ea2adb60fa5997e360f6c Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Compose render-to-texture widgets through QRhiLaszlo Agocs2022-03-111-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QPlatformTextureList holds a QRhiTexture instead of GLuint. A QPlatformBackingStore now optionally can own a QRhi and a QRhiSwapChain for the associated window. Non-GL rendering must use this QRhi everywhere, whereas GL (QOpenGLWidget) can choose to still rely on resource sharing between contexts. A widget tells that it wants QRhi and the desired configuration in a new virtual function in QWidgetPrivate returning a QPlatformBackingStoreRhiConfig. This is evaluated (among a top-level's all children) upon create() before creating the repaint manager and the QWidgetWindow. In QOpenGLWidget what do request is obvious: it will request an OpenGL-based QRhi. QQuickWidget (or a potential future QRhiWidget) will be more interesting: it needs to honor the standard Qt Quick env.vars. and QQuickWindow APIs (or, in whatever way the user configured the QRhiWidget), and so will set up the config struct accordingly. In addition, the rhiconfig and surface type is (re)evaluated when (re)parenting a widget to a new tlw. If needed, this will now trigger a destroy - create on the tlw. This should be be safe to do in setParent. When multiple child widgets report an enabled rhiconfig, the first one (the first child encountered) wins. So e.g. attempting to have a QOpenGLWidget and a Vulkan-based QQuickWidget in the same top-level window will fail one of the widgets (it likely won't render). RasterGLSurface is no longer used by widgets. Rather, the appropriate surface type is chosen. The rhi support in the backingstore is usable without widgets as well. To make rhiFlush() functional, one needs to call setRhiConfig() after creating the QBackingStore. (like QWidget does to top-level windows) Most of the QT_NO_OPENGL ifdefs are eliminated all over the place. Everything with QRhi is unconditional code at compile time, except the actual initialization. Having to plumb the widget tlw's shareContext (or, now, the QRhi) through QWindowPrivate is no longer needed. The old approach does not scale: to implement composeAndFlush (now rhiFlush) we need more than just a QRhi object, and this way we no longer pollute everything starting from the widget level (QWidget's topextra -> QWidgetWindow -> QWindowPrivate) just to send data around. The BackingStoreOpenGLSupport interface and the QtGui - QtOpenGL split is all gone. Instead, there is a QBackingStoreDefaultCompositor in QtGui which is what the default implementations of composeAndFlush and toTexture call. (overriding composeAndFlush and co. f.ex. in eglfs should continue working mostly as-is, apart from adapting to the texture list changes and getting the native OpenGL texture id out of the QRhiTexture) As QQuickWidget is way too complicated to just port as-is, an rhi manual test (rhiwidget) is introduced as a first step, in ordewr to exercise a simple, custom render-to-texture widget that does something using a (not necessarily OpenGL-backed) QRhi and acts as fully functional QWidget (modeled after QOpenGLWidget). This can also form the foundation of a potential future QRhiWidget. It is also possible to force the QRhi-based flushing always, regardless of the presence of render-to-texture widgets. To exercise this, set the env.var. QT_WIDGETS_RHI=1. This picks a platform-specific default, and can be overridden with QT_WIDGETS_RHI_BACKEND. (in sync with Qt Quick) This can eventually be extended to query the platform plugin as well to check if the platform plugin prefers to always do flushes with a 3D API. QOpenGLWidget should work like before from the user's perspective, while internally it has to do some things differently to play nice and prevent regressions with the new rendering architecture. To exercise this better, the qopenglwidget example gets a new tab-based view (that could perhaps replace the example's main window later on?). The openglwidget manual test is made compatible with Qt 6, and gets a counterpart in form of the dockedopenglwidget manual test, which is a modified version of the cube example that features dock widgets. This is relevant in particular because render-to-texture widgets within a QDockWidget has its own specific quirks, with logic taking this into account, hence testing is essential. For existing applications there are two important consequences with this patch in place: - Once the rhi-based composition is enabled, it stays active for the lifetime of the top-level window. - Dynamically creating and parenting the first render-to-texture widget to an already created tlw will destroy and recreate the tlw (and the underlying window). The visible effects of this depend on the platform. (e.g. the window may disappear and reappear on some, whereas with other windowing systems it is not noticeable at all - this is not really different from similar situtions with reparenting or when moving windows between screens, so should be acceptable in practice) - On iOS raster windows are flushed with Metal (and rhi) from now on (previously this was through OpenGL by making flush() call composeAndFlush(). Change-Id: Id05bd0f7a26fa845f8b7ad8eedda3b0e78ab7a4e Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* xcb: Return standalone image from QXcbBackingStore::toImage()Tor Arne Vestbø2021-11-191-1/+7
| | | | | | | | | Otherwise the original backingstore image will detach from the m_xcb_image data on the next backingstore paint or scroll. Pick-to: 6.2 Change-Id: I73f68d9c2e7c106951541831a5df8b97695f2001 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* xcb: Don't mark scrolled area as flushed when doing client side scrollTor Arne Vestbø2021-11-181-8/+9
| | | | | | | | | | | | | | The m_pendingFlush variable is used to track what is missing in the server side backingstore. If we're doing a client side scroll the pending area is still the same. If we were to always discard the scrolled area from m_pendingFlush we would get in trouble on the next non-client side scroll, as we think the content exists server-side. Pick-to: 6.2 Change-Id: Ie50a99a8e5d8a83d1299c53534a1c83c6bfb47bd Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* xcb: Ensure we have pixmap GC before trying to flush to it during scrollTor Arne Vestbø2021-11-181-2/+2
| | | | | | Pick-to: 6.2 Change-Id: Icc85b1eb830d8d9b1b2bfb8b9998470388522832 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* xcb: Prepare correct area when doing client side backingstore scrollTor Arne Vestbø2021-11-181-2/+4
| | | | | | | | The area we're going to fill is the one after applying the scroll delta. Pick-to: 6.2 Change-Id: I254830a15e5f4c93ba28ed8f0a9b35c40f1d1af2 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* xcb: Flush scrolled region of backingstore to client when requesting imageTor Arne Vestbø2021-10-051-1/+6
| | | | | | | | | | | | We were doing this for composeAndFlush already, which accesses the image via graphicsBuffer(). Task-number: QTBUG-64504 Task-number: QTBUG-64414 Pick-to: 6.2 Change-Id: I51cc002db8a15991f8a8aa32e849c07318e6e74c Reviewed-by: Błażej Szczygieł <mumei6102@gmail.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* xcb: Fix flushing of native subwindows when not using shared memoryTor Arne Vestbø2020-08-221-2/+11
| | | | | | | | | | | | | | | | | | | | | When using X-forwarding we're not using shared memory for the backing store image, and end up in a code path where we first copy the updated parts of the backing store from our client side image over to the server, and then flush those parts from the server-side image to the window. The problem was that this code path didn't account for the possibility that we'd flush a sub-window at an offset, and would end up uploading the sub-window local region directly, without applying the offset. This problem was revealed when 79bf1b7e348d started being smarter about what regions we flush and to what windows when we have sub windows. Fixes: QTBUG-81723 Pick-to: 5.15 Pick-to: 5.12 Change-Id: I1c9c8bc53c088cdc1ae8b892e17930f4a468ccad Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Make bytes-per-line safe for int overflowAllan Sandfeld Jensen2020-02-201-2/+2
| | | | | | | | Goes through the Qt code and make sure bytes-per-line calculations are safe when they are too big for 32bit integers. Change-Id: I88b2d74b3da82e91407d316aa932a4a37587c0cf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Tidy nullptr usageAllan Sandfeld Jensen2019-12-061-6/+6
| | | | | | | | | | | Move away from using 0 as pointer literal. Done using clang-tidy. This is not complete as run-clang-tidy can't handle all of qtbase in one go. Change-Id: I1076a21f32aac0dab078af6f175f7508145eece0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* xcb: respect big-request encoding in max request sizeGatis Paeglis2019-02-061-8/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From big-request specification: "This extension defines a mechanism for extending the length field beyond 16 bits. If the normal 16-bit length field of the protocol request is zero, then an additional 32-bit field containing the actual length (in 4-byte units) is inserted into the request, immediately following the 16-bit length field." Meaning that the request requires 4 additional bytes. This patch provides a convenience API for calculating maximum request data size. Besides fixing QTBUG-73044, it was also discovered that calculations for xcb_image_put (in QXcbBackingStoreImage::flushPixmap) were wrong. The code assumed that xcb_get_maximum_request_length() returns bytes, but what it actually returns is length which is measured in four-byte units. This means that we were sending 4x less bytes than allowed by the protocol. Furthermore, use the actual 'stride' (bytes per line) value when calculating rows_per_put. The new stride value was introduced by 760b2929a3b268e2edf14a561329bdb78fbdc26e, but was not updated in rows_per_put calculations. Fixes: QTBUG-73044 Done-with: JiDe Zhang <zccrs@live.com> Done-with: Mikhail Svetkin <mikhail.svetkin@qt.io> Change-Id: I06beb6082da3e8bc78225a87603914e796fe5878 Reviewed-by: Błażej Szczygieł <spaz16@wp.pl> Reviewed-by: JiDe Zhang <zccrs@live.com> Reviewed-by: Mikhail Svetkin <mikhail.svetkin@qt.io> Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* configure: make xcb-render a hard dependency for xcb pluginGatis Paeglis2019-01-031-12/+0
| | | | | | | | | | | | | | Its been available by default since at least libxcb 1.5, and in Qt 5.12 we have even increased the minimal required libxcb version to 1.9. Having configure switches for extensions is a legacy from Qt 4. There are still few exceptions in Qt5, where the reason is that we have to support Linux distributions that don't ship recent enough libxcb. Task-number: QTBUG-30939 Change-Id: I0a02d93b6411119ec018b0cb8fe5c63beeab62ee Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* configure: properly atomize render vs. renderutilGatis Paeglis2019-01-031-6/+0
| | | | | | | | | | | | | | | | | | xcb-render is a C interface for X11 extension. xcb-render-util is a utility library that complements xcb-render by providing convenience functions and interfaces which make the raw X protocol more usable. Bumped xcb-render-util version to avoid having include hacks. We were bundling 8 years old release 0.3.8 (Apr, 2011). 0.3.9 is the latest release and it was relesed 4,5 years ago (Jun, 2014). All CI machines have 0.3.9. The only thing that have changed in xcb-render-util sources since 2011 is that we don't need to have various hacks to include xcb_renderutil.h in C++ files. Upgrading bundled XCB libs was also requested in QTBUG-71109. Task-number: QTBUG-71109 Change-Id: Ib261f7584ad81be95660123b007e2200a3042f4c Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
* Fix image grab when XCB is rgb-swappingAllan Sandfeld Jensen2018-11-111-0/+3
| | | | | | | | | | The rgbSwap produces an image that fits the X-server, but not one that fits our internal image definitions, so instead return our internal image. Task-number: QTBUG-56806 Change-Id: I25aedf7279bcd86792213b11dbd07a77b49538de Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: qxcbconnection_basicGatis Paeglis2018-10-171-9/+9
| | | | | | | | | | | | A basic base class that creates a connection and initializes extensions. The goal was to reduce the size of qxcbconnection.h/cpp. Made QXcbAtom into a class that handles atom initialization and exposes the relevant APIs. Before this patch, all of that logic was inside of qxcbconnection.h/cpp. Change-Id: Ia893c3b31e2343dfbe62fe2aa6bfd0017abf46ea Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* Merge remote-tracking branch 'origin/5.11' into devLiang Qi2018-08-161-57/+86
|\ | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qconfig-bootstrapped.h src/plugins/platforms/xcb/qxcbbackingstore.cpp Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Change-Id: I4af138ffb2f5306373244523768209e8873b2798
| * xcb: make sure we have a valid m_qimage in backing storeGatis Paeglis2018-08-131-50/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch amends a62f1d03560937a306c7586669a46cd9575e9464. If the initial backing store resize request is called with QSize(0, 0), we end up with QXcbBackingStoreImage holding a default contructed QImage / m_qimage. This happens because of the logic in QXcbBackingStoreImage::create(), where if we detect that the requested segmentSize == 0, we do not allocate any memory, and thus don't create a valid image in m_qimage. On subsequent call to QXcbBackingStore::resize() we would only check if QXcbBackingStoreImage object has been created, but not if it is in a valid state. This obviously would cause problems. This patch re-factors the logic to handle better resize to QSize(0, 0). And make the code cleaner by: - merging ::create and ::resize as semantically it is always resize(). - dropping unnecessary argument passing. Task-number: QTBUG-69581 Change-Id: Ied337beb449dea8259fcf6b7d29f0a5bd553019d Reviewed-by: Błażej Szczygieł <spaz16@wp.pl> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* | xcb: Fix artifacts on the tray background with lock screensAlexander Volkov2018-07-101-12/+193
|/ | | | | | | | | | | | | | | | | | | | | With the current method of painting the tray icon with 24 bpp visuals we grab the window's background once on the first show and then use it in all paint operations. This leads to a wrong background if an application shows the system tray icon when the lock screen is active. We can avoid this by painting with XRender when it's available. This change introduces QXcbSystemTrayBackingStore and moves the selection of a suitable painting method from QSystemTrayIconSys into it. In addition the visual for the window is selected according to the system tray specification and the platform window for the tray icon is created without needless OpenGL and Vulkan support. Task-number: QTBUG-55540 Change-Id: Ib3ca42bc02dcbdd4ccfe5d6e23f870ef22f0d25a Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: fix regression with remote X11 clientsGatis Paeglis2018-06-111-45/+62
| | | | | | | | | | | | | | | | | | | | | | | | | There were several issues here: We were attempting to use MIT-SHM functions over SSH connection, which is not supported. X server should detect this and return with an appropriate error message. It does actually return BadAccess for non-fd code path, but Qt was stubbornly trying to repeat this action and always falling back to malloc (during window resizing). For fd code path we were hitting X server bug, which would result in window freeze [1]. During the initialization we check if xcb_shm_attach_checked() fails, and disable MIT-SHM if it does. We use this logic to detect if we are running remotely, as there are no public APIs for it. This way we can avoid X server bug and avoid needless calling of code path which will _always_ fail on a remote X11 connection. [1] https://lists.x.org/archives/xorg-devel/2018-June/057011.html Task-number: QTBUG-68449 Task-number: QTBUG-68783 Change-Id: I7ab3dcf0f323fd53001b9f7b88c2cb10809af509 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: cleanup the code for detecting when to create/destroy SHM segmentGatis Paeglis2018-04-141-6/+8
| | | | | | | | | | | - removed the check for "m_segmentSize > 0" as according to the code it will never be <= 0. - wrap the entire logic in connection()->hasShm() { .. } as that is when the logic becomes relevant. This makes the code more readable. Change-Id: I572420df8e29cc46593f8a13c250f8c05c6a9108 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* xcb: various coding style cleanups in qxcbbackingstoreGatis Paeglis2018-04-091-36/+32
| | | | | | | | | | | - Pass QXcbBackingStoreImage a pointer to QXcbBackingStore. This allow for simpler QXcbBackingStoreImage ctor. - Use member initializers. Change-Id: Ia992390060bb30e1184813cd0d115a8bf0fbc237 Reviewed-by: Błażej Szczygieł <spaz16@wp.pl> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* xcb: rename two classes in qxcbbackingstoreGatis Paeglis2018-04-091-21/+21
| | | | | | | | | | | | | | QXcbShmImage to QXcbBackingStoreImage as it is an image that might or might not have SHM capability. The current name implies that it always uses SHM. QXcbShmGraphicsBuffer to QXcbGraphicsBuffer as it has nothing to do with SHM. Change-Id: I57ced75891e8b10515142769278a7f3f40da91ef Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru> Reviewed-by: Błażej Szczygieł <spaz16@wp.pl> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* xcb: Prevent shared memory allocation on every window resizeBłażej Szczygieł2018-03-141-35/+83
| | | | | | | | | | | Allocate new shared memory only when window size grows or when window size is 2 times smaller than allocated memory size. This improves window resizing performance and also allows to free some memory if window becames much smaller. Change-Id: I3454cd3c6023eede8242d6b29038f4dd6638f9f1 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru>
* xcb: Fix developer buildFriedemann Kleint2018-02-191-0/+3
| | | | | | | | | | | | Add Q_UNUSED, fixing: qxcbbackingstore.cpp:344:45: error: unused parameter 'segmentSize' [-Werror=unused-parameter] on Kubuntu 17.10. Amends 24adaa9a742e6f95ff897d0eb9a2bce0527dd042. Task-number: QTBUG-46017 Change-Id: I64f21d8f1d1ac21340cfbba66b97768140ce23a8 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: Fix access to shm for X server running from another userAlexander Volkov2018-02-151-35/+98
| | | | | | | | | | | | | | | Use ShmCreateSegment call, that was added in MIT-SHM 1.2, to create shared memory segments on the server side. It returns a POSIX shared memory object that is used to mmap memory. It's in effect a file descriptor that is passed through the X server socket and thus avoids permission checks. On the other hand this scheme is more secure, because the file descriptor, and thus the shared memory, are accessible only by the X server and the application. Task-number: QTBUG-46017 Change-Id: I202eead9d01aee2ab5b65f4f74f4c13da7cb2239 Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: Enhance SHM management codeAlexander Volkov2018-02-151-39/+64
| | | | | | | | | | - extract the creation of a shared memory segment into a separate function - do extra checks for errors - check that MIT-SHM extension is present once in QXcbConnection Change-Id: I956bdf76b879ec5c95a7ed219a59ae722dc5afba Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* xcb: port away from last QRegion::rects()Marc Mutz2017-12-061-5/+4
| | | | | | | | | | | Use begin()/end() instead. In QXcbShmImage::flushPixmap(), instead of gettings different rects(), depending on a bool parameter, just call yourself again with the modified QRegion, which we can then just iterate over. Change-Id: I6d4f7c6e4e5d2a24520716847ca9331bf39337c8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* xcb: share code for QRegion -> xcb_rectangle_t[] conversionMarc Mutz2017-12-061-10/+1
| | | | | | | | | | ... between QXcbWindow and QxcbShmImage. Replaces one QRegion::rects() call (to be deprecated), fixes potential overflows that QXcbShmImage did not handle, but QXcbWindow did, and saves ~1KiB of text size. Change-Id: I55d37021164feefe0cb3e60bd6d22b1976a6467b Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* xcb: Speed-up image scrollingBłażej Szczygieł2017-11-231-47/+152
| | | | | | | | | | | | | | | | | | | | Prevent image scrolling on client-side whenever possible - do it on server-side. When using shared memory use server-side pixmap for scrolled contents. Put new image which will be scrolled to the server-side pixmap and do scroll on it. Then do a server-side copy of a scrolled area from pixmap to he window. Also put non-scrolled image directly to the window. When not using shared memory also don't do redundand client-side image scrolling. When using OpenGL compositing first copy scrolled image area from/to server-side pixmap. Task-number: QTBUG-64414 Change-Id: Ibf5f8cfb40cd4fb3e4a75a1b92eecb625f4fd74f Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Merge remote-tracking branch 'origin/5.10' into devLiang Qi2017-10-171-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/network/fortuneclient/client.cpp examples/network/fortuneserver/server.cpp src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h src/plugins/platforms/cocoa/qcocoabackingstore.h src/plugins/platforms/cocoa/qcocoaintegration.h src/plugins/platforms/cocoa/qcocoascreen.h src/plugins/platforms/ios/qiosbackingstore.h src/plugins/sqldrivers/oci/qsql_oci.cpp src/widgets/kernel/qwidgetwindow.cpp Change-Id: Ia6dd2c52d4a691b671cf9a2ffca70deccece8f10
| * Let QPlatformBackingStore handle its own QOpenGLContextTor Arne Vestbø2017-10-051-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The resources allocated by QPlatformBackingStore are owned by the class, and should be allocated in a context the class also owns. This removes the asymmetry of having to pass in a context to composeAndFlush, while having to make the same context current before destroying the platform backingstore. The context owned by QPlatformBackingStore is shared with the associated window though a new QWindowPrivate::shareContext() API. The result is that on e.g. iOS, the backingstore does not need to tie the resource allocation of QPlatformBackingStore to the global share context, but can instead tie them to the per-window context, and hence clean them up after each window is closed. Task-number: QTBUG-56653 Change-Id: Ic1bcae50dafeeafaa8d16a7febd83b840ec6367a Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Replace Q_NULLPTR with nullptr where possibleKevin Funk2017-09-191-3/+3
|/ | | | | | | | | | | | | Remaining uses of Q_NULLPTR are in: src/corelib/global/qcompilerdetection.h (definition and documentation of Q_NULLPTR) tests/manual/qcursor/qcursorhighdpi/main.cpp (a test executable compilable both under Qt4 and Qt5) Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-041-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qprocess_unix.cpp src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/util/util.pri tests/auto/corelib/thread/qthread/qthread.pro tests/auto/corelib/thread/qthread/tst_qthread.cpp Change-Id: I5c45ab54d46d3c75a5c6c116777ebf5bc47a871b
| * xcb: Increment iterator inside bgr888 region loopBłażej Szczygieł2017-06-281-1/+1
| | | | | | | | | | | | | | Amends 9c1d3bc253abd4418f3050d19ec5f05bef3ada97. Change-Id: I912096794d274617e5b290dfb42685088cd49b23 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | xcb: remove code and macros related to Q_XCB_DEBUGGatis Paeglis2017-03-101-59/+43
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | ... early spring-cleaning, leaving one block of virtual root debug code that was inappropriately conditioned on Q_XCB_DEBUG; it now gets its own define. Removed Q_XCB_CALL: 1) I don't know anyone who actually uses it. 2) Enabling this feature (via Q_XCB_DEBUG) fails to build (and has been like that for about 1 year). 3) There are better ways to debug X11 client message exchange (see xtrace for example). 4) Using Q_XCB_CALL is a very fragile approach. Grep for example for xcb_change_property and you will see that half of the calls are not wrapped with the Q_XCB_CALL macro. This patch also removes the Q_XCB_NOOP macro. It's unclear what its purpose was. There was a TODO comment in qxcbeglcontext.h suggesting removal of this macro as well. Its evaluation of its parameter, even without Q_XCB_DEBUG, had no side-effects, so its removal should be harmless. Change-Id: I9fa48af454061d8b38f69f308131647cd18f85f4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Alexander Volkov <a.volkov@rusbitech.ru> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* xcb: Replace Q_DECL_OVERRIDE by overrideAlexander Volkov2016-12-011-6/+6
| | | | | | | | We can use 'override' directly since Qt 5.7. Also remove redundant 'virtual' keywords. Change-Id: Ia40be0e1e60e51f9d043ab575fd6b9305ea620b0 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
* Merge remote-tracking branch 'origin/5.7' into 5.8Liang Qi2016-11-011-7/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config.tests/win/msvc_version.cpp configure.pri mkspecs/macx-ios-clang/features/default_post.prf mkspecs/macx-ios-clang/features/resolve_config.prf mkspecs/features/uikit/default_post.prf mkspecs/features/uikit/resolve_config.prf src/corelib/io/qsettings_mac.cpp src/corelib/json/qjsondocument.cpp src/plugins/platforms/cocoa/qcocoawindow.h src/plugins/platforms/cocoa/qcocoawindow.mm src/plugins/platforms/cocoa/qnswindowdelegate.h src/plugins/platforms/cocoa/qnswindowdelegate.mm src/plugins/platforms/ios/ios.pro src/plugins/platforms/ios/kernel.pro src/plugins/platforms/ios/qiosintegration.h src/plugins/platforms/minimalegl/qminimaleglintegration.cpp tests/auto/gui/painting/qpainter/tst_qpainter.cpp tools/configure/environment.cpp Change-Id: I654845e54e40f5951fb78aab349ca667e9f27843
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-10-131-7/+9
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also bump minimum required Qt version for Android: Ministro updates. Conflicts: src/android/java/src/org/qtproject/qt5/android/bindings/QtActivityLoader.java src/android/java/src/org/qtproject/qt5/android/bindings/QtLoader.java src/plugins/platforms/android/androidjnimain.cpp Change-Id: I966f249bebf92da37bfdeb995ad21b027eb03301
| | * QXcbShmImage: don't use shmget()'s return unless it succeedsEdward Welbourne2016-10-121-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When shmget() failed, we didn't set m_shm_info.shmid (not even to the -1 failure id) but did pass it (i.e. uninitialized noise) to shmat(), among other related functions. Guard against this; handle failure gracefully. Task-number: QTBUG-56419 Change-Id: Ie823c36c2ede03af6cb5d94ce7b4b5cd543c1008 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com> Reviewed-by: Błażej Szczygieł <spaz16@wp.pl> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> Reviewed-by: Joni Poikelin <joni.poikelin@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-121-5/+13
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: config_help.txt configure src/corelib/io/qprocess_wince.cpp src/plugins/platforms/windows/qwindowstheme.cpp src/plugins/platforms/xcb/qxcbbackingstore.cpp tests/auto/corelib/tools/qtimezone/BLACKLIST tests/auto/network/socket/qudpsocket/tst_qudpsocket.cpp tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp Change-Id: I26644d1cb3b78412c8ff285e2a55bea1bd641c01
| * | xcb: support nested paint operations in remote scenariosLouai Al-Khanji2016-04-291-4/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent changes to the xcb platform plugin added logic to paint to a server-side X Pixmap when the MIT-SHM extension is unavailable. Those changes also added logic to keep track of the dirty areas that need to be flushed to the server from the backing store when the backing store is flushed to a window. Because a single QRegion was used to track those areas, nested paint operations no longer accurately tracked all the dirty areas. Consider: void Widget::paintEvent(QPaintEvent *) { QPainter p1(this); for (int i = 0; longRunningOperationInProgress(); i++) { QPixmap pixmap(size()); QPainter p2(&pixmap); p2.drawText(pixmap.rect(), i & 1 ? "Working." : "Working.."); p2.end(); QBackingStore *bs = backingStore(); bs->beginPaint(rect()); p1.drawPixmap(0, 0, pixmap); bs->endPaint(); bs->flush(rect(), windowHandle()); } p1.fillRect(rect(), Qt::red); p1.drawText(rect(), "Done!"); } While this code could be restructured, it is a common pattern in legacy Qt applications which cannot be easily changed. Change-Id: I3b919266abe41c96a584cb02f41cafac3f9d1d7c Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-05-031-15/+22
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/3rdparty/double-conversion/include/double-conversion/utils.h src/corelib/global/qnamespace.qdoc src/corelib/tools/qsimd_p.h tests/auto/corelib/io/qfile/tst_qfile.cpp Change-Id: I3ca1007bab5355d251c13002a18e93d81c254d34
| * | xcb: Fix image scanline paddingLouai Al-Khanji2016-04-151-15/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit b9d386f2ccd69c7f6a766a6d90a6024eeb48e90a neglects to account for the scanline padding requested by the X server. This can result in visual artifacts if padding is required. This commit fixes this by factoring in the X server's requested scanline padding when calculating image stride. Change-Id: I082cb7101ec3a9c554b9b58a76f53f780b87d31e Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | | Add QPlatformBackingStore::toImage() implementationsAndy Nichols2016-04-301-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | On platforms where it makes sense, add the implementation that makes returning a QImage possible. This makes it possible to grab raster windows. Change-Id: I89241728aa6f7811c56bb66cd86a64aa961d71f8 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-04-111-21/+88
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qobject.cpp src/gui/painting/qpaintengine_raster.cpp Change-Id: I74e1779832f43d033708dcfd6b666c7b4f0111fb
| * | xcb: Optimize non-shm backing store flushingLouai Al-Khanji2016-04-101-21/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately the functions in xcb-image are quite slow, both for the subimage generation and the byte order swapping. xcb_image_subimage is implemented as a pixel by pixel copy, and the xcb byte swapping is done manually without utilizing potential CPU instructions to accelerate the swap. Replace both with their Qt equivalents. Change-Id: I1fe1fe5d9576fdf2bab4a8c401d2a6bb842c2727 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>