aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-07-28 16:56:18 +0200
committerSimon Ser <contact@emersion.fr>2020-11-15 22:48:42 +0100
commitc88c54fb385a9fe29f79db2ece3e8ebba0edd0a3 (patch)
tree69cf413b94914f4c8d19f4843411471f0be7ad69
parent0b40d09a21eb79896a7e60509a7ff8c69b25b37c (diff)
render: introduce wlr_renderer_bind_buffer
-rw-r--r--include/render/wlr_renderer.h8
-rw-r--r--include/wlr/render/interface.h2
-rw-r--r--include/wlr/render/wlr_renderer.h1
-rw-r--r--render/wlr_renderer.c10
4 files changed, 21 insertions, 0 deletions
diff --git a/include/render/wlr_renderer.h b/include/render/wlr_renderer.h
new file mode 100644
index 00000000..0ef1ef82
--- /dev/null
+++ b/include/render/wlr_renderer.h
@@ -0,0 +1,8 @@
+#ifndef RENDER_WLR_RENDERER_H
+#define RENDER_WLR_RENDERER_H
+
+#include <wlr/render/wlr_renderer.h>
+
+bool wlr_renderer_bind_buffer(struct wlr_renderer *r, struct wlr_buffer *buffer);
+
+#endif
diff --git a/include/wlr/render/interface.h b/include/wlr/render/interface.h
index 998b1cfa..1b57c660 100644
--- a/include/wlr/render/interface.h
+++ b/include/wlr/render/interface.h
@@ -30,6 +30,8 @@
#include <wlr/render/dmabuf.h>
struct wlr_renderer_impl {
+ bool (*bind_buffer)(struct wlr_renderer *renderer,
+ struct wlr_buffer *buffer);
void (*begin)(struct wlr_renderer *renderer, uint32_t width,
uint32_t height);
void (*end)(struct wlr_renderer *renderer);
diff --git a/include/wlr/render/wlr_renderer.h b/include/wlr/render/wlr_renderer.h
index 363a12e4..8908d3ce 100644
--- a/include/wlr/render/wlr_renderer.h
+++ b/include/wlr/render/wlr_renderer.h
@@ -21,6 +21,7 @@ enum wlr_renderer_read_pixels_flags {
struct wlr_renderer_impl;
struct wlr_drm_format_set;
+struct wlr_buffer;
struct wlr_renderer {
const struct wlr_renderer_impl *impl;
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index bdcc836f..311747f1 100644
--- a/render/wlr_renderer.c
+++ b/render/wlr_renderer.c
@@ -7,6 +7,7 @@
#include <wlr/types/wlr_matrix.h>
#include <wlr/util/log.h>
#include "util/signal.h"
+#include "render/wlr_renderer.h"
void wlr_renderer_init(struct wlr_renderer *renderer,
const struct wlr_renderer_impl *impl) {
@@ -37,6 +38,15 @@ void wlr_renderer_destroy(struct wlr_renderer *r) {
}
}
+bool wlr_renderer_bind_buffer(struct wlr_renderer *r,
+ struct wlr_buffer *buffer) {
+ assert(!r->rendering);
+ if (!r->impl->bind_buffer) {
+ return false;
+ }
+ return r->impl->bind_buffer(r, buffer);
+}
+
void wlr_renderer_begin(struct wlr_renderer *r, uint32_t width, uint32_t height) {
assert(!r->rendering);