diff options
author | Simon Ser <contact@emersion.fr> | 2020-12-19 16:33:52 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-07-28 22:52:35 +0200 |
commit | d6f0fc251e675d85e1d8e6f23165b0ba0b503b83 (patch) | |
tree | edaf3ef88f49331120baf28e8e61b5c05143c222 | |
parent | d1c931cbe87ee18a46519f6f8c5cf8528e6b291d (diff) |
backend/drm: implement get_primary_formats
-rw-r--r-- | backend/drm/drm.c | 16 |
1 files changed, 16 insertions, 0 deletions
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) { |