Lines Matching refs:property
43 * property types and ranges.
50 * tables, color correction matrices or large structures) a property can instead
54 * per-object mapping from those names to the property ID used in the atomic
55 * IOCTL and in the get/set property IOCTL.
82 * drm_property_create - create a new property type
84 * @flags: flags specifying the property type
85 * @name: name of the property
88 * This creates a new generic drm property which can then be attached to a drm
89 * object with drm_object_attach_property(). The returned property object must
94 * A pointer to the newly created property on success, NULL on failure.
100 struct drm_property *property = NULL;
109 property = kzalloc(sizeof(struct drm_property), GFP_KERNEL);
110 if (!property)
113 property->dev = dev;
116 property->values = kcalloc(num_values, sizeof(uint64_t),
118 if (!property->values)
122 ret = drm_mode_object_add(dev, &property->base, DRM_MODE_OBJECT_PROPERTY);
126 property->flags = flags;
127 property->num_values = num_values;
128 INIT_LIST_HEAD(&property->enum_list);
130 strscpy_pad(property->name, name, DRM_PROP_NAME_LEN);
132 list_add_tail(&property->head, &dev->mode_config.property_list);
134 return property;
136 kfree(property->values);
137 kfree(property);
143 * drm_property_create_enum - create a new enumeration property type
145 * @flags: flags specifying the property type
146 * @name: name of the property
147 * @props: enumeration lists with property values
150 * This creates a new generic drm property which can then be attached to a drm
151 * object with drm_object_attach_property(). The returned property object must
159 * A pointer to the newly created property on success, NULL on failure.
166 struct drm_property *property;
171 property = drm_property_create(dev, flags, name, num_values);
172 if (!property)
176 ret = drm_property_add_enum(property,
180 drm_property_destroy(dev, property);
185 return property;
190 * drm_property_create_bitmask - create a new bitmask property type
192 * @flags: flags specifying the property type
193 * @name: name of the property
194 * @props: enumeration lists with property bitflags
198 * This creates a new bitmask drm property which can then be attached to a drm
199 * object with drm_object_attach_property(). The returned property object must
204 * or'ed together combination of the predefined property bitflag values
207 * A pointer to the newly created property on success, NULL on failure.
215 struct drm_property *property;
221 property = drm_property_create(dev, flags, name, num_values);
222 if (!property)
228 ret = drm_property_add_enum(property,
232 drm_property_destroy(dev, property);
237 return property;
245 struct drm_property *property;
247 property = drm_property_create(dev, flags, name, 2);
248 if (!property)
251 property->values[0] = min;
252 property->values[1] = max;
254 return property;
258 * drm_property_create_range - create a new unsigned ranged property type
260 * @flags: flags specifying the property type
261 * @name: name of the property
262 * @min: minimum value of the property
263 * @max: maximum value of the property
265 * This creates a new generic drm property which can then be attached to a drm
266 * object with drm_object_attach_property(). The returned property object must
274 * A pointer to the newly created property on success, NULL on failure.
286 * drm_property_create_signed_range - create a new signed ranged property type
288 * @flags: flags specifying the property type
289 * @name: name of the property
290 * @min: minimum value of the property
291 * @max: maximum value of the property
293 * This creates a new generic drm property which can then be attached to a drm
294 * object with drm_object_attach_property(). The returned property object must
302 * A pointer to the newly created property on success, NULL on failure.
314 * drm_property_create_object - create a new object property type
316 * @flags: flags specifying the property type
317 * @name: name of the property
320 * This creates a new generic drm property which can then be attached to a drm
321 * object with drm_object_attach_property(). The returned property object must
325 * Userspace is only allowed to set this to any property value of the given
329 * A pointer to the newly created property on success, NULL on failure.
335 struct drm_property *property;
342 property = drm_property_create(dev, flags, name, 1);
343 if (!property)
346 property->values[0] = type;
348 return property;
353 * drm_property_create_bool - create a new boolean property type
355 * @flags: flags specifying the property type
356 * @name: name of the property
358 * This creates a new generic drm property which can then be attached to a drm
359 * object with drm_object_attach_property(). The returned property object must
363 * This is implemented as a ranged property with only {0, 1} as valid values.
366 * A pointer to the newly created property on success, NULL on failure.
376 * drm_property_add_enum - add a possible value to an enumeration property
377 * @property: enumeration property to change
381 * This functions adds enumerations to a property.
384 * to directly create the property with all enumerations already attached.
389 int drm_property_add_enum(struct drm_property *property,
398 if (WARN_ON(!drm_property_type_is(property, DRM_MODE_PROP_ENUM) &&
399 !drm_property_type_is(property, DRM_MODE_PROP_BITMASK)))
406 if (WARN_ON(drm_property_type_is(property, DRM_MODE_PROP_BITMASK) &&
410 list_for_each_entry(prop_enum, &property->enum_list, head) {
416 if (WARN_ON(index >= property->num_values))
426 property->values[index] = value;
427 list_add_tail(&prop_enum->head, &property->enum_list);
433 * drm_property_destroy - destroy a drm property
435 * @property: property to destroy
437 * This function frees a property including any attached resources like
440 void drm_property_destroy(struct drm_device *dev, struct drm_property *property)
444 list_for_each_entry_safe(prop_enum, pt, &property->enum_list, head) {
449 if (property->num_values)
450 kfree(property->values);
451 drm_mode_object_unregister(dev, &property->base);
452 list_del(&property->head);
453 kfree(property);
461 struct drm_property *property;
472 property = drm_property_find(dev, file_priv, out_resp->prop_id);
473 if (!property)
476 strscpy_pad(out_resp->name, property->name, DRM_PROP_NAME_LEN);
477 out_resp->flags = property->flags;
479 value_count = property->num_values;
484 put_user(property->values[i], values_ptr + i)) {
493 if (drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
494 drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
495 list_for_each_entry(prop_enum, &property->enum_list, head) {
514 * property values. But nothing ever added them to the corresponding
516 * read the value for a blob property. It also doesn't make a lot of
518 * the property itself.
520 if (drm_property_type_is(property, DRM_MODE_PROP_BLOB))
541 * drm_property_create_blob - Create new blob property
542 * @dev: DRM device to create property for
546 * Creates a new blob property for a specified DRM device, optionally
548 * data must be filled out before the blob is used as the value of any property.
551 * New blob property with a single reference on success, or an ERR_PTR
595 * drm_property_blob_put - release a blob property reference
596 * @blob: DRM blob property
598 * Releases a reference to a blob property. May free the object.
625 * drm_property_blob_get - acquire blob property reference
626 * @blob: DRM blob property
628 * Acquires a reference to an existing blob property. Returns @blob, which
639 * drm_property_lookup_blob - look up a blob property and take a reference
641 * @id: id of the blob property
643 * If successful, this takes an additional reference to the blob property.
644 * callers need to make sure to eventually unreferenced the returned property
664 * drm_property_replace_global_blob - replace existing blob property
666 * @replace: location of blob property pointer to be replaced
669 * @obj_holds_id: optional object for property holding blob ID
670 * @prop_holds_id: optional property holding blob ID
673 * This function will replace a global property in the blob list, optionally
674 * updating a property which holds the ID of that property.
677 * property, if specified, will be set to 0.
682 * For example, a drm_connector has a 'PATH' property, which contains the ID
683 * of a blob property with the value of the MST path information. Calling this
686 * base object, and prop_holds_id set to the path property name, will perform
732 * drm_property_replace_blob - replace a blob property
835 /* Ensure the property was actually created by this user. */
868 * value doesn't become invalid part way through the property update due to
870 * to drm_property_change_valid_put() after the property is set (and the
871 * object to which the property is attached has a chance to take its own
874 bool drm_property_change_valid_get(struct drm_property *property,
879 if (property->flags & DRM_MODE_PROP_IMMUTABLE)
884 if (drm_property_type_is(property, DRM_MODE_PROP_RANGE)) {
885 if (value < property->values[0] || value > property->values[1])
888 } else if (drm_property_type_is(property, DRM_MODE_PROP_SIGNED_RANGE)) {
891 if (svalue < U642I64(property->values[0]) ||
892 svalue > U642I64(property->values[1]))
895 } else if (drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
898 for (i = 0; i < property->num_values; i++)
899 valid_mask |= (1ULL << property->values[i]);
901 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) {
907 blob = drm_property_lookup_blob(property->dev, value);
914 } else if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
915 /* a zero value for an object property translates to null: */
919 *ref = __drm_mode_object_find(property->dev, NULL, value,
920 property->values[0]);
924 for (i = 0; i < property->num_values; i++)
925 if (property->values[i] == value)
930 void drm_property_change_valid_put(struct drm_property *property,
936 if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
938 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB))