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
89 mutex_lock(&dev->mode_config.idr_mutex); in drm_mode_object_register()
90 idr_replace(&dev->mode_config.object_idr, obj, obj->id); in drm_mode_object_register()
91 mutex_unlock(&dev->mode_config.idr_mutex); in drm_mode_object_register()
95 * drm_mode_object_unregister - free a modeset identifier
108 WARN_ON(!dev->driver->load && dev->registered && !object->free_cb); in drm_mode_object_unregister()
110 mutex_lock(&dev->mode_config.idr_mutex); in drm_mode_object_unregister()
111 if (object->id) { in drm_mode_object_unregister()
112 idr_remove(&dev->mode_config.object_idr, object->id); in drm_mode_object_unregister()
113 object->id = 0; in drm_mode_object_unregister()
115 mutex_unlock(&dev->mode_config.idr_mutex); in drm_mode_object_unregister()
119 * drm_mode_object_lease_required - check types which must be leased to be used
125 bool drm_mode_object_lease_required(uint32_t type) in drm_mode_object_lease_required()
143 mutex_lock(&dev->mode_config.idr_mutex); in __drm_mode_object_find()
144 obj = idr_find(&dev->mode_config.object_idr, id); in __drm_mode_object_find()
145 if (obj && type != DRM_MODE_OBJECT_ANY && obj->type != type) in __drm_mode_object_find()
147 if (obj && obj->id != id) in __drm_mode_object_find()
150 if (obj && drm_mode_object_lease_required(obj->type) && in __drm_mode_object_find()
151 !_drm_lease_held(file_priv, obj->id)) { in __drm_mode_object_find()
156 if (obj && obj->free_cb) { in __drm_mode_object_find()
157 if (!kref_get_unless_zero(&obj->refcount)) in __drm_mode_object_find()
160 mutex_unlock(&dev->mode_config.idr_mutex); in __drm_mode_object_find()
166 * drm_mode_object_find - look up a drm object with static lifetime
188 * drm_mode_object_put - release a mode object reference
192 * object. It is a no-op on any other object. This is used to drop references
197 if (obj->free_cb) { in drm_mode_object_put()
198 DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, kref_read(&obj->refcount)); in drm_mode_object_put()
199 kref_put(&obj->refcount, obj->free_cb); in drm_mode_object_put()
205 * drm_mode_object_get - acquire a mode object reference
209 * object. It is a no-op on any other object. References should be dropped again
214 if (obj->free_cb) { in drm_mode_object_get()
215 DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, kref_read(&obj->refcount)); in drm_mode_object_get()
216 kref_get(&obj->refcount); in drm_mode_object_get()
222 * drm_object_attach_property - attach a property to a modeset object
224 * @property: property to attach
225 * @init_val: initial value of the property
227 * This attaches the given property to the modeset object with the given initial
235 struct drm_property *property, in drm_object_attach_property() argument
238 int count = obj->properties->count; in drm_object_attach_property()
239 struct drm_device *dev = property->dev; in drm_object_attach_property()
242 if (obj->type == DRM_MODE_OBJECT_CONNECTOR) { in drm_object_attach_property()
245 WARN_ON(!dev->driver->load && in drm_object_attach_property()
246 connector->registration_state == DRM_CONNECTOR_REGISTERED); in drm_object_attach_property()
248 WARN_ON(!dev->driver->load && dev->registered); in drm_object_attach_property()
252 WARN(1, "Failed to attach object property (type: 0x%x). Please " in drm_object_attach_property()
255 obj->type); in drm_object_attach_property()
259 obj->properties->properties[count] = property; in drm_object_attach_property()
260 obj->properties->values[count] = init_val; in drm_object_attach_property()
261 obj->properties->count++; in drm_object_attach_property()
266 * drm_object_property_set_value - set the value of a property
267 * @obj: drm mode object to set property value for
268 * @property: property to set
269 * @val: value the property should be set to
271 * This function sets a given property on a given object. This function only
272 * changes the software state of the property, it does not call into the
273 * driver's ->set_property callback.
277 * appropriate ->atomic_get_property callback. Only legacy drivers should call
285 struct drm_property *property, uint64_t val) in drm_object_property_set_value() argument
289 WARN_ON(drm_drv_uses_atomic_modeset(property->dev) && in drm_object_property_set_value()
290 !(property->flags & DRM_MODE_PROP_IMMUTABLE)); in drm_object_property_set_value()
292 for (i = 0; i < obj->properties->count; i++) { in drm_object_property_set_value()
293 if (obj->properties->properties[i] == property) { in drm_object_property_set_value()
294 obj->properties->values[i] = val; in drm_object_property_set_value()
299 return -EINVAL; in drm_object_property_set_value()
304 struct drm_property *property, in __drm_object_property_get_prop_value() argument
309 for (i = 0; i < obj->properties->count; i++) { in __drm_object_property_get_prop_value()
310 if (obj->properties->properties[i] == property) { in __drm_object_property_get_prop_value()
311 *val = obj->properties->values[i]; in __drm_object_property_get_prop_value()
316 return -EINVAL; in __drm_object_property_get_prop_value()
320 struct drm_property *property, in __drm_object_property_get_value() argument
324 /* read-only properties bypass atomic mechanism and still store in __drm_object_property_get_value()
325 * their value in obj->properties->values[].. mostly to avoid in __drm_object_property_get_value()
328 if (drm_drv_uses_atomic_modeset(property->dev) && in __drm_object_property_get_value()
329 !(property->flags & DRM_MODE_PROP_IMMUTABLE)) in __drm_object_property_get_value()
330 return drm_atomic_get_property(obj, property, val); in __drm_object_property_get_value()
332 return __drm_object_property_get_prop_value(obj, property, val); in __drm_object_property_get_value()
336 * drm_object_property_get_value - retrieve the value of a property
337 * @obj: drm mode object to get property value from
338 * @property: property to retrieve
339 * @val: storage for the property value
341 * This function retrieves the softare state of the given property for the given
342 * property. Since there is no driver callback to retrieve the current property
344 * and property.
347 * out property values through the various ->atomic_get_property callbacks.
353 struct drm_property *property, uint64_t *val) in drm_object_property_get_value() argument
355 WARN_ON(drm_drv_uses_atomic_modeset(property->dev)); in drm_object_property_get_value()
357 return __drm_object_property_get_value(obj, property, val); in drm_object_property_get_value()
362 * drm_object_property_get_default_value - retrieve the default value of a
363 * property when in atomic mode.
364 * @obj: drm mode object to get property value from
365 * @property: property to retrieve
366 * @val: storage for the property value
368 * This function retrieves the default state of the given property as passed in
371 * Only atomic drivers should call this function directly, as for non-atomic
378 struct drm_property *property, in drm_object_property_get_default_value() argument
381 WARN_ON(!drm_drv_uses_atomic_modeset(property->dev)); in drm_object_property_get_default_value()
383 return __drm_object_property_get_prop_value(obj, property, val); in drm_object_property_get_default_value()
388 int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic, in drm_mode_object_get_properties()
395 for (i = 0, count = 0; i < obj->properties->count; i++) { in drm_mode_object_get_properties()
396 struct drm_property *prop = obj->properties->properties[i]; in drm_mode_object_get_properties()
399 if ((prop->flags & DRM_MODE_PROP_ATOMIC) && !atomic) in drm_mode_object_get_properties()
407 if (put_user(prop->base.id, prop_ptr + count)) in drm_mode_object_get_properties()
408 return -EFAULT; in drm_mode_object_get_properties()
411 return -EFAULT; in drm_mode_object_get_properties()
422 * drm_mode_obj_get_properties_ioctl - get the current value of a object's property
427 * This function retrieves the current value for an object's property. Compared
445 return -EOPNOTSUPP; in drm_mode_obj_get_properties_ioctl()
449 obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type); in drm_mode_obj_get_properties_ioctl()
451 ret = -ENOENT; in drm_mode_obj_get_properties_ioctl()
454 if (!obj->properties) { in drm_mode_obj_get_properties_ioctl()
455 ret = -EINVAL; in drm_mode_obj_get_properties_ioctl()
459 ret = drm_mode_object_get_properties(obj, file_priv->atomic, in drm_mode_obj_get_properties_ioctl()
460 (uint32_t __user *)(unsigned long)(arg->props_ptr), in drm_mode_obj_get_properties_ioctl()
461 (uint64_t __user *)(unsigned long)(arg->prop_values_ptr), in drm_mode_obj_get_properties_ioctl()
462 &arg->count_props); in drm_mode_obj_get_properties_ioctl()
476 for (i = 0; i < obj->properties->count; i++) in drm_mode_obj_find_prop_id()
477 if (obj->properties->properties[i]->base.id == prop_id) in drm_mode_obj_find_prop_id()
478 return obj->properties->properties[i]; in drm_mode_obj_find_prop_id()
488 struct drm_device *dev = prop->dev; in set_property_legacy()
491 int ret = -EINVAL; in set_property_legacy()
494 return -EINVAL; in set_property_legacy()
497 switch (obj->type) { in set_property_legacy()
520 struct drm_device *dev = prop->dev; in set_property_atomic()
527 return -ENOMEM; in set_property_atomic()
530 state->acquire_ctx = &ctx; in set_property_atomic()
533 if (prop == state->dev->mode_config.dpms_property) { in set_property_atomic()
534 if (obj->type != DRM_MODE_OBJECT_CONNECTOR) { in set_property_atomic()
535 ret = -EINVAL; in set_property_atomic()
549 if (ret == -EDEADLK) { in set_property_atomic()
568 struct drm_property *property; in drm_mode_obj_set_property_ioctl() local
569 int ret = -EINVAL; in drm_mode_obj_set_property_ioctl()
572 return -EOPNOTSUPP; in drm_mode_obj_set_property_ioctl()
574 arg_obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type); in drm_mode_obj_set_property_ioctl()
576 return -ENOENT; in drm_mode_obj_set_property_ioctl()
578 if (!arg_obj->properties) in drm_mode_obj_set_property_ioctl()
581 property = drm_mode_obj_find_prop_id(arg_obj, arg->prop_id); in drm_mode_obj_set_property_ioctl()
582 if (!property) in drm_mode_obj_set_property_ioctl()
585 if (drm_drv_uses_atomic_modeset(property->dev)) in drm_mode_obj_set_property_ioctl()
586 ret = set_property_atomic(arg_obj, file_priv, property, arg->value); in drm_mode_obj_set_property_ioctl()
588 ret = set_property_legacy(arg_obj, property, arg->value); in drm_mode_obj_set_property_ioctl()