aboutsummaryrefslogtreecommitdiff
path: root/backend/drm
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2021-07-12 17:23:25 +0200
committerSimon Ser <contact@emersion.fr>2021-07-28 22:52:35 +0200
commitc74dc45bb68c43a14d638b4c2b71e84ea4f94951 (patch)
tree343238bacdbe26c0470add634fbcfb2f6db4ab8a /backend/drm
parent9b99570869e41158b2cd5681b6403a74312fcc69 (diff)
backend/drm: drop get_renderer implementation
We can now just rely on the common code for this.
Diffstat (limited to 'backend/drm')
-rw-r--r--backend/drm/backend.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c
index 39b9d221..cee3cfa5 100644
--- a/backend/drm/backend.c
+++ b/backend/drm/backend.c
@@ -11,6 +11,7 @@
#include <wlr/interfaces/wlr_output.h>
#include <wlr/util/log.h>
#include <xf86drm.h>
+#include "backend/backend.h"
#include "backend/drm/drm.h"
#include "util/signal.h"
@@ -61,17 +62,6 @@ static void backend_destroy(struct wlr_backend *backend) {
free(drm);
}
-static struct wlr_renderer *backend_get_renderer(
- struct wlr_backend *backend) {
- struct wlr_drm_backend *drm = get_drm_backend_from_backend(backend);
-
- if (drm->parent) {
- return drm->parent->renderer.wlr_rend;
- } else {
- return drm->renderer.wlr_rend;
- }
-}
-
static clockid_t backend_get_presentation_clock(struct wlr_backend *backend) {
struct wlr_drm_backend *drm = get_drm_backend_from_backend(backend);
return drm->clock;
@@ -87,17 +77,16 @@ static int backend_get_drm_fd(struct wlr_backend *backend) {
}
}
-static uint32_t backend_get_buffer_caps(struct wlr_backend *backend) {
+static uint32_t drm_backend_get_buffer_caps(struct wlr_backend *backend) {
return WLR_BUFFER_CAP_DMABUF;
}
static const struct wlr_backend_impl backend_impl = {
.start = backend_start,
.destroy = backend_destroy,
- .get_renderer = backend_get_renderer,
.get_presentation_clock = backend_get_presentation_clock,
.get_drm_fd = backend_get_drm_fd,
- .get_buffer_caps = backend_get_buffer_caps,
+ .get_buffer_caps = drm_backend_get_buffer_caps,
};
bool wlr_backend_is_drm(struct wlr_backend *b) {
@@ -236,6 +225,10 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
}
if (drm->parent) {
+ // Ensure we use the same renderer as the parent backend
+ drm->backend.renderer = wlr_backend_get_renderer(&drm->parent->backend);
+ assert(drm->backend.renderer != NULL);
+
// We'll perform a multi-GPU copy for all submitted buffers, we need
// to be able to texture from them
struct wlr_renderer *renderer = drm->renderer.wlr_rend;
@@ -258,6 +251,12 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
}
}
+ struct wlr_renderer *renderer = wlr_backend_get_renderer(&drm->backend);
+ struct wlr_allocator *allocator = backend_get_allocator(&drm->backend);
+ if (renderer == NULL || allocator == NULL) {
+ goto error_event;
+ }
+
drm->session_destroy.notify = handle_session_destroy;
wl_signal_add(&session->events.destroy, &drm->session_destroy);