From 1670bc751e7f7f3fddf92870b9a4da5f38ab93a9 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 1 Dec 2016 10:51:13 +0100 Subject: eglfs: make it possible to configure the EGLStream FIFO length MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Setting QT_QPA_EGLFS_STREAM_FIFO_LENGTH to a >= 1 value changes from mailbox to FIFO mode, with the specified length. [ChangeLog][Platform Specific Changes][Linux] Added an option to switch from mailbox to FIFO mode in eglfs' EGLStream backend. This is done by setting the environment variable QT_QPA_EGLFS_STREAM_FIFO_LENGTH to a >= 1 value, the desired length of the FIFO queue. Change-Id: Ib98e2ff805f8c00ca2e224d1db5b9c1b2c9a04f0 Done-with: Pasi Petajajarvi Reviewed-by: Pasi Petäjäjärvi --- .../qeglfskmsegldeviceintegration.cpp | 23 +++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp') diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index d0c9c9565e..977b318ad9 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -129,10 +129,16 @@ void QEglJetsonTK1Window::resetSurface() qCDebug(qLcEglfsKmsDebug, "Creating stream"); EGLDisplay display = screen()->display(); - EGLOutputLayerEXT layer = EGL_NO_OUTPUT_LAYER_EXT; - EGLint count; + EGLint streamAttribs[3]; + int streamAttribCount = 0; + int fifoLength = qEnvironmentVariableIntValue("QT_QPA_EGLFS_STREAM_FIFO_LENGTH"); + if (fifoLength > 0) { + streamAttribs[streamAttribCount++] = EGL_STREAM_FIFO_LENGTH_KHR; + streamAttribs[streamAttribCount++] = fifoLength; + } + streamAttribs[streamAttribCount++] = EGL_NONE; - m_egl_stream = m_integration->m_funcs->create_stream(display, Q_NULLPTR); + m_egl_stream = m_integration->m_funcs->create_stream(display, streamAttribs); if (m_egl_stream == EGL_NO_STREAM_KHR) { qWarning("resetSurface: Couldn't create EGLStream for native window"); return; @@ -140,6 +146,16 @@ void QEglJetsonTK1Window::resetSurface() qCDebug(qLcEglfsKmsDebug, "Created stream %p on display %p", m_egl_stream, display); + EGLint count; + if (m_integration->m_funcs->query_stream(display, m_egl_stream, EGL_STREAM_FIFO_LENGTH_KHR, &count)) { + if (count > 0) + qCDebug(qLcEglfsKmsDebug, "Using EGLStream FIFO mode with %d frames", count); + else + qCDebug(qLcEglfsKmsDebug, "Using EGLStream mailbox mode"); + } else { + qCDebug(qLcEglfsKmsDebug, "Could not query number of EGLStream FIFO frames"); + } + if (!m_integration->m_funcs->get_output_layers(display, Q_NULLPTR, Q_NULLPTR, 0, &count) || count == 0) { qWarning("No output layers found"); return; @@ -159,6 +175,7 @@ void QEglJetsonTK1Window::resetSurface() Q_ASSERT(cur_screen); qCDebug(qLcEglfsKmsDebug, "Searching for id: %d", cur_screen->output().crtc_id); + EGLOutputLayerEXT layer = EGL_NO_OUTPUT_LAYER_EXT; for (int i = 0; i < actualCount; ++i) { EGLAttrib id; if (m_integration->m_funcs->query_output_layer_attrib(display, layers[i], EGL_DRM_CRTC_EXT, &id)) { -- cgit v1.2.3 From 09d481987bc94b28252923f9ab7c5b9183d7bf74 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 1 Dec 2016 13:59:15 +0100 Subject: eglfs: improve EGLStream logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make it possible to identify from the logs that QT_QPA_EGLFS_LAYER_INDEX was set, in order to help troubleshooting. Change-Id: Ic22825e5df9f0eeb31f817f398b9f6c000c3a00f Reviewed-by: Pasi Petäjäjärvi --- .../eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp') diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index 977b318ad9..b443a724ec 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -193,8 +193,10 @@ void QEglJetsonTK1Window::resetSurface() QByteArray reqLayerIndex = qgetenv("QT_QPA_EGLFS_LAYER_INDEX"); if (!reqLayerIndex.isEmpty()) { int idx = reqLayerIndex.toInt(); - if (idx >= 0 && idx < layers.count()) + if (idx >= 0 && idx < layers.count()) { + qCDebug(qLcEglfsKmsDebug, "EGLOutput layer index override = %d", idx); layer = layers[idx]; + } } if (layer == EGL_NO_OUTPUT_LAYER_EXT) { -- cgit v1.2.3 From f30b88846566bc1254e5e6d61077092cdaeba409 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Fri, 2 Dec 2016 10:39:35 +0100 Subject: eglfs: allow forcing an overlay plane MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a QT_QPA_EGLFS_KMS_PLANE_INDEX environment variable that applies both to the GBM and EGLDevice backends. When set to a value between 0 and the number of planes on the connector - 1, the chosen overlay plane will be used for output, meaning there will be a drmModeSetPlane to configure, and, in case of EGLDevice, the plane's corresponding EGL layer will get chosen instead of the CRTC's. Task-number: QTBUG-57386 Change-Id: I12c89472ea5730987052f39211fadc597d1302ef Reviewed-by: Pasi Petäjäjärvi --- .../eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp') diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp index b443a724ec..cf1de71831 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_kms_egldevice/qeglfskmsegldeviceintegration.cpp @@ -39,11 +39,11 @@ ****************************************************************************/ #include "qeglfskmsegldeviceintegration.h" +#include "qeglfskmsegldevice.h" +#include "qeglfskmsegldevicescreen.h" #include #include "private/qeglfswindow_p.h" #include "private/qeglfscursor_p.h" -#include "qeglfskmsegldevice.h" -#include "qeglfskmsscreen.h" #include #include @@ -171,20 +171,23 @@ void QEglJetsonTK1Window::resetSurface() return; } - QEglFSKmsScreen *cur_screen = static_cast(screen()); + QEglFSKmsEglDeviceScreen *cur_screen = static_cast(screen()); Q_ASSERT(cur_screen); - qCDebug(qLcEglfsKmsDebug, "Searching for id: %d", cur_screen->output().crtc_id); + QEglFSKmsOutput &output(cur_screen->output()); + const uint32_t wantedId = !output.wants_plane ? output.crtc_id : output.plane_id; + qCDebug(qLcEglfsKmsDebug, "Searching for id: %d", wantedId); EGLOutputLayerEXT layer = EGL_NO_OUTPUT_LAYER_EXT; for (int i = 0; i < actualCount; ++i) { EGLAttrib id; if (m_integration->m_funcs->query_output_layer_attrib(display, layers[i], EGL_DRM_CRTC_EXT, &id)) { qCDebug(qLcEglfsKmsDebug, " [%d] layer %p - crtc %d", i, layers[i], (int) id); - if (id == EGLAttrib(cur_screen->output().crtc_id)) + if (id == EGLAttrib(wantedId)) layer = layers[i]; } else if (m_integration->m_funcs->query_output_layer_attrib(display, layers[i], EGL_DRM_PLANE_EXT, &id)) { - // Not used yet, just for debugging. qCDebug(qLcEglfsKmsDebug, " [%d] layer %p - plane %d", i, layers[i], (int) id); + if (id == EGLAttrib(wantedId)) + layer = layers[i]; } else { qCDebug(qLcEglfsKmsDebug, " [%d] layer %p - unknown", i, layers[i]); } -- cgit v1.2.3