backend-drm: allow to disable GBM modifiers

Allow to disable GBM modifiers at runtime using the environment variable
WESTON_DISABLE_GBM_MODIFIERS.

This can be useful for debugging or when modifiers cause issues, e.g. in
case modifiers use higher memory bandwidth and hence impose a lower
resolution limit as it is the case with Intel Kaby Lake graphics.

Related to: https://gitlab.freedesktop.org/wayland/weston/-/issues/404
Signed-off-by: Stefan Agner <stefan@agner.ch>
dev
Stefan Agner 5 years ago committed by Daniel Stone
parent 43ebb7e25a
commit 465ab2cd92
  1. 3
      libweston/backend-drm/drm-internal.h
  2. 3
      libweston/backend-drm/drm.c
  3. 12
      libweston/backend-drm/kms.c

@ -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);

@ -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;
}

@ -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");
if (!getenv("WESTON_DISABLE_GBM_MODIFIERS")) {
ret = drmGetCap(b->drm.fd, DRM_CAP_ADDFB2_MODIFIERS, &cap);
if (ret == 0)
b->fb_modifiers = cap;
else
b->fb_modifiers = 0;
}
weston_log("DRM: %s GBM modifiers\n",
b->fb_modifiers ? "supports" : "does not support");
/*
* KMS support for hardware planes cannot properly synchronize

Loading…
Cancel
Save