diff options
author | Simon Ser <contact@emersion.fr> | 2021-07-07 17:09:17 +0200 |
---|---|---|
committer | Simon Zeni <simon@bl4ckb0ne.ca> | 2021-07-07 12:00:43 -0400 |
commit | c2bd63c1865358ec22e467dad70159dac0afbed9 (patch) | |
tree | ea4b737342b6254306818c665ab7d7420b8bfb5a /render/wlr_renderer.c | |
parent | 4c7657ee629874df1d33f850bfc33fd9af556888 (diff) |
output: detach buffer from renderer before commit
Right now we rely entirely on implicit sync for synchronizing
access to GPU buffers. Implicit sync works by setting
synchronization points on the buffer in writers, and letting
readers wait on these sync points before accessing the buffer.
With OpenGL, sync points are created using functions such as
eglSwapBuffers or glFlush. If none of these special functions
are called, no sync point will be created and readers will
potentially access a buffer that hasn't finished rendering yet.
In the context of wlroots, OpenGL is the writer and the backend
(KMS or parent Wayland/X11 session) is the reader. After we're
done rendering a frame, and before passing that frame to the
backend, we need to call glFlush.
glFlush is called when the buffer is detached from the renderer.
This is a task done by output_clear_back_buffer. So let's call
this function before invoking the impl->commit hook, instead of
calling it after.
All of this is maybe a little tricky to get right with the
current renderer_bind_buffer API. The new
wlr_renderer_begin_with_buffer API is much better, because glFlush
is called on wlr_renderer_end, so it's more intuitive.
Closes: https://github.com/swaywm/wlroots/issues/3020
Diffstat (limited to 'render/wlr_renderer.c')
0 files changed, 0 insertions, 0 deletions