diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/gui/kernel/qoffscreensurface.cpp qt5base-5.11.2/src/gui/kernel/qoffscreensurface.cpp
--- qt5base-5.11.2-orig/src/gui/kernel/qoffscreensurface.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/gui/kernel/qoffscreensurface.cpp	2020-03-09 11:43:43.024240412 -0400
@@ -193,7 +193,7 @@
 {
     Q_D(QOffscreenSurface);
     if (!d->platformOffscreenSurface && !d->offscreenWindow) {
-        d->platformOffscreenSurface = QGuiApplicationPrivate::platformIntegration()->createPlatformOffscreenSurface(this);
+        d->platformOffscreenSurface = QGuiApplicationPrivate::platformIntegration()->createPlatformOffscreenSurface(this, screen()->handle()->device_index());
         // No platform offscreen surface, fallback to an invisible window
         if (!d->platformOffscreenSurface) {
             if (QThread::currentThread() != qGuiApp->thread())
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/gui/kernel/qopenglcontext.cpp qt5base-5.11.2/src/gui/kernel/qopenglcontext.cpp
--- qt5base-5.11.2-orig/src/gui/kernel/qopenglcontext.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/gui/kernel/qopenglcontext.cpp	2020-03-09 11:33:23.991599271 -0400
@@ -609,7 +609,7 @@
     if (d->platformGLContext)
         destroy();
 
-    d->platformGLContext = QGuiApplicationPrivate::platformIntegration()->createPlatformOpenGLContext(this);
+    d->platformGLContext = QGuiApplicationPrivate::platformIntegration()->createPlatformOpenGLContext(this, screen()->handle()->device_index());
     if (!d->platformGLContext)
         return false;
     d->platformGLContext->initialize();
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/gui/kernel/qplatformintegration.cpp qt5base-5.11.2/src/gui/kernel/qplatformintegration.cpp
--- qt5base-5.11.2-orig/src/gui/kernel/qplatformintegration.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/gui/kernel/qplatformintegration.cpp	2020-03-06 15:27:07.149546398 -0500
@@ -296,7 +296,7 @@
 
     \sa QOpenGLContext
 */
-QPlatformOpenGLContext *QPlatformIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
+QPlatformOpenGLContext *QPlatformIntegration::createPlatformOpenGLContext(QOpenGLContext *context, int i) const
 {
     Q_UNUSED(context);
     qWarning("This plugin does not support createPlatformOpenGLContext!");
@@ -554,7 +554,7 @@
    pixel buffer (pbuffer). If the platform doesn't support offscreen surfaces, an invisible window
    will be used by QOffscreenSurface instead.
 */
-QPlatformOffscreenSurface *QPlatformIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
+QPlatformOffscreenSurface *QPlatformIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface, int i) const
 {
     Q_UNUSED(surface)
     return 0;
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/gui/kernel/qplatformintegration.h qt5base-5.11.2/src/gui/kernel/qplatformintegration.h
--- qt5base-5.11.2-orig/src/gui/kernel/qplatformintegration.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/gui/kernel/qplatformintegration.h	2020-03-06 15:27:31.274520909 -0500
@@ -115,7 +115,7 @@
     virtual QPlatformWindow *createForeignWindow(QWindow *, WId) const { return 0; }
     virtual QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const = 0;
 #ifndef QT_NO_OPENGL
-    virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const;
+    virtual QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context, int i) const;
 #endif
     virtual QPlatformSharedGraphicsCache *createPlatformSharedGraphicsCache(const char *cacheId) const;
     virtual QPaintEngine *createImagePaintEngine(QPaintDevice *paintDevice) const;
@@ -177,7 +177,7 @@
     virtual QStringList themeNames() const;
     virtual QPlatformTheme *createPlatformTheme(const QString &name) const;
 
-    virtual QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const;
+    virtual QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface, int i) const;
 
 #ifndef QT_NO_SESSIONMANAGER
     virtual QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const;
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/gui/kernel/qplatformscreen.cpp qt5base-5.11.2/src/gui/kernel/qplatformscreen.cpp
--- qt5base-5.11.2-orig/src/gui/kernel/qplatformscreen.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/gui/kernel/qplatformscreen.cpp	2020-03-06 16:37:57.980056921 -0500
@@ -588,4 +588,8 @@
     return 0;
 }
 
+int QPlatformScreen::device_index() const
+{
+    return 0;
+}
 QT_END_NAMESPACE
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/gui/kernel/qplatformscreen.h qt5base-5.11.2/src/gui/kernel/qplatformscreen.h
--- qt5base-5.11.2-orig/src/gui/kernel/qplatformscreen.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/gui/kernel/qplatformscreen.h	2020-03-06 16:37:03.152113497 -0500
@@ -151,6 +151,8 @@
     virtual int currentMode() const;
     virtual int preferredMode() const;
 
+    virtual int device_index() const;
+
     static int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b);
     static QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target);
     static QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect);
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/platformsupport/eglconvenience/qeglplatformcontext.cpp qt5base-5.11.2/src/platformsupport/eglconvenience/qeglplatformcontext.cpp
--- qt5base-5.11.2-orig/src/platformsupport/eglconvenience/qeglplatformcontext.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/platformsupport/eglconvenience/qeglplatformcontext.cpp	2020-03-09 10:37:01.101373584 -0400
@@ -268,7 +268,7 @@
 
 // Base implementation for pbuffers. Subclasses will handle the specialized cases for
 // platforms without pbuffers.
-EGLSurface QEGLPlatformContext::createTemporaryOffscreenSurface()
+EGLSurface QEGLPlatformContext::createTemporaryOffscreenSurface(int i)
 {
     // Make the context current to ensure the GL version query works. This needs a surface too.
     const EGLint pbufferAttributes[] = {
@@ -315,7 +315,7 @@
     EGLSurface tempSurface = EGL_NO_SURFACE;
     EGLContext tempContext = EGL_NO_CONTEXT;
     if (m_flags.testFlag(NoSurfaceless) || !q_hasEglExtension(m_eglDisplay, "EGL_KHR_surfaceless_context"))
-        tempSurface = createTemporaryOffscreenSurface();
+        tempSurface = createTemporaryOffscreenSurface(0);
 
     EGLBoolean ok = eglMakeCurrent(m_eglDisplay, tempSurface, tempSurface, m_eglContext);
     if (!ok) {
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/platformsupport/eglconvenience/qeglplatformcontext_p.h qt5base-5.11.2/src/platformsupport/eglconvenience/qeglplatformcontext_p.h
--- qt5base-5.11.2-orig/src/platformsupport/eglconvenience/qeglplatformcontext_p.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/platformsupport/eglconvenience/qeglplatformcontext_p.h	2020-03-06 15:17:23.856162662 -0500
@@ -88,7 +88,7 @@
 
 protected:
     virtual EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) = 0;
-    virtual EGLSurface createTemporaryOffscreenSurface();
+    virtual EGLSurface createTemporaryOffscreenSurface(int i);
     virtual void destroyTemporaryOffscreenSurface(EGLSurface surface);
     virtual void runGLChecks();
 
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/platformsupport/kmsconvenience/qkmsdevice.cpp qt5base-5.11.2/src/platformsupport/kmsconvenience/qkmsdevice.cpp
--- qt5base-5.11.2-orig/src/platformsupport/kmsconvenience/qkmsdevice.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/platformsupport/kmsconvenience/qkmsdevice.cpp	2020-03-06 14:18:05.245883693 -0500
@@ -164,7 +164,7 @@
 
 QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
                                                       drmModeConnectorPtr connector,
-                                                      ScreenInfo *vinfo)
+                                                      ScreenInfo *vinfo, int i)
 {
     Q_ASSERT(vinfo);
     const QByteArray connectorName = nameForConnector(connector);
@@ -424,7 +424,7 @@
 
     vinfo->output = output;
 
-    return createScreen(output);
+    return createScreen(output, i);
 }
 
 drmModePropertyPtr QKmsDevice::connectorProperty(drmModeConnectorPtr connector, const QByteArray &name)
@@ -480,15 +480,6 @@
 {
 }
 
-struct OrderedScreen
-{
-    OrderedScreen() : screen(nullptr) { }
-    OrderedScreen(QPlatformScreen *screen, const QKmsDevice::ScreenInfo &vinfo)
-        : screen(screen), vinfo(vinfo) { }
-    QPlatformScreen *screen;
-    QKmsDevice::ScreenInfo vinfo;
-};
-
 QDebug operator<<(QDebug dbg, const OrderedScreen &s)
 {
     QDebugStateSaver saver(dbg);
@@ -505,7 +496,7 @@
     return a.vinfo.virtualIndex < b.vinfo.virtualIndex;
 }
 
-void QKmsDevice::createScreens()
+void QKmsDevice::createScreens(int ii, QVector<OrderedScreen> &screens)
 {
     // Headless mode using a render node: cannot do any output related DRM
     // stuff. Skip it all and register a dummy screen.
@@ -530,8 +521,6 @@
 
     discoverPlanes();
 
-    QVector<OrderedScreen> screens;
-
     int wantedConnectorIndex = -1;
     bool ok;
     int idx = qEnvironmentVariableIntValue("QT_QPA_EGLFS_KMS_CONNECTOR_INDEX", &ok);
@@ -551,7 +540,7 @@
             continue;
 
         ScreenInfo vinfo;
-        QPlatformScreen *screen = createScreenForConnector(resources, connector, &vinfo);
+        QPlatformScreen *screen = createScreenForConnector(resources, connector, &vinfo, ii);
         if (screen)
             screens.append(OrderedScreen(screen, vinfo));
 
@@ -559,6 +548,11 @@
     }
 
     drmModeFreeResources(resources);
+}
+
+void QKmsDevice::arrangeScreens(QVector<OrderedScreen> &screens)
+{
+    QPoint pos(0, 0);
 
     // Use stable sort to preserve the original (DRM connector) order
     // for outputs with unspecified indices.
@@ -591,7 +585,6 @@
     }
 
     // Figure out the virtual desktop and register the screens to QPA/QGuiApplication.
-    QPoint pos(0, 0);
     QList<QPlatformScreen *> siblings;
     QVector<QPoint> virtualPositions;
     int primarySiblingIdx = -1;
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/platformsupport/kmsconvenience/qkmsdevice_p.h qt5base-5.11.2/src/platformsupport/kmsconvenience/qkmsdevice_p.h
--- qt5base-5.11.2-orig/src/platformsupport/kmsconvenience/qkmsdevice_p.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/platformsupport/kmsconvenience/qkmsdevice_p.h	2020-03-06 14:17:11.148933255 -0500
@@ -198,16 +198,25 @@
     void setPowerState(QKmsDevice *device, QPlatformScreen::PowerState state);
 };
 
+struct ScreenInfo {
+    int virtualIndex = 0;
+    QPoint virtualPos;
+    bool isPrimary = false;
+    QKmsOutput output;
+};
+
+struct OrderedScreen
+{
+    OrderedScreen() : screen(nullptr) { }
+    OrderedScreen(QPlatformScreen *screen, const ScreenInfo &vinfo)
+        : screen(screen), vinfo(vinfo) { }
+    QPlatformScreen *screen;
+    ScreenInfo vinfo;
+};
+
 class QKmsDevice
 {
 public:
-    struct ScreenInfo {
-        int virtualIndex = 0;
-        QPoint virtualPos;
-        bool isPrimary = false;
-        QKmsOutput output;
-    };
-
     QKmsDevice(QKmsScreenConfig *screenConfig, const QString &path = QString());
     virtual ~QKmsDevice();
 
@@ -215,7 +224,8 @@
     virtual void close() = 0;
     virtual void *nativeDisplay() const = 0;
 
-    void createScreens();
+    void createScreens(int ii, QVector<OrderedScreen> &screens);
+    void arrangeScreens(QVector<OrderedScreen> &screens);
 
     int fd() const;
     QString devicePath() const;
@@ -223,7 +233,7 @@
     QKmsScreenConfig *screenConfig() const;
 
 protected:
-    virtual QPlatformScreen *createScreen(const QKmsOutput &output) = 0;
+    virtual QPlatformScreen *createScreen(const QKmsOutput &output, int i) = 0;
     virtual QPlatformScreen *createHeadlessScreen();
     virtual void registerScreenCloning(QPlatformScreen *screen,
                                        QPlatformScreen *screenThisScreenClones,
@@ -237,7 +247,7 @@
     int crtcForConnector(drmModeResPtr resources, drmModeConnectorPtr connector);
     QPlatformScreen *createScreenForConnector(drmModeResPtr resources,
                                               drmModeConnectorPtr connector,
-                                              ScreenInfo *vinfo);
+                                              ScreenInfo *vinfo, int i);
     drmModePropertyPtr connectorProperty(drmModeConnectorPtr connector, const QByteArray &name);
     drmModePropertyBlobPtr connectorPropertyBlob(drmModeConnectorPtr connector, const QByteArray &name);
     typedef std::function<void(drmModePropertyPtr, quint64)> PropCallback;
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp qt5base-5.11.2/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp
--- qt5base-5.11.2-orig/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/platformsupport/platformcompositor/qopenglcompositorbackingstore.cpp	2020-03-09 16:59:36.519533890 -0400
@@ -83,6 +83,7 @@
       m_textures(new QPlatformTextureList),
       m_lockedWidgetTextures(0)
 {
+    m_target = QOpenGLCompositor::instance()->indexOf(window);
 }
 
 QOpenGLCompositorBackingStore::~QOpenGLCompositorBackingStore()
@@ -94,7 +95,7 @@
         // windows with regular widgets only.
         QScopedPointer<QOffscreenSurface> tempSurface;
         if (!ctx) {
-            ctx = QOpenGLCompositor::instance()->context();
+            ctx = QOpenGLCompositor::instance()->context(m_target);
             tempSurface.reset(new QOffscreenSurface);
             tempSurface->setFormat(ctx->format());
             tempSurface->create();
@@ -186,10 +187,10 @@
     Q_UNUSED(offset);
 
     QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
-    QOpenGLContext *dstCtx = compositor->context();
+    QOpenGLContext *dstCtx = compositor->context(m_target);
     Q_ASSERT(dstCtx);
 
-    QWindow *dstWin = compositor->targetWindow();
+    QWindow *dstWin = compositor->targetWindow(m_target);
     if (!dstWin)
         return;
 
@@ -212,14 +213,14 @@
     Q_UNUSED(translucentBackground);
 
     QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
-    QOpenGLContext *dstCtx = compositor->context();
+    QOpenGLContext *dstCtx = compositor->context(m_target);
     Q_ASSERT(dstCtx); // setTarget() must have been called before, e.g. from QEGLFSWindow
 
     // The compositor's context and the context to which QOpenGLWidget/QQuickWidget
     // textures belong are not the same. They share resources, though.
     Q_ASSERT(qt_window_private(window)->shareContext()->shareGroup() == dstCtx->shareGroup());
 
-    QWindow *dstWin = compositor->targetWindow();
+    QWindow *dstWin = compositor->targetWindow(m_target);
     if (!dstWin)
         return;
 
@@ -267,8 +268,8 @@
     Q_UNUSED(staticContents);
 
     QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
-    QOpenGLContext *dstCtx = compositor->context();
-    QWindow *dstWin = compositor->targetWindow();
+    QOpenGLContext *dstCtx = compositor->context(m_target);
+    QWindow *dstWin = compositor->targetWindow(m_target);
     if (!dstWin)
         return;
 
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h qt5base-5.11.2/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h
--- qt5base-5.11.2-orig/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h	2020-03-09 16:43:56.875516985 -0400
@@ -92,6 +92,7 @@
     QOpenGLContext *m_bsTextureContext;
     QPlatformTextureList *m_textures;
     QPlatformTextureList *m_lockedWidgetTextures;
+    int m_target;
 };
 
 QT_END_NAMESPACE
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/platformsupport/platformcompositor/qopenglcompositor.cpp qt5base-5.11.2/src/platformsupport/platformcompositor/qopenglcompositor.cpp
--- qt5base-5.11.2-orig/src/platformsupport/platformcompositor/qopenglcompositor.cpp	2020-03-06 09:29:23.602285153 -0500
+++ qt5base-5.11.2/src/platformsupport/platformcompositor/qopenglcompositor.cpp	2020-03-10 09:43:06.601162659 -0400
@@ -86,7 +86,6 @@
 QOpenGLCompositor::~QOpenGLCompositor()
 {
     Q_ASSERT(compositor == this);
-    m_blitter.destroy();
     compositor = 0;
 }
 
@@ -141,10 +140,10 @@
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
     glViewport(0, 0, t->m_nativeTargetGeometry.width(), t->m_nativeTargetGeometry.height());
 
-    if (!m_blitter.isCreated())
-        m_blitter.create();
+    if (!t->m_blitter.isCreated())
+        t->m_blitter.create();
 
-    m_blitter.bind();
+    t->m_blitter.bind();
 
     for (int i = 0; i < m_windows.size(); ++i)
         m_windows.at(i)->beginCompositing();
@@ -152,7 +151,7 @@
     for (int i = 0; i < m_windows.size(); ++i)
         render(m_windows.at(i), t);
 
-    m_blitter.release();
+    t->m_blitter.release();
     if (!fbo)
         t->m_context->swapBuffers(t->m_targetWindow);
     else
@@ -227,7 +226,7 @@
         const float opacity = window->sourceWindow()->opacity();
         if (opacity != currentOpacity) {
             currentOpacity = opacity;
-            m_blitter.setOpacity(currentOpacity);
+            t->m_blitter.setOpacity(currentOpacity);
         }
 
         if (textures->count() > 1 && i == textures->count() - 1) {
@@ -236,7 +235,7 @@
             QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i), targetWindowRect);
             if (t->m_rotation)
                 target = t->m_rotationMatrix * target;
-            m_blitter.blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
+            t->m_blitter.blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
         } else if (textures->count() == 1) {
             // A regular QWidget window
             const bool translucent = window->sourceWindow()->requestedFormat().alphaBufferSize() > 0;
@@ -244,22 +243,22 @@
             QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i), targetWindowRect);
             if (t->m_rotation)
                 target = t->m_rotationMatrix * target;
-            m_blitter.blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
+            t->m_blitter.blit(textureId, target, QOpenGLTextureBlitter::OriginTopLeft);
         } else if (!textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) {
             // Texture from an FBO belonging to a QOpenGLWidget
             blend.set(false);
-            clippedBlit(textures, i, targetWindowRect, &m_blitter, t->m_rotation ? &t->m_rotationMatrix : nullptr);
+            clippedBlit(textures, i, targetWindowRect, &t->m_blitter, t->m_rotation ? &t->m_rotationMatrix : nullptr);
         }
     }
 
     for (int i = 0; i < textures->count(); ++i) {
         if (textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) {
             blend.set(true);
-            clippedBlit(textures, i, targetWindowRect, &m_blitter, t->m_rotation ? &t->m_rotationMatrix : nullptr);
+            clippedBlit(textures, i, targetWindowRect, &t->m_blitter, t->m_rotation ? &t->m_rotationMatrix : nullptr);
         }
     }
 
-    m_blitter.setOpacity(1.0f);
+    t->m_blitter.setOpacity(1.0f);
 }
 
 QOpenGLCompositor *QOpenGLCompositor::instance()
@@ -307,4 +306,15 @@
     }
 }
 
+int QOpenGLCompositor::indexOf(QWindow *window)
+{
+    for (int i = 0; i < m_targets.size(); i++) {
+        if (m_targets[i]->m_targetWindow == window) {
+		return i;
+	}
+    }
+
+    return 0;
+}
+
 QT_END_NAMESPACE
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/platformsupport/platformcompositor/qopenglcompositor_p.h qt5base-5.11.2/src/platformsupport/platformcompositor/qopenglcompositor_p.h
--- qt5base-5.11.2-orig/src/platformsupport/platformcompositor/qopenglcompositor_p.h	2020-03-06 09:29:23.602285153 -0500
+++ qt5base-5.11.2/src/platformsupport/platformcompositor/qopenglcompositor_p.h	2020-03-09 17:00:02.098479998 -0400
@@ -66,12 +66,14 @@
 {
 public:
     QOpenGLCompositorTarget() : m_context(0), m_targetWindow(0), m_rotation(0) { }
+    ~QOpenGLCompositorTarget() { m_blitter.destroy(); }
 
     QOpenGLContext *m_context;
     QWindow *m_targetWindow;
     QRect m_nativeTargetGeometry;
     int m_rotation;
     QMatrix4x4 m_rotationMatrix;
+    QOpenGLTextureBlitter m_blitter;
 };
 
 class QOpenGLCompositorWindow
@@ -94,8 +96,8 @@
 
     void addTarget(QOpenGLContext *context, QWindow *window,
         const QRect &nativeTargetGeometry, int degrees);
-    QOpenGLContext *context() const { return m_targets.isEmpty() ? 0 : m_targets[0]->m_context; }
-    QWindow *targetWindow() const { return m_targets.isEmpty() ? 0 : m_targets[0]->m_targetWindow; }
+    QOpenGLContext *context(int i) const { return ((i >= 0) && (i < m_targets.size())) ? m_targets[i]->m_context : 0; }
+    QWindow *targetWindow(int i) const { return ((i >= 0) && (i < m_targets.size())) ? m_targets[i]->m_targetWindow : 0; }
 
     void update();
     QImage grab();
@@ -106,6 +108,8 @@
     void moveToTop(QOpenGLCompositorWindow *window);
     void changeWindowIndex(QOpenGLCompositorWindow *window, int newIdx);
 
+    int indexOf(QWindow *window);
+
 signals:
     void topWindowChanged(QOpenGLCompositorWindow *window);
 
@@ -121,7 +125,6 @@
 
     QList<QOpenGLCompositorTarget *> m_targets;
     QTimer m_updateTimer;
-    QOpenGLTextureBlitter m_blitter;
     QList<QOpenGLCompositorWindow *> m_windows;
 };
 
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfscontext.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfscontext.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfscontext.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfscontext.cpp	2020-03-09 10:40:36.004828201 -0400
@@ -65,13 +65,13 @@
         return static_cast<QEGLPbuffer *>(surface)->pbuffer();
 }
 
-EGLSurface QEglFSContext::createTemporaryOffscreenSurface()
+EGLSurface QEglFSContext::createTemporaryOffscreenSurface(int i)
 {
     if (qt_egl_device_integration()->supportsPBuffers())
-        return QEGLPlatformContext::createTemporaryOffscreenSurface();
+        return QEGLPlatformContext::createTemporaryOffscreenSurface(i);
 
     if (!m_tempWindow) {
-        m_tempWindow = qt_egl_device_integration()->createNativeOffscreenWindow(format());
+        m_tempWindow = qt_egl_device_integration()->createNativeOffscreenWindow(format(), i);
         if (!m_tempWindow) {
             qWarning("QEglFSContext: Failed to create temporary native window");
             return EGL_NO_SURFACE;
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfscontext_p.h qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfscontext_p.h
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfscontext_p.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfscontext_p.h	2020-03-06 15:09:04.492689888 -0500
@@ -64,7 +64,7 @@
     QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display,
                   EGLConfig *config, const QVariant &nativeHandle);
     EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override;
-    EGLSurface createTemporaryOffscreenSurface() override;
+    EGLSurface createTemporaryOffscreenSurface(int i) override;
     void destroyTemporaryOffscreenSurface(EGLSurface surface) override;
     void runGLChecks() override;
     void swapBuffers(QPlatformSurface *surface) override;
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp	2020-03-06 12:06:03.924053071 -0500
@@ -149,7 +149,7 @@
     return fbIndex;
 }
 
-void QEglFSDeviceIntegration::platformInit()
+int QEglFSDeviceIntegration::platformInit()
 {
 #ifdef Q_OS_LINUX
     QByteArray fbDev = fbDeviceName();
@@ -165,6 +165,7 @@
     ioctl(framebuffer, FBIOBLANK, VESA_NO_BLANKING);
 #endif
 #endif
+    return 0;
 }
 
 void QEglFSDeviceIntegration::platformDestroy()
@@ -175,7 +176,7 @@
 #endif
 }
 
-EGLNativeDisplayType QEglFSDeviceIntegration::platformDisplay() const
+EGLNativeDisplayType QEglFSDeviceIntegration::platformDisplay(int i) const
 {
     return EGL_DEFAULT_DISPLAY;
 }
@@ -295,7 +296,7 @@
     return 0;
 }
 
-EGLNativeWindowType QEglFSDeviceIntegration::createNativeOffscreenWindow(const QSurfaceFormat &format)
+EGLNativeWindowType QEglFSDeviceIntegration::createNativeOffscreenWindow(const QSurfaceFormat &format, int i)
 {
     Q_UNUSED(format);
     return 0;
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h	2020-03-06 12:05:50.021065297 -0500
@@ -70,9 +70,9 @@
 public:
     virtual ~QEglFSDeviceIntegration() { }
 
-    virtual void platformInit();
+    virtual int platformInit();
     virtual void platformDestroy();
-    virtual EGLNativeDisplayType platformDisplay() const;
+    virtual EGLNativeDisplayType platformDisplay(int i) const;
     virtual EGLDisplay createDisplay(EGLNativeDisplayType nativeDisplay);
     virtual bool usesDefaultScreen();
     virtual void screenInit();
@@ -92,7 +92,7 @@
     virtual EGLNativeWindowType createNativeWindow(QPlatformWindow *platformWindow,
                                                    const QSize &size,
                                                    const QSurfaceFormat &format);
-    virtual EGLNativeWindowType createNativeOffscreenWindow(const QSurfaceFormat &format);
+    virtual EGLNativeWindowType createNativeOffscreenWindow(const QSurfaceFormat &format, int i);
     virtual void destroyNativeWindow(EGLNativeWindowType window);
     virtual bool hasCapability(QPlatformIntegration::Capability cap) const;
     virtual QPlatformCursor *createCursor(QPlatformScreen *screen) const;
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp	2020-03-09 16:24:58.419919803 -0400
@@ -108,8 +108,7 @@
 QT_BEGIN_NAMESPACE
 
 QEglFSIntegration::QEglFSIntegration()
-    : m_display(EGL_NO_DISPLAY),
-      m_inputContext(0),
+    : m_inputContext(0),
       m_fontDb(new QGenericUnixFontDatabase),
       m_services(new QGenericUnixServices),
       m_kbdMgr(0),
@@ -132,22 +131,26 @@
 
 void QEglFSIntegration::initialize()
 {
-    qt_egl_device_integration()->platformInit();
+    int c = qt_egl_device_integration()->platformInit();
 
-    m_display = qt_egl_device_integration()->createDisplay(nativeDisplay());
-    if (Q_UNLIKELY(m_display == EGL_NO_DISPLAY))
-        qFatal("Could not open egl display");
-
-    EGLint major, minor;
-    if (Q_UNLIKELY(!eglInitialize(m_display, &major, &minor)))
-        qFatal("Could not initialize egl display");
+    for (int i = 0; i < c; i++) {
+        EGLDisplay d = qt_egl_device_integration()->createDisplay(nativeDisplay(i));
+        if (Q_UNLIKELY(d == EGL_NO_DISPLAY))
+            qFatal("Could not open egl display");
+
+        EGLint major, minor;
+        if (Q_UNLIKELY(!eglInitialize(d, &major, &minor)))
+            qFatal("Could not initialize egl display");
+
+        m_displays.append(d);
+    }
 
     m_inputContext = QPlatformInputContextFactory::create();
 
     m_vtHandler.reset(new QFbVtHandler);
 
     if (qt_egl_device_integration()->usesDefaultScreen())
-        addScreen(new QEglFSScreen(display()));
+        addScreen(new QEglFSScreen(display(0), 0));
     else
         qt_egl_device_integration()->screenInit();
 
@@ -163,8 +166,9 @@
 
     qt_egl_device_integration()->screenDestroy();
 
-    if (m_display != EGL_NO_DISPLAY)
-        eglTerminate(m_display);
+    foreach (EGLDisplay d, m_displays) {
+        eglTerminate(d);
+    }
 
     qt_egl_device_integration()->platformDestroy();
 }
@@ -216,9 +220,9 @@
 }
 
 #ifndef QT_NO_OPENGL
-QPlatformOpenGLContext *QEglFSIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
+QPlatformOpenGLContext *QEglFSIntegration::createPlatformOpenGLContext(QOpenGLContext *context, int i) const
 {
-    EGLDisplay dpy = context->screen() ? static_cast<QEglFSScreen *>(context->screen()->handle())->display() : display();
+    EGLDisplay dpy = context->screen() ? static_cast<QEglFSScreen *>(context->screen()->handle())->display() : display(i);
     QPlatformOpenGLContext *share = context->shareHandle();
     QVariant nativeHandle = context->nativeHandle();
 
@@ -236,9 +240,9 @@
     return ctx;
 }
 
-QPlatformOffscreenSurface *QEglFSIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const
+QPlatformOffscreenSurface *QEglFSIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface, int i) const
 {
-    EGLDisplay dpy = surface->screen() ? static_cast<QEglFSScreen *>(surface->screen()->handle())->display() : display();
+    EGLDisplay dpy = surface->screen() ? static_cast<QEglFSScreen *>(surface->screen()->handle())->display() : display(i);
     QSurfaceFormat fmt = qt_egl_device_integration()->surfaceFormatFor(surface->requestedFormat());
     if (qt_egl_device_integration()->supportsPBuffers()) {
         QEGLPlatformContext::Flags flags = 0;
@@ -246,7 +250,7 @@
             flags |= QEGLPlatformContext::NoSurfaceless;
         return new QEGLPbuffer(dpy, fmt, surface, flags);
     } else {
-        return new QEglFSOffscreenWindow(dpy, fmt, surface);
+        return new QEglFSOffscreenWindow(dpy, fmt, surface, i);
     }
     // Never return null. Multiple QWindows are not supported by this plugin.
 }
@@ -315,10 +319,10 @@
 
     switch (resourceType(resource)) {
     case EglDisplay:
-        result = display();
+        result = display(0);
         break;
     case NativeDisplay:
-        result = reinterpret_cast<void*>(nativeDisplay());
+        result = reinterpret_cast<void*>(nativeDisplay(0));
         break;
     case WaylandDisplay:
         result = qt_egl_device_integration()->wlDisplay();
@@ -339,7 +343,7 @@
     case XlibDisplay:
         // Play nice when using the x11 hooks: Be compatible with xcb that allows querying
         // the X Display pointer, which is nothing but our native display.
-        result = reinterpret_cast<void*>(nativeDisplay());
+        result = reinterpret_cast<void*>(nativeDisplay(0));
         break;
     default:
         result = qt_egl_device_integration()->nativeResourceForScreen(resource, screen);
@@ -358,7 +362,7 @@
         if (window && window->handle())
             result = static_cast<QEglFSScreen *>(window->handle()->screen())->display();
         else
-            result = display();
+            result = display(0);
         break;
     case EglWindow:
         if (window && window->handle())
@@ -476,9 +480,9 @@
 #endif
 }
 
-EGLNativeDisplayType QEglFSIntegration::nativeDisplay() const
+EGLNativeDisplayType QEglFSIntegration::nativeDisplay(int i) const
 {
-    return qt_egl_device_integration()->platformDisplay();
+    return qt_egl_device_integration()->platformDisplay(i);
 }
 
 QT_END_NAMESPACE
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h	2020-03-06 15:11:19.973546833 -0500
@@ -72,7 +72,7 @@
     void initialize() override;
     void destroy() override;
 
-    EGLDisplay display() const { return m_display; }
+    EGLDisplay display(int i) const { return m_displays[i]; }
 
     QAbstractEventDispatcher *createEventDispatcher() const override;
     QPlatformFontDatabase *fontDatabase() const override;
@@ -83,8 +83,8 @@
     QPlatformWindow *createPlatformWindow(QWindow *window) const override;
     QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
 #ifndef QT_NO_OPENGL
-    QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
-    QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override;
+    QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context, int i) const override;
+    QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface, int i) const override;
 #endif
     bool hasCapability(QPlatformIntegration::Capability cap) const override;
 
@@ -107,11 +107,11 @@
     void removeScreen(QPlatformScreen *screen);
 
 private:
-    EGLNativeDisplayType nativeDisplay() const;
+    EGLNativeDisplayType nativeDisplay(int i) const;
     void createInputHandlers();
     static void loadKeymapStatic(const QString &filename);
 
-    EGLDisplay m_display;
+    QList<EGLDisplay> m_displays;
     QPlatformInputContext *m_inputContext;
     QScopedPointer<QPlatformFontDatabase> m_fontDb;
     QScopedPointer<QPlatformServices> m_services;
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp	2020-03-06 15:15:44.662267412 -0500
@@ -54,14 +54,14 @@
     This class requires the hooks to implement createNativeOffscreenWindow().
 */
 
-QEglFSOffscreenWindow::QEglFSOffscreenWindow(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface)
+QEglFSOffscreenWindow::QEglFSOffscreenWindow(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface, int i)
     : QPlatformOffscreenSurface(offscreenSurface)
     , m_format(format)
     , m_display(display)
     , m_surface(EGL_NO_SURFACE)
     , m_window(0)
 {
-    m_window = qt_egl_device_integration()->createNativeOffscreenWindow(format);
+    m_window = qt_egl_device_integration()->createNativeOffscreenWindow(format, i);
     if (!m_window) {
         qWarning("QEglFSOffscreenWindow: Failed to create native window");
         return;
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h	2020-03-06 15:15:59.332251926 -0500
@@ -59,7 +59,7 @@
 class Q_EGLFS_EXPORT QEglFSOffscreenWindow : public QPlatformOffscreenSurface
 {
 public:
-    QEglFSOffscreenWindow(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface);
+    QEglFSOffscreenWindow(EGLDisplay display, const QSurfaceFormat &format, QOffscreenSurface *offscreenSurface, int i);
     ~QEglFSOffscreenWindow();
 
     QSurfaceFormat format() const override { return m_format; }
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp	2020-03-09 10:45:06.597252126 -0400
@@ -51,7 +51,7 @@
 
 QT_BEGIN_NAMESPACE
 
-QEglFSScreen::QEglFSScreen(EGLDisplay dpy)
+QEglFSScreen::QEglFSScreen(EGLDisplay dpy, int i)
     : m_dpy(dpy),
       m_surface(EGL_NO_SURFACE),
       m_cursor(0)
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h	2020-03-09 10:41:24.690724133 -0400
@@ -64,7 +64,7 @@
 class Q_EGLFS_EXPORT QEglFSScreen : public QPlatformScreen
 {
 public:
-    QEglFSScreen(EGLDisplay display);
+    QEglFSScreen(EGLDisplay display, int i);
     ~QEglFSScreen();
 
     QRect geometry() const override;
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfswindow.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfswindow.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/api/qeglfswindow.cpp	2020-03-06 09:29:23.603285153 -0500
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/api/qeglfswindow.cpp	2020-03-09 16:23:29.879098347 -0400
@@ -116,7 +116,7 @@
 #ifndef QT_NO_OPENGL
     QOpenGLCompositor *compositor = QOpenGLCompositor::instance();
     if (screen->primarySurface() != EGL_NO_SURFACE) {
-        if (Q_UNLIKELY(!isRaster() || !compositor->targetWindow())) {
+        if (Q_UNLIKELY(!isRaster() || !compositor->targetWindow(screen->device_index()))) {
 #if !defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_EMBEDDED)
             // We can have either a single OpenGL window or multiple raster windows.
             // Other combinations cannot work.
@@ -124,7 +124,7 @@
 #endif
             return;
         }
-        m_format = compositor->targetWindow()->format();
+        m_format = compositor->targetWindow(screen->device_index())->format();
         return;
     }
 #endif // QT_NO_OPENGL
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.cpp	2020-03-06 11:36:10.737760040 -0500
@@ -64,8 +64,9 @@
     setDisplay = reinterpret_cast<PFNQGSSETDISPLAYPROC>(eglGetProcAddress("qgsSetDisplay"));
 }
 
-void QEglFSEmulatorIntegration::platformInit()
+int QEglFSEmulatorIntegration::platformInit()
 {
+	return 0;
 }
 
 void QEglFSEmulatorIntegration::platformDestroy()
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.h qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.h
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.h	2020-03-06 11:35:51.695777782 -0500
@@ -57,7 +57,7 @@
 public:
     QEglFSEmulatorIntegration();
 
-    void platformInit() override;
+    int platformInit() override;
     void platformDestroy() override;
     bool usesDefaultScreen() override;
     void screenInit() override;
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp	2020-03-09 10:50:10.827563862 -0400
@@ -42,7 +42,7 @@
 QT_BEGIN_NAMESPACE
 
 QEglFSEmulatorScreen::QEglFSEmulatorScreen(const QJsonObject &screenDescription)
-    : QEglFSScreen(eglGetDisplay(EGL_DEFAULT_DISPLAY))
+    : QEglFSScreen(eglGetDisplay(EGL_DEFAULT_DISPLAY), 0)
     , m_id(0)
 {
     initFromJsonObject(screenDescription);
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp	2020-03-06 12:12:15.694711725 -0500
@@ -127,9 +127,9 @@
     }
 }
 
-QPlatformScreen *QEglFSKmsGbmDevice::createScreen(const QKmsOutput &output)
+QPlatformScreen *QEglFSKmsGbmDevice::createScreen(const QKmsOutput &output, int i)
 {
-    QEglFSKmsGbmScreen *screen = new QEglFSKmsGbmScreen(this, output, false);
+    QEglFSKmsGbmScreen *screen = new QEglFSKmsGbmScreen(this, i, output, false);
 
     if (!m_globalCursor && screenConfig()->hwCursor()) {
         qCDebug(qLcEglfsKmsDebug, "Creating new global GBM mouse cursor");
@@ -141,7 +141,7 @@
 
 QPlatformScreen *QEglFSKmsGbmDevice::createHeadlessScreen()
 {
-    return new QEglFSKmsGbmScreen(this, QKmsOutput(), true);
+    return new QEglFSKmsGbmScreen(this, 0, QKmsOutput(), true);
 }
 
 void QEglFSKmsGbmDevice::registerScreenCloning(QPlatformScreen *screen,
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h	2020-03-06 12:12:29.068699257 -0500
@@ -65,7 +65,7 @@
     QPlatformCursor *globalCursor() const;
     void destroyGlobalCursor();
 
-    QPlatformScreen *createScreen(const QKmsOutput &output) override;
+    QPlatformScreen *createScreen(const QKmsOutput &output, int i) override;
     QPlatformScreen *createHeadlessScreen() override;
     void registerScreenCloning(QPlatformScreen *screen,
                                QPlatformScreen *screenThisScreenClones,
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp	2020-03-06 12:09:37.416859284 -0500
@@ -92,12 +92,12 @@
     return display;
 }
 
-EGLNativeWindowType QEglFSKmsGbmIntegration::createNativeOffscreenWindow(const QSurfaceFormat &format)
+EGLNativeWindowType QEglFSKmsGbmIntegration::createNativeOffscreenWindow(const QSurfaceFormat &format, int i)
 {
     Q_UNUSED(format);
-    Q_ASSERT(device());
+    Q_ASSERT(device(i));
 
-    gbm_surface *surface = gbm_surface_create(static_cast<QEglFSKmsGbmDevice *>(device())->gbmDevice(),
+    gbm_surface *surface = gbm_surface_create(static_cast<QEglFSKmsGbmDevice *>(device(i))->gbmDevice(),
                                               1, 1,
                                               GBM_FORMAT_XRGB8888,
                                               GBM_BO_USE_RENDERING);
@@ -129,11 +129,15 @@
     screen->flip();
 }
 
-QKmsDevice *QEglFSKmsGbmIntegration::createDevice()
+QKmsDevice *QEglFSKmsGbmIntegration::createDevice(const QString &path)
 {
-    QString path = screenConfig()->devicePath();
-    if (!path.isEmpty()) {
-        qCDebug(qLcEglfsKmsDebug) << "GBM: Using DRM device" << path << "specified in config file";
+    QString path2 = path;
+
+    if (path2.isEmpty()) {
+        path2 = screenConfig()->devicePath();
+    }
+    if (!path2.isEmpty()) {
+        qCDebug(qLcEglfsKmsDebug) << "GBM: Using DRM device" << path2 << "specified in config file";
     } else {
         QDeviceDiscovery *d = QDeviceDiscovery::create(QDeviceDiscovery::Device_VideoMask);
         const QStringList devices = d->scanConnectedDevices();
@@ -143,11 +147,11 @@
         if (Q_UNLIKELY(devices.isEmpty()))
             qFatal("Could not find DRM device!");
 
-        path = devices.first();
-        qCDebug(qLcEglfsKmsDebug) << "Using" << path;
+        path2 = devices.first();
+        qCDebug(qLcEglfsKmsDebug) << "Using" << path2;
     }
 
-    return new QEglFSKmsGbmDevice(screenConfig(), path);
+    return new QEglFSKmsGbmDevice(screenConfig(), path2);
 }
 
 QEglFSWindow *QEglFSKmsGbmIntegration::createWindow(QWindow *window) const
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.h qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.h
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.h	2020-03-06 12:05:19.367092251 -0500
@@ -56,7 +56,7 @@
     QEglFSKmsGbmIntegration();
 
     EGLDisplay createDisplay(EGLNativeDisplayType nativeDisplay) override;
-    EGLNativeWindowType createNativeOffscreenWindow(const QSurfaceFormat &format) override;
+    EGLNativeWindowType createNativeOffscreenWindow(const QSurfaceFormat &format, int i) override;
     void destroyNativeWindow(EGLNativeWindowType window) override;
 
     QPlatformCursor *createCursor(QPlatformScreen *screen) const override;
@@ -64,7 +64,7 @@
     QEglFSWindow *createWindow(QWindow *window) const override;
 
 protected:
-    QKmsDevice *createDevice() override;
+    QKmsDevice *createDevice(const QString &path) override;
 
 private:
 };
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp	2020-03-09 10:56:50.208647599 -0400
@@ -109,8 +109,8 @@
     return fb.take();
 }
 
-QEglFSKmsGbmScreen::QEglFSKmsGbmScreen(QKmsDevice *device, const QKmsOutput &output, bool headless)
-    : QEglFSKmsScreen(device, output, headless)
+QEglFSKmsGbmScreen::QEglFSKmsGbmScreen(QKmsDevice *device, int i, const QKmsOutput &output, bool headless)
+    : QEglFSKmsScreen(device, i, output, headless)
     , m_gbm_surface(nullptr)
     , m_gbm_bo_current(nullptr)
     , m_gbm_bo_next(nullptr)
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h	2020-03-09 10:55:27.279839449 -0400
@@ -54,7 +54,7 @@
 class QEglFSKmsGbmScreen : public QEglFSKmsScreen
 {
 public:
-    QEglFSKmsGbmScreen(QKmsDevice *device, const QKmsOutput &output, bool headless);
+    QEglFSKmsGbmScreen(QKmsDevice *device, int i, const QKmsOutput &output, bool headless);
     ~QEglFSKmsGbmScreen();
 
     QPlatformCursor *cursor() const override;
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp	2020-03-06 12:25:03.998924609 -0500
@@ -82,7 +82,7 @@
     return m_devInt->eglDevice();
 }
 
-QPlatformScreen *QEglFSKmsEglDevice::createScreen(const QKmsOutput &output)
+QPlatformScreen *QEglFSKmsEglDevice::createScreen(const QKmsOutput &output, int i)
 {
     QEglFSKmsScreen *screen = new QEglFSKmsEglDeviceScreen(this, output);
 #if QT_CONFIG(opengl)
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h	2020-03-06 12:24:44.927944141 -0500
@@ -57,7 +57,7 @@
 
     void *nativeDisplay() const override;
 
-    QPlatformScreen *createScreen(const QKmsOutput &output) override;
+    QPlatformScreen *createScreen(const QKmsOutput &output, int i) override;
 
     QPlatformCursor *globalCursor() { return m_globalCursor; }
     void destroyGlobalCursor();
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp	2020-03-06 11:59:14.001413531 -0500
@@ -251,7 +251,7 @@
     return eglWindow;
 }
 
-QKmsDevice *QEglFSKmsEglDeviceIntegration::createDevice()
+QKmsDevice *QEglFSKmsEglDeviceIntegration::createDevice(const QString &path)
 {
     if (Q_UNLIKELY(!query_egl_device()))
         qFatal("Could not set up EGL device!");
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h	2020-03-06 11:58:53.568433258 -0500
@@ -65,7 +65,7 @@
     EGLDeviceEXT eglDevice() const { return m_egl_device; }
 
 protected:
-    QKmsDevice *createDevice() override;
+    QKmsDevice *createDevice(const QString &path) override;
     QPlatformCursor *createCursor(QPlatformScreen *screen) const override;
 
 private:
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp	2020-03-06 11:57:15.236534061 -0500
@@ -48,7 +48,7 @@
 Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug)
 
 QEglFSKmsEglDeviceScreen::QEglFSKmsEglDeviceScreen(QKmsDevice *device, const QKmsOutput &output)
-    : QEglFSKmsScreen(device, output)
+    : QEglFSKmsScreen(device, 0, output)
 {
 }
 
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp	2020-03-09 13:16:02.996459430 -0400
@@ -47,6 +47,8 @@
 #include <QtGui/qpa/qplatformwindow.h>
 #include <QtGui/QScreen>
 
+#include <QtDeviceDiscoverySupport/private/qdevicediscovery_p.h>
+
 #include <xf86drm.h>
 #include <xf86drmMode.h>
 
@@ -55,8 +57,7 @@
 Q_LOGGING_CATEGORY(qLcEglfsKmsDebug, "qt.qpa.eglfs.kms")
 
 QEglFSKmsIntegration::QEglFSKmsIntegration()
-    : m_device(nullptr),
-      m_screenConfig(new QKmsScreenConfig)
+      : m_screenConfig(new QKmsScreenConfig)
 {
 }
 
@@ -65,26 +66,47 @@
     delete m_screenConfig;
 }
 
-void QEglFSKmsIntegration::platformInit()
+int QEglFSKmsIntegration::platformInit()
 {
-    qCDebug(qLcEglfsKmsDebug, "platformInit: Opening DRM device");
-    m_device = createDevice();
-    if (Q_UNLIKELY(!m_device->open()))
-        qFatal("Could not open DRM device");
+    qCDebug(qLcEglfsKmsDebug, "platformInit: Opening DRM devices");
+
+    QDeviceDiscovery *d = QDeviceDiscovery::create(QDeviceDiscovery::Device_VideoMask);
+    const QStringList devices = d->scanConnectedDevices();
+    qCDebug(qLcEglfsKmsDebug) << "Found the following video devices:" << devices;
+    d->deleteLater();
+
+    if (Q_UNLIKELY(devices.isEmpty()))
+	qFatal("Could not find DRM device!");
+
+    foreach (const QString &path, devices) {
+        qCDebug(qLcEglfsKmsDebug) << "Using" << path;
+
+        QKmsDevice *device = createDevice(path);
+        if (Q_UNLIKELY(!device->open()))
+            qFatal("Could not open DRM device");
+
+        m_devices.append(device);
+    }
+
+    return m_devices.size();
 }
 
 void QEglFSKmsIntegration::platformDestroy()
 {
-    qCDebug(qLcEglfsKmsDebug, "platformDestroy: Closing DRM device");
-    m_device->close();
-    delete m_device;
-    m_device = nullptr;
+    qCDebug(qLcEglfsKmsDebug, "platformDestroy: Closing DRM devices");
+
+    foreach (QKmsDevice *device, m_devices) {
+	device->close();
+        delete device;
+    }
+
+    m_devices.clear();
 }
 
-EGLNativeDisplayType QEglFSKmsIntegration::platformDisplay() const
+EGLNativeDisplayType QEglFSKmsIntegration::platformDisplay(int i) const
 {
-    Q_ASSERT(m_device);
-    return (EGLNativeDisplayType) m_device->nativeDisplay();
+    Q_ASSERT(m_devices.size() > i);
+    return (EGLNativeDisplayType) m_devices[i]->nativeDisplay();
 }
 
 bool QEglFSKmsIntegration::usesDefaultScreen()
@@ -94,7 +116,13 @@
 
 void QEglFSKmsIntegration::screenInit()
 {
-    m_device->createScreens();
+    QVector<OrderedScreen> screens;
+
+    for (int i = 0; i < m_devices.size(); i++) {
+        m_devices[i]->createScreens(i, screens);
+    }
+
+    m_devices[0]->arrangeScreens(screens);
 }
 
 QSurfaceFormat QEglFSKmsIntegration::surfaceFormatFor(const QSurfaceFormat &inputFormat) const
@@ -135,8 +163,8 @@
 
 void *QEglFSKmsIntegration::nativeResourceForIntegration(const QByteArray &name)
 {
-    if (name == QByteArrayLiteral("dri_fd") && m_device)
-        return (void *) (qintptr) m_device->fd();
+    if (name == QByteArrayLiteral("dri_fd") && (m_devices.size() > 0))
+        return (void *) (qintptr) m_devices[0]->fd();
 
     return nullptr;
 }
@@ -151,9 +179,9 @@
     return nullptr;
 }
 
-QKmsDevice *QEglFSKmsIntegration::device() const
+QKmsDevice *QEglFSKmsIntegration::device(int i) const
 {
-    return m_device;
+    return (i < m_devices.size()) ? m_devices[i] : nullptr;
 }
 
 QKmsScreenConfig *QEglFSKmsIntegration::screenConfig() const
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h	2020-03-06 11:46:30.043177468 -0500
@@ -60,9 +60,9 @@
     QEglFSKmsIntegration();
     ~QEglFSKmsIntegration();
 
-    void platformInit() override;
+    int platformInit() override;
     void platformDestroy() override;
-    EGLNativeDisplayType platformDisplay() const override;
+    EGLNativeDisplayType platformDisplay(int i) const override;
     bool usesDefaultScreen() override;
     void screenInit() override;
     QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const override;
@@ -72,13 +72,13 @@
     void *nativeResourceForIntegration(const QByteArray &name) override;
     void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override;
 
-    QKmsDevice *device() const;
+    QKmsDevice *device(int i) const;
     QKmsScreenConfig *screenConfig() const;
 
 protected:
-    virtual QKmsDevice *createDevice() = 0;
+    virtual QKmsDevice *createDevice(const QString &path) = 0;
 
-    QKmsDevice *m_device;
+    QList<QKmsDevice *> m_devices;
     QKmsScreenConfig *m_screenConfig;
 };
 
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp	2020-03-09 10:49:29.093658430 -0400
@@ -68,9 +68,10 @@
     QEglFSKmsScreen *m_screen;
 };
 
-QEglFSKmsScreen::QEglFSKmsScreen(QKmsDevice *device, const QKmsOutput &output, bool headless)
-    : QEglFSScreen(static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration())->display())
+QEglFSKmsScreen::QEglFSKmsScreen(QKmsDevice *device, int i, const QKmsOutput &output, bool headless)
+    : QEglFSScreen(static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration())->display(i), i)
     , m_device(device)
+    , m_device_index(i)
     , m_output(output)
     , m_powerState(PowerStateOn)
     , m_interruptHandler(new QEglFSKmsInterruptHandler(this))
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
--- qt5base-5.11.2-orig/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h	2020-03-09 10:48:13.144825522 -0400
@@ -56,7 +56,7 @@
 class Q_EGLFS_EXPORT QEglFSKmsScreen : public QEglFSScreen
 {
 public:
-    QEglFSKmsScreen(QKmsDevice *device, const QKmsOutput &output, bool headless = false);
+    QEglFSKmsScreen(QKmsDevice *device, int i, const QKmsOutput &output, bool headless = false);
     ~QEglFSKmsScreen();
 
     void setVirtualPosition(const QPoint &pos);
@@ -88,6 +88,7 @@
     int preferredMode() const override;
 
     QKmsDevice *device() const { return m_device; }
+    int device_index() const { return m_device_index; }
 
     virtual void waitForFlip();
 
@@ -101,6 +102,7 @@
 
 protected:
     QKmsDevice *m_device;
+    int m_device_index;
 
     QKmsOutput m_output;
     QEdidParser m_edid;
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp qt5base-5.11.2/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/linuxfb/qlinuxfbdrmscreen.cpp	2020-03-06 14:18:35.799855696 -0500
@@ -103,7 +103,7 @@
 
 private:
     void *nativeDisplay() const override;
-    QPlatformScreen *createScreen(const QKmsOutput &output) override;
+    QPlatformScreen *createScreen(const QKmsOutput &output, int i) override;
     void registerScreen(QPlatformScreen *screen,
                         bool isPrimary,
                         const QPoint &virtualPos,
@@ -165,7 +165,7 @@
     return nullptr;
 }
 
-QPlatformScreen *QLinuxFbDevice::createScreen(const QKmsOutput &output)
+QPlatformScreen *QLinuxFbDevice::createScreen(const QKmsOutput &output, int i)
 {
     qCDebug(qLcFbDrm, "Got a new output: %s", qPrintable(output.name));
     Output o;
@@ -404,7 +404,9 @@
         return false;
 
     // Discover outputs. Calls back Device::createScreen().
-    m_device->createScreens();
+    QVector<OrderedScreen> screens;
+    m_device->createScreens(0, screens);
+    m_device->arrangeScreens(screens);
     // Now off to dumb buffer specifics.
     m_device->createFramebuffers();
     // Do the modesetting.
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp qt5base-5.11.2/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp
--- qt5base-5.11.2-orig/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/minimalegl/qminimaleglintegration.cpp	2020-03-09 10:46:28.193061116 -0400
@@ -136,7 +136,7 @@
 #endif
 }
 #ifndef QT_NO_OPENGL
-QPlatformOpenGLContext *QMinimalEglIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const
+QPlatformOpenGLContext *QMinimalEglIntegration::createPlatformOpenGLContext(QOpenGLContext *context, int i) const
 {
     return static_cast<QMinimalEglScreen *>(context->screen()->handle())->platformContext();
 }
diff -x 'Makefile*' -ru qt5base-5.11.2-orig/src/plugins/platforms/minimalegl/qminimaleglintegration.h qt5base-5.11.2/src/plugins/platforms/minimalegl/qminimaleglintegration.h
--- qt5base-5.11.2-orig/src/plugins/platforms/minimalegl/qminimaleglintegration.h	2018-09-13 00:25:10.000000000 -0400
+++ qt5base-5.11.2/src/plugins/platforms/minimalegl/qminimaleglintegration.h	2020-03-09 10:46:10.736101980 -0400
@@ -56,7 +56,7 @@
     QPlatformWindow *createPlatformWindow(QWindow *window) const override;
     QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
 #ifndef QT_NO_OPENGL
-    QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override;
+    QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context, int i) const override;
 #endif
     QPlatformFontDatabase *fontDatabase() const override;
 
