File indexing completed on 2024-05-12 05:31:41
0001 /* 0002 SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <epoxy/egl.h> 0010 0011 #include "kwin_export.h" 0012 #include "utils/filedescriptor.h" 0013 0014 namespace KWin 0015 { 0016 0017 class EglDisplay; 0018 0019 class KWIN_EXPORT EGLNativeFence 0020 { 0021 public: 0022 explicit EGLNativeFence(EglDisplay *display); 0023 explicit EGLNativeFence(EglDisplay *display, EGLSyncKHR sync); 0024 EGLNativeFence(EGLNativeFence &&) = delete; 0025 EGLNativeFence(const EGLNativeFence &) = delete; 0026 ~EGLNativeFence(); 0027 0028 bool isValid() const; 0029 const FileDescriptor &fileDescriptor() const; 0030 bool waitSync() const; 0031 0032 static EGLNativeFence importFence(EglDisplay *display, FileDescriptor &&fd); 0033 0034 private: 0035 EGLSyncKHR m_sync = EGL_NO_SYNC_KHR; 0036 EglDisplay *m_display = nullptr; 0037 FileDescriptor m_fileDescriptor; 0038 }; 0039 0040 } // namespace KWin