Lines Matching full:property

43  * property types and ranges.
49 * Property values are only 64bit. To support bigger piles of data (like gamma
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; in drm_property_create() local
109 property = kzalloc(sizeof(struct drm_property), GFP_KERNEL); in drm_property_create()
110 if (!property) in drm_property_create()
113 property->dev = dev; in drm_property_create()
116 property->values = kcalloc(num_values, sizeof(uint64_t), in drm_property_create()
118 if (!property->values) in drm_property_create()
122 ret = drm_mode_object_add(dev, &property->base, DRM_MODE_OBJECT_PROPERTY); in drm_property_create()
126 property->flags = flags; in drm_property_create()
127 property->num_values = num_values; in drm_property_create()
128 INIT_LIST_HEAD(&property->enum_list); in drm_property_create()
130 strscpy_pad(property->name, name, DRM_PROP_NAME_LEN); in drm_property_create()
132 list_add_tail(&property->head, &dev->mode_config.property_list); in drm_property_create()
134 return property; in drm_property_create()
136 kfree(property->values); in drm_property_create()
137 kfree(property); in drm_property_create()
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; in drm_property_create_enum() local
171 property = drm_property_create(dev, flags, name, num_values); in drm_property_create_enum()
172 if (!property) in drm_property_create_enum()
176 ret = drm_property_add_enum(property, in drm_property_create_enum()
180 drm_property_destroy(dev, property); in drm_property_create_enum()
185 return property; in drm_property_create_enum()
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; in drm_property_create_bitmask() local
221 property = drm_property_create(dev, flags, name, num_values); in drm_property_create_bitmask()
222 if (!property) in drm_property_create_bitmask()
228 ret = drm_property_add_enum(property, in drm_property_create_bitmask()
232 drm_property_destroy(dev, property); in drm_property_create_bitmask()
237 return property; in drm_property_create_bitmask()
245 struct drm_property *property; in property_create_range() local
247 property = drm_property_create(dev, flags, name, 2); in property_create_range()
248 if (!property) in property_create_range()
251 property->values[0] = min; in property_create_range()
252 property->values[1] = max; in property_create_range()
254 return property; in property_create_range()
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; in drm_property_create_object() local
342 property = drm_property_create(dev, flags, name, 1); in drm_property_create_object()
343 if (!property) in drm_property_create_object()
346 property->values[0] = type; in drm_property_create_object()
348 return property; in drm_property_create_object()
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, in drm_property_add_enum() argument
398 if (WARN_ON(!drm_property_type_is(property, DRM_MODE_PROP_ENUM) && in drm_property_add_enum()
399 !drm_property_type_is(property, DRM_MODE_PROP_BITMASK))) in drm_property_add_enum()
406 if (WARN_ON(drm_property_type_is(property, DRM_MODE_PROP_BITMASK) && in drm_property_add_enum()
410 list_for_each_entry(prop_enum, &property->enum_list, head) { in drm_property_add_enum()
416 if (WARN_ON(index >= property->num_values)) in drm_property_add_enum()
426 property->values[index] = value; in drm_property_add_enum()
427 list_add_tail(&prop_enum->head, &property->enum_list); in drm_property_add_enum()
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) in drm_property_destroy() argument
444 list_for_each_entry_safe(prop_enum, pt, &property->enum_list, head) { in drm_property_destroy()
449 if (property->num_values) in drm_property_destroy()
450 kfree(property->values); in drm_property_destroy()
451 drm_mode_object_unregister(dev, &property->base); in drm_property_destroy()
452 list_del(&property->head); in drm_property_destroy()
453 kfree(property); in drm_property_destroy()
461 struct drm_property *property; in drm_mode_getproperty_ioctl() local
472 property = drm_property_find(dev, file_priv, out_resp->prop_id); in drm_mode_getproperty_ioctl()
473 if (!property) in drm_mode_getproperty_ioctl()
476 strscpy_pad(out_resp->name, property->name, DRM_PROP_NAME_LEN); in drm_mode_getproperty_ioctl()
477 out_resp->flags = property->flags; in drm_mode_getproperty_ioctl()
479 value_count = property->num_values; in drm_mode_getproperty_ioctl()
484 put_user(property->values[i], values_ptr + i)) { in drm_mode_getproperty_ioctl()
493 if (drm_property_type_is(property, DRM_MODE_PROP_ENUM) || in drm_mode_getproperty_ioctl()
494 drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) { in drm_mode_getproperty_ioctl()
495 list_for_each_entry(prop_enum, &property->enum_list, head) { in drm_mode_getproperty_ioctl()
514 * property values. But nothing ever added them to the corresponding in drm_mode_getproperty_ioctl()
516 * read the value for a blob property. It also doesn't make a lot of in drm_mode_getproperty_ioctl()
518 * the property itself. in drm_mode_getproperty_ioctl()
520 if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) in drm_mode_getproperty_ioctl()
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. */ in drm_mode_destroyblob_ioctl()
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, in drm_property_change_valid_get() argument
879 if (property->flags & DRM_MODE_PROP_IMMUTABLE) in drm_property_change_valid_get()
884 if (drm_property_type_is(property, DRM_MODE_PROP_RANGE)) { in drm_property_change_valid_get()
885 if (value < property->values[0] || value > property->values[1]) in drm_property_change_valid_get()
888 } else if (drm_property_type_is(property, DRM_MODE_PROP_SIGNED_RANGE)) { in drm_property_change_valid_get()
891 if (svalue < U642I64(property->values[0]) || in drm_property_change_valid_get()
892 svalue > U642I64(property->values[1])) in drm_property_change_valid_get()
895 } else if (drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) { in drm_property_change_valid_get()
898 for (i = 0; i < property->num_values; i++) in drm_property_change_valid_get()
899 valid_mask |= (1ULL << property->values[i]); in drm_property_change_valid_get()
901 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) { in drm_property_change_valid_get()
907 blob = drm_property_lookup_blob(property->dev, value); in drm_property_change_valid_get()
914 } else if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) { in drm_property_change_valid_get()
915 /* a zero value for an object property translates to null: */ in drm_property_change_valid_get()
919 *ref = __drm_mode_object_find(property->dev, NULL, value, in drm_property_change_valid_get()
920 property->values[0]); in drm_property_change_valid_get()
924 for (i = 0; i < property->num_values; i++) in drm_property_change_valid_get()
925 if (property->values[i] == value) in drm_property_change_valid_get()
930 void drm_property_change_valid_put(struct drm_property *property, in drm_property_change_valid_put() argument
936 if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) { in drm_property_change_valid_put()
938 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) in drm_property_change_valid_put()