Lines Matching defs:property
49 * property types and ranges.
55 * Property values are only 64bit. To support bigger piles of data (like gamma
56 * tables, color correction matrices or large structures) a property can instead
60 * per-object mapping from those names to the property ID used in the atomic
61 * IOCTL and in the get/set property IOCTL.
88 * drm_property_create - create a new property type
90 * @flags: flags specifying the property type
91 * @name: name of the property
94 * This creates a new generic drm property which can then be attached to a drm
95 * object with drm_object_attach_property(). The returned property object must
100 * A pointer to the newly created property on success, NULL on failure.
106 struct drm_property *property = NULL;
115 property = kzalloc(sizeof(struct drm_property), GFP_KERNEL);
116 if (!property)
119 property->dev = dev;
122 property->values = kcalloc(num_values, sizeof(uint64_t),
124 if (!property->values)
128 ret = drm_mode_object_add(dev, &property->base, DRM_MODE_OBJECT_PROPERTY);
132 property->flags = flags;
133 property->num_values = num_values;
134 INIT_LIST_HEAD(&property->enum_list);
136 strncpy(property->name, name, DRM_PROP_NAME_LEN);
137 property->name[DRM_PROP_NAME_LEN-1] = '\0';
139 list_add_tail(&property->head, &dev->mode_config.property_list);
141 return property;
143 kfree(property->values);
144 kfree(property);
150 * drm_property_create_enum - create a new enumeration property type
152 * @flags: flags specifying the property type
153 * @name: name of the property
154 * @props: enumeration lists with property values
157 * This creates a new generic drm property which can then be attached to a drm
158 * object with drm_object_attach_property(). The returned property object must
166 * A pointer to the newly created property on success, NULL on failure.
173 struct drm_property *property;
178 property = drm_property_create(dev, flags, name, num_values);
179 if (!property)
183 ret = drm_property_add_enum(property,
187 drm_property_destroy(dev, property);
192 return property;
197 * drm_property_create_bitmask - create a new bitmask property type
199 * @flags: flags specifying the property type
200 * @name: name of the property
201 * @props: enumeration lists with property bitflags
205 * This creates a new bitmask drm property which can then be attached to a drm
206 * object with drm_object_attach_property(). The returned property object must
211 * or'ed together combination of the predefined property bitflag values
214 * A pointer to the newly created property on success, NULL on failure.
222 struct drm_property *property;
228 property = drm_property_create(dev, flags, name, num_values);
229 if (!property)
235 ret = drm_property_add_enum(property,
239 drm_property_destroy(dev, property);
244 return property;
252 struct drm_property *property;
254 property = drm_property_create(dev, flags, name, 2);
255 if (!property)
258 property->values[0] = min;
259 property->values[1] = max;
261 return property;
265 * drm_property_create_range - create a new unsigned ranged property type
267 * @flags: flags specifying the property type
268 * @name: name of the property
269 * @min: minimum value of the property
270 * @max: maximum value of the property
272 * This creates a new generic drm property which can then be attached to a drm
273 * object with drm_object_attach_property(). The returned property object must
281 * A pointer to the newly created property on success, NULL on failure.
293 * drm_property_create_signed_range - create a new signed ranged property type
295 * @flags: flags specifying the property type
296 * @name: name of the property
297 * @min: minimum value of the property
298 * @max: maximum value of the property
300 * This creates a new generic drm property which can then be attached to a drm
301 * object with drm_object_attach_property(). The returned property object must
309 * A pointer to the newly created property on success, NULL on failure.
321 * drm_property_create_object - create a new object property type
323 * @flags: flags specifying the property type
324 * @name: name of the property
327 * This creates a new generic drm property which can then be attached to a drm
328 * object with drm_object_attach_property(). The returned property object must
332 * Userspace is only allowed to set this to any property value of the given
336 * A pointer to the newly created property on success, NULL on failure.
342 struct drm_property *property;
349 property = drm_property_create(dev, flags, name, 1);
350 if (!property)
353 property->values[0] = type;
355 return property;
360 * drm_property_create_bool - create a new boolean property type
362 * @flags: flags specifying the property type
363 * @name: name of the property
365 * This creates a new generic drm property which can then be attached to a drm
366 * object with drm_object_attach_property(). The returned property object must
370 * This is implemented as a ranged property with only {0, 1} as valid values.
373 * A pointer to the newly created property on success, NULL on failure.
383 * drm_property_add_enum - add a possible value to an enumeration property
384 * @property: enumeration property to change
388 * This functions adds enumerations to a property.
391 * to directly create the property with all enumerations already attached.
396 int drm_property_add_enum(struct drm_property *property,
405 if (WARN_ON(!drm_property_type_is(property, DRM_MODE_PROP_ENUM) &&
406 !drm_property_type_is(property, DRM_MODE_PROP_BITMASK)))
413 if (WARN_ON(drm_property_type_is(property, DRM_MODE_PROP_BITMASK) &&
417 list_for_each_entry(prop_enum, &property->enum_list, head) {
423 if (WARN_ON(index >= property->num_values))
434 property->values[index] = value;
435 list_add_tail(&prop_enum->head, &property->enum_list);
441 * drm_property_destroy - destroy a drm property
443 * @property: property to destry
445 * This function frees a property including any attached resources like
448 void drm_property_destroy(struct drm_device *dev, struct drm_property *property)
452 list_for_each_entry_safe(prop_enum, pt, &property->enum_list, head) {
457 if (property->num_values)
458 kfree(property->values);
459 drm_mode_object_unregister(dev, &property->base);
460 list_del(&property->head);
461 kfree(property);
469 struct drm_property *property;
480 property = drm_property_find(dev, file_priv, out_resp->prop_id);
481 if (!property)
484 strncpy(out_resp->name, property->name, DRM_PROP_NAME_LEN);
486 out_resp->flags = property->flags;
488 value_count = property->num_values;
493 put_user(property->values[i], values_ptr + i)) {
502 if (drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
503 drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
504 list_for_each_entry(prop_enum, &property->enum_list, head) {
523 * property values. But nothing ever added them to the corresponding
525 property. It also doesn't make a lot of
527 * the property itself.
529 if (drm_property_type_is(property, DRM_MODE_PROP_BLOB))
550 * drm_property_create_blob - Create new blob property
551 * @dev: DRM device to create property for
555 * Creates a new blob property for a specified DRM device, optionally
557 * data must be filled out before the blob is used as the value of any property.
560 * New blob property with a single reference on success, or an ERR_PTR
604 * drm_property_blob_put - release a blob property reference
605 * @blob: DRM blob property
607 * Releases a reference to a blob property. May free the object.
634 * drm_property_blob_get - acquire blob property reference
635 * @blob: DRM blob property
637 * Acquires a reference to an existing blob property. Returns @blob, which
648 * drm_property_lookup_blob - look up a blob property and take a reference
650 * @id: id of the blob property
652 * If successful, this takes an additional reference to the blob property.
653 * callers need to make sure to eventually unreference the returned property
673 * drm_property_replace_global_blob - replace existing blob property
675 * @replace: location of blob property pointer to be replaced
678 * @obj_holds_id: optional object for property holding blob ID
679 * @prop_holds_id: optional property holding blob ID
682 * This function will replace a global property in the blob list, optionally
683 * updating a property which holds the ID of that property.
686 * property, if specified, will be set to 0.
691 * For example, a drm_connector has a 'PATH' property, which contains the ID
692 * of a blob property with the value of the MST path information. Calling this
695 * base object, and prop_holds_id set to the path property name, will perform
741 * drm_property_replace_blob - replace a blob property
844 /* Ensure the property was actually created by this user. */
877 * value doesn't become invalid part way through the property update due to
879 * to drm_property_change_valid_put() after the property is set (and the
880 * object to which the property is attached has a chance to take its own
883 bool drm_property_change_valid_get(struct drm_property *property,
888 if (property->flags & DRM_MODE_PROP_IMMUTABLE)
893 if (drm_property_type_is(property, DRM_MODE_PROP_RANGE)) {
894 if (value < property->values[0] || value > property->values[1])
897 } else if (drm_property_type_is(property, DRM_MODE_PROP_SIGNED_RANGE)) {
900 if (svalue < U642I64(property->values[0]) ||
901 svalue > U642I64(property->values[1]))
904 } else if (drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
907 for (i = 0; i < property->num_values; i++)
908 valid_mask |= (1ULL << property->values[i]);
910 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) {
916 blob = drm_property_lookup_blob(property->dev, value);
923 } else if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
924 /* a zero value for an object property translates to null: */
928 *ref = __drm_mode_object_find(property->dev, NULL, value,
929 property->values[0]);
933 for (i = 0; i < property->num_values; i++)
934 if (property->values[i] == value)
939 void drm_property_change_valid_put(struct drm_property *property,
945 if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
947 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB))