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.c30
1 files changed, 26 insertions, 4 deletions
diff --git a/render/wlr_renderer.c b/render/wlr_renderer.c
index 8d1bd9ce..aed821c9 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/render/gles2.h>
#include <wlr/util/log.h>
#include "util/signal.h"
@@ -158,9 +159,9 @@ bool wlr_renderer_format_supported(struct wlr_renderer *r,
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)) {
+void wlr_renderer_init_wl_display(struct wlr_renderer *r,
+ struct wl_display *wl_display) {
+ if (wl_display_init_shm(wl_display)) {
wlr_log(L_ERROR, "Failed to initialize shm");
return;
}
@@ -173,9 +174,30 @@ void wlr_renderer_init_wl_shm(struct wlr_renderer *r,
}
for (size_t i = 0; i < len; ++i) {
+ // These formats are already added by default
if (formats[i] != WL_SHM_FORMAT_ARGB8888 &&
formats[i] != WL_SHM_FORMAT_XRGB8888) {
- wl_display_add_shm_format(display, formats[i]);
+ wl_display_add_shm_format(wl_display, formats[i]);
}
}
+
+ if (r->impl->init_wl_display) {
+ r->impl->init_wl_display(r, wl_display);
+ }
+}
+
+struct wlr_renderer *wlr_renderer_autocreate(struct wlr_egl *egl,
+ EGLenum platform, void *remote_display, EGLint *config_attribs, EGLint visual_id) {
+
+ if (!wlr_egl_init(egl, platform, remote_display, config_attribs, visual_id)) {
+ wlr_log(L_ERROR, "Could not initialize EGL");
+ return NULL;
+ }
+
+ struct wlr_renderer *renderer = wlr_gles2_renderer_create(egl);
+ if (!renderer) {
+ wlr_egl_finish(egl);
+ }
+
+ return renderer;
}