dmabuf: correctly list modifiers

relates to #99 and #106
This commit is contained in:
vaxerski 2023-10-10 01:11:43 +01:00
parent ec6304f475
commit ff87a16b2b

View file

@ -1022,15 +1022,16 @@ static bool wlr_query_dmabuf_modifiers(uint32_t drm_format, uint32_t num_modifie
return true; return true;
} }
for (size_t i = 0; i < g_pPortalManager->m_vDMABUFMods.size(); ++i) { size_t i = 0;
for (const auto& mod : g_pPortalManager->m_vDMABUFMods) {
if (i >= num_modifiers) if (i >= num_modifiers)
break; break;
const auto& mod = g_pPortalManager->m_vDMABUFMods[i];
if (mod.fourcc == drm_format && if (mod.fourcc == drm_format &&
(mod.mod == DRM_FORMAT_MOD_INVALID || gbm_device_get_format_modifier_plane_count(g_pPortalManager->m_sWaylandConnection.gbmDevice, mod.fourcc, mod.mod) > 0)) (mod.mod == DRM_FORMAT_MOD_INVALID || gbm_device_get_format_modifier_plane_count(g_pPortalManager->m_sWaylandConnection.gbmDevice, mod.fourcc, mod.mod) > 0)) {
modifiers[i] = mod.mod; modifiers[i] = mod.mod;
++i;
}
} }
*max_modifiers = num_modifiers; *max_modifiers = num_modifiers;