Warning, file /plasma/kwin/src/x11syncmanager.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 SPDX-FileCopyrightText: 2014 Fredrik Höglund <fredrik@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include "kwinglutils.h" 0010 0011 #include <xcb/sync.h> 0012 #include <xcb/xcb.h> 0013 0014 namespace KWin 0015 { 0016 0017 /** 0018 * SyncObject represents a fence used to synchronize operations in the kwin command stream 0019 * with operations in the X command stream. 0020 */ 0021 class X11SyncObject 0022 { 0023 public: 0024 enum State { 0025 Ready, 0026 TriggerSent, 0027 Waiting, 0028 Done, 0029 Resetting, 0030 }; 0031 0032 X11SyncObject(); 0033 ~X11SyncObject(); 0034 0035 State state() const 0036 { 0037 return m_state; 0038 } 0039 0040 void trigger(); 0041 void wait(); 0042 bool finish(); 0043 void reset(); 0044 void finishResetting(); 0045 0046 private: 0047 State m_state; 0048 GLsync m_sync; 0049 xcb_sync_fence_t m_fence; 0050 xcb_get_input_focus_cookie_t m_reset_cookie; 0051 }; 0052 0053 /** 0054 * SyncManager manages a set of fences used for explicit synchronization with the X command 0055 * stream. 0056 */ 0057 class X11SyncManager 0058 { 0059 public: 0060 enum { 0061 MaxFences = 4, 0062 }; 0063 0064 static X11SyncManager *create(); 0065 ~X11SyncManager(); 0066 0067 bool endFrame(); 0068 0069 void triggerFence(); 0070 void insertWait(); 0071 0072 private: 0073 X11SyncManager(); 0074 0075 X11SyncObject *m_currentFence = nullptr; 0076 QVector<X11SyncObject *> m_fences; 0077 int m_next = 0; 0078 }; 0079 0080 } // namespace KWin