aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-05-25 08:38:44 -0400
committerGitHub <noreply@github.com>2018-05-25 08:38:44 -0400
commit35b31dcfb7f54c08301c4eb352325bb852b1bece (patch)
tree93d550e437722bdeabca5605ada5c0b4d41128cf /backend/drm
parenta0eb37e2ea4ad96b4f6e98fddbc5c31d0bd0f293 (diff)
parent24cf70ae9691d605e4a1f7e9d8dc59ec72401bd0 (diff)
Merge pull request #1000 from ammen99/custom-renderer-initialization
[RFC] backends: implement custom EGL and renderer initialization
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/backend.c5
-rw-r--r--backend/drm/renderer.c17
2 files changed, 11 insertions, 11 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c
index c14b99e3..744a32d2 100644
--- a/backend/drm/backend.c
+++ b/backend/drm/backend.c
@@ -114,7 +114,8 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
}
struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
- struct wlr_session *session, int gpu_fd, struct wlr_backend *parent) {
+ struct wlr_session *session, int gpu_fd, struct wlr_backend *parent,
+ wlr_renderer_create_func_t create_renderer_func) {
assert(display && session && gpu_fd >= 0);
assert(!parent || wlr_backend_is_drm(parent));
@@ -161,7 +162,7 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
goto error_event;
}
- if (!init_drm_renderer(drm, &drm->renderer)) {
+ if (!init_drm_renderer(drm, &drm->renderer, create_renderer_func)) {
wlr_log(L_ERROR, "Failed to initialize renderer");
goto error_event;
}
diff --git a/backend/drm/renderer.c b/backend/drm/renderer.c
index 7e2b5174..d5bcef2b 100644
--- a/backend/drm/renderer.c
+++ b/backend/drm/renderer.c
@@ -19,29 +19,28 @@
#endif
bool init_drm_renderer(struct wlr_drm_backend *drm,
- struct wlr_drm_renderer *renderer) {
+ struct wlr_drm_renderer *renderer, wlr_renderer_create_func_t create_renderer_func) {
renderer->gbm = gbm_create_device(drm->fd);
if (!renderer->gbm) {
wlr_log(L_ERROR, "Failed to create GBM device");
return false;
}
- if (!wlr_egl_init(&renderer->egl, EGL_PLATFORM_GBM_MESA, renderer->gbm,
- NULL, GBM_FORMAT_ARGB8888)) {
- goto error_gbm;
+ if (!create_renderer_func) {
+ create_renderer_func = wlr_renderer_autocreate;
}
- renderer->wlr_rend = wlr_gles2_renderer_create(&renderer->egl);
+ renderer->wlr_rend = create_renderer_func(&renderer->egl,
+ EGL_PLATFORM_GBM_MESA, renderer->gbm, NULL, GBM_FORMAT_ARGB8888);
+
if (!renderer->wlr_rend) {
- wlr_log(L_ERROR, "Failed to create WLR renderer");
- goto error_egl;
+ wlr_log(L_ERROR, "Failed to create EGL/WLR renderer");
+ goto error_gbm;
}
renderer->fd = drm->fd;
return true;
-error_egl:
- wlr_egl_finish(&renderer->egl);
error_gbm:
gbm_device_destroy(renderer->gbm);
return false;