mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-09 15:45:57 +01:00
eee
This commit is contained in:
parent
941c003dec
commit
8f38c06ac1
3 changed files with 20 additions and 9 deletions
|
@ -30,6 +30,8 @@ static int fdHandleWrite(int fd, uint32_t mask, void* data) {
|
||||||
|
|
||||||
g_pFrameSchedulingManager->gpuDone(RB->m_pWlrBuffer);
|
g_pFrameSchedulingManager->gpuDone(RB->m_pWlrBuffer);
|
||||||
|
|
||||||
|
RB->removeFence();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,11 +84,6 @@ CRenderbuffer::CRenderbuffer(wlr_buffer* buffer, uint32_t format, CMonitor* pMon
|
||||||
},
|
},
|
||||||
this, "CRenderbuffer");
|
this, "CRenderbuffer");
|
||||||
|
|
||||||
wlr_dmabuf_attributes attrs = {0};
|
|
||||||
wlr_buffer_get_dmabuf(m_pWlrBuffer, &attrs);
|
|
||||||
|
|
||||||
m_pFDWrite = wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, attrs.fd[0], WL_EVENT_READABLE, fdHandleWrite, this);
|
|
||||||
|
|
||||||
g_pFrameSchedulingManager->registerBuffer(m_pWlrBuffer, pMonitor);
|
g_pFrameSchedulingManager->registerBuffer(m_pWlrBuffer, pMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,3 +108,14 @@ void CRenderbuffer::unbind() {
|
||||||
CFramebuffer* CRenderbuffer::getFB() {
|
CFramebuffer* CRenderbuffer::getFB() {
|
||||||
return &m_sFramebuffer;
|
return &m_sFramebuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CRenderbuffer::plantFence() {
|
||||||
|
wlr_dmabuf_attributes attrs = {0};
|
||||||
|
wlr_buffer_get_dmabuf(m_pWlrBuffer, &attrs);
|
||||||
|
m_pFDWrite = wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, attrs.fd[0], WL_EVENT_WRITABLE, fdHandleWrite, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CRenderbuffer::removeFence() {
|
||||||
|
wl_event_source_remove(m_pFDWrite);
|
||||||
|
m_pFDWrite = nullptr;
|
||||||
|
}
|
|
@ -13,6 +13,8 @@ class CRenderbuffer {
|
||||||
void bindFB();
|
void bindFB();
|
||||||
void unbind();
|
void unbind();
|
||||||
CFramebuffer* getFB();
|
CFramebuffer* getFB();
|
||||||
|
void plantFence();
|
||||||
|
void removeFence();
|
||||||
|
|
||||||
wlr_buffer* m_pWlrBuffer = nullptr;
|
wlr_buffer* m_pWlrBuffer = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -2676,6 +2676,7 @@ void CHyprRenderer::endRender() {
|
||||||
glFlush();
|
glFlush();
|
||||||
|
|
||||||
if (m_eRenderMode == RENDER_MODE_NORMAL) {
|
if (m_eRenderMode == RENDER_MODE_NORMAL) {
|
||||||
|
m_pCurrentRenderbuffer->plantFence();
|
||||||
wlr_output_state_set_buffer(PMONITOR->state.wlr(), m_pCurrentWlrBuffer);
|
wlr_output_state_set_buffer(PMONITOR->state.wlr(), m_pCurrentWlrBuffer);
|
||||||
unsetEGL(); // flush the context
|
unsetEGL(); // flush the context
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue