aboutsummaryrefslogtreecommitdiff
path: root/include/wlr/render/wlr_texture.h
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2022-05-29 11:50:47 +0200
committerSimon Ser <contact@emersion.fr>2022-08-12 08:41:32 +0000
commit98cf38601fdf32fdd1d40ed4a92b1f31fb75d667 (patch)
treefdb35534a2dc7439349948ffb9048d67e33115e0 /include/wlr/render/wlr_texture.h
parent8c3c6987dbdffa74eb1fee901b4ab1d73641e29f (diff)
render: replace wlr_texture_write_pixels with update_from_buffer
This lets the renderer handle the wlr_buffer directly, just like it does in texture_from_buffer. This also allows the renderer to batch the rectangle updates, and update more than the damage region if desirable (e.g. too many rects), so can be more efficient.
Diffstat (limited to 'include/wlr/render/wlr_texture.h')
-rw-r--r--include/wlr/render/wlr_texture.h17
1 files changed, 11 insertions, 6 deletions
diff --git a/include/wlr/render/wlr_texture.h b/include/wlr/render/wlr_texture.h
index 0f39b8a8..5d4b0b61 100644
--- a/include/wlr/render/wlr_texture.h
+++ b/include/wlr/render/wlr_texture.h
@@ -9,6 +9,7 @@
#ifndef WLR_RENDER_WLR_TEXTURE_H
#define WLR_RENDER_WLR_TEXTURE_H
+#include <pixman.h>
#include <stdint.h>
#include <wayland-server-core.h>
#include <wlr/render/dmabuf.h>
@@ -37,13 +38,17 @@ struct wlr_texture *wlr_texture_from_dmabuf(struct wlr_renderer *renderer,
struct wlr_dmabuf_attributes *attribs);
/**
- * Update a texture with raw pixels. The texture must be mutable, and the input
- * data must have the same pixel format that the texture was created with.
+ * Update a texture with a struct wlr_buffer's contents.
+ *
+ * The update might be rejected (in case the texture is immutable, the buffer
+ * has an unsupported type/format, etc), so callers must be prepared to fall
+ * back to re-creating the texture from scratch via wlr_texture_from_buffer().
+ *
+ * The damage can be used by the renderer as an optimization: only the supplied
+ * region needs to be updated.
*/
-bool wlr_texture_write_pixels(struct wlr_texture *texture,
- uint32_t stride, uint32_t width, uint32_t height,
- uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,
- const void *data);
+bool wlr_texture_update_from_buffer(struct wlr_texture *texture,
+ struct wlr_buffer *buffer, pixman_region32_t *damage);
/**
* Destroys the texture.