diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-07-06 15:35:28 +0200 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2020-07-06 15:41:25 +0200 |
commit | 1f0299b029eadc988872dc6b0bc27e78a625c871 (patch) | |
tree | a2bbdad506af8865f9117e13451af7a542a1cb9e /src/plugins | |
parent | cd75446c1e6e9ce17f9bb536af97775ad62aef1a (diff) |
Remove OpenWFD platform plugin
It was added in 2011 and has not seen any development since, and was
never included in the build system.
The OpenWFD use-case is covered by EGLFS, which has a dedicated
OpenWFD backend.
Change-Id: Id08c505e2d869a96255163cae2ede51b9efeb73f
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/plugins')
24 files changed, 0 insertions, 2326 deletions
diff --git a/src/plugins/platforms/openwfd/main.cpp b/src/plugins/platforms/openwfd/main.cpp deleted file mode 100644 index 0609f92139..0000000000 --- a/src/plugins/platforms/openwfd/main.cpp +++ /dev/null @@ -1,61 +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$ -** -****************************************************************************/ - -#include <qpa/qplatformintegrationplugin.h> -#include "qopenwfdintegration.h" - -QT_BEGIN_NAMESPACE - -class QOpenWFDIntegrationPlugin : public QPlatformIntegrationPlugin -{ - Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid) -public: - QPlatformIntegration *create(const QString&, const QStringList&); -}; - -QPlatformIntegration* QOpenWFDIntegrationPlugin::create(const QString& system, const QStringList& paramList) -{ - Q_UNUSED(paramList); - if (!system.compare(QLatin1String("openwfd"), Qt::CaseInsensitive)) - return new QOpenWFDIntegration; - - return 0; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/openwfd/openwf.pro b/src/plugins/platforms/openwfd/openwf.pro deleted file mode 100644 index 0c097f4676..0000000000 --- a/src/plugins/platforms/openwfd/openwf.pro +++ /dev/null @@ -1,39 +0,0 @@ -TARGET = qopenwf - -QT += \ - core-private gui-private - -HEADERS += \ - qopenwfddevice.h \ - qopenwfdintegration.h \ - qopenwfdnativeinterface.h \ - qopenwfdscreen.h \ - qopenwfdbackingstore.h \ - qopenwfdevent.h \ - qopenwfdglcontext.h \ - qopenwfdoutputbuffer.h \ - qopenwfdport.h \ - qopenwfdwindow.h \ - qopenwfdportmode.h - -SOURCES += \ - main.cpp \ - qopenwfddevice.cpp \ - qopenwfdintegration.cpp \ - qopenwfdnativeinterface.cpp \ - qopenwfdscreen.cpp \ - qopenwfdbackingstore.cpp \ - qopenwfdevent.cpp \ - qopenwfdglcontext.cpp \ - qopenwfdoutputbuffer.cpp \ - qopenwfdport.cpp \ - qopenwfdportmode.cpp \ - qopenwfdwindow.cpp - -LIBS += -lWFD -QMAKE_USE += gbm opengl_es2 egl - -PLUGIN_TYPE = platforms -PLUGIN_CLASS_NAME = QOpenWFDIntegrationPlugin -!equals(TARGET, $$QT_DEFAULT_QPA_PLUGIN): PLUGIN_EXTENDS = - -load(qt_plugin) diff --git a/src/plugins/platforms/openwfd/qopenwfdbackingstore.cpp b/src/plugins/platforms/openwfd/qopenwfdbackingstore.cpp deleted file mode 100644 index 1ee2e05cb1..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdbackingstore.cpp +++ /dev/null @@ -1,64 +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$ -** -****************************************************************************/ - -#include "qopenwfdbackingstore.h" - -QOpenWFDBackingStore::QOpenWFDBackingStore(QWindow *window) - : QPlatformBackingStore(window) -{ -} - -QPaintDevice * QOpenWFDBackingStore::paintDevice() -{ - return &mImage; -} - -//we don't support flush yet :) -void QOpenWFDBackingStore::flush(QWindow *window, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(window); - Q_UNUSED(region); - Q_UNUSED(offset); -} - -void QOpenWFDBackingStore::resize(const QSize &size, const QRegion &staticContents) -{ - Q_UNUSED(staticContents); - mImage = QImage(size,QImage::Format_RGB32); -} diff --git a/src/plugins/platforms/openwfd/qopenwfdbackingstore.h b/src/plugins/platforms/openwfd/qopenwfdbackingstore.h deleted file mode 100644 index 99bad8f471..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdbackingstore.h +++ /dev/null @@ -1,63 +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 QOPENWFDBACKINGSTORE_H -#define QOPENWFDBACKINGSTORE_H - -#include <qpa/qplatformbackingstore.h> -#include <QtGui/QImage> - -class QOpenWFDBackingStore : public QPlatformBackingStore -{ -public: - QOpenWFDBackingStore(QWindow *window); - - QPaintDevice *paintDevice(); - - // 'window' can be a child window, in which case 'region' is in child window coordinates and - // offset is the (child) window's offset in relation to the window surface. - void flush(QWindow *window, const QRegion ®ion, const QPoint &offset); - - void resize(const QSize &size, const QRegion &staticContents); - -private: - QImage mImage; -}; - -#endif // QOPENWFDBACKINGSTORE_H diff --git a/src/plugins/platforms/openwfd/qopenwfddevice.cpp b/src/plugins/platforms/openwfd/qopenwfddevice.cpp deleted file mode 100644 index 99896151b2..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfddevice.cpp +++ /dev/null @@ -1,315 +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$ -** -****************************************************************************/ - -#include "qopenwfddevice.h" - -#include "qopenwfdport.h" -#include "qopenwfdscreen.h" - -#include <QtCore/QDebug> - -#include <WF/wfdext.h> -#include <gbm.h> - -QOpenWFDDevice::QOpenWFDDevice(QOpenWFDIntegration *integration, WFDint device_enumeration) - : mIntegration(integration) - , mDeviceEnum(device_enumeration) - , mCommitedDevice(false) - , mWaitingForBindSourceEvent(false) -{ - mDevice = wfdCreateDevice(WFD_DEFAULT_DEVICE_ID,WFD_NONE); - if (mDevice == WFD_INVALID_HANDLE) - qDebug("failed to create device"); - - mEvent = wfdCreateEvent(mDevice,0); - if (mEvent == WFD_INVALID_HANDLE) - qDebug("failed to create event handle"); - - //initialize pipelines for device. - wfdEnumeratePipelines(mDevice,WFD_NONE,0,WFD_NONE); - - initializeGbmAndEgl(); - - WFDint numberOfPorts = wfdEnumeratePorts(mDevice,0,0,0); - WFDint port_enumerations[numberOfPorts]; - WFDint actualNumberOfPorts = wfdEnumeratePorts(mDevice,port_enumerations,numberOfPorts,WFD_NONE); - Q_ASSERT(actualNumberOfPorts == numberOfPorts); - - for (int i = 0; i < actualNumberOfPorts; i++) - { - QOpenWFDPort *port = new QOpenWFDPort(this,port_enumerations[i]); - if (port->attached()) { - mPorts.append(port); - } else { - delete port; - } - } - - int fd = wfdDeviceEventGetFD(mDevice,mEvent); - mEventSocketNotifier = new QSocketNotifier(fd,QSocketNotifier::Read,this); - connect(mEventSocketNotifier,SIGNAL(activated(QSocketDescriptor)),SLOT(readEvents())); - - mCommitedDevice = true; - commit(WFD_COMMIT_ENTIRE_DEVICE, handle()); -} - -QOpenWFDDevice::~QOpenWFDDevice() -{ - delete mEventSocketNotifier; - wfdDestroyEvent(mDevice,mEvent); - - for (int i = 0; i < mPorts.size(); i++) { - //probably don't need to remove them from the list - QList <WFDint> keys = mUsedPipelines.keys(mPorts.at(i)); - for (int keyIndex = 0; keyIndex < keys.size(); keyIndex++) { - mUsedPipelines.remove(keys.at(keyIndex)); - } - //but we have to delete them :) - delete mPorts[i]; - } - - eglDestroyContext(mEglDisplay,mEglContext); - eglTerminate(mEglDisplay); - - gbm_device_destroy(mGbmDevice); - - wfdDestroyDevice(mDevice); -} - -WFDDevice QOpenWFDDevice::handle() const -{ - return mDevice; -} - -QOpenWFDIntegration * QOpenWFDDevice::integration() const -{ - return mIntegration; -} - -bool QOpenWFDDevice::isPipelineUsed(WFDint pipelineId) -{ - return mUsedPipelines.contains(pipelineId); -} - -void QOpenWFDDevice::addToUsedPipelineSet(WFDint pipelineId,QOpenWFDPort *port) -{ - mUsedPipelines.insert(pipelineId,port); -} - -void QOpenWFDDevice::removeFromUsedPipelineSet(WFDint pipelineId) -{ - mUsedPipelines.remove(pipelineId); -} - -gbm_device * QOpenWFDDevice::gbmDevice() const - -{ - return mGbmDevice; -} - -EGLDisplay QOpenWFDDevice::eglDisplay() const -{ - return mEglDisplay; -} - -EGLContext QOpenWFDDevice::eglContext() const -{ - return mEglContext; -} - -void QOpenWFDDevice::commit(WFDCommitType type, WFDHandle handle) -{ - if (mCommitedDevice) { - wfdDeviceCommit(mDevice,type,handle); - } -} - -void QOpenWFDDevice::waitForPipelineBindSourceCompleteEvent() -{ - mWaitingForBindSourceEvent = true; - - while (mWaitingForBindSourceEvent) { - readEvents(WFD_FOREVER); - } -} - -void QOpenWFDDevice::readEvents(WFDtime wait) -{ - WFDEventType type = wfdDeviceEventWait(mDevice,mEvent,wait); - - if (type == WFD_EVENT_NONE || type == WFD_EVENT_DESTROYED) { - return; - } - switch (type) { - case WFD_EVENT_INVALID: - case WFD_EVENT_NONE: - return; - case WFD_EVENT_DESTROYED: - qDebug("Event or Device destoryed!"); - return; - case WFD_EVENT_PORT_ATTACH_DETACH: - handlePortAttachDetach(); - break; - case WFD_EVENT_PORT_PROTECTION_FAILURE: - qDebug("Port protection event handling not implemented"); - break; - case WFD_EVENT_PIPELINE_BIND_SOURCE_COMPLETE: - handlePipelineBindSourceComplete(); - break; - case WFD_EVENT_PIPELINE_BIND_MASK_COMPLETE: - qDebug("Pipeline bind mask event handling not implemented"); - break; - default: - qDebug("Unrecognized event type: %lu", static_cast<long unsigned int>(type)); - break; - } - - -} - -void QOpenWFDDevice::initializeGbmAndEgl() -{ - - qDebug("initializing GBM and EGL"); - int fd = wfdGetDeviceAttribi(mDevice,WFD_DEVICE_ID); - if (fd < 0) { - qDebug("failed to get WFD_DEVICE_ID"); - } - - mGbmDevice = gbm_create_device(fd); - - setenv("EGL_PLATFORM", "drm",1); - - mEglDisplay = eglGetDisplay(mGbmDevice); - - EGLint minor, major; - - if (!eglInitialize(mEglDisplay,&major,&minor)) { - qDebug("failed to initialize egl"); - } - - QByteArray eglExtensions = eglQueryString(mEglDisplay, EGL_EXTENSIONS); - if (!eglExtensions.contains("EGL_KHR_surfaceless_opengl")) { - qDebug("This egl implementation does not have the required EGL extension EGL_KHR_surfaceless_opengl"); - } - - eglBindAPI(EGL_OPENGL_ES_API); - - EGLint contextAttribs[] = { - EGL_CONTEXT_CLIENT_VERSION, 2, - EGL_NONE - }; - - mEglContext = eglCreateContext(mEglDisplay,NULL,EGL_NO_CONTEXT,contextAttribs); - if (mEglContext == EGL_NO_CONTEXT) { - qDebug("Failed to create EGL context"); - } - - eglCreateImage = (PFNEGLCREATEIMAGEKHRPROC) eglGetProcAddress("eglCreateImageKHR"); - if (!eglCreateImage) { - qWarning("failed to load extension eglCreateImageKHR"); - } - - eglDestroyImage = (PFNEGLDESTROYIMAGEKHRPROC) eglGetProcAddress("eglDestroyImageKHR"); - if (!eglDestroyImage) { - qWarning("failed to load extension eglDestoryImageKHR"); - } - - glEglImageTargetRenderBufferStorage = (PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) eglGetProcAddress("glEGLImageTargetRenderbufferStorageOES"); - if (!glEglImageTargetRenderBufferStorage) { - qWarning("failed to load extension glEGLImageTargetRenderbufferStorageOES"); - } -} - -void QOpenWFDDevice::handlePortAttachDetach() -{ - WFDint id = wfdGetEventAttribi(mDevice,mEvent,WFD_EVENT_PORT_ATTACH_PORT_ID); - if (id == WFD_INVALID_PORT_ID) - return; - - WFDint attachState = wfdGetEventAttribi(mDevice,mEvent,WFD_EVENT_PORT_ATTACH_STATE); - if (attachState == WFD_TRUE) { - int indexToAdd = -1; - for (int i = 0; i < mPorts.size(); i++) { - if (mPorts.at(i)->portId() == id) { - indexToAdd = i; - qDebug("found index to attach"); - break; - } - } - if (indexToAdd >= 0) { - mPorts[indexToAdd]->attach(); - } else { - mPorts.append(new QOpenWFDPort(this,id)); - } - - } else { - int indexToDelete = -1; - for (int i = 0; i < mPorts.size(); i++) { - if (mPorts.at(i)->portId() == id) { - indexToDelete = i; - break; - } - } - if (indexToDelete >= 0) { - QOpenWFDPort *portToDelete = mPorts.at(indexToDelete); - mPorts.removeAt(indexToDelete); - delete portToDelete; - } - } -} - -void QOpenWFDDevice::handlePipelineBindSourceComplete() -{ - mWaitingForBindSourceEvent = false; - - WFDint overflow = wfdGetEventAttribi(mDevice,mEvent, WFD_EVENT_PIPELINE_BIND_QUEUE_OVERFLOW); - if (overflow == WFD_TRUE) { - qDebug("PIPELINE_BIND_QUEUE_OVERFLOW event occurred"); - } - - WFDint pipelineId = wfdGetEventAttribi(mDevice,mEvent,WFD_EVENT_PIPELINE_BIND_PIPELINE_ID); - for (int i = 0; i < mPorts.size(); i++) { - if (pipelineId != WFD_INVALID_PIPELINE_ID && mUsedPipelines.contains(pipelineId)) { - QOpenWFDPort *port = mUsedPipelines.value(pipelineId); - port->screen()->pipelineBindSourceComplete(); - break; - } - } -} diff --git a/src/plugins/platforms/openwfd/qopenwfddevice.h b/src/plugins/platforms/openwfd/qopenwfddevice.h deleted file mode 100644 index bd89edd313..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfddevice.h +++ /dev/null @@ -1,111 +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 QOPENWFDDEVICE_H -#define QOPENWFDDEVICE_H - -#include "qopenwfdintegration.h" - -#include <QtCore/QList> -#include <QtCore/QSet> -#include <QtCore/QSocketNotifier> - -#include <WF/wfd.h> - -#include <gbm.h> -#include <EGL/egl.h> -#include <EGL/eglext.h> -#include <GLES2/gl2.h> -#include <GLES2/gl2ext.h> - -class QOpenWFDPort; - -class QOpenWFDDevice : public QObject -{ - Q_OBJECT -public: - QOpenWFDDevice(QOpenWFDIntegration *integration, WFDint handle); - ~QOpenWFDDevice(); - WFDDevice handle() const; - QOpenWFDIntegration *integration() const; - - - bool isPipelineUsed(WFDint pipelineId); - void addToUsedPipelineSet(WFDint pipelineId, QOpenWFDPort *port); - void removeFromUsedPipelineSet(WFDint pipelineId); - - gbm_device *gbmDevice() const; - EGLDisplay eglDisplay() const; - EGLContext eglContext() const; - - PFNEGLCREATEIMAGEKHRPROC eglCreateImage; - PFNEGLDESTROYIMAGEKHRPROC eglDestroyImage; - PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC glEglImageTargetRenderBufferStorage; - - void commit(WFDCommitType type, WFDHandle handle); - bool isDeviceInitializedAndCommited() const { return mCommitedDevice; } - - void waitForPipelineBindSourceCompleteEvent(); - -public slots: - void readEvents(WFDtime wait = 0); -private: - void initializeGbmAndEgl(); - void handlePortAttachDetach(); - void handlePipelineBindSourceComplete(); - QOpenWFDIntegration *mIntegration; - WFDint mDeviceEnum; - WFDDevice mDevice; - - WFDEvent mEvent; - QSocketNotifier *mEventSocketNotifier; - - QList<QOpenWFDPort *> mPorts; - - QMap<WFDint, QOpenWFDPort *> mUsedPipelines; - - struct gbm_device *mGbmDevice; - EGLDisplay mEglDisplay; - EGLContext mEglContext; - - bool mCommitedDevice; - bool mWaitingForBindSourceEvent; -}; - -#endif // QOPENWFDDEVICE_H diff --git a/src/plugins/platforms/openwfd/qopenwfdevent.cpp b/src/plugins/platforms/openwfd/qopenwfdevent.cpp deleted file mode 100644 index 6ffe5bcf45..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdevent.cpp +++ /dev/null @@ -1,44 +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$ -** -****************************************************************************/ - -#include "qopenwfdevent.h" - -QOpenWFDEvent::QOpenWFDEvent() -{ -} diff --git a/src/plugins/platforms/openwfd/qopenwfdevent.h b/src/plugins/platforms/openwfd/qopenwfdevent.h deleted file mode 100644 index 122a61bc5d..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdevent.h +++ /dev/null @@ -1,49 +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 QOPENWFDEVENT_H -#define QOPENWFDEVENT_H - -class QOpenWFDEvent -{ -public: - QOpenWFDEvent(); -}; - -#endif // QOPENWFDEVENT_H diff --git a/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp b/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp deleted file mode 100644 index cf267ea203..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdglcontext.cpp +++ /dev/null @@ -1,101 +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$ -** -****************************************************************************/ - -#include "qopenwfdglcontext.h" - -#include "qopenwfdwindow.h" -#include "qopenwfdscreen.h" -#include <dlfcn.h> - -QOpenWFDGLContext::QOpenWFDGLContext(QOpenWFDDevice *device) - : QPlatformOpenGLContext() - , mWfdDevice(device) -{ -} - -QSurfaceFormat QOpenWFDGLContext::format() const -{ - return QSurfaceFormat(); -} - -bool QOpenWFDGLContext::makeCurrent(QPlatformSurface *surface) -{ - Q_ASSERT(surface->surface()->surfaceType() == QSurface::OpenGLSurface); - - EGLDisplay display = mWfdDevice->eglDisplay(); - EGLContext context = mWfdDevice->eglContext(); - if (!eglMakeCurrent(display,EGL_NO_SURFACE,EGL_NO_SURFACE,context)) { - qDebug("GLContext: eglMakeCurrent FAILED!"); - } - - QPlatformWindow *window = static_cast<QPlatformWindow *>(surface); - QOpenWFDScreen *screen = static_cast<QOpenWFDScreen *>(QPlatformScreen::platformScreenForWindow(window->window())); - screen->bindFramebuffer(); - return true; -} - -void QOpenWFDGLContext::doneCurrent() -{ - //do nothing :) -} - -void QOpenWFDGLContext::swapBuffers(QPlatformSurface *surface) -{ - glFlush(); - - QPlatformWindow *window = static_cast<QPlatformWindow *>(surface); - QOpenWFDScreen *screen = static_cast<QOpenWFDScreen *>(QPlatformScreen::platformScreenForWindow(window->window())); - - screen->swapBuffers(); -} - -QFunctionPointer QOpenWFDGLContext::getProcAddress(const char *procName) -{ - QFunctionPointer proc = (QFunctionPointer) eglGetProcAddress(procName); - if (!proc) - proc = (QFunctionPointer) dlsym(RTLD_DEFAULT, procName); - return proc; -} - -EGLContext QOpenWFDGLContext::eglContext() const -{ - return mWfdDevice->eglContext(); -} - - diff --git a/src/plugins/platforms/openwfd/qopenwfdglcontext.h b/src/plugins/platforms/openwfd/qopenwfdglcontext.h deleted file mode 100644 index 1c2541e098..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdglcontext.h +++ /dev/null @@ -1,66 +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 QOPENWFDGLCONTEXT_H -#define QOPENWFDGLCONTEXT_H - -#include <qpa/qplatformopenglcontext.h> - -#include "qopenwfddevice.h" - -class QOpenWFDGLContext : public QPlatformOpenGLContext -{ -public: - QOpenWFDGLContext(QOpenWFDDevice *device); - - QSurfaceFormat format() const; - - bool makeCurrent(QPlatformSurface *surface); - void doneCurrent(); - - void swapBuffers(QPlatformSurface *surface); - - QFunctionPointer getProcAddress(const char *procName); - - EGLContext eglContext() const; -private: - QOpenWFDDevice *mWfdDevice; -}; - -#endif // QOPENWFDGLCONTEXT_H diff --git a/src/plugins/platforms/openwfd/qopenwfdintegration.cpp b/src/plugins/platforms/openwfd/qopenwfdintegration.cpp deleted file mode 100644 index 253bdf39e7..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdintegration.cpp +++ /dev/null @@ -1,138 +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$ -** -****************************************************************************/ - -#include "qopenwfdintegration.h" -#include "qopenwfdscreen.h" -#include "qopenwfdnativeinterface.h" -#include "qopenwfddevice.h" -#include "qopenwfdwindow.h" -#include "qopenwfdglcontext.h" -#include "qopenwfdbackingstore.h" - -#include <QtPlatformSupport/private/qgenericunixprintersupport_p.h> - -#include <QtGui/private/qguiapplication_p.h> -#include <QtGui/QOpenGLContext> -#include <QtGui/QScreen> -#include <qpa/qwindowsysteminterface.h> - -#include <QtGui/private/qgenericunixeventdispatcher_p.h> -#include <QtGui/private/qgenericunixfontdatabase_p.h> - -#include <stdio.h> - -#include <WF/wfd.h> - -QOpenWFDIntegration::QOpenWFDIntegration() - : QPlatformIntegration() - , mPrinterSupport(new QGenericUnixPrinterSupport) -{ - int numberOfDevices = wfdEnumerateDevices(0,0,0); - - WFDint devices[numberOfDevices]; - int actualNumberOfDevices = wfdEnumerateDevices(devices,numberOfDevices,0); - Q_ASSERT(actualNumberOfDevices == numberOfDevices); - - mDevices.reserve(actualNumberOfDevices); - for (int i = 0; i < actualNumberOfDevices; i++) { - mDevices.append(new QOpenWFDDevice(this,devices[i])); - } - - mFontDatabase = new QGenericUnixFontDatabase(); - mNativeInterface = new QOpenWFDNativeInterface; -} - -QOpenWFDIntegration::~QOpenWFDIntegration() -{ - //don't delete screens since they are deleted by the devices - qDebug("deleting platform integration"); - for (int i = 0; i < mDevices.size(); i++) { - delete mDevices[i]; - } - - delete mFontDatabase; - delete mNativeInterface; - delete mPrinterSupport; -} - -bool QOpenWFDIntegration::hasCapability(QPlatformIntegration::Capability cap) const -{ - switch (cap) { - case ThreadedPixmaps: return true; - case OpenGL: return true; - default: return QPlatformIntegration::hasCapability(cap); - } -} - -QPlatformWindow *QOpenWFDIntegration::createPlatformWindow(QWindow *window) const -{ - return new QOpenWFDWindow(window); -} - -QPlatformOpenGLContext *QOpenWFDIntegration::createPlatformOpenGLContext(QOpenGLContext *context) const -{ - QOpenWFDScreen *screen = static_cast<QOpenWFDScreen *>(context->screen()->handle()); - - return new QOpenWFDGLContext(screen->port()->device()); -} - -QPlatformBackingStore *QOpenWFDIntegration::createPlatformBackingStore(QWindow *window) const -{ - return new QOpenWFDBackingStore(window); -} - -QAbstractEventDispatcher *QOpenWFDIntegration::createEventDispatcher() const -{ - return createUnixEventDispatcher(); -} - -QPlatformFontDatabase *QOpenWFDIntegration::fontDatabase() const -{ - return mFontDatabase; -} - -QPlatformNativeInterface * QOpenWFDIntegration::nativeInterface() const -{ - return mNativeInterface; -} - -QPlatformPrinterSupport * QOpenWFDIntegration::printerSupport() const -{ - return mPrinterSupport; -} diff --git a/src/plugins/platforms/openwfd/qopenwfdintegration.h b/src/plugins/platforms/openwfd/qopenwfdintegration.h deleted file mode 100644 index 444aaccaaf..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdintegration.h +++ /dev/null @@ -1,82 +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 QOPENWFDINTEGRATION_H -#define QOPENWFDINTEGRATION_H - -#include <qpa/qplatformintegration.h> -#include <qpa/qplatformscreen.h> - -QT_BEGIN_NAMESPACE - -class QOpenWFDDevice; -class QOpenWFDScreen; - -class QOpenWFDIntegration : public QPlatformIntegration -{ -public: - QOpenWFDIntegration(); - ~QOpenWFDIntegration(); - - bool hasCapability(Capability cap) const; - QPlatformWindow *createPlatformWindow(QWindow *window) const; - QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; - QPlatformOpenGLContext *createPlatformOpenGLContext(QOpenGLContext *context) const; - - //This should not be a factory interface, but rather a accessor - QAbstractEventDispatcher *createEventDispatcher() const; - - QPlatformFontDatabase *fontDatabase() const; - - QPlatformNativeInterface *nativeInterface()const; - - QPlatformPrinterSupport *printerSupport() const; - -private: - QList<QPlatformScreen *> mScreens; - QList<QOpenWFDDevice *>mDevices; - - QPlatformFontDatabase *mFontDatabase; - QPlatformNativeInterface *mNativeInterface; - QPlatformPrinterSupport *mPrinterSupport; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/openwfd/qopenwfdnativeinterface.cpp b/src/plugins/platforms/openwfd/qopenwfdnativeinterface.cpp deleted file mode 100644 index 8d299c2683..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdnativeinterface.cpp +++ /dev/null @@ -1,139 +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$ -** -****************************************************************************/ - -#include "qopenwfdnativeinterface.h" - -#include "qopenwfdscreen.h" -#include "qopenwfdwindow.h" -#include "qopenwfdglcontext.h" - -#include <private/qguiapplication_p.h> -#include <QtCore/QMap> - -#include <QtCore/QDebug> - -#include <QtGui/qguiglcontext_qpa.h> - -class QOpenWFDResourceMap : public QMap<QByteArray, QOpenWFDNativeInterface::ResourceType> -{ -public: - QOpenWFDResourceMap() - :QMap<QByteArray, QOpenWFDNativeInterface::ResourceType>() - { - insert("wfddevice",QOpenWFDNativeInterface::WFDDevice); - insert("egldisplay",QOpenWFDNativeInterface::EglDisplay); - insert("eglcontext",QOpenWFDNativeInterface::EglContext); - insert("wfdport",QOpenWFDNativeInterface::WFDPort); - insert("wfdpipeline",QOpenWFDNativeInterface::WFDPipeline); - } -}; - -Q_GLOBAL_STATIC(QOpenWFDResourceMap, qOpenWFDResourceMap) - -void *QOpenWFDNativeInterface::nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context) -{ - QByteArray lowerCaseResource = resourceString.toLower(); - ResourceType resource = qOpenWFDResourceMap()->value(lowerCaseResource); - void *result = 0; - switch (resource) { - case EglContext: - result = eglContextForContext(context); - break; - default: - result = 0; - } - return result; -} - -void *QOpenWFDNativeInterface::nativeResourceForWindow(const QByteArray &resourceString, QWindow *window) -{ - QByteArray lowerCaseResource = resourceString.toLower(); - ResourceType resource = qOpenWFDResourceMap()->value(lowerCaseResource); - void *result = 0; - switch (resource) { - //What should we do for int wfd handles? This is clearly not the solution - case WFDDevice: - result = (void *)wfdDeviceForWindow(window); - break; - case WFDPort: - result = (void *)wfdPortForWindow(window); - break; - case WFDPipeline: - result = (void *)wfdPipelineForWindow(window); - break; - case EglDisplay: - result = eglDisplayForWindow(window); - break; - default: - result = 0; - } - return result; -} - -WFDHandle QOpenWFDNativeInterface::wfdDeviceForWindow(QWindow *window) -{ - QOpenWFDWindow *openWFDwindow = static_cast<QOpenWFDWindow *>(window->handle()); - return openWFDwindow->port()->device()->handle(); -} - -WFDHandle QOpenWFDNativeInterface::wfdPortForWindow(QWindow *window) -{ - QOpenWFDWindow *openWFDwindow = static_cast<QOpenWFDWindow *>(window->handle()); - return openWFDwindow->port()->handle(); -} - -WFDHandle QOpenWFDNativeInterface::wfdPipelineForWindow(QWindow *window) - -{ - QOpenWFDWindow *openWFDwindow = static_cast<QOpenWFDWindow *>(window->handle()); - return openWFDwindow->port()->pipeline(); - -} - -void *QOpenWFDNativeInterface::eglDisplayForWindow(QWindow *window) -{ - QOpenWFDWindow *openWFDwindow = static_cast<QOpenWFDWindow *>(window->handle()); - return openWFDwindow->port()->device()->eglDisplay(); -} - -void * QOpenWFDNativeInterface::eglContextForContext(QOpenGLContext *context) -{ - QOpenWFDGLContext *openWFDContext = static_cast<QOpenWFDGLContext *>(context->handle()); - return openWFDContext->eglContext(); -} diff --git a/src/plugins/platforms/openwfd/qopenwfdnativeinterface.h b/src/plugins/platforms/openwfd/qopenwfdnativeinterface.h deleted file mode 100644 index d50e17ee92..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdnativeinterface.h +++ /dev/null @@ -1,74 +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 QOPENWFDNATIVEINTERFACE_H -#define QOPENWFDNATIVEINTERFACE_H - -#include <qpa/qplatformnativeinterface.h> - -#include <WF/wfdplatform.h> - -class QOpenWFDScreen; - -class QOpenWFDNativeInterface : public QPlatformNativeInterface -{ -public: - enum ResourceType { - WFDDevice, - EglDisplay, - EglContext, - WFDPort, - WFDPipeline - }; - - void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context); - void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window); - - WFDHandle wfdDeviceForWindow(QWindow *window); - void *eglDisplayForWindow(QWindow *window); - WFDHandle wfdPortForWindow(QWindow *window); - WFDHandle wfdPipelineForWindow(QWindow *window); - - void *eglContextForContext(QOpenGLContext *context); - -private: - static QOpenWFDScreen *qPlatformScreenForWindow(QWindow *window); -}; - -#endif // QOPENWFDNATIVEINTERFACE_H diff --git a/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp b/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp deleted file mode 100644 index 4d0de7b0d4..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.cpp +++ /dev/null @@ -1,88 +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$ -** -****************************************************************************/ - -#include "qopenwfdoutputbuffer.h" - -#include "qopenwfdport.h" - -QOpenWFDOutputBuffer::QOpenWFDOutputBuffer(const QSize &size, QOpenWFDPort *port) - : mPort(port) - , mAvailable(true) -{ - qDebug() << "creating output buffer for size" << size; - glGenRenderbuffers(1,&mRbo); - glBindRenderbuffer(GL_RENDERBUFFER, mRbo); - - mGbm_buffer = gbm_bo_create(port->device()->gbmDevice(), - size.width(), - size.height(), - GBM_BO_FORMAT_XRGB8888, - GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING); - - mEglImage = port->device()->eglCreateImage(port->device()->eglDisplay(),0, EGL_NATIVE_PIXMAP_KHR, mGbm_buffer, 0); - - port->device()->glEglImageTargetRenderBufferStorage(GL_RENDERBUFFER,mEglImage); - - mWfdSource = wfdCreateSourceFromImage(port->device()->handle(),port->pipeline(),mEglImage,WFD_NONE); - if (mWfdSource == WFD_INVALID_HANDLE) { - qWarning("failed to create wfdSource from image"); - } -} - -QOpenWFDOutputBuffer::~QOpenWFDOutputBuffer() -{ - wfdDestroySource(mPort->device()->handle(),mWfdSource); - if (!mPort->device()->eglDestroyImage(mPort->device()->eglDisplay(),mEglImage)) { - qDebug("could not delete eglImage"); - } - gbm_bo_destroy(mGbm_buffer); - - glDeleteRenderbuffers(1, &mRbo); -} - -void QOpenWFDOutputBuffer::bindToCurrentFbo() -{ - glFramebufferRenderbuffer(GL_FRAMEBUFFER, - GL_COLOR_ATTACHMENT0, - GL_RENDERBUFFER, - mRbo); - if (glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { - qDebug("framebuffer not ready!"); - } -} diff --git a/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.h b/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.h deleted file mode 100644 index 3726237a42..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdoutputbuffer.h +++ /dev/null @@ -1,67 +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 QOPENWFDOUTPUTBUFFER_H -#define QOPENWFDOUTPUTBUFFER_H - -#include "qopenwfdport.h" - -#include <EGL/egl.h> -#include <GLES2/gl2.h> - -class QOpenWFDOutputBuffer -{ -public: - QOpenWFDOutputBuffer(const QSize &size, QOpenWFDPort *port); - ~QOpenWFDOutputBuffer(); - void bindToCurrentFbo(); - bool isAvailable() const { return mAvailable; } - void setAvailable(bool available) { mAvailable = available; } - - WFDSource wfdSource() const { return mWfdSource; } -private: - QOpenWFDPort *mPort; - WFDSource mWfdSource; - GLuint mRbo; - EGLImageKHR mEglImage; - struct gbm_bo *mGbm_buffer; - bool mAvailable; -}; - -#endif // QOPENWFDOUTPUTBUFFER_H diff --git a/src/plugins/platforms/openwfd/qopenwfdport.cpp b/src/plugins/platforms/openwfd/qopenwfdport.cpp deleted file mode 100644 index 34b4439958..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdport.cpp +++ /dev/null @@ -1,209 +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$ -** -****************************************************************************/ - -#include "qopenwfdport.h" - -#include "qopenwfdportmode.h" -#include "qopenwfdscreen.h" - -#include <QtCore/QDebug> - -QOpenWFDPort::QOpenWFDPort(QOpenWFDDevice *device, WFDint portEnumeration) - : mDevice(device) - , mPortId(portEnumeration) - , mAttached(false) - , mPipelineId(WFD_INVALID_PIPELINE_ID) - , mPipeline(WFD_INVALID_HANDLE) -{ - mPort = wfdCreatePort(device->handle(),portEnumeration,0); - WFDint isPortAttached = wfdGetPortAttribi(device->handle(),mPort,WFD_PORT_ATTACHED); - if (isPortAttached) { - attach(); - } -} - -QOpenWFDPort::~QOpenWFDPort() -{ - detach(); - - wfdDestroyPort(mDevice->handle(),mPort); -} - -void QOpenWFDPort::attach() -{ - if (mAttached) { - return; - } - - //just forcing port to be on - wfdSetPortAttribi(mDevice->handle(), mPort, WFD_PORT_POWER_MODE, WFD_POWER_MODE_ON); - - int numberOfPortModes = wfdGetPortModes(mDevice->handle(),mPort,0,0); - WFDPortMode portModes[numberOfPortModes]; - int actualNumberOfPortModes = wfdGetPortModes(mDevice->handle(),mPort,portModes,numberOfPortModes); - Q_ASSERT(actualNumberOfPortModes == numberOfPortModes); - - if (!actualNumberOfPortModes) { - qDebug("didn't find any available port modes"); - return; - } - - for (int i = 0; i < actualNumberOfPortModes; i++) { - if (portModes[i] != WFD_INVALID_HANDLE) { - mPortModes.append(QOpenWFDPortMode(this,portModes[i])); - qDebug() << "PortModeAdded:" << mPortModes.at(mPortModes.size()-1); - } - } - - - mPixelSize = setNativeResolutionMode(); - if (mPixelSize.isEmpty()) { - qDebug("Could not set native resolution mode in QOpenWFPort"); - } - - WFDfloat physicalWFDSize[2]; - wfdGetPortAttribfv(mDevice->handle(),mPort,WFD_PORT_PHYSICAL_SIZE,2,physicalWFDSize); - mPhysicalSize = QSizeF(physicalWFDSize[0],physicalWFDSize[1]); - - WFDint numAvailablePipelines = wfdGetPortAttribi(mDevice->handle(),mPort,WFD_PORT_PIPELINE_ID_COUNT); - if (Q_UNLIKELY(!numAvailablePipelines)) - qFatal("Not possible to make screen that is not possible to create WFPort with no pipline"); - - WFDint pipeIds[numAvailablePipelines]; - wfdGetPortAttribiv(mDevice->handle(),mPort,WFD_PORT_BINDABLE_PIPELINE_IDS,numAvailablePipelines,pipeIds); - - for (int i = 0; i < numAvailablePipelines; i++) { - if (pipeIds[i] != WFD_INVALID_PIPELINE_ID && !mDevice->isPipelineUsed(pipeIds[i])) { - mPipelineId = pipeIds[i]; - mDevice-> addToUsedPipelineSet(mPipelineId,this); - - mPipeline = wfdCreatePipeline(mDevice->handle(),mPipelineId,WFD_NONE); - if (Q_UNLIKELY(mPipeline == WFD_INVALID_HANDLE)) - qFatal("Failed to create pipeline for port %p", this); - - break; - } - } - - if (mPipeline == WFD_INVALID_HANDLE) { - qWarning("Failed to create pipeline and can't bind it to port"); - } - - WFDint geomerty[] = { 0, 0, mPixelSize.width(), mPixelSize.height() }; - - wfdSetPipelineAttribiv(mDevice->handle(),mPipeline, WFD_PIPELINE_SOURCE_RECTANGLE, 4, geomerty); - wfdSetPipelineAttribiv(mDevice->handle(),mPipeline, WFD_PIPELINE_DESTINATION_RECTANGLE, 4, geomerty); - - wfdBindPipelineToPort(mDevice->handle(),mPort,mPipeline); - - mScreen = new QOpenWFDScreen(this); - QWindowSystemInterface::handleScreenAdded(mScreen); - mAttached = true; -} - -void QOpenWFDPort::detach() -{ - if (!mAttached) - return; - - mAttached = false; - mOn = false; - - QWindowSystemInterface::handleScreenRemoved(mScreen); - - wfdDestroyPipeline(mDevice->handle(),mPipeline); - mPipelineId = WFD_INVALID_PIPELINE_ID; - mPipeline = WFD_INVALID_HANDLE; -} - -bool QOpenWFDPort::attached() const -{ - return mAttached; -} - -QSize QOpenWFDPort::setNativeResolutionMode() -{ - WFDint nativePixelSize[2]; - wfdGetPortAttribiv(device()->handle(),mPort,WFD_PORT_NATIVE_RESOLUTION,2,nativePixelSize); - QSize nativeSize(nativePixelSize[0],nativePixelSize[1]); - - for (int i = 0; i < mPortModes.size(); i++) { - const QOpenWFDPortMode &mode = mPortModes.at(i); - if (nativeSize == mode.size()) { - wfdSetPortMode(device()->handle(),mPort,mode.handle()); - return nativeSize; - } - } - return QSize(); -} - -QSize QOpenWFDPort::pixelSize() const -{ - return mPixelSize; -} - -QSizeF QOpenWFDPort::physicalSize() const -{ - return mPhysicalSize; -} - -QOpenWFDDevice * QOpenWFDPort::device() const -{ - return mDevice; -} - -WFDPort QOpenWFDPort::handle() const -{ - return mPort; -} - -WFDint QOpenWFDPort::portId() const -{ - return mPortId; -} - -WFDPipeline QOpenWFDPort::pipeline() const -{ - return mPipeline; -} - -QOpenWFDScreen * QOpenWFDPort::screen() const -{ - return mScreen; -} diff --git a/src/plugins/platforms/openwfd/qopenwfdport.h b/src/plugins/platforms/openwfd/qopenwfdport.h deleted file mode 100644 index dc8357961f..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdport.h +++ /dev/null @@ -1,87 +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 QOPENWFDPORT_H -#define QOPENWFDPORT_H - -#include "qopenwfddevice.h" -#include "qopenwfdportmode.h" - -#include <WF/wfd.h> - -class QOpenWFDPort -{ -public: - QOpenWFDPort(QOpenWFDDevice *device, WFDint portEnumeration); - ~QOpenWFDPort(); - void attach(); - void detach(); - bool attached() const; - - QSize setNativeResolutionMode(); - - QSize pixelSize() const; - QSizeF physicalSize() const; - - QOpenWFDDevice *device() const; - WFDPort handle() const; - WFDint portId() const; - WFDPipeline pipeline() const; - QOpenWFDScreen *screen() const; - -private: - QOpenWFDDevice *mDevice; - WFDPort mPort; - WFDint mPortId; - - QList<QOpenWFDPortMode> mPortModes; - - bool mAttached; - bool mOn; - QSize mPixelSize; - QSizeF mPhysicalSize; - - QOpenWFDScreen *mScreen; - - WFDint mPipelineId; - WFDPipeline mPipeline; - -}; - -#endif // QOPENWFDPORT_H diff --git a/src/plugins/platforms/openwfd/qopenwfdportmode.cpp b/src/plugins/platforms/openwfd/qopenwfdportmode.cpp deleted file mode 100644 index 26da69ea95..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdportmode.cpp +++ /dev/null @@ -1,61 +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$ -** -****************************************************************************/ - -#include "qopenwfdportmode.h" - -#include "qopenwfdport.h" - -QOpenWFDPortMode::QOpenWFDPortMode(QOpenWFDPort *port, WFDPortMode portMode) - : mPortMode(portMode) -{ - int width = wfdGetPortModeAttribi(port->device()->handle(),port->handle(),portMode,WFD_PORT_MODE_WIDTH); - int height = wfdGetPortModeAttribi(port->device()->handle(),port->handle(),portMode,WFD_PORT_MODE_HEIGHT); - mSize = QSize(width,height); - - mRefresh = wfdGetPortModeAttribf(port->device()->handle(),port->handle(),portMode,WFD_PORT_MODE_REFRESH_RATE); - mFlipMirror = wfdGetPortModeAttribi(port->device()->handle(),port->handle(),portMode,WFD_PORT_MODE_FLIP_MIRROR_SUPPORT); - mInterlaced = wfdGetPortModeAttribi(port->device()->handle(), port->handle(),portMode,WFD_PORT_MODE_INTERLACED); -} - -QDebug operator<<(QDebug s, const QOpenWFDPortMode &portMode) -{ - s.nospace() << "QOpenWFPortMode( " << portMode.size() << " Refreash: " << portMode.refreshRate() - << " FlipMirror: " << portMode.flipMirror() << " Interlaced: " << portMode.interlaced(); - return s; -} diff --git a/src/plugins/platforms/openwfd/qopenwfdportmode.h b/src/plugins/platforms/openwfd/qopenwfdportmode.h deleted file mode 100644 index acce9e0b2e..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdportmode.h +++ /dev/null @@ -1,72 +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 QOPENWFDPORTMODE_H -#define QOPENWFDPORTMODE_H - -#include <WF/wfd.h> - -#include <QtCore/QSize> - -#include <QtCore/QDebug> - -class QOpenWFDPort; - -class QOpenWFDPortMode -{ -public: - QOpenWFDPortMode(QOpenWFDPort *port, WFDPortMode portMode); - - QSize size() const {return mSize;} - qreal refreshRate() const { return mRefresh; } - bool flipMirror() const { return mFlipMirror; } - bool interlaced() const { return mInterlaced; } - - WFDPortMode handle() const { return mPortMode; } -private: - WFDPortMode mPortMode; - - QSize mSize; - qreal mRefresh; - bool mFlipMirror; - bool mInterlaced; -}; - -QDebug operator<<(QDebug, const QOpenWFDPortMode &); -#endif // QOPENWFPORTMODE_H diff --git a/src/plugins/platforms/openwfd/qopenwfdscreen.cpp b/src/plugins/platforms/openwfd/qopenwfdscreen.cpp deleted file mode 100644 index ab394fa594..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdscreen.cpp +++ /dev/null @@ -1,190 +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$ -** -****************************************************************************/ - -#include "qopenwfdscreen.h" - -#include "qopenwfdport.h" -#include "qopenwfdoutputbuffer.h" - -#include <QtGui/QGuiApplication> - -QOpenWFDScreen::QOpenWFDScreen(QOpenWFDPort *port) - : mPort(port) - , mFbo(0) - , mOutputBuffers(BUFFER_NUM) - , mCurrentRenderBufferIndex(0) - , mStagedBackBufferIndex(-1) - , mCommitedBackBufferIndex(-1) - , mBackBufferIndex(-1) -{ - printf ("\n"); - printf ("Information of screen %p:\n", this); - printf (" width..........: %d\n", port->pixelSize().width()); - printf (" height.........: %d\n", port->pixelSize().height()); - printf (" physical width.: %f\n", port->physicalSize().width()); - printf (" physical height: %f\n", port->physicalSize().height()); - printf ("\n"); - - EGLDisplay display = mPort->device()->eglDisplay(); - EGLContext context = mPort->device()->eglContext(); - - if (!eglMakeCurrent(display,EGL_NO_SURFACE,EGL_NO_SURFACE,context)) { - qDebug("screen: eglMakeCurrent FAILED"); - } - - glGenFramebuffers(1,&mFbo); - glBindFramebuffer(GL_FRAMEBUFFER,mFbo); - - for (int i = 0; i < mOutputBuffers.size(); i++) { - mOutputBuffers[i] = new QOpenWFDOutputBuffer(mPort->pixelSize(),mPort); - } - - mStagedBackBufferIndex = mOutputBuffers.size()-1; - mOutputBuffers[mStagedBackBufferIndex]->setAvailable(false);; - commitStagedOutputBuffer(); - - mOutputBuffers.at(mCurrentRenderBufferIndex)->bindToCurrentFbo(); - - if (mPort->device()->isDeviceInitializedAndCommited()) { - mPort->device()->commit(WFD_COMMIT_ENTIRE_PORT,mPort->handle()); - } - -} - -QOpenWFDScreen::~QOpenWFDScreen() -{ - for (int i = 0; i < mOutputBuffers.size(); i++) { - delete mOutputBuffers[i]; - } - glDeleteFramebuffers(1, &mFbo); -} - -QRect QOpenWFDScreen::geometry() const -{ - return QRect(QPoint(),mPort->pixelSize()); -} - -int QOpenWFDScreen::depth() const -{ - return 32; -} - -QImage::Format QOpenWFDScreen::format() const -{ - return QImage::Format_RGB32; -} - -QSizeF QOpenWFDScreen::physicalSize() const -{ - return mPort->physicalSize(); -} - -QOpenWFDPort * QOpenWFDScreen::port() const -{ - return mPort; -} - -void QOpenWFDScreen::swapBuffers() -{ - glFlush(); - - setStagedBackBuffer(mCurrentRenderBufferIndex); - mCurrentRenderBufferIndex = nextAvailableRenderBuffer(); - - bindFramebuffer(); - mOutputBuffers.at(mCurrentRenderBufferIndex)->bindToCurrentFbo(); -} - -void QOpenWFDScreen::bindFramebuffer() -{ - glBindFramebuffer(GL_FRAMEBUFFER,mFbo); -} - -void QOpenWFDScreen::setStagedBackBuffer(int bufferIndex) -{ - if (mStagedBackBufferIndex >= 0) { - mOutputBuffers[mStagedBackBufferIndex]->setAvailable(true); - } - - mOutputBuffers[bufferIndex]->setAvailable(false);; - mStagedBackBufferIndex = bufferIndex; - - if (mCommitedBackBufferIndex < 0) { - commitStagedOutputBuffer(); - } -} - -void QOpenWFDScreen::commitStagedOutputBuffer() -{ - Q_ASSERT(mStagedBackBufferIndex >= 0); - wfdBindSourceToPipeline(mPort->device()->handle(), - mPort->pipeline(), - mOutputBuffers.at(mStagedBackBufferIndex)->wfdSource(), - WFD_TRANSITION_AT_VSYNC, - 0); - mPort->device()->commit(WFD_COMMIT_PIPELINE,mPort->pipeline()); - mCommitedBackBufferIndex = mStagedBackBufferIndex; - mStagedBackBufferIndex = -1; -} - -int QOpenWFDScreen::nextAvailableRenderBuffer() const -{ - while (true) { - for (int i = 0; i < mOutputBuffers.size(); i++) { - if (mOutputBuffers.at(i)->isAvailable()) { - return i; - } - } - mPort->device()->waitForPipelineBindSourceCompleteEvent(); - } -} - -void QOpenWFDScreen::pipelineBindSourceComplete() -{ - if (mBackBufferIndex >= 0) { - mOutputBuffers[mBackBufferIndex]->setAvailable(true); - } - - mBackBufferIndex = mCommitedBackBufferIndex; - mCommitedBackBufferIndex = -1; - - if (mStagedBackBufferIndex >= 0) { - commitStagedOutputBuffer(); - } -} diff --git a/src/plugins/platforms/openwfd/qopenwfdscreen.h b/src/plugins/platforms/openwfd/qopenwfdscreen.h deleted file mode 100644 index dec51d306b..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdscreen.h +++ /dev/null @@ -1,88 +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 QOPENWFDSCREEN_H -#define QOPENWFDSCREEN_H - -#include <qpa/qplatformscreen.h> - - -#include "qopenwfdoutputbuffer.h" - -#include <WF/wfd.h> - -#include <QtCore/QVarLengthArray> - -#define BUFFER_NUM 4 - -class QOpenWFDPort; -class QOpenWFDScreen : public QPlatformScreen -{ -public: - QOpenWFDScreen(QOpenWFDPort *port); - ~QOpenWFDScreen(); - - QRect geometry() const; - int depth() const; - QImage::Format format() const; - QSizeF physicalSize() const; - - QOpenWFDPort *port() const; - - void swapBuffers(); - void bindFramebuffer(); - void pipelineBindSourceComplete(); - -private: - void setStagedBackBuffer(int bufferIndex); - void commitStagedOutputBuffer(); - int nextAvailableRenderBuffer() const; - - QOpenWFDPort *mPort; - - GLuint mFbo; - - QVarLengthArray<QOpenWFDOutputBuffer *, BUFFER_NUM> mOutputBuffers; - int mCurrentRenderBufferIndex; - int mStagedBackBufferIndex; - int mCommitedBackBufferIndex; - int mBackBufferIndex; -}; - -#endif diff --git a/src/plugins/platforms/openwfd/qopenwfdwindow.cpp b/src/plugins/platforms/openwfd/qopenwfdwindow.cpp deleted file mode 100644 index 9320c19bbe..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdwindow.cpp +++ /dev/null @@ -1,59 +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$ -** -****************************************************************************/ - -#include "qopenwfdwindow.h" - -#include "qopenwfdscreen.h" -#include <qpa/qwindowsysteminterface.h> - -QOpenWFDWindow::QOpenWFDWindow(QWindow *window) - : QPlatformWindow(window) -{ - - QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWindow(window); - mPort = static_cast<QOpenWFDScreen *>(platformScreen)->port(); - - QWindowSystemInterface::handleGeometryChange(window,QRect(QPoint(0,0),mPort->screen()->geometry().size())); -} - -QOpenWFDPort *QOpenWFDWindow::port() const -{ - return mPort; -} - diff --git a/src/plugins/platforms/openwfd/qopenwfdwindow.h b/src/plugins/platforms/openwfd/qopenwfdwindow.h deleted file mode 100644 index 2cb131b65b..0000000000 --- a/src/plugins/platforms/openwfd/qopenwfdwindow.h +++ /dev/null @@ -1,59 +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 QOPENWFDWINDOW_H -#define QOPENWFDWINDOW_H - -#include <qpa/qplatformwindow.h> -#include <QtCore/QVarLengthArray> - -#include "qopenwfdport.h" - -class QOpenWFDWindow : public QPlatformWindow -{ -public: - QOpenWFDWindow(QWindow *window); - - QOpenWFDPort *port() const; - -private: - QOpenWFDPort *mPort; -}; - -#endif // QOPENWFWINDOW_H |