aboutsummaryrefslogtreecommitdiff
path: root/backend/drm/backend.c
diff options
context:
space:
mode:
Diffstat (limited to 'backend/drm/backend.c')
-rw-r--r--backend/drm/backend.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/backend/drm/backend.c b/backend/drm/backend.c
index 2caf76bd..c7a72a35 100644
--- a/backend/drm/backend.c
+++ b/backend/drm/backend.c
@@ -1,5 +1,6 @@
#include <assert.h>
#include <errno.h>
+#include <drm_fourcc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -238,6 +239,35 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
goto error_event;
}
+ if (drm->parent) {
+ // 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;
+ const struct wlr_drm_format_set *texture_formats =
+ wlr_renderer_get_dmabuf_texture_formats(renderer);
+ if (texture_formats == NULL) {
+ wlr_log(WLR_ERROR, "Failed to query renderer texture formats");
+ goto error_event;
+ }
+
+ for (size_t i = 0; i < texture_formats->len; i++) {
+ const struct wlr_drm_format *fmt = texture_formats->formats[i];
+ if (fmt->len == 0) {
+ // Modifiers aren't supported. The implicit modifier changes
+ // from a GPU to the other, so we can only accept linear
+ // buffers
+ wlr_drm_format_set_add(&drm->mgpu_formats, fmt->format,
+ DRM_FORMAT_MOD_LINEAR);
+ continue;
+ }
+
+ for (size_t j = 0; j < fmt->len; j++) {
+ wlr_drm_format_set_add(&drm->mgpu_formats, fmt->format,
+ fmt->modifiers[j]);
+ }
+ }
+ }
+
drm->session_destroy.notify = handle_session_destroy;
wl_signal_add(&session->events.destroy, &drm->session_destroy);