mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-12-23 02:19:49 +01:00
backend/drm: allow non-linear modifiers for multi-GPU
Prior to [1], if an entry in a DRM format set was different than a single LINEAR modifier, implicit modifiers were always allowed. This has changed and now implicit modifiers are only allowed if INVALID is in the list of modifiers. So now we can safely enable explicit modifiers for cross-GPU imports, without risking receiving buffers with an implicit modifier. This should improve perf a bit on setups where two GPUs from the same vendor are used. This fixes the first bullet point from [2]. [1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3231 [2]: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3331
This commit is contained in:
parent
ad06c12c89
commit
e59f4d4ffa
1 changed files with 9 additions and 7 deletions
|
@ -275,15 +275,17 @@ struct wlr_backend *wlr_drm_backend_create(struct wl_display *display,
|
|||
goto error_mgpu_renderer;
|
||||
}
|
||||
|
||||
// Force a linear layout. In case explicit modifiers aren't supported,
|
||||
// the meaning of implicit modifiers changes from one GPU to the other.
|
||||
// In case explicit modifiers are supported, we still have no guarantee
|
||||
// that the buffer producer will support these, so they might fallback
|
||||
// to implicit modifiers.
|
||||
// Forbid implicit modifiers, because their meaning changes from one
|
||||
// GPU to another.
|
||||
for (size_t i = 0; i < texture_formats->len; i++) {
|
||||
const struct wlr_drm_format *fmt = texture_formats->formats[i];
|
||||
wlr_drm_format_set_add(&drm->mgpu_formats, fmt->format,
|
||||
DRM_FORMAT_MOD_LINEAR);
|
||||
for (size_t j = 0; j < fmt->len; j++) {
|
||||
uint64_t mod = fmt->modifiers[j];
|
||||
if (mod == DRM_FORMAT_MOD_INVALID) {
|
||||
continue;
|
||||
}
|
||||
wlr_drm_format_set_add(&drm->mgpu_formats, fmt->format, mod);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue