diff options
author | Liang Qi <liang.qi@qt.io> | 2016-12-13 09:36:26 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-12-13 09:39:20 +0100 |
commit | 6755ec891a1740110c48895afd53d39e8370704a (patch) | |
tree | 982606f3bc582262e4b315a63f55ccb141fff97b /src/plugins/platforms/eglfs | |
parent | 449204f8c0d6679ae0e58dbb8a30b8a86fbdb4ec (diff) | |
parent | 00c9ec63a552d040e851b561c11428fabf1a2b08 (diff) |
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts:
configure
qmake/Makefile.unix.macos
qmake/Makefile.unix.win32
qmake/generators/win32/msvc_vcproj.cpp
src/3rdparty/pcre/qt_attribution.json
src/corelib/io/qsettings.cpp
src/corelib/kernel/qdeadlinetimer.cpp
src/platformsupport/kmsconvenience/qkmsdevice.cpp
src/platformsupport/kmsconvenience/qkmsdevice_p.h
src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp
src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp
src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsdevice.cpp
src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h
tests/manual/qstorageinfo/printvolumes.cpp
tools/configure/configureapp.cpp
Change-Id: Ibaabcc8e965c44926f9fb018466e8b132b8df49e
Diffstat (limited to 'src/plugins/platforms/eglfs')
7 files changed, 89 insertions, 35 deletions
diff --git a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp index 3cc3776e3b..190f5a80d0 100644 --- a/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfsintegration.cpp @@ -200,7 +200,7 @@ QPlatformBackingStore *QEglFSIntegration::createPlatformBackingStore(QWindow *wi QPlatformWindow *QEglFSIntegration::createPlatformWindow(QWindow *window) const { - QWindowSystemInterface::flushWindowSystemEvents(); + QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); QEglFSWindow *w = qt_egl_device_integration()->createWindow(window); w->create(); if (window->type() != Qt::ToolTip) diff --git a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp index 1e202e4ff4..12108fd1c4 100644 --- a/src/plugins/platforms/eglfs/api/qeglfswindow.cpp +++ b/src/plugins/platforms/eglfs/api/qeglfswindow.cpp @@ -231,7 +231,7 @@ void QEglFSWindow::setVisible(bool visible) QWindowSystemInterface::handleExposeEvent(wnd, QRect(QPoint(0, 0), wnd->geometry().size())); if (visible) - QWindowSystemInterface::flushWindowSystemEvents(); + QWindowSystemInterface::flushWindowSystemEvents(QEventLoop::ExcludeUserInputEvents); } void QEglFSWindow::setGeometry(const QRect &r) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp index ebce0a4776..3723142f0b 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp @@ -184,24 +184,41 @@ void QEglFSKmsGbmScreen::flip() FrameBuffer *fb = framebufferForBufferObject(m_gbm_bo_next); - if (!output().mode_set) { - int ret = drmModeSetCrtc(device()->fd(), - output().crtc_id, + QKmsOutput &op(output()); + const int fd = device()->fd(); + const uint32_t w = op.modes[op.mode].hdisplay; + const uint32_t h = op.modes[op.mode].vdisplay; + + if (!op.mode_set) { + int ret = drmModeSetCrtc(fd, + op.crtc_id, fb->fb, 0, 0, - &output().connector_id, 1, - &output().modes[output().mode]); + &op.connector_id, 1, + &op.modes[op.mode]); - if (ret) { - qErrnoWarning("Could not set DRM mode!"); + if (ret == -1) { + qErrnoWarning(errno, "Could not set DRM mode!"); } else { - output().mode_set = true; + op.mode_set = true; setPowerState(PowerStateOn); + + if (!op.plane_set) { + op.plane_set = true; + if (op.wants_plane) { + int ret = drmModeSetPlane(fd, op.plane_id, op.crtc_id, + uint32_t(-1), 0, + 0, 0, w, h, + 0 << 16, 0 << 16, w << 16, h << 16); + if (ret == -1) + qErrnoWarning(errno, "drmModeSetPlane failed"); + } + } } } - int ret = drmModePageFlip(device()->fd(), - output().crtc_id, + int ret = drmModePageFlip(fd, + op.crtc_id, fb->fb, DRM_MODE_PAGE_FLIP_EVENT, this); 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 4a1ed8875a..3e333fc25a 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -39,11 +39,11 @@ ****************************************************************************/ #include "qeglfskmsegldeviceintegration.h" +#include "qeglfskmsegldevice.h" +#include "qeglfskmsegldevicescreen.h" #include <QtEglSupport/private/qeglconvenience_p.h> #include "private/qeglfswindow_p.h" #include "private/qeglfscursor_p.h" -#include "qeglfskmsegldevice.h" -#include "qeglfskmsscreen.h" #include <QLoggingCategory> #include <private/qmath_p.h> @@ -128,10 +128,16 @@ void QEglFSKmsEglDeviceWindow::resetSurface() qCDebug(qLcEglfsKmsDebug, "Creating stream"); EGLDisplay display = screen()->display(); - EGLOutputLayerEXT layer = EGL_NO_OUTPUT_LAYER_EXT; - EGLint count; + EGLint streamAttribs[3]; + int streamAttribCount = 0; + int fifoLength = qEnvironmentVariableIntValue("QT_QPA_EGLFS_STREAM_FIFO_LENGTH"); + if (fifoLength > 0) { + streamAttribs[streamAttribCount++] = EGL_STREAM_FIFO_LENGTH_KHR; + streamAttribs[streamAttribCount++] = fifoLength; + } + streamAttribs[streamAttribCount++] = EGL_NONE; - m_egl_stream = m_integration->m_funcs->create_stream(display, Q_NULLPTR); + m_egl_stream = m_integration->m_funcs->create_stream(display, streamAttribs); if (m_egl_stream == EGL_NO_STREAM_KHR) { qWarning("resetSurface: Couldn't create EGLStream for native window"); return; @@ -139,6 +145,16 @@ void QEglFSKmsEglDeviceWindow::resetSurface() qCDebug(qLcEglfsKmsDebug, "Created stream %p on display %p", m_egl_stream, display); + EGLint count; + if (m_integration->m_funcs->query_stream(display, m_egl_stream, EGL_STREAM_FIFO_LENGTH_KHR, &count)) { + if (count > 0) + qCDebug(qLcEglfsKmsDebug, "Using EGLStream FIFO mode with %d frames", count); + else + qCDebug(qLcEglfsKmsDebug, "Using EGLStream mailbox mode"); + } else { + qCDebug(qLcEglfsKmsDebug, "Could not query number of EGLStream FIFO frames"); + } + if (!m_integration->m_funcs->get_output_layers(display, Q_NULLPTR, Q_NULLPTR, 0, &count) || count == 0) { qWarning("No output layers found"); return; @@ -154,19 +170,23 @@ void QEglFSKmsEglDeviceWindow::resetSurface() return; } - QEglFSKmsScreen *cur_screen = static_cast<QEglFSKmsScreen*>(screen()); + QEglFSKmsEglDeviceScreen *cur_screen = static_cast<QEglFSKmsEglDeviceScreen *>(screen()); Q_ASSERT(cur_screen); - qCDebug(qLcEglfsKmsDebug, "Searching for id: %d", cur_screen->output().crtc_id); + QKmsOutput &output(cur_screen->output()); + const uint32_t wantedId = !output.wants_plane ? output.crtc_id : output.plane_id; + qCDebug(qLcEglfsKmsDebug, "Searching for id: %d", wantedId); + EGLOutputLayerEXT layer = EGL_NO_OUTPUT_LAYER_EXT; for (int i = 0; i < actualCount; ++i) { EGLAttrib id; if (m_integration->m_funcs->query_output_layer_attrib(display, layers[i], EGL_DRM_CRTC_EXT, &id)) { qCDebug(qLcEglfsKmsDebug, " [%d] layer %p - crtc %d", i, layers[i], (int) id); - if (id == EGLAttrib(cur_screen->output().crtc_id)) + if (id == EGLAttrib(wantedId)) layer = layers[i]; } else if (m_integration->m_funcs->query_output_layer_attrib(display, layers[i], EGL_DRM_PLANE_EXT, &id)) { - // Not used yet, just for debugging. qCDebug(qLcEglfsKmsDebug, " [%d] layer %p - plane %d", i, layers[i], (int) id); + if (id == EGLAttrib(wantedId)) + layer = layers[i]; } else { qCDebug(qLcEglfsKmsDebug, " [%d] layer %p - unknown", i, layers[i]); } @@ -175,8 +195,10 @@ 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.count()) { + qCDebug(qLcEglfsKmsDebug, "EGLOutput layer index override = %d", idx); layer = layers[idx]; + } } if (layer == EGL_NO_OUTPUT_LAYER_EXT) { 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 532ec0b440..7e5477e4bf 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldevicescreen.cpp @@ -73,13 +73,16 @@ QPlatformCursor *QEglFSKmsEglDeviceScreen::cursor() const void QEglFSKmsEglDeviceScreen::waitForFlip() { - if (!output().mode_set) { - output().mode_set = true; + QKmsOutput &op(output()); + const int fd = device()->fd(); + const uint32_t w = op.modes[op.mode].hdisplay; + const uint32_t h = op.modes[op.mode].vdisplay; - drmModeCrtcPtr currentMode = drmModeGetCrtc(device()->fd(), output().crtc_id); - const bool alreadySet = currentMode - && currentMode->width == output().modes[output().mode].hdisplay - && currentMode->height == output().modes[output().mode].vdisplay; + if (!op.mode_set) { + op.mode_set = true; + + drmModeCrtcPtr currentMode = drmModeGetCrtc(fd, op.crtc_id); + const bool alreadySet = currentMode && currentMode->width == w && currentMode->height == h; if (currentMode) drmModeFreeCrtc(currentMode); if (alreadySet) { @@ -93,14 +96,26 @@ void QEglFSKmsEglDeviceScreen::waitForFlip() } qCDebug(qLcEglfsKmsDebug, "Setting mode"); - int ret = drmModeSetCrtc(device()->fd(), output().crtc_id, + int ret = drmModeSetCrtc(fd, op.crtc_id, uint32_t(-1), 0, 0, - &output().connector_id, 1, - &output().modes[output().mode]); + &op.connector_id, 1, + &op.modes[op.mode]); if (ret) - qFatal("drmModeSetCrtc failed"); + qErrnoWarning(errno, "drmModeSetCrtc failed"); } + if (!op.plane_set) { + op.plane_set = true; + + if (op.wants_plane) { + qCDebug(qLcEglfsKmsDebug, "Setting plane %u", op.plane_id); + int ret = drmModeSetPlane(fd, op.plane_id, op.crtc_id, uint32_t(-1), 0, + 0, 0, w, h, + 0 << 16, 0 << 16, w << 16, h << 16); + if (ret == -1) + qErrnoWarning(errno, "drmModeSetPlane failed"); + } + } } QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp index cd468c989f..8eb07d727b 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_mali/qeglfsmaliintegration.cpp @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE -struct fbdev_window { +struct shadow_fbdev_window { unsigned short width; unsigned short height; }; @@ -91,7 +91,7 @@ EGLNativeWindowType QEglFSMaliIntegration::createNativeWindow(QPlatformWindow *w Q_UNUSED(window); Q_UNUSED(format); - fbdev_window *fbwin = reinterpret_cast<fbdev_window *>(malloc(sizeof(fbdev_window))); + shadow_fbdev_window *fbwin = reinterpret_cast<shadow_fbdev_window *>(malloc(sizeof(shadow_fbdev_window))); if (NULL == fbwin) return 0; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp index f9924fe5ce..0a547b832f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/qeglfsx11integration.cpp @@ -55,7 +55,7 @@ public: EventReader(QEglFSX11Integration *integration) : m_integration(integration) { } - void run(); + void run() override; private: QEglFSX11Integration *m_integration; |