backends/native: Store supported variants for KMS enum/bitmasks

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2861>
This commit is contained in:
Sebastian Wick 2022-06-27 18:39:07 +02:00 committed by Marge Bot
parent 80dd26428b
commit 36aada2164
2 changed files with 19 additions and 6 deletions

View File

@ -551,24 +551,31 @@ update_prop_value (MetaKmsProp *prop,
case DRM_MODE_PROP_ENUM:
{
int i;
uint64_t result = prop->default_value;
uint64_t supported = 0;
for (i = 0; i < prop->num_enum_values; i++)
{
if (prop->enum_values[i].valid &&
prop->enum_values[i].value == drm_value)
if (!prop->enum_values[i].valid)
continue;
if (prop->enum_values[i].value == drm_value)
{
prop->value = i;
return;
result = i;
}
supported |= (1 << i);
}
prop->value = prop->default_value;
prop->value = result;
prop->supported_variants = supported;
return;
}
case DRM_MODE_PROP_BITMASK:
{
int i;
uint64_t result = 0;
uint64_t supported = 0;
for (i = 0; i < prop->num_enum_values; i++)
{
@ -580,11 +587,15 @@ update_prop_value (MetaKmsProp *prop,
result |= prop->enum_values[i].bitmask;
drm_value &= ~(1 << prop->enum_values[i].value);
}
supported |= prop->enum_values[i].bitmask;
}
if (drm_value != 0)
if (drm_value != 0)
result |= prop->default_value;
prop->value = result;
prop->supported_variants = supported;
return;
}
default:

View File

@ -70,6 +70,8 @@ struct _MetaKmsProp
int64_t range_min_signed;
int64_t range_max_signed;
uint64_t supported_variants;
uint32_t prop_id;
uint64_t value;
};