render/gles2: implement texture_from_buffer

Make it so wlr_gles2_texture is ref'counted (via wlr_buffer). This
is similar to wlr_gles2_buffer or wlr_drm_fb work.

When creating a wlr_texture from a wlr_buffer, first check if we
already have a texture for the buffer. If so, increase the
wlr_buffer ref'count and make sure any changes made by an external
process are made visible (by invalidating the texture).

When destroying a wlr_texture created from a wlr_buffer, decrease
the ref'count, but keep the wlr_texture around in case the caller
uses it again. When the wlr_buffer is destroyed, cleanup the
wlr_texture.
This commit is contained in:
Simon Ser 2021-04-12 11:58:31 +02:00
parent 9d55f712e3
commit f6ba26ff58
3 changed files with 91 additions and 3 deletions

View file

@ -593,6 +593,7 @@ static const struct wlr_renderer_impl renderer_impl = {
.init_wl_display = gles2_init_wl_display,
.get_drm_fd = gles2_get_drm_fd,
.get_render_buffer_caps = gles2_get_render_buffer_caps,
.texture_from_buffer = gles2_texture_from_buffer,
};
void push_gles2_debug_(struct wlr_gles2_renderer *renderer,