mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-12-15 08:56:26 -05:00
render/shm_allocator: make wlr_shm_allocator_create return a wlr_allocator
This commit is contained in:
parent
c75aa71816
commit
a8c91fbac9
4 changed files with 12 additions and 15 deletions
|
|
@ -452,21 +452,19 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
|
|||
goto error_drm_fd;
|
||||
}
|
||||
|
||||
struct wlr_allocator *alloc = wlr_gbm_allocator_create(drm_fd);
|
||||
if (alloc == NULL) {
|
||||
wl->allocator = wlr_gbm_allocator_create(drm_fd);
|
||||
if (wl->allocator == NULL) {
|
||||
wlr_log(WLR_ERROR, "Failed to create GBM allocator");
|
||||
close(drm_fd);
|
||||
goto error_drm_fd;
|
||||
}
|
||||
wl->allocator = alloc;
|
||||
} else {
|
||||
wlr_log(WLR_DEBUG, "No render node found, falling back to shared memory");
|
||||
struct wlr_shm_allocator *shm_alloc = wlr_shm_allocator_create();
|
||||
if (shm_alloc == NULL) {
|
||||
wl->allocator = wlr_shm_allocator_create();
|
||||
if (wl->allocator == NULL) {
|
||||
wlr_log(WLR_ERROR, "Failed to create shared memory allocator");
|
||||
goto error_remote_display_src;
|
||||
}
|
||||
wl->allocator = &shm_alloc->base;
|
||||
}
|
||||
|
||||
wl->renderer = wlr_renderer_autocreate(&wl->backend);
|
||||
|
|
|
|||
|
|
@ -622,22 +622,20 @@ struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
|
|||
goto error_event;
|
||||
}
|
||||
|
||||
struct wlr_allocator *alloc = wlr_gbm_allocator_create(drm_fd);
|
||||
if (alloc == NULL) {
|
||||
x11->allocator = wlr_gbm_allocator_create(drm_fd);
|
||||
if (x11->allocator == NULL) {
|
||||
wlr_log(WLR_ERROR, "Failed to create GBM allocator");
|
||||
close(drm_fd);
|
||||
goto error_event;
|
||||
}
|
||||
x11->allocator = alloc;
|
||||
pixmap_formats = &x11->dri3_formats;
|
||||
} else if (x11->have_shm) {
|
||||
x11->drm_fd = -1;
|
||||
struct wlr_shm_allocator *shm_alloc = wlr_shm_allocator_create();
|
||||
if (shm_alloc == NULL) {
|
||||
x11->allocator = wlr_shm_allocator_create();
|
||||
if (x11->allocator == NULL) {
|
||||
wlr_log(WLR_ERROR, "Failed to create shared memory allocator");
|
||||
goto error_event;
|
||||
}
|
||||
x11->allocator = &shm_alloc->base;
|
||||
pixmap_formats = &x11->shm_formats;
|
||||
} else {
|
||||
wlr_log(WLR_ERROR,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue