plugins/screencast: Check compositing type
Screencasting only works with OpenGL compositing at the moment.
This commit is contained in:
parent
8256f8e14c
commit
5fe9e9c756
1 changed files with 13 additions and 4 deletions
|
@ -10,7 +10,6 @@
|
||||||
#include "compositor.h"
|
#include "compositor.h"
|
||||||
#include "core/drmdevice.h"
|
#include "core/drmdevice.h"
|
||||||
#include "core/graphicsbufferallocator.h"
|
#include "core/graphicsbufferallocator.h"
|
||||||
#include "core/outputbackend.h"
|
|
||||||
#include "core/renderbackend.h"
|
#include "core/renderbackend.h"
|
||||||
#include "cursor.h"
|
#include "cursor.h"
|
||||||
#include "kwinscreencast_logging.h"
|
#include "kwinscreencast_logging.h"
|
||||||
|
@ -20,7 +19,6 @@
|
||||||
#include "opengl/glutils.h"
|
#include "opengl/glutils.h"
|
||||||
#include "pipewirecore.h"
|
#include "pipewirecore.h"
|
||||||
#include "platformsupport/scenes/opengl/abstract_egl_backend.h"
|
#include "platformsupport/scenes/opengl/abstract_egl_backend.h"
|
||||||
#include "platformsupport/scenes/opengl/openglbackend.h"
|
|
||||||
#include "scene/workspacescene.h"
|
#include "scene/workspacescene.h"
|
||||||
#include "screencastbuffer.h"
|
#include "screencastbuffer.h"
|
||||||
#include "screencastsource.h"
|
#include "screencastsource.h"
|
||||||
|
@ -343,6 +341,12 @@ bool ScreenCastStream::init()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AbstractEglBackend *backend = qobject_cast<AbstractEglBackend *>(Compositor::self()->backend());
|
||||||
|
if (!backend) {
|
||||||
|
m_error = i18n("OpenGL compositing is required for screencasting");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
connect(m_pwCore.get(), &PipeWireCore::pipewireFailed, this, &ScreenCastStream::coreFailed);
|
connect(m_pwCore.get(), &PipeWireCore::pipewireFailed, this, &ScreenCastStream::coreFailed);
|
||||||
|
|
||||||
if (!createStream()) {
|
if (!createStream()) {
|
||||||
|
@ -482,6 +486,11 @@ void ScreenCastStream::recordFrame(const QRegion &damage, Contents contents)
|
||||||
m_pendingDamage = {};
|
m_pendingDamage = {};
|
||||||
m_pendingContents = {};
|
m_pendingContents = {};
|
||||||
|
|
||||||
|
AbstractEglBackend *backend = qobject_cast<AbstractEglBackend *>(Compositor::self()->backend());
|
||||||
|
if (!backend) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
struct pw_buffer *pwBuffer = pw_stream_dequeue_buffer(m_pwStream);
|
struct pw_buffer *pwBuffer = pw_stream_dequeue_buffer(m_pwStream);
|
||||||
if (!pwBuffer) {
|
if (!pwBuffer) {
|
||||||
return;
|
return;
|
||||||
|
@ -506,7 +515,7 @@ void ScreenCastStream::recordFrame(const QRegion &damage, Contents contents)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EglContext *context = static_cast<AbstractEglBackend *>(Compositor::self()->backend())->openglContext();
|
EglContext *context = backend->openglContext();
|
||||||
context->makeCurrent();
|
context->makeCurrent();
|
||||||
|
|
||||||
if (effectiveContents & Content::Video) {
|
if (effectiveContents & Content::Video) {
|
||||||
|
@ -819,7 +828,7 @@ void ScreenCastStream::setCursorMode(ScreencastV1Interface::CursorMode mode, qre
|
||||||
|
|
||||||
std::optional<ScreenCastDmaBufTextureParams> ScreenCastStream::testCreateDmaBuf(const QSize &size, quint32 format, const QList<uint64_t> &modifiers)
|
std::optional<ScreenCastDmaBufTextureParams> ScreenCastStream::testCreateDmaBuf(const QSize &size, quint32 format, const QList<uint64_t> &modifiers)
|
||||||
{
|
{
|
||||||
AbstractEglBackend *backend = dynamic_cast<AbstractEglBackend *>(Compositor::self()->backend());
|
AbstractEglBackend *backend = qobject_cast<AbstractEglBackend *>(Compositor::self()->backend());
|
||||||
if (!backend) {
|
if (!backend) {
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue