2 * Copyright (c) 2016 Intel Corporation
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that copyright
7 * notice and this permission notice appear in supporting documentation, and
8 * that the name of the copyright holders not be used in advertising or
9 * publicity pertaining to distribution of the software without specific,
10 * written prior permission. The copyright holders make no representations
11 * about the suitability of this software for any purpose. It is provided "as
12 * is" without express or implied warranty.
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
23 #include <linux/export.h>
25 #include <drm/drm_property.h>
27 #include "drm_crtc_internal.h"
32 * Properties as represented by &drm_property are used to extend the modeset
33 * interface exposed to userspace. For the atomic modeset IOCTL properties are
34 * even the only way to transport metadata about the desired new modeset
35 * configuration from userspace to the kernel. Properties have a well-defined
36 * value range, which is enforced by the drm core. See the documentation of the
37 * flags member of struct &drm_property for an overview of the different
38 * property types and ranges.
40 * Properties don't store the current value directly, but need to be
41 * instatiated by attaching them to a &drm_mode_object with
42 * drm_object_attach_property().
44 * Property values are only 64bit. To support bigger piles of data (like gamma
45 * tables, color correction matrizes or large structures) a property can instead
46 * point at a &drm_property_blob with that additional data
48 * Properties are defined by their symbolic name, userspace must keep a
49 * per-object mapping from those names to the property ID used in the atomic
50 * IOCTL and in the get/set property IOCTL.
53 static bool drm_property_type_valid(struct drm_property *property)
55 if (property->flags & DRM_MODE_PROP_EXTENDED_TYPE)
56 return !(property->flags & DRM_MODE_PROP_LEGACY_TYPE);
57 return !!(property->flags & DRM_MODE_PROP_LEGACY_TYPE);
61 * drm_property_create - create a new property type
63 * @flags: flags specifying the property type
64 * @name: name of the property
65 * @num_values: number of pre-defined values
67 * This creates a new generic drm property which can then be attached to a drm
68 * object with drm_object_attach_property(). The returned property object must
69 * be freed with drm_property_destroy(), which is done automatically when
70 * calling drm_mode_config_cleanup().
73 * A pointer to the newly created property on success, NULL on failure.
75 struct drm_property *drm_property_create(struct drm_device *dev, int flags,
76 const char *name, int num_values)
78 struct drm_property *property = NULL;
81 property = kzalloc(sizeof(struct drm_property), GFP_KERNEL);
88 property->values = kcalloc(num_values, sizeof(uint64_t),
90 if (!property->values)
94 ret = drm_mode_object_get(dev, &property->base, DRM_MODE_OBJECT_PROPERTY);
98 property->flags = flags;
99 property->num_values = num_values;
100 INIT_LIST_HEAD(&property->enum_list);
103 strncpy(property->name, name, DRM_PROP_NAME_LEN);
104 property->name[DRM_PROP_NAME_LEN-1] = '\0';
107 list_add_tail(&property->head, &dev->mode_config.property_list);
109 WARN_ON(!drm_property_type_valid(property));
113 kfree(property->values);
117 EXPORT_SYMBOL(drm_property_create);
120 * drm_property_create_enum - create a new enumeration property type
122 * @flags: flags specifying the property type
123 * @name: name of the property
124 * @props: enumeration lists with property values
125 * @num_values: number of pre-defined values
127 * This creates a new generic drm property which can then be attached to a drm
128 * object with drm_object_attach_property(). The returned property object must
129 * be freed with drm_property_destroy(), which is done automatically when
130 * calling drm_mode_config_cleanup().
132 * Userspace is only allowed to set one of the predefined values for enumeration
136 * A pointer to the newly created property on success, NULL on failure.
138 struct drm_property *drm_property_create_enum(struct drm_device *dev, int flags,
140 const struct drm_prop_enum_list *props,
143 struct drm_property *property;
146 flags |= DRM_MODE_PROP_ENUM;
148 property = drm_property_create(dev, flags, name, num_values);
152 for (i = 0; i < num_values; i++) {
153 ret = drm_property_add_enum(property, i,
157 drm_property_destroy(dev, property);
164 EXPORT_SYMBOL(drm_property_create_enum);
167 * drm_property_create_bitmask - create a new bitmask property type
169 * @flags: flags specifying the property type
170 * @name: name of the property
171 * @props: enumeration lists with property bitflags
172 * @num_props: size of the @props array
173 * @supported_bits: bitmask of all supported enumeration values
175 * This creates a new bitmask drm property which can then be attached to a drm
176 * object with drm_object_attach_property(). The returned property object must
177 * be freed with drm_property_destroy(), which is done automatically when
178 * calling drm_mode_config_cleanup().
180 * Compared to plain enumeration properties userspace is allowed to set any
181 * or'ed together combination of the predefined property bitflag values
184 * A pointer to the newly created property on success, NULL on failure.
186 struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
187 int flags, const char *name,
188 const struct drm_prop_enum_list *props,
190 uint64_t supported_bits)
192 struct drm_property *property;
193 int i, ret, index = 0;
194 int num_values = hweight64(supported_bits);
196 flags |= DRM_MODE_PROP_BITMASK;
198 property = drm_property_create(dev, flags, name, num_values);
201 for (i = 0; i < num_props; i++) {
202 if (!(supported_bits & (1ULL << props[i].type)))
205 if (WARN_ON(index >= num_values)) {
206 drm_property_destroy(dev, property);
210 ret = drm_property_add_enum(property, index++,
214 drm_property_destroy(dev, property);
221 EXPORT_SYMBOL(drm_property_create_bitmask);
223 static struct drm_property *property_create_range(struct drm_device *dev,
224 int flags, const char *name,
225 uint64_t min, uint64_t max)
227 struct drm_property *property;
229 property = drm_property_create(dev, flags, name, 2);
233 property->values[0] = min;
234 property->values[1] = max;
240 * drm_property_create_range - create a new unsigned ranged property type
242 * @flags: flags specifying the property type
243 * @name: name of the property
244 * @min: minimum value of the property
245 * @max: maximum value of the property
247 * This creates a new generic drm property which can then be attached to a drm
248 * object with drm_object_attach_property(). The returned property object must
249 * be freed with drm_property_destroy(), which is done automatically when
250 * calling drm_mode_config_cleanup().
252 * Userspace is allowed to set any unsigned integer value in the (min, max)
256 * A pointer to the newly created property on success, NULL on failure.
258 struct drm_property *drm_property_create_range(struct drm_device *dev, int flags,
260 uint64_t min, uint64_t max)
262 return property_create_range(dev, DRM_MODE_PROP_RANGE | flags,
265 EXPORT_SYMBOL(drm_property_create_range);
268 * drm_property_create_signed_range - create a new signed ranged property type
270 * @flags: flags specifying the property type
271 * @name: name of the property
272 * @min: minimum value of the property
273 * @max: maximum value of the property
275 * This creates a new generic drm property which can then be attached to a drm
276 * object with drm_object_attach_property(). The returned property object must
277 * be freed with drm_property_destroy(), which is done automatically when
278 * calling drm_mode_config_cleanup().
280 * Userspace is allowed to set any signed integer value in the (min, max)
284 * A pointer to the newly created property on success, NULL on failure.
286 struct drm_property *drm_property_create_signed_range(struct drm_device *dev,
287 int flags, const char *name,
288 int64_t min, int64_t max)
290 return property_create_range(dev, DRM_MODE_PROP_SIGNED_RANGE | flags,
291 name, I642U64(min), I642U64(max));
293 EXPORT_SYMBOL(drm_property_create_signed_range);
296 * drm_property_create_object - create a new object property type
298 * @flags: flags specifying the property type
299 * @name: name of the property
300 * @type: object type from DRM_MODE_OBJECT_* defines
302 * This creates a new generic drm property which can then be attached to a drm
303 * object with drm_object_attach_property(). The returned property object must
304 * be freed with drm_property_destroy(), which is done automatically when
305 * calling drm_mode_config_cleanup().
307 * Userspace is only allowed to set this to any property value of the given
308 * @type. Only useful for atomic properties, which is enforced.
311 * A pointer to the newly created property on success, NULL on failure.
313 struct drm_property *drm_property_create_object(struct drm_device *dev,
314 int flags, const char *name,
317 struct drm_property *property;
319 flags |= DRM_MODE_PROP_OBJECT;
321 if (WARN_ON(!(flags & DRM_MODE_PROP_ATOMIC)))
324 property = drm_property_create(dev, flags, name, 1);
328 property->values[0] = type;
332 EXPORT_SYMBOL(drm_property_create_object);
335 * drm_property_create_bool - create a new boolean property type
337 * @flags: flags specifying the property type
338 * @name: name of the property
340 * This creates a new generic drm property which can then be attached to a drm
341 * object with drm_object_attach_property(). The returned property object must
342 * be freed with drm_property_destroy(), which is done automatically when
343 * calling drm_mode_config_cleanup().
345 * This is implemented as a ranged property with only {0, 1} as valid values.
348 * A pointer to the newly created property on success, NULL on failure.
350 struct drm_property *drm_property_create_bool(struct drm_device *dev, int flags,
353 return drm_property_create_range(dev, flags, name, 0, 1);
355 EXPORT_SYMBOL(drm_property_create_bool);
358 * drm_property_add_enum - add a possible value to an enumeration property
359 * @property: enumeration property to change
360 * @index: index of the new enumeration
361 * @value: value of the new enumeration
362 * @name: symbolic name of the new enumeration
364 * This functions adds enumerations to a property.
366 * It's use is deprecated, drivers should use one of the more specific helpers
367 * to directly create the property with all enumerations already attached.
370 * Zero on success, error code on failure.
372 int drm_property_add_enum(struct drm_property *property, int index,
373 uint64_t value, const char *name)
375 struct drm_property_enum *prop_enum;
377 if (!(drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
378 drm_property_type_is(property, DRM_MODE_PROP_BITMASK)))
382 * Bitmask enum properties have the additional constraint of values
385 if (drm_property_type_is(property, DRM_MODE_PROP_BITMASK) &&
389 if (!list_empty(&property->enum_list)) {
390 list_for_each_entry(prop_enum, &property->enum_list, head) {
391 if (prop_enum->value == value) {
392 strncpy(prop_enum->name, name, DRM_PROP_NAME_LEN);
393 prop_enum->name[DRM_PROP_NAME_LEN-1] = '\0';
399 prop_enum = kzalloc(sizeof(struct drm_property_enum), GFP_KERNEL);
403 strncpy(prop_enum->name, name, DRM_PROP_NAME_LEN);
404 prop_enum->name[DRM_PROP_NAME_LEN-1] = '\0';
405 prop_enum->value = value;
407 property->values[index] = value;
408 list_add_tail(&prop_enum->head, &property->enum_list);
411 EXPORT_SYMBOL(drm_property_add_enum);
414 * drm_property_destroy - destroy a drm property
416 * @property: property to destry
418 * This function frees a property including any attached resources like
419 * enumeration values.
421 void drm_property_destroy(struct drm_device *dev, struct drm_property *property)
423 struct drm_property_enum *prop_enum, *pt;
425 list_for_each_entry_safe(prop_enum, pt, &property->enum_list, head) {
426 list_del(&prop_enum->head);
430 if (property->num_values)
431 kfree(property->values);
432 drm_mode_object_unregister(dev, &property->base);
433 list_del(&property->head);
436 EXPORT_SYMBOL(drm_property_destroy);
438 int drm_mode_getproperty_ioctl(struct drm_device *dev,
439 void *data, struct drm_file *file_priv)
441 struct drm_mode_get_property *out_resp = data;
442 struct drm_property *property;
447 struct drm_property_enum *prop_enum;
448 struct drm_mode_property_enum __user *enum_ptr;
449 uint64_t __user *values_ptr;
451 if (!drm_core_check_feature(dev, DRIVER_MODESET))
454 drm_modeset_lock_all(dev);
455 property = drm_property_find(dev, out_resp->prop_id);
461 if (drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
462 drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
463 list_for_each_entry(prop_enum, &property->enum_list, head)
467 value_count = property->num_values;
469 strncpy(out_resp->name, property->name, DRM_PROP_NAME_LEN);
470 out_resp->name[DRM_PROP_NAME_LEN-1] = 0;
471 out_resp->flags = property->flags;
473 if ((out_resp->count_values >= value_count) && value_count) {
474 values_ptr = (uint64_t __user *)(unsigned long)out_resp->values_ptr;
475 for (i = 0; i < value_count; i++) {
476 if (copy_to_user(values_ptr + i, &property->values[i], sizeof(uint64_t))) {
482 out_resp->count_values = value_count;
484 if (drm_property_type_is(property, DRM_MODE_PROP_ENUM) ||
485 drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
486 if ((out_resp->count_enum_blobs >= enum_count) && enum_count) {
488 enum_ptr = (struct drm_mode_property_enum __user *)(unsigned long)out_resp->enum_blob_ptr;
489 list_for_each_entry(prop_enum, &property->enum_list, head) {
491 if (copy_to_user(&enum_ptr[copied].value, &prop_enum->value, sizeof(uint64_t))) {
496 if (copy_to_user(&enum_ptr[copied].name,
497 &prop_enum->name, DRM_PROP_NAME_LEN)) {
504 out_resp->count_enum_blobs = enum_count;
508 * NOTE: The idea seems to have been to use this to read all the blob
509 * property values. But nothing ever added them to the corresponding
510 * list, userspace always used the special-purpose get_blob ioctl to
511 * read the value for a blob property. It also doesn't make a lot of
512 * sense to return values here when everything else is just metadata for
513 * the property itself.
515 if (drm_property_type_is(property, DRM_MODE_PROP_BLOB))
516 out_resp->count_enum_blobs = 0;
518 drm_modeset_unlock_all(dev);
522 static void drm_property_free_blob(struct kref *kref)
524 struct drm_property_blob *blob =
525 container_of(kref, struct drm_property_blob, base.refcount);
527 mutex_lock(&blob->dev->mode_config.blob_lock);
528 list_del(&blob->head_global);
529 mutex_unlock(&blob->dev->mode_config.blob_lock);
531 drm_mode_object_unregister(blob->dev, &blob->base);
537 * drm_property_create_blob - Create new blob property
538 * @dev: DRM device to create property for
539 * @length: Length to allocate for blob data
540 * @data: If specified, copies data into blob
542 * Creates a new blob property for a specified DRM device, optionally
543 * copying data. Note that blob properties are meant to be invariant, hence the
544 * data must be filled out before the blob is used as the value of any property.
547 * New blob property with a single reference on success, or an ERR_PTR
550 struct drm_property_blob *
551 drm_property_create_blob(struct drm_device *dev, size_t length,
554 struct drm_property_blob *blob;
557 if (!length || length > ULONG_MAX - sizeof(struct drm_property_blob))
558 return ERR_PTR(-EINVAL);
560 blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL);
562 return ERR_PTR(-ENOMEM);
564 /* This must be explicitly initialised, so we can safely call list_del
565 * on it in the removal handler, even if it isn't in a file list. */
566 INIT_LIST_HEAD(&blob->head_file);
567 blob->length = length;
571 memcpy(blob->data, data, length);
573 ret = drm_mode_object_get_reg(dev, &blob->base, DRM_MODE_OBJECT_BLOB,
574 true, drm_property_free_blob);
577 return ERR_PTR(-EINVAL);
580 mutex_lock(&dev->mode_config.blob_lock);
581 list_add_tail(&blob->head_global,
582 &dev->mode_config.property_blob_list);
583 mutex_unlock(&dev->mode_config.blob_lock);
587 EXPORT_SYMBOL(drm_property_create_blob);
590 * drm_property_unreference_blob - Unreference a blob property
591 * @blob: Pointer to blob property
593 * Drop a reference on a blob property. May free the object.
595 void drm_property_unreference_blob(struct drm_property_blob *blob)
600 drm_mode_object_unreference(&blob->base);
602 EXPORT_SYMBOL(drm_property_unreference_blob);
604 void drm_property_destroy_user_blobs(struct drm_device *dev,
605 struct drm_file *file_priv)
607 struct drm_property_blob *blob, *bt;
610 * When the file gets released that means no one else can access the
611 * blob list any more, so no need to grab dev->blob_lock.
613 list_for_each_entry_safe(blob, bt, &file_priv->blobs, head_file) {
614 list_del_init(&blob->head_file);
615 drm_property_unreference_blob(blob);
620 * drm_property_reference_blob - Take a reference on an existing property
621 * @blob: Pointer to blob property
623 * Take a new reference on an existing blob property. Returns @blob, which
624 * allows this to be used as a shorthand in assignments.
626 struct drm_property_blob *drm_property_reference_blob(struct drm_property_blob *blob)
628 drm_mode_object_reference(&blob->base);
631 EXPORT_SYMBOL(drm_property_reference_blob);
634 * drm_property_lookup_blob - look up a blob property and take a reference
636 * @id: id of the blob property
638 * If successful, this takes an additional reference to the blob property.
639 * callers need to make sure to eventually unreference the returned property
640 * again, using @drm_property_unreference_blob.
643 * NULL on failure, pointer to the blob on success.
645 struct drm_property_blob *drm_property_lookup_blob(struct drm_device *dev,
648 struct drm_mode_object *obj;
649 struct drm_property_blob *blob = NULL;
651 obj = __drm_mode_object_find(dev, id, DRM_MODE_OBJECT_BLOB);
653 blob = obj_to_blob(obj);
656 EXPORT_SYMBOL(drm_property_lookup_blob);
659 * drm_property_replace_global_blob - replace existing blob property
661 * @replace: location of blob property pointer to be replaced
662 * @length: length of data for new blob, or 0 for no data
663 * @data: content for new blob, or NULL for no data
664 * @obj_holds_id: optional object for property holding blob ID
665 * @prop_holds_id: optional property holding blob ID
666 * @return 0 on success or error on failure
668 * This function will replace a global property in the blob list, optionally
669 * updating a property which holds the ID of that property.
671 * If length is 0 or data is NULL, no new blob will be created, and the holding
672 * property, if specified, will be set to 0.
674 * Access to the replace pointer is assumed to be protected by the caller, e.g.
675 * by holding the relevant modesetting object lock for its parent.
677 * For example, a drm_connector has a 'PATH' property, which contains the ID
678 * of a blob property with the value of the MST path information. Calling this
679 * function with replace pointing to the connector's path_blob_ptr, length and
680 * data set for the new path information, obj_holds_id set to the connector's
681 * base object, and prop_holds_id set to the path property name, will perform
682 * a completely atomic update. The access to path_blob_ptr is protected by the
683 * caller holding a lock on the connector.
685 int drm_property_replace_global_blob(struct drm_device *dev,
686 struct drm_property_blob **replace,
689 struct drm_mode_object *obj_holds_id,
690 struct drm_property *prop_holds_id)
692 struct drm_property_blob *new_blob = NULL;
693 struct drm_property_blob *old_blob = NULL;
696 WARN_ON(replace == NULL);
700 if (length && data) {
701 new_blob = drm_property_create_blob(dev, length, data);
702 if (IS_ERR(new_blob))
703 return PTR_ERR(new_blob);
707 ret = drm_object_property_set_value(obj_holds_id,
710 new_blob->base.id : 0);
715 drm_property_unreference_blob(old_blob);
721 drm_property_unreference_blob(new_blob);
724 EXPORT_SYMBOL(drm_property_replace_global_blob);
726 int drm_mode_getblob_ioctl(struct drm_device *dev,
727 void *data, struct drm_file *file_priv)
729 struct drm_mode_get_blob *out_resp = data;
730 struct drm_property_blob *blob;
733 if (!drm_core_check_feature(dev, DRIVER_MODESET))
736 blob = drm_property_lookup_blob(dev, out_resp->blob_id);
740 if (out_resp->length == blob->length) {
741 if (copy_to_user(u64_to_user_ptr(out_resp->data),
748 out_resp->length = blob->length;
750 drm_property_unreference_blob(blob);
755 int drm_mode_createblob_ioctl(struct drm_device *dev,
756 void *data, struct drm_file *file_priv)
758 struct drm_mode_create_blob *out_resp = data;
759 struct drm_property_blob *blob;
762 if (!drm_core_check_feature(dev, DRIVER_MODESET))
765 blob = drm_property_create_blob(dev, out_resp->length, NULL);
767 return PTR_ERR(blob);
769 if (copy_from_user(blob->data,
770 u64_to_user_ptr(out_resp->data),
776 /* Dropping the lock between create_blob and our access here is safe
777 * as only the same file_priv can remove the blob; at this point, it is
778 * not associated with any file_priv. */
779 mutex_lock(&dev->mode_config.blob_lock);
780 out_resp->blob_id = blob->base.id;
781 list_add_tail(&blob->head_file, &file_priv->blobs);
782 mutex_unlock(&dev->mode_config.blob_lock);
787 drm_property_unreference_blob(blob);
791 int drm_mode_destroyblob_ioctl(struct drm_device *dev,
792 void *data, struct drm_file *file_priv)
794 struct drm_mode_destroy_blob *out_resp = data;
795 struct drm_property_blob *blob = NULL, *bt;
799 if (!drm_core_check_feature(dev, DRIVER_MODESET))
802 blob = drm_property_lookup_blob(dev, out_resp->blob_id);
806 mutex_lock(&dev->mode_config.blob_lock);
807 /* Ensure the property was actually created by this user. */
808 list_for_each_entry(bt, &file_priv->blobs, head_file) {
820 /* We must drop head_file here, because we may not be the last
821 * reference on the blob. */
822 list_del_init(&blob->head_file);
823 mutex_unlock(&dev->mode_config.blob_lock);
825 /* One reference from lookup, and one from the filp. */
826 drm_property_unreference_blob(blob);
827 drm_property_unreference_blob(blob);
832 mutex_unlock(&dev->mode_config.blob_lock);
833 drm_property_unreference_blob(blob);
838 /* Some properties could refer to dynamic refcnt'd objects, or things that
839 * need special locking to handle lifetime issues (ie. to ensure the prop
840 * value doesn't become invalid part way through the property update due to
841 * race). The value returned by reference via 'obj' should be passed back
842 * to drm_property_change_valid_put() after the property is set (and the
843 * object to which the property is attached has a chance to take it's own
846 bool drm_property_change_valid_get(struct drm_property *property,
847 uint64_t value, struct drm_mode_object **ref)
851 if (property->flags & DRM_MODE_PROP_IMMUTABLE)
856 if (drm_property_type_is(property, DRM_MODE_PROP_RANGE)) {
857 if (value < property->values[0] || value > property->values[1])
860 } else if (drm_property_type_is(property, DRM_MODE_PROP_SIGNED_RANGE)) {
861 int64_t svalue = U642I64(value);
863 if (svalue < U642I64(property->values[0]) ||
864 svalue > U642I64(property->values[1]))
867 } else if (drm_property_type_is(property, DRM_MODE_PROP_BITMASK)) {
868 uint64_t valid_mask = 0;
870 for (i = 0; i < property->num_values; i++)
871 valid_mask |= (1ULL << property->values[i]);
872 return !(value & ~valid_mask);
873 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB)) {
874 struct drm_property_blob *blob;
879 blob = drm_property_lookup_blob(property->dev, value);
886 } else if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
887 /* a zero value for an object property translates to null: */
891 *ref = __drm_mode_object_find(property->dev, value,
892 property->values[0]);
896 for (i = 0; i < property->num_values; i++)
897 if (property->values[i] == value)
902 void drm_property_change_valid_put(struct drm_property *property,
903 struct drm_mode_object *ref)
908 if (drm_property_type_is(property, DRM_MODE_PROP_OBJECT)) {
909 drm_mode_object_unreference(ref);
910 } else if (drm_property_type_is(property, DRM_MODE_PROP_BLOB))
911 drm_property_unreference_blob(obj_to_blob(ref));