From 51ff2e4c32b6e061992b5a6ae2ed126110a3b628 Mon Sep 17 00:00:00 2001 From: Xaver Hugl Date: Wed, 13 Dec 2023 20:03:13 +0100 Subject: [PATCH] backends/drm: do glFinish after rendering on NVidia Polling the dmabuf for readability doesn't appear to work on NVidia and we're no longer using an egl surface where the driver does this for us, so we need to explicitly wait for rendering to complete or there are glitches on the output --- src/backends/drm/drm_egl_layer_surface.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/backends/drm/drm_egl_layer_surface.cpp b/src/backends/drm/drm_egl_layer_surface.cpp index 877cb983a1..8797f578ef 100644 --- a/src/backends/drm/drm_egl_layer_surface.cpp +++ b/src/backends/drm/drm_egl_layer_surface.cpp @@ -176,8 +176,9 @@ bool EglGbmLayerSurface::endRendering(const QRegion &damagedRegion) m_surface->gbmSwapchain->release(m_surface->currentSlot); m_surface->timeQuery->end(); glFlush(); - if (m_eglBackend->contextObject()->isSoftwareRenderer()) { + if (m_eglBackend->contextObject()->isSoftwareRenderer() || m_eglBackend->gpu()->isNVidia()) { // llvmpipe doesn't do synchronization properly: https://gitlab.freedesktop.org/mesa/mesa/-/issues/9375 + // and NVidia doesn't support implicit sync glFinish(); } const auto buffer = importBuffer(m_surface.get(), m_surface->currentSlot.get()); @@ -547,6 +548,10 @@ std::shared_ptr EglGbmLayerSurface::importWithEgl(Surface *surfa surface->importContext->shaderManager()->popShader(); glFlush(); + if (m_gpu->isNVidia()) { + // the proprietary NVidia driver desn't support implicit sync + glFinish(); + } surface->importGbmSwapchain->release(slot); surface->importTimeQuery->end();