aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-12-11 17:48:16 +0100
committerSimon Zeni <simon@bl4ckb0ne.ca>2023-12-12 14:42:52 +0000
commit3475b1880f360203995f226e8a7a6a56d5ca1052 (patch)
tree0cec0082682424475677d03a25f972adc5239b00
parentfc7a0b93dd49cb8e585ea23b8eb3eda892536abb (diff)
linux-dmabuf-v1: ignore scanout output for secondary DRM backends
We don't support direct scanout on such backends yet.
-rw-r--r--types/wlr_linux_dmabuf_v1.c17
1 files changed, 16 insertions, 1 deletions
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 <sys/mman.h>
#include <unistd.h>
#include <wlr/backend.h>
+#include <wlr/config.h>
#include <wlr/interfaces/wlr_buffer.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h>
@@ -17,6 +18,10 @@
#include "render/drm_format_set.h"
#include "util/shm.h"
+#if WLR_HAS_DRM_BACKEND
+#include <wlr/backend/drm.h>
+#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");