Commit 6546ac2c authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

screencast: Replace EGLFence with a glFinish()

The way EGLFence is used is equivalent to calling glFinish().

CCBUG: 425869
parent 6f153552
...@@ -37,35 +37,6 @@ ScreencastManager::ScreencastManager(QObject *parent) ...@@ -37,35 +37,6 @@ ScreencastManager::ScreencastManager(QObject *parent)
this, &ScreencastManager::streamOutput); this, &ScreencastManager::streamOutput);
} }
class EGLFence : public QObject
{
public:
EGLFence(EGLDisplay eglDisplay)
: m_eglDisplay(eglDisplay)
, m_sync(eglCreateSync(eglDisplay, EGL_SYNC_FENCE_KHR, nullptr))
{
Q_ASSERT(m_sync);
glFinish();
}
bool clientWaitSync()
{
glFenceSync (GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
int ret = eglClientWaitSync(m_eglDisplay, m_sync, EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, 0);
Q_ASSERT(ret == EGL_CONDITION_SATISFIED_KHR);
return ret == EGL_CONDITION_SATISFIED_KHR;
}
~EGLFence() {
auto ret = eglDestroySyncKHR(m_eglDisplay, m_sync);
Q_ASSERT(ret == EGL_TRUE);
}
private:
const EGLDisplay m_eglDisplay;
const EGLSyncKHR m_sync;
};
class WindowStream : public PipeWireStream class WindowStream : public PipeWireStream
{ {
public: public:
...@@ -100,7 +71,6 @@ private: ...@@ -100,7 +71,6 @@ private:
return; return;
} }
effects->makeOpenGLContextCurrent(); effects->makeOpenGLContextCurrent();
EGLFence fence(kwinApp()->platform()->sceneEglDisplay());
QSharedPointer<GLTexture> frameTexture(m_toplevel->effectWindow()->sceneWindow()->windowTexture()); QSharedPointer<GLTexture> frameTexture(m_toplevel->effectWindow()->sceneWindow()->windowTexture());
const bool wasYInverted = frameTexture->isYInverted(); const bool wasYInverted = frameTexture->isYInverted();
frameTexture->setYInverted(false); frameTexture->setYInverted(false);
...@@ -108,8 +78,7 @@ private: ...@@ -108,8 +78,7 @@ private:
recordFrame(frameTexture.data(), m_damagedRegion); recordFrame(frameTexture.data(), m_damagedRegion);
frameTexture->setYInverted(wasYInverted); frameTexture->setYInverted(wasYInverted);
m_damagedRegion = {}; m_damagedRegion = {};
bool b = fence.clientWaitSync(); glFinish(); // TODO: Don't stall the whole pipeline. Use EGL_ANDROID_native_fence_sync.
Q_ASSERT(b);
} }
QRegion m_damagedRegion; QRegion m_damagedRegion;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment