From d6f0fc251e675d85e1d8e6f23165b0ba0b503b83 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Sat, 19 Dec 2020 16:33:52 +0100 Subject: [PATCH] backend/drm: implement get_primary_formats --- backend/drm/drm.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/backend/drm/drm.c b/backend/drm/drm.c index be3c3289..e6e45455 100644 --- a/backend/drm/drm.c +++ b/backend/drm/drm.c @@ -1004,6 +1004,21 @@ static void drm_connector_get_cursor_size(struct wlr_output *output, *height = (int)drm->cursor_height; } +static const struct wlr_drm_format_set *drm_connector_get_primary_formats( + struct wlr_output *output, uint32_t buffer_caps) { + if (!(buffer_caps & WLR_BUFFER_CAP_DMABUF)) { + return NULL; + } + struct wlr_drm_connector *conn = get_drm_connector_from_output(output); + if (!conn->crtc) { + return NULL; + } + if (conn->backend->parent) { + return &conn->backend->mgpu_formats; + } + return &conn->crtc->primary->formats; +} + static const struct wlr_output_impl output_impl = { .set_cursor = drm_connector_set_cursor, .move_cursor = drm_connector_move_cursor, @@ -1015,6 +1030,7 @@ static const struct wlr_output_impl output_impl = { .get_gamma_size = drm_connector_get_gamma_size, .get_cursor_formats = drm_connector_get_cursor_formats, .get_cursor_size = drm_connector_get_cursor_size, + .get_primary_formats = drm_connector_get_primary_formats, }; bool wlr_output_is_drm(struct wlr_output *output) {