Lines Matching +full:bool +full:- +full:property

40 			  uint32_t obj_type, bool register_obj,  in __drm_mode_object_add()
45 WARN_ON(!dev->driver->load && dev->registered && !obj_free_cb); in __drm_mode_object_add()
47 mutex_lock(&dev->mode_config.idr_mutex); in __drm_mode_object_add()
48 ret = idr_alloc(&dev->mode_config.object_idr, register_obj ? obj : NULL, in __drm_mode_object_add()
55 obj->id = ret; in __drm_mode_object_add()
56 obj->type = obj_type; in __drm_mode_object_add()
58 obj->free_cb = obj_free_cb; in __drm_mode_object_add()
59 kref_init(&obj->refcount); in __drm_mode_object_add()
62 mutex_unlock(&dev->mode_config.idr_mutex); in __drm_mode_object_add()
68 * drm_mode_object_add - allocate a new modeset identifier
88 mutex_lock(&dev->mode_config.idr_mutex); in drm_mode_object_register()
89 idr_replace(&dev->mode_config.object_idr, obj, obj->id); in drm_mode_object_register()
90 mutex_unlock(&dev->mode_config.idr_mutex); in drm_mode_object_register()
94 * drm_mode_object_unregister - free a modeset identifier
107 WARN_ON(!dev->driver->load && dev->registered && !object->free_cb); in drm_mode_object_unregister()
109 mutex_lock(&dev->mode_config.idr_mutex); in drm_mode_object_unregister()
110 if (object->id) { in drm_mode_object_unregister()
111 idr_remove(&dev->mode_config.object_idr, object->id); in drm_mode_object_unregister()
112 object->id = 0; in drm_mode_object_unregister()
114 mutex_unlock(&dev->mode_config.idr_mutex); in drm_mode_object_unregister()
118 * drm_mode_object_lease_required - check types which must be leased to be used
124 bool drm_mode_object_lease_required(uint32_t type) in drm_mode_object_lease_required()
142 mutex_lock(&dev->mode_config.idr_mutex); in __drm_mode_object_find()
143 obj = idr_find(&dev->mode_config.object_idr, id); in __drm_mode_object_find()
144 if (obj && type != DRM_MODE_OBJECT_ANY && obj->type != type) in __drm_mode_object_find()
146 if (obj && obj->id != id) in __drm_mode_object_find()
149 if (obj && drm_mode_object_lease_required(obj->type) && in __drm_mode_object_find()
150 !_drm_lease_held(file_priv, obj->id)) { in __drm_mode_object_find()
155 if (obj && obj->free_cb) { in __drm_mode_object_find()
156 if (!kref_get_unless_zero(&obj->refcount)) in __drm_mode_object_find()
159 mutex_unlock(&dev->mode_config.idr_mutex); in __drm_mode_object_find()
165 * drm_mode_object_find - look up a drm object with static lifetime
187 * drm_mode_object_put - release a mode object reference
191 * object. It is a no-op on any other object. This is used to drop references
196 if (obj->free_cb) { in drm_mode_object_put()
197 DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, kref_read(&obj->refcount)); in drm_mode_object_put()
198 kref_put(&obj->refcount, obj->free_cb); in drm_mode_object_put()
204 * drm_mode_object_get - acquire a mode object reference
208 * object. It is a no-op on any other object. References should be dropped again
213 if (obj->free_cb) { in drm_mode_object_get()
214 DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, kref_read(&obj->refcount)); in drm_mode_object_get()
215 kref_get(&obj->refcount); in drm_mode_object_get()
221 * drm_object_attach_property - attach a property to a modeset object
223 * @property: property to attach
224 * @init_val: initial value of the property
226 * This attaches the given property to the modeset object with the given initial
234 struct drm_property *property, in drm_object_attach_property() argument
237 int count = obj->properties->count; in drm_object_attach_property()
238 struct drm_device *dev = property->dev; in drm_object_attach_property()
241 if (obj->type == DRM_MODE_OBJECT_CONNECTOR) { in drm_object_attach_property()
244 WARN_ON(!dev->driver->load && in drm_object_attach_property()
245 connector->registration_state == DRM_CONNECTOR_REGISTERED); in drm_object_attach_property()
247 WARN_ON(!dev->driver->load && dev->registered); in drm_object_attach_property()
251 WARN(1, "Failed to attach object property (type: 0x%x). Please " in drm_object_attach_property()
254 obj->type); in drm_object_attach_property()
258 obj->properties->properties[count] = property; in drm_object_attach_property()
259 obj->properties->values[count] = init_val; in drm_object_attach_property()
260 obj->properties->count++; in drm_object_attach_property()
265 * drm_object_property_set_value - set the value of a property
266 * @obj: drm mode object to set property value for
267 * @property: property to set
268 * @val: value the property should be set to
270 * This function sets a given property on a given object. This function only
271 * changes the software state of the property, it does not call into the
272 * driver's ->set_property callback.
276 * appropriate ->atomic_get_property callback. Only legacy drivers should call
284 struct drm_property *property, uint64_t val) in drm_object_property_set_value() argument
288 WARN_ON(drm_drv_uses_atomic_modeset(property->dev) && in drm_object_property_set_value()
289 !(property->flags & DRM_MODE_PROP_IMMUTABLE)); in drm_object_property_set_value()
291 for (i = 0; i < obj->properties->count; i++) { in drm_object_property_set_value()
292 if (obj->properties->properties[i] == property) { in drm_object_property_set_value()
293 obj->properties->values[i] = val; in drm_object_property_set_value()
298 return -EINVAL; in drm_object_property_set_value()
303 struct drm_property *property, in __drm_object_property_get_prop_value() argument
308 for (i = 0; i < obj->properties->count; i++) { in __drm_object_property_get_prop_value()
309 if (obj->properties->properties[i] == property) { in __drm_object_property_get_prop_value()
310 *val = obj->properties->values[i]; in __drm_object_property_get_prop_value()
315 return -EINVAL; in __drm_object_property_get_prop_value()
319 struct drm_property *property, in __drm_object_property_get_value() argument
323 /* read-only properties bypass atomic mechanism and still store in __drm_object_property_get_value()
324 * their value in obj->properties->values[].. mostly to avoid in __drm_object_property_get_value()
327 if (drm_drv_uses_atomic_modeset(property->dev) && in __drm_object_property_get_value()
328 !(property->flags & DRM_MODE_PROP_IMMUTABLE)) in __drm_object_property_get_value()
329 return drm_atomic_get_property(obj, property, val); in __drm_object_property_get_value()
331 return __drm_object_property_get_prop_value(obj, property, val); in __drm_object_property_get_value()
335 * drm_object_property_get_value - retrieve the value of a property
336 * @obj: drm mode object to get property value from
337 * @property: property to retrieve
338 * @val: storage for the property value
340 * This function retrieves the softare state of the given property for the given
341 * property. Since there is no driver callback to retrieve the current property
343 * and property.
346 * out property values through the various ->atomic_get_property callbacks.
352 struct drm_property *property, uint64_t *val) in drm_object_property_get_value() argument
354 WARN_ON(drm_drv_uses_atomic_modeset(property->dev)); in drm_object_property_get_value()
356 return __drm_object_property_get_value(obj, property, val); in drm_object_property_get_value()
361 * drm_object_property_get_default_value - retrieve the default value of a
362 * property when in atomic mode.
363 * @obj: drm mode object to get property value from
364 * @property: property to retrieve
365 * @val: storage for the property value
367 * This function retrieves the default state of the given property as passed in
370 * Only atomic drivers should call this function directly, as for non-atomic
377 struct drm_property *property, in drm_object_property_get_default_value() argument
380 WARN_ON(!drm_drv_uses_atomic_modeset(property->dev)); in drm_object_property_get_default_value()
382 return __drm_object_property_get_prop_value(obj, property, val); in drm_object_property_get_default_value()
387 int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic, in drm_mode_object_get_properties()
394 for (i = 0, count = 0; i < obj->properties->count; i++) { in drm_mode_object_get_properties()
395 struct drm_property *prop = obj->properties->properties[i]; in drm_mode_object_get_properties()
398 if ((prop->flags & DRM_MODE_PROP_ATOMIC) && !atomic) in drm_mode_object_get_properties()
406 if (put_user(prop->base.id, prop_ptr + count)) in drm_mode_object_get_properties()
407 return -EFAULT; in drm_mode_object_get_properties()
410 return -EFAULT; in drm_mode_object_get_properties()
421 * drm_mode_obj_get_properties_ioctl - get the current value of a object's property
426 * This function retrieves the current value for an object's property. Compared
444 return -EOPNOTSUPP; in drm_mode_obj_get_properties_ioctl()
448 obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type); in drm_mode_obj_get_properties_ioctl()
450 ret = -ENOENT; in drm_mode_obj_get_properties_ioctl()
453 if (!obj->properties) { in drm_mode_obj_get_properties_ioctl()
454 ret = -EINVAL; in drm_mode_obj_get_properties_ioctl()
458 ret = drm_mode_object_get_properties(obj, file_priv->atomic, in drm_mode_obj_get_properties_ioctl()
459 (uint32_t __user *)(unsigned long)(arg->props_ptr), in drm_mode_obj_get_properties_ioctl()
460 (uint64_t __user *)(unsigned long)(arg->prop_values_ptr), in drm_mode_obj_get_properties_ioctl()
461 &arg->count_props); in drm_mode_obj_get_properties_ioctl()
475 for (i = 0; i < obj->properties->count; i++) in drm_mode_obj_find_prop_id()
476 if (obj->properties->properties[i]->base.id == prop_id) in drm_mode_obj_find_prop_id()
477 return obj->properties->properties[i]; in drm_mode_obj_find_prop_id()
486 struct drm_device *dev = prop->dev; in set_property_legacy()
489 int ret = -EINVAL; in set_property_legacy()
492 return -EINVAL; in set_property_legacy()
495 switch (obj->type) { in set_property_legacy()
518 struct drm_device *dev = prop->dev; in set_property_atomic()
525 return -ENOMEM; in set_property_atomic()
528 state->acquire_ctx = &ctx; in set_property_atomic()
531 if (prop == state->dev->mode_config.dpms_property) { in set_property_atomic()
532 if (obj->type != DRM_MODE_OBJECT_CONNECTOR) { in set_property_atomic()
533 ret = -EINVAL; in set_property_atomic()
547 if (ret == -EDEADLK) { in set_property_atomic()
566 struct drm_property *property; in drm_mode_obj_set_property_ioctl() local
567 int ret = -EINVAL; in drm_mode_obj_set_property_ioctl()
570 return -EOPNOTSUPP; in drm_mode_obj_set_property_ioctl()
572 arg_obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type); in drm_mode_obj_set_property_ioctl()
574 return -ENOENT; in drm_mode_obj_set_property_ioctl()
576 if (!arg_obj->properties) in drm_mode_obj_set_property_ioctl()
579 property = drm_mode_obj_find_prop_id(arg_obj, arg->prop_id); in drm_mode_obj_set_property_ioctl()
580 if (!property) in drm_mode_obj_set_property_ioctl()
583 if (drm_drv_uses_atomic_modeset(property->dev)) in drm_mode_obj_set_property_ioctl()
584 ret = set_property_atomic(arg_obj, file_priv, property, arg->value); in drm_mode_obj_set_property_ioctl()
586 ret = set_property_legacy(arg_obj, property, arg->value); in drm_mode_obj_set_property_ioctl()