virtual: fix screencasting by output

Properly notify when the output changes.
Forward the texture that holds the output when requested.
master
Aleix Pol 2 years ago committed by Aleix Pol Gonzalez
parent 1ede84f4fe
commit 309c9100fa

@ -32,9 +32,9 @@ VirtualEglLayer::VirtualEglLayer(Output *output, VirtualEglBackend *backend)
VirtualEglLayer::~VirtualEglLayer() = default;
GLTexture *VirtualEglLayer::texture() const
std::shared_ptr<GLTexture> VirtualEglLayer::texture() const
{
return m_texture.get();
return m_texture;
}
std::optional<OutputLayerBeginFrameInfo> VirtualEglLayer::beginFrame()
@ -57,6 +57,7 @@ std::optional<OutputLayerBeginFrameInfo> VirtualEglLayer::beginFrame()
bool VirtualEglLayer::endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion)
{
glFlush(); // flush pending rendering commands.
Q_EMIT m_output->outputChange(damagedRegion);
return true;
}
@ -202,4 +203,13 @@ void VirtualEglBackend::present(Output *output)
static_cast<VirtualOutput *>(output)->vsyncMonitor()->arm();
}
std::shared_ptr<GLTexture> VirtualEglBackend::textureForOutput(Output *output) const
{
auto it = m_outputs.find(output);
if (it == m_outputs.end()) {
return nullptr;
}
return it->second->texture();
}
} // namespace

@ -10,6 +10,7 @@
#include "abstract_egl_backend.h"
#include "core/outputlayer.h"
#include <memory>
namespace KWin
{
@ -27,13 +28,13 @@ public:
std::optional<OutputLayerBeginFrameInfo> beginFrame() override;
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
GLTexture *texture() const;
std::shared_ptr<GLTexture> texture() const;
private:
VirtualEglBackend *const m_backend;
Output *m_output;
std::unique_ptr<GLFramebuffer> m_fbo;
std::unique_ptr<GLTexture> m_texture;
std::shared_ptr<GLTexture> m_texture;
};
/**
@ -48,6 +49,7 @@ public:
~VirtualEglBackend() override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
std::shared_ptr<GLTexture> textureForOutput(Output *output) const override;
OutputLayer *primaryLayer(Output *output) override;
void present(Output *output) override;
void init() override;

Loading…
Cancel
Save