aboutsummaryrefslogtreecommitdiff
path: root/render/wlr_renderer.c
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-04-20 23:58:30 +0100
committeremersion <contact@emersion.fr>2018-04-20 23:58:30 +0100
commit70d820be252ed530dd456b0d4c3fc84a3377f8c8 (patch)
tree47b9c0d6e3f9699bb56a94a7790159ab74b17298 /render/wlr_renderer.c
parentc18afd6731270cf3243586989416bc2168d7588f (diff)
Add wlr_renderer_init_wl_shm to advertize supported renderer formats
Diffstat (limited to 'render/wlr_renderer.c')
-rw-r--r--render/wlr_renderer.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index 80649b8c..a41ae388 100644
--- a/render/wlr_renderer.c
+++ b/render/wlr_renderer.c
@@ -4,6 +4,7 @@
#include <wlr/render/interface.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_matrix.h>
+#include <wlr/util/log.h>
void wlr_renderer_init(struct wlr_renderer *renderer,
const struct wlr_renderer_impl *impl) {
@@ -151,3 +152,22 @@ bool wlr_renderer_format_supported(struct wlr_renderer *r,
enum wl_shm_format fmt) {
return r->impl->format_supported(r, fmt);
}
+
+void wlr_renderer_init_wl_shm(struct wlr_renderer *r,
+ struct wl_display *display) {
+ if (wl_display_init_shm(display)) {
+ wlr_log(L_ERROR, "Failed to initialize shm");
+ return;
+ }
+
+ size_t len;
+ const enum wl_shm_format *formats = wlr_renderer_get_formats(r, &len);
+ if (formats == NULL) {
+ wlr_log(L_ERROR, "Failed to initialize shm: cannot get formats");
+ return;
+ }
+
+ for (size_t i = 0; i < len; ++i) {
+ wl_display_add_shm_format(display, formats[i]);
+ }
+}