-
Notifications
You must be signed in to change notification settings - Fork 341
backend/headless: use FBOs instead of pbuffers #2063
Conversation
Shouldn't wlroots also offer a way to get the FB to render to? For example, Wayfire also switches between various FBs when rendering. Until now, I have always tried to reset to FB 0 to render the the output, which seems to not be the case anymore. |
Oh and by the way, doesn't this make the headless backend dependent on a GLES renderer? From my understanding, this wasn't the case before, but I am not very familiar with EGL. |
If you switch between FBs, you should save the previous value with
Yes, that's true. Could be fixed by using |
My understanding was that we want to make it possible to write a pixman-based renderer or something :P (note I do not care about this case, just pointing it out since somebody does) |
Yeah, I care about this, but I don't think it's related. Currently the headless backend depends on EGL, so this PR doesn't change a lot. With renderer v6 the compositor will manage swapchains directly (or indirectly via helpers) so the backend won't even care. (My |
CPU load in sway due to |
Can you try |
Yes, using RGBA8_OES performs much better. GL_RGBA4 actually performs much worse. |
Most of the pending output state is not forwarded to the backend prior to an output commit. For instance, wlr_output_set_mode just stashes the mode without calling any wlr_output_impl function. wlr_output_impl.commit is responsible for applying the pending mode. However, there are exceptions to this rule. The first one is wlr_output_attach_render. It won't go away before renderer v6 is complete, because it needs to set the current EGL surface. The second one is wlr_output_attach_buffer. wlr_output_impl.attach_buffer is removed in [1]. When wlr_output_rollback is called, all pending state is supposed to be cleared. This works for all the state except the two exceptions mentionned above. To fix this, introduce wlr_output_impl.rollback. Right now, the backend resets the current EGL surface. This prevents GL commands from affecting the output after wlr_output_rollback. This patch is required for FBO-based outputs to work properly. The compositor might be using FBOs for its own purposes [2], having leftover FBO state can have bad consequences. [1]: swaywm#2097 [2]: swaywm#2063 (comment)
This is now ready for review.
|
Most of the pending output state is not forwarded to the backend prior to an output commit. For instance, wlr_output_set_mode just stashes the mode without calling any wlr_output_impl function. wlr_output_impl.commit is responsible for applying the pending mode. However, there are exceptions to this rule. The first one is wlr_output_attach_render. It won't go away before renderer v6 is complete, because it needs to set the current EGL surface. The second one is wlr_output_attach_buffer. wlr_output_impl.attach_buffer is removed in [1]. When wlr_output_rollback is called, all pending state is supposed to be cleared. This works for all the state except the two exceptions mentionned above. To fix this, introduce wlr_output_impl.rollback. Right now, the backend resets the current EGL surface. This prevents GL commands from affecting the output after wlr_output_rollback. This patch is required for FBO-based outputs to work properly. The compositor might be using FBOs for its own purposes [2], having leftover FBO state can have bad consequences. [1]: swaywm#2097 [2]: swaywm#2063 (comment)
Most of the pending output state is not forwarded to the backend prior to an output commit. For instance, wlr_output_set_mode just stashes the mode without calling any wlr_output_impl function. wlr_output_impl.commit is responsible for applying the pending mode. However, there are exceptions to this rule. The first one is wlr_output_attach_render. It won't go away before renderer v6 is complete, because it needs to set the current EGL surface. The second one is wlr_output_attach_buffer. wlr_output_impl.attach_buffer is removed in [1]. When wlr_output_rollback is called, all pending state is supposed to be cleared. This works for all the state except the two exceptions mentionned above. To fix this, introduce wlr_output_impl.rollback. Right now, the backend resets the current EGL surface. This prevents GL commands from affecting the output after wlr_output_rollback. This patch is required for FBO-based outputs to work properly. The compositor might be using FBOs for its own purposes [2], having leftover FBO state can have bad consequences. [1]: #2097 [2]: #2063 (comment)
I tested this. It works well and there are no obvious regressions. |
Rebased and added a fallback for the internal format. |
The fallback is perhaps not terribly important, but might I suggest RGB565 instead? |
Overall, this LGTM |
f61db96
to
6ada106
Compare
Comments addressed. |
This allows one to create a headless backend with an existing renderer.
Thanks! |
Allows the headless backend to use another backend's renderer.