diff options
Diffstat (limited to 'src/plugins/platforms/eglfs')
121 files changed, 1967 insertions, 4555 deletions
diff --git a/src/plugins/platforms/eglfs/CMakeLists.txt b/src/plugins/platforms/eglfs/CMakeLists.txt new file mode 100644 index 0000000000..cb4b5d1eb9 --- /dev/null +++ b/src/plugins/platforms/eglfs/CMakeLists.txt @@ -0,0 +1,106 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +qt_find_package(EGL) + +if(QT_FEATURE_eglfs_gbm) + set(_device_integration "eglfs_kms") +elseif(QT_FEATURE_eglfs_egldevice) + set(_device_integration "eglfs_kms_egldevice") +elseif(QT_FEATURE_eglfs_viv) + set(_device_integration "eglfs_viv") +elseif(QT_FEATURE_eglfs_brcm) + set(_device_integration "eglfs_brcm") +elseif(QT_FEATURE_eglfs_openwfd) + set(_device_integration "eglfs_openwfd") +endif() + +set(QT_QPA_DEFAULT_EGLFS_INTEGRATION "${_device_integration}" CACHE STRING "Default EGLFS device integration plugin") + +##################################################################### +## EglFSDeviceIntegrationPrivate Module: +##################################################################### + +qt_internal_add_module(EglFSDeviceIntegrationPrivate + INTERNAL_MODULE + SOURCES + api/qeglfsdeviceintegration.cpp api/qeglfsdeviceintegration_p.h + api/qeglfsglobal_p.h + api/qeglfshooks.cpp api/qeglfshooks_p.h + api/qeglfsintegration.cpp api/qeglfsintegration_p.h + api/qeglfsoffscreenwindow.cpp api/qeglfsoffscreenwindow_p.h + api/qeglfsscreen.cpp api/qeglfsscreen_p.h + api/qeglfswindow.cpp api/qeglfswindow_p.h + DEFINES + QT_BUILD_EGL_DEVICE_LIB + QT_EGL_NO_X11 + QT_NO_FOREACH + EGLFS_PREFERRED_PLUGIN=${QT_QPA_DEFAULT_EGLFS_INTEGRATION} + INCLUDE_DIRECTORIES + api + PUBLIC_LIBRARIES + Qt::CorePrivate + Qt::DeviceDiscoverySupportPrivate + Qt::FbSupportPrivate + Qt::GuiPrivate + EGL::EGL + HEADER_SYNC_SOURCE_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}/api" + NO_GENERATE_CPP_EXPORTS +) + +## Scopes: +##################################################################### + +qt_internal_extend_target(EglFSDeviceIntegrationPrivate CONDITION TARGET Qt::InputSupportPrivate + PUBLIC_LIBRARIES + Qt::InputSupportPrivate +) + +qt_internal_extend_target(EglFSDeviceIntegrationPrivate CONDITION INTEGRITY AND TARGET IntegrityPlatformGraphics::IntegrityPlatformGraphics + LIBRARIES + IntegrityPlatformGraphics::IntegrityPlatformGraphics +) + +qt_internal_extend_target(EglFSDeviceIntegrationPrivate CONDITION QT_FEATURE_opengl + SOURCES + api/qeglfscontext.cpp api/qeglfscontext_p.h + api/qeglfscursor.cpp api/qeglfscursor_p.h + PUBLIC_LIBRARIES + Qt::OpenGLPrivate +) + +if(QT_FEATURE_cursor) + # Resources: + set(cursor_resource_files + "cursor-atlas.png" + "cursor.json" + ) + + qt_internal_add_resource(EglFSDeviceIntegrationPrivate "cursor" + PREFIX + "/" + FILES + ${cursor_resource_files} + ) +endif() + +##################################################################### +## QEglFSIntegrationPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QEglFSIntegrationPlugin + OUTPUT_NAME qeglfs + PLUGIN_TYPE platforms + DEFAULT_IF "eglfs" IN_LIST QT_QPA_PLATFORMS + SOURCES + qeglfsmain.cpp + DEFINES + QT_EGL_NO_X11 + LIBRARIES + Qt::CorePrivate + Qt::EglFSDeviceIntegrationPrivate + EGL::EGL +) + +add_subdirectory(deviceintegration) diff --git a/src/plugins/platforms/eglfs/api/api.pri b/src/plugins/platforms/eglfs/api/api.pri deleted file mode 100644 index a6d81016b6..0000000000 --- a/src/plugins/platforms/eglfs/api/api.pri +++ /dev/null @@ -1,26 +0,0 @@ - -SOURCES += $$PWD/qeglfswindow.cpp \ - $$PWD/qeglfsscreen.cpp \ - $$PWD/qeglfshooks.cpp \ - $$PWD/qeglfsdeviceintegration.cpp \ - $$PWD/qeglfsintegration.cpp \ - $$PWD/qeglfsoffscreenwindow.cpp - -HEADERS += $$PWD/qeglfswindow_p.h \ - $$PWD/qeglfsscreen_p.h \ - $$PWD/qeglfshooks_p.h \ - $$PWD/qeglfsdeviceintegration_p.h \ - $$PWD/qeglfsintegration_p.h \ - $$PWD/qeglfsoffscreenwindow_p.h \ - $$PWD/qeglfsglobal_p.h - -qtConfig(opengl) { - SOURCES += \ - $$PWD/qeglfscursor.cpp \ - $$PWD/qeglfscontext.cpp - HEADERS += \ - $$PWD/qeglfscursor_p.h \ - $$PWD/qeglfscontext_p.h -} - -INCLUDEPATH += $$PWD diff --git a/src/plugins/platforms/eglfs/api/qeglfscontext.cpp b/src/plugins/platforms/eglfs/api/qeglfscontext.cpp index 48fafbda8d..9c10c1a998 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscontext.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfscontext.cpp @@ -1,46 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfsglobal_p.h" #include <QtGui/QSurface> -#include <QtEglSupport/private/qeglconvenience_p.h> -#include <QtEglSupport/private/qeglpbuffer_p.h> +#include <QtGui/private/qeglconvenience_p.h> +#include <QtGui/private/qeglpbuffer_p.h> #include "qeglfscontext_p.h" #include "qeglfswindow_p.h" @@ -50,19 +14,27 @@ QT_BEGIN_NAMESPACE QEglFSContext::QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, - EGLConfig *config, const QVariant &nativeHandle) - : QEGLPlatformContext(format, share, display, config, nativeHandle, - qt_egl_device_integration()->supportsSurfacelessContexts() ? Flags() : QEGLPlatformContext::NoSurfaceless), - m_tempWindow(0) + EGLConfig *config) + : QEGLPlatformContext(format, share, display, config, + qt_egl_device_integration()->supportsSurfacelessContexts() ? Flags() : QEGLPlatformContext::NoSurfaceless) { } EGLSurface QEglFSContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface) { - if (surface->surface()->surfaceClass() == QSurface::Window) - return static_cast<QEglFSWindow *>(surface)->surface(); - else + if (surface->surface()->surfaceClass() == QSurface::Window) { + + QEglFSWindow *w = static_cast<QEglFSWindow *>(surface); + EGLSurface s = w->surface(); + if (s == EGL_NO_SURFACE) { + w->resetSurface(); + s = w->surface(); + } + return s; + + } else { return static_cast<QEGLPbuffer *>(surface)->pbuffer(); + } } EGLSurface QEglFSContext::createTemporaryOffscreenSurface() diff --git a/src/plugins/platforms/eglfs/api/qeglfscontext_p.h b/src/plugins/platforms/eglfs/api/qeglfscontext_p.h index af8725b6b3..75a4741b1f 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscontext_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfscontext_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSCONTEXT_H #define QEGLFSCONTEXT_H @@ -53,7 +17,7 @@ #include "qeglfsglobal_p.h" #include "qeglfscursor_p.h" -#include <QtEglSupport/private/qeglplatformcontext_p.h> +#include <QtGui/private/qeglplatformcontext_p.h> #include <QtCore/QVariant> QT_BEGIN_NAMESPACE @@ -61,8 +25,10 @@ QT_BEGIN_NAMESPACE class Q_EGLFS_EXPORT QEglFSContext : public QEGLPlatformContext { public: + using QEGLPlatformContext::QEGLPlatformContext; + QEglFSContext() = default; // workaround for INTEGRITY compiler QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, - EGLConfig *config, const QVariant &nativeHandle); + EGLConfig *config); EGLSurface eglSurfaceForPlatformSurface(QPlatformSurface *surface) override; EGLSurface createTemporaryOffscreenSurface() override; void destroyTemporaryOffscreenSurface(EGLSurface surface) override; @@ -72,7 +38,7 @@ public: QEglFSCursorData cursorData; private: - EGLNativeWindowType m_tempWindow; + EGLNativeWindowType m_tempWindow = 0; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp index 98e05195ee..1e1a7d8269 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscursor.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfscursor.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfscursor_p.h" #include "qeglfsintegration_p.h" @@ -44,13 +8,14 @@ #include <qpa/qwindowsysteminterface.h> #include <QtGui/QOpenGLContext> +#include <QtGui/QOpenGLFunctions> #include <QtCore/QFile> #include <QtCore/QJsonDocument> #include <QtCore/QJsonArray> #include <QtCore/QJsonObject> #include <QtGui/private/qguiapplication_p.h> -#include <QtGui/private/qopenglvertexarrayobject_p.h> +#include <QtOpenGL/private/qopenglvertexarrayobject_p.h> #ifndef GL_VERTEX_ARRAY_BINDING #define GL_VERTEX_ARRAY_BINDING 0x85B5 @@ -58,6 +23,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + QEglFSCursor::QEglFSCursor(QPlatformScreen *screen) : m_visible(true), m_screen(static_cast<QEglFSScreen *>(screen)), @@ -151,16 +118,18 @@ void QEglFSCursor::createShaderPrograms() void QEglFSCursor::createCursorTexture(uint *texture, const QImage &image) { + Q_ASSERT(QOpenGLContext::currentContext()); + QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); if (!*texture) - glGenTextures(1, texture); - glBindTexture(GL_TEXTURE_2D, *texture); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - - glTexImage2D(GL_TEXTURE_2D, 0 /* level */, GL_RGBA, image.width(), image.height(), 0 /* border */, - GL_RGBA, GL_UNSIGNED_BYTE, image.constBits()); + f->glGenTextures(1, texture); + f->glBindTexture(GL_TEXTURE_2D, *texture); + f->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + f->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + f->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + f->glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + + f->glTexImage2D(GL_TEXTURE_2D, 0 /* level */, GL_RGBA, image.width(), image.height(), 0 /* border */, + GL_RGBA, GL_UNSIGNED_BYTE, image.constBits()); } void QEglFSCursor::initCursorAtlas() @@ -178,14 +147,14 @@ void QEglFSCursor::initCursorAtlas() QJsonDocument doc = QJsonDocument::fromJson(file.readAll()); QJsonObject object = doc.object(); - QString atlas = object.value(QLatin1String("image")).toString(); + QString atlas = object.value("image"_L1).toString(); Q_ASSERT(!atlas.isEmpty()); - const int cursorsPerRow = object.value(QLatin1String("cursorsPerRow")).toDouble(); + const int cursorsPerRow = object.value("cursorsPerRow"_L1).toDouble(); Q_ASSERT(cursorsPerRow); m_cursorAtlas.cursorsPerRow = cursorsPerRow; - const QJsonArray hotSpots = object.value(QLatin1String("hotSpots")).toArray(); + const QJsonArray hotSpots = object.value("hotSpots"_L1).toArray(); Q_ASSERT(hotSpots.count() == Qt::LastCursor + 1); for (int i = 0; i < hotSpots.count(); i++) { QPoint hotSpot(hotSpots[i].toArray()[0].toDouble(), hotSpots[i].toArray()[1].toDouble()); @@ -323,7 +292,7 @@ void QEglFSCursor::pointerEvent(const QMouseEvent &event) if (event.type() != QEvent::MouseMove) return; const QRect oldCursorRect = cursorRect(); - m_cursor.pos = event.screenPos().toPoint(); + m_cursor.pos = event.globalPosition().toPoint(); update(oldCursorRect | cursorRect(), false); for (QPlatformScreen *screen : m_screen->virtualSiblings()) static_cast<QEglFSScreen *>(screen)->handleCursorMove(m_cursor.pos); @@ -343,8 +312,7 @@ void QEglFSCursor::paintOnScreen() // screens are siblings of each other. When not enabled, the sibling list // only contains m_screen itself. for (QPlatformScreen *screen : m_screen->virtualSiblings()) { - if (screen->geometry().contains(cr.topLeft().toPoint() + m_cursor.hotSpot) - && QOpenGLContext::currentContext()->screen() == screen->screen()) + if (screen->geometry().contains(cr.topLeft().toPoint() + m_cursor.hotSpot)) { cr.translate(-screen->geometry().topLeft()); const QSize screenSize = screen->geometry().size(); @@ -373,9 +341,9 @@ void QEglFSCursor::paintOnScreen() // to deal with the changes we make. struct StateSaver { - StateSaver() { - f = QOpenGLContext::currentContext()->functions(); - vaoHelper = new QOpenGLVertexArrayObjectHelper(QOpenGLContext::currentContext()); + StateSaver(QOpenGLFunctions* func) { + f = func; + vaoHelper = QOpenGLVertexArrayObjectHelper::vertexArrayObjectHelperForContext(QOpenGLContext::currentContext()); static bool windowsChecked = false; static bool shouldSave = true; @@ -400,6 +368,8 @@ struct StateSaver f->glGetIntegerv(GL_BLEND_SRC_ALPHA, blendFunc + 1); f->glGetIntegerv(GL_BLEND_DST_RGB, blendFunc + 2); f->glGetIntegerv(GL_BLEND_DST_ALPHA, blendFunc + 3); + scissor = f->glIsEnabled(GL_SCISSOR_TEST); + stencil = f->glIsEnabled(GL_STENCIL_TEST); f->glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &arrayBuf); if (vaoHelper->isValid()) f->glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &vao); @@ -423,17 +393,15 @@ struct StateSaver f->glFrontFace(frontFace); if (cull) f->glEnable(GL_CULL_FACE); - else - f->glDisable(GL_CULL_FACE); if (depthTest) f->glEnable(GL_DEPTH_TEST); - else - f->glDisable(GL_DEPTH_TEST); - if (blend) - f->glEnable(GL_BLEND); - else + if (!blend) f->glDisable(GL_BLEND); f->glBlendFuncSeparate(blendFunc[0], blendFunc[1], blendFunc[2], blendFunc[3]); + if (scissor) + f->glEnable(GL_SCISSOR_TEST); + if (stencil) + f->glEnable(GL_STENCIL_TEST); f->glBindBuffer(GL_ARRAY_BUFFER, arrayBuf); if (vaoHelper->isValid()) vaoHelper->glBindVertexArray(vao); @@ -446,7 +414,6 @@ struct StateSaver f->glVertexAttribPointer(i, va[i].size, va[i].type, va[i].normalized, va[i].stride, va[i].pointer); } } - delete vaoHelper; } QOpenGLFunctions *f; QOpenGLVertexArrayObjectHelper *vaoHelper; @@ -459,6 +426,8 @@ struct StateSaver bool depthTest; bool blend; GLint blendFunc[4]; + bool scissor; + bool stencil; GLint vao; GLint arrayBuf; struct { GLint enabled, type, size, normalized, stride, buffer; GLvoid *pointer; } va[2]; @@ -466,13 +435,12 @@ struct StateSaver void QEglFSCursor::draw(const QRectF &r) { - StateSaver stateSaver; + Q_ASSERT(QOpenGLContext::currentContext()); + QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions(); + StateSaver stateSaver(f); QEglFSCursorData &gfx = static_cast<QEglFSContext*>(QOpenGLContext::currentContext()->handle())->cursorData; if (!gfx.program) { - // one time initialization - initializeOpenGLFunctions(); - createShaderPrograms(); if (!gfx.atlasTexture) { @@ -518,13 +486,13 @@ void QEglFSCursor::draw(const QRectF &r) s2, t1 }; - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, cursorTexture); + f->glActiveTexture(GL_TEXTURE0); + f->glBindTexture(GL_TEXTURE_2D, cursorTexture); if (stateSaver.vaoHelper->isValid()) stateSaver.vaoHelper->glBindVertexArray(0); - glBindBuffer(GL_ARRAY_BUFFER, 0); + f->glBindBuffer(GL_ARRAY_BUFFER, 0); gfx.program->enableAttributeArray(0); gfx.program->enableAttributeArray(1); @@ -534,13 +502,15 @@ void QEglFSCursor::draw(const QRectF &r) gfx.program->setUniformValue(gfx.textureEntry, 0); gfx.program->setUniformValue(gfx.matEntry, m_rotationMatrix); - glDisable(GL_CULL_FACE); - glFrontFace(GL_CCW); - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - glDisable(GL_DEPTH_TEST); // disable depth testing to make sure cursor is always on top + f->glDisable(GL_CULL_FACE); + f->glFrontFace(GL_CCW); + f->glEnable(GL_BLEND); + f->glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + f->glDisable(GL_DEPTH_TEST); // disable depth testing to make sure cursor is always on top + f->glDisable(GL_SCISSOR_TEST); + f->glDisable(GL_STENCIL_TEST); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); + f->glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); gfx.program->disableAttributeArray(0); gfx.program->disableAttributeArray(1); @@ -548,3 +518,5 @@ void QEglFSCursor::draw(const QRectF &r) } QT_END_NAMESPACE + +#include "moc_qeglfscursor_p.cpp" diff --git a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h index 8768f9dd8c..88d4ce695a 100644 --- a/src/plugins/platforms/eglfs/api/qeglfscursor_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfscursor_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSCURSOR_H #define QEGLFSCURSOR_H @@ -54,12 +18,11 @@ #include "qeglfsglobal_p.h" #include <qpa/qplatformcursor.h> #include <qpa/qplatformscreen.h> +#include <QtOpenGL/QOpenGLShaderProgram> #include <QtGui/QMatrix4x4> -#include <QtGui/QOpenGLFunctions> -#include <QtGui/QOpenGLShaderProgram> #include <QtGui/private/qinputdevicemanager_p.h> -#include <QtCore/qvector.h> +#include <QtCore/qlist.h> QT_BEGIN_NAMESPACE @@ -94,7 +57,6 @@ struct QEglFSCursorData { }; class Q_EGLFS_EXPORT QEglFSCursor : public QPlatformCursor - , protected QOpenGLFunctions { Q_OBJECT public: @@ -145,7 +107,7 @@ private: int cursorsPerRow; int width, height; // width and height of the atlas int cursorWidth, cursorHeight; // width and height of cursors inside the atlas - QVector<QPoint> hotSpots; + QList<QPoint> hotSpots; QImage image; // valid until it's uploaded } m_cursorAtlas; diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp index 81bad45cd2..56fda45e90 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfsdeviceintegration_p.h" #include "qeglfsintegration_p.h" @@ -46,12 +10,13 @@ #include "qeglfsscreen_p.h" #include "qeglfshooks_p.h" -#include <QtEglSupport/private/qeglconvenience_p.h> +#include <QtGui/private/qeglconvenience_p.h> #include <QGuiApplication> #include <private/qguiapplication_p.h> #include <QScreen> #include <QDir> #if QT_CONFIG(regularexpression) +# include <QFileInfo> # include <QRegularExpression> #endif #include <QLoggingCategory> @@ -68,52 +33,24 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + Q_LOGGING_CATEGORY(qLcEglDevDebug, "qt.qpa.egldeviceintegration") Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, - (QEglFSDeviceIntegrationFactoryInterface_iid, QLatin1String("/egldeviceintegrations"), Qt::CaseInsensitive)) - -#if QT_CONFIG(library) -Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, directLoader, - (QEglFSDeviceIntegrationFactoryInterface_iid, QLatin1String(""), Qt::CaseInsensitive)) + (QEglFSDeviceIntegrationFactoryInterface_iid, "/egldeviceintegrations"_L1, Qt::CaseInsensitive)) -#endif // QT_CONFIG(library) - -QStringList QEglFSDeviceIntegrationFactory::keys(const QString &pluginPath) +QStringList QEglFSDeviceIntegrationFactory::keys() { QStringList list; -#if QT_CONFIG(library) - if (!pluginPath.isEmpty()) { - QCoreApplication::addLibraryPath(pluginPath); - list = directLoader()->keyMap().values(); - if (!list.isEmpty()) { - const QString postFix = QLatin1String(" (from ") - + QDir::toNativeSeparators(pluginPath) - + QLatin1Char(')'); - const QStringList::iterator end = list.end(); - for (QStringList::iterator it = list.begin(); it != end; ++it) - (*it).append(postFix); - } - } -#else - Q_UNUSED(pluginPath); -#endif list.append(loader()->keyMap().values()); qCDebug(qLcEglDevDebug) << "EGL device integration plugin keys:" << list; return list; } -QEglFSDeviceIntegration *QEglFSDeviceIntegrationFactory::create(const QString &key, const QString &pluginPath) +QEglFSDeviceIntegration *QEglFSDeviceIntegrationFactory::create(const QString &key) { QEglFSDeviceIntegration *integration = nullptr; -#if QT_CONFIG(library) - if (!pluginPath.isEmpty()) { - QCoreApplication::addLibraryPath(pluginPath); - integration = qLoadPlugin<QEglFSDeviceIntegration, QEglFSDeviceIntegrationPlugin>(directLoader(), key); - } -#else - Q_UNUSED(pluginPath); -#endif if (!integration) integration = qLoadPlugin<QEglFSDeviceIntegration, QEglFSDeviceIntegrationPlugin>(loader(), key); if (integration) @@ -128,7 +65,7 @@ static int framebuffer = -1; QByteArray QEglFSDeviceIntegration::fbDeviceName() const { -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_VXWORKS) QByteArray fbDev = qgetenv("QT_QPA_EGLFS_FB"); if (fbDev.isEmpty()) fbDev = QByteArrayLiteral("/dev/fb0"); @@ -143,8 +80,13 @@ int QEglFSDeviceIntegration::framebufferIndex() const { int fbIndex = 0; #if QT_CONFIG(regularexpression) - QRegularExpression fbIndexRx(QLatin1String("fb(\\d+)")); - QRegularExpressionMatch match = fbIndexRx.match(QString::fromLocal8Bit(fbDeviceName())); + QRegularExpression fbIndexRx("fb(\\d+)"_L1); + QFileInfo fbinfo(QString::fromLocal8Bit(fbDeviceName())); + QRegularExpressionMatch match; + if (fbinfo.isSymLink()) + match = fbIndexRx.match(fbinfo.symLinkTarget()); + else + match = fbIndexRx.match(fbinfo.fileName()); if (match.hasMatch()) fbIndex = match.captured(1).toInt(); #endif @@ -153,7 +95,7 @@ int QEglFSDeviceIntegration::framebufferIndex() const void QEglFSDeviceIntegration::platformInit() { -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_VXWORKS) QByteArray fbDev = fbDeviceName(); framebuffer = qt_safe_open(fbDev, O_RDONLY); @@ -171,7 +113,7 @@ void QEglFSDeviceIntegration::platformInit() void QEglFSDeviceIntegration::platformDestroy() { -#ifdef Q_OS_LINUX +#if defined(Q_OS_LINUX) || defined(Q_OS_VXWORKS) if (framebuffer != -1) close(framebuffer); #endif @@ -179,7 +121,9 @@ void QEglFSDeviceIntegration::platformDestroy() EGLNativeDisplayType QEglFSDeviceIntegration::platformDisplay() const { - return EGL_DEFAULT_DISPLAY; + bool displayOk; + const int defaultDisplay = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DEFAULT_DISPLAY", &displayOk); + return displayOk ? EGLNativeDisplayType(quintptr(defaultDisplay)) : EGL_DEFAULT_DISPLAY; } EGLDisplay QEglFSDeviceIntegration::createDisplay(EGLNativeDisplayType nativeDisplay) @@ -216,19 +160,12 @@ QSize QEglFSDeviceIntegration::screenSize() const QDpi QEglFSDeviceIntegration::logicalDpi() const { - const QSizeF ps = physicalScreenSize(); - const QSize s = screenSize(); - - if (!ps.isEmpty() && !s.isEmpty()) - return QDpi(25.4 * s.width() / ps.width(), - 25.4 * s.height() / ps.height()); - else - return QDpi(100, 100); + return QDpi(100, 100); } -qreal QEglFSDeviceIntegration::pixelDensity() const +QDpi QEglFSDeviceIntegration::logicalBaseDpi() const { - return qMax(1, qRound(logicalDpi().first / qreal(100))); + return QDpi(100, 100); } Qt::ScreenOrientation QEglFSDeviceIntegration::nativeOrientation() const @@ -394,3 +331,5 @@ EGLConfig QEglFSDeviceIntegration::chooseConfig(EGLDisplay display, const QSurfa } QT_END_NAMESPACE + +#include "moc_qeglfsdeviceintegration_p.cpp" diff --git a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h index 71ffb4c69a..e0a863c6da 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsdeviceintegration_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSDEVICEINTEGRATION_H #define QEGLFSDEVICEINTEGRATION_H @@ -80,7 +44,7 @@ public: virtual QSizeF physicalScreenSize() const; virtual QSize screenSize() const; virtual QDpi logicalDpi() const; - virtual qreal pixelDensity() const; + virtual QDpi logicalBaseDpi() const; virtual Qt::ScreenOrientation nativeOrientation() const; virtual Qt::ScreenOrientation orientation() const; virtual int screenDepth() const; @@ -126,8 +90,8 @@ public: class Q_EGLFS_EXPORT QEglFSDeviceIntegrationFactory { public: - static QStringList keys(const QString &pluginPath = QString()); - static QEglFSDeviceIntegration *create(const QString &name, const QString &platformPluginPath = QString()); + static QStringList keys(); + static QEglFSDeviceIntegration *create(const QString &name); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/api/qeglfsglobal_p.h b/src/plugins/platforms/eglfs/api/qeglfsglobal_p.h index 8d76ff5ee0..488675dbf1 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsglobal_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsglobal_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSGLOBAL_H #define QEGLFSGLOBAL_H @@ -53,7 +17,7 @@ #include <QtCore/qglobal.h> -#include <QtEglSupport/private/qt_egl_p.h> +#include <QtGui/private/qt_egl_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/api/qeglfshooks.cpp b/src/plugins/platforms/eglfs/api/qeglfshooks.cpp index ff5c5deee4..4ab40c46fe 100644 --- a/src/plugins/platforms/eglfs/api/qeglfshooks.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfshooks.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfshooks_p.h" #include <QLoggingCategory> diff --git a/src/plugins/platforms/eglfs/api/qeglfshooks_p.h b/src/plugins/platforms/eglfs/api/qeglfshooks_p.h index 4c3149c7c9..5a308b0f68 100644 --- a/src/plugins/platforms/eglfs/api/qeglfshooks_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfshooks_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSHOOKS_H #define QEGLFSHOOKS_H diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index d9a3545a95..f0b64c475c 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include <QtCore/qtextstream.h> #include <QtGui/private/qguiapplication_p.h> @@ -61,23 +25,21 @@ #endif #include "qeglfsoffscreenwindow_p.h" -#include <QtEglSupport/private/qeglconvenience_p.h> +#include <QtGui/private/qeglconvenience_p.h> #ifndef QT_NO_OPENGL -# include <QtEglSupport/private/qeglplatformcontext_p.h> -# include <QtEglSupport/private/qeglpbuffer_p.h> +# include <QtGui/private/qeglplatformcontext_p.h> +# include <QtGui/private/qeglpbuffer_p.h> #endif -#include <QtFontDatabaseSupport/private/qgenericunixfontdatabase_p.h> -#include <QtServiceSupport/private/qgenericunixservices_p.h> -#include <QtThemeSupport/private/qgenericunixthemes_p.h> -#include <QtEventDispatcherSupport/private/qgenericunixeventdispatcher_p.h> +#include <QtGui/private/qgenericunixfontdatabase_p.h> +#include <QtGui/private/qgenericunixservices_p.h> +#include <QtGui/private/qgenericunixthemes_p.h> +#include <QtGui/private/qgenericunixeventdispatcher_p.h> #include <QtFbSupport/private/qfbvthandler_p.h> #ifndef QT_NO_OPENGL -# include <QtPlatformCompositorSupport/private/qopenglcompositorbackingstore_p.h> +# include <QtOpenGL/private/qopenglcompositorbackingstore_p.h> #endif -#include <QtPlatformHeaders/QEGLNativeContext> - #if QT_CONFIG(libinput) #include <QtInputSupport/private/qlibinputhandler_p.h> #endif @@ -96,8 +58,6 @@ #include <QtInputSupport/qintegrityhidmanager.h> #endif -#include <QtPlatformHeaders/qeglfsfunctions.h> - static void initResources() { #ifndef QT_NO_CURSOR @@ -107,12 +67,14 @@ static void initResources() QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + QEglFSIntegration::QEglFSIntegration() - : m_display(EGL_NO_DISPLAY), + : m_kbdMgr(nullptr), + m_display(EGL_NO_DISPLAY), m_inputContext(nullptr), m_fontDb(new QGenericUnixFontDatabase), m_services(new QGenericUnixServices), - m_kbdMgr(nullptr), m_disableInputHandlers(false) { m_disableInputHandlers = qEnvironmentVariableIntValue("QT_QPA_EGLFS_DISABLE_INPUT"); @@ -148,7 +110,8 @@ void QEglFSIntegration::initialize() void QEglFSIntegration::destroy() { - foreach (QWindow *w, qGuiApp->topLevelWindows()) + const auto toplevels = qGuiApp->topLevelWindows(); + for (QWindow *w : toplevels) w->destroy(); qt_egl_device_integration()->screenDestroy(); @@ -215,22 +178,20 @@ QPlatformOpenGLContext *QEglFSIntegration::createPlatformOpenGLContext(QOpenGLCo { EGLDisplay dpy = context->screen() ? static_cast<QEglFSScreen *>(context->screen()->handle())->display() : display(); QPlatformOpenGLContext *share = context->shareHandle(); - QVariant nativeHandle = context->nativeHandle(); QEglFSContext *ctx; QSurfaceFormat adjustedFormat = qt_egl_device_integration()->surfaceFormatFor(context->format()); - if (nativeHandle.isNull()) { - EGLConfig config = QEglFSDeviceIntegration::chooseConfig(dpy, adjustedFormat); - ctx = new QEglFSContext(adjustedFormat, share, dpy, &config, QVariant()); - } else { - ctx = new QEglFSContext(adjustedFormat, share, dpy, nullptr, nativeHandle); - } - nativeHandle = QVariant::fromValue<QEGLNativeContext>(QEGLNativeContext(ctx->eglContext(), dpy)); + EGLConfig config = QEglFSDeviceIntegration::chooseConfig(dpy, adjustedFormat); + ctx = new QEglFSContext(adjustedFormat, share, dpy, &config); - context->setNativeHandle(nativeHandle); return ctx; } +QOpenGLContext *QEglFSIntegration::createOpenGLContext(EGLContext context, EGLDisplay contextDisplay, QOpenGLContext *shareContext) const +{ + return QEGLPlatformContext::createFrom<QEglFSContext>(context, contextDisplay, display(), shareContext); +} + QPlatformOffscreenSurface *QEglFSIntegration::createPlatformOffscreenSurface(QOffscreenSurface *surface) const { EGLDisplay dpy = surface->screen() ? static_cast<QEglFSScreen *>(surface->screen()->handle())->display() : display(); @@ -283,7 +244,8 @@ enum ResourceType { NativeDisplay, XlibDisplay, WaylandDisplay, - EglSurface + EglSurface, + VkSurface }; static int resourceType(const QByteArray &key) @@ -296,7 +258,8 @@ static int resourceType(const QByteArray &key) QByteArrayLiteral("nativedisplay"), QByteArrayLiteral("display"), QByteArrayLiteral("server_wl_display"), - QByteArrayLiteral("eglsurface") + QByteArrayLiteral("eglsurface"), + QByteArrayLiteral("vksurface") }; const QByteArray *end = names + sizeof(names) / sizeof(names[0]); const QByteArray *result = std::find(names, end, key); @@ -421,45 +384,40 @@ QPlatformNativeInterface::NativeResourceForContextFunction QEglFSIntegration::na QFunctionPointer QEglFSIntegration::platformFunction(const QByteArray &function) const { -#if QT_CONFIG(evdev) - if (function == QEglFSFunctions::loadKeymapTypeIdentifier()) - return QFunctionPointer(loadKeymapStatic); - else if (function == QEglFSFunctions::switchLangTypeIdentifier()) - return QFunctionPointer(switchLangStatic); -#endif - return qt_egl_device_integration()->platformFunction(function); } -void QEglFSIntegration::loadKeymapStatic(const QString &filename) +QVariant QEglFSIntegration::styleHint(QPlatformIntegration::StyleHint hint) const { + if (hint == QPlatformIntegration::ShowIsFullScreen) + return true; + + return QPlatformIntegration::styleHint(hint); +} + #if QT_CONFIG(evdev) - QEglFSIntegration *self = static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration()); - if (self->m_kbdMgr) - self->m_kbdMgr->loadKeymap(filename); +void QEglFSIntegration::loadKeymap(const QString &filename) +{ + if (m_kbdMgr) + m_kbdMgr->loadKeymap(filename); else qWarning("QEglFSIntegration: Cannot load keymap, no keyboard handler found"); -#else - Q_UNUSED(filename); -#endif } -void QEglFSIntegration::switchLangStatic() +void QEglFSIntegration::switchLang() { -#if QT_CONFIG(evdev) - QEglFSIntegration *self = static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration()); - if (self->m_kbdMgr) - self->m_kbdMgr->switchLang(); + if (m_kbdMgr) + m_kbdMgr->switchLang(); else qWarning("QEglFSIntegration: Cannot switch language, no keyboard handler found"); -#endif } +#endif void QEglFSIntegration::createInputHandlers() { #if QT_CONFIG(libinput) if (!qEnvironmentVariableIntValue("QT_QPA_EGLFS_NO_LIBINPUT")) { - new QLibInputHandler(QLatin1String("libinput"), QString()); + new QLibInputHandler("libinput"_L1, QString()); return; } #endif @@ -467,16 +425,16 @@ void QEglFSIntegration::createInputHandlers() #if QT_CONFIG(tslib) bool useTslib = qEnvironmentVariableIntValue("QT_QPA_EGLFS_TSLIB"); if (useTslib) - new QTsLibMouseHandler(QLatin1String("TsLib"), QString() /* spec */); + new QTsLibMouseHandler("TsLib"_L1, QString() /* spec */); #endif #if QT_CONFIG(evdev) - m_kbdMgr = new QEvdevKeyboardManager(QLatin1String("EvdevKeyboard"), QString() /* spec */, this); - new QEvdevMouseManager(QLatin1String("EvdevMouse"), QString() /* spec */, this); + m_kbdMgr = new QEvdevKeyboardManager("EvdevKeyboard"_L1, QString() /* spec */, this); + new QEvdevMouseManager("EvdevMouse"_L1, QString() /* spec */, this); #if QT_CONFIG(tslib) if (!useTslib) #endif - new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); + new QEvdevTouchManager("EvdevTouch"_L1, QString() /* spec */, this); #endif #if QT_CONFIG(integrityhid) diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h index 898b322834..8007167ec7 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSINTEGRATION_H #define QEGLFSINTEGRATION_H @@ -52,10 +16,14 @@ // #include "qeglfsglobal_p.h" +#include <QtCore/QPointer> #include <QtCore/QVariant> +#include <QtGui/QWindow> #include <qpa/qplatformintegration.h> #include <qpa/qplatformnativeinterface.h> +#include <qpa/qplatformopenglcontext.h> #include <qpa/qplatformscreen.h> +#include <QtGui/private/qkeymapper_p.h> QT_BEGIN_NAMESPACE @@ -65,6 +33,12 @@ class QFbVtHandler; class QEvdevKeyboardManager; class Q_EGLFS_EXPORT QEglFSIntegration : public QPlatformIntegration, public QPlatformNativeInterface +#if QT_CONFIG(evdev) + , public QNativeInterface::Private::QEvdevKeyMapper +#endif +#ifndef QT_NO_OPENGL + , public QNativeInterface::Private::QEGLIntegration +#endif { public: QEglFSIntegration(); @@ -84,6 +58,7 @@ public: QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override; #ifndef QT_NO_OPENGL QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const override; + QOpenGLContext *createOpenGLContext(EGLContext context, EGLDisplay display, QOpenGLContext *shareContext) const override; QPlatformOffscreenSurface *createPlatformOffscreenSurface(QOffscreenSurface *surface) const override; #endif bool hasCapability(QPlatformIntegration::Capability cap) const override; @@ -101,20 +76,31 @@ public: QFunctionPointer platformFunction(const QByteArray &function) const override; + QVariant styleHint(QPlatformIntegration::StyleHint hint) const override; + QFbVtHandler *vtHandler() { return m_vtHandler.data(); } + QPointer<QWindow> pointerWindow() { return m_pointerWindow; } + void setPointerWindow(QWindow *pointerWindow) { m_pointerWindow = pointerWindow; } + +#if QT_CONFIG(evdev) + void loadKeymap(const QString &filename) override; + void switchLang() override; +#endif + +protected: + virtual void createInputHandlers(); + QEvdevKeyboardManager *m_kbdMgr; + private: EGLNativeDisplayType nativeDisplay() const; - void createInputHandlers(); - static void loadKeymapStatic(const QString &filename); - static void switchLangStatic(); EGLDisplay m_display; QPlatformInputContext *m_inputContext; QScopedPointer<QPlatformFontDatabase> m_fontDb; QScopedPointer<QPlatformServices> m_services; QScopedPointer<QFbVtHandler> m_vtHandler; - QEvdevKeyboardManager *m_kbdMgr; + QPointer<QWindow> m_pointerWindow; bool m_disableInputHandlers; }; diff --git a/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp index c96e329816..cf926529c2 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow.cpp @@ -1,46 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfsoffscreenwindow_p.h" #include "qeglfshooks_p.h" #include <QtGui/QOffscreenSurface> -#include <QtEglSupport/private/qeglconvenience_p.h> +#include <QtGui/private/qeglconvenience_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h index 9fdb81efdd..568302d298 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsoffscreenwindow_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSOFFSCREENWINDOW_H #define QEGLFSOFFSCREENWINDOW_H diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp index 8a8e8cd563..c5108be04a 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsscreen.cpp @@ -1,48 +1,13 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include <QtCore/qtextstream.h> #include <QtGui/qwindow.h> +#include <QtGui/private/qguiapplication_p.h> #include <qpa/qwindowsysteminterface.h> #include <qpa/qplatformcursor.h> #ifndef QT_NO_OPENGL -# include <QtPlatformCompositorSupport/private/qopenglcompositor_p.h> +# include <QtOpenGL/private/qopenglcompositor_p.h> #endif #include "qeglfsscreen_p.h" @@ -114,9 +79,9 @@ QDpi QEglFSScreen::logicalDpi() const return qt_egl_device_integration()->logicalDpi(); } -qreal QEglFSScreen::pixelDensity() const +QDpi QEglFSScreen::logicalBaseDpi() const { - return qt_egl_device_integration()->pixelDensity(); + return qt_egl_device_integration()->logicalBaseDpi(); } Qt::ScreenOrientation QEglFSScreen::nativeOrientation() const @@ -149,37 +114,43 @@ void QEglFSScreen::handleCursorMove(const QPoint &pos) #ifndef QT_NO_OPENGL const QOpenGLCompositor *compositor = QOpenGLCompositor::instance(); const QList<QOpenGLCompositorWindow *> windows = compositor->windows(); + QEglFSIntegration *platformIntegration = static_cast<QEglFSIntegration *>(QGuiApplicationPrivate::platformIntegration()); // Generate enter and leave events like a real windowing system would do. if (windows.isEmpty()) return; // First window is always fullscreen. - if (windows.count() == 1) { + if (windows.size() == 1) { QWindow *window = windows[0]->sourceWindow(); - if (m_pointerWindow != window) { - m_pointerWindow = window; + if (platformIntegration->pointerWindow() != window) { + platformIntegration->setPointerWindow(window); QWindowSystemInterface::handleEnterEvent(window, window->mapFromGlobal(pos), pos); } return; } QWindow *enter = nullptr, *leave = nullptr; - for (int i = windows.count() - 1; i >= 0; --i) { + for (int i = windows.size() - 1; i >= 0; --i) { QWindow *window = windows[i]->sourceWindow(); const QRect geom = window->geometry(); if (geom.contains(pos)) { - if (m_pointerWindow != window) { - leave = m_pointerWindow; - m_pointerWindow = window; + if (platformIntegration->pointerWindow() != window) { + leave = platformIntegration->pointerWindow(); + platformIntegration->setPointerWindow(window); enter = window; } break; } } - if (enter && leave) + if (enter && leave) { QWindowSystemInterface::handleEnterLeaveEvent(enter, leave, enter->mapFromGlobal(pos), pos); + } else if (enter) { + QWindowSystemInterface::handleEnterEvent(enter, enter->mapFromGlobal(pos), pos); + } else if (leave) { + QWindowSystemInterface::handleLeaveEvent(leave); + } #else Q_UNUSED(pos); #endif @@ -194,7 +165,8 @@ QPixmap QEglFSScreen::grabWindow(WId wid, int x, int y, int width, int height) c QImage img; - if (static_cast<QEglFSWindow *>(windows.first()->sourceWindow()->handle())->isRaster()) { + QEglFSWindow *primaryWin = static_cast<QEglFSWindow *>(windows.first()->sourceWindow()->handle()); + if (primaryWin->isRaster() || primaryWin->backingStore()) { // Request the compositor to render everything into an FBO and read it back. This // is of course slow, but it's safe and reliable. It will not include the mouse // cursor, which is a plus. @@ -217,7 +189,7 @@ QPixmap QEglFSScreen::grabWindow(WId wid, int x, int y, int width, int height) c return QPixmap::fromImage(img).copy(x, y, width, height); } - foreach (QOpenGLCompositorWindow *w, windows) { + for (QOpenGLCompositorWindow *w : windows) { const QWindow *window = w->sourceWindow(); if (window->winId() == wid) { const QRect geom = window->geometry(); @@ -240,4 +212,22 @@ QPixmap QEglFSScreen::grabWindow(WId wid, int x, int y, int width, int height) c return QPixmap(); } +QWindow *QEglFSScreen::topLevelAt(const QPoint &point) const +{ +#ifndef QT_NO_OPENGL + QOpenGLCompositor *compositor = QOpenGLCompositor::instance(); + const QList<QOpenGLCompositorWindow *> windows = compositor->windows(); + const int windowCount = windows.size(); + + // Higher z-order is at the end of the list + for (int i = windowCount - 1; i >= 0; i--) { + QWindow *window = windows[i]->sourceWindow(); + if (window->isVisible() && window->geometry().contains(point)) + return window; + } +#endif + + return QPlatformScreen::topLevelAt(point); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h index bea7b4c8ef..bbfc9a9259 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfsscreen_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSSCREEN_H #define QEGLFSSCREEN_H @@ -74,7 +38,7 @@ public: QSizeF physicalSize() const override; QDpi logicalDpi() const override; - qreal pixelDensity() const override; + QDpi logicalBaseDpi() const override; Qt::ScreenOrientation nativeOrientation() const override; Qt::ScreenOrientation orientation() const override; @@ -90,11 +54,12 @@ public: void handleCursorMove(const QPoint &pos); + QWindow *topLevelAt(const QPoint &point) const override; + private: void setPrimarySurface(EGLSurface surface); EGLDisplay m_dpy; - QPointer<QWindow> m_pointerWindow; EGLSurface m_surface; QPlatformCursor *m_cursor; diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp index f7e116eb88..306d121cfb 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include <QtCore/qtextstream.h> #include <qpa/qwindowsysteminterface.h> @@ -45,9 +9,9 @@ #ifndef QT_NO_OPENGL # include <QtGui/private/qopenglcontext_p.h> # include <QtGui/QOpenGLContext> -# include <QtPlatformCompositorSupport/private/qopenglcompositorbackingstore_p.h> +# include <QtOpenGL/private/qopenglcompositorbackingstore_p.h> #endif -#include <QtEglSupport/private/qeglconvenience_p.h> +#include <QtGui/private/qeglconvenience_p.h> #include "qeglfswindow_p.h" #ifndef QT_NO_OPENGL @@ -58,6 +22,8 @@ QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(qLcEglDevDebug) + QEglFSWindow::QEglFSWindow(QWindow *w) : QPlatformWindow(w), #ifndef QT_NO_OPENGL @@ -110,12 +76,12 @@ void QEglFSWindow::create() #ifndef QT_NO_OPENGL QOpenGLCompositor *compositor = QOpenGLCompositor::instance(); if (screen->primarySurface() != EGL_NO_SURFACE) { - if (Q_UNLIKELY(!isRaster() || !compositor->targetWindow())) { -#if !defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_EMBEDDED) + if (Q_UNLIKELY(isRaster() != (compositor->targetWindow() != nullptr))) { +# ifndef Q_OS_ANDROID // We can have either a single OpenGL window or multiple raster windows. // Other combinations cannot work. qFatal("EGLFS: OpenGL windows cannot be mixed with others."); -#endif +# endif return; } m_format = compositor->targetWindow()->format(); @@ -137,25 +103,30 @@ void QEglFSWindow::create() screen->setPrimarySurface(m_surface); #ifndef QT_NO_OPENGL - if (isRaster()) { + compositor->setTargetWindow(window(), screen->rawGeometry()); + compositor->setRotation(qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION")); +#endif +} + +void QEglFSWindow::setBackingStore(QOpenGLCompositorBackingStore *backingStore) +{ +#ifndef QT_NO_OPENGL + if (!m_rasterCompositingContext) { m_rasterCompositingContext = new QOpenGLContext; m_rasterCompositingContext->setShareContext(qt_gl_global_share_context()); m_rasterCompositingContext->setFormat(m_format); m_rasterCompositingContext->setScreen(window()->screen()); if (Q_UNLIKELY(!m_rasterCompositingContext->create())) qFatal("EGLFS: Failed to create compositing context"); - compositor->setTarget(m_rasterCompositingContext, window(), screen->rawGeometry()); - compositor->setRotation(qEnvironmentVariableIntValue("QT_QPA_EGLFS_ROTATION")); // If there is a "root" window into which raster and QOpenGLWidget content is // composited, all other contexts must share with its context. - if (!qt_gl_global_share_context()) { + if (!qt_gl_global_share_context()) qt_gl_set_global_share_context(m_rasterCompositingContext); - // What we set up here is in effect equivalent to the application setting - // AA_ShareOpenGLContexts. Set the attribute to be fully consistent. - QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts); - } } -#endif // QT_NO_OPENGL + QOpenGLCompositor *compositor = QOpenGLCompositor::instance(); + compositor->setTargetContext(m_rasterCompositingContext); +#endif + m_backingStore = backingStore; } void QEglFSWindow::destroy() @@ -181,6 +152,8 @@ void QEglFSWindow::destroy() #ifndef QT_NO_OPENGL QOpenGLCompositor::destroy(); + if (qt_gl_global_share_context() == m_rasterCompositingContext) + qt_gl_set_global_share_context(nullptr); delete m_rasterCompositingContext; #endif } @@ -191,8 +164,29 @@ void QEglFSWindow::destroy() void QEglFSWindow::invalidateSurface() { if (m_surface != EGL_NO_SURFACE) { - eglDestroySurface(screen()->display(), m_surface); + qCDebug(qLcEglDevDebug) << Q_FUNC_INFO << " about to destroy EGLSurface: " << m_surface; + + bool ok = eglDestroySurface(screen()->display(), m_surface); + + if (!ok) { + qCWarning(qLcEglDevDebug, "QEglFSWindow::invalidateSurface() eglDestroySurface failed!" + " Follow-up errors or memory leaks are possible." + " eglGetError(): %x", eglGetError()); + } + + if (eglGetCurrentSurface(EGL_READ) == m_surface || + eglGetCurrentSurface(EGL_DRAW) == m_surface) { + bool ok = eglMakeCurrent(eglGetCurrentDisplay(), EGL_NO_DISPLAY, EGL_NO_DISPLAY, EGL_NO_CONTEXT); + qCDebug(qLcEglDevDebug) << Q_FUNC_INFO << " due to eglDestroySurface on *currently* bound surface" + << "we just called eglMakeCurrent(..,0,0,0)! It returned: " << ok; + } + + if (screen()->primarySurface() == m_surface) + screen()->setPrimarySurface(EGL_NO_SURFACE); + + m_surface = EGL_NO_SURFACE; + m_flags = m_flags & ~Created; } qt_egl_device_integration()->destroyNativeWindow(m_window); m_window = 0; @@ -269,7 +263,7 @@ void QEglFSWindow::requestActivateWindow() QOpenGLCompositor::instance()->moveToTop(this); #endif QWindow *wnd = window(); - QWindowSystemInterface::handleWindowActivated(wnd); + QWindowSystemInterface::handleFocusWindowChanged(wnd, Qt::ActiveWindowFocusReason); QWindowSystemInterface::handleExposeEvent(wnd, QRect(QPoint(0, 0), wnd->geometry().size())); } @@ -289,7 +283,7 @@ void QEglFSWindow::lower() #ifndef QT_NO_OPENGL QOpenGLCompositor *compositor = QOpenGLCompositor::instance(); QList<QOpenGLCompositorWindow *> windows = compositor->windows(); - if (window()->type() != Qt::Desktop && windows.count() > 1) { + if (window()->type() != Qt::Desktop && windows.size() > 1) { int idx = windows.indexOf(this); if (idx > 0) { compositor->changeWindowIndex(this, idx - 1); @@ -354,7 +348,7 @@ WId QEglFSWindow::winId() const void QEglFSWindow::setOpacity(qreal) { - if (!isRaster()) + if (!isRaster() && !backingStore()) qWarning("QEglFSWindow: Cannot set opacity for non-raster windows"); // Nothing to do here. The opacity is stored in the QWindow. diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h index be2a0630d3..e51cd69f3d 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow_p.h +++ b/src/plugins/platforms/eglfs/api/qeglfswindow_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSWINDOW_H #define QEGLFSWINDOW_H @@ -57,13 +21,14 @@ #include <qpa/qplatformwindow.h> #ifndef QT_NO_OPENGL -# include <QtPlatformCompositorSupport/private/qopenglcompositor_p.h> +# include <QtOpenGL/private/qopenglcompositor_p.h> #endif QT_BEGIN_NAMESPACE class QOpenGLCompositorBackingStore; class QPlatformTextureList; + #ifndef QT_NO_OPENGL class Q_EGLFS_EXPORT QEglFSWindow : public QPlatformWindow, public QOpenGLCompositorWindow #else @@ -102,12 +67,11 @@ public: void invalidateSurface() override; virtual void resetSurface(); -#ifndef QT_NO_OPENGL - QOpenGLCompositorBackingStore *backingStore() { return m_backingStore; } - void setBackingStore(QOpenGLCompositorBackingStore *backingStore) { m_backingStore = backingStore; } -#endif bool isRaster() const; + #ifndef QT_NO_OPENGL + QOpenGLCompositorBackingStore *backingStore() const override { return m_backingStore; } + void setBackingStore(QOpenGLCompositorBackingStore *backingStore) override; QWindow *sourceWindow() const override; const QPlatformTextureList *textures() const override; void endCompositing() override; diff --git a/src/plugins/platforms/eglfs/cursor.qrc b/src/plugins/platforms/eglfs/cursor.qrc deleted file mode 100644 index 8ea6e86587..0000000000 --- a/src/plugins/platforms/eglfs/cursor.qrc +++ /dev/null @@ -1,7 +0,0 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> - <file>cursor-atlas.png</file> - <file>cursor.json</file> -</qresource> -</RCC> - diff --git a/src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt new file mode 100644 index 0000000000..bb50216f23 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/CMakeLists.txt @@ -0,0 +1,39 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +if(QT_FEATURE_eglfs_x11) + add_subdirectory(eglfs_x11) +endif() +if(QT_FEATURE_eglfs_egldevice OR QT_FEATURE_eglfs_gbm) + add_subdirectory(eglfs_kms_support) +endif() +if(QT_FEATURE_eglfs_gbm) + add_subdirectory(eglfs_kms) +endif() +if(QT_FEATURE_eglfs_egldevice) + add_subdirectory(eglfs_kms_egldevice) +endif() +if(QT_FEATURE_eglfs_vsp2) + # add_subdirectory(eglfs_kms_vsp2) # TODO: QTBUG-112769 +endif() +if(QT_FEATURE_eglfs_brcm) + # add_subdirectory(eglfs_brcm) # TODO: QTBUG-112769 +endif() +if(QT_FEATURE_eglfs_mali) + add_subdirectory(eglfs_mali) +endif() +if(QT_FEATURE_eglfs_viv) + add_subdirectory(eglfs_viv) +endif() +if(QT_FEATURE_eglfs_rcar) + # add_subdirectory(eglfs_rcar) # TODO: QTBUG-112769 +endif() +if(QT_FEATURE_eglfs_viv_wl) + add_subdirectory(eglfs_viv_wl) +endif() +if(QT_FEATURE_eglfs_openwfd) + add_subdirectory(eglfs_openwfd) +endif() +if(QT_FEATURE_opengl) + add_subdirectory(eglfs_emu) +endif() diff --git a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro deleted file mode 100644 index 360536d22f..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro +++ /dev/null @@ -1,17 +0,0 @@ -TEMPLATE = subdirs -QT_FOR_CONFIG += gui-private - -qtConfig(eglfs_x11): SUBDIRS += eglfs_x11 -qtConfig(eglfs_gbm): SUBDIRS *= eglfs_kms_support eglfs_kms -qtConfig(eglfs_egldevice): SUBDIRS *= eglfs_kms_support eglfs_kms_egldevice -qtConfig(eglfs_vsp2): SUBDIRS += eglfs_kms_vsp2 -qtConfig(eglfs_brcm): SUBDIRS += eglfs_brcm -qtConfig(eglfs_mali): SUBDIRS += eglfs_mali -qtConfig(eglfs_viv): SUBDIRS += eglfs_viv -qtConfig(eglfs_rcar): SUBDIRS += eglfs_rcar -qtConfig(eglfs_viv_wl): SUBDIRS += eglfs_viv_wl -qtConfig(eglfs_openwfd): SUBDIRS += eglfs_openwfd -qtConfig(opengl): SUBDIRS += eglfs_emu - -eglfs_kms_egldevice.depends = eglfs_kms_support -eglfs_kms.depends = eglfs_kms_support diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro deleted file mode 100644 index aa487be8c0..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/eglfs_brcm.pro +++ /dev/null @@ -1,22 +0,0 @@ -TARGET = qeglfs-brcm-integration - -QT += core-private gui-private eglfsdeviceintegration-private - -INCLUDEPATH += $$PWD/../../api -CONFIG += egl - -LIBS += -lbcm_host - -# Avoid X11 header collision, use generic EGL native types -DEFINES += QT_EGL_NO_X11 - -SOURCES += $$PWD/qeglfsbrcmmain.cpp \ - $$PWD/qeglfsbrcmintegration.cpp - -HEADERS += $$PWD/qeglfsbrcmintegration.h - -OTHER_FILES += $$PWD/eglfs_brcm.json - -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSBrcmIntegrationPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp index 4e811a1dfe..8dd3eb8681 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfsbrcmintegration.h" #include <bcm_host.h> @@ -127,7 +91,7 @@ QSize QEglFSBrcmIntegration::screenSize() const EGLNativeWindowType QEglFSBrcmIntegration::createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format) { - Q_UNUSED(window) + Q_UNUSED(window); return createDispmanxLayer(QPoint(0, 0), size, 1, format.hasAlpha() ? DISPMANX_FLAGS_ALPHA_FROM_SOURCE : DISPMANX_FLAGS_ALPHA_FIXED_ALL_PIXELS); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.h index 83bcc487af..1cd4bfd672 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmintegration.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSBRCMINTEGRATION_H #define QEGLFSBRCMINTEGRATION_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmmain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmmain.cpp index fd6665e560..58028d37d1 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmmain.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_brcm/qeglfsbrcmmain.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "private/qeglfsdeviceintegration_p.h" #include "qeglfsbrcmintegration.h" diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/CMakeLists.txt new file mode 100644 index 0000000000..fa744be033 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/CMakeLists.txt @@ -0,0 +1,25 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +##################################################################### +## QEglFSEmulatorIntegrationPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QEglFSEmulatorIntegrationPlugin + OUTPUT_NAME qeglfs-emu-integration + PLUGIN_TYPE egldeviceintegrations + SOURCES + qeglfsemulatorintegration.cpp qeglfsemulatorintegration.h + qeglfsemulatorscreen.cpp qeglfsemulatorscreen.h + qeglfsemumain.cpp + DEFINES + QT_EGL_NO_X11 + INCLUDE_DIRECTORIES + ../../api + LIBRARIES + Qt::Core + Qt::CorePrivate + Qt::EglFSDeviceIntegrationPrivate + Qt::Gui + Qt::GuiPrivate +) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/eglfs_emu.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/eglfs_emu.pro deleted file mode 100644 index 609f04e8a9..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/eglfs_emu.pro +++ /dev/null @@ -1,27 +0,0 @@ -TARGET = qeglfs-emu-integration - -QT += core-private gui-private eglfsdeviceintegration-private - -INCLUDEPATH += $$PWD/../../api -CONFIG += egl - -# Avoid X11 header collision -DEFINES += QT_EGL_NO_X11 - -OTHER_FILES += $$PWD/eglfs_emu.json - -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSEmulatorIntegrationPlugin -load(qt_plugin) - -DISTFILES += \ - eglfs_emu.json - -SOURCES += \ - qeglfsemumain.cpp \ - qeglfsemulatorintegration.cpp \ - qeglfsemulatorscreen.cpp - -HEADERS += \ - qeglfsemulatorintegration.h \ - qeglfsemulatorscreen.h diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.cpp index cb7844aff0..a63aafa242 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.cpp @@ -1,49 +1,13 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfsemulatorintegration.h" #include "qeglfsemulatorscreen.h" #include "private/qeglfsintegration_p.h" #include <private/qguiapplication_p.h> -#include <QtEglSupport/private/qeglconvenience_p.h> -#include <QtEglSupport/private/qeglplatformcontext_p.h> +#include <QtGui/private/qeglconvenience_p.h> +#include <QtGui/private/qeglplatformcontext_p.h> #include <qpa/qwindowsysteminterface.h> @@ -129,7 +93,7 @@ EGLNativeWindowType QEglFSEmulatorIntegration::createNativeWindow(QPlatformWindo // Let the emulator know which screen the window surface is attached to setDisplay(screen->id()); } - static QBasicAtomicInt uniqueWindowId = Q_BASIC_ATOMIC_INITIALIZER(0); + Q_CONSTINIT static QBasicAtomicInt uniqueWindowId = Q_BASIC_ATOMIC_INITIALIZER(0); return EGLNativeWindowType(qintptr(1 + uniqueWindowId.fetchAndAddRelaxed(1))); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.h index be5524cba3..24bda7b9ca 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorintegration.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSEMULATORINTEGRATION_H #define QEGLFSEMULATORINTEGRATION_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp index 7654034f85..ff2f966477 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.cpp @@ -1,46 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfsemulatorscreen.h" QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + QEglFSEmulatorScreen::QEglFSEmulatorScreen(const QJsonObject &screenDescription) : QEglFSScreen(eglGetDisplay(EGL_DEFAULT_DISPLAY)) , m_id(0) @@ -75,19 +41,12 @@ QSizeF QEglFSEmulatorScreen::physicalSize() const QDpi QEglFSEmulatorScreen::logicalDpi() const { - const QSizeF ps = m_physicalSize; - const QSize s = m_geometry.size(); - - if (!ps.isEmpty() && !s.isEmpty()) - return QDpi(25.4 * s.width() / ps.width(), - 25.4 * s.height() / ps.height()); - else - return QDpi(100, 100); + return logicalBaseDpi(); } -qreal QEglFSEmulatorScreen::pixelDensity() const +QDpi QEglFSEmulatorScreen::logicalBaseDpi() const { - return m_pixelDensity; + return QDpi(100, 100); } qreal QEglFSEmulatorScreen::refreshRate() const @@ -119,63 +78,60 @@ void QEglFSEmulatorScreen::initFromJsonObject(const QJsonObject &description) { QJsonValue value; - value = description.value(QLatin1String("id")); + value = description.value("id"_L1); if (!value.isUndefined() && value.isDouble()) m_id = value.toInt(); - value = description.value(QLatin1String("description")); + value = description.value("description"_L1); if (!value.isUndefined() && value.isString()) m_description = value.toString(); - value = description.value(QLatin1String("geometry")); + value = description.value("geometry"_L1); if (!value.isUndefined() && value.isObject()) { QJsonObject geometryObject = value.toObject(); - value = geometryObject.value(QLatin1String("x")); + value = geometryObject.value("x"_L1); if (!value.isUndefined() && value.isDouble()) m_geometry.setX(value.toInt()); - value = geometryObject.value(QLatin1String("y")); + value = geometryObject.value("y"_L1); if (!value.isUndefined() && value.isDouble()) m_geometry.setY(value.toInt()); - value = geometryObject.value(QLatin1String("width")); + value = geometryObject.value("width"_L1); if (!value.isUndefined() && value.isDouble()) m_geometry.setWidth(value.toInt()); - value = geometryObject.value(QLatin1String("height")); + value = geometryObject.value("height"_L1); if (!value.isUndefined() && value.isDouble()) m_geometry.setHeight(value.toInt()); } - value = description.value(QLatin1String("depth")); + value = description.value("depth"_L1); if (!value.isUndefined() && value.isDouble()) m_depth = value.toInt(); - value = description.value(QLatin1String("format")); + value = description.value("format"_L1); if (!value.isUndefined() && value.isDouble()) m_format = static_cast<QImage::Format>(value.toInt()); - value = description.value(QLatin1String("physicalSize")); + value = description.value("physicalSize"_L1); if (!value.isUndefined() && value.isObject()) { QJsonObject physicalSizeObject = value.toObject(); - value = physicalSizeObject.value(QLatin1String("width")); + value = physicalSizeObject.value("width"_L1); if (!value.isUndefined() && value.isDouble()) m_physicalSize.setWidth(value.toInt()); - value = physicalSizeObject.value(QLatin1String("height")); + value = physicalSizeObject.value("height"_L1); if (!value.isUndefined() && value.isDouble()) m_physicalSize.setHeight(value.toInt()); } - value = description.value(QLatin1String("pixelDensity")); - if (!value.isUndefined() && value.isDouble()) - m_pixelDensity = value.toDouble(); - value = description.value(QLatin1String("refreshRate")); + value = description.value("refreshRate"_L1); if (!value.isUndefined() && value.isDouble()) m_refreshRate = value.toDouble(); - value = description.value(QLatin1String("nativeOrientation")); + value = description.value("nativeOrientation"_L1); if (!value.isUndefined() && value.isDouble()) m_nativeOrientation = static_cast<Qt::ScreenOrientation>(value.toInt()); - value = description.value(QLatin1String("orientation")); + value = description.value("orientation"_L1); if (!value.isUndefined() && value.isDouble()) m_orientation = static_cast<Qt::ScreenOrientation>(value.toInt()); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.h index c4994720fa..570a14079c 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemulatorscreen.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSEMULATORSCREEN_H #define QEGLFSEMULATORSCREEN_H @@ -58,7 +22,7 @@ public: QImage::Format format() const override; QSizeF physicalSize() const override; QDpi logicalDpi() const override; - qreal pixelDensity() const override; + QDpi logicalBaseDpi() const override; qreal refreshRate() const override; Qt::ScreenOrientation nativeOrientation() const override; Qt::ScreenOrientation orientation() const override; @@ -74,7 +38,6 @@ private: int m_depth; QImage::Format m_format; QSizeF m_physicalSize; - float m_pixelDensity; float m_refreshRate; Qt::ScreenOrientation m_nativeOrientation; Qt::ScreenOrientation m_orientation; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemumain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemumain.cpp index a9923851ef..22fe6ad40f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemumain.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_emu/qeglfsemumain.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "private/qeglfsdeviceintegration_p.h" #include "qeglfsemulatorintegration.h" diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/CMakeLists.txt new file mode 100644 index 0000000000..9f9d315202 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/CMakeLists.txt @@ -0,0 +1,49 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +##################################################################### +## EglFsKmsGbmSupportPrivate Module: +##################################################################### + +qt_internal_add_module(EglFsKmsGbmSupportPrivate + CONFIG_MODULE_NAME eglfs_kms_gbm_support + INTERNAL_MODULE + SOURCES + qeglfskmsgbmcursor.cpp qeglfskmsgbmcursor_p.h + qeglfskmsgbmdevice.cpp qeglfskmsgbmdevice_p.h + qeglfskmsgbmintegration.cpp qeglfskmsgbmintegration_p.h + qeglfskmsgbmscreen.cpp qeglfskmsgbmscreen_p.h + qeglfskmsgbmwindow.cpp qeglfskmsgbmwindow_p.h + DEFINES + QT_EGL_NO_X11 + PUBLIC_LIBRARIES + Libdrm::Libdrm + Qt::CorePrivate + Qt::EglFSDeviceIntegrationPrivate + Qt::EglFsKmsSupportPrivate + Qt::GuiPrivate + Qt::KmsSupportPrivate + gbm::gbm + NO_GENERATE_CPP_EXPORTS +) +##################################################################### +## QEglFSKmsGbmIntegrationPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QEglFSKmsGbmIntegrationPlugin + OUTPUT_NAME qeglfs-kms-integration + PLUGIN_TYPE egldeviceintegrations + SOURCES + qeglfskmsgbmmain.cpp + DEFINES + QT_EGL_NO_X11 + LIBRARIES + Libdrm::Libdrm + Qt::CorePrivate + Qt::EglFSDeviceIntegrationPrivate + Qt::EglFsKmsGbmSupportPrivate + Qt::EglFsKmsSupportPrivate + Qt::GuiPrivate + Qt::KmsSupportPrivate + gbm::gbm +) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro deleted file mode 100644 index f5c2c0ed89..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/eglfs_kms.pro +++ /dev/null @@ -1,30 +0,0 @@ -TARGET = qeglfs-kms-integration - -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSKmsGbmIntegrationPlugin -load(qt_plugin) - -QT += core-private gui-private eglfsdeviceintegration-private eglfs_kms_support-private kms_support-private edid_support-private - -INCLUDEPATH += $$PWD/../../api $$PWD/../eglfs_kms_support - -# Avoid X11 header collision, use generic EGL native types -DEFINES += QT_EGL_NO_X11 - -QMAKE_USE += gbm drm -CONFIG += egl - -SOURCES += $$PWD/qeglfskmsgbmmain.cpp \ - $$PWD/qeglfskmsgbmintegration.cpp \ - $$PWD/qeglfskmsgbmdevice.cpp \ - $$PWD/qeglfskmsgbmscreen.cpp \ - $$PWD/qeglfskmsgbmcursor.cpp \ - $$PWD/qeglfskmsgbmwindow.cpp - -HEADERS += $$PWD/qeglfskmsgbmintegration.h \ - $$PWD/qeglfskmsgbmdevice.h \ - $$PWD/qeglfskmsgbmscreen.h \ - $$PWD/qeglfskmsgbmcursor.h \ - $$PWD/qeglfskmsgbmwindow.h - -OTHER_FILES += $$PWD/eglfs_kms.json diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp index dc98cdce4b..d171715e72 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp @@ -1,48 +1,13 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qeglfskmsgbmcursor.h" -#include "qeglfskmsgbmscreen.h" -#include "qeglfskmsgbmdevice.h" +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only +#include "qeglfskmsgbmcursor_p.h" +#include "qeglfskmsgbmscreen_p.h" +#include "qeglfskmsgbmdevice_p.h" + +#include <QtCore/QFile> #include <QtCore/QJsonDocument> #include <QtCore/QJsonObject> #include <QtCore/QJsonArray> @@ -63,6 +28,8 @@ QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug) QEglFSKmsGbmCursor::QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen) @@ -111,7 +78,7 @@ QEglFSKmsGbmCursor::~QEglFSKmsGbmCursor() { delete m_deviceListener; - Q_FOREACH (QPlatformScreen *screen, m_screen->virtualSiblings()) { + for (QPlatformScreen *screen : m_screen->virtualSiblings()) { QEglFSKmsScreen *kmsScreen = static_cast<QEglFSKmsScreen *>(screen); drmModeSetCursor(kmsScreen->device()->fd(), kmsScreen->output().crtc_id, 0, 0, 0); drmModeMoveCursor(kmsScreen->device()->fd(), kmsScreen->output().crtc_id, 0, 0); @@ -150,7 +117,7 @@ void QEglFSKmsGbmCursorDeviceListener::onDeviceListChanged(QInputDeviceManager:: void QEglFSKmsGbmCursor::pointerEvent(const QMouseEvent &event) { - setPos(event.screenPos().toPoint()); + setPos(event.globalPosition().toPoint()); } #ifndef QT_NO_CURSOR @@ -163,7 +130,7 @@ void QEglFSKmsGbmCursor::changeCursor(QCursor *windowCursor, QWindow *window) if (m_state == CursorPendingHidden) { m_state = CursorHidden; - Q_FOREACH (QPlatformScreen *screen, m_screen->virtualSiblings()) { + for (QPlatformScreen *screen : m_screen->virtualSiblings()) { QEglFSKmsScreen *kmsScreen = static_cast<QEglFSKmsScreen *>(screen); drmModeSetCursor(kmsScreen->device()->fd(), kmsScreen->output().crtc_id, 0, 0, 0); } @@ -212,7 +179,7 @@ void QEglFSKmsGbmCursor::changeCursor(QCursor *windowCursor, QWindow *window) if (m_state == CursorPendingVisible) m_state = CursorVisible; - Q_FOREACH (QPlatformScreen *screen, m_screen->virtualSiblings()) { + for (QPlatformScreen *screen : m_screen->virtualSiblings()) { QEglFSKmsScreen *kmsScreen = static_cast<QEglFSKmsScreen *>(screen); if (kmsScreen->isCursorOutOfRange()) continue; @@ -231,7 +198,7 @@ QPoint QEglFSKmsGbmCursor::pos() const void QEglFSKmsGbmCursor::setPos(const QPoint &pos) { - Q_FOREACH (QPlatformScreen *screen, m_screen->virtualSiblings()) { + for (QPlatformScreen *screen : m_screen->virtualSiblings()) { QEglFSKmsScreen *kmsScreen = static_cast<QEglFSKmsScreen *>(screen); const QRect screenGeom = kmsScreen->geometry(); const QPoint origin = screenGeom.topLeft(); @@ -247,7 +214,7 @@ void QEglFSKmsGbmCursor::setPos(const QPoint &pos) } } else { int ret; - if (kmsScreen->isCursorOutOfRange()) { + if (kmsScreen->isCursorOutOfRange() && m_bo) { kmsScreen->setCursorOutOfRange(false); uint32_t handle = gbm_bo_get_handle(m_bo).u32; ret = drmModeSetCursor(kmsScreen->device()->fd(), kmsScreen->output().crtc_id, @@ -276,7 +243,7 @@ void QEglFSKmsGbmCursor::initCursorAtlas() QFile file(QString::fromUtf8(json)); if (!file.open(QFile::ReadOnly)) { - Q_FOREACH (QPlatformScreen *screen, m_screen->virtualSiblings()) { + for (QPlatformScreen *screen : m_screen->virtualSiblings()) { QEglFSKmsScreen *kmsScreen = static_cast<QEglFSKmsScreen *>(screen); drmModeSetCursor(kmsScreen->device()->fd(), kmsScreen->output().crtc_id, 0, 0, 0); drmModeMoveCursor(kmsScreen->device()->fd(), kmsScreen->output().crtc_id, 0, 0); @@ -288,14 +255,14 @@ void QEglFSKmsGbmCursor::initCursorAtlas() QJsonDocument doc = QJsonDocument::fromJson(file.readAll()); QJsonObject object = doc.object(); - QString atlas = object.value(QLatin1String("image")).toString(); + QString atlas = object.value("image"_L1).toString(); Q_ASSERT(!atlas.isEmpty()); - const int cursorsPerRow = object.value(QLatin1String("cursorsPerRow")).toDouble(); + const int cursorsPerRow = object.value("cursorsPerRow"_L1).toDouble(); Q_ASSERT(cursorsPerRow); m_cursorAtlas.cursorsPerRow = cursorsPerRow; - const QJsonArray hotSpots = object.value(QLatin1String("hotSpots")).toArray(); + const QJsonArray hotSpots = object.value("hotSpots"_L1).toArray(); Q_ASSERT(hotSpots.count() == Qt::LastCursor + 1); for (int i = 0; i < hotSpots.count(); i++) { QPoint hotSpot(hotSpots[i].toArray()[0].toDouble(), hotSpots[i].toArray()[1].toDouble()); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h deleted file mode 100644 index 5d2dfedba2..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEGLFSKMSGBMCURSOR_H -#define QEGLFSKMSGBMCURSOR_H - -#include <qpa/qplatformcursor.h> -#include <QtCore/QVector> -#include <QtGui/QImage> -#include <QtGui/private/qinputdevicemanager_p.h> - -#include <gbm.h> - -QT_BEGIN_NAMESPACE - -class QEglFSKmsGbmScreen; -class QEglFSKmsGbmCursor; - -class QEglFSKmsGbmCursorDeviceListener : public QObject -{ - Q_OBJECT - -public: - QEglFSKmsGbmCursorDeviceListener(QEglFSKmsGbmCursor *cursor) : m_cursor(cursor) { } - bool hasMouse() const; - -public slots: - void onDeviceListChanged(QInputDeviceManager::DeviceType type); - -private: - QEglFSKmsGbmCursor *m_cursor; -}; - -class QEglFSKmsGbmCursor : public QPlatformCursor -{ - Q_OBJECT - -public: - QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen); - ~QEglFSKmsGbmCursor(); - - // input methods - void pointerEvent(const QMouseEvent & event) override; -#ifndef QT_NO_CURSOR - void changeCursor(QCursor * windowCursor, QWindow * window) override; -#endif - QPoint pos() const override; - void setPos(const QPoint &pos) override; - - void updateMouseStatus(); - - void reevaluateVisibilityForScreens() { setPos(pos()); } - -private: - void initCursorAtlas(); - - enum CursorState { - CursorDisabled, - CursorPendingHidden, - CursorHidden, - CursorPendingVisible, - CursorVisible - }; - - QEglFSKmsGbmScreen *m_screen; - QSize m_cursorSize; - gbm_bo *m_bo; - QPoint m_pos; - QPlatformCursorImage m_cursorImage; - CursorState m_state; - QEglFSKmsGbmCursorDeviceListener *m_deviceListener; - - // cursor atlas information - struct CursorAtlas { - CursorAtlas() : cursorsPerRow(0), cursorWidth(0), cursorHeight(0) { } - int cursorsPerRow; - int width, height; // width and height of the atlas - int cursorWidth, cursorHeight; // width and height of cursors inside the atlas - QVector<QPoint> hotSpots; - QImage image; - } m_cursorAtlas; -}; - -QT_END_NAMESPACE - -#endif // QEGLFSKMSGBMCURSOR_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor_p.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor_p.h new file mode 100644 index 0000000000..a0f78bb310 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor_p.h @@ -0,0 +1,97 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEGLFSKMSGBMCURSOR_H +#define QEGLFSKMSGBMCURSOR_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <qpa/qplatformcursor.h> +#include <QtCore/QList> +#include <QtGui/QImage> +#include <QtGui/private/qinputdevicemanager_p.h> + +#include <gbm.h> + +QT_BEGIN_NAMESPACE + +class QEglFSKmsGbmScreen; +class QEglFSKmsGbmCursor; + +class QEglFSKmsGbmCursorDeviceListener : public QObject +{ + Q_OBJECT + +public: + QEglFSKmsGbmCursorDeviceListener(QEglFSKmsGbmCursor *cursor) : m_cursor(cursor) { } + bool hasMouse() const; + +public slots: + void onDeviceListChanged(QInputDeviceManager::DeviceType type); + +private: + QEglFSKmsGbmCursor *m_cursor; +}; + +class QEglFSKmsGbmCursor : public QPlatformCursor +{ + Q_OBJECT + +public: + QEglFSKmsGbmCursor(QEglFSKmsGbmScreen *screen); + ~QEglFSKmsGbmCursor(); + + // input methods + void pointerEvent(const QMouseEvent & event) override; +#ifndef QT_NO_CURSOR + void changeCursor(QCursor * windowCursor, QWindow * window) override; +#endif + QPoint pos() const override; + void setPos(const QPoint &pos) override; + + void updateMouseStatus(); + + void reevaluateVisibilityForScreens() { setPos(pos()); } + +private: + void initCursorAtlas(); + + enum CursorState { + CursorDisabled, + CursorPendingHidden, + CursorHidden, + CursorPendingVisible, + CursorVisible + }; + + QEglFSKmsGbmScreen *m_screen; + QSize m_cursorSize; + gbm_bo *m_bo; + QPoint m_pos; + QPlatformCursorImage m_cursorImage; + CursorState m_state; + QEglFSKmsGbmCursorDeviceListener *m_deviceListener; + + // cursor atlas information + struct CursorAtlas { + CursorAtlas() : cursorsPerRow(0), cursorWidth(0), cursorHeight(0) { } + int cursorsPerRow; + int width, height; // width and height of the atlas + int cursorWidth, cursorHeight; // width and height of cursors inside the atlas + QList<QPoint> hotSpots; + QImage image; + } m_cursorAtlas; +}; + +QT_END_NAMESPACE + +#endif // QEGLFSKMSGBMCURSOR_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp index 503419cf91..89479fc250 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp @@ -1,48 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qeglfskmsgbmdevice.h" -#include "qeglfskmsgbmscreen.h" - -#include "qeglfsintegration_p.h" +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qeglfskmsgbmdevice_p.h" +#include "qeglfskmsgbmscreen_p.h" + +#include <private/qeglfsintegration_p.h> #include <QtCore/QLoggingCategory> #include <QtCore/private/qcore_unix_p.h> @@ -83,7 +47,13 @@ bool QEglFSKmsGbmDevice::open() setFd(fd); - m_eventReader.create(this); + if (usesEventReader()) { + qCDebug(qLcEglfsKmsDebug, "Using dedicated drm event reading thread"); + m_eventReader.create(this); + } else { + qCDebug(qLcEglfsKmsDebug, "Not using dedicated drm event reading thread; " + "threaded multi-screen setups may experience problems"); + } return true; } @@ -92,7 +62,8 @@ void QEglFSKmsGbmDevice::close() { // Note: screens are gone at this stage. - m_eventReader.destroy(); + if (usesEventReader()) + m_eventReader.destroy(); if (m_gbm_device) { gbm_device_destroy(m_gbm_device); @@ -131,14 +102,19 @@ void QEglFSKmsGbmDevice::destroyGlobalCursor() } } -QPlatformScreen *QEglFSKmsGbmDevice::createScreen(const QKmsOutput &output) +void QEglFSKmsGbmDevice::createGlobalCursor(QEglFSKmsGbmScreen *screen) { - QEglFSKmsGbmScreen *screen = new QEglFSKmsGbmScreen(this, output, false); - if (!m_globalCursor && screenConfig()->hwCursor()) { qCDebug(qLcEglfsKmsDebug, "Creating new global GBM mouse cursor"); m_globalCursor = new QEglFSKmsGbmCursor(screen); } +} + +QPlatformScreen *QEglFSKmsGbmDevice::createScreen(const QKmsOutput &output) +{ + QEglFSKmsGbmScreen *screen = new QEglFSKmsGbmScreen(this, output, false); + + createGlobalCursor(screen); return screen; } @@ -150,7 +126,7 @@ QPlatformScreen *QEglFSKmsGbmDevice::createHeadlessScreen() void QEglFSKmsGbmDevice::registerScreenCloning(QPlatformScreen *screen, QPlatformScreen *screenThisScreenClones, - const QVector<QPlatformScreen *> &screensCloningThisScreen) + const QList<QPlatformScreen *> &screensCloningThisScreen) { if (!screenThisScreenClones && screensCloningThisScreen.isEmpty()) return; @@ -169,4 +145,10 @@ void QEglFSKmsGbmDevice::registerScreen(QPlatformScreen *screen, m_globalCursor->reevaluateVisibilityForScreens(); } +bool QEglFSKmsGbmDevice::usesEventReader() const +{ + static const bool eventReaderThreadDisabled = qEnvironmentVariableIntValue("QT_QPA_EGLFS_KMS_NO_EVENT_READER_THREAD"); + return !eventReaderThreadDisabled; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h deleted file mode 100644 index f1476f8ffa..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEGLFSKMSGBMDEVICE_H -#define QEGLFSKMSGBMDEVICE_H - -#include "qeglfskmsgbmcursor.h" -#include <qeglfskmsdevice.h> - -#include <gbm.h> - -QT_BEGIN_NAMESPACE - -class QEglFSKmsScreen; - -class QEglFSKmsGbmDevice: public QEglFSKmsDevice -{ -public: - QEglFSKmsGbmDevice(QKmsScreenConfig *screenConfig, const QString &path); - - bool open() override; - void close() override; - - void *nativeDisplay() const override; - gbm_device *gbmDevice() const; - - QPlatformCursor *globalCursor() const; - void destroyGlobalCursor(); - - QPlatformScreen *createScreen(const QKmsOutput &output) override; - QPlatformScreen *createHeadlessScreen() override; - void registerScreenCloning(QPlatformScreen *screen, - QPlatformScreen *screenThisScreenClones, - const QVector<QPlatformScreen *> &screensCloningThisScreen) override; - void registerScreen(QPlatformScreen *screen, - bool isPrimary, - const QPoint &virtualPos, - const QList<QPlatformScreen *> &virtualSiblings) override; - -private: - Q_DISABLE_COPY(QEglFSKmsGbmDevice) - - gbm_device *m_gbm_device; - - QEglFSKmsGbmCursor *m_globalCursor; -}; - -QT_END_NAMESPACE - -#endif // QEGLFSKMSGBMDEVICE_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice_p.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice_p.h new file mode 100644 index 0000000000..e00992ed29 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice_p.h @@ -0,0 +1,68 @@ +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEGLFSKMSGBMDEVICE_H +#define QEGLFSKMSGBMDEVICE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "qeglfskmsgbmcursor_p.h" +#include <private/qeglfskmsdevice_p.h> +#include <private/qeglfskmseventreader_p.h> + +#include <gbm.h> + +QT_BEGIN_NAMESPACE + +class QEglFSKmsScreen; + +class Q_EGLFS_EXPORT QEglFSKmsGbmDevice: public QEglFSKmsDevice +{ +public: + QEglFSKmsGbmDevice(QKmsScreenConfig *screenConfig, const QString &path); + + bool open() override; + void close() override; + + void *nativeDisplay() const override; + gbm_device *gbmDevice() const; + + QPlatformCursor *globalCursor() const; + void destroyGlobalCursor(); + void createGlobalCursor(QEglFSKmsGbmScreen *screen); + + QPlatformScreen *createScreen(const QKmsOutput &output) override; + QPlatformScreen *createHeadlessScreen() override; + void registerScreenCloning(QPlatformScreen *screen, + QPlatformScreen *screenThisScreenClones, + const QList<QPlatformScreen *> &screensCloningThisScreen) override; + void registerScreen(QPlatformScreen *screen, + bool isPrimary, + const QPoint &virtualPos, + const QList<QPlatformScreen *> &virtualSiblings) override; + + bool usesEventReader() const; + QEglFSKmsEventReader *eventReader() { return &m_eventReader; } + +private: + Q_DISABLE_COPY(QEglFSKmsGbmDevice) + + gbm_device *m_gbm_device; + QEglFSKmsEventReader m_eventReader; + QEglFSKmsGbmCursor *m_globalCursor; +}; + +QT_END_NAMESPACE + +#endif // QEGLFSKMSGBMDEVICE_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp index caa1187b40..05ffb3b212 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp @@ -1,49 +1,13 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qeglfskmsgbmintegration.h" -#include "qeglfskmsgbmdevice.h" -#include "qeglfskmsgbmscreen.h" -#include "qeglfskmsgbmcursor.h" -#include "qeglfskmsgbmwindow.h" +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qeglfskmsgbmintegration_p.h" +#include "qeglfskmsgbmdevice_p.h" +#include "qeglfskmsgbmscreen_p.h" +#include "qeglfskmsgbmcursor_p.h" +#include "qeglfskmsgbmwindow_p.h" #include "private/qeglfscursor_p.h" #include <QtCore/QLoggingCategory> diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.h deleted file mode 100644 index 71f232abf9..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.h +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEGLFSKMSGBMINTEGRATION_H -#define QEGLFSKMSGBMINTEGRATION_H - -#include "qeglfskmsintegration.h" -#include <QtCore/QMap> -#include <QtCore/QVariant> - -QT_BEGIN_NAMESPACE - -class QEglFSKmsDevice; - -class QEglFSKmsGbmIntegration : public QEglFSKmsIntegration -{ -public: - QEglFSKmsGbmIntegration(); - - EGLDisplay createDisplay(EGLNativeDisplayType nativeDisplay) override; - EGLNativeWindowType createNativeOffscreenWindow(const QSurfaceFormat &format) override; - void destroyNativeWindow(EGLNativeWindowType window) override; - - QPlatformCursor *createCursor(QPlatformScreen *screen) const override; - void presentBuffer(QPlatformSurface *surface) override; - QEglFSWindow *createWindow(QWindow *window) const override; - -protected: - QKmsDevice *createDevice() override; - -private: -}; - -QT_END_NAMESPACE - -#endif // QEGLFSKMSGBMINTEGRATION_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration_p.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration_p.h new file mode 100644 index 0000000000..fb118438d2 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration_p.h @@ -0,0 +1,49 @@ +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEGLFSKMSGBMINTEGRATION_H +#define QEGLFSKMSGBMINTEGRATION_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <private/qeglfskmsintegration_p.h> +#include <QtCore/QMap> +#include <QtCore/QVariant> + +QT_BEGIN_NAMESPACE + +class QEglFSKmsDevice; + +class Q_EGLFS_EXPORT QEglFSKmsGbmIntegration : public QEglFSKmsIntegration +{ +public: + QEglFSKmsGbmIntegration(); + + EGLDisplay createDisplay(EGLNativeDisplayType nativeDisplay) override; + EGLNativeWindowType createNativeOffscreenWindow(const QSurfaceFormat &format) override; + void destroyNativeWindow(EGLNativeWindowType window) override; + + QPlatformCursor *createCursor(QPlatformScreen *screen) const override; + void presentBuffer(QPlatformSurface *surface) override; + QEglFSWindow *createWindow(QWindow *window) const override; + +protected: + QKmsDevice *createDevice() override; + +private: +}; + +QT_END_NAMESPACE + +#endif // QEGLFSKMSGBMINTEGRATION_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmmain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmmain.cpp index 945c8b4255..9d6a694f03 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmmain.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmmain.cpp @@ -1,45 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "private/qeglfsdeviceintegration_p.h" -#include "qeglfskmsgbmintegration.h" +#include "qeglfskmsgbmintegration_p.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp index 6f5c3b6953..8dcfed04db 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp @@ -1,48 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qeglfskmsgbmscreen.h" -#include "qeglfskmsgbmdevice.h" -#include "qeglfskmsgbmcursor.h" -#include "qeglfsintegration_p.h" +// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qeglfskmsgbmscreen_p.h" +#include "qeglfskmsgbmdevice_p.h" +#include "qeglfskmsgbmcursor_p.h" +#include <private/qeglfsintegration_p.h> #include <QtCore/QLoggingCategory> @@ -56,6 +20,8 @@ QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug) +QMutex QEglFSKmsGbmScreen::m_nonThreadedFlipMutex; + static inline uint32_t drmFormatToGbmFormat(uint32_t drmFormat) { Q_ASSERT(DRM_FORMAT_XRGB8888 == GBM_FORMAT_XRGB8888); @@ -95,8 +61,9 @@ QEglFSKmsGbmScreen::FrameBuffer *QEglFSKmsGbmScreen::framebufferForBufferObject( uint32_t offsets[4] = { 0 }; uint32_t pixelFormat = gbmFormatToDrmFormat(gbm_bo_get_format(bo)); - QScopedPointer<FrameBuffer> fb(new FrameBuffer); - qCDebug(qLcEglfsKmsDebug, "Adding FB, size %ux%u, DRM format 0x%x", width, height, pixelFormat); + auto fb = std::make_unique<FrameBuffer>(); + qCDebug(qLcEglfsKmsDebug, "Adding FB, size %ux%u, DRM format 0x%x, stride %u, handle %u", + width, height, pixelFormat, strides[0], handles[0]); int ret = drmModeAddFB2(device()->fd(), width, height, pixelFormat, handles, strides, offsets, &fb->fb, 0); @@ -106,8 +73,9 @@ QEglFSKmsGbmScreen::FrameBuffer *QEglFSKmsGbmScreen::framebufferForBufferObject( return nullptr; } - gbm_bo_set_user_data(bo, fb.data(), bufferDestroyedHandler); - return fb.take(); + auto res = fb.get(); + gbm_bo_set_user_data(bo, fb.release(), bufferDestroyedHandler); + return res; } QEglFSKmsGbmScreen::QEglFSKmsGbmScreen(QEglFSKmsDevice *device, const QKmsOutput &output, bool headless) @@ -169,36 +137,63 @@ gbm_surface *QEglFSKmsGbmScreen::createSurface(EGLConfig eglConfig) rawGeometry().width(), rawGeometry().height(), native_format, - GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); + gbmFlags()); if (m_gbm_surface) m_output.drm_format = gbmFormatToDrmFormat(native_format); } } + const uint32_t gbmFormat = drmFormatToGbmFormat(m_output.drm_format); + // Fallback for older drivers, and when "format" is explicitly specified // in the output config. (not guaranteed that the requested format works // of course, but do what we are told to) if (!m_gbm_surface) { - uint32_t gbmFormat = drmFormatToGbmFormat(m_output.drm_format); if (queryFromEgl) qCDebug(qLcEglfsKmsDebug, "Could not create surface with EGL_NATIVE_VISUAL_ID, falling back to format %x", gbmFormat); m_gbm_surface = gbm_surface_create(gbmDevice, rawGeometry().width(), rawGeometry().height(), gbmFormat, - GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); + gbmFlags()); + } + + // Fallback for some drivers, its required to request with modifiers + if (!m_gbm_surface) { + uint64_t modifier = DRM_FORMAT_MOD_LINEAR; + + m_gbm_surface = gbm_surface_create_with_modifiers(gbmDevice, + rawGeometry().width(), + rawGeometry().height(), + gbmFormat, + &modifier, 1); } + // Fail here, as it would fail with the next usage of the GBM surface, which is very unexpected + if (!m_gbm_surface) + qFatal("Could not create GBM surface!"); } return m_gbm_surface; // not owned, gets destroyed in QEglFSKmsGbmIntegration::destroyNativeWindow() via QEglFSKmsGbmWindow::invalidateSurface() } void QEglFSKmsGbmScreen::resetSurface() { + m_flipPending = false; // not necessarily true but enough to keep bo_next + m_gbm_bo_current = nullptr; m_gbm_surface = nullptr; + + // Leave m_gbm_bo_next untouched. waitForFlip() should + // still do its work, when called. Otherwise we end up + // in device-is-busy errors if there is a new QWindow + // created afterwards. (QTBUG-122663) + + // If not using atomic, will need a new drmModeSetCrtc if a new window + // gets created later on (and so there's a new fb). + if (!device()->hasAtomicSupport()) + needsNewModeSetForNextFb = true; } void QEglFSKmsGbmScreen::initCloning(QPlatformScreen *screenThisScreenClones, - const QVector<QPlatformScreen *> &screensCloningThisScreen) + const QList<QPlatformScreen *> &screensCloningThisScreen) { // clone destinations need to know the clone source const bool clonesAnother = screenThisScreenClones != nullptr; @@ -206,8 +201,10 @@ void QEglFSKmsGbmScreen::initCloning(QPlatformScreen *screenThisScreenClones, qWarning("QEglFSKmsGbmScreen %s cannot be clone source and destination at the same time", qPrintable(name())); return; } - if (clonesAnother) + if (clonesAnother) { m_cloneSource = static_cast<QEglFSKmsGbmScreen *>(screenThisScreenClones); + qCDebug(qLcEglfsKmsDebug, "Screen %s clones %s", qPrintable(name()), qPrintable(m_cloneSource->name())); + } // clone sources need to know their additional destinations for (QPlatformScreen *s : screensCloningThisScreen) { @@ -222,21 +219,17 @@ void QEglFSKmsGbmScreen::ensureModeSet(uint32_t fb) QKmsOutput &op(output()); const int fd = device()->fd(); - if (!op.mode_set) { + if (!op.mode_set || needsNewModeSetForNextFb) { op.mode_set = true; + needsNewModeSetForNextFb = false; bool doModeSet = true; drmModeCrtcPtr currentMode = drmModeGetCrtc(fd, op.crtc_id); - const bool alreadySet = currentMode && !memcmp(¤tMode->mode, &op.modes[op.mode], sizeof(drmModeModeInfo)); + const bool alreadySet = currentMode && currentMode->buffer_id == fb && !memcmp(¤tMode->mode, &op.modes[op.mode], sizeof(drmModeModeInfo)); if (currentMode) drmModeFreeCrtc(currentMode); - if (alreadySet) { - static bool alwaysDoSet = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ALWAYS_SET_MODE"); - if (!alwaysDoSet) { - qCDebug(qLcEglfsKmsDebug, "Mode already set, skipping modesetting for screen %s", qPrintable(name())); - doModeSet = false; - } - } + if (alreadySet) + doModeSet = false; if (doModeSet) { qCDebug(qLcEglfsKmsDebug, "Setting mode for screen %s", qPrintable(name())); @@ -267,6 +260,29 @@ void QEglFSKmsGbmScreen::ensureModeSet(uint32_t fb) } } +void QEglFSKmsGbmScreen::nonThreadedPageFlipHandler(int fd, + unsigned int sequence, + unsigned int tv_sec, + unsigned int tv_usec, + void *user_data) +{ + // note that with cloning involved this callback is called also for screens that clone another one + Q_UNUSED(fd); + QEglFSKmsGbmScreen *screen = static_cast<QEglFSKmsGbmScreen *>(user_data); + screen->flipFinished(); + screen->pageFlipped(sequence, tv_sec, tv_usec); +} + +void QEglFSKmsGbmScreen::waitForFlipWithEventReader(QEglFSKmsGbmScreen *screen) +{ + m_flipMutex.lock(); + QEglFSKmsGbmDevice *dev = static_cast<QEglFSKmsGbmDevice *>(device()); + dev->eventReader()->startWaitFlip(screen, &m_flipMutex, &m_flipCond); + m_flipCond.wait(&m_flipMutex); + m_flipMutex.unlock(); + screen->flipFinished(); +} + void QEglFSKmsGbmScreen::waitForFlip() { if (m_headless || m_cloneSource) @@ -276,18 +292,69 @@ void QEglFSKmsGbmScreen::waitForFlip() if (!m_gbm_bo_next) return; - m_flipMutex.lock(); - device()->eventReader()->startWaitFlip(this, &m_flipMutex, &m_flipCond); - m_flipCond.wait(&m_flipMutex); - m_flipMutex.unlock(); - - flipFinished(); + QEglFSKmsGbmDevice *dev = static_cast<QEglFSKmsGbmDevice *>(device()); + if (dev->usesEventReader()) { + waitForFlipWithEventReader(this); + // Now, unlike on the other code path, we need to ensure the + // flips have completed for the screens that just scan out + // this one's content, because the eventReader's wait is + // per-output. + for (CloneDestination &d : m_cloneDests) { + if (d.screen != this) + waitForFlipWithEventReader(d.screen); + } + } else { + QMutexLocker lock(&m_nonThreadedFlipMutex); + while (m_gbm_bo_next) { + drmEventContext drmEvent; + memset(&drmEvent, 0, sizeof(drmEvent)); + drmEvent.version = 2; + drmEvent.vblank_handler = nullptr; + drmEvent.page_flip_handler = nonThreadedPageFlipHandler; + drmHandleEvent(device()->fd(), &drmEvent); + } + } #if QT_CONFIG(drm_atomic) device()->threadLocalAtomicReset(); #endif } +#if QT_CONFIG(drm_atomic) +static void addAtomicFlip(drmModeAtomicReq *request, const QKmsOutput &output, uint32_t fb) +{ + drmModeAtomicAddProperty(request, output.eglfs_plane->id, + output.eglfs_plane->framebufferPropertyId, fb); + + drmModeAtomicAddProperty(request, output.eglfs_plane->id, + output.eglfs_plane->crtcPropertyId, output.crtc_id); + + drmModeAtomicAddProperty(request, output.eglfs_plane->id, + output.eglfs_plane->srcwidthPropertyId, output.size.width() << 16); + + drmModeAtomicAddProperty(request, output.eglfs_plane->id, + output.eglfs_plane->srcXPropertyId, 0); + + drmModeAtomicAddProperty(request, output.eglfs_plane->id, + output.eglfs_plane->srcYPropertyId, 0); + + drmModeAtomicAddProperty(request, output.eglfs_plane->id, + output.eglfs_plane->srcheightPropertyId, output.size.height() << 16); + + drmModeAtomicAddProperty(request, output.eglfs_plane->id, + output.eglfs_plane->crtcXPropertyId, 0); + + drmModeAtomicAddProperty(request, output.eglfs_plane->id, + output.eglfs_plane->crtcYPropertyId, 0); + + drmModeAtomicAddProperty(request, output.eglfs_plane->id, + output.eglfs_plane->crtcwidthPropertyId, output.modes[output.mode].hdisplay); + + drmModeAtomicAddProperty(request, output.eglfs_plane->id, + output.eglfs_plane->crtcheightPropertyId, output.modes[output.mode].vdisplay); +} +#endif + void QEglFSKmsGbmScreen::flip() { // For headless screen just return silently. It is not necessarily an error @@ -307,14 +374,24 @@ void QEglFSKmsGbmScreen::flip() m_gbm_bo_next = gbm_surface_lock_front_buffer(m_gbm_surface); if (!m_gbm_bo_next) { - qWarning("Could not lock GBM surface front buffer!"); + qWarning("Could not lock GBM surface front buffer for screen %s", qPrintable(name())); return; } + auto gbmRelease = qScopeGuard([this]{ + m_flipPending = false; + gbm_surface_release_buffer(m_gbm_surface, m_gbm_bo_next); + m_gbm_bo_next = nullptr; + }); + FrameBuffer *fb = framebufferForBufferObject(m_gbm_bo_next); + if (!fb) { + qWarning("FrameBuffer not available. Cannot flip"); + return; + } ensureModeSet(fb->fb); - QKmsOutput &op(output()); + const QKmsOutput &thisOutput(output()); const int fd = device()->fd(); m_flipPending = true; @@ -322,40 +399,27 @@ void QEglFSKmsGbmScreen::flip() #if QT_CONFIG(drm_atomic) drmModeAtomicReq *request = device()->threadLocalAtomicRequest(); if (request) { - drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->framebufferPropertyId, fb->fb); - drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->crtcPropertyId, op.crtc_id); - drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->srcwidthPropertyId, - op.size.width() << 16); - drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->srcXPropertyId, 0); - drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->srcYPropertyId, 0); - drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->srcheightPropertyId, - op.size.height() << 16); - drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->crtcXPropertyId, 0); - drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->crtcYPropertyId, 0); - drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->crtcwidthPropertyId, - m_output.modes[m_output.mode].hdisplay); - drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->crtcheightPropertyId, - m_output.modes[m_output.mode].vdisplay); - + addAtomicFlip(request, thisOutput, fb->fb); static int zpos = qEnvironmentVariableIntValue("QT_QPA_EGLFS_KMS_ZPOS"); - if (zpos) - drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->zposPropertyId, zpos); + if (zpos) { + drmModeAtomicAddProperty(request, thisOutput.eglfs_plane->id, + thisOutput.eglfs_plane->zposPropertyId, zpos); + } static uint blendOp = uint(qEnvironmentVariableIntValue("QT_QPA_EGLFS_KMS_BLEND_OP")); - if (blendOp) - drmModeAtomicAddProperty(request, op.eglfs_plane->id, op.eglfs_plane->blendOpPropertyId, blendOp); + if (blendOp) { + drmModeAtomicAddProperty(request, thisOutput.eglfs_plane->id, + thisOutput.eglfs_plane->blendOpPropertyId, blendOp); + } } #endif } else { int ret = drmModePageFlip(fd, - op.crtc_id, - fb->fb, - DRM_MODE_PAGE_FLIP_EVENT, - this); + thisOutput.crtc_id, + fb->fb, + DRM_MODE_PAGE_FLIP_EVENT, + this); if (ret) { qErrnoWarning("Could not queue DRM page flip on screen %s", qPrintable(name())); - m_flipPending = false; - gbm_surface_release_buffer(m_gbm_surface, m_gbm_bo_next); - m_gbm_bo_next = nullptr; return; } } @@ -364,34 +428,46 @@ void QEglFSKmsGbmScreen::flip() if (d.screen != this) { d.screen->ensureModeSet(fb->fb); d.cloneFlipPending = true; + const QKmsOutput &destOutput(d.screen->output()); if (device()->hasAtomicSupport()) { #if QT_CONFIG(drm_atomic) drmModeAtomicReq *request = device()->threadLocalAtomicRequest(); - if (request) { - drmModeAtomicAddProperty(request, d.screen->output().eglfs_plane->id, - d.screen->output().eglfs_plane->framebufferPropertyId, fb->fb); - drmModeAtomicAddProperty(request, d.screen->output().eglfs_plane->id, - d.screen->output().eglfs_plane->crtcPropertyId, op.crtc_id); - } + if (request) + addAtomicFlip(request, destOutput, fb->fb); + + // ### This path is broken. On the other branch we can easily + // pass in d.screen as the user_data for drmModePageFlip, but + // using one atomic request breaks down here since we get events + // with the same user_data passed to drmModeAtomicCommit. Until + // this gets reworked (multiple requests?) screen cloning is not + // compatible with atomic. #endif } else { int ret = drmModePageFlip(fd, - d.screen->output().crtc_id, + destOutput.crtc_id, fb->fb, DRM_MODE_PAGE_FLIP_EVENT, d.screen); if (ret) { - qErrnoWarning("Could not queue DRM page flip for clone screen %s", qPrintable(name())); + qErrnoWarning("Could not queue DRM page flip for screen %s (clones screen %s)", + qPrintable(d.screen->name()), + qPrintable(name())); d.cloneFlipPending = false; } } } } + if (device()->hasAtomicSupport()) { #if QT_CONFIG(drm_atomic) - device()->threadLocalAtomicCommit(this); + if (!device()->threadLocalAtomicCommit(this)) { + return; + } #endif + } + + gbmRelease.dismiss(); } void QEglFSKmsGbmScreen::flipFinished() @@ -418,19 +494,23 @@ void QEglFSKmsGbmScreen::cloneDestFlipFinished(QEglFSKmsGbmScreen *cloneDestScre void QEglFSKmsGbmScreen::updateFlipStatus() { - Q_ASSERT(!m_cloneSource); + // only for 'real' outputs that own the color buffer, i.e. that are not cloning another one + if (m_cloneSource) + return; + // proceed only if flips for both this and all others that clone this have finished if (m_flipPending) return; - for (const CloneDestination &d : qAsConst(m_cloneDests)) { + for (const CloneDestination &d : std::as_const(m_cloneDests)) { if (d.cloneFlipPending) return; } - if (m_gbm_bo_current) + if (m_gbm_bo_current) { gbm_surface_release_buffer(m_gbm_surface, m_gbm_bo_current); + } m_gbm_bo_current = m_gbm_bo_next; m_gbm_bo_next = nullptr; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h deleted file mode 100644 index 69feeee703..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEGLFSKMSGBMSCREEN_H -#define QEGLFSKMSGBMSCREEN_H - -#include "qeglfskmsscreen.h" -#include <QMutex> -#include <QWaitCondition> - -#include <gbm.h> - -QT_BEGIN_NAMESPACE - -class QEglFSKmsGbmCursor; - -class QEglFSKmsGbmScreen : public QEglFSKmsScreen -{ -public: - QEglFSKmsGbmScreen(QEglFSKmsDevice *device, const QKmsOutput &output, bool headless); - ~QEglFSKmsGbmScreen(); - - QPlatformCursor *cursor() const override; - - gbm_surface *createSurface(EGLConfig eglConfig); - void resetSurface(); - - void initCloning(QPlatformScreen *screenThisScreenClones, - const QVector<QPlatformScreen *> &screensCloningThisScreen); - - void waitForFlip() override; - - void flip(); - -private: - void flipFinished(); - void ensureModeSet(uint32_t fb); - void cloneDestFlipFinished(QEglFSKmsGbmScreen *cloneDestScreen); - void updateFlipStatus(); - - gbm_surface *m_gbm_surface; - - gbm_bo *m_gbm_bo_current; - gbm_bo *m_gbm_bo_next; - bool m_flipPending; - - QMutex m_flipMutex; - QWaitCondition m_flipCond; - - QScopedPointer<QEglFSKmsGbmCursor> m_cursor; - - struct FrameBuffer { - uint32_t fb = 0; - }; - static void bufferDestroyedHandler(gbm_bo *bo, void *data); - FrameBuffer *framebufferForBufferObject(gbm_bo *bo); - - QEglFSKmsGbmScreen *m_cloneSource; - struct CloneDestination { - QEglFSKmsGbmScreen *screen = nullptr; - bool cloneFlipPending = false; - }; - QVector<CloneDestination> m_cloneDests; -}; - -QT_END_NAMESPACE - -#endif // QEGLFSKMSGBMSCREEN_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen_p.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen_p.h new file mode 100644 index 0000000000..aca34fcae2 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen_p.h @@ -0,0 +1,92 @@ +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEGLFSKMSGBMSCREEN_H +#define QEGLFSKMSGBMSCREEN_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <private/qeglfskmsscreen_p.h> +#include <QMutex> +#include <QWaitCondition> + +#include <gbm.h> + +QT_BEGIN_NAMESPACE + +class QEglFSKmsGbmCursor; + +class Q_EGLFS_EXPORT QEglFSKmsGbmScreen : public QEglFSKmsScreen +{ +public: + QEglFSKmsGbmScreen(QEglFSKmsDevice *device, const QKmsOutput &output, bool headless); + ~QEglFSKmsGbmScreen(); + + QPlatformCursor *cursor() const override; + + gbm_surface *createSurface(EGLConfig eglConfig); + void resetSurface(); + + void initCloning(QPlatformScreen *screenThisScreenClones, + const QList<QPlatformScreen *> &screensCloningThisScreen); + + void waitForFlip() override; + + virtual void flip(); + virtual void updateFlipStatus(); + + virtual uint32_t gbmFlags() { return GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING; } + +protected: + void flipFinished(); + void ensureModeSet(uint32_t fb); + void cloneDestFlipFinished(QEglFSKmsGbmScreen *cloneDestScreen); + void waitForFlipWithEventReader(QEglFSKmsGbmScreen *screen); + static void nonThreadedPageFlipHandler(int fd, + unsigned int sequence, + unsigned int tv_sec, + unsigned int tv_usec, + void *user_data); + + gbm_surface *m_gbm_surface; + + gbm_bo *m_gbm_bo_current; + gbm_bo *m_gbm_bo_next; + bool m_flipPending; + + QMutex m_flipMutex; + QWaitCondition m_flipCond; + static QMutex m_nonThreadedFlipMutex; + + QScopedPointer<QEglFSKmsGbmCursor> m_cursor; + + struct FrameBuffer { + uint32_t fb = 0; + }; + static void bufferDestroyedHandler(gbm_bo *bo, void *data); + FrameBuffer *framebufferForBufferObject(gbm_bo *bo); + + QEglFSKmsGbmScreen *m_cloneSource; + struct CloneDestination { + QEglFSKmsGbmScreen *screen = nullptr; + bool cloneFlipPending = false; + }; + QList<CloneDestination> m_cloneDests; + + bool needsNewModeSetForNextFb = false; +}; + +QT_END_NAMESPACE + +#endif // QEGLFSKMSGBMSCREEN_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp index a93762e5b4..f2e23061be 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.cpp @@ -1,47 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#include "qeglfskmsgbmwindow.h" -#include "qeglfskmsgbmintegration.h" -#include "qeglfskmsgbmscreen.h" +#include "qeglfskmsgbmwindow_p.h" +#include "qeglfskmsgbmintegration_p.h" +#include "qeglfskmsgbmscreen_p.h" -#include <QtEglSupport/private/qeglconvenience_p.h> +#include <QtGui/private/qeglconvenience_p.h> QT_BEGIN_NAMESPACE @@ -67,7 +31,21 @@ void QEglFSKmsGbmWindow::resetSurface() } if (createPlatformWindowSurface) { - m_surface = createPlatformWindowSurface(display, m_config, reinterpret_cast<void *>(m_window), nullptr); + QVector<EGLint> contextAttributes; +#ifdef EGL_EXT_protected_content + if (platformFormat.testOption(QSurfaceFormat::ProtectedContent)) { + if (q_hasEglExtension(display, "EGL_EXT_protected_content")) { + contextAttributes.append(EGL_PROTECTED_CONTENT_EXT); + contextAttributes.append(EGL_TRUE); + qCDebug(qLcEglfsKmsDebug, "Enabled EGL_PROTECTED_CONTENT_EXT for eglCreatePlatformWindowSurfaceEXT"); + } else { + m_format.setOption(QSurfaceFormat::ProtectedContent, false); + } + } +#endif + contextAttributes.append(EGL_NONE); + + m_surface = createPlatformWindowSurface(display, m_config, reinterpret_cast<void *>(m_window), contextAttributes.constData()); } else { qCDebug(qLcEglfsKmsDebug, "No eglCreatePlatformWindowSurface for GBM, falling back to eglCreateWindowSurface"); m_surface = eglCreateWindowSurface(display, m_config, m_window, nullptr); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.h deleted file mode 100644 index ee4b7978f1..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEGLFSKMSGBMWINDOW_H -#define QEGLFSKMSGBMWINDOW_H - -#include "private/qeglfswindow_p.h" - -QT_BEGIN_NAMESPACE - -class QEglFSKmsGbmIntegration; - -class QEglFSKmsGbmWindow : public QEglFSWindow -{ -public: - QEglFSKmsGbmWindow(QWindow *w, const QEglFSKmsGbmIntegration *integration) - : QEglFSWindow(w), - m_integration(integration) - { } - - ~QEglFSKmsGbmWindow() { destroy(); } - - void resetSurface() override; - void invalidateSurface() override; - -private: - const QEglFSKmsGbmIntegration *m_integration; -}; - -QT_END_NAMESPACE - -#endif // QEGLFSKMSGBMWINDOW_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow_p.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow_p.h new file mode 100644 index 0000000000..2d225b0314 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmwindow_p.h @@ -0,0 +1,45 @@ +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEGLFSKMSGBMWINDOW_H +#define QEGLFSKMSGBMWINDOW_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "private/qeglfswindow_p.h" + +QT_BEGIN_NAMESPACE + +class QEglFSKmsGbmIntegration; + +class Q_EGLFS_EXPORT QEglFSKmsGbmWindow : public QEglFSWindow +{ +public: + QEglFSKmsGbmWindow(QWindow *w, const QEglFSKmsGbmIntegration *integration) + : QEglFSWindow(w), + m_integration(integration) + { } + + ~QEglFSKmsGbmWindow() { destroy(); } + + void resetSurface() override; + void invalidateSurface() override; + +private: + const QEglFSKmsGbmIntegration *m_integration; +}; + +QT_END_NAMESPACE + +#endif // QEGLFSKMSGBMWINDOW_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt new file mode 100644 index 0000000000..3c3e5a8a6c --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/CMakeLists.txt @@ -0,0 +1,27 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +##################################################################### +## QEglFSKmsEglDeviceIntegrationPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QEglFSKmsEglDeviceIntegrationPlugin + OUTPUT_NAME qeglfs-kms-egldevice-integration + PLUGIN_TYPE egldeviceintegrations + SOURCES + qeglfskmsegldevice.cpp qeglfskmsegldevice.h + qeglfskmsegldeviceintegration.cpp qeglfskmsegldeviceintegration.h + qeglfskmsegldevicemain.cpp + qeglfskmsegldevicescreen.cpp qeglfskmsegldevicescreen.h + DEFINES + QT_EGL_NO_X11 + LIBRARIES + Libdrm::Libdrm + Qt::Core + Qt::CorePrivate + Qt::EglFSDeviceIntegrationPrivate + Qt::EglFsKmsSupportPrivate + Qt::Gui + Qt::GuiPrivate + Qt::KmsSupportPrivate +) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro deleted file mode 100644 index a6145c07e6..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/eglfs_kms_egldevice.pro +++ /dev/null @@ -1,26 +0,0 @@ -TARGET = qeglfs-kms-egldevice-integration - -QT += core-private gui-private eglfsdeviceintegration-private eglfs_kms_support-private kms_support-private edid_support-private - -INCLUDEPATH += $$PWD/../../api $$PWD/../eglfs_kms_support - -# Avoid X11 header collision, use generic EGL native types -DEFINES += QT_EGL_NO_X11 - -QMAKE_USE += drm -CONFIG += egl - -SOURCES += $$PWD/qeglfskmsegldevicemain.cpp \ - $$PWD/qeglfskmsegldeviceintegration.cpp \ - qeglfskmsegldevice.cpp \ - qeglfskmsegldevicescreen.cpp - -HEADERS += $$PWD/qeglfskmsegldeviceintegration.h \ - qeglfskmsegldevice.h \ - qeglfskmsegldevicescreen.h - -OTHER_FILES += $$PWD/eglfs_kms_egldevice.json - -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSKmsEglDeviceIntegrationPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp index 8c8e6260f1..3e2c93d8e5 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfskmsegldevice.h" #include "qeglfskmsegldevicescreen.h" @@ -58,7 +22,12 @@ bool QEglFSKmsEglDevice::open() { Q_ASSERT(fd() == -1); - int fd = drmOpen(devicePath().toLocal8Bit().constData(), nullptr); + int fd = -1; + + if (devicePath().compare("drm-nvdc") == 0) + fd = drmOpen(devicePath().toLocal8Bit().constData(), nullptr); + else + fd = qt_safe_open(devicePath().toLocal8Bit().constData(), O_RDWR); if (Q_UNLIKELY(fd < 0)) qFatal("Could not open DRM (NV) device"); @@ -71,7 +40,7 @@ void QEglFSKmsEglDevice::close() { // Note: screens are gone at this stage. - if (qt_safe_close(fd()) == -1) + if (drmClose(fd()) == -1) qErrnoWarning("Could not close DRM (NV) device"); setFd(-1); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h index 8d469879ab..824cae0906 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevice.h @@ -1,46 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSKMSEGLDEVICE_H #define QEGLFSKMSEGLDEVICE_H -#include <qeglfskmsdevice.h> +#include <private/qeglfskmsdevice_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index 3e78196227..a213bc9bba 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -1,47 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfskmsegldeviceintegration.h" #include "qeglfskmsegldevice.h" #include "qeglfskmsegldevicescreen.h" -#include <QtEglSupport/private/qeglconvenience_p.h> +#include <QtGui/private/qeglconvenience_p.h> #include "private/qeglfswindow_p.h" #include "private/qeglfscursor_p.h" #include <QLoggingCategory> @@ -74,8 +38,11 @@ EGLDisplay QEglFSKmsEglDeviceIntegration::createDisplay(EGLNativeDisplayType nat EGLDisplay display; + EGLint egldevice_fd = device()->fd(); + + const EGLint attribs[] = { EGL_DRM_MASTER_FD_EXT, egldevice_fd, EGL_NONE }; if (m_funcs->has_egl_platform_device) { - display = m_funcs->get_platform_display(EGL_PLATFORM_DEVICE_EXT, nativeDisplay, nullptr); + display = m_funcs->get_platform_display(EGL_PLATFORM_DEVICE_EXT, nativeDisplay, attribs); } else { qWarning("EGL_EXT_platform_device not available, falling back to legacy path!"); display = eglGetDisplay(nativeDisplay); @@ -171,7 +138,7 @@ void QEglFSKmsEglDeviceWindow::resetSurface() qCDebug(qLcEglfsKmsDebug, "Output has %d layers", count); - QVector<EGLOutputLayerEXT> layers; + QList<EGLOutputLayerEXT> layers; layers.resize(count); EGLint actualCount; if (!m_integration->m_funcs->get_output_layers(display, nullptr, layers.data(), count, &actualCount)) { @@ -204,7 +171,7 @@ void QEglFSKmsEglDeviceWindow::resetSurface() QByteArray reqLayerIndex = qgetenv("QT_QPA_EGLFS_LAYER_INDEX"); if (!reqLayerIndex.isEmpty()) { int idx = reqLayerIndex.toInt(); - if (idx >= 0 && idx < layers.count()) { + if (idx >= 0 && idx < layers.size()) { qCDebug(qLcEglfsKmsDebug, "EGLOutput layer index override = %d", idx); layer = layers[idx]; } @@ -262,7 +229,7 @@ QKmsDevice *QEglFSKmsEglDeviceIntegration::createDevice() if (Q_UNLIKELY(!deviceName)) qFatal("Failed to query device name from EGLDevice"); - return new QEglFSKmsEglDevice(this, screenConfig(), QLatin1String(deviceName)); + return new QEglFSKmsEglDevice(this, screenConfig(), QLatin1StringView(deviceName)); } bool QEglFSKmsEglDeviceIntegration::query_egl_device() diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h index 5819d82ebf..4c4bdc5f1b 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.h @@ -1,52 +1,16 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSKMSEGLDEVICEINTEGRATION_H #define QEGLFSKMSEGLDEVICEINTEGRATION_H -#include <qeglfskmsintegration.h> +#include <private/qeglfskmsintegration_p.h> #include <xf86drm.h> #include <xf86drmMode.h> -#include <QtEglSupport/private/qeglstreamconvenience_p.h> +#include <QtGui/private/qeglstreamconvenience_p.h> QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicemain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicemain.cpp index 5763ab45cc..c8c5bb789e 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicemain.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicemain.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfskmsegldeviceintegration.h" diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp index 5a62e437c4..3fc46cd224 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfskmsegldevicescreen.h" #include "qeglfskmsegldevice.h" @@ -49,12 +13,63 @@ Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug) QEglFSKmsEglDeviceScreen::QEglFSKmsEglDeviceScreen(QEglFSKmsDevice *device, const QKmsOutput &output) : QEglFSKmsScreen(device, output) + , m_default_fb_handle(uint32_t(-1)) + , m_default_fb_id(uint32_t(-1)) { + const int fd = device->fd(); + + struct drm_mode_create_dumb createRequest; + createRequest.width = output.size.width(); + createRequest.height = output.size.height(); + createRequest.bpp = 32; + createRequest.flags = 0; + + qCDebug(qLcEglfsKmsDebug, "Creating dumb fb %dx%d", createRequest.width, createRequest.height); + + int ret = drmIoctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &createRequest); + if (ret < 0) + qFatal("Unable to create dumb buffer.\n"); + + m_default_fb_handle = createRequest.handle; + + uint32_t handles[4] = { 0, 0, 0, 0 }; + uint32_t pitches[4] = { 0, 0, 0, 0 }; + uint32_t offsets[4] = { 0, 0, 0, 0 }; + + handles[0] = createRequest.handle; + pitches[0] = createRequest.pitch; + offsets[0] = 0; + + ret = drmModeAddFB2(fd, createRequest.width, createRequest.height, DRM_FORMAT_ARGB8888, handles, + pitches, offsets, &m_default_fb_id, 0); + if (ret) + qFatal("Unable to add fb\n"); + + qCDebug(qLcEglfsKmsDebug, "Added dumb fb %dx%d handle:%u pitch:%d id:%u", createRequest.width, createRequest.height, + createRequest.handle, createRequest.pitch, m_default_fb_id); } QEglFSKmsEglDeviceScreen::~QEglFSKmsEglDeviceScreen() { - const int remainingScreenCount = qGuiApp->screens().count(); + int ret; + const int fd = device()->fd(); + + if (m_default_fb_id != uint32_t(-1)) { + ret = drmModeRmFB(fd, m_default_fb_id); + if (ret) + qErrnoWarning("drmModeRmFB failed"); + } + + if (m_default_fb_handle != uint32_t(-1)) { + struct drm_mode_destroy_dumb destroyRequest; + destroyRequest.handle = m_default_fb_handle; + + ret = drmIoctl(fd, DRM_IOCTL_MODE_DESTROY_DUMB, &destroyRequest); + if (ret) + qErrnoWarning("DRM_IOCTL_MODE_DESTROY_DUMB failed"); + } + + const int remainingScreenCount = qGuiApp->screens().size(); qCDebug(qLcEglfsKmsDebug, "Screen dtor. Remaining screens: %d", remainingScreenCount); if (!remainingScreenCount && !device()->screenConfig()->separateScreens()) static_cast<QEglFSKmsEglDevice *>(device())->destroyGlobalCursor(); @@ -89,8 +104,11 @@ void QEglFSKmsEglDeviceScreen::waitForFlip() if (alreadySet) { // Maybe detecting the DPMS mode could help here, but there are no properties // exposed on the connector apparently. So rely on an env var for now. - static bool alwaysDoSet = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ALWAYS_SET_MODE"); - if (!alwaysDoSet) { + // Note that typically, we need to set crtc with the default fb even if the + // mode did not change, unless QT_QPA_EGLFS_ALWAYS_SET_MODE is explicitly specified. + static bool envVarSet = false; + static bool alwaysDoSet = qEnvironmentVariableIntValue("QT_QPA_EGLFS_ALWAYS_SET_MODE", &envVarSet); + if (envVarSet && !alwaysDoSet) { qCDebug(qLcEglfsKmsDebug, "Mode already set"); return; } @@ -98,7 +116,7 @@ void QEglFSKmsEglDeviceScreen::waitForFlip() qCDebug(qLcEglfsKmsDebug, "Setting mode"); int ret = drmModeSetCrtc(fd, op.crtc_id, - uint32_t(-1), 0, 0, + m_default_fb_id, 0, 0, &op.connector_id, 1, &op.modes[op.mode]); if (ret) @@ -110,7 +128,7 @@ void QEglFSKmsEglDeviceScreen::waitForFlip() if (op.wants_forced_plane) { qCDebug(qLcEglfsKmsDebug, "Setting plane %u", op.forced_plane_id); - int ret = drmModeSetPlane(fd, op.forced_plane_id, op.crtc_id, uint32_t(-1), 0, + int ret = drmModeSetPlane(fd, op.forced_plane_id, op.crtc_id, m_default_fb_id, 0, 0, 0, w, h, 0 << 16, 0 << 16, op.size.width() << 16, op.size.height() << 16); if (ret == -1) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h index 961398ba3e..8779499bef 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.h @@ -1,46 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSKMSEGLDEVICESCREEN_H #define QEGLFSKMSEGLDEVICESCREEN_H -#include <qeglfskmsscreen.h> +#include <private/qeglfskmsscreen_p.h> QT_BEGIN_NAMESPACE @@ -53,6 +17,9 @@ public: QPlatformCursor *cursor() const override; void waitForFlip() override; +private: + uint32_t m_default_fb_handle; + uint32_t m_default_fb_id; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt new file mode 100644 index 0000000000..5fcc0e1b18 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +##################################################################### +## EglFsKmsSupportPrivate Module: +##################################################################### + +qt_internal_add_module(EglFsKmsSupportPrivate + CONFIG_MODULE_NAME eglfs_kms_support + INTERNAL_MODULE + SOURCES + qeglfskmsdevice.cpp qeglfskmsdevice_p.h + qeglfskmseventreader.cpp qeglfskmseventreader_p.h + qeglfskmshelpers_p.h + qeglfskmsintegration.cpp qeglfskmsintegration_p.h + qeglfskmsscreen.cpp qeglfskmsscreen_p.h + DEFINES + QT_EGL_NO_X11 + PUBLIC_LIBRARIES + Libdrm::Libdrm + Qt::Core + Qt::CorePrivate + Qt::EglFSDeviceIntegrationPrivate + Qt::Gui + Qt::GuiPrivate + Qt::KmsSupportPrivate + NO_GENERATE_CPP_EXPORTS +) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro deleted file mode 100644 index e51903ed96..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/eglfs_kms_support.pro +++ /dev/null @@ -1,24 +0,0 @@ -TARGET = QtEglFsKmsSupport -CONFIG += no_module_headers internal_module -load(qt_module) - -QT += core-private gui-private eglfsdeviceintegration-private kms_support-private edid_support-private - -INCLUDEPATH += $$PWD/../../api - -# Avoid X11 header collision, use generic EGL native types -DEFINES += QT_EGL_NO_X11 - -QMAKE_USE += drm -CONFIG += egl - -SOURCES += $$PWD/qeglfskmsintegration.cpp \ - $$PWD/qeglfskmsdevice.cpp \ - $$PWD/qeglfskmsscreen.cpp \ - $$PWD/qeglfskmseventreader.cpp - -HEADERS += $$PWD/qeglfskmsintegration.h \ - $$PWD/qeglfskmsdevice.h \ - $$PWD/qeglfskmsscreen.h \ - $$PWD/qeglfskmshelpers.h \ - $$PWD/qeglfskmseventreader.h diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp index 4f0b0d7725..037b26f023 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp @@ -1,45 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -#include "qeglfskmsdevice.h" -#include "qeglfskmsscreen.h" +#include "qeglfskmsdevice_p.h" +#include "qeglfskmsscreen_p.h" #include "private/qeglfsintegration_p.h" #include <QtGui/private/qguiapplication_p.h> diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h deleted file mode 100644 index 34908aa60f..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEGLFSKMSDEVICE_H -#define QEGLFSKMSDEVICE_H - -#include "private/qeglfsglobal_p.h" -#include "qeglfskmseventreader.h" -#include <QtKmsSupport/private/qkmsdevice_p.h> - -QT_BEGIN_NAMESPACE - -class Q_EGLFS_EXPORT QEglFSKmsDevice : public QKmsDevice -{ -public: - QEglFSKmsDevice(QKmsScreenConfig *screenConfig, const QString &path); - - void registerScreen(QPlatformScreen *screen, - bool isPrimary, - const QPoint &virtualPos, - const QList<QPlatformScreen *> &virtualSiblings) override; - - QEglFSKmsEventReader *eventReader() { return &m_eventReader; } - -protected: - QEglFSKmsEventReader m_eventReader; -}; - -QT_END_NAMESPACE - -#endif // QEGLFSKMSDEVICE_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice_p.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice_p.h new file mode 100644 index 0000000000..6e11953a69 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice_p.h @@ -0,0 +1,37 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEGLFSKMSDEVICE_H +#define QEGLFSKMSDEVICE_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "private/qeglfsglobal_p.h" +#include <QtKmsSupport/private/qkmsdevice_p.h> + +QT_BEGIN_NAMESPACE + +class Q_EGLFS_EXPORT QEglFSKmsDevice : public QKmsDevice +{ +public: + QEglFSKmsDevice(QKmsScreenConfig *screenConfig, const QString &path); + + void registerScreen(QPlatformScreen *screen, + bool isPrimary, + const QPoint &virtualPos, + const QList<QPlatformScreen *> &virtualSiblings) override; +}; + +QT_END_NAMESPACE + +#endif // QEGLFSKMSDEVICE_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmseventreader.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmseventreader.cpp index 645a0ae2e9..96cdcd8947 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmseventreader.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmseventreader.cpp @@ -1,44 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qeglfskmseventreader.h" -#include "qeglfskmsdevice.h" +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qeglfskmseventreader_p.h" +#include "qeglfskmsdevice_p.h" +#include "qeglfskmsscreen_p.h" #include <QSocketNotifier> #include <QCoreApplication> #include <QLoggingCategory> @@ -50,12 +15,12 @@ Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug) static void pageFlipHandler(int fd, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data) { Q_UNUSED(fd); - Q_UNUSED(sequence); - Q_UNUSED(tv_sec); - Q_UNUSED(tv_usec); QEglFSKmsEventReaderThread *t = static_cast<QEglFSKmsEventReaderThread *>(QThread::currentThread()); t->eventHost()->handlePageFlipCompleted(user_data); + + QEglFSKmsScreen *screen = static_cast<QEglFSKmsScreen *>(user_data); + screen->pageFlipped(sequence, tv_sec, tv_usec); } class RegisterWaitFlipEvent : public QEvent @@ -179,7 +144,7 @@ void QEglFSKmsEventReader::create(QEglFSKmsDevice *device) m_device = device; - qCDebug(qLcEglfsKmsDebug, "Initalizing event reader for device %p fd %d", + qCDebug(qLcEglfsKmsDebug, "Initializing event reader for device %p fd %d", m_device, m_device->fd()); m_thread = new QEglFSKmsEventReaderThread(m_device->fd()); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmseventreader.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmseventreader.h deleted file mode 100644 index 4aa285b0fe..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmseventreader.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2019 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEGLFSKKMSEVENTREADER_H -#define QEGLFSKKMSEVENTREADER_H - -#include "private/qeglfsglobal_p.h" -#include <QObject> -#include <QThread> -#include <QMutex> -#include <QWaitCondition> - -QT_BEGIN_NAMESPACE - -class QEglFSKmsDevice; - -struct QEglFSKmsEventHost : public QObject -{ - struct PendingFlipWait { - void *key; - QMutex *mutex; - QWaitCondition *cond; - }; - - static const int MAX_FLIPS = 32; - void *completedFlips[MAX_FLIPS] = {}; - QEglFSKmsEventHost::PendingFlipWait pendingFlipWaits[MAX_FLIPS] = {}; - - bool event(QEvent *event) override; - void updateStatus(); - void handlePageFlipCompleted(void *key); -}; - -class QEglFSKmsEventReaderThread : public QThread -{ -public: - QEglFSKmsEventReaderThread(int fd) : m_fd(fd) { } - void run() override; - QEglFSKmsEventHost *eventHost() { return &m_ev; } - -private: - int m_fd; - QEglFSKmsEventHost m_ev; -}; - -class Q_EGLFS_EXPORT QEglFSKmsEventReader -{ -public: - ~QEglFSKmsEventReader(); - - void create(QEglFSKmsDevice *device); - void destroy(); - - void startWaitFlip(void *key, QMutex *mutex, QWaitCondition *cond); - -private: - QEglFSKmsDevice *m_device = nullptr; - QEglFSKmsEventReaderThread *m_thread = nullptr; -}; - -QT_END_NAMESPACE - -#endif // QEGLFSKKMSEVENTREADER_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmseventreader_p.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmseventreader_p.h new file mode 100644 index 0000000000..295e5c4407 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmseventreader_p.h @@ -0,0 +1,74 @@ +// Copyright (C) 2019 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEGLFSKKMSEVENTREADER_H +#define QEGLFSKKMSEVENTREADER_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "private/qeglfsglobal_p.h" +#include <QObject> +#include <QThread> +#include <QMutex> +#include <QWaitCondition> + +QT_BEGIN_NAMESPACE + +class QEglFSKmsDevice; + +struct QEglFSKmsEventHost : public QObject +{ + struct PendingFlipWait { + void *key; + QMutex *mutex; + QWaitCondition *cond; + }; + + static const int MAX_FLIPS = 32; + void *completedFlips[MAX_FLIPS] = {}; + QEglFSKmsEventHost::PendingFlipWait pendingFlipWaits[MAX_FLIPS] = {}; + + bool event(QEvent *event) override; + void updateStatus(); + void handlePageFlipCompleted(void *key); +}; + +class QEglFSKmsEventReaderThread : public QThread +{ +public: + QEglFSKmsEventReaderThread(int fd) : m_fd(fd) { } + void run() override; + QEglFSKmsEventHost *eventHost() { return &m_ev; } + +private: + int m_fd; + QEglFSKmsEventHost m_ev; +}; + +class Q_EGLFS_EXPORT QEglFSKmsEventReader +{ +public: + ~QEglFSKmsEventReader(); + + void create(QEglFSKmsDevice *device); + void destroy(); + + void startWaitFlip(void *key, QMutex *mutex, QWaitCondition *cond); + +private: + QEglFSKmsDevice *m_device = nullptr; + QEglFSKmsEventReaderThread *m_thread = nullptr; +}; + +QT_END_NAMESPACE + +#endif // QEGLFSKKMSEVENTREADER_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmshelpers.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmshelpers.h deleted file mode 100644 index c9e5f04a7b..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmshelpers.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEGLFSKMSHELPERS_H -#define QEGLFSKMSHELPERS_H - -#include <QString> - -QT_BEGIN_NAMESPACE - -inline QString q_fourccToString(uint code) -{ - QString s; - s.reserve(4); - s.append(code & 0xff); - s.append((code >> 8) & 0xff); - s.append((code >> 16) & 0xff); - s.append((code >> 24) & 0xff); - return s; -} - -QT_END_NAMESPACE - -#endif // QEGLFSKMSHELPERS_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmshelpers_p.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmshelpers_p.h new file mode 100644 index 0000000000..5f9935e93b --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmshelpers_p.h @@ -0,0 +1,35 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEGLFSKMSHELPERS_H +#define QEGLFSKMSHELPERS_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include <QString> + +QT_BEGIN_NAMESPACE + +inline QString q_fourccToString(uint code) +{ + QString s; + s.reserve(4); + s.append(code & 0xff); + s.append((code >> 8) & 0xff); + s.append((code >> 16) & 0xff); + s.append((code >> 24) & 0xff); + return s; +} + +QT_END_NAMESPACE + +#endif // QEGLFSKMSHELPERS_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp index 28b6b7df63..26420b441f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.cpp @@ -1,46 +1,10 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qeglfskmsintegration.h" -#include "qeglfskmsscreen.h" +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qeglfskmsintegration_p.h" +#include "qeglfskmsscreen_p.h" #include <QtKmsSupport/private/qkmsdevice_p.h> @@ -55,18 +19,19 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(qLcEglfsKmsDebug, "qt.qpa.eglfs.kms") QEglFSKmsIntegration::QEglFSKmsIntegration() - : m_device(nullptr), - m_screenConfig(new QKmsScreenConfig) + : m_device(nullptr) { } QEglFSKmsIntegration::~QEglFSKmsIntegration() { - delete m_screenConfig; } void QEglFSKmsIntegration::platformInit() { + qCDebug(qLcEglfsKmsDebug, "platformInit: Load Screen Config"); + m_screenConfig = createScreenConfig(); + qCDebug(qLcEglfsKmsDebug, "platformInit: Opening DRM device"); m_device = createDevice(); if (Q_UNLIKELY(!m_device->open())) @@ -79,6 +44,8 @@ void QEglFSKmsIntegration::platformDestroy() m_device->close(); delete m_device; m_device = nullptr; + delete m_screenConfig; + m_screenConfig = nullptr; } EGLNativeDisplayType QEglFSKmsIntegration::platformDisplay() const @@ -167,4 +134,12 @@ QKmsScreenConfig *QEglFSKmsIntegration::screenConfig() const return m_screenConfig; } +QKmsScreenConfig *QEglFSKmsIntegration::createScreenConfig() +{ + QKmsScreenConfig *screenConfig = new QKmsScreenConfig; + screenConfig->loadConfig(); + + return screenConfig; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h deleted file mode 100644 index e2c37f60fc..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration.h +++ /dev/null @@ -1,87 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEGLFSKMSINTEGRATION_H -#define QEGLFSKMSINTEGRATION_H - -#include "private/qeglfsdeviceintegration_p.h" -#include <QtCore/QMap> -#include <QtCore/QVariant> -#include <QtCore/QLoggingCategory> - -QT_BEGIN_NAMESPACE - -class QKmsDevice; -class QKmsScreenConfig; - -Q_EGLFS_EXPORT Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug) - -class Q_EGLFS_EXPORT QEglFSKmsIntegration : public QEglFSDeviceIntegration -{ -public: - QEglFSKmsIntegration(); - ~QEglFSKmsIntegration(); - - void platformInit() override; - void platformDestroy() override; - EGLNativeDisplayType platformDisplay() const override; - bool usesDefaultScreen() override; - void screenInit() override; - QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const override; - bool hasCapability(QPlatformIntegration::Capability cap) const override; - void waitForVSync(QPlatformSurface *surface) const override; - bool supportsPBuffers() const override; - void *nativeResourceForIntegration(const QByteArray &name) override; - void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override; - - QKmsDevice *device() const; - QKmsScreenConfig *screenConfig() const; - -protected: - virtual QKmsDevice *createDevice() = 0; - - QKmsDevice *m_device; - QKmsScreenConfig *m_screenConfig; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration_p.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration_p.h new file mode 100644 index 0000000000..36e65a0bd4 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsintegration_p.h @@ -0,0 +1,63 @@ +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEGLFSKMSINTEGRATION_H +#define QEGLFSKMSINTEGRATION_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "private/qeglfsdeviceintegration_p.h" +#include <QtCore/QMap> +#include <QtCore/QVariant> +#include <QtCore/QLoggingCategory> + +QT_BEGIN_NAMESPACE + +class QKmsDevice; +class QKmsScreenConfig; + +Q_DECLARE_EXPORTED_LOGGING_CATEGORY(qLcEglfsKmsDebug, Q_EGLFS_EXPORT) + +class Q_EGLFS_EXPORT QEglFSKmsIntegration : public QEglFSDeviceIntegration +{ +public: + QEglFSKmsIntegration(); + ~QEglFSKmsIntegration(); + + void platformInit() override; + void platformDestroy() override; + EGLNativeDisplayType platformDisplay() const override; + bool usesDefaultScreen() override; + void screenInit() override; + QSurfaceFormat surfaceFormatFor(const QSurfaceFormat &inputFormat) const override; + bool hasCapability(QPlatformIntegration::Capability cap) const override; + void waitForVSync(QPlatformSurface *surface) const override; + bool supportsPBuffers() const override; + void *nativeResourceForIntegration(const QByteArray &name) override; + void *nativeResourceForScreen(const QByteArray &resource, QScreen *screen) override; + + QKmsDevice *device() const; + QKmsScreenConfig *screenConfig() const; + +protected: + virtual QKmsDevice *createDevice() = 0; + virtual QKmsScreenConfig *createScreenConfig(); + + QKmsDevice *m_device; + QKmsScreenConfig *m_screenConfig = nullptr; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp index 959f17eba3..369356b761 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp @@ -1,47 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qeglfskmsscreen.h" -#include "qeglfskmsdevice.h" -#include "qeglfsintegration_p.h" +// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2017 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qeglfskmsscreen_p.h" +#include "qeglfskmsdevice_p.h" +#include <private/qeglfsintegration_p.h> #include <QtCore/QLoggingCategory> @@ -160,14 +124,12 @@ QSizeF QEglFSKmsScreen::physicalSize() const QDpi QEglFSKmsScreen::logicalDpi() const { - const QSizeF ps = physicalSize(); - const QSize s = geometry().size(); - - if (!ps.isEmpty() && !s.isEmpty()) - return QDpi(25.4 * s.width() / ps.width(), - 25.4 * s.height() / ps.height()); - else - return QDpi(100, 100); + return logicalBaseDpi(); +} + +QDpi QEglFSKmsScreen::logicalBaseDpi() const +{ + return QDpi(100, 100); } Qt::ScreenOrientation QEglFSKmsScreen::nativeOrientation() const @@ -218,12 +180,12 @@ qreal QEglFSKmsScreen::refreshRate() const return refresh > 0 ? refresh : 60; } -QVector<QPlatformScreen::Mode> QEglFSKmsScreen::modes() const +QList<QPlatformScreen::Mode> QEglFSKmsScreen::modes() const { - QVector<QPlatformScreen::Mode> list; + QList<QPlatformScreen::Mode> list; list.reserve(m_output.modes.size()); - for (const drmModeModeInfo &info : qAsConst(m_output.modes)) + for (const drmModeModeInfo &info : std::as_const(m_output.modes)) list.append({QSize(info.hdisplay, info.vdisplay), qreal(info.vrefresh > 0 ? info.vrefresh : 60)}); @@ -256,4 +218,13 @@ void QEglFSKmsScreen::setPowerState(QPlatformScreen::PowerState state) m_powerState = state; } +/* Informs exact page flip timing which can be used rendering optimization. + Consider this is from drm event reader thread. */ +void QEglFSKmsScreen::pageFlipped(unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec) +{ + Q_UNUSED(sequence); + Q_UNUSED(tv_sec); + Q_UNUSED(tv_usec); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h deleted file mode 100644 index a5c8f5b4e8..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h +++ /dev/null @@ -1,125 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2016 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QEGLFSKMSSCREEN_H -#define QEGLFSKMSSCREEN_H - -#include "private/qeglfsscreen_p.h" -#include <QtCore/QList> -#include <QtCore/QMutex> - -#include <QtKmsSupport/private/qkmsdevice_p.h> -#include <QtEdidSupport/private/qedidparser_p.h> - -QT_BEGIN_NAMESPACE - -class QEglFSKmsDevice; -class QEglFSKmsInterruptHandler; - -class Q_EGLFS_EXPORT QEglFSKmsScreen : public QEglFSScreen -{ -public: - QEglFSKmsScreen(QEglFSKmsDevice *device, const QKmsOutput &output, bool headless = false); - ~QEglFSKmsScreen(); - - void setVirtualPosition(const QPoint &pos); - - QRect rawGeometry() const override; - - int depth() const override; - QImage::Format format() const override; - - QSizeF physicalSize() const override; - QDpi logicalDpi() const override; - Qt::ScreenOrientation nativeOrientation() const override; - Qt::ScreenOrientation orientation() const override; - - QString name() const override; - - QString manufacturer() const override; - QString model() const override; - QString serialNumber() const override; - - qreal refreshRate() const override; - - QList<QPlatformScreen *> virtualSiblings() const override { return m_siblings; } - void setVirtualSiblings(QList<QPlatformScreen *> sl) { m_siblings = sl; } - - QVector<QPlatformScreen::Mode> modes() const override; - - int currentMode() const override; - int preferredMode() const override; - - QEglFSKmsDevice *device() const { return m_device; } - - virtual void waitForFlip(); - - QKmsOutput &output() { return m_output; } - void restoreMode(); - - SubpixelAntialiasingType subpixelAntialiasingTypeHint() const override; - - QPlatformScreen::PowerState powerState() const override; - void setPowerState(QPlatformScreen::PowerState state) override; - - bool isCursorOutOfRange() const { return m_cursorOutOfRange; } - void setCursorOutOfRange(bool b) { m_cursorOutOfRange = b; } - -protected: - QEglFSKmsDevice *m_device; - - QKmsOutput m_output; - QEdidParser m_edid; - QPoint m_pos; - bool m_cursorOutOfRange; - - QList<QPlatformScreen *> m_siblings; - - PowerState m_powerState; - - QEglFSKmsInterruptHandler *m_interruptHandler; - - bool m_headless; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen_p.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen_p.h new file mode 100644 index 0000000000..6fb1f9a134 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen_p.h @@ -0,0 +1,102 @@ +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2016 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#ifndef QEGLFSKMSSCREEN_H +#define QEGLFSKMSSCREEN_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "private/qeglfsscreen_p.h" +#include <QtCore/QList> +#include <QtCore/QMutex> + +#include <QtKmsSupport/private/qkmsdevice_p.h> +#include <QtGui/private/qedidparser_p.h> + +QT_BEGIN_NAMESPACE + +class QEglFSKmsDevice; +class QEglFSKmsInterruptHandler; + +class Q_EGLFS_EXPORT QEglFSKmsScreen : public QEglFSScreen +{ +public: + QEglFSKmsScreen(QEglFSKmsDevice *device, const QKmsOutput &output, bool headless = false); + ~QEglFSKmsScreen(); + + void setVirtualPosition(const QPoint &pos); + + QRect rawGeometry() const override; + + int depth() const override; + QImage::Format format() const override; + + QSizeF physicalSize() const override; + QDpi logicalDpi() const override; + QDpi logicalBaseDpi() const override; + Qt::ScreenOrientation nativeOrientation() const override; + Qt::ScreenOrientation orientation() const override; + + QString name() const override; + + QString manufacturer() const override; + QString model() const override; + QString serialNumber() const override; + + qreal refreshRate() const override; + + QList<QPlatformScreen *> virtualSiblings() const override { return m_siblings; } + void setVirtualSiblings(QList<QPlatformScreen *> sl) { m_siblings = sl; } + + QList<QPlatformScreen::Mode> modes() const override; + + int currentMode() const override; + int preferredMode() const override; + + QEglFSKmsDevice *device() const { return m_device; } + + virtual void waitForFlip(); + + QKmsOutput &output() { return m_output; } + void restoreMode(); + + SubpixelAntialiasingType subpixelAntialiasingTypeHint() const override; + + QPlatformScreen::PowerState powerState() const override; + void setPowerState(QPlatformScreen::PowerState state) override; + + bool isCursorOutOfRange() const { return m_cursorOutOfRange; } + void setCursorOutOfRange(bool b) { m_cursorOutOfRange = b; } + + virtual void pageFlipped(unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec); +protected: + QEglFSKmsDevice *m_device; + + QKmsOutput m_output; + QEdidParser m_edid; + QPoint m_pos; + bool m_cursorOutOfRange; + + QList<QPlatformScreen *> m_siblings; + + PowerState m_powerState; + + QEglFSKmsInterruptHandler *m_interruptHandler; + + bool m_headless; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/eglfs_kms_vsp2.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/eglfs_kms_vsp2.pro deleted file mode 100644 index f63b768a38..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/eglfs_kms_vsp2.pro +++ /dev/null @@ -1,30 +0,0 @@ -TARGET = qeglfs-kms-vsp2-integration - -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSKmsVsp2IntegrationPlugin -load(qt_plugin) - -QT += core-private gui-private eglfsdeviceintegration-private eglfs_kms_support-private kms_support-private edid_support-private - -INCLUDEPATH += $$PWD/../../api $$PWD/../eglfs_kms_support - -# Avoid X11 header collision, use generic EGL native types -DEFINES += QT_EGL_NO_X11 - -QMAKE_USE += gbm drm v4l2 -CONFIG += egl - -SOURCES += $$PWD/qeglfskmsvsp2main.cpp \ - $$PWD/qeglfskmsvsp2integration.cpp \ - $$PWD/qeglfskmsvsp2device.cpp \ - $$PWD/qeglfskmsvsp2screen.cpp \ - $$PWD/qlinuxmediadevice.cpp \ - $$PWD/qvsp2blendingdevice.cpp - -HEADERS += $$PWD/qeglfskmsvsp2integration.h \ - $$PWD/qeglfskmsvsp2device.h \ - $$PWD/qeglfskmsvsp2screen.h \ - $$PWD/qlinuxmediadevice.h \ - $$PWD/qvsp2blendingdevice.h - -OTHER_FILES += $$PWD/eglfs_kms.json diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2device.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2device.cpp index 44f855910c..e1ac1127b7 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2device.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2device.cpp @@ -1,43 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2017 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfskmsvsp2device.h" #include "qeglfskmsvsp2screen.h" @@ -122,7 +86,7 @@ QPlatformScreen *QEglFSKmsVsp2Device::createHeadlessScreen() void QEglFSKmsVsp2Device::registerScreenCloning(QPlatformScreen *screen, QPlatformScreen *screenThisScreenClones, - const QVector<QPlatformScreen *> &screensCloningThisScreen) + const QList<QPlatformScreen *> &screensCloningThisScreen) { Q_UNUSED(screen); qWarning() << Q_FUNC_INFO << "Not implemented yet"; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2device.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2device.h index c795fa4005..7826ffd4e3 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2device.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2device.h @@ -1,48 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2017 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSKMSVSP2DEVICE_H #define QEGLFSKMSVSP2DEVICE_H -#include <qeglfskmsdevice.h> +#include <qeglfskmsdevice_p.h> #include <gbm.h> @@ -65,7 +29,7 @@ public: QPlatformScreen *createHeadlessScreen() override; void registerScreenCloning(QPlatformScreen *screen, QPlatformScreen *screenThisScreenClones, - const QVector<QPlatformScreen *> &screensCloningThisScreen) override; + const QList<QPlatformScreen *> &screensCloningThisScreen) override; private: Q_DISABLE_COPY(QEglFSKmsVsp2Device) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2integration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2integration.cpp index d1250ec9bf..9150eeb870 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2integration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2integration.cpp @@ -1,43 +1,7 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2017 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfskmsvsp2integration.h" #include "qeglfskmsvsp2device.h" @@ -45,14 +9,13 @@ #include "private/qeglfswindow_p.h" #include <QtDeviceDiscoverySupport/private/qdevicediscovery_p.h> -#include <QtEglSupport/private/qeglconvenience_p.h> +#include <QtGui/private/qeglconvenience_p.h> #include <QtCore/QLoggingCategory> #include <QtCore/QJsonDocument> #include <QtCore/QJsonObject> #include <QtCore/QJsonArray> #include <QtGui/qpa/qplatformwindow.h> #include <QtGui/QScreen> -#include <QtPlatformHeaders/qeglfsfunctions.h> #include <xf86drm.h> #include <xf86drmMode.h> @@ -123,24 +86,6 @@ void QEglFSKmsVsp2Integration::presentBuffer(QPlatformSurface *surface) screen->flip(); } -QFunctionPointer QEglFSKmsVsp2Integration::platformFunction(const QByteArray &function) const -{ - if (function == QEglFSFunctions::vsp2AddLayerTypeIdentifier()) - return QFunctionPointer(addLayerStatic); - if (function == QEglFSFunctions::vsp2RemoveLayerTypeIdentifier()) - return QFunctionPointer(removeLayerStatic); - if (function == QEglFSFunctions::vsp2SetLayerBufferTypeIdentifier()) - return QFunctionPointer(setLayerBufferStatic); - if (function == QEglFSFunctions::vsp2SetLayerPositionTypeIdentifier()) - return QFunctionPointer(setLayerPositionStatic); - if (function == QEglFSFunctions::vsp2SetLayerAlphaTypeIdentifier()) - return QFunctionPointer(setLayerAlphaStatic); - if (function == QEglFSFunctions::vsp2AddBlendListenerTypeIdentifier()) - return QFunctionPointer(addBlendListenerStatic); - - return nullptr; -} - QKmsDevice *QEglFSKmsVsp2Integration::createDevice() { QString path = screenConfig()->devicePath(); @@ -162,42 +107,6 @@ QKmsDevice *QEglFSKmsVsp2Integration::createDevice() return new QEglFSKmsVsp2Device(screenConfig(), path); } -int QEglFSKmsVsp2Integration::addLayerStatic(const QScreen *screen, int dmabufFd, const QSize &size, const QPoint &position, uint pixelFormat, uint bytesPerLine) -{ - auto vsp2Screen = static_cast<QEglFSKmsVsp2Screen *>(screen->handle()); - return vsp2Screen->addLayer(dmabufFd, size, position, pixelFormat, bytesPerLine); -} - -bool QEglFSKmsVsp2Integration::removeLayerStatic(const QScreen *screen, int id) -{ - auto vsp2Screen = static_cast<QEglFSKmsVsp2Screen *>(screen->handle()); - return vsp2Screen->removeLayer(id); -} - -void QEglFSKmsVsp2Integration::setLayerBufferStatic(const QScreen *screen, int id, int dmabufFd) -{ - auto vsp2Screen = static_cast<QEglFSKmsVsp2Screen *>(screen->handle()); - vsp2Screen->setLayerBuffer(id, dmabufFd); -} - -void QEglFSKmsVsp2Integration::setLayerPositionStatic(const QScreen *screen, int id, const QPoint &position) -{ - auto vsp2Screen = static_cast<QEglFSKmsVsp2Screen *>(screen->handle()); - vsp2Screen->setLayerPosition(id, position); -} - -void QEglFSKmsVsp2Integration::setLayerAlphaStatic(const QScreen *screen, int id, qreal alpha) -{ - auto vsp2Screen = static_cast<QEglFSKmsVsp2Screen *>(screen->handle()); - vsp2Screen->setLayerAlpha(id, alpha); -} - -void QEglFSKmsVsp2Integration::addBlendListenerStatic(const QScreen *screen, void(*callback)()) -{ - auto vsp2Screen = static_cast<QEglFSKmsVsp2Screen *>(screen->handle()); - vsp2Screen->addBlendListener(callback); -} - class QEglFSKmsVsp2Window : public QEglFSWindow { public: diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2integration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2integration.h index b1a8a2edf3..10e74eea13 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2integration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2integration.h @@ -1,48 +1,12 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2017 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSKMSVSP2INTEGRATION_H #define QEGLFSKMSVSP2INTEGRATION_H -#include "qeglfskmsintegration.h" +#include "qeglfskmsintegration_p.h" #include <QtCore/QMap> #include <QtCore/QVariant> @@ -62,18 +26,8 @@ public: void presentBuffer(QPlatformSurface *surface) override; QEglFSWindow *createWindow(QWindow *window) const override; - QFunctionPointer platformFunction(const QByteArray &function) const override; - protected: QKmsDevice *createDevice() override; - -private: - static int addLayerStatic(const QScreen *screen, int dmabufFd, const QSize &size, const QPoint &position, uint pixelFormat, uint bytesPerLine); - static bool removeLayerStatic(const QScreen *screen, int id); - static void setLayerBufferStatic(const QScreen *screen, int id, int dmabufFd); - static void setLayerPositionStatic(const QScreen *screen, int id, const QPoint &position); - static void setLayerAlphaStatic(const QScreen *screen, int id, qreal alpha); - static void addBlendListenerStatic(const QScreen *screen, void(*callback)()); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2main.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2main.cpp index 1345d38359..24240a19d3 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2main.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2main.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "private/qeglfsdeviceintegration_p.h" #include "qeglfskmsvsp2integration.h" diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.cpp index c255bc84b7..e5996271bb 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.cpp @@ -1,47 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfskmsvsp2screen.h" #include "qeglfskmsvsp2device.h" -#include <qeglfskmshelpers.h> +#include <qeglfskmshelpers_p.h> #include <QtCore/QLoggingCategory> #include <QtGui/private/qguiapplication_p.h> diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.h index 378786643d..b865522697 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qeglfskmsvsp2screen.h @@ -1,56 +1,23 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> -** Copyright (C) 2017 The Qt Company Ltd. -** Copyright (C) 2016 Pelagicore AG -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2015 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> +// Copyright (C) 2017 The Qt Company Ltd. +// Copyright (C) 2016 Pelagicore AG +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSKMSVSP2SCREEN_H #define QEGLFSKMSVSP2SCREEN_H -#include "qeglfskmsscreen.h" +#include "qeglfskmsscreen_p.h" #include "qvsp2blendingdevice.h" #include <QtCore/QMutex> +#include <qpa/qplatformscreen_p.h> + #include <gbm.h> QT_BEGIN_NAMESPACE class QEglFSKmsVsp2Screen : public QEglFSKmsScreen + , public QNativeInterface::Private::QVsp2Screen { public: QEglFSKmsVsp2Screen(QEglFSKmsDevice *device, const QKmsOutput &output); @@ -63,12 +30,12 @@ public: void initQtLayer(); //TODO: use a fixed index API instead of auto increment? - int addLayer(int dmabufFd, const QSize &size, const QPoint &position, uint drmPixelFormat, uint bytesPerLine); - void setLayerBuffer(int id, int dmabufFd); - void setLayerPosition(int id, const QPoint &position); - void setLayerAlpha(int id, qreal alpha); - bool removeLayer(int id); - void addBlendListener(void (*callback)()); + int addLayer(int dmabufFd, const QSize &size, const QPoint &position, uint drmPixelFormat, uint bytesPerLine) override; + void setLayerBuffer(int id, int dmabufFd) override; + void setLayerPosition(int id, const QPoint &position) override; + void setLayerAlpha(int id, qreal alpha) override; + bool removeLayer(int id) override; + void addBlendListener(void (*callback)()) override; void flip(); void blendAndFlipDrm(); @@ -97,7 +64,7 @@ private: std::array<FrameBuffer, 2> m_frameBuffers; uint m_backFb = 0; void initDumbFrameBuffer(FrameBuffer &fb); - QVector<void (*)()> m_blendFinishedCallbacks; + QList<void (*)()> m_blendFinishedCallbacks; struct DmaBuffer { //these are for qt buffers before blending with additional layers (gbm buffer data) int dmabufFd = -1; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qlinuxmediadevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qlinuxmediadevice.cpp index f77430d7a0..5d2900097e 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qlinuxmediadevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qlinuxmediadevice.cpp @@ -1,45 +1,9 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfsintegration_p.h" #include "qlinuxmediadevice.h" -#include <qeglfskmshelpers.h> +#include <qeglfskmshelpers_p.h> #include <QtCore/QLoggingCategory> #include <QtCore/QSize> @@ -236,7 +200,7 @@ bool QLinuxMediaDevice::resetLinks() struct media_link *QLinuxMediaDevice::parseLink(const QString &link) { - char *endp = nullptr;; + char *endp = nullptr; struct media_link *mediaLink = media_parse_link(m_mediaDevice, link.toStdString().c_str(), &endp); if (!mediaLink) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qlinuxmediadevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qlinuxmediadevice.h index 26f863214b..c0998916c6 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qlinuxmediadevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qlinuxmediadevice.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QLINUXMEDIADEVICE_H #define QLINUXMEDIADEVICE_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qvsp2blendingdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qvsp2blendingdevice.cpp index 132806a2e3..e7e3c76190 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qvsp2blendingdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qvsp2blendingdevice.cpp @@ -1,44 +1,8 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qvsp2blendingdevice.h" -#include <qeglfskmshelpers.h> +#include <qeglfskmshelpers_p.h> #include <QDebug> #include <QtCore/QLoggingCategory> @@ -241,7 +205,7 @@ bool QVsp2BlendingDevice::blend(int outputDmabufFd) if (queueingFailed) { qWarning() << "Vsp2: Trying to clean up queued buffers"; - for (auto &input : qAsConst(m_inputs)) { + for (auto &input : std::as_const(m_inputs)) { if (input.enabled) { if (!input.rpfInput->clearBuffers()) qWarning() << "Vsp2: Failed to remove buffers after an aborted blend"; @@ -284,7 +248,7 @@ int QVsp2BlendingDevice::numInputs() const bool QVsp2BlendingDevice::hasContinuousLayers() const { bool seenDisabled = false; - for (auto &input : qAsConst(m_inputs)) { + for (auto &input : std::as_const(m_inputs)) { if (seenDisabled && input.enabled) return false; seenDisabled |= !input.enabled; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qvsp2blendingdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qvsp2blendingdevice.h index ee34ae654a..3b8e662eb4 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qvsp2blendingdevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_vsp2/qvsp2blendingdevice.h @@ -1,47 +1,11 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QVSP2BLENDINGDEVICE_H #define QVSP2BLENDINGDEVICE_H +#include <QtCore/QList> #include <QtCore/QRect> -#include <QtCore/QVector> #include <QtCore/qglobal.h> #include "qlinuxmediadevice.h" @@ -86,7 +50,7 @@ private: struct media_pad *bruInputFormatPad = nullptr; // bru:x QLinuxMediaDevice::OutputSubDevice *rpfInput = nullptr; // rpf.x input }; - QVector<struct Input> m_inputs; + QList<struct Input> m_inputs; const QSize m_screenSize; bool m_dirty = true; }; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/CMakeLists.txt new file mode 100644 index 0000000000..38981f87b9 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/CMakeLists.txt @@ -0,0 +1,24 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +##################################################################### +## QEglFSMaliIntegrationPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QEglFSMaliIntegrationPlugin + OUTPUT_NAME qeglfs-mali-integration + PLUGIN_TYPE egldeviceintegrations + SOURCES + qeglfsmaliintegration.cpp qeglfsmaliintegration.h + qeglfsmalimain.cpp + DEFINES + QT_EGL_NO_X11 + INCLUDE_DIRECTORIES + ../../api + LIBRARIES + Qt::Core + Qt::CorePrivate + Qt::EglFSDeviceIntegrationPrivate + Qt::Gui + Qt::GuiPrivate +) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro deleted file mode 100644 index 3261a6dbba..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/eglfs_mali.pro +++ /dev/null @@ -1,20 +0,0 @@ -TARGET = qeglfs-mali-integration - -QT += core-private gui-private eglfsdeviceintegration-private - -# Avoid X11 header collision, use generic EGL native types -DEFINES += QT_EGL_NO_X11 - -INCLUDEPATH += $$PWD/../../api -CONFIG += egl - -SOURCES += $$PWD/qeglfsmalimain.cpp \ - $$PWD/qeglfsmaliintegration.cpp - -HEADERS += $$PWD/qeglfsmaliintegration.h - -OTHER_FILES += $$PWD/eglfs_mali.json - -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSMaliIntegrationPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp index 8eb07d727b..36768f6ff2 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfsmaliintegration.h" diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.h index 85eda4889f..24b97a933f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSMALIINTEGRATION_H #define QEGLFSMALIINTEGRATION_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmalimain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmalimain.cpp index 4f87dab967..0a62a67a28 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmalimain.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmalimain.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "private/qeglfsdeviceintegration_p.h" #include "qeglfsmaliintegration.h" diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/CMakeLists.txt new file mode 100644 index 0000000000..7e2362e627 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +##################################################################### +## QEglFSOpenWFDIntegrationPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QEglFSOpenWFDIntegrationPlugin + OUTPUT_NAME qeglfs-openwfd-integration + PLUGIN_TYPE egldeviceintegrations + SOURCES + qeglfsopenwfdintegration.cpp qeglfsopenwfdintegration.h + qeglfsopenwfdmain.cpp + INCLUDE_DIRECTORIES + ../../api + LIBRARIES + Qt::Core + Qt::CorePrivate + Qt::EglFSDeviceIntegrationPrivate + Qt::Gui + Qt::GuiPrivate +) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/eglfs_openwfd.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/eglfs_openwfd.pro deleted file mode 100644 index 448b4cbe21..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/eglfs_openwfd.pro +++ /dev/null @@ -1,17 +0,0 @@ -TARGET = qeglfs-openwfd-integration - -QT += core-private gui-private eglfsdeviceintegration-private - -INCLUDEPATH += $$PWD/../../api -CONFIG += egl - -SOURCES += $$PWD/qeglfsopenwfdmain.cpp \ - $$PWD/qeglfsopenwfdintegration.cpp - -HEADERS += $$PWD/qeglfsopenwfdintegration.h - -OTHER_FILES += $$PWD/eglfs_openwfd.json - -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSOpenWFDIntegrationPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/qeglfsopenwfdintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/qeglfsopenwfdintegration.cpp index b8f04cf978..c23ae7caa1 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/qeglfsopenwfdintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/qeglfsopenwfdintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfsopenwfdintegration.h" @@ -154,23 +118,23 @@ EGLNativeWindowType QEglFSOpenWFDIntegration::createNativeWindow(QPlatformWindow if (!ok) pipelineId = pipelineIds[0]; - WFDPipeline pipeline = wfdCreatePipeline(mDevice, pipelineId, nullptr); - if (WFD_INVALID_HANDLE == pipeline) + mPipeline = wfdCreatePipeline(mDevice, pipelineId, nullptr); + if (WFD_INVALID_HANDLE == mPipeline) qFatal("Failed to create wfd pipeline"); - wfdSetPipelineAttribi(mDevice, pipeline, WFD_PIPELINE_TRANSPARENCY_ENABLE, + wfdSetPipelineAttribi(mDevice, mPipeline, WFD_PIPELINE_TRANSPARENCY_ENABLE, (WFD_TRANSPARENCY_SOURCE_ALPHA|WFD_TRANSPARENCY_GLOBAL_ALPHA)); WFDErrorCode eError = wfdGetError(mDevice); if (WFD_ERROR_NONE != eError) qFatal("Failed to set WFD_PIPELINE_TRANSPARENCY_ENABLE"); - wfdSetPipelineAttribi(mDevice, pipeline, WFD_PIPELINE_GLOBAL_ALPHA, 255); + wfdSetPipelineAttribi(mDevice, mPipeline, WFD_PIPELINE_GLOBAL_ALPHA, 255); eError = wfdGetError(mDevice); if (WFD_ERROR_NONE != eError) qFatal("Failed to set WFD_PIPELINE_GLOBAL_ALPHA"); - wfdBindPipelineToPort(mDevice, mPort, pipeline); + wfdBindPipelineToPort(mDevice, mPort, mPipeline); eError = wfdGetError(mDevice); if (WFD_ERROR_NONE != eError) qFatal("Failed to bind port to pipeline"); @@ -190,7 +154,7 @@ EGLNativeWindowType QEglFSOpenWFDIntegration::createNativeWindow(QPlatformWindow if (WFD_INVALID_HANDLE == wfdEglImages[i]) qFatal("Failed to create WDFEGLImages"); - source[i] = wfdCreateSourceFromImage(mDevice, pipeline, eglImageHandles[i], nullptr); + source[i] = wfdCreateSourceFromImage(mDevice, mPipeline, eglImageHandles[i], nullptr); if (WFD_INVALID_HANDLE == source[i]) qFatal("Failed to create source from EGLImage"); } @@ -208,14 +172,13 @@ EGLNativeWindowType QEglFSOpenWFDIntegration::createNativeWindow(QPlatformWindow nativeWindow->dev = mDevice; nativeWindow->port = mPort; - nativeWindow->pipeline = pipeline; + nativeWindow->pipeline = mPipeline; nativeWindow->numBuffers = MAX_NUM_OF_WFD_BUFFERS; for (int i = 0; i < MAX_NUM_OF_WFD_BUFFERS; i++) { nativeWindow->buffers[i].image = wfdEglImages[i]; nativeWindow->buffers[i].source = source[i]; } - return (EGLNativeWindowType)nativeWindow; } @@ -231,7 +194,16 @@ QSurfaceFormat QEglFSOpenWFDIntegration::surfaceFormatFor(const QSurfaceFormat & void QEglFSOpenWFDIntegration::destroyNativeWindow(EGLNativeWindowType window) { + wfdDestroyPipeline(mDevice, mPipeline); free((void*)window); } +void QEglFSOpenWFDIntegration::platformDestroy() +{ + wfdDestroyPort(mDevice, mPort); + WFDErrorCode error = wfdDestroyDevice(mDevice); + if (error != WFD_ERROR_NONE) + qWarning() << "Failed to release wfd device! Error = " << error; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/qeglfsopenwfdintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/qeglfsopenwfdintegration.h index 189ddd4d7a..c6ff282b5c 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/qeglfsopenwfdintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/qeglfsopenwfdintegration.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSOPENWFDINTEGRATION_H #define QEGLFSOPENWFDINTEGRATION_H @@ -51,6 +15,7 @@ class QEglFSOpenWFDIntegration : public QEglFSDeviceIntegration { public: void platformInit() override; + void platformDestroy() override; QSize screenSize() const override; EGLNativeWindowType createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format) override; void destroyNativeWindow(EGLNativeWindowType window) override; @@ -62,6 +27,7 @@ private: EGLNativeDisplayType mNativeDisplay; WFDDevice mDevice; WFDPort mPort; + WFDPipeline mPipeline; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/qeglfsopenwfdmain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/qeglfsopenwfdmain.cpp index 1d6132b55e..70f2d694f1 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/qeglfsopenwfdmain.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_openwfd/qeglfsopenwfdmain.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2017 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "private/qeglfsdeviceintegration_p.h" #include "qeglfsopenwfdintegration.h" diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/eglfs_rcar.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/eglfs_rcar.pro deleted file mode 100644 index 62acd51cea..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/eglfs_rcar.pro +++ /dev/null @@ -1,18 +0,0 @@ -TARGET = qeglfs-rcar-integration - -QT += core-private gui-private eglfsdeviceintegration-private - -INCLUDEPATH += $$PWD/../../api -CONFIG += egl -DEFINES += LINUX=1 EGL_API_FB=1 - -SOURCES += $$PWD/qeglfsrcarmain.cpp \ - $$PWD/qeglfsrcarintegration.cpp - -HEADERS += $$PWD/qeglfsrcarintegration.h - -OTHER_FILES += $$PWD/eglfs_rcar.json - -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSRcarIntegrationPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarintegration.cpp index 212ebde05a..a805795bab 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarintegration.cpp @@ -1,44 +1,8 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include <QDebug> -#include <QtEglSupport/private/qeglconvenience_p.h> +#include <QtGui/private/qeglconvenience_p.h> #include <EGL/egl.h> #include "INTEGRITY.h" #include "qeglfsrcarintegration.h" diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarintegration.h index 08911594f9..dba6bdfa40 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarintegration.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSVIVINTEGRATION_H #define QEGLFSVIVINTEGRATION_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarmain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarmain.cpp index 6cf3e1387d..2fcadad4ff 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarmain.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarmain.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "INTEGRITY.h" #include "private/qeglfsdeviceintegration_p.h" diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/CMakeLists.txt new file mode 100644 index 0000000000..01defc9242 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/CMakeLists.txt @@ -0,0 +1,25 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +##################################################################### +## QEglFSVivIntegrationPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QEglFSVivIntegrationPlugin + OUTPUT_NAME qeglfs-viv-integration + PLUGIN_TYPE egldeviceintegrations + SOURCES + qeglfsvivintegration.cpp qeglfsvivintegration.h + qeglfsvivmain.cpp + DEFINES + EGL_API_FB=1 + LINUX=1 + INCLUDE_DIRECTORIES + ../../api + LIBRARIES + Qt::Core + Qt::CorePrivate + Qt::EglFSDeviceIntegrationPrivate + Qt::Gui + Qt::GuiPrivate +) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro deleted file mode 100644 index 8d3be9c2ac..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/eglfs_viv.pro +++ /dev/null @@ -1,18 +0,0 @@ -TARGET = qeglfs-viv-integration - -QT += core-private gui-private eglfsdeviceintegration-private - -INCLUDEPATH += $$PWD/../../api -CONFIG += egl -DEFINES += LINUX=1 EGL_API_FB=1 - -SOURCES += $$PWD/qeglfsvivmain.cpp \ - $$PWD/qeglfsvivintegration.cpp - -HEADERS += $$PWD/qeglfsvivintegration.h - -OTHER_FILES += $$PWD/eglfs_viv.json - -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSVivIntegrationPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.cpp index 2fc076ad0c..c8b08f95a4 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfsvivintegration.h" #include <EGL/eglvivante.h> @@ -85,8 +49,8 @@ EGLNativeDisplayType QEglFSVivIntegration::platformDisplay() const EGLNativeWindowType QEglFSVivIntegration::createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format) { - Q_UNUSED(window) - Q_UNUSED(format) + Q_UNUSED(window); + Q_UNUSED(format); EGLNativeWindowType eglWindow = static_cast<EGLNativeWindowType>(fbCreateWindow(mNativeDisplay, 0, 0, size.width(), size.height())); return eglWindow; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.h index 4d1718afcf..abee5e623d 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivintegration.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSVIVINTEGRATION_H #define QEGLFSVIVINTEGRATION_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivmain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivmain.cpp index 0736637b6b..2db12e0e71 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivmain.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv/qeglfsvivmain.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "private/qeglfsdeviceintegration_p.h" #include "qeglfsvivintegration.h" diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/CMakeLists.txt new file mode 100644 index 0000000000..6052e98ab8 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/CMakeLists.txt @@ -0,0 +1,26 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +##################################################################### +## QEglFSVivWaylandIntegrationPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QEglFSVivWaylandIntegrationPlugin + OUTPUT_NAME qeglfs-viv-wl-integration + PLUGIN_TYPE egldeviceintegrations + SOURCES + qeglfsvivwlintegration.cpp qeglfsvivwlintegration.h + qeglfsvivwlmain.cpp + DEFINES + EGL_API_FB=1 + LINUX=1 + INCLUDE_DIRECTORIES + ../../api + LIBRARIES + Wayland::Server + Qt::Core + Qt::CorePrivate + Qt::EglFSDeviceIntegrationPrivate + Qt::Gui + Qt::GuiPrivate +) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro deleted file mode 100644 index 45d73e1eb8..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/eglfs_viv_wl.pro +++ /dev/null @@ -1,20 +0,0 @@ -TARGET = qeglfs-viv-wl-integration - -QT += core-private gui-private eglfsdeviceintegration-private - -INCLUDEPATH += $$PWD/../../api -CONFIG += egl -DEFINES += LINUX=1 EGL_API_FB=1 - -SOURCES += $$PWD/qeglfsvivwlmain.cpp \ - $$PWD/qeglfsvivwlintegration.cpp - -HEADERS += $$PWD/qeglfsvivwlintegration.h - -OTHER_FILES += $$PWD/eglfs_viv_wl.json - -QMAKE_USE_PRIVATE += wayland_server - -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSVivWaylandIntegrationPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.cpp index 296e301f07..898ea96e1f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfsvivwlintegration.h" #include <EGL/eglvivante.h> @@ -83,8 +47,8 @@ EGLNativeDisplayType QEglFSVivWaylandIntegration::platformDisplay() const EGLNativeWindowType QEglFSVivWaylandIntegration::createNativeWindow(QPlatformWindow *window, const QSize &size, const QSurfaceFormat &format) { - Q_UNUSED(window) - Q_UNUSED(format) + Q_UNUSED(window); + Q_UNUSED(format); EGLNativeWindowType eglWindow = static_cast<EGLNativeWindowType>(fbCreateWindow(mNativeDisplay, 0, 0, size.width(), size.height())); return eglWindow; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.h index bee23dfb3e..84cdfe34db 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlintegration.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSVIVINTEGRATION_H #define QEGLFSVIVINTEGRATION_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlmain.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlmain.cpp index 6cdc9346c0..357265d708 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlmain.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_viv_wl/qeglfsvivwlmain.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "private/qeglfsdeviceintegration_p.h" #include "qeglfsvivwlintegration.h" diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/CMakeLists.txt b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/CMakeLists.txt new file mode 100644 index 0000000000..9dde3090c8 --- /dev/null +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/CMakeLists.txt @@ -0,0 +1,28 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause + +##################################################################### +## QEglFSX11IntegrationPlugin Plugin: +##################################################################### + +qt_internal_add_plugin(QEglFSX11IntegrationPlugin + OUTPUT_NAME qeglfs-x11-integration + PLUGIN_TYPE egldeviceintegrations + SOURCES + qeglfsx11integration.cpp qeglfsx11integration.h + qeglfsx11main.cpp + DEFINES + QT_EGL_NO_X11 + INCLUDE_DIRECTORIES + ../../api + LIBRARIES + Qt::Core + Qt::CorePrivate + Qt::EglFSDeviceIntegrationPrivate + Qt::Gui + Qt::GuiPrivate + X11::X11 + X11::XCB + XCB::XCB + NO_UNITY_BUILD # X11 define clashes +) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro deleted file mode 100644 index 6b55918f03..0000000000 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro +++ /dev/null @@ -1,22 +0,0 @@ -TARGET = qeglfs-x11-integration - -QT += core-private gui-private eglfsdeviceintegration-private - -# Avoid X11 header collision, use generic EGL native types -DEFINES += QT_EGL_NO_X11 - -INCLUDEPATH += $$PWD/../../api - -CONFIG += egl -QMAKE_USE += xcb_xlib xcb xlib - -SOURCES += $$PWD/qeglfsx11main.cpp \ - $$PWD/qeglfsx11integration.cpp - -HEADERS += $$PWD/qeglfsx11integration.h - -OTHER_FILES += $$PWD/eglfs_x11.json - -PLUGIN_TYPE = egldeviceintegrations -PLUGIN_CLASS_NAME = QEglFSX11IntegrationPlugin -load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp index ce5a721906..8f491274d5 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "qeglfsx11integration.h" #include <QThread> @@ -61,7 +25,7 @@ private: QEglFSX11Integration *m_integration; }; -QAtomicInt running; +Q_CONSTINIT static QBasicAtomicInt running = Q_BASIC_ATOMIC_INITIALIZER(0); void EventReader::run() { @@ -151,7 +115,7 @@ QSize QEglFSX11Integration::screenSize() const { if (m_screenSize.isEmpty()) { QList<QByteArray> env = qgetenv("EGLFS_X11_SIZE").split('x'); - if (env.length() == 2) { + if (env.size() == 2) { m_screenSize = QSize(env.at(0).toInt(), env.at(1).toInt()); } else { XWindowAttributes a; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h index ebcc19b682..e083c157cd 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QEGLFSX11INTEGRATION_H #define QEGLFSX11INTEGRATION_H diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11main.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11main.cpp index 39ab54ae5a..b46e88843f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11main.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11main.cpp @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include "private/qeglfsdeviceintegration_p.h" #include "qeglfsx11integration.h" diff --git a/src/plugins/platforms/eglfs/eglfs-plugin.pro b/src/plugins/platforms/eglfs/eglfs-plugin.pro deleted file mode 100644 index ec229796e5..0000000000 --- a/src/plugins/platforms/eglfs/eglfs-plugin.pro +++ /dev/null @@ -1,19 +0,0 @@ -TARGET = qeglfs - -QT += eglfsdeviceintegration-private - -CONFIG += egl - -# Avoid X11 header collision, use generic EGL native types -DEFINES += QT_EGL_NO_X11 - -SOURCES += $$PWD/qeglfsmain.cpp - -OTHER_FILES += $$PWD/eglfs.json - -INCLUDEPATH += $$PWD/api - -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QEglFSIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) diff --git a/src/plugins/platforms/eglfs/eglfs.pro b/src/plugins/platforms/eglfs/eglfs.pro deleted file mode 100644 index d91ffd60a1..0000000000 --- a/src/plugins/platforms/eglfs/eglfs.pro +++ /dev/null @@ -1,6 +0,0 @@ -TEMPLATE = subdirs -CONFIG += ordered - -SUBDIRS += eglfsdeviceintegration.pro -SUBDIRS += eglfs-plugin.pro -SUBDIRS += deviceintegration diff --git a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro b/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro deleted file mode 100644 index 8bb7b614f1..0000000000 --- a/src/plugins/platforms/eglfs/eglfsdeviceintegration.pro +++ /dev/null @@ -1,49 +0,0 @@ -# The device integration plugin base class has to live in a shared library, -# placing it into a static lib like platformsupport is not sufficient since we -# have to keep the QObject magic like qobject_cast working. -# Hence this private-only module. -# By having _p headers, it also enables developing out-of-tree integration plugins. - -TARGET = QtEglFSDeviceIntegration -CONFIG += internal_module -MODULE = eglfsdeviceintegration - -QT += \ - core-private gui-private \ - devicediscovery_support-private eventdispatcher_support-private \ - service_support-private theme_support-private fontdatabase_support-private \ - fb_support-private egl_support-private - -qtHaveModule(input_support-private): \ - QT += input_support-private - -qtHaveModule(platformcompositor_support-private): \ - QT += platformcompositor_support-private - -# Avoid X11 header collision, use generic EGL native types -DEFINES += QT_EGL_NO_X11 - -DEFINES += QT_BUILD_EGL_DEVICE_LIB - -include($$PWD/api/api.pri) - -!isEmpty(EGLFS_PLATFORM_HOOKS_SOURCES) { - HEADERS += $$EGLFS_PLATFORM_HOOKS_HEADERS - SOURCES += $$EGLFS_PLATFORM_HOOKS_SOURCES - LIBS += $$EGLFS_PLATFORM_HOOKS_LIBS - DEFINES += EGLFS_PLATFORM_HOOKS -} - -!isEmpty(EGLFS_DEVICE_INTEGRATION) { - DEFINES += EGLFS_PREFERRED_PLUGIN=$$EGLFS_DEVICE_INTEGRATION -} - -CONFIG += egl - -# Prevent gold linker from crashing. -# This started happening when QtPlatformSupport was modularized. -use_gold_linker: CONFIG += no_linker_version_script - -!contains(DEFINES, QT_NO_CURSOR): RESOURCES += $$PWD/cursor.qrc - -load(qt_module) diff --git a/src/plugins/platforms/eglfs/qeglfsmain.cpp b/src/plugins/platforms/eglfs/qeglfsmain.cpp index b41bbec27d..13e4199f45 100644 --- a/src/plugins/platforms/eglfs/qeglfsmain.cpp +++ b/src/plugins/platforms/eglfs/qeglfsmain.cpp @@ -1,47 +1,13 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #include <qpa/qplatformintegrationplugin.h> -#include "qeglfsintegration_p.h" +#include <private/qeglfsintegration_p.h> QT_BEGIN_NAMESPACE +using namespace Qt::StringLiterals; + class QEglFSIntegrationPlugin : public QPlatformIntegrationPlugin { Q_OBJECT @@ -53,7 +19,7 @@ public: QPlatformIntegration* QEglFSIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (!system.compare(QLatin1String("eglfs"), Qt::CaseInsensitive)) + if (!system.compare("eglfs"_L1, Qt::CaseInsensitive)) return new QEglFSIntegration; return nullptr; |