File indexing completed on 2024-05-19 16:34:01

0001 /*
0002     SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "kwinglobals.h"
0010 #include "rendertarget.h"
0011 
0012 #include <QObject>
0013 
0014 #include <memory>
0015 
0016 namespace KWin
0017 {
0018 
0019 class Output;
0020 class OverlayWindow;
0021 class OutputLayer;
0022 class SurfacePixmapInternal;
0023 class SurfacePixmapWayland;
0024 class SurfacePixmapX11;
0025 class SurfaceTexture;
0026 
0027 /**
0028  * The RenderBackend class is the base class for all rendering backends.
0029  */
0030 class KWIN_EXPORT RenderBackend : public QObject
0031 {
0032     Q_OBJECT
0033 
0034 public:
0035     explicit RenderBackend(QObject *parent = nullptr);
0036 
0037     virtual CompositingType compositingType() const = 0;
0038     virtual OverlayWindow *overlayWindow() const;
0039 
0040     virtual bool checkGraphicsReset();
0041 
0042     virtual OutputLayer *primaryLayer(Output *output) = 0;
0043     virtual void present(Output *output) = 0;
0044 
0045     virtual QHash<uint32_t, QVector<uint64_t>> supportedFormats() const;
0046 
0047     virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureInternal(SurfacePixmapInternal *pixmap);
0048     virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureX11(SurfacePixmapX11 *pixmap);
0049     virtual std::unique_ptr<SurfaceTexture> createSurfaceTextureWayland(SurfacePixmapWayland *pixmap);
0050 };
0051 
0052 } // namespace KWin