File indexing completed on 2025-04-20 10:57:33

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2022 Xaver Hugl <xaver.hugl@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 
0011 #include <QMap>
0012 #include <QPointer>
0013 #include <QVector>
0014 
0015 namespace KWaylandServer
0016 {
0017 class SurfaceInterface;
0018 class LinuxDmaBufV1ClientBuffer;
0019 }
0020 
0021 namespace KWin
0022 {
0023 
0024 class EglGbmBackend;
0025 class DrmGpu;
0026 
0027 class DmabufFeedback
0028 {
0029 public:
0030     DmabufFeedback(DrmGpu *gpu, EglGbmBackend *eglBackend);
0031 
0032     void renderingSurface();
0033     void scanoutSuccessful(KWaylandServer::SurfaceInterface *surface);
0034     void scanoutFailed(KWaylandServer::SurfaceInterface *surface, const QMap<uint32_t, QVector<uint64_t>> &formats);
0035 
0036 private:
0037     QPointer<KWaylandServer::SurfaceInterface> m_surface;
0038     QMap<uint32_t, QVector<uint64_t>> m_attemptedFormats;
0039     bool m_attemptedThisFrame = false;
0040 
0041     DrmGpu *const m_gpu;
0042     EglGbmBackend *const m_eglBackend;
0043 };
0044 
0045 }