aboutsummaryrefslogtreecommitdiff
path: root/render/wlr_renderer.c
diff options
context:
space:
mode:
Diffstat (limited to 'render/wlr_renderer.c')
-rw-r--r--render/wlr_renderer.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index ff315913..2b5cf994 100644
--- a/render/wlr_renderer.c
+++ b/render/wlr_renderer.c
@@ -202,17 +202,18 @@ bool wlr_renderer_read_pixels(struct wlr_renderer *r, uint32_t fmt,
src_x, src_y, dst_x, dst_y, data);
}
-bool wlr_renderer_init_wl_display(struct wlr_renderer *r,
+bool wlr_renderer_init_wl_shm(struct wlr_renderer *r,
struct wl_display *wl_display) {
- if (wl_display_init_shm(wl_display)) {
- wlr_log(WLR_ERROR, "Failed to initialize shm");
+ if (wl_display_init_shm(wl_display) != 0) {
+ wlr_log(WLR_ERROR, "Failed to initialize wl_shm");
return false;
}
size_t len;
const uint32_t *formats = wlr_renderer_get_shm_texture_formats(r, &len);
if (formats == NULL) {
- wlr_log(WLR_ERROR, "Failed to initialize shm: cannot get formats");
+ wlr_log(WLR_ERROR, "Failed to initialize wl_shm: "
+ "cannot get renderer formats");
return false;
}
@@ -229,11 +230,24 @@ bool wlr_renderer_init_wl_display(struct wlr_renderer *r,
xrgb8888 = true;
break;
default:
- wl_display_add_shm_format(wl_display, fmt);
+ if (wl_display_add_shm_format(wl_display, fmt) == NULL) {
+ wlr_log(WLR_ERROR, "Failed to initialize wl_shm: "
+ "failed to add format");
+ return false;
+ }
}
}
assert(argb8888 && xrgb8888);
+ return true;
+}
+
+bool wlr_renderer_init_wl_display(struct wlr_renderer *r,
+ struct wl_display *wl_display) {
+ if (!wlr_renderer_init_wl_shm(r, wl_display)) {
+ return false;
+ }
+
if (wlr_renderer_get_dmabuf_texture_formats(r) != NULL) {
if (wlr_renderer_get_drm_fd(r) >= 0) {
if (wlr_drm_create(wl_display, r) == NULL) {