From a31b5bf5dac9ffc48ec89c30b60a0c67057ab5fa Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 8 Sep 2017 17:07:52 +0200 Subject: [PATCH] eglfs_kms: Remove unused virtuals and move flip callback ...to the screen, where it belongs. Task-number: QTBUG-63088 Change-Id: I4bfc4c259f91431d12851f888a7d044e43856d63 Reviewed-by: Andy Nichols --- .../eglfs_kms/qeglfskmsgbmdevice.cpp | 22 ------------------- .../eglfs_kms/qeglfskmsgbmdevice.h | 8 ------- .../eglfs_kms/qeglfskmsgbmintegration.cpp | 3 +-- .../eglfs_kms/qeglfskmsgbmscreen.cpp | 21 ++++++++++++++++-- .../eglfs_kms/qeglfskmsgbmscreen.h | 11 ++++++++-- .../eglfs_kms_support/qeglfskmsscreen.cpp | 8 ------- .../eglfs_kms_support/qeglfskmsscreen.h | 2 -- 7 files changed, 29 insertions(+), 46 deletions(-) diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp index 79c9687dc6..e2dd8cf9ad 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.cpp @@ -53,17 +53,6 @@ QT_BEGIN_NAMESPACE Q_DECLARE_LOGGING_CATEGORY(qLcEglfsKmsDebug) -void QEglFSKmsGbmDevice::pageFlipHandler(int fd, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data) -{ - Q_UNUSED(fd); - Q_UNUSED(sequence); - Q_UNUSED(tv_sec); - Q_UNUSED(tv_usec); - - QEglFSKmsScreen *screen = static_cast(user_data); - screen->flipFinished(); -} - QEglFSKmsGbmDevice::QEglFSKmsGbmDevice(QKmsScreenConfig *screenConfig, const QString &path) : QEglFSKmsDevice(screenConfig, path) , m_gbm_device(Q_NULLPTR) @@ -138,17 +127,6 @@ void QEglFSKmsGbmDevice::destroyGlobalCursor() } } -void QEglFSKmsGbmDevice::handleDrmEvent() -{ - drmEventContext drmEvent; - memset(&drmEvent, 0, sizeof(drmEvent)); - drmEvent.version = 2; - drmEvent.vblank_handler = nullptr; - drmEvent.page_flip_handler = pageFlipHandler; - - drmHandleEvent(fd(), &drmEvent); -} - QPlatformScreen *QEglFSKmsGbmDevice::createScreen(const QKmsOutput &output) { QEglFSKmsGbmScreen *screen = new QEglFSKmsGbmScreen(this, output, false); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h index ad5a4d6e6a..518e2ce58b 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmdevice.h @@ -65,8 +65,6 @@ public: QPlatformCursor *globalCursor() const; void destroyGlobalCursor(); - void handleDrmEvent(); - QPlatformScreen *createScreen(const QKmsOutput &output) override; QPlatformScreen *createHeadlessScreen() override; void registerScreenCloning(QPlatformScreen *screen, @@ -79,12 +77,6 @@ private: gbm_device *m_gbm_device; QEglFSKmsGbmCursor *m_globalCursor; - - static void pageFlipHandler(int fd, - unsigned int sequence, - unsigned int tv_sec, - unsigned int tv_usec, - void *user_data); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp index 7071dfdaa0..402338197d 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmintegration.cpp @@ -125,8 +125,7 @@ QPlatformCursor *QEglFSKmsGbmIntegration::createCursor(QPlatformScreen *screen) void QEglFSKmsGbmIntegration::presentBuffer(QPlatformSurface *surface) { QWindow *window = static_cast(surface->surface()); - QEglFSKmsScreen *screen = static_cast(window->screen()->handle()); - + QEglFSKmsGbmScreen *screen = static_cast(window->screen()->handle()); screen->flip(); } diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp index e8a94ed997..73342327cc 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp @@ -235,8 +235,14 @@ void QEglFSKmsGbmScreen::waitForFlip() return; QMutexLocker lock(&m_waitForFlipMutex); - while (m_gbm_bo_next) - static_cast(device())->handleDrmEvent(); + while (m_gbm_bo_next) { + drmEventContext drmEvent; + memset(&drmEvent, 0, sizeof(drmEvent)); + drmEvent.version = 2; + drmEvent.vblank_handler = nullptr; + drmEvent.page_flip_handler = pageFlipHandler; + drmHandleEvent(device()->fd(), &drmEvent); + } } void QEglFSKmsGbmScreen::flip() @@ -298,6 +304,17 @@ void QEglFSKmsGbmScreen::flip() } } +void QEglFSKmsGbmScreen::pageFlipHandler(int fd, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data) +{ + Q_UNUSED(fd); + Q_UNUSED(sequence); + Q_UNUSED(tv_sec); + Q_UNUSED(tv_usec); + + QEglFSKmsGbmScreen *screen = static_cast(user_data); + screen->flipFinished(); +} + void QEglFSKmsGbmScreen::flipFinished() { if (m_cloneSource) { diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h index 4541e500d5..f5a2122723 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.h @@ -66,14 +66,21 @@ public: const QVector &screensCloningThisScreen); void waitForFlip() override; - void flip() override; - void flipFinished() override; + + void flip(); private: + void flipFinished(); void ensureModeSet(uint32_t fb); void cloneDestFlipFinished(QEglFSKmsGbmScreen *cloneDestScreen); void updateFlipStatus(); + static void pageFlipHandler(int fd, + unsigned int sequence, + unsigned int tv_sec, + unsigned int tv_usec, + void *user_data); + gbm_surface *m_gbm_surface; gbm_bo *m_gbm_bo_current; diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp index cc70ab5a3c..5e45b42abe 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.cpp @@ -203,14 +203,6 @@ void QEglFSKmsScreen::waitForFlip() { } -void QEglFSKmsScreen::flip() -{ -} - -void QEglFSKmsScreen::flipFinished() -{ -} - void QEglFSKmsScreen::restoreMode() { m_output.restoreMode(m_device); diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h index aacea90eae..7f395aacb7 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_support/qeglfskmsscreen.h @@ -90,8 +90,6 @@ public: QKmsDevice *device() const { return m_device; } virtual void waitForFlip(); - virtual void flip(); - virtual void flipFinished(); QKmsOutput &output() { return m_output; } void restoreMode();