struct drm_property_info {
const char *name; /**< name as string (static, not freed) */
uint32_t prop_id; /**< KMS property object ID */
+ uint32_t flags;
unsigned int num_enum_values; /**< number of enum values */
struct drm_property_enum_info *enum_values; /**< array of enum values */
+ unsigned int num_range_values;
+ uint64_t range_values[2];
};
/**
drm_property_get_value(struct drm_property_info *info,
const drmModeObjectProperties *props,
uint64_t def);
+uint64_t *
+drm_property_get_range_values(struct drm_property_info *info,
+ const drmModeObjectProperties *props);
int
drm_plane_populate_formats(struct drm_plane *plane, const drmModePlane *kplane,
const drmModeObjectProperties *props);
return def;
}
+/**
+ * Get the current range values of a KMS property
+ *
+ * Given a drmModeObjectGetProperties return, as well as the drm_property_info
+ * for the target property, return the current range values of that property,
+ *
+ * If the property is not present, or there's no it is not a prop range then
+ * NULL will be returned.
+ *
+ * @param info Internal structure for property to look up
+ * @param props Raw KMS properties for the target object
+ */
+uint64_t *
+drm_property_get_range_values(struct drm_property_info *info,
+ const drmModeObjectProperties *props)
+{
+ unsigned int i;
+
+ if (info->prop_id == 0)
+ return NULL;
+
+ for (i = 0; i < props->count_props; i++) {
+
+ if (props->props[i] != info->prop_id)
+ continue;
+
+ if (!(info->flags & DRM_MODE_PROP_RANGE) &&
+ !(info->flags & DRM_MODE_PROP_SIGNED_RANGE))
+ continue;
+
+ return info->range_values;
+ }
+
+ return NULL;
+}
+
/**
* Cache DRM property values
*
}
info[j].prop_id = props->props[i];
+ info[j].flags = prop->flags;
+
+ if (prop->flags & DRM_MODE_PROP_RANGE ||
+ prop->flags & DRM_MODE_PROP_SIGNED_RANGE) {
+ info[j].num_range_values = prop->count_values;
+ for (int i = 0; i < prop->count_values; i++)
+ info[j].range_values[i] = prop->values[i];
+ }
+
if (info[j].num_enum_values == 0) {
drmModeFreeProperty(prop);