core: Expose graphics buffer allocator in RenderBackend
It can be used by other components to allocate buffers on the compositing render device. For example, QPA.
This commit is contained in:
parent
c2dfb55c59
commit
76335880bf
12 changed files with 29 additions and 6 deletions
|
@ -142,6 +142,11 @@ std::unique_ptr<SurfaceTexture> EglGbmBackend::createSurfaceTextureWayland(Surfa
|
|||
return std::make_unique<BasicEGLSurfaceTextureWayland>(this, pixmap);
|
||||
}
|
||||
|
||||
GraphicsBufferAllocator *EglGbmBackend::graphicsBufferAllocator() const
|
||||
{
|
||||
return gpu()->graphicsBufferAllocator();
|
||||
}
|
||||
|
||||
void EglGbmBackend::present(Output *output)
|
||||
{
|
||||
static_cast<DrmAbstractOutput *>(output)->present();
|
||||
|
|
|
@ -50,6 +50,8 @@ public:
|
|||
std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
|
||||
std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
|
||||
|
||||
GraphicsBufferAllocator *graphicsBufferAllocator() const override;
|
||||
|
||||
void present(Output *output) override;
|
||||
OutputLayer *primaryLayer(Output *output) override;
|
||||
OutputLayer *cursorLayer(Output *output) override;
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
*/
|
||||
#include "drm_qpainter_backend.h"
|
||||
#include "drm_backend.h"
|
||||
#include "drm_gpu.h"
|
||||
#include "drm_output.h"
|
||||
#include "drm_pipeline.h"
|
||||
#include "drm_qpainter_layer.h"
|
||||
|
@ -31,6 +32,11 @@ DrmQPainterBackend::~DrmQPainterBackend()
|
|||
m_backend->setRenderBackend(nullptr);
|
||||
}
|
||||
|
||||
GraphicsBufferAllocator *DrmQPainterBackend::graphicsBufferAllocator() const
|
||||
{
|
||||
return m_backend->primaryGpu()->graphicsBufferAllocator();
|
||||
}
|
||||
|
||||
void DrmQPainterBackend::present(Output *output)
|
||||
{
|
||||
static_cast<DrmAbstractOutput *>(output)->present();
|
||||
|
|
|
@ -28,6 +28,8 @@ public:
|
|||
DrmQPainterBackend(DrmBackend *backend);
|
||||
~DrmQPainterBackend();
|
||||
|
||||
GraphicsBufferAllocator *graphicsBufferAllocator() const override;
|
||||
|
||||
void present(Output *output) override;
|
||||
OutputLayer *primaryLayer(Output *output) override;
|
||||
OutputLayer *cursorLayer(Output *output) override;
|
||||
|
|
|
@ -59,7 +59,7 @@ public:
|
|||
void init() override;
|
||||
|
||||
VirtualBackend *backend() const;
|
||||
GraphicsBufferAllocator *graphicsBufferAllocator() const;
|
||||
GraphicsBufferAllocator *graphicsBufferAllocator() const override;
|
||||
|
||||
private:
|
||||
bool initializeEgl();
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
VirtualQPainterBackend(VirtualBackend *backend);
|
||||
~VirtualQPainterBackend() override;
|
||||
|
||||
GraphicsBufferAllocator *graphicsBufferAllocator() const;
|
||||
GraphicsBufferAllocator *graphicsBufferAllocator() const override;
|
||||
|
||||
void present(Output *output) override;
|
||||
VirtualQPainterLayer *primaryLayer(Output *output) override;
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
~WaylandEglBackend() override;
|
||||
|
||||
WaylandBackend *backend() const;
|
||||
GraphicsBufferAllocator *graphicsBufferAllocator() const;
|
||||
GraphicsBufferAllocator *graphicsBufferAllocator() const override;
|
||||
|
||||
std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
|
||||
std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
|
||||
|
|
|
@ -81,7 +81,7 @@ public:
|
|||
explicit WaylandQPainterBackend(WaylandBackend *b);
|
||||
~WaylandQPainterBackend() override;
|
||||
|
||||
GraphicsBufferAllocator *graphicsBufferAllocator() const;
|
||||
GraphicsBufferAllocator *graphicsBufferAllocator() const override;
|
||||
|
||||
void present(Output *output) override;
|
||||
OutputLayer *primaryLayer(Output *output) override;
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
~X11WindowedEglBackend() override;
|
||||
|
||||
X11WindowedBackend *backend() const;
|
||||
GraphicsBufferAllocator *graphicsBufferAllocator() const;
|
||||
GraphicsBufferAllocator *graphicsBufferAllocator() const override;
|
||||
|
||||
std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap) override;
|
||||
std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap) override;
|
||||
|
|
|
@ -69,7 +69,7 @@ public:
|
|||
X11WindowedQPainterBackend(X11WindowedBackend *backend);
|
||||
~X11WindowedQPainterBackend() override;
|
||||
|
||||
GraphicsBufferAllocator *graphicsBufferAllocator() const;
|
||||
GraphicsBufferAllocator *graphicsBufferAllocator() const override;
|
||||
|
||||
void present(Output *output) override;
|
||||
OutputLayer *primaryLayer(Output *output) override;
|
||||
|
|
|
@ -32,6 +32,11 @@ bool RenderBackend::checkGraphicsReset()
|
|||
return false;
|
||||
}
|
||||
|
||||
GraphicsBufferAllocator *RenderBackend::graphicsBufferAllocator() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool RenderBackend::testImportBuffer(GraphicsBuffer *buffer)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -17,6 +17,7 @@ namespace KWin
|
|||
{
|
||||
|
||||
class GraphicsBuffer;
|
||||
class GraphicsBufferAllocator;
|
||||
class Output;
|
||||
class OverlayWindow;
|
||||
class OutputLayer;
|
||||
|
@ -44,6 +45,8 @@ public:
|
|||
virtual OutputLayer *cursorLayer(Output *output);
|
||||
virtual void present(Output *output) = 0;
|
||||
|
||||
virtual GraphicsBufferAllocator *graphicsBufferAllocator() const;
|
||||
|
||||
virtual bool testImportBuffer(GraphicsBuffer *buffer);
|
||||
virtual QHash<uint32_t, QVector<uint64_t>> supportedFormats() const;
|
||||
|
||||
|
|
Loading…
Reference in a new issue