backend/drm: don't retry page-flip when modifiers are unsupported

Parse WLR_DRM_NO_MODIFIERS at startup. Don't parse IN_FORMATS when
WLR_DRM_NO_MODIFIERS is set, so that the legacy behaviour is better
reproduced.

When modifiers aren't supported, try the initial page-flip once only.
This commit is contained in:
Simon Ser 2020-12-23 19:49:27 +01:00
parent 54ec17ff64
commit 64a2ca4dba
No known key found for this signature in database
GPG Key ID: 0FDE7BE0E88F5E48
1 changed files with 9 additions and 11 deletions

View File

@ -75,8 +75,13 @@ bool check_drm_features(struct wlr_drm_backend *drm) {
int ret = drmGetCap(drm->fd, DRM_CAP_TIMESTAMP_MONOTONIC, &cap); int ret = drmGetCap(drm->fd, DRM_CAP_TIMESTAMP_MONOTONIC, &cap);
drm->clock = (ret == 0 && cap == 1) ? CLOCK_MONOTONIC : CLOCK_REALTIME; drm->clock = (ret == 0 && cap == 1) ? CLOCK_MONOTONIC : CLOCK_REALTIME;
ret = drmGetCap(drm->fd, DRM_CAP_ADDFB2_MODIFIERS, &cap); const char *no_modifiers = getenv("WLR_DRM_NO_MODIFIERS");
drm->addfb2_modifiers = ret == 0 && cap == 1; if (no_modifiers != NULL && strcmp(no_modifiers, "1") == 0) {
wlr_log(WLR_DEBUG, "WLR_DRM_NO_MODIFIERS set, disabling modifiers");
} else {
ret = drmGetCap(drm->fd, DRM_CAP_ADDFB2_MODIFIERS, &cap);
drm->addfb2_modifiers = ret == 0 && cap == 1;
}
return true; return true;
} }
@ -105,7 +110,7 @@ static bool add_plane(struct wlr_drm_backend *drm,
DRM_FORMAT_MOD_INVALID); DRM_FORMAT_MOD_INVALID);
} }
if (p->props.in_formats) { if (p->props.in_formats && drm->addfb2_modifiers) {
uint64_t blob_id; uint64_t blob_id;
if (!get_drm_prop(drm->fd, p->id, p->props.in_formats, &blob_id)) { if (!get_drm_prop(drm->fd, p->id, p->props.in_formats, &blob_id)) {
wlr_log(WLR_ERROR, "Failed to read IN_FORMATS property"); wlr_log(WLR_ERROR, "Failed to read IN_FORMATS property");
@ -704,14 +709,7 @@ static bool drm_connector_init_renderer(struct wlr_drm_connector *conn,
int height = mode->wlr_mode.height; int height = mode->wlr_mode.height;
uint32_t format = DRM_FORMAT_ARGB8888; uint32_t format = DRM_FORMAT_ARGB8888;
bool modifiers = true; bool modifiers = drm->addfb2_modifiers;
const char *no_modifiers = getenv("WLR_DRM_NO_MODIFIERS");
if (no_modifiers != NULL && strcmp(no_modifiers, "1") == 0) {
wlr_drm_conn_log(conn, WLR_DEBUG,
"WLR_DRM_NO_MODIFIERS set, initializing planes without modifiers");
modifiers = false;
}
if (!drm_plane_init_surface(plane, drm, width, height, format, false, modifiers) || if (!drm_plane_init_surface(plane, drm, width, height, format, false, modifiers) ||
!drm_connector_pageflip_renderer(conn)) { !drm_connector_pageflip_renderer(conn)) {
if (!modifiers) { if (!modifiers) {