renderer: Explicit sync fixes (#7151)

Enables explicit sync by default for most platforms

`misc:no_direct_scanout` -> `render:direct_scanout`
This commit is contained in:
Vaxry
2024-08-06 14:52:19 +01:00
committed by GitHub
parent 0e86808e59
commit 640d161851
24 changed files with 378 additions and 165 deletions

View File

@@ -2870,7 +2870,7 @@ SP<CEGLSync> CHyprOpenGLImpl::createEGLSync(int fenceFD) {
std::vector<EGLint> attribs;
int dupFd = -1;
if (fenceFD > 0) {
int dupFd = fcntl(fenceFD, F_DUPFD_CLOEXEC, 0);
dupFd = fcntl(fenceFD, F_DUPFD_CLOEXEC, 0);
if (dupFd < 0) {
Debug::log(ERR, "createEGLSync: dup failed");
return nullptr;
@@ -2889,8 +2889,18 @@ SP<CEGLSync> CHyprOpenGLImpl::createEGLSync(int fenceFD) {
return nullptr;
}
auto eglsync = SP<CEGLSync>(new CEGLSync);
eglsync->sync = sync;
// we need to flush otherwise we might not get a valid fd
glFlush();
int fd = g_pHyprOpenGL->m_sProc.eglDupNativeFenceFDANDROID(g_pHyprOpenGL->m_pEglDisplay, sync);
if (fd == EGL_NO_NATIVE_FENCE_FD_ANDROID) {
Debug::log(ERR, "eglDupNativeFenceFDANDROID failed");
return nullptr;
}
auto eglsync = SP<CEGLSync>(new CEGLSync);
eglsync->sync = sync;
eglsync->m_iFd = fd;
return eglsync;
}
@@ -2983,19 +2993,13 @@ CEGLSync::~CEGLSync() {
if (g_pHyprOpenGL->m_sProc.eglDestroySyncKHR(g_pHyprOpenGL->m_pEglDisplay, sync) != EGL_TRUE)
Debug::log(ERR, "eglDestroySyncKHR failed");
if (m_iFd >= 0)
close(m_iFd);
}
int CEGLSync::dupFenceFD() {
if (sync == EGL_NO_SYNC_KHR)
return -1;
int fd = g_pHyprOpenGL->m_sProc.eglDupNativeFenceFDANDROID(g_pHyprOpenGL->m_pEglDisplay, sync);
if (fd == EGL_NO_NATIVE_FENCE_FD_ANDROID) {
Debug::log(ERR, "eglDupNativeFenceFDANDROID failed");
return -1;
}
return fd;
int CEGLSync::fd() {
return m_iFd;
}
bool CEGLSync::wait() {