aboutsummaryrefslogtreecommitdiff
path: root/include/render
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-04-12 11:58:31 +0200
committerSimon Ser <contact@emersion.fr>2021-05-17 16:22:43 +0200
commitf6ba26ff583fc0ea3e615521ddc26110e48a5d40 (patch)
tree15f32722f04d1e6a85ad59c4d363664e56866e99 /include/render
parent9d55f712e3880927bcbc39bf4da7f4166ea94a91 (diff)
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.
Diffstat (limited to 'include/render')
-rw-r--r--include/render/gles2.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/render/gles2.h b/include/render/gles2.h
index 450235f0..39ec1da0 100644
--- a/include/render/gles2.h
+++ b/include/render/gles2.h
@@ -103,6 +103,10 @@ struct wlr_gles2_texture {
// Only affects target == GL_TEXTURE_2D
uint32_t drm_format; // used to interpret upload data
+ // If imported from a wlr_buffer
+ struct wlr_buffer *buffer;
+
+ struct wl_listener buffer_destroy;
};
const struct wlr_gles2_pixel_format *get_gles2_format_from_drm(uint32_t fmt);
@@ -122,6 +126,8 @@ struct wlr_texture *gles2_texture_from_wl_drm(struct wlr_renderer *wlr_renderer,
struct wl_resource *data);
struct wlr_texture *gles2_texture_from_dmabuf(struct wlr_renderer *wlr_renderer,
struct wlr_dmabuf_attributes *attribs);
+struct wlr_texture *gles2_texture_from_buffer(struct wlr_renderer *wlr_renderer,
+ struct wlr_buffer *buffer);
void push_gles2_debug_(struct wlr_gles2_renderer *renderer,
const char *file, const char *func);