core: Move surface texture factory functions to RenderBackend
The goal is to create surface items for things that are not in the workspace scene. RenderBackend perhaps is not a great place for these factory functions. On the other hand, this change merely rewires code from Scene to RenderBackend. I think that in distant future we could make surface items pick surface texture type on their own, for what it's worth that's what we would do in QtQuick.
This commit is contained in:
parent
f94b8bfa86
commit
23bef7601e
14 changed files with 34 additions and 91 deletions
|
@ -5,6 +5,7 @@
|
|||
*/
|
||||
|
||||
#include "renderbackend.h"
|
||||
#include "scene/surfaceitem.h"
|
||||
|
||||
#include <drm_fourcc.h>
|
||||
|
||||
|
@ -31,4 +32,19 @@ QHash<uint32_t, QVector<uint64_t>> RenderBackend::supportedFormats() const
|
|||
return QHash<uint32_t, QVector<uint64_t>>{{DRM_FORMAT_XRGB8888, QVector<uint64_t>{DRM_FORMAT_MOD_LINEAR}}};
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> RenderBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> RenderBackend::createSurfaceTextureX11(SurfacePixmapX11 *pixmap)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> RenderBackend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace KWin
|
||||
|
|
|
@ -11,12 +11,18 @@
|
|||
|
||||
#include <QObject>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
||||
class Output;
|
||||
class OverlayWindow;
|
||||
class OutputLayer;
|
||||
class SurfacePixmapInternal;
|
||||
class SurfacePixmapWayland;
|
||||
class SurfacePixmapX11;
|
||||
class SurfaceTexture;
|
||||
|
||||
/**
|
||||
* The RenderBackend class is the base class for all rendering backends.
|
||||
|
@ -37,6 +43,10 @@ public:
|
|||
virtual void present(Output *output) = 0;
|
||||
|
||||
virtual QHash<uint32_t, QVector<uint64_t>> supportedFormats() const;
|
||||
|
||||
virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap);
|
||||
virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureX11(SurfacePixmapX11 *pixmap);
|
||||
virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap);
|
||||
};
|
||||
|
||||
} // namespace KWin
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <kwineffects.h>
|
||||
#include <kwinglutils_funcs.h>
|
||||
|
||||
#include "scene/surfaceitem.h"
|
||||
#include "utils/common.h"
|
||||
#include "workspace.h"
|
||||
|
||||
|
@ -62,21 +61,6 @@ std::shared_ptr<KWin::GLTexture> OpenGLBackend::textureForOutput(Output *output)
|
|||
return {};
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> OpenGLBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> OpenGLBackend::createSurfaceTextureX11(SurfacePixmapX11 *pixmap)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> OpenGLBackend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool OpenGLBackend::checkGraphicsReset()
|
||||
{
|
||||
const GLenum status = KWin::glGetGraphicsResetStatus();
|
||||
|
|
|
@ -18,11 +18,6 @@ namespace KWin
|
|||
{
|
||||
class Output;
|
||||
class OpenGLBackend;
|
||||
class SurfaceItem;
|
||||
class SurfacePixmapInternal;
|
||||
class SurfacePixmapX11;
|
||||
class SurfacePixmapWayland;
|
||||
class SurfaceTexture;
|
||||
class GLTexture;
|
||||
|
||||
/**
|
||||
|
@ -51,10 +46,6 @@ public:
|
|||
CompositingType compositingType() const override final;
|
||||
bool checkGraphicsReset() override final;
|
||||
|
||||
virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap);
|
||||
virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureX11(SurfacePixmapX11 *pixmap);
|
||||
virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap);
|
||||
|
||||
virtual bool makeCurrent() = 0;
|
||||
virtual void doneCurrent() = 0;
|
||||
|
||||
|
|
|
@ -20,9 +20,6 @@ class QString;
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
class SurfacePixmapInternal;
|
||||
class SurfacePixmapWayland;
|
||||
class SurfaceTexture;
|
||||
class Output;
|
||||
|
||||
class KWIN_EXPORT QPainterBackend : public RenderBackend
|
||||
|
@ -34,8 +31,8 @@ public:
|
|||
|
||||
CompositingType compositingType() const override final;
|
||||
|
||||
std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap);
|
||||
std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap);
|
||||
std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
|
||||
std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
|
||||
|
||||
/**
|
||||
* @brief Whether the creation of the Backend failed.
|
||||
|
|
|
@ -608,19 +608,4 @@ QVector<QByteArray> Scene::openGLPlatformInterfaceExtensions() const
|
|||
return QVector<QByteArray>{};
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> Scene::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> Scene::createSurfaceTextureX11(SurfacePixmapX11 *pixmap)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> Scene::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
|
|
@ -40,10 +40,6 @@ class Scene;
|
|||
class Shadow;
|
||||
class ShadowItem;
|
||||
class SurfaceItem;
|
||||
class SurfacePixmapInternal;
|
||||
class SurfacePixmapWayland;
|
||||
class SurfacePixmapX11;
|
||||
class SurfaceTexture;
|
||||
class WindowItem;
|
||||
|
||||
class SceneDelegate : public RenderLayerDelegate
|
||||
|
@ -154,10 +150,6 @@ public:
|
|||
return {};
|
||||
}
|
||||
|
||||
virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap);
|
||||
virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureX11(SurfacePixmapX11 *pixmap);
|
||||
virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap);
|
||||
|
||||
ItemRenderer *renderer() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include "core/output.h"
|
||||
#include "decorations/decoratedclient.h"
|
||||
#include "scene/itemrenderer_opengl.h"
|
||||
#include "scene/surfaceitem.h"
|
||||
#include "window.h"
|
||||
|
||||
#include <cmath>
|
||||
|
@ -95,21 +94,6 @@ std::shared_ptr<GLTexture> SceneOpenGL::textureForOutput(Output *output) const
|
|||
return m_backend->textureForOutput(output);
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> SceneOpenGL::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
|
||||
{
|
||||
return m_backend->createSurfaceTextureInternal(pixmap);
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> SceneOpenGL::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
|
||||
{
|
||||
return m_backend->createSurfaceTextureWayland(pixmap);
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> SceneOpenGL::createSurfaceTextureX11(SurfacePixmapX11 *pixmap)
|
||||
{
|
||||
return m_backend->createSurfaceTextureX11(pixmap);
|
||||
}
|
||||
|
||||
//****************************************
|
||||
// SceneOpenGL::Shadow
|
||||
//****************************************
|
||||
|
|
|
@ -36,9 +36,6 @@ public:
|
|||
bool supportsNativeFence() const override;
|
||||
DecorationRenderer *createDecorationRenderer(Decoration::DecoratedClientImpl *impl) override;
|
||||
bool animationsSupported() const override;
|
||||
std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
|
||||
std::unique_ptr<SurfaceTexture> createSurfaceTextureX11(SurfacePixmapX11 *pixmap) override;
|
||||
std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
|
||||
|
||||
OpenGLBackend *backend() const
|
||||
{
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
// KWin
|
||||
#include "decorations/decoratedclient.h"
|
||||
#include "scene/itemrenderer_qpainter.h"
|
||||
#include "scene/surfaceitem.h"
|
||||
#include "window.h"
|
||||
|
||||
// Qt
|
||||
|
@ -47,16 +46,6 @@ DecorationRenderer *SceneQPainter::createDecorationRenderer(Decoration::Decorate
|
|||
return new SceneQPainterDecorationRenderer(impl);
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> SceneQPainter::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
|
||||
{
|
||||
return m_backend->createSurfaceTextureInternal(pixmap);
|
||||
}
|
||||
|
||||
std::unique_ptr<SurfaceTexture> SceneQPainter::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
|
||||
{
|
||||
return m_backend->createSurfaceTextureWayland(pixmap);
|
||||
}
|
||||
|
||||
//****************************************
|
||||
// QPainterShadow
|
||||
//****************************************
|
||||
|
|
|
@ -27,8 +27,6 @@ public:
|
|||
|
||||
Shadow *createShadow(Window *window) override;
|
||||
DecorationRenderer *createDecorationRenderer(Decoration::DecoratedClientImpl *impl) override;
|
||||
std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
|
||||
std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
|
||||
|
||||
bool animationsSupported() const override
|
||||
{
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
|
||||
#include "scene/surfaceitem_internal.h"
|
||||
#include "composite.h"
|
||||
#include "core/renderbackend.h"
|
||||
#include "deleted.h"
|
||||
#include "internalwindow.h"
|
||||
#include "scene/scene.h"
|
||||
|
||||
#include <QOpenGLFramebufferObject>
|
||||
|
||||
|
@ -61,7 +61,7 @@ void SurfaceItemInternal::handleWindowClosed(Window *original, Deleted *deleted)
|
|||
}
|
||||
|
||||
SurfacePixmapInternal::SurfacePixmapInternal(SurfaceItemInternal *item, QObject *parent)
|
||||
: SurfacePixmap(Compositor::self()->scene()->createSurfaceTextureInternal(this), parent)
|
||||
: SurfacePixmap(Compositor::self()->backend()->createSurfaceTextureInternal(this), parent)
|
||||
, m_item(item)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#include "scene/surfaceitem_wayland.h"
|
||||
#include "composite.h"
|
||||
#include "core/renderbackend.h"
|
||||
#include "deleted.h"
|
||||
#include "scene/scene.h"
|
||||
#include "wayland/clientbuffer.h"
|
||||
#include "wayland/subcompositor_interface.h"
|
||||
#include "wayland/surface_interface.h"
|
||||
|
@ -143,7 +143,7 @@ ContentType SurfaceItemWayland::contentType() const
|
|||
}
|
||||
|
||||
SurfacePixmapWayland::SurfacePixmapWayland(SurfaceItemWayland *item, QObject *parent)
|
||||
: SurfacePixmap(Compositor::self()->scene()->createSurfaceTextureWayland(this), parent)
|
||||
: SurfacePixmap(Compositor::self()->backend()->createSurfaceTextureWayland(this), parent)
|
||||
, m_item(item)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#include "scene/surfaceitem_x11.h"
|
||||
#include "composite.h"
|
||||
#include "core/renderbackend.h"
|
||||
#include "deleted.h"
|
||||
#include "scene/scene.h"
|
||||
#include "x11syncmanager.h"
|
||||
|
||||
namespace KWin
|
||||
|
@ -183,7 +183,7 @@ std::unique_ptr<SurfacePixmap> SurfaceItemX11::createPixmap()
|
|||
}
|
||||
|
||||
SurfacePixmapX11::SurfacePixmapX11(SurfaceItemX11 *item, QObject *parent)
|
||||
: SurfacePixmap(Compositor::self()->scene()->createSurfaceTextureX11(this), parent)
|
||||
: SurfacePixmap(Compositor::self()->backend()->createSurfaceTextureX11(this), parent)
|
||||
, m_item(item)
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue