eglfs_kms: Lift the one window per screen ever limitation

There is still one fullscreen window per screen at a time, but
there is no reason we should fail in the backend when the screen
already has the gbm_surface created. If there is really another
active GL window for this screen, then the base eglfs window
implementation will panic anyway.

This should help certain cases, where windows belonging to screen B get
created for screen A and then moved (recreated) for screen B.

Task-number: QTBUG-62262
Change-Id: Ia029f028d32a35e8e023f3132097ba9a919b8fe8
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
bb10
Laszlo Agocs 2017-08-02 13:10:59 +02:00
parent 18af543304
commit 95d73132c7
3 changed files with 17 additions and 8 deletions

View File

@ -167,21 +167,18 @@ public:
, m_integration(integration)
{}
void resetSurface() override;
void invalidateSurface() override;
const QEglFSKmsGbmIntegration *m_integration;
};
void QEglFSKmsGbmWindow::resetSurface()
{
QEglFSKmsGbmScreen *gbmScreen = static_cast<QEglFSKmsGbmScreen *>(screen());
if (gbmScreen->surface()) {
qWarning("Only single window per screen supported!");
return;
}
EGLDisplay display = gbmScreen->display();
QSurfaceFormat platformFormat = m_integration->surfaceFormatFor(window()->requestedFormat());
m_config = QEglFSDeviceIntegration::chooseConfig(display, platformFormat);
m_format = q_glFormatFromConfig(display, m_config, platformFormat);
// One fullscreen window per screen -> the native window is simply the gbm_surface the screen created.
m_window = reinterpret_cast<EGLNativeWindowType>(gbmScreen->createSurface());
PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC createPlatformWindowSurface = nullptr;
@ -199,6 +196,13 @@ void QEglFSKmsGbmWindow::resetSurface()
}
}
void QEglFSKmsGbmWindow::invalidateSurface()
{
QEglFSKmsGbmScreen *gbmScreen = static_cast<QEglFSKmsGbmScreen *>(screen());
QEglFSWindow::invalidateSurface();
gbmScreen->resetSurface();
}
QEglFSWindow *QEglFSKmsGbmIntegration::createWindow(QWindow *window) const
{
return new QEglFSKmsGbmWindow(window, this);

View File

@ -132,14 +132,19 @@ QPlatformCursor *QEglFSKmsGbmScreen::cursor() const
gbm_surface *QEglFSKmsGbmScreen::createSurface()
{
if (!m_gbm_surface) {
qCDebug(qLcEglfsKmsDebug) << "Creating window for screen" << name();
qCDebug(qLcEglfsKmsDebug) << "Creating gbm_surface for screen" << name();
m_gbm_surface = gbm_surface_create(static_cast<QEglFSKmsGbmDevice *>(device())->gbmDevice(),
rawGeometry().width(),
rawGeometry().height(),
GBM_FORMAT_XRGB8888,
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
}
return m_gbm_surface; // not owned, gets destroyed in QEglFSKmsGbmIntegration::destroyNativeWindow()
return m_gbm_surface; // not owned, gets destroyed in QEglFSKmsGbmIntegration::destroyNativeWindow() via QEglFSKmsGbmWindow::invalidateSurface()
}
void QEglFSKmsGbmScreen::resetSurface()
{
m_gbm_surface = nullptr;
}
void QEglFSKmsGbmScreen::waitForFlip()

View File

@ -59,8 +59,8 @@ public:
QPlatformCursor *cursor() const override;
gbm_surface *surface() const { return m_gbm_surface; }
gbm_surface *createSurface();
void resetSurface();
void waitForFlip() override;
void flip() override;