Lines Matching full:property
44 * property types and ranges.
50 * Property values are only 64bit. To support bigger piles of data (like gamma
51 * tables, color correction matrices or large structures) a property can instead
55 * per-object mapping from those names to the property ID used in the atomic
56 * IOCTL and in the get/set property IOCTL.
83 * drm_property_create - create a new property type
85 * @flags: flags specifying the property type
86 * @name: name of the property
89 * This creates a new generic drm property which can then be attached to a drm
90 * object with drm_object_attach_property(). The returned property object must
95 * A pointer to the newly created property on success, NULL on failure.
101 struct drm_property *property = NULL; in drm_property_create() local
110 property = kzalloc(sizeof(struct drm_property), GFP_KERNEL); in drm_property_create()
111 if (!property) in drm_property_create()
114 property->dev = dev; in drm_property_create()
117 property->values = kcalloc(num_values, sizeof(uint64_t), in drm_property_create()
119 if (!property->values) in drm_property_create()
123 ret = drm_mode_object_add(dev, &property->base, DRM_MODE_OBJECT_PROPERTY); in drm_property_create()
127 property->flags = flags; in drm_property_create()
128 property->num_values = num_values; in drm_property_create()
129 INIT_LIST_HEAD(&property->enum_list); in drm_property_create()
131 strscpy_pad(property->name, name, DRM_PROP_NAME_LEN); in drm_property_create()
133 list_add_tail(&property->head, &dev->mode_config.property_list); in drm_property_create()
135 return property; in drm_property_create()
137 kfree(property->values); in drm_property_create()
138 kfree(property); in drm_property_create()
144 * drm_property_create_enum - create a new enumeration property type
146 * @flags: flags specifying the property type
147 * @name: name of the property
148 * @props: enumeration lists with property values
151 * This creates a new generic drm property which can then be attached to a drm
152 * object with drm_object_attach_property(). The returned property object must
160 * A pointer to the newly created property on success, NULL on failure.
167 struct drm_property *property; in drm_property_create_enum() local
172 property = drm_property_create(dev, flags, name, num_values); in drm_property_create_enum()
173 if (!property) in drm_property_create_enum()
177 ret = drm_property_add_enum(property, in drm_property_create_enum()
181 drm_property_destroy(dev, property); in drm_property_create_enum()
186 return property; in drm_property_create_enum()
191 * drm_property_create_bitmask - create a new bitmask property type
193 * @flags: flags specifying the property type
194 * @name: name of the property
195 * @props: enumeration lists with property bitflags
199 * This creates a new bitmask drm property which can then be attached to a drm
200 * object with drm_object_attach_property(). The returned property object must
205 * or'ed together combination of the predefined property bitflag values
208 * A pointer to the newly created property on success, NULL on failure.
216 struct drm_property *property; in drm_property_create_bitmask() local
222 property = drm_property_create(dev, flags, name, num_values); in drm_property_create_bitmask()
223 if (!property) in drm_property_create_bitmask()
229 ret = drm_property_add_enum(property, in drm_property_create_bitmask()
233 drm_property_destroy(dev, property); in drm_property_create_bitmask()
238 return property; in drm_property_create_bitmask()
246 struct drm_property *property; in property_create_range() local
248 property = drm_property_create(dev, flags, name, 2); in property_create_range()
249 if (!property) in property_create_range()
252 property->values[0] = min; in property_create_range()
253 property->values[1] = max; in property_create_range()
255 return property; in property_create_range()
259 * drm_property_create_range - create a new unsigned ranged property type
261 * @flags: flags specifying the property type
262 * @name: name of the property
263 * @min: minimum value of the property
264 * @max: maximum value of the property
266 * This creates a new generic drm property which can then be attached to a drm
267 * object with drm_object_attach_property(). The returned property object must
275 * A pointer to the newly created property on success, NULL on failure.
287 * drm_property_create_signed_range - create a new signed ranged property type
289 * @flags: flags specifying the property type
290 * @name: name of the property
291 * @min: minimum value of the property
292 * @max: maximum value of the property
294 * This creates a new generic drm property which can then be attached to a drm
295 * object with drm_object_attach_property(). The returned property object must
303 * A pointer to the newly created property on success, NULL on failure.
315 * drm_property_create_object - create a new object property type
317 * @flags: flags specifying the property type
318 * @name: name of the property
321 * This creates a new generic drm property which can then be attached to a drm
322 * object with drm_object_attach_property(). The returned property object must
326 * Userspace is only allowed to set this to any property value of the given
330 * A pointer to the newly created property on success, NULL on failure.
336 struct drm_property *property; in drm_property_create_object() local
343 property = drm_property_create(dev, flags, name, 1); in drm_property_create_object()
344 if (!property) in drm_property_create_object()
347 property->values[0] = type; in drm_property_create_object()
349 return property; in drm_property_create_object()
354 * drm_property_create_bool - create a new boolean property type
356 * @flags: flags specifying the property type
357 * @name: name of the property
359 * This creates a new generic drm property which can then be attached to a drm
360 * object with drm_object_attach_property(). The returned property object must
364 * This is implemented as a ranged property with only {0, 1} as valid values.
367 * A pointer to the newly created property on success, NULL on failure.
377 * drm_property_add_enum - add a possible value to an enumeration property
378 * @property: enumeration property to change
382 * This functions adds enumerations to a property.
385 * to directly create the property with all enumerations already attached.
390 int drm_property_add_enum(struct drm_property *property, in drm_property_add_enum() argument
399 if (WARN_ON(!drm_property_type_is(property, DRM_MODE_PROP_ENUM) && in drm_property_add_enum()
400 !drm_property_type_is(property, DRM_MODE_PROP_BITMASK))) in drm_property_add_enum()
407 if (WARN_ON(drm_property_type_is(property, DRM_MODE_PROP_BITMASK) && in drm_property_add_enum()
411 list_for_each_entry(prop_enum, &property->enum_list, head) { in drm_property_add_enum()
417 if (WARN_ON(index >= property->num_values)) in drm_property_add_enum()
427 property->values[index] = value; in drm_property_add_enum()
428 list_add_tail(&prop_enum->head, &property->enum_list); in drm_property_add_enum()
434 * drm_property_destroy - destroy a drm property
436 * @property: property to destroy
438 * This function frees a property including any attached resources like
441 void drm_property_destroy(struct drm_device *dev, struct drm_property *property) in drm_property_destroy() argument
445 list_for_each_entry_safe(prop_enum, pt, &property->enum_list, head) { in drm_property_destroy()
450 if (property->num_values) in drm_property_destroy()
451 kfree(property->values); in drm_property_destroy()
452 drm_mode_object_unregister(dev, &property->base); in drm_property_destroy()
453 list_del(&property->head); in drm_property_destroy()
454 kfree(property); in drm_property_destroy()
462 struct drm_property *property; in drm_mode_getproperty_ioctl() local
473 property = drm_property_find(dev, file_priv, out_resp->prop_id); in drm_mode_getproperty_ioctl()
474 if (!property) in drm_mode_getproperty_ioctl()
477 strscpy_pad(out_resp->name, property->name, DRM_PROP_NAME_LEN); in drm_mode_getproperty_ioctl()
478 out_resp->flags = property->flags; in drm_mode_getproperty_ioctl()
480 value_count = property->num_values; in drm_mode_getproperty_ioctl()
485 put_user(property->values[i], values_ptr + i)) { in drm_mode_getproperty_ioctl()
494 if (drm_property_type_is(property, DRM_MODE_PROP_ENUM) || in drm_mode_getproperty_ioctl()
495 drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) { in drm_mode_getproperty_ioctl()
496 list_for_each_entry(prop_enum, &property->enum_list, head) { in drm_mode_getproperty_ioctl()
515 * property values. But nothing ever added them to the corresponding in drm_mode_getproperty_ioctl()
517 * read the value for a blob property. It also doesn't make a lot of in drm_mode_getproperty_ioctl()
519 * the property itself. in drm_mode_getproperty_ioctl()
521 if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) in drm_mode_getproperty_ioctl()
542 * drm_property_create_blob - Create new blob property
543 * @dev: DRM device to create property for
547 * Creates a new blob property for a specified DRM device, optionally
549 * data must be filled out before the blob is used as the value of any property.
552 * New blob property with a single reference on success, or an ERR_PTR
596 * drm_property_blob_put - release a blob property reference
597 * @blob: DRM blob property
599 * Releases a reference to a blob property. May free the object.
626 * drm_property_blob_get - acquire blob property reference
627 * @blob: DRM blob property
629 * Acquires a reference to an existing blob property. Returns @blob, which
640 * drm_property_lookup_blob - look up a blob property and take a reference
642 * @id: id of the blob property
644 * If successful, this takes an additional reference to the blob property.
645 * callers need to make sure to eventually unreferenced the returned property
665 * drm_property_replace_global_blob - replace existing blob property
667 * @replace: location of blob property pointer to be replaced
670 * @obj_holds_id: optional object for property holding blob ID
671 * @prop_holds_id: optional property holding blob ID
674 * This function will replace a global property in the blob list, optionally
675 * updating a property which holds the ID of that property.
678 * property, if specified, will be set to 0.
683 * For example, a drm_connector has a 'PATH' property, which contains the ID
684 * of a blob property with the value of the MST path information. Calling this
687 * base object, and prop_holds_id set to the path property name, will perform
733 * drm_property_replace_blob - replace a blob property
756 * drm_property_replace_blob_from_id - replace a blob property taking a reference
760 * @expected_size: expected size of the blob property
761 * @expected_elem_size: expected size of an element in the blob property
894 /* Ensure the property was actually created by this user. */ in drm_mode_destroyblob_ioctl()
927 * value doesn't become invalid part way through the property update due to
929 * to drm_property_change_valid_put() after the property is set (and the
930 * object to which the property is attached has a chance to take its own
933 bool drm_property_change_valid_get(struct drm_property *property, in drm_property_change_valid_get() argument
938 if (property->flags & DRM_MODE_PROP_IMMUTABLE) in drm_property_change_valid_get()
943 if (drm_property_type_is(property, DRM_MODE_PROP_RANGE)) { in drm_property_change_valid_get()
944 if (value < property->values[0] || value > property->values[1]) in drm_property_change_valid_get()
947 } else if (drm_property_type_is(property, DRM_MODE_PROP_SIGNED_RANGE)) { in drm_property_change_valid_get()
950 if (svalue < U642I64(property->values[0]) || in drm_property_change_valid_get()
951 svalue > U642I64(property->values[1])) in drm_property_change_valid_get()
954 } else if (drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) { in drm_property_change_valid_get()
957 for (i = 0; i < property->num_values; i++) in drm_property_change_valid_get()
958 valid_mask |= (1ULL << property->values[i]); in drm_property_change_valid_get()
960 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) { in drm_property_change_valid_get()
966 blob = drm_property_lookup_blob(property->dev, value); in drm_property_change_valid_get()
973 } else if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) { in drm_property_change_valid_get()
974 /* a zero value for an object property translates to null: */ in drm_property_change_valid_get()
978 *ref = __drm_mode_object_find(property->dev, NULL, value, in drm_property_change_valid_get()
979 property->values[0]); in drm_property_change_valid_get()
983 for (i = 0; i < property->num_values; i++) in drm_property_change_valid_get()
984 if (property->values[i] == value) in drm_property_change_valid_get()
989 void drm_property_change_valid_put(struct drm_property *property, in drm_property_change_valid_put() argument
995 if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) { in drm_property_change_valid_put()
997 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) in drm_property_change_valid_put()