-
Notifications
You must be signed in to change notification settings - Fork 341
Conversation
62023ab
to
f6e6029
Compare
The intent with the current API was to allow compositors to create |
See #775 An alternative would be to add a |
f6e6029
to
197e5b5
Compare
Pushed a new version which moves the destruction function to |
This is still GLES2 specific, as the renderer passed to the texture creation functions take a |
Yes, since there is no other renderer. But the listener is now registered for all |
I am not using any of the functions which are touched here, so I am not against this change. Renderers are supposed to be redesigned sometime in the future anyway IIRC. |
Maybe we should just hide these functions from the public API for now. |
Should this be done in this PR? Is there anything else blocking this PR? |
Yeah, since this PR contains breaking changes, can we make these functions private? |
197e5b5
to
d656a7c
Compare
Done, I also cleaned up some |
Are |
7a155c7
to
5c82e0d
Compare
Not sure how to verify this short of verifying all callers, I have been running this PR on top of master with address sanitizer and tested output hotplug so far. |
Grepping for
|
Looks straightforward.
Hm, how do I handle the reference counting? Just ignore, send a release for the buffer and subsequently destroy? |
We shouldn't release the buffer. We could set |
Add a destroy listener for textures, which destroys the textures of a renderer upon renderer destruction. Fixes swaywm#1949
Remove unnecessary imports and if necessary replace with the correct ones.
Remove the prefix, move the functions and remove the wrappers inside the renderer.
In case the renderer is destroyed, it will implicitly destroy the textures. Set buffer->texture to NULL to prevent use after free and guard against a NULL texture in wlr_client_buffer_apply_damage.
Listen for a renderer destory event and remove the reference to the to be destroyed texture from the cursor.
5c82e0d
to
c3773c0
Compare
This should be ready for review. |
@@ -18,6 +18,8 @@ struct wlr_texture_impl; | |||
|
|||
struct wlr_texture { | |||
const struct wlr_texture_impl *impl; | |||
|
|||
struct wl_listener renderer_destroy; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This listener may run before or after other renderer destroy listeners (listener call order is undefined). This can cause a use-after-free if the texture listener is called first, then the buffer/output listener is called.
We should probably add a destroy
signal to wlr_texture
to prevent this.
These functions are unused by compositors (see e.g. [1]) and prevent wlr_gles2_texture from accessing wlr_gles2_renderer state. This is an issue for proper teardown [2] and for accessing GLES2 extensions. [1]: swaywm#1962 (comment) [2]: swaywm#1962
These functions are unused by compositors (see e.g. [1]) and prevent wlr_gles2_texture from accessing wlr_gles2_renderer state. This is an issue for proper teardown [2] and for accessing GLES2 extensions. [1]: #1962 (comment) [2]: #1962
Will be superseded by usage of |
Hm, I don't think so. |
Yep, but I remember the last place where this was lacking to be the cursor code having no nice place to hook into. And with your reworks in flight currently (and this PR not having been rebased in a while), I'll see how things turn out in master. I intend to pick this up again, but it will be a while, so closing this for now. |
I see! No problem, thanks for working on this :) |
Add a destroy listener for textures, which destroys the gles2 textures
when the renderer is destroyed.
Fixes #1949
I am not entirely sure about the API changes, since the
wlr_renderer
is now passed directly to the texture creation functions. I am all ears for possible improvements.