Created
March 22, 2025 11:13
-
-
Save gulafaran/89b102e837cb0d08e7b6de0181f38362 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/protocols/Screencopy.cpp b/src/protocols/Screencopy.cpp | |
index aae5caf1..701987ca 100644 | |
--- a/src/protocols/Screencopy.cpp | |
+++ b/src/protocols/Screencopy.cpp | |
@@ -221,6 +221,9 @@ bool CScreencopyFrame::copyDmabuf() { | |
g_pHyprOpenGL->m_RenderData.blockScreenShader = true; | |
g_pHyprRenderer->endRender(); | |
+ auto sync = g_pHyprOpenGL->createEGLSync(); | |
+ sync->wait(); | |
+ | |
LOGM(TRACE, "Copied frame via dma"); | |
return true; | |
@@ -295,6 +298,9 @@ bool CScreencopyFrame::copyShm() { | |
glBindFramebuffer(GL_FRAMEBUFFER, 0); | |
#endif | |
+ auto sync = g_pHyprOpenGL->createEGLSync(); | |
+ sync->wait(); | |
+ | |
LOGM(TRACE, "Copied frame via shm"); | |
return true; | |
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp | |
index e2f72fff..6ca16f17 100644 | |
--- a/src/render/OpenGL.cpp | |
+++ b/src/render/OpenGL.cpp | |
@@ -3025,3 +3025,7 @@ CFileDescriptor&& CEGLSync::takeFD() { | |
CFileDescriptor& CEGLSync::fd() { | |
return m_iFd; | |
} | |
+ | |
+bool CEGLSync::wait() { | |
+ return g_pHyprOpenGL->m_sProc.eglWaitSyncKHR(g_pHyprOpenGL->m_pEglDisplay, sync, 0) == EGL_TRUE; | |
+} | |
diff --git a/src/render/OpenGL.hpp b/src/render/OpenGL.hpp | |
index fa6c575d..fa0ad2e3 100644 | |
--- a/src/render/OpenGL.hpp | |
+++ b/src/render/OpenGL.hpp | |
@@ -152,6 +152,7 @@ class CEGLSync { | |
Hyprutils::OS::CFileDescriptor&& takeFD(); | |
Hyprutils::OS::CFileDescriptor& fd(); | |
+ bool wait(); | |
private: | |
CEGLSync() = default; | |
diff --git a/src/render/Renderbuffer.cpp b/src/render/Renderbuffer.cpp | |
index 1ea9f785..eba68ba9 100644 | |
--- a/src/render/Renderbuffer.cpp | |
+++ b/src/render/Renderbuffer.cpp | |
@@ -25,6 +25,10 @@ CRenderbuffer::CRenderbuffer(SP<Aquamarine::IBuffer> buffer, uint32_t format) : | |
auto dma = buffer->dmabuf(); | |
m_iImage = g_pHyprOpenGL->createEGLImage(dma); | |
+ | |
+ auto sync = g_pHyprOpenGL->createEGLSync(); | |
+ sync->wait(); | |
+ | |
if (m_iImage == EGL_NO_IMAGE_KHR) { | |
Debug::log(ERR, "rb: createEGLImage failed"); | |
return; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment