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 strncpy(property->name, name, DRM_PROP_NAME_LEN); in drm_property_create()
131 property->name[DRM_PROP_NAME_LEN-1] = '\0'; 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()
428 property->values[index] = value; in drm_property_add_enum()
429 list_add_tail(&prop_enum->head, &property->enum_list); in drm_property_add_enum()
435 * drm_property_destroy - destroy a drm property
437 * @property: property to destry
439 * This function frees a property including any attached resources like
442 void drm_property_destroy(struct drm_device *dev, struct drm_property *property) in drm_property_destroy() argument
446 list_for_each_entry_safe(prop_enum, pt, &property->enum_list, head) { in drm_property_destroy()
451 if (property->num_values) in drm_property_destroy()
452 kfree(property->values); in drm_property_destroy()
453 drm_mode_object_unregister(dev, &property->base); in drm_property_destroy()
454 list_del(&property->head); in drm_property_destroy()
455 kfree(property); in drm_property_destroy()
463 struct drm_property *property; in drm_mode_getproperty_ioctl() local
474 property = drm_property_find(dev, file_priv, out_resp->prop_id); in drm_mode_getproperty_ioctl()
475 if (!property) in drm_mode_getproperty_ioctl()
478 strncpy(out_resp->name, property->name, DRM_PROP_NAME_LEN); in drm_mode_getproperty_ioctl()
480 out_resp->flags = property->flags; in drm_mode_getproperty_ioctl()
482 value_count = property->num_values; in drm_mode_getproperty_ioctl()
487 put_user(property->values[i], values_ptr + i)) { in drm_mode_getproperty_ioctl()
496 if (drm_property_type_is(property, DRM_MODE_PROP_ENUM) || in drm_mode_getproperty_ioctl()
497 drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) { in drm_mode_getproperty_ioctl()
498 list_for_each_entry(prop_enum, &property->enum_list, head) { in drm_mode_getproperty_ioctl()
517 * property values. But nothing ever added them to the corresponding in drm_mode_getproperty_ioctl()
519 * read the value for a blob property. It also doesn't make a lot of in drm_mode_getproperty_ioctl()
521 * the property itself. in drm_mode_getproperty_ioctl()
523 if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) in drm_mode_getproperty_ioctl()
544 * drm_property_create_blob - Create new blob property
545 * @dev: DRM device to create property for
549 * Creates a new blob property for a specified DRM device, optionally
551 * data must be filled out before the blob is used as the value of any property.
554 * New blob property with a single reference on success, or an ERR_PTR
598 * drm_property_blob_put - release a blob property reference
599 * @blob: DRM blob property
601 * Releases a reference to a blob property. May free the object.
628 * drm_property_blob_get - acquire blob property reference
629 * @blob: DRM blob property
631 * Acquires a reference to an existing blob property. Returns @blob, which
642 * drm_property_lookup_blob - look up a blob property and take a reference
644 * @id: id of the blob property
646 * If successful, this takes an additional reference to the blob property.
647 * callers need to make sure to eventually unreference the returned property
667 * drm_property_replace_global_blob - replace existing blob property
669 * @replace: location of blob property pointer to be replaced
672 * @obj_holds_id: optional object for property holding blob ID
673 * @prop_holds_id: optional property holding blob ID
676 * This function will replace a global property in the blob list, optionally
677 * updating a property which holds the ID of that property.
680 * property, if specified, will be set to 0.
685 * For example, a drm_connector has a 'PATH' property, which contains the ID
686 * of a blob property with the value of the MST path information. Calling this
689 * base object, and prop_holds_id set to the path property name, will perform
735 * drm_property_replace_blob - replace a blob property
838 /* Ensure the property was actually created by this user. */ in drm_mode_destroyblob_ioctl()
871 * value doesn't become invalid part way through the property update due to
873 * to drm_property_change_valid_put() after the property is set (and the
874 * object to which the property is attached has a chance to take its own
877 bool drm_property_change_valid_get(struct drm_property *property, in drm_property_change_valid_get() argument
882 if (property->flags & DRM_MODE_PROP_IMMUTABLE) in drm_property_change_valid_get()
887 if (drm_property_type_is(property, DRM_MODE_PROP_RANGE)) { in drm_property_change_valid_get()
888 if (value < property->values[0] || value > property->values[1]) in drm_property_change_valid_get()
891 } else if (drm_property_type_is(property, DRM_MODE_PROP_SIGNED_RANGE)) { in drm_property_change_valid_get()
894 if (svalue < U642I64(property->values[0]) || in drm_property_change_valid_get()
895 svalue > U642I64(property->values[1])) in drm_property_change_valid_get()
898 } else if (drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) { in drm_property_change_valid_get()
901 for (i = 0; i < property->num_values; i++) in drm_property_change_valid_get()
902 valid_mask |= (1ULL << property->values[i]); in drm_property_change_valid_get()
904 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) { in drm_property_change_valid_get()
910 blob = drm_property_lookup_blob(property->dev, value); in drm_property_change_valid_get()
917 } else if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) { in drm_property_change_valid_get()
918 /* a zero value for an object property translates to null: */ in drm_property_change_valid_get()
922 *ref = __drm_mode_object_find(property->dev, NULL, value, in drm_property_change_valid_get()
923 property->values[0]); in drm_property_change_valid_get()
927 for (i = 0; i < property->num_values; i++) in drm_property_change_valid_get()
928 if (property->values[i] == value) in drm_property_change_valid_get()
933 void drm_property_change_valid_put(struct drm_property *property, in drm_property_change_valid_put() argument
939 if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) { in drm_property_change_valid_put()
941 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) in drm_property_change_valid_put()