aboutsummaryrefslogtreecommitdiff
path: root/include
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
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')
-rw-r--r--include/wlr/render/interface.h6
-rw-r--r--include/wlr/render/wlr_texture.h17
-rw-r--r--include/wlr/types/wlr_buffer.h3
3 files changed, 13 insertions, 13 deletions
diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h
index 7e923353..20d755f9 100644
--- a/include/wlr/render/interface.h
+++ b/include/wlr/render/interface.h
@@ -54,10 +54,8 @@ void wlr_renderer_init(struct wlr_renderer *renderer,
const struct wlr_renderer_impl *impl);
struct wlr_texture_impl {
- bool (*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 (*update_from_buffer)(struct wlr_texture *texture,
+ struct wlr_buffer *buffer, pixman_region32_t *damage);
void (*destroy)(struct wlr_texture *texture);
};
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.
diff --git a/include/wlr/types/wlr_buffer.h b/include/wlr/types/wlr_buffer.h
index 17b93e5c..b24c0ccd 100644
--- a/include/wlr/types/wlr_buffer.h
+++ b/include/wlr/types/wlr_buffer.h
@@ -151,9 +151,6 @@ struct wlr_client_buffer {
// private state
struct wl_listener source_destroy;
-
- // If the client buffer has been created from a wl_shm buffer
- uint32_t shm_source_format;
};
/**