diff --git a/libweston/backend-drm/drm-internal.h b/libweston/backend-drm/drm-internal.h index 7ece756d..06f952f2 100644 --- a/libweston/backend-drm/drm-internal.h +++ b/libweston/backend-drm/drm-internal.h @@ -634,7 +634,8 @@ drm_property_get_range_values(struct drm_property_info *info, const drmModeObjectProperties *props); int drm_plane_populate_formats(struct drm_plane *plane, const drmModePlane *kplane, - const drmModeObjectProperties *props); + const drmModeObjectProperties *props, + const bool use_modifiers); void drm_property_info_free(struct drm_property_info *info, int num_props); diff --git a/libweston/backend-drm/drm.c b/libweston/backend-drm/drm.c index 83993da5..980a12da 100644 --- a/libweston/backend-drm/drm.c +++ b/libweston/backend-drm/drm.c @@ -808,7 +808,8 @@ drm_plane_create(struct drm_backend *b, const drmModePlane *kplane, plane->zpos_max = DRM_PLANE_ZPOS_INVALID_PLANE; } - if (drm_plane_populate_formats(plane, kplane, props) < 0) { + if (drm_plane_populate_formats(plane, kplane, props, + b->fb_modifiers) < 0) { drmModeFreeObjectProperties(props); goto err; } diff --git a/libweston/backend-drm/kms.c b/libweston/backend-drm/kms.c index f5215f20..c91e3810 100644 --- a/libweston/backend-drm/kms.c +++ b/libweston/backend-drm/kms.c @@ -434,7 +434,8 @@ modifiers_ptr(struct drm_format_modifier_blob *blob) */ int drm_plane_populate_formats(struct drm_plane *plane, const drmModePlane *kplane, - const drmModeObjectProperties *props) + const drmModeObjectProperties *props, + const bool use_modifiers) { unsigned i; drmModePropertyBlobRes *blob; @@ -443,6 +444,9 @@ drm_plane_populate_formats(struct drm_plane *plane, const drmModePlane *kplane, uint32_t *blob_formats; uint32_t blob_id; + if (!use_modifiers) + goto fallback; + blob_id = drm_property_get_value(&plane->props[WDRM_PLANE_IN_FORMATS], props, 0); @@ -1474,11 +1478,13 @@ init_kms_caps(struct drm_backend *b) weston_log("DRM: %s atomic modesetting\n", b->atomic_modeset ? "supports" : "does not support"); - ret = drmGetCap(b->drm.fd, DRM_CAP_ADDFB2_MODIFIERS, &cap); - if (ret == 0) - b->fb_modifiers = cap; - else - b->fb_modifiers = 0; + if (!getenv("WESTON_DISABLE_GBM_MODIFIERS")) { + ret = drmGetCap(b->drm.fd, DRM_CAP_ADDFB2_MODIFIERS, &cap); + if (ret == 0) + b->fb_modifiers = cap; + } + weston_log("DRM: %s GBM modifiers\n", + b->fb_modifiers ? "supports" : "does not support"); /* * KMS support for hardware planes cannot properly synchronize