Lines Matching +full:primary +full:- +full:device

32 #include <linux/dma-resv.h>
78 * drm_mode_getresources - get graphics configuration
79 * @dev: drm device for the ioctl
107 return -EOPNOTSUPP; in drm_mode_getresources()
109 mutex_lock(&file_priv->fbs_lock); in drm_mode_getresources()
111 fb_id = u64_to_user_ptr(card_res->fb_id_ptr); in drm_mode_getresources()
112 list_for_each_entry(fb, &file_priv->fbs, filp_head) { in drm_mode_getresources()
113 if (count < card_res->count_fbs && in drm_mode_getresources()
114 put_user(fb->base.id, fb_id + count)) { in drm_mode_getresources()
115 mutex_unlock(&file_priv->fbs_lock); in drm_mode_getresources()
116 return -EFAULT; in drm_mode_getresources()
120 card_res->count_fbs = count; in drm_mode_getresources()
121 mutex_unlock(&file_priv->fbs_lock); in drm_mode_getresources()
123 card_res->max_height = dev->mode_config.max_height; in drm_mode_getresources()
124 card_res->min_height = dev->mode_config.min_height; in drm_mode_getresources()
125 card_res->max_width = dev->mode_config.max_width; in drm_mode_getresources()
126 card_res->min_width = dev->mode_config.min_width; in drm_mode_getresources()
129 crtc_id = u64_to_user_ptr(card_res->crtc_id_ptr); in drm_mode_getresources()
131 if (drm_lease_held(file_priv, crtc->base.id)) { in drm_mode_getresources()
132 if (count < card_res->count_crtcs && in drm_mode_getresources()
133 put_user(crtc->base.id, crtc_id + count)) in drm_mode_getresources()
134 return -EFAULT; in drm_mode_getresources()
138 card_res->count_crtcs = count; in drm_mode_getresources()
141 encoder_id = u64_to_user_ptr(card_res->encoder_id_ptr); in drm_mode_getresources()
143 if (count < card_res->count_encoders && in drm_mode_getresources()
144 put_user(encoder->base.id, encoder_id + count)) in drm_mode_getresources()
145 return -EFAULT; in drm_mode_getresources()
148 card_res->count_encoders = count; in drm_mode_getresources()
152 connector_id = u64_to_user_ptr(card_res->connector_id_ptr); in drm_mode_getresources()
155 if (!file_priv->writeback_connectors && in drm_mode_getresources()
156 (connector->connector_type == DRM_MODE_CONNECTOR_WRITEBACK)) in drm_mode_getresources()
159 if (drm_lease_held(file_priv, connector->base.id)) { in drm_mode_getresources()
160 if (count < card_res->count_connectors && in drm_mode_getresources()
161 put_user(connector->base.id, connector_id + count)) { in drm_mode_getresources()
163 return -EFAULT; in drm_mode_getresources()
168 card_res->count_connectors = count; in drm_mode_getresources()
175 * drm_mode_config_reset - call ->reset callbacks
176 * @dev: drm device
178 * This functions calls all the crtc's, encoder's and connector's ->reset
191 if (plane->funcs->reset) in drm_mode_config_reset()
192 plane->funcs->reset(plane); in drm_mode_config_reset()
195 if (crtc->funcs->reset) in drm_mode_config_reset()
196 crtc->funcs->reset(crtc); in drm_mode_config_reset()
199 if (encoder->funcs && encoder->funcs->reset) in drm_mode_config_reset()
200 encoder->funcs->reset(encoder); in drm_mode_config_reset()
204 if (connector->funcs->reset) in drm_mode_config_reset()
205 connector->funcs->reset(connector); in drm_mode_config_reset()
215 { DRM_PLANE_TYPE_PRIMARY, "Primary" },
232 return -ENOMEM; in drm_mode_create_standard_properties()
233 dev->mode_config.plane_type_property = prop; in drm_mode_create_standard_properties()
238 return -ENOMEM; in drm_mode_create_standard_properties()
239 dev->mode_config.prop_src_x = prop; in drm_mode_create_standard_properties()
244 return -ENOMEM; in drm_mode_create_standard_properties()
245 dev->mode_config.prop_src_y = prop; in drm_mode_create_standard_properties()
250 return -ENOMEM; in drm_mode_create_standard_properties()
251 dev->mode_config.prop_src_w = prop; in drm_mode_create_standard_properties()
256 return -ENOMEM; in drm_mode_create_standard_properties()
257 dev->mode_config.prop_src_h = prop; in drm_mode_create_standard_properties()
262 return -ENOMEM; in drm_mode_create_standard_properties()
263 dev->mode_config.prop_crtc_x = prop; in drm_mode_create_standard_properties()
268 return -ENOMEM; in drm_mode_create_standard_properties()
269 dev->mode_config.prop_crtc_y = prop; in drm_mode_create_standard_properties()
274 return -ENOMEM; in drm_mode_create_standard_properties()
275 dev->mode_config.prop_crtc_w = prop; in drm_mode_create_standard_properties()
280 return -ENOMEM; in drm_mode_create_standard_properties()
281 dev->mode_config.prop_crtc_h = prop; in drm_mode_create_standard_properties()
286 return -ENOMEM; in drm_mode_create_standard_properties()
287 dev->mode_config.prop_fb_id = prop; in drm_mode_create_standard_properties()
290 "IN_FENCE_FD", -1, INT_MAX); in drm_mode_create_standard_properties()
292 return -ENOMEM; in drm_mode_create_standard_properties()
293 dev->mode_config.prop_in_fence_fd = prop; in drm_mode_create_standard_properties()
298 return -ENOMEM; in drm_mode_create_standard_properties()
299 dev->mode_config.prop_out_fence_ptr = prop; in drm_mode_create_standard_properties()
304 return -ENOMEM; in drm_mode_create_standard_properties()
305 dev->mode_config.prop_crtc_id = prop; in drm_mode_create_standard_properties()
311 return -ENOMEM; in drm_mode_create_standard_properties()
312 dev->mode_config.prop_fb_damage_clips = prop; in drm_mode_create_standard_properties()
317 return -ENOMEM; in drm_mode_create_standard_properties()
318 dev->mode_config.prop_active = prop; in drm_mode_create_standard_properties()
324 return -ENOMEM; in drm_mode_create_standard_properties()
325 dev->mode_config.prop_mode_id = prop; in drm_mode_create_standard_properties()
330 return -ENOMEM; in drm_mode_create_standard_properties()
331 dev->mode_config.prop_vrr_enabled = prop; in drm_mode_create_standard_properties()
337 return -ENOMEM; in drm_mode_create_standard_properties()
338 dev->mode_config.degamma_lut_property = prop; in drm_mode_create_standard_properties()
344 return -ENOMEM; in drm_mode_create_standard_properties()
345 dev->mode_config.degamma_lut_size_property = prop; in drm_mode_create_standard_properties()
351 return -ENOMEM; in drm_mode_create_standard_properties()
352 dev->mode_config.ctm_property = prop; in drm_mode_create_standard_properties()
358 return -ENOMEM; in drm_mode_create_standard_properties()
359 dev->mode_config.gamma_lut_property = prop; in drm_mode_create_standard_properties()
365 return -ENOMEM; in drm_mode_create_standard_properties()
366 dev->mode_config.gamma_lut_size_property = prop; in drm_mode_create_standard_properties()
372 return -ENOMEM; in drm_mode_create_standard_properties()
373 dev->mode_config.modifiers_property = prop; in drm_mode_create_standard_properties()
379 return -ENOMEM; in drm_mode_create_standard_properties()
380 dev->mode_config.size_hints_property = prop; in drm_mode_create_standard_properties()
391 * drmm_mode_config_init - managed DRM mode_configuration structure
393 * @dev: DRM device
411 mutex_init(&dev->mode_config.mutex); in drmm_mode_config_init()
412 drm_modeset_lock_init(&dev->mode_config.connection_mutex); in drmm_mode_config_init()
413 mutex_init(&dev->mode_config.idr_mutex); in drmm_mode_config_init()
414 mutex_init(&dev->mode_config.fb_lock); in drmm_mode_config_init()
415 mutex_init(&dev->mode_config.blob_lock); in drmm_mode_config_init()
416 INIT_LIST_HEAD(&dev->mode_config.fb_list); in drmm_mode_config_init()
417 INIT_LIST_HEAD(&dev->mode_config.crtc_list); in drmm_mode_config_init()
418 INIT_LIST_HEAD(&dev->mode_config.connector_list); in drmm_mode_config_init()
419 INIT_LIST_HEAD(&dev->mode_config.encoder_list); in drmm_mode_config_init()
420 INIT_LIST_HEAD(&dev->mode_config.property_list); in drmm_mode_config_init()
421 INIT_LIST_HEAD(&dev->mode_config.property_blob_list); in drmm_mode_config_init()
422 INIT_LIST_HEAD(&dev->mode_config.plane_list); in drmm_mode_config_init()
423 INIT_LIST_HEAD(&dev->mode_config.privobj_list); in drmm_mode_config_init()
424 idr_init_base(&dev->mode_config.object_idr, 1); in drmm_mode_config_init()
425 idr_init_base(&dev->mode_config.tile_idr, 1); in drmm_mode_config_init()
426 ida_init(&dev->mode_config.connector_ida); in drmm_mode_config_init()
427 spin_lock_init(&dev->mode_config.connector_list_lock); in drmm_mode_config_init()
429 init_llist_head(&dev->mode_config.connector_free_list); in drmm_mode_config_init()
430 INIT_WORK(&dev->mode_config.connector_free_work, drm_connector_free_work_fn); in drmm_mode_config_init()
439 dev->mode_config.num_fb = 0; in drmm_mode_config_init()
440 dev->mode_config.num_connector = 0; in drmm_mode_config_init()
441 dev->mode_config.num_crtc = 0; in drmm_mode_config_init()
442 dev->mode_config.num_encoder = 0; in drmm_mode_config_init()
443 dev->mode_config.num_total_plane = 0; in drmm_mode_config_init()
454 ret = drm_modeset_lock(&dev->mode_config.connection_mutex, in drmm_mode_config_init()
456 if (ret == -EDEADLK) in drmm_mode_config_init()
463 if (ret == -EDEADLK) in drmm_mode_config_init()
480 * drm_mode_config_cleanup - free up DRM mode_config info
481 * @dev: DRM device
483 * Free up all the connectors and CRTCs associated with this DRM device, then
486 * Note that since this /should/ happen single-threaded at driver/device
504 list_for_each_entry_safe(encoder, enct, &dev->mode_config.encoder_list, in drm_mode_config_cleanup()
506 encoder->funcs->destroy(encoder); in drm_mode_config_cleanup()
513 * against unreferencing the current connector - but not against in drm_mode_config_cleanup()
519 flush_work(&dev->mode_config.connector_free_work); in drm_mode_config_cleanup()
520 if (WARN_ON(!list_empty(&dev->mode_config.connector_list))) { in drm_mode_config_cleanup()
523 DRM_ERROR("connector %s leaked!\n", connector->name); in drm_mode_config_cleanup()
527 list_for_each_entry_safe(property, pt, &dev->mode_config.property_list, in drm_mode_config_cleanup()
532 list_for_each_entry_safe(plane, plt, &dev->mode_config.plane_list, in drm_mode_config_cleanup()
534 plane->funcs->destroy(plane); in drm_mode_config_cleanup()
537 list_for_each_entry_safe(crtc, ct, &dev->mode_config.crtc_list, head) { in drm_mode_config_cleanup()
538 crtc->funcs->destroy(crtc); in drm_mode_config_cleanup()
541 list_for_each_entry_safe(blob, bt, &dev->mode_config.property_blob_list, in drm_mode_config_cleanup()
547 * Single-threaded teardown context, so it's not required to grab the in drm_mode_config_cleanup()
554 WARN_ON(!list_empty(&dev->mode_config.fb_list)); in drm_mode_config_cleanup()
555 list_for_each_entry_safe(fb, fbt, &dev->mode_config.fb_list, head) { in drm_mode_config_cleanup()
558 drm_printf(&p, "framebuffer[%u]:\n", fb->base.id); in drm_mode_config_cleanup()
560 drm_framebuffer_free(&fb->base.refcount); in drm_mode_config_cleanup()
563 ida_destroy(&dev->mode_config.connector_ida); in drm_mode_config_cleanup()
564 idr_destroy(&dev->mode_config.tile_idr); in drm_mode_config_cleanup()
565 idr_destroy(&dev->mode_config.object_idr); in drm_mode_config_cleanup()
566 drm_modeset_lock_fini(&dev->mode_config.connection_mutex); in drm_mode_config_cleanup()
588 if (encoder->possible_clones == 0) in fixup_encoder_possible_clones()
589 encoder->possible_clones = drm_encoder_mask(encoder); in fixup_encoder_possible_clones()
594 struct drm_device *dev = encoder->dev; in validate_encoder_possible_clones()
599 WARN(!!(encoder->possible_clones & drm_encoder_mask(other)) != in validate_encoder_possible_clones()
600 !!(other->possible_clones & drm_encoder_mask(encoder)), in validate_encoder_possible_clones()
604 encoder->base.id, encoder->name, in validate_encoder_possible_clones()
605 drm_encoder_mask(encoder), encoder->possible_clones, in validate_encoder_possible_clones()
606 other->base.id, other->name, in validate_encoder_possible_clones()
607 drm_encoder_mask(other), other->possible_clones); in validate_encoder_possible_clones()
610 WARN((encoder->possible_clones & drm_encoder_mask(encoder)) == 0 || in validate_encoder_possible_clones()
611 (encoder->possible_clones & ~encoder_mask) != 0, in validate_encoder_possible_clones()
614 encoder->base.id, encoder->name, in validate_encoder_possible_clones()
615 encoder->possible_clones, encoder_mask); in validate_encoder_possible_clones()
631 u32 crtc_mask = full_crtc_mask(encoder->dev); in validate_encoder_possible_crtcs()
633 WARN((encoder->possible_crtcs & crtc_mask) == 0 || in validate_encoder_possible_crtcs()
634 (encoder->possible_crtcs & ~crtc_mask) != 0, in validate_encoder_possible_crtcs()
637 encoder->base.id, encoder->name, in validate_encoder_possible_crtcs()
638 encoder->possible_crtcs, crtc_mask); in validate_encoder_possible_crtcs()
661 WARN(!crtc->primary, "Missing primary plane on [CRTC:%d:%s]\n", in drm_mode_config_validate()
662 crtc->base.id, crtc->name); in drm_mode_config_validate()
664 WARN(crtc->cursor && crtc->funcs->cursor_set, in drm_mode_config_validate()
666 crtc->base.id, crtc->name); in drm_mode_config_validate()
667 WARN(crtc->cursor && crtc->funcs->cursor_set2, in drm_mode_config_validate()
669 crtc->base.id, crtc->name); in drm_mode_config_validate()
670 WARN(crtc->cursor && crtc->funcs->cursor_move, in drm_mode_config_validate()
672 crtc->base.id, crtc->name); in drm_mode_config_validate()
674 if (crtc->primary) { in drm_mode_config_validate()
675 WARN(!(crtc->primary->possible_crtcs & drm_crtc_mask(crtc)), in drm_mode_config_validate()
676 "Bogus primary plane possible_crtcs: [PLANE:%d:%s] must be compatible with [CRTC:%d:%s]\n", in drm_mode_config_validate()
677 crtc->primary->base.id, crtc->primary->name, in drm_mode_config_validate()
678 crtc->base.id, crtc->name); in drm_mode_config_validate()
679 WARN(primary_with_crtc & drm_plane_mask(crtc->primary), in drm_mode_config_validate()
680 "Primary plane [PLANE:%d:%s] used for multiple CRTCs", in drm_mode_config_validate()
681 crtc->primary->base.id, crtc->primary->name); in drm_mode_config_validate()
682 primary_with_crtc |= drm_plane_mask(crtc->primary); in drm_mode_config_validate()
684 if (crtc->cursor) { in drm_mode_config_validate()
685 WARN(!(crtc->cursor->possible_crtcs & drm_crtc_mask(crtc)), in drm_mode_config_validate()
687 crtc->cursor->base.id, crtc->cursor->name, in drm_mode_config_validate()
688 crtc->base.id, crtc->name); in drm_mode_config_validate()
689 WARN(cursor_with_crtc & drm_plane_mask(crtc->cursor), in drm_mode_config_validate()
691 crtc->cursor->base.id, crtc->cursor->name); in drm_mode_config_validate()
692 cursor_with_crtc |= drm_plane_mask(crtc->cursor); in drm_mode_config_validate()
697 if (plane->type == DRM_PLANE_TYPE_PRIMARY) in drm_mode_config_validate()
701 WARN(num_primary != dev->mode_config.num_crtc, in drm_mode_config_validate()
702 … "Must have as many primary planes as there are CRTCs, but have %u primary planes and %u CRTCs", in drm_mode_config_validate()
703 num_primary, dev->mode_config.num_crtc); in drm_mode_config_validate()