linux-dmabuf-v1: ignore scanout output for secondary DRM backends

We don't support direct scanout on such backends yet.
This commit is contained in:
Simon Ser 2023-12-11 17:48:16 +01:00 committed by Simon Zeni
parent fc7a0b93dd
commit 3475b1880f
1 changed files with 16 additions and 1 deletions

View File

@ -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");