summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2019-08-01 15:29:01 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2019-08-15 10:12:22 +0200
commit80e7120feb5ddf9d5f0c9ed12bb8580898b18db8 (patch)
tree90fe857faf102797a6288a21be1e4ad7745529c9 /src/plugins/platforms/eglfs/deviceintegration/eglfs_kms
parenta547404c12b50b8c9ab6a078fce5ce9a7300586f (diff)
eglfs/kms: Re-enable drm/gbm format overrides in the config file
Follow up to 091a386eaf91ad8932332a8aefc2df793de59f6c Defaulting to querying from the egl config is fine, but dropping support for the "format" key in the output list in the json config file is not ideal. Task-number: QTBUG-76748 Change-Id: I25dc99369d118c300cdef25b464426f6be85453b Reviewed-by: Johan Helsing <johan.helsing@qt.io>
Diffstat (limited to 'src/plugins/platforms/eglfs/deviceintegration/eglfs_kms')
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp37
1 files changed, 25 insertions, 12 deletions
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
index 24f82e7843..3a2951efbd 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmscreen.cpp
@@ -155,20 +155,33 @@ gbm_surface *QEglFSKmsGbmScreen::createSurface(EGLConfig eglConfig)
qCDebug(qLcEglfsKmsDebug, "Creating gbm_surface for screen %s", qPrintable(name()));
const auto gbmDevice = static_cast<QEglFSKmsGbmDevice *>(device())->gbmDevice();
- EGLint native_format = -1;
- EGLBoolean success = eglGetConfigAttrib(display(), eglConfig, EGL_NATIVE_VISUAL_ID, &native_format);
- qCDebug(qLcEglfsKmsDebug) << "Got native format" << hex << native_format << dec << "from eglGetConfigAttrib() with return code" << bool(success);
-
- if (success)
- m_gbm_surface = gbm_surface_create(gbmDevice,
- rawGeometry().width(),
- rawGeometry().height(),
- native_format,
- GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
+ // If there was no format override given in the config file,
+ // query the native (here, gbm) format from the EGL config.
+ const bool queryFromEgl = !m_output.drm_format_requested_by_user;
+ if (queryFromEgl) {
+ EGLint native_format = -1;
+ EGLBoolean success = eglGetConfigAttrib(display(), eglConfig, EGL_NATIVE_VISUAL_ID, &native_format);
+ qCDebug(qLcEglfsKmsDebug) << "Got native format" << hex << native_format << dec
+ << "from eglGetConfigAttrib() with return code" << bool(success);
+
+ if (success) {
+ m_gbm_surface = gbm_surface_create(gbmDevice,
+ rawGeometry().width(),
+ rawGeometry().height(),
+ native_format,
+ GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
+ if (m_gbm_surface)
+ m_output.drm_format = gbmFormatToDrmFormat(native_format);
+ }
+ }
- if (!m_gbm_surface) { // fallback for older drivers
+ // Fallback for older drivers, and when "format" is explicitly specified
+ // in the output config. (not guaranteed that the requested format works
+ // of course, but do what we are told to)
+ if (!m_gbm_surface) {
uint32_t gbmFormat = drmFormatToGbmFormat(m_output.drm_format);
- qCDebug(qLcEglfsKmsDebug, "Could not create surface with EGL_NATIVE_VISUAL_ID, falling back to format %x", gbmFormat);
+ if (queryFromEgl)
+ qCDebug(qLcEglfsKmsDebug, "Could not create surface with EGL_NATIVE_VISUAL_ID, falling back to format %x", gbmFormat);
m_gbm_surface = gbm_surface_create(gbmDevice,
rawGeometry().width(),
rawGeometry().height(),