Lines Matching refs:property
44 * property types and ranges.
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;
110 property = kzalloc(sizeof(struct drm_property), GFP_KERNEL);
111 if (!property)
114 property->dev = dev;
117 property->values = kcalloc(num_values, sizeof(uint64_t),
119 if (!property->values)
123 ret = drm_mode_object_add(dev, &property->base, DRM_MODE_OBJECT_PROPERTY);
127 property->flags = flags;
128 property->num_values = num_values;
129 INIT_LIST_HEAD(&property->enum_list);
131 strscpy_pad(property->name, name, DRM_PROP_NAME_LEN);
133 list_add_tail(&property->head, &dev->mode_config.property_list);
135 return property;
137 kfree(property->values);
138 kfree(property);
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;
172 property = drm_property_create(dev, flags, name, num_values);
173 if (!property)
177 ret = drm_property_add_enum(property,
181 drm_property_destroy(dev, property);
186 return property;
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;
222 property = drm_property_create(dev, flags, name, num_values);
223 if (!property)
229 ret = drm_property_add_enum(property,
233 drm_property_destroy(dev, property);
238 return property;
246 struct drm_property *property;
248 property = drm_property_create(dev, flags, name, 2);
249 if (!property)
252 property->values[0] = min;
253 property->values[1] = max;
255 return property;
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;
343 property = drm_property_create(dev, flags, name, 1);
344 if (!property)
347 property->values[0] = type;
349 return property;
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,
399 if (WARN_ON(!drm_property_type_is(property, DRM_MODE_PROP_ENUM) &&
400 !drm_property_type_is(property, DRM_MODE_PROP_BITMASK)))
407 if (WARN_ON(drm_property_type_is(property, DRM_MODE_PROP_BITMASK) &&
411 list_for_each_entry(prop_enum, &property->enum_list, head) {
417 if (WARN_ON(index >= property->num_values))
427 property->values[index] = value;
428 list_add_tail(&prop_enum->head, &property->enum_list);
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)
445 list_for_each_entry_safe(prop_enum, pt, &property->enum_list, head) {
450 if (property->num_values)
451 kfree(property->values);
452 drm_mode_object_unregister(dev, &property->base);
453 list_del(&property->head);
454 kfree(property);
462 struct drm_property *property;
473 property = drm_property_find(dev, file_priv, out_resp->prop_id);
474 if (!property)
477 strscpy_pad(out_resp->name, property->name, DRM_PROP_NAME_LEN);
478 out_resp->flags = property->flags;
480 value_count = property->num_values;
485 put_user(property->values[i], values_ptr + i)) {
494 if (drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
495 drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
496 list_for_each_entry(prop_enum, &property->enum_list, head) {
515 * property values. But nothing ever added them to the corresponding
517 * read the value for a blob property. It also doesn't make a lot of
519 * the property itself.
521 if (drm_property_type_is(property, DRM_MODE_PROP_BLOB))
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. */
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,
938 if (property->flags & DRM_MODE_PROP_IMMUTABLE)
943 if (drm_property_type_is(property, DRM_MODE_PROP_RANGE)) {
944 if (value < property->values[0] || value > property->values[1])
947 } else if (drm_property_type_is(property, DRM_MODE_PROP_SIGNED_RANGE)) {
950 if (svalue < U642I64(property->values[0]) ||
951 svalue > U642I64(property->values[1]))
954 } else if (drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
957 for (i = 0; i < property->num_values; i++)
958 valid_mask |= (1ULL << property->values[i]);
960 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) {
966 blob = drm_property_lookup_blob(property->dev, value);
973 } else if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
974 /* a zero value for an object property translates to null: */
978 *ref = __drm_mode_object_find(property->dev, NULL, value,
979 property->values[0]);
983 for (i = 0; i < property->num_values; i++)
984 if (property->values[i] == value)
989 void drm_property_change_valid_put(struct drm_property *property,
995 if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
997 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB))