From d054b1212334538c07305e4deb5cabf55a00efd2 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Fri, 29 Oct 2021 17:22:31 +0200 Subject: [PATCH] screencast: Skip frames with no damage Instead of issuing a full redraw. We'll be calling outputChanged when uploading to drm, there's no need to stream that as well. --- src/plugins/screencast/screencastmanager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/screencast/screencastmanager.cpp b/src/plugins/screencast/screencastmanager.cpp index 4a50c68b23..57b3defb2c 100644 --- a/src/plugins/screencast/screencastmanager.cpp +++ b/src/plugins/screencast/screencastmanager.cpp @@ -141,13 +141,13 @@ void ScreencastManager::streamOutput(KWaylandServer::ScreencastStreamV1Interface auto bufferToStream = [streamOutput, stream] (const QRegion &damagedRegion) { auto scene = Compositor::self()->scene(); auto texture = scene->textureForOutput(streamOutput); - if (!texture) { + if (!texture || damagedRegion.isEmpty()) { // Some backends will return no-op because textures aren't really supported there return; } const QRect frame({}, streamOutput->modeSize()); - const QRegion region = damagedRegion.isEmpty() || streamOutput->pixelSize() != streamOutput->modeSize() ? frame : damagedRegion.translated(-streamOutput->geometry().topLeft()).intersected(frame); + const QRegion region = streamOutput->pixelSize() != streamOutput->modeSize() ? frame : damagedRegion.translated(-streamOutput->geometry().topLeft()).intersected(frame); stream->recordFrame(texture.data(), region); }; connect(stream, &PipeWireStream::startStreaming, waylandStream, [streamOutput, stream, bufferToStream] {