File indexing completed on 2024-05-19 05:31:34

0001 /*
0002     SPDX-FileCopyrightText: 2023 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "kwin_export.h"
0010 
0011 #include <QList>
0012 #include <QSize>
0013 
0014 namespace KWin
0015 {
0016 
0017 class GraphicsBuffer;
0018 
0019 /**
0020  * The GraphicsBufferOptions describes the properties of an allocated graphics buffer.
0021  */
0022 struct GraphicsBufferOptions
0023 {
0024     /// The size of the buffer, in device pixels.
0025     QSize size;
0026 
0027     /// The pixel format of the buffer, see DRM_FORMAT_*.
0028     uint32_t format;
0029 
0030     /// An optional list of modifiers, see DRM_FORMAT_MOD_*.
0031     QList<uint64_t> modifiers;
0032 
0033     /// Whether the graphics buffer should be suitable for software rendering.
0034     bool software = false;
0035 };
0036 
0037 class KWIN_EXPORT GraphicsBufferAllocator
0038 {
0039 public:
0040     GraphicsBufferAllocator();
0041     virtual ~GraphicsBufferAllocator();
0042 
0043     virtual GraphicsBuffer *allocate(const GraphicsBufferOptions &options) = 0;
0044 };
0045 
0046 } // namespace KWin