9c20df5030
Currently, we use glFinish() to ensure that stream consumers don't see corrupted or rather incomplete buffers. This is a serious issue because glFinish() not only prevents the gpu from processing new GL commands, but it also blocks the compositor. This change addresses the blocking issue by using native fences. With the proposed change, after finishing recording a frame, a fence is inserted in the command stream. When the native fence is signaled, the pending pipewire buffer will be enqueued. If the EGL_ANDROID_native_fence_sync extension is not supported, we'll fall back to using glFinish().
32 lines
553 B
C++
32 lines
553 B
C++
/*
|
|
SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <epoxy/egl.h>
|
|
#include <fixx11h.h>
|
|
|
|
namespace KWin
|
|
{
|
|
|
|
class EGLNativeFence
|
|
{
|
|
public:
|
|
explicit EGLNativeFence(EGLDisplay display);
|
|
~EGLNativeFence();
|
|
|
|
bool isValid() const;
|
|
int fileDescriptor() const;
|
|
|
|
private:
|
|
EGLSyncKHR m_sync = EGL_NO_SYNC_KHR;
|
|
EGLDisplay m_display = EGL_NO_DISPLAY;
|
|
int m_fileDescriptor = -1;
|
|
|
|
Q_DISABLE_COPY(EGLNativeFence)
|
|
};
|
|
|
|
} // namespace KWin
|