Lines Matching refs:obj
34 int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj, in __drm_mode_object_add() argument
41 ret = idr_alloc(&dev->mode_config.crtc_idr, register_obj ? obj : NULL, 1, 0, GFP_KERNEL); in __drm_mode_object_add()
47 obj->id = ret; in __drm_mode_object_add()
48 obj->type = obj_type; in __drm_mode_object_add()
50 obj->free_cb = obj_free_cb; in __drm_mode_object_add()
51 kref_init(&obj->refcount); in __drm_mode_object_add()
72 struct drm_mode_object *obj, uint32_t obj_type) in drm_mode_object_add() argument
74 return __drm_mode_object_add(dev, obj, obj_type, true, NULL); in drm_mode_object_add()
78 struct drm_mode_object *obj) in drm_mode_object_register() argument
81 idr_replace(&dev->mode_config.crtc_idr, obj, obj->id); in drm_mode_object_register()
130 struct drm_mode_object *obj = NULL; in __drm_mode_object_find() local
133 obj = idr_find(&dev->mode_config.crtc_idr, id); in __drm_mode_object_find()
134 if (obj && type != DRM_MODE_OBJECT_ANY && obj->type != type) in __drm_mode_object_find()
135 obj = NULL; in __drm_mode_object_find()
136 if (obj && obj->id != id) in __drm_mode_object_find()
137 obj = NULL; in __drm_mode_object_find()
140 if (obj && drm_mode_object_lease_required(obj->type) && in __drm_mode_object_find()
141 !_drm_lease_held(file_priv, obj->id)) in __drm_mode_object_find()
142 obj = NULL; in __drm_mode_object_find()
145 if (obj && obj->free_cb) { in __drm_mode_object_find()
146 if (!kref_get_unless_zero(&obj->refcount)) in __drm_mode_object_find()
147 obj = NULL; in __drm_mode_object_find()
151 return obj; in __drm_mode_object_find()
169 struct drm_mode_object *obj = NULL; in drm_mode_object_find() local
171 obj = __drm_mode_object_find(dev, file_priv, id, type); in drm_mode_object_find()
172 return obj; in drm_mode_object_find()
184 void drm_mode_object_put(struct drm_mode_object *obj) in drm_mode_object_put() argument
186 if (obj->free_cb) { in drm_mode_object_put()
187 DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, kref_read(&obj->refcount)); in drm_mode_object_put()
188 kref_put(&obj->refcount, obj->free_cb); in drm_mode_object_put()
201 void drm_mode_object_get(struct drm_mode_object *obj) in drm_mode_object_get() argument
203 if (obj->free_cb) { in drm_mode_object_get()
204 DRM_DEBUG("OBJ ID: %d (%d)\n", obj->id, kref_read(&obj->refcount)); in drm_mode_object_get()
205 kref_get(&obj->refcount); in drm_mode_object_get()
220 void drm_object_attach_property(struct drm_mode_object *obj, in drm_object_attach_property() argument
224 int count = obj->properties->count; in drm_object_attach_property()
230 obj->type); in drm_object_attach_property()
234 obj->properties->properties[count] = property; in drm_object_attach_property()
235 obj->properties->values[count] = init_val; in drm_object_attach_property()
236 obj->properties->count++; in drm_object_attach_property()
259 int drm_object_property_set_value(struct drm_mode_object *obj, in drm_object_property_set_value() argument
267 for (i = 0; i < obj->properties->count; i++) { in drm_object_property_set_value()
268 if (obj->properties->properties[i] == property) { in drm_object_property_set_value()
269 obj->properties->values[i] = val; in drm_object_property_set_value()
278 static int __drm_object_property_get_value(struct drm_mode_object *obj, in __drm_object_property_get_value() argument
290 return drm_atomic_get_property(obj, property, val); in __drm_object_property_get_value()
292 for (i = 0; i < obj->properties->count; i++) { in __drm_object_property_get_value()
293 if (obj->properties->properties[i] == property) { in __drm_object_property_get_value()
294 *val = obj->properties->values[i]; in __drm_object_property_get_value()
320 int drm_object_property_get_value(struct drm_mode_object *obj, in drm_object_property_get_value() argument
325 return __drm_object_property_get_value(obj, property, val); in drm_object_property_get_value()
330 int drm_mode_object_get_properties(struct drm_mode_object *obj, bool atomic, in drm_mode_object_get_properties() argument
337 for (i = 0, count = 0; i < obj->properties->count; i++) { in drm_mode_object_get_properties()
338 struct drm_property *prop = obj->properties->properties[i]; in drm_mode_object_get_properties()
345 ret = __drm_object_property_get_value(obj, prop, &val); in drm_mode_object_get_properties()
382 struct drm_mode_object *obj; in drm_mode_obj_get_properties_ioctl() local
390 obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type); in drm_mode_obj_get_properties_ioctl()
391 if (!obj) { in drm_mode_obj_get_properties_ioctl()
395 if (!obj->properties) { in drm_mode_obj_get_properties_ioctl()
400 ret = drm_mode_object_get_properties(obj, file_priv->atomic, in drm_mode_obj_get_properties_ioctl()
406 drm_mode_object_put(obj); in drm_mode_obj_get_properties_ioctl()
412 struct drm_property *drm_mode_obj_find_prop_id(struct drm_mode_object *obj, in drm_mode_obj_find_prop_id() argument
417 for (i = 0; i < obj->properties->count; i++) in drm_mode_obj_find_prop_id()
418 if (obj->properties->properties[i]->base.id == prop_id) in drm_mode_obj_find_prop_id()
419 return obj->properties->properties[i]; in drm_mode_obj_find_prop_id()
424 static int set_property_legacy(struct drm_mode_object *obj, in set_property_legacy() argument
436 switch (obj->type) { in set_property_legacy()
438 ret = drm_mode_connector_set_obj_prop(obj, prop, in set_property_legacy()
442 ret = drm_mode_crtc_set_obj_prop(obj, prop, prop_value); in set_property_legacy()
445 ret = drm_mode_plane_set_obj_prop(obj_to_plane(obj), in set_property_legacy()
455 static int set_property_atomic(struct drm_mode_object *obj, in set_property_atomic() argument
472 if (obj->type != DRM_MODE_OBJECT_CONNECTOR) { in set_property_atomic()
478 obj_to_connector(obj), in set_property_atomic()
481 ret = drm_atomic_set_property(state, obj, prop, prop_value); in set_property_atomic()