diff --git a/src/plugins/platforms/drm/egl_gbm_backend.cpp b/src/plugins/platforms/drm/egl_gbm_backend.cpp index 262abc0053..97b8f0c676 100644 --- a/src/plugins/platforms/drm/egl_gbm_backend.cpp +++ b/src/plugins/platforms/drm/egl_gbm_backend.cpp @@ -30,12 +30,13 @@ #include #include #include +#include +#include // kwayland server #include "KWaylandServer/surface_interface.h" #include "KWaylandServer/buffer_interface.h" #include "KWaylandServer/linuxdmabuf_v1_interface.h" -#include -#include +#include "KWaylandServer/clientconnection.h" namespace KWin { @@ -689,6 +690,9 @@ void EglGbmBackend::setViewport(const Output &output) const QRegion EglGbmBackend::beginFrame(int screenId) { Output &output = m_outputs[screenId]; + if (output.surfaceInterface) { + qCDebug(KWIN_DRM) << "Direct scanout stopped on output" << output.output->name(); + } output.surfaceInterface = nullptr; if (isPrimary()) { return prepareRenderingForOutput(output); @@ -817,8 +821,18 @@ bool EglGbmBackend::scanout(int screenId, SurfaceItem *surfaceItem) damage = output.output->geometry(); } output.buffer = QSharedPointer::create(m_gpu, importedBuffer, buffer); + auto oldSurface = output.surfaceInterface; output.surfaceInterface = surface; - return presentOnOutput(output, damage); + if (presentOnOutput(output, damage)) { + if (oldSurface != surface) { + auto path = surface->client()->executablePath(); + qCDebug(KWIN_DRM).nospace() << "Direct scanout starting on output " << output.output->name() << " for application \"" << path << "\""; + } + return true; + } else { + output.surfaceInterface = nullptr; + return false; + } } QSharedPointer EglGbmBackend::textureForOutput(AbstractOutput *abstractOutput) const