Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Commit

Permalink
backend: don't create renderer if none is available
Browse files Browse the repository at this point in the history
  • Loading branch information
bl4ckb0ne committed Sep 13, 2021
1 parent 56ef360 commit c00d542
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
26 changes: 0 additions & 26 deletions backend/backend.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ void wlr_backend_init(struct wlr_backend *backend,
void wlr_backend_finish(struct wlr_backend *backend) {
wlr_signal_emit_safe(&backend->events.destroy, backend);
wlr_allocator_destroy(backend->allocator);
if (backend->has_own_renderer) {
wlr_renderer_destroy(backend->renderer);
}
}

bool wlr_backend_start(struct wlr_backend *backend) {
Expand All @@ -71,33 +68,10 @@ void wlr_backend_destroy(struct wlr_backend *backend) {
}
}

static bool backend_create_renderer(struct wlr_backend *backend) {
if (backend->renderer != NULL) {
return true;
}

backend->renderer = wlr_renderer_autocreate(backend);
if (backend->renderer == NULL) {
return false;
}

backend->has_own_renderer = true;
return true;
}

struct wlr_renderer *wlr_backend_get_renderer(struct wlr_backend *backend) {
if (backend->impl->get_renderer) {
return backend->impl->get_renderer(backend);
}
if (backend_get_buffer_caps(backend) != 0) {
// If the backend is capable of presenting buffers, automatically create
// the renderer if necessary.
if (!backend_create_renderer(backend)) {
wlr_log(WLR_ERROR, "Failed to create backend renderer");
return NULL;
}
return backend->renderer;
}
return NULL;
}

Expand Down
2 changes: 0 additions & 2 deletions include/wlr/backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ struct wlr_backend {

// Private state

bool has_own_renderer;
struct wlr_renderer *renderer;
struct wlr_allocator *allocator;
};

Expand Down

0 comments on commit c00d542

Please sign in to comment.