kwinglutils: Clean up persistent vbo fences at the start of the frame
With a persistent vbo, kwin will allocate one big enough buffer and allocate memory out of it. In order to prevent overwriting vertex buffer data that is currently being accessed by the GPU, fences are inserted at the end of frame. The signaled fences are destroyed after the buffer swap operation, which seems a bit odd because the just inserted fence most likely won't be signaled. Perhaps it's a historical artifact? This change rearranges fence cleanup so it's performed right before starting a new frame. With it, kwin will most likely re-use the previously used memory chunk because there will be plenty of time for the fence to become signaled. Another motivation behind this change is to make refactoring SceneOpenGL code easier. As is, m_backend->endFrame() is wrapped in GLVertexBuffer::endOfFrame() and GLVertexBuffer::framePosted(). With that, the Compositor can't call m_backend->endFrame(), which can be desired for cleaning up render backend abstractions.
This commit is contained in:
parent
eecf14394e
commit
7013c1473c
3 changed files with 4 additions and 4 deletions
|
@ -2097,7 +2097,7 @@ void GLVertexBuffer::endOfFrame()
|
|||
}
|
||||
}
|
||||
|
||||
void GLVertexBuffer::framePosted()
|
||||
void GLVertexBuffer::beginFrame()
|
||||
{
|
||||
if (!d->persistent)
|
||||
return;
|
||||
|
|
|
@ -747,11 +747,11 @@ public:
|
|||
void endOfFrame();
|
||||
|
||||
/**
|
||||
* Notifies the vertex buffer that we have posted the frame.
|
||||
* Notifies the vertex buffer that we are about to paint a frame.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
void framePosted();
|
||||
void beginFrame();
|
||||
|
||||
/**
|
||||
* @internal
|
||||
|
|
|
@ -306,6 +306,7 @@ void SceneOpenGL::paint(AbstractOutput *output, const QRegion &damage, const QLi
|
|||
} else {
|
||||
// prepare rendering makescontext current on the output
|
||||
repaint = m_backend->beginFrame(output);
|
||||
GLVertexBuffer::streamingBuffer()->beginFrame();
|
||||
|
||||
GLVertexBuffer::setVirtualScreenGeometry(geo);
|
||||
GLRenderTarget::setVirtualScreenGeometry(geo);
|
||||
|
@ -337,7 +338,6 @@ void SceneOpenGL::paint(AbstractOutput *output, const QRegion &damage, const QLi
|
|||
|
||||
GLVertexBuffer::streamingBuffer()->endOfFrame();
|
||||
m_backend->endFrame(output, valid, update);
|
||||
GLVertexBuffer::streamingBuffer()->framePosted();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue