diff --git a/CMakeLists.txt b/CMakeLists.txt index e4033ec255..8f036b59b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,7 +247,7 @@ set_package_properties(UDev PROPERTIES PURPOSE "Required for input handling on Wayland." ) -find_package(Libdrm 2.4.62) +find_package(Libdrm 2.4.108) set_package_properties(Libdrm PROPERTIES TYPE REQUIRED PURPOSE "Required for drm output on Wayland.") find_package(gbm) diff --git a/src/backends/drm/drm_object_plane.cpp b/src/backends/drm/drm_object_plane.cpp index 5633c0cd21..dc615a39f4 100644 --- a/src/backends/drm/drm_object_plane.cpp +++ b/src/backends/drm/drm_object_plane.cpp @@ -68,25 +68,9 @@ bool DrmPlane::init() // read formats from blob if available and if modifiers are supported, and from the plane object if not if (const auto formatProp = getProp(PropertyIndex::In_Formats); formatProp && formatProp->immutableBlob() && gpu()->addFB2ModifiersSupported()) { - auto blob = static_cast(formatProp->immutableBlob()->data); - auto modifiers = reinterpret_cast(reinterpret_cast(blob) + blob->modifiers_offset); - uint32_t *formatarr = reinterpret_cast(reinterpret_cast(blob) + blob->formats_offset); - - for (uint32_t f = 0; f < blob->count_formats; f++) { - auto format = formatarr[f]; - QVector mods; - for (uint32_t m = 0; m < blob->count_modifiers; m++) { - auto modifier = &modifiers[m]; - // The modifier advertisement blob is partitioned into groups of 64 formats - if (m < modifier->offset || m > modifier->offset + 63) { - continue; - } - if (!(modifier->formats & (1 << (f - modifier->offset)))) { - continue; - } - mods << modifier->modifier; - } - m_supportedFormats.insert(format, mods); + drmModeFormatModifierIterator iterator{}; + while (drmModeFormatModifierBlobIterNext(formatProp->immutableBlob(), &iterator)) { + m_supportedFormats[iterator.fmt].push_back(iterator.mod); } } else { for (uint32_t i = 0; i < p->count_formats; i++) {