backend/drm: implement get_primary_formats

This commit is contained in:
Simon Ser 2020-12-19 16:33:52 +01:00
parent d1c931cbe8
commit d6f0fc251e
1 changed files with 16 additions and 0 deletions

View File

@ -1004,6 +1004,21 @@ static void drm_connector_get_cursor_size(struct wlr_output *output,
*height = (int)drm->cursor_height; *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 = { static const struct wlr_output_impl output_impl = {
.set_cursor = drm_connector_set_cursor, .set_cursor = drm_connector_set_cursor,
.move_cursor = drm_connector_move_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_gamma_size = drm_connector_get_gamma_size,
.get_cursor_formats = drm_connector_get_cursor_formats, .get_cursor_formats = drm_connector_get_cursor_formats,
.get_cursor_size = drm_connector_get_cursor_size, .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) { bool wlr_output_is_drm(struct wlr_output *output) {