mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 22:25:58 +01:00
backend/drm: use drmModeFormatModifierBlobIterNext
This avoids open-coding our own logic. The resulting code is more readable. References: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/146
This commit is contained in:
parent
4377b55292
commit
a15c327718
2 changed files with 4 additions and 12 deletions
|
@ -142,17 +142,9 @@ static bool add_plane(struct wlr_drm_backend *drm,
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct drm_format_modifier_blob *data = blob->data;
|
drmModeFormatModifierIterator iter = {0};
|
||||||
uint32_t *fmts = (uint32_t *)((char *)data + data->formats_offset);
|
while (drmModeFormatModifierBlobIterNext(blob, &iter)) {
|
||||||
struct drm_format_modifier *mods = (struct drm_format_modifier *)
|
wlr_drm_format_set_add(&p->formats, iter.fmt, iter.mod);
|
||||||
((char *)data + data->modifiers_offset);
|
|
||||||
for (uint32_t i = 0; i < data->count_modifiers; ++i) {
|
|
||||||
for (int j = 0; j < 64; ++j) {
|
|
||||||
if (mods[i].formats & ((uint64_t)1 << j)) {
|
|
||||||
wlr_drm_format_set_add(&p->formats,
|
|
||||||
fmts[j + mods[i].offset], mods[i].modifier);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
drmModeFreePropertyBlob(blob);
|
drmModeFreePropertyBlob(blob);
|
||||||
|
|
|
@ -104,7 +104,7 @@ wayland_server = dependency('wayland-server',
|
||||||
default_options: wayland_project_options,
|
default_options: wayland_project_options,
|
||||||
)
|
)
|
||||||
|
|
||||||
drm = dependency('libdrm', version: '>=2.4.105')
|
drm = dependency('libdrm', version: '>=2.4.108')
|
||||||
gbm = dependency('gbm', version: '>=17.1.0')
|
gbm = dependency('gbm', version: '>=17.1.0')
|
||||||
xkbcommon = dependency('xkbcommon')
|
xkbcommon = dependency('xkbcommon')
|
||||||
udev = dependency('libudev')
|
udev = dependency('libudev')
|
||||||
|
|
Loading…
Reference in a new issue