diff options
Diffstat (limited to 'src/plugins/platforms/xcb')
10 files changed, 62 insertions, 16 deletions
diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index d42a33c22b..476de6d1e5 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -652,6 +652,12 @@ static const char *qglx_threadedgl_blacklist_renderer[] = { 0 }; +static const char *qglx_threadedgl_blacklist_vendor[] = { + "llvmpipe", // QTCREATORBUG-10666 + "nouveau", // https://bugs.freedesktop.org/show_bug.cgi?id=91632 + nullptr +}; + void QGLXContext::queryDummyContext() { if (m_queriedDummyContext) @@ -710,6 +716,18 @@ void QGLXContext::queryDummyContext() } } } + if (const char *vendor = (const char *) glGetString(GL_VENDOR)) { + for (int i = 0; qglx_threadedgl_blacklist_vendor[i]; ++i) { + if (strstr(vendor, qglx_threadedgl_blacklist_vendor[i]) != 0) { + qCDebug(lcQpaGl).nospace() << "Multithreaded OpenGL disabled: " + "blacklisted vendor \"" + << qglx_threadedgl_blacklist_vendor[i] + << "\""; + m_supportsThreading = false; + break; + } + } + } if (glxvendor && m_supportsThreading) { // Blacklist Mesa drivers due to QTCREATORBUG-10875 (crash in creator), diff --git a/src/plugins/platforms/xcb/nativepainting/qbackingstore_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qbackingstore_x11.cpp index ed482e5dae..bbc156fc53 100644 --- a/src/plugins/platforms/xcb/nativepainting/qbackingstore_x11.cpp +++ b/src/plugins/platforms/xcb/nativepainting/qbackingstore_x11.cpp @@ -192,6 +192,10 @@ bool QXcbNativeBackingStore::scroll(const QRegion &area, int dx, int dy) void QXcbNativeBackingStore::beginPaint(const QRegion ®ion) { + QX11PlatformPixmap *x11pm = qt_x11Pixmap(m_pixmap); + if (x11pm) + x11pm->setIsBackingStore(true); + #if QT_CONFIG(xrender) if (m_translucentBackground) { const QVector<XRectangle> xrects = qt_region_to_xrectangles(region); diff --git a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp index 2688d6e884..3377eeaae9 100644 --- a/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp +++ b/src/plugins/platforms/xcb/nativepainting/qpaintengine_x11.cpp @@ -200,6 +200,7 @@ public: uint has_pattern : 1; uint has_alpha_pen : 1; uint has_alpha_brush : 1; + uint use_sysclip : 1; uint render_hints; const QXcbX11Info *xinfo; @@ -701,6 +702,9 @@ bool QX11PaintEngine::begin(QPaintDevice *pdev) d->xlibMaxLinePoints = 32762; // a safe number used to avoid, call to XMaxRequestSize(d->dpy) - 3; d->opacity = 1; + QX11PlatformPixmap *x11pm = paintDevice()->devType() == QInternal::Pixmap ? qt_x11Pixmap(*static_cast<QPixmap *>(paintDevice())) : nullptr; + d->use_sysclip = paintDevice()->devType() == QInternal::Widget || (x11pm ? x11pm->isBackingStore() : false); + // Set up the polygon clipper. Note: This will only work in // polyline mode as long as we have a buffer zone, since a // polyline may be clipped into several non-connected polylines. @@ -1472,7 +1476,7 @@ void QX11PaintEngine::updatePen(const QPen &pen) } if (!d->has_clipping) { // if clipping is set the paintevent clip region is merged with the clip region - QRegion sysClip = systemClip(); + QRegion sysClip = d->use_sysclip ? systemClip() : QRegion(); if (!sysClip.isEmpty()) x11SetClipRegion(d->dpy, d->gc, 0, d->picture, sysClip); else @@ -1603,7 +1607,7 @@ void QX11PaintEngine::updateBrush(const QBrush &brush, const QPointF &origin) vals.fill_style = s; XChangeGC(d->dpy, d->gc_brush, mask, &vals); if (!d->has_clipping) { - QRegion sysClip = systemClip(); + QRegion sysClip = d->use_sysclip ? systemClip() : QRegion(); if (!sysClip.isEmpty()) x11SetClipRegion(d->dpy, d->gc_brush, 0, d->picture, sysClip); else @@ -2223,7 +2227,7 @@ void QX11PaintEngine::updateMatrix(const QTransform &mtx) void QX11PaintEngine::updateClipRegion_dev(const QRegion &clipRegion, Qt::ClipOperation op) { Q_D(QX11PaintEngine); - QRegion sysClip = systemClip(); + QRegion sysClip = d->use_sysclip ? systemClip() : QRegion(); if (op == Qt::NoClip) { d->has_clipping = false; d->crgn = sysClip; diff --git a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp index 86c87e5e30..b1ce39f363 100644 --- a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp +++ b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11.cpp @@ -1772,6 +1772,20 @@ XID QX11PlatformPixmap::createBitmapFromImage(const QImage &image) return hd; } +bool QX11PlatformPixmap::isBackingStore() const +{ + return (flags & IsBackingStore); +} + +void QX11PlatformPixmap::setIsBackingStore(bool on) +{ + if (on) + flags |= IsBackingStore; + else { + flags &= ~IsBackingStore; + } +} + #if QT_CONFIG(xrender) void QX11PlatformPixmap::convertToARGB32(bool preserveContents) { diff --git a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11_p.h b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11_p.h index 7392cbfccf..9c0ba98300 100644 --- a/src/plugins/platforms/xcb/nativepainting/qpixmap_x11_p.h +++ b/src/plugins/platforms/xcb/nativepainting/qpixmap_x11_p.h @@ -90,6 +90,8 @@ public: void convertToARGB32(bool preserveContents = true); #endif + bool isBackingStore() const; + void setIsBackingStore(bool on); private: friend class QX11PaintEngine; friend const QXcbX11Info &qt_x11Info(const QPixmap &pixmap); @@ -110,7 +112,8 @@ private: Uninitialized = 0x1, Readonly = 0x2, InvertedWhenBoundToTexture = 0x4, - GlSurfaceCreatedWithAlpha = 0x8 + GlSurfaceCreatedWithAlpha = 0x8, + IsBackingStore = 0x10 }; uint flags; diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index e35b97dab4..d27a288feb 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -152,10 +152,9 @@ QXcbConnection::~QXcbConnection() if (m_eventQueue) delete m_eventQueue; - QXcbIntegration *integration = QXcbIntegration::instance(); // Delete screens in reverse order to avoid crash in case of multiple screens while (!m_screens.isEmpty()) - integration->destroyScreen(m_screens.takeLast()); + QWindowSystemInterface::handleScreenRemoved(m_screens.takeLast()); while (!m_virtualDesktops.isEmpty()) delete m_virtualDesktops.takeLast(); diff --git a/src/plugins/platforms/xcb/qxcbconnection_basic.h b/src/plugins/platforms/xcb/qxcbconnection_basic.h index 3691763398..b979129cba 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_basic.h +++ b/src/plugins/platforms/xcb/qxcbconnection_basic.h @@ -40,6 +40,7 @@ #define QXCBBASICCONNECTION_H #include "qxcbatom.h" +#include "qxcbexport.h" #include <QtCore/QPair> #include <QtCore/QObject> @@ -55,7 +56,7 @@ QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(lcQpaXcb) -class QXcbBasicConnection : public QObject +class Q_XCB_EXPORT QXcbBasicConnection : public QObject { Q_OBJECT public: diff --git a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp index 4bafe83156..9ba71ada37 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_screens.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_screens.cpp @@ -44,6 +44,8 @@ #include <QtCore/QString> #include <QtCore/QList> +#include <qpa/qwindowsysteminterface.h> + #include <xcb/xinerama.h> void QXcbConnection::xrandrSelectEvents() @@ -211,7 +213,7 @@ void QXcbConnection::updateScreen(QXcbScreen *screen, const xcb_randr_output_cha m_screens.swapItemsAt(0, idx); } screen->virtualDesktop()->setPrimaryScreen(screen); - QXcbIntegration::instance()->setPrimaryScreen(screen); + QWindowSystemInterface::handlePrimaryScreenChanged(screen); } } } @@ -234,7 +236,7 @@ QXcbScreen *QXcbConnection::createScreen(QXcbVirtualDesktop *virtualDesktop, m_screens.append(screen); } virtualDesktop->addScreen(screen); - QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary()); + QWindowSystemInterface::handleScreenAdded(screen, screen->isPrimary()); return screen; } @@ -261,10 +263,10 @@ void QXcbConnection::destroyScreen(QXcbScreen *screen) const int idx = m_screens.indexOf(newPrimary); if (idx > 0) m_screens.swapItemsAt(0, idx); - QXcbIntegration::instance()->setPrimaryScreen(newPrimary); + QWindowSystemInterface::handlePrimaryScreenChanged(newPrimary); } - QXcbIntegration::instance()->destroyScreen(screen); + QWindowSystemInterface::handleScreenRemoved(screen); } } @@ -406,7 +408,7 @@ void QXcbConnection::initializeScreens() // Push the screens to QGuiApplication for (QXcbScreen *screen : qAsConst(m_screens)) { qCDebug(lcQpaScreen) << "adding" << screen << "(Primary:" << screen->isPrimary() << ")"; - QXcbIntegration::instance()->screenAdded(screen, screen->isPrimary()); + QWindowSystemInterface::handleScreenAdded(screen, screen->isPrimary()); } qCDebug(lcQpaScreen) << "primary output is" << qAsConst(m_screens).first()->name(); diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index f13e232291..571726c354 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -137,8 +137,6 @@ private: QScopedPointer<QPlatformServices> m_services; - friend class QXcbConnection; // access QPlatformIntegration::screenAdded() - mutable QByteArray m_wmClass; const char *m_instanceName; bool m_canGrab; diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 4d526a6bda..899081e752 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -412,12 +412,15 @@ void *QXcbNativeInterface::atspiBus() auto reply = Q_XCB_REPLY(xcb_get_property, defaultConnection->xcb_connection(), false, defaultConnection->rootWindow(), atspiBusAtom, XCB_ATOM_STRING, 0, 128); - Q_ASSERT(!reply->bytes_after); + if (!reply) + return nullptr; + char *data = (char *)xcb_get_property_value(reply.get()); int length = xcb_get_property_value_length(reply.get()); return new QByteArray(data, length); } - return 0; + + return nullptr; } void QXcbNativeInterface::setAppTime(QScreen* screen, xcb_timestamp_t time) |