Paste P618

Masterwork From Distant Lands
ActivePublic

Authored by davidedmundson on Jul 15 2020, 9:56 AM.
diff --git a/abstract_wayland_output.h b/abstract_wayland_output.h
index a98fef0fe..31e101ee5 100644
--- a/abstract_wayland_output.h
+++ b/abstract_wayland_output.h
@@ -125,7 +125,6 @@ public:
Q_SIGNALS:
void modeChanged();
- void outputChange(const QRegion &damagedRegion);
protected:
void initInterfaces(const QString &model, const QString &manufacturer,
diff --git a/plugins/platforms/drm/egl_gbm_backend.cpp b/plugins/platforms/drm/egl_gbm_backend.cpp
index 43ec516a5..129a182aa 100644
--- a/plugins/platforms/drm/egl_gbm_backend.cpp
+++ b/plugins/platforms/drm/egl_gbm_backend.cpp
@@ -431,12 +431,11 @@ void EglGbmBackend::present()
// Not in use. This backend does per-screen rendering.
}
-void EglGbmBackend::presentOnOutput(Output &output, const QRegion &damagedRegion)
+void EglGbmBackend::presentOnOutput(Output &output)
{
eglSwapBuffers(eglDisplay(), output.eglSurface);
output.buffer = m_backend->createBuffer(output.gbmSurface);
- Q_EMIT output.output->outputChange(damagedRegion);
m_backend->present(output.buffer, output.output);
if (supportsBufferAge()) {
@@ -525,7 +524,7 @@ void EglGbmBackend::endRenderingFrameForScreen(int screenId,
}
return;
}
- presentOnOutput(output, damagedRegion);
+ presentOnOutput(output);
// Save the damaged region to history
// Note: damage history is only collected for the first screen. For any other screen full
diff --git a/plugins/platforms/drm/egl_gbm_backend.h b/plugins/platforms/drm/egl_gbm_backend.h
index e63806046..a3458572d 100644
--- a/plugins/platforms/drm/egl_gbm_backend.h
+++ b/plugins/platforms/drm/egl_gbm_backend.h
@@ -99,7 +99,7 @@ private:
void prepareRenderFramebuffer(const Output &output) const;
void renderFramebufferToSurface(Output &output);
- void presentOnOutput(Output &output, const QRegion &damagedRegion);
+ void presentOnOutput(Output &output);
void removeOutput(DrmOutput *drmOutput);
void cleanupOutput(Output &output);
diff --git a/plugins/platforms/wayland/egl_wayland_backend.cpp b/plugins/platforms/wayland/egl_wayland_backend.cpp
index ce1f5b6af..a8ba75e5d 100644
--- a/plugins/platforms/wayland/egl_wayland_backend.cpp
+++ b/plugins/platforms/wayland/egl_wayland_backend.cpp
@@ -300,8 +300,6 @@ void EglWaylandBackend::presentOnSurface(EglWaylandOutput *output, const QRegion
Compositor::self()->aboutToSwapBuffers();
}
- Q_EMIT output->m_waylandOutput->outputChange(damage);
-
if (supportsBufferAge()) {
eglSwapBuffers(eglDisplay(), output->m_eglSurface);
eglQuerySurface(eglDisplay(), output->m_eglSurface, EGL_BUFFER_AGE_EXT, &output->m_bufferAge);
diff --git a/plugins/scenes/opengl/scene_opengl.cpp b/plugins/scenes/opengl/scene_opengl.cpp
index bb09d65f0..2b3090f33 100644
--- a/plugins/scenes/opengl/scene_opengl.cpp
+++ b/plugins/scenes/opengl/scene_opengl.cpp
@@ -660,6 +660,14 @@ qint64 SceneOpenGL::paint(const QRegion &damage, const QList<Toplevel *> &toplev
m_backend->endRenderingFrameForScreen(i, valid, update);
+ AbstractOutput *output = kwinApp()->platform()->outputs().at(i);
+ if (output) {
+ const QRegion damage = update.intersected(output->geometry());
+ if (!damage.isNull()) {
+ emit outputChanged(output, damage);
+ }
+ }
+
GLVertexBuffer::streamingBuffer()->framePosted();
}
} else {
diff --git a/scene.h b/scene.h
index c36a2e423..54e17f101 100644
--- a/scene.h
+++ b/scene.h
@@ -54,6 +54,7 @@ class Shadow;
class WindowPixmap;
class GLTexture;
class AbstractWaylandOutput;
+class AbstractOutput;
// The base class for compositing backends.
class KWIN_EXPORT Scene : public QObject
@@ -208,6 +209,7 @@ public:
Q_SIGNALS:
void frameRendered();
+ void outputChanged(AbstractOutput *output, const QRegion &region);
void resetCompositing();
public Q_SLOTS:
diff --git a/screencast/screencastmanager.cpp b/screencast/screencastmanager.cpp
index b5d5ffe39..876f26680 100644
--- a/screencast/screencastmanager.cpp
+++ b/screencast/screencastmanager.cpp
@@ -170,7 +170,10 @@ void ScreencastManager::streamOutput(KWaylandServer::ScreencastStreamInterface*
stream->setObjectName(streamOutput->name());
stream->setCursorMode(mode, streamOutput->scale(), streamOutput->geometry());
connect(streamOutput, &QObject::destroyed, stream, &PipeWireStream::stopStreaming);
- auto bufferToStream = [streamOutput, stream] (const QRegion &damagedRegion) {
+ auto bufferToStream = [streamOutput, stream] (AbstractOutput *output, const QRegion &damagedRegion) {
+ if (output != streamOutput) {
+ return;
+ }
auto scene = KWin::Compositor::self()->scene();
auto texture = scene->textureForOutput(streamOutput);
@@ -180,7 +183,7 @@ void ScreencastManager::streamOutput(KWaylandServer::ScreencastStreamInterface*
};
connect(stream, &PipeWireStream::startStreaming, waylandStream, [streamOutput, stream, bufferToStream] {
KWin::Compositor::self()->addRepaint(streamOutput->geometry());
- connect(streamOutput, &AbstractWaylandOutput::outputChange, stream, bufferToStream);
+ connect(KWin::Compositor::self()->scene(), &Scene::outputChanged, stream, bufferToStream);
});
integrateStreams(waylandStream, stream);
}
davidedmundson edited the content of this paste. (Show Details)Jul 15 2020, 9:56 AM
davidedmundson changed the title of this paste from untitled to Masterwork From Distant Lands.