From 3475b1880f360203995f226e8a7a6a56d5ca1052 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 11 Dec 2023 17:48:16 +0100 Subject: [PATCH] linux-dmabuf-v1: ignore scanout output for secondary DRM backends We don't support direct scanout on such backends yet. --- types/wlr_linux_dmabuf_v1.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/types/wlr_linux_dmabuf_v1.c b/types/wlr_linux_dmabuf_v1.c index d018d773..9560ace3 100644 --- a/types/wlr_linux_dmabuf_v1.c +++ b/types/wlr_linux_dmabuf_v1.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -17,6 +18,10 @@ #include "render/drm_format_set.h" #include "util/shm.h" +#if WLR_HAS_DRM_BACKEND +#include +#endif + #define LINUX_DMABUF_VERSION 4 struct wlr_linux_buffer_params_v1 { @@ -1054,6 +1059,15 @@ static bool devid_from_fd(int fd, dev_t *devid) { return true; } +static bool is_secondary_drm_backend(struct wlr_backend *backend) { +#if WLR_HAS_DRM_BACKEND + return wlr_backend_is_drm(backend) && + wlr_drm_backend_get_parent(backend) != NULL; +#else + return false; +#endif +} + bool wlr_linux_dmabuf_feedback_v1_init_with_options(struct wlr_linux_dmabuf_feedback_v1 *feedback, const struct wlr_linux_dmabuf_feedback_v1_init_options *options) { assert(options->main_renderer != NULL); @@ -1096,7 +1110,8 @@ bool wlr_linux_dmabuf_feedback_v1_init_with_options(struct wlr_linux_dmabuf_feed wlr_log(WLR_ERROR, "Failed to intersect renderer and scanout formats"); goto error; } - } else if (options->scanout_primary_output != NULL) { + } else if (options->scanout_primary_output != NULL && + !is_secondary_drm_backend(options->scanout_primary_output->backend)) { int backend_drm_fd = wlr_backend_get_drm_fd(options->scanout_primary_output->backend); if (backend_drm_fd < 0) { wlr_log(WLR_ERROR, "Failed to get backend DRM FD");