multi-backend: do not expose internal renderers

backend_get_renderer() is now returning the renderer of the primary GPU, instead
of its own renderer, since that's the thing which actually does all of the "real"
rendering

wlr_multi_backend_add() is now adding all subbackends (otherwise only one GPU
is handled).

credits: @ascent12
This commit is contained in:
Mariusz Bialonczyk 2018-08-02 13:37:23 +02:00
parent eb9c9d8852
commit 15dacebc36
2 changed files with 7 additions and 2 deletions

View file

@ -51,8 +51,13 @@ static void backend_destroy(struct wlr_backend *backend) {
static struct wlr_renderer *backend_get_renderer( static struct wlr_renderer *backend_get_renderer(
struct wlr_backend *backend) { struct wlr_backend *backend) {
struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend; struct wlr_drm_backend *drm = (struct wlr_drm_backend *)backend;
if (drm->parent) {
return drm->parent->renderer.wlr_rend;
} else {
return drm->renderer.wlr_rend; return drm->renderer.wlr_rend;
} }
}
static struct wlr_backend_impl backend_impl = { static struct wlr_backend_impl backend_impl = {
.start = backend_start, .start = backend_start,

View file

@ -143,7 +143,7 @@ bool wlr_multi_backend_add(struct wlr_backend *_multi,
struct wlr_renderer *multi_renderer = struct wlr_renderer *multi_renderer =
multi_backend_get_renderer(&multi->backend); multi_backend_get_renderer(&multi->backend);
struct wlr_renderer *backend_renderer = wlr_backend_get_renderer(backend); struct wlr_renderer *backend_renderer = wlr_backend_get_renderer(backend);
if (multi_renderer != NULL && backend_renderer != NULL) { if (multi_renderer != NULL && backend_renderer != NULL && multi_renderer != backend_renderer) {
wlr_log(WLR_ERROR, "Could not add backend: multiple renderers at the " wlr_log(WLR_ERROR, "Could not add backend: multiple renderers at the "
"same time aren't supported"); "same time aren't supported");
return false; return false;