Lines Matching refs:property
43 * property types and ranges.
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;
109 property = kzalloc(sizeof(struct drm_property), GFP_KERNEL);
110 if (!property)
113 property->dev = dev;
116 property->values = kcalloc(num_values, sizeof(uint64_t),
118 if (!property->values)
122 ret = drm_mode_object_add(dev, &property->base, DRM_MODE_OBJECT_PROPERTY);
126 property->flags = flags;
127 property->num_values = num_values;
128 INIT_LIST_HEAD(&property->enum_list);
130 strncpy(property->name, name, DRM_PROP_NAME_LEN);
131 property->name[DRM_PROP_NAME_LEN-1] = '\0';
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))
428 property->values[index] = value;
429 list_add_tail(&prop_enum->head, &property->enum_list);
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)
446 list_for_each_entry_safe(prop_enum, pt, &property->enum_list, head) {
451 if (property->num_values)
452 kfree(property->values);
453 drm_mode_object_unregister(dev, &property->base);
454 list_del(&property->head);
455 kfree(property);
463 struct drm_property *property;
474 property = drm_property_find(dev, file_priv, out_resp->prop_id);
475 if (!property)
478 strncpy(out_resp->name, property->name, DRM_PROP_NAME_LEN);
480 out_resp->flags = property->flags;
482 value_count = property->num_values;
487 put_user(property->values[i], values_ptr + i)) {
496 if (drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
497 drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
498 list_for_each_entry(prop_enum, &property->enum_list, head) {
517 * property values. But nothing ever added them to the corresponding
519 * read the value for a blob property. It also doesn't make a lot of
521 * the property itself.
523 if (drm_property_type_is(property, DRM_MODE_PROP_BLOB))
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. */
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,
882 if (property->flags & DRM_MODE_PROP_IMMUTABLE)
887 if (drm_property_type_is(property, DRM_MODE_PROP_RANGE)) {
888 if (value < property->values[0] || value > property->values[1])
891 } else if (drm_property_type_is(property, DRM_MODE_PROP_SIGNED_RANGE)) {
894 if (svalue < U642I64(property->values[0]) ||
895 svalue > U642I64(property->values[1]))
898 } else if (drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
901 for (i = 0; i < property->num_values; i++)
902 valid_mask |= (1ULL << property->values[i]);
904 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) {
910 blob = drm_property_lookup_blob(property->dev, value);
917 } else if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
918 /* a zero value for an object property translates to null: */
922 *ref = __drm_mode_object_find(property->dev, NULL, value,
923 property->values[0]);
927 for (i = 0; i < property->num_values; i++)
928 if (property->values[i] == value)
933 void drm_property_change_valid_put(struct drm_property *property,
939 if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
941 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB))