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 <andy.nichols@qt.io>
This commit is contained in:
Laszlo Agocs 2017-09-08 17:07:52 +02:00
parent 6ada5f876e
commit a31b5bf5da
7 changed files with 29 additions and 46 deletions

View File

@ -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<QEglFSKmsScreen *>(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);

View File

@ -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

View File

@ -125,8 +125,7 @@ QPlatformCursor *QEglFSKmsGbmIntegration::createCursor(QPlatformScreen *screen)
void QEglFSKmsGbmIntegration::presentBuffer(QPlatformSurface *surface)
{
QWindow *window = static_cast<QWindow *>(surface->surface());
QEglFSKmsScreen *screen = static_cast<QEglFSKmsScreen *>(window->screen()->handle());
QEglFSKmsGbmScreen *screen = static_cast<QEglFSKmsGbmScreen *>(window->screen()->handle());
screen->flip();
}

View File

@ -235,8 +235,14 @@ void QEglFSKmsGbmScreen::waitForFlip()
return;
QMutexLocker lock(&m_waitForFlipMutex);
while (m_gbm_bo_next)
static_cast<QEglFSKmsGbmDevice *>(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<QEglFSKmsGbmScreen *>(user_data);
screen->flipFinished();
}
void QEglFSKmsGbmScreen::flipFinished()
{
if (m_cloneSource) {

View File

@ -66,14 +66,21 @@ public:
const QVector<QPlatformScreen *> &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;

View File

@ -203,14 +203,6 @@ void QEglFSKmsScreen::waitForFlip()
{
}
void QEglFSKmsScreen::flip()
{
}
void QEglFSKmsScreen::flipFinished()
{
}
void QEglFSKmsScreen::restoreMode()
{
m_output.restoreMode(m_device);

View File

@ -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();