summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbbackingstore.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Use backing store formats with alphaAllan Sandfeld Jensen2016-01-081-0/+4
| | | | | | | | | | | | | We depend on being able to punch holes in the backing store when integrating with FBO elements. To do that we need a format with an alpha channel. This was only working previously because RGB32 didn't mask when filling or when converting to ARGB32_PM, but other formats didn't. Also unifies the logic for getting alpha versions of QImage formats. Task-number: QTBUG-50281 Change-Id: Ied1325f60e2b67d9ea2dfa9701b06fc2231ebfca Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Xcb: fix crash on screen power savePaul Olav Tvete2015-10-261-2/+11
| | | | | | | | | | | | Handle various cases where we have null QScreen or QPlatformScreen pointers. With this change, I can run Qt Creator for several days. Before, it would crash multiple times per day with a two-monitor setup. Change-Id: I0923d886ae2a4199ac37edd711ddd4f6f99df93d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
* xcb: better error reporting when shmget() failsShawn Rutledge2015-10-261-2/+2
| | | | | | Change-Id: I160ebc07f25fd08b86ca5494cb149c5fc7c70086 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* X11 changes for highdpiPaul Olav Tvete2015-07-301-1/+2
| | | | | | | | | | | Adapt the xcb plugin to work with the new cross-platform high-DPI scaling. Fixes for drag and drop is done in a separate change. Task-number: QTBUG-46615 Change-Id: I29002721169750b9de59edb0f3e9134adabc4855 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Remove QT_DEVICE_PIXEL_RATIO support from xcbPaul Olav Tvete2015-07-291-33/+12
| | | | | | | | It will be reintroduced as a cross-platform feature. Task-number: QTBUG-46615 Change-Id: Ia6d03275018b2a25ebed438fe51f15e491f1c3ff Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4' into 5.5Liang Qi2015-03-311-1/+1
|\ | | | | | | | | | | | | | | | | Conflicts: mkspecs/android-g++/qmake.conf qmake/generators/unix/unixmake2.cpp src/gui/image/qimage_conversions.cpp Change-Id: Ib76264b8c2d29a0228438ec02bd97d4b97545be0
| * Fallback to malloc for insanely large windowsPaul Olav Tvete2015-03-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If shmget() does not work (probably because the backingstore size is bigger than SHMMAX), don't create a QImage with the previous buffer and the new size. That does not end well when we try to draw to the image later. Instead, fall back to the malloc path, like we do when the system doesn't support shared memory. [ChangeLog][X11] Don't crash when resizing windows to bigger than 3840x2160 Task-number: QTBUG-45071 Change-Id: I009de7c2179ffde28e252593067756877cad1b1c Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* | xcb: Fix bgr888 VNC sessionsLaszlo Agocs2015-03-301-5/+32
| | | | | | | | | | | | | | | | | | Introduce a slow path for 24 and 32 bit BGR. We don't care about performance here but it has to show the correct colors. Task-number: QTBUG-42776 Change-Id: Ic73e8ca3950b2b956f06643165dcfac51e7540f3 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
* | Resize backingstore properly on devicePixelRatio changesPaul Olav Tvete2015-03-251-6/+17
| | | | | | | | | | | | | | | | Task-number: QTBUG-45076 Change-Id: Ib2f2408abf7bd0b6d1c8a05fbbdc665e77ea6392 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* | Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2015-01-211-2/+2
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/global.pri src/corelib/global/qcompilerdetection.h src/corelib/global/qglobal.h src/corelib/tools/qdatetime.cpp src/plugins/platforms/xcb/qxcbscreen.h src/plugins/platforms/xcb/qxcbwindow.h src/widgets/dialogs/qcolordialog.cpp src/widgets/dialogs/qcolordialog_p.h tools/configure/configureapp.cpp Change-Id: Ie9d6e9df13e570da0a90a67745a0d05f46c532af
| * Fix use-after-free bugGatis Paeglis2015-01-081-2/+2
| | | | | | | | | | | | | | | | | | | | xcb_image_destroy() calls free on m_xcb_image and then few lines down we access member of m_xcb_image. Swap order of these two actions. Change-Id: I01fb43a066459cce462df6af22161c35cef524eb Task-number: QTBUG-43623 Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* | Introducing QPlatformGraphicsBufferJørgen Lind2015-01-171-0/+43
| | | | | | | | | | Change-Id: Idcf8f75bd151a877c7097b79df998c1ffd56871c Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* | XCB: Don't override non-existent method when QT_NO_OPENGLUli Schlachter2014-12-081-0/+2
|/ | | | | | | | | | | | QBackingStore only has a toImage() method if OpenGL is enabled. I noticed this because compilation failed for me, thanks to Q_DECL_OVERRIDE. qxcbbackingstore.h:60:12: error: ‘QImage QXcbBackingStore::toImage() const’ marked override, but does not override QImage toImage() const Q_DECL_OVERRIDE; Change-Id: I6b45ef41c53d819d81fe657f26adc1f630fec6bb Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* devicePixelRatio support for XCBPaul Olav Tvete2014-08-191-12/+22
| | | | | | | | | | This adds support for the environment variable QT_DEVICE_PIXEL_RATIO for the xcb platform plugin. Task-number: QTBUG-38858 Change-Id: I7faca2f2e7dc5c601a82b3cc08456870b3e5602d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@digia.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Fix composition for windows with alphaLaszlo Agocs2014-08-131-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | While we will cover the entire surface with our textured quads, the clear is still necessary in order to make top-levels with TranslucentBackground render correctly: We don't want to blend transparent areas with undefined content that is in the surface's framebuffer. Blending is problematic for alpha values. We now prevent the blended alpha from being written out. This ensures that in examples like qquickviewcomparison, where the backingstore image contains an alpha of 0.5 while the QQuickWidget texture 1.0, the result is still an alpha value of 1.0 in the final image. Writing out an alpha of 0.5 would break on systems where windows get an alpha buffer by default. hellogl2 can now take a --transparent parameter which makes the QOpenGLWidget being cleared to transparent in order to verify it works in combination with Qt::WA_TranslucentBackground. The swapped red and blue problem is also corrected. RGBA8888 does not need swizzling. The only format that needs this is RGB32. Task-number: QTBUG-40716 Change-Id: I54a9fd3a91a1b59575b38cdb908835315514e40f Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Improve the implementation of the _NET_WM_SYNC_REQUEST protocolMartin Gräßlin2014-05-271-12/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change improves the synced resizes of xcb windows and adds support for synced resizes of glx windows. The QXcbWindow keeps a better track on whether the window manager expects a sync and can be in one of three states: * no sync required * sync required, but configure notify event not yet received * sync required and configured By tracking this in the QXcbWindow itself the backing store can make use of this information and doesn't need an own heuristic to decide whether a sync is needed. Also this allows to add support for synced resizes of windows with an OpenGLSurface. This is accomplished by checking the sync state after swapping buffers. As the OpenGL context may be bound to a background thread the sync is done using a QueuedConnection to ensure that the sync happens in the thread which created the xcb window. So far this is only added for GLX. This significantly improves the resize experience of QQuickWindow and also the initial mapping with a composited window manager in case the compositor uses the sync protocol to determine whether the window is ready to get painted on screen. Change-Id: Ied0261873043d785dec652d2821fc3638292fa36 Reviewed-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Fix xcb plugin backing store byte order issueJason Haslam2014-04-081-9/+24
| | | | | | | | | | | | The image format of the backing store should use the byte order of the machine where the application is running, not the native format of the X server. Then, if the byte order of the backing store image differs from the X server's native format, it needs to be converted before being sent across the network. Task-number: QTBUG-29898 Change-Id: Ic91c8ffb814c6beeb9f1d9195174a47d8bd94a90 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Enabling QQuickWidget and QOpenGLWidgetPaul Olav Tvete2014-02-121-0/+24
| | | | | | | | | Enable child widgets (without a native window) that render to an FBO and are composed with the raster backingstore by the platform plugin. A preliminary version of QOpenGLWidget is included as private API. Change-Id: I8f984a4d7db285069ce3d6564707942c823d890d Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* xcb: Remove useless flushesUli Schlachter2014-01-061-4/+2
| | | | | | | | | | | | | | | | | | | | | | Calling xcb_flush() right before QXcbConnection::sync() is pointless. The flush sends all requests that were already queued to the server and the call to sync() then just sends another request, flushes it and waits for its reply. Having just sync() implicitly flush for us means less overhead and has the same effect. Another useless flush is in QXcbShmImage::put(). The only caller is QXcbBackingStore::flush() and this calls put() in a loop. If we just call xcb_flush() from flush(), then xcb can send more requests in a single write() call again. Finally, calling Q_XCB_NOOP() twice in a row without doing any interaction with xcb in between doesn't help much, so remove one of the two calls from QXcbShmImage::put() Change-Id: Ia3d6945b8d961e2844fc3e31fdf8189c47b534d1 Signed-off-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
* remove unnecessary beginPaint and endPaint overridesShawn Rutledge2013-09-161-4/+0
| | | | | | | | | | | | | QPlatformBackingStore::endPaint does not take a QRegion parameter. 6ce6b8a378b0d97ba950240ffb048a4b7e485235 set the API, but the platform implementations were not all synced up since then. There was anyway no point in overriding beginPaint and endPaint on platforms which don't need to do anything there. This fixes clang warnings of the form QXcbBackingStore::endPaint hides overloaded virtual function Change-Id: Id6cd0fc2c831a34576ac2c73eeb0d5741d26e622 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
* QXcbBackingStore: don't crash in flush() if no platformWindowShawn Rutledge2013-08-211-0/+4
| | | | | | Task-number: QTBUG-32681 Change-Id: Iec7204985867a8d65cea393ba6ab66d328a5e7b2 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Merge remote-tracking branch 'gerrit/release' into stableFrederik Gladhorn2013-01-151-1/+1
|\ | | | | | | Change-Id: Ieb104d0e390218a063082c93bc9c7e412af2166d
| * Change all shmget calls to user-only memoryThiago Macieira2013-01-151-1/+1
| | | | | | | | | | | | | | | | Drop the read and write permissions for group and other users in the system. Change-Id: I8fc753f09126651af3fb82df3049050f0b14e876 Reviewed-by: Richard J. Moore <rich@kde.org>
* | Clear backingstore for windows with alpha channel.Friedemann Kleint2013-01-111-2/+0
|/ | | | | | | | | Fixes painting artifacts in translucent windows. Task-number: QTBUG-28531 Change-Id: I00a7a86f88a40d356fa3e37bd497a288b2118469 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Don't crash if there's no m_image yet.Sérgio Martins2012-10-251-1/+4
| | | | | | | | | | | Reproducible with: QBackingStore store( &window ); store.beginPaint(QRect(0,0,500,500)); All other methods already have null pointer checks. Change-Id: Ie278a263760900b58cf4a2ef286deb7f35d50cd0 Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Fix compilation: std::min is in <algorithm>Thiago Macieira2012-03-221-0/+1
| | | | | Change-Id: I89227bb9fca0f081a232c2ede10c4d455edb2ee9 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* xcb: Check for SHM extension before using itUli Schlachter2012-01-311-2/+6
| | | | | | | | | | | If we call any xcb_shm_*() function, libxcb will have to figure out SHM's major number. However, if that fails because the SHM extension is not available, xcb will disconnect from the server. Obviously, that's not what we want and must be avoided. Change-Id: I8eba5ff9e84e0e2017a5c0d88fda4efd0459bd1e Signed-off-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* xcb: Obey maximum request length when uploading imagesUli Schlachter2012-01-161-11/+41
| | | | | | | | | | | | | | | | | | | | | When connecting to an X11 server, the server tells the client what its maximum allowed request size is. Larger requests are not permitted. Thus, libxcb verifies that all requests which are sent are smaller than this size limit and possibly kills the connection (without any good error message). Thus, when uploading an image, we could be trying to send more pixel data than fit into a single request. If this would be the case, the code will now use multiple requests where each request only sends a part of the allowed rows. In case all the data fits into a single request, this commit shouldn't change any behavior. Change-Id: I84a4ebfcdb6de7e206015c37e3e33cba3bd309b1 Signed-off-by: Uli Schlachter <psychon@znc.in> Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Remove all non-inline of qMalloc/qFree/qRealloc.Robin Burchell2012-01-061-2/+2
| | | | | | | | | | | | We're trying to deprecate these, so don't use them anymore. The inline uses of these have been left intact, for the moment. Inline code will need to create their own non-inline allocation methods (for future-proofing to allow alterations in how e.g. individual containers allocate) Change-Id: I1071a487c25e95b7bb81a3327b20c5481fb5ed22 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-051-1/+1
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Fixed crashes from tests using xcb plugin with -qtnamespace.Rohan McGovern2011-11-181-0/+3
| | | | | | | | Use QT_BEGIN_NAMESPACE/QT_END_NAMESPACE consistently in xcb plugin. Some, but not all, of the sources were already using QT_BEGIN_NAMESPACE. Change-Id: I23b83cc88870fd4039437b733084ab86dd807356 Reviewed-by: Toby Tomkins <toby.tomkins@nokia.com>
* Create the window when neededLars Knoll2011-09-211-1/+6
| | | | | | | | | | | We need to create the XWindow here to avoid crashes, when resizing the backing store before creating the window. Change-Id: Ib8d9efca3552e5a91f5f63a9262449080ae301e5 Reviewed-on: http://codereview.qt-project.org/5259 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* Make sure to clip in QXcbBackingStore::flush()Samuel Rødal2011-09-191-3/+12
| | | | | | | | | Clip to image and window dimensions to prevent X errors. Change-Id: I7fa581217444e00d6eb83ac356c600f86ae03636 Reviewed-on: http://codereview.qt-project.org/5140 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Holger Ihrig <holger.ihrig@nokia.com>
* Added workable QScreen API on top of QPlatformScreen.Samuel Rødal2011-07-251-2/+3
| | | | | | | | | | | | | | | | | | | | | QPlatformIntegration::screens() no longer has to be implemented, implementations should call QPlatformIntegration::screenAdded() for each screen instead. This is for being able to support adding screens at run-time later on, by connecting it to a signal in QGuiApplication. The QGuiGLContext API has changed a bit, by not sending in all the parameters in the constructor but instead having a create() function. The createPlatformGLContext() factory in QPlatformIntegration takes a QGuiGLContext * instead of a QSurfaceFormat and a share context, similar to how the window and backing store factory functions work. The XCB plugin has experimental support for connecting to multiple X displays simultaneously, creating one or more QScreen for each. Change-Id: I248a22a4fd3481280710110272c04a30a8021e8f Reviewed-on: http://codereview.qt.nokia.com/2103 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
* Handle failed SHM attach in XCB backing store.Samuel Rødal2011-07-211-15/+39
| | | | | | | Change-Id: I5f97c0c6030d13b68cfc17d19ba969cd78f79c3f Reviewed-on: http://codereview.qt.nokia.com/1943 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
* OpenGL API refactor.Samuel Rødal2011-06-211-1/+1
| | | | | | Rename QGuiGLFormat to QSurfaceFormat, and make QWindow sub-class of QSurface and QPlatformWindow sub-class of QPlatformSurface, instead of having QPlatformGLSurface accessor in QWindow.
* Rename QWindowSurface -> QBackingStore and split into platform / public.Samuel Rødal2011-06-211-0/+284
Also get rid of GL window surface and related classes.