render/gbm_allocator: make wlr_gbm_allocator_create return a wlr_allocator

This commit is contained in:
Simon Zeni 2021-04-15 14:32:13 -04:00 committed by Simon Ser
parent 3a04fb4560
commit c75aa71816
7 changed files with 24 additions and 21 deletions

View file

@ -220,21 +220,21 @@ struct wlr_backend *wlr_headless_backend_create(struct wl_display *display) {
goto error_dup;
}
struct wlr_gbm_allocator *gbm_alloc = wlr_gbm_allocator_create(drm_fd);
if (gbm_alloc == NULL) {
struct wlr_allocator *alloc = wlr_gbm_allocator_create(drm_fd);
if (alloc == NULL) {
wlr_log(WLR_ERROR, "Failed to create GBM allocator");
close(drm_fd);
goto error_dup;
}
if (!backend_init(backend, display, &gbm_alloc->base, NULL)) {
if (!backend_init(backend, display, alloc, NULL)) {
goto error_init;
}
return &backend->backend;
error_init:
wlr_allocator_destroy(&gbm_alloc->base);
wlr_allocator_destroy(alloc);
error_dup:
close(backend->drm_fd);
error_drm_fd:
@ -266,14 +266,14 @@ struct wlr_backend *wlr_headless_backend_create_with_renderer(
goto error_dup;
}
struct wlr_gbm_allocator *gbm_alloc = wlr_gbm_allocator_create(drm_fd);
if (gbm_alloc == NULL) {
struct wlr_allocator *alloc = wlr_gbm_allocator_create(drm_fd);
if (alloc == NULL) {
wlr_log(WLR_ERROR, "Failed to create GBM allocator");
close(drm_fd);
goto error_dup;
}
if (!backend_init(backend, display, &gbm_alloc->base, renderer)) {
if (!backend_init(backend, display, alloc, renderer)) {
goto error_init;
}
@ -283,7 +283,7 @@ struct wlr_backend *wlr_headless_backend_create_with_renderer(
return &backend->backend;
error_init:
wlr_allocator_destroy(&gbm_alloc->base);
wlr_allocator_destroy(alloc);
error_dup:
close(backend->drm_fd);
error_drm_fd: