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>
This commit is contained in:
Stefan Agner 2020-06-17 23:36:44 +02:00 committed by Daniel Stone
parent 43ebb7e25a
commit 465ab2cd92
3 changed files with 16 additions and 8 deletions

View File

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

View File

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

View File

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