Commit f80a14d4 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

backends/virtual: Make render backend naming consistent

parent 5bf1332d
......@@ -24,20 +24,20 @@
namespace KWin
{
VirtualOutputLayer::VirtualOutputLayer(Output *output, EglGbmBackend *backend)
VirtualEglLayer::VirtualEglLayer(Output *output, VirtualEglBackend *backend)
: m_backend(backend)
, m_output(output)
{
}
VirtualOutputLayer::~VirtualOutputLayer() = default;
VirtualEglLayer::~VirtualEglLayer() = default;
GLTexture *VirtualOutputLayer::texture() const
GLTexture *VirtualEglLayer::texture() const
{
return m_texture.get();
}
OutputLayerBeginFrameInfo VirtualOutputLayer::beginFrame()
OutputLayerBeginFrameInfo VirtualEglLayer::beginFrame()
{
m_backend->makeCurrent();
......@@ -55,7 +55,7 @@ OutputLayerBeginFrameInfo VirtualOutputLayer::beginFrame()
};
}
bool VirtualOutputLayer::endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion)
bool VirtualEglLayer::endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion)
{
Q_UNUSED(renderedRegion)
Q_UNUSED(damagedRegion)
......@@ -63,7 +63,7 @@ bool VirtualOutputLayer::endFrame(const QRegion &renderedRegion, const QRegion &
return true;
}
EglGbmBackend::EglGbmBackend(VirtualBackend *b)
VirtualEglBackend::VirtualEglBackend(VirtualBackend *b)
: AbstractEglBackend()
, m_backend(b)
{
......@@ -71,13 +71,13 @@ EglGbmBackend::EglGbmBackend(VirtualBackend *b)
setIsDirectRendering(true);
}
EglGbmBackend::~EglGbmBackend()
VirtualEglBackend::~VirtualEglBackend()
{
m_outputs.clear();
cleanup();
}
bool EglGbmBackend::initializeEgl()
bool VirtualEglBackend::initializeEgl()
{
initClientExtensions();
EGLDisplay display = m_backend->sceneEglDisplay();
......@@ -100,7 +100,7 @@ bool EglGbmBackend::initializeEgl()
return initEglAPI();
}
void EglGbmBackend::init()
void VirtualEglBackend::init()
{
if (!initializeEgl()) {
setFailed("Could not initialize egl");
......@@ -125,11 +125,11 @@ void EglGbmBackend::init()
addOutput(output);
}
connect(m_backend, &VirtualBackend::outputEnabled, this, &EglGbmBackend::addOutput);
connect(m_backend, &VirtualBackend::outputDisabled, this, &EglGbmBackend::removeOutput);
connect(m_backend, &VirtualBackend::outputEnabled, this, &VirtualEglBackend::addOutput);
connect(m_backend, &VirtualBackend::outputDisabled, this, &VirtualEglBackend::removeOutput);
}
bool EglGbmBackend::initRenderingContext()
bool VirtualEglBackend::initRenderingContext()
{
initBufferConfigs();
......@@ -140,19 +140,19 @@ bool EglGbmBackend::initRenderingContext()
return makeCurrent();
}
void EglGbmBackend::addOutput(Output *output)
void VirtualEglBackend::addOutput(Output *output)
{
makeCurrent();
m_outputs[output] = std::make_unique<VirtualOutputLayer>(output, this);
m_outputs[output] = std::make_unique<VirtualEglLayer>(output, this);
}
void EglGbmBackend::removeOutput(Output *output)
void VirtualEglBackend::removeOutput(Output *output)
{
makeCurrent();
m_outputs.erase(output);
}
bool EglGbmBackend::initBufferConfigs()
bool VirtualEglBackend::initBufferConfigs()
{
const EGLint config_attribs[] = {
EGL_SURFACE_TYPE,
......@@ -185,29 +185,29 @@ bool EglGbmBackend::initBufferConfigs()
return true;
}
std::unique_ptr<SurfaceTexture> EglGbmBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
std::unique_ptr<SurfaceTexture> VirtualEglBackend::createSurfaceTextureInternal(SurfacePixmapInternal *pixmap)
{
return std::make_unique<BasicEGLSurfaceTextureInternal>(this, pixmap);
}
std::unique_ptr<SurfaceTexture> EglGbmBackend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
std::unique_ptr<SurfaceTexture> VirtualEglBackend::createSurfaceTextureWayland(SurfacePixmapWayland *pixmap)
{
return std::make_unique<BasicEGLSurfaceTextureWayland>(this, pixmap);
}
OutputLayer *EglGbmBackend::primaryLayer(Output *output)
OutputLayer *VirtualEglBackend::primaryLayer(Output *output)
{
return m_outputs[output].get();
}
void EglGbmBackend::present(Output *output)
void VirtualEglBackend::present(Output *output)
{
glFlush();
static_cast<VirtualOutput *>(output)->vsyncMonitor()->arm();
if (m_backend->saveFrames()) {
const std::unique_ptr<VirtualOutputLayer> &layer = m_outputs[output];
const std::unique_ptr<VirtualEglLayer> &layer = m_outputs[output];
layer->texture()->toImage().save(QStringLiteral("%1/%2.png").arg(m_backend->saveFrames()).arg(QString::number(m_frameCounter++)));
}
}
......
......@@ -16,13 +16,13 @@ namespace KWin
class VirtualBackend;
class GLFramebuffer;
class GLTexture;
class EglGbmBackend;
class VirtualEglBackend;
class VirtualOutputLayer : public OutputLayer
class VirtualEglLayer : public OutputLayer
{
public:
VirtualOutputLayer(Output *output, EglGbmBackend *backend);
~VirtualOutputLayer() override;
VirtualEglLayer(Output *output, VirtualEglBackend *backend);
~VirtualEglLayer() override;
OutputLayerBeginFrameInfo beginFrame() override;
bool endFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) override;
......@@ -30,7 +30,7 @@ public:
GLTexture *texture() const;
private:
EglGbmBackend *const m_backend;
VirtualEglBackend *const m_backend;
Output *m_output;
std::unique_ptr<GLFramebuffer> m_fbo;
std::unique_ptr<GLTexture> m_texture;
......@@ -39,13 +39,13 @@ private:
/**
* @brief OpenGL Backend using Egl on a GBM surface.
*/
class EglGbmBackend : public AbstractEglBackend
class VirtualEglBackend : public AbstractEglBackend
{
Q_OBJECT
public:
EglGbmBackend(VirtualBackend *b);
~EglGbmBackend() override;
VirtualEglBackend(VirtualBackend *b);
~VirtualEglBackend() override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
OutputLayer *primaryLayer(Output *output) override;
......@@ -62,7 +62,7 @@ private:
VirtualBackend *m_backend;
int m_frameCounter = 0;
std::map<Output *, std::unique_ptr<VirtualOutputLayer>> m_outputs;
std::map<Output *, std::unique_ptr<VirtualEglLayer>> m_outputs;
};
} // namespace
......
......@@ -87,7 +87,7 @@ QPainterBackend *VirtualBackend::createQPainterBackend()
OpenGLBackend *VirtualBackend::createOpenGLBackend()
{
return new EglGbmBackend(this);
return new VirtualEglBackend(this);
}
Outputs VirtualBackend::outputs() const
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment