mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 17:05:58 +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);
|
||||
|
||||
RB->removeFence();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -82,11 +84,6 @@ CRenderbuffer::CRenderbuffer(wlr_buffer* buffer, uint32_t format, CMonitor* pMon
|
|||
},
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -110,4 +107,15 @@ void CRenderbuffer::unbind() {
|
|||
|
||||
CFramebuffer* CRenderbuffer::getFB() {
|
||||
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,15 +13,17 @@ class CRenderbuffer {
|
|||
void bindFB();
|
||||
void unbind();
|
||||
CFramebuffer* getFB();
|
||||
void plantFence();
|
||||
void removeFence();
|
||||
|
||||
wlr_buffer* m_pWlrBuffer = nullptr;
|
||||
|
||||
DYNLISTENER(destroyBuffer);
|
||||
|
||||
private:
|
||||
EGLImageKHR m_iImage = 0;
|
||||
GLuint m_iRBO = 0;
|
||||
CFramebuffer m_sFramebuffer;
|
||||
CMonitor* m_pMonitor = nullptr;
|
||||
EGLImageKHR m_iImage = 0;
|
||||
GLuint m_iRBO = 0;
|
||||
CFramebuffer m_sFramebuffer;
|
||||
CMonitor* m_pMonitor = nullptr;
|
||||
wl_event_source* m_pFDWrite = nullptr;
|
||||
};
|
|
@ -2676,6 +2676,7 @@ void CHyprRenderer::endRender() {
|
|||
glFlush();
|
||||
|
||||
if (m_eRenderMode == RENDER_MODE_NORMAL) {
|
||||
m_pCurrentRenderbuffer->plantFence();
|
||||
wlr_output_state_set_buffer(PMONITOR->state.wlr(), m_pCurrentWlrBuffer);
|
||||
unsetEGL(); // flush the context
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue