eglfs: Extend GBM surface creation probing
Some graphics drivers do only create a surface with the help of gbm_surface_create_with_modifiers and others do require to use gbm_surface_create. So it is needed to probe these. Change-Id: I9ea657f12f2ea23ec426a378cfd67e297cb2d310 Pick-to: 6.5 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> (cherry picked from commit 86eb1f4413e96e1731e8feeba7f51b5842759784) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
d48f08edb6
commit
8da777fa6a
@ -142,11 +142,12 @@ gbm_surface *QEglFSKmsGbmScreen::createSurface(EGLConfig eglConfig)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const uint32_t gbmFormat = drmFormatToGbmFormat(m_output.drm_format);
|
||||||
|
|
||||||
// Fallback for older drivers, and when "format" is explicitly specified
|
// Fallback for older drivers, and when "format" is explicitly specified
|
||||||
// in the output config. (not guaranteed that the requested format works
|
// in the output config. (not guaranteed that the requested format works
|
||||||
// of course, but do what we are told to)
|
// of course, but do what we are told to)
|
||||||
if (!m_gbm_surface) {
|
if (!m_gbm_surface) {
|
||||||
uint32_t gbmFormat = drmFormatToGbmFormat(m_output.drm_format);
|
|
||||||
if (queryFromEgl)
|
if (queryFromEgl)
|
||||||
qCDebug(qLcEglfsKmsDebug, "Could not create surface with EGL_NATIVE_VISUAL_ID, falling back to format %x", gbmFormat);
|
qCDebug(qLcEglfsKmsDebug, "Could not create surface with EGL_NATIVE_VISUAL_ID, falling back to format %x", gbmFormat);
|
||||||
m_gbm_surface = gbm_surface_create(gbmDevice,
|
m_gbm_surface = gbm_surface_create(gbmDevice,
|
||||||
@ -155,6 +156,20 @@ gbm_surface *QEglFSKmsGbmScreen::createSurface(EGLConfig eglConfig)
|
|||||||
gbmFormat,
|
gbmFormat,
|
||||||
gbmFlags());
|
gbmFlags());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fallback for some drivers, its required to request with modifiers
|
||||||
|
if (!m_gbm_surface) {
|
||||||
|
uint64_t modifier = DRM_FORMAT_MOD_LINEAR;
|
||||||
|
|
||||||
|
m_gbm_surface = gbm_surface_create_with_modifiers(gbmDevice,
|
||||||
|
rawGeometry().width(),
|
||||||
|
rawGeometry().height(),
|
||||||
|
gbmFormat,
|
||||||
|
&modifier, 1);
|
||||||
|
}
|
||||||
|
// Fail here, as it would fail with the next usage of the GBM surface, which is very unexpected
|
||||||
|
if (!m_gbm_surface)
|
||||||
|
qFatal("Could not create GBM surface!");
|
||||||
}
|
}
|
||||||
return m_gbm_surface; // not owned, gets destroyed in QEglFSKmsGbmIntegration::destroyNativeWindow() via QEglFSKmsGbmWindow::invalidateSurface()
|
return m_gbm_surface; // not owned, gets destroyed in QEglFSKmsGbmIntegration::destroyNativeWindow() via QEglFSKmsGbmWindow::invalidateSurface()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user