Lines Matching +full:mipi +full:- +full:to +full:- +full:edp

4  * Permission to use, copy, modify, distribute, and sell this software and its
9 * publicity pertaining to distribution of the software without specific,
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
44 * Frame buffers are abstract memory objects that provide a source of pixels to
45 * scanout to a CRTC. Applications explicitly request the creation of frame
47 * handle that can be passed to the KMS CRTC control, plane configuration and
52 * (or a list of memory handles for multi-planar formats) through the
55 * free to use their own backing storage object handles, e.g. vmwgfx directly
56 * exposes special TTM handles to userspace and so expects TTM handles in the
60 * using drm_framebuffer_init() - after calling that function userspace can use
62 * drm_helper_mode_fill_fb_struct() can be used to pre-fill the required
67 * them again with drm_framebuffer_put(). For driver-private framebuffers for
72 * recommended, and it's better to have a normal free-standing &struct
82 fb_width = fb->width << 16; in drm_framebuffer_check_src_coords()
83 fb_height = fb->height << 16; in drm_framebuffer_check_src_coords()
87 src_x > fb_width - src_w || in drm_framebuffer_check_src_coords()
89 src_y > fb_height - src_h) { in drm_framebuffer_check_src_coords()
90 drm_dbg_kms(fb->dev, "Invalid source coordinates " in drm_framebuffer_check_src_coords()
96 fb->width, fb->height); in drm_framebuffer_check_src_coords()
97 return -ENOSPC; in drm_framebuffer_check_src_coords()
105 * drm_mode_addfb - add an FB to the graphics configuration
107 * @or: pointer to request structure
110 * Add a new FB to the specified CRTC, given a user request. This is the
113 * Called by the user via ioctl, or by an in-kernel client.
125 return -EOPNOTSUPP; in drm_mode_addfb()
127 r.pixel_format = drm_driver_legacy_fb_format(dev, or->bpp, or->depth); in drm_mode_addfb()
129 drm_dbg_kms(dev, "bad {bpp:%d, depth:%d}\n", or->bpp, or->depth); in drm_mode_addfb()
130 return -EINVAL; in drm_mode_addfb()
133 /* convert to new format and call new ioctl */ in drm_mode_addfb()
134 r.fb_id = or->fb_id; in drm_mode_addfb()
135 r.width = or->width; in drm_mode_addfb()
136 r.height = or->height; in drm_mode_addfb()
137 r.pitches[0] = or->pitch; in drm_mode_addfb()
138 r.handles[0] = or->handle; in drm_mode_addfb()
144 or->fb_id = r.fb_id; in drm_mode_addfb()
161 if (r->width == 0) { in framebuffer_check()
162 drm_dbg_kms(dev, "bad framebuffer width %u\n", r->width); in framebuffer_check()
163 return -EINVAL; in framebuffer_check()
166 if (r->height == 0) { in framebuffer_check()
167 drm_dbg_kms(dev, "bad framebuffer height %u\n", r->height); in framebuffer_check()
168 return -EINVAL; in framebuffer_check()
171 for (i = 0; i < info->num_planes; i++) { in framebuffer_check()
172 unsigned int width = drm_format_info_plane_width(info, r->width, i); in framebuffer_check()
173 unsigned int height = drm_format_info_plane_height(info, r->height, i); in framebuffer_check()
174 unsigned int block_size = info->char_per_block[i]; in framebuffer_check()
177 if (!block_size && (r->modifier[i] == DRM_FORMAT_MOD_LINEAR)) { in framebuffer_check()
178 drm_dbg_kms(dev, "Format requires non-linear modifier for plane %d\n", i); in framebuffer_check()
179 return -EINVAL; in framebuffer_check()
182 if (!r->handles[i]) { in framebuffer_check()
184 return -EINVAL; in framebuffer_check()
188 return -ERANGE; in framebuffer_check()
190 if ((uint64_t) height * r->pitches[i] + r->offsets[i] > UINT_MAX) in framebuffer_check()
191 return -ERANGE; in framebuffer_check()
193 if (block_size && r->pitches[i] < min_pitch) { in framebuffer_check()
194 drm_dbg_kms(dev, "bad pitch %u for plane %d\n", r->pitches[i], i); in framebuffer_check()
195 return -EINVAL; in framebuffer_check()
198 if (r->modifier[i] && !(r->flags & DRM_MODE_FB_MODIFIERS)) { in framebuffer_check()
200 r->modifier[i], i); in framebuffer_check()
201 return -EINVAL; in framebuffer_check()
204 if (r->flags & DRM_MODE_FB_MODIFIERS && in framebuffer_check()
205 r->modifier[i] != r->modifier[0]) { in framebuffer_check()
207 r->modifier[i], i); in framebuffer_check()
208 return -EINVAL; in framebuffer_check()
212 switch (r->modifier[i]) { in framebuffer_check()
217 if (r->pixel_format != DRM_FORMAT_NV12 || in framebuffer_check()
219 r->pitches[i] % 128) { in framebuffer_check()
221 return -EINVAL; in framebuffer_check()
230 for (i = info->num_planes; i < 4; i++) { in framebuffer_check()
231 if (r->modifier[i]) { in framebuffer_check()
232 drm_dbg_kms(dev, "non-zero modifier for unused plane %d\n", i); in framebuffer_check()
233 return -EINVAL; in framebuffer_check()
236 /* Pre-FB_MODIFIERS userspace didn't clear the structs properly. */ in framebuffer_check()
237 if (!(r->flags & DRM_MODE_FB_MODIFIERS)) in framebuffer_check()
240 if (r->handles[i]) { in framebuffer_check()
242 return -EINVAL; in framebuffer_check()
245 if (r->pitches[i]) { in framebuffer_check()
246 drm_dbg_kms(dev, "non-zero pitch for unused plane %d\n", i); in framebuffer_check()
247 return -EINVAL; in framebuffer_check()
250 if (r->offsets[i]) { in framebuffer_check()
251 drm_dbg_kms(dev, "non-zero offset for unused plane %d\n", i); in framebuffer_check()
252 return -EINVAL; in framebuffer_check()
264 struct drm_mode_config *config = &dev->mode_config; in drm_internal_framebuffer_create()
269 if (r->flags & ~(DRM_MODE_FB_INTERLACED | DRM_MODE_FB_MODIFIERS)) { in drm_internal_framebuffer_create()
270 drm_dbg_kms(dev, "bad framebuffer flags 0x%08x\n", r->flags); in drm_internal_framebuffer_create()
271 return ERR_PTR(-EINVAL); in drm_internal_framebuffer_create()
274 if ((config->min_width > r->width) || (r->width > config->max_width)) { in drm_internal_framebuffer_create()
276 r->width, config->min_width, config->max_width); in drm_internal_framebuffer_create()
277 return ERR_PTR(-EINVAL); in drm_internal_framebuffer_create()
279 if ((config->min_height > r->height) || (r->height > config->max_height)) { in drm_internal_framebuffer_create()
281 r->height, config->min_height, config->max_height); in drm_internal_framebuffer_create()
282 return ERR_PTR(-EINVAL); in drm_internal_framebuffer_create()
285 if (r->flags & DRM_MODE_FB_MODIFIERS && in drm_internal_framebuffer_create()
286 dev->mode_config.fb_modifiers_not_supported) { in drm_internal_framebuffer_create()
288 return ERR_PTR(-EINVAL); in drm_internal_framebuffer_create()
292 if (!__drm_format_info(r->pixel_format)) { in drm_internal_framebuffer_create()
294 &r->pixel_format); in drm_internal_framebuffer_create()
295 return ERR_PTR(-EINVAL); in drm_internal_framebuffer_create()
299 info = drm_get_format_info(dev, r->pixel_format, r->modifier[0]); in drm_internal_framebuffer_create()
305 fb = dev->mode_config.funcs->fb_create(dev, file_priv, info, r); in drm_internal_framebuffer_create()
316 * drm_mode_addfb2 - add an FB to the graphics configuration
321 * Add a new FB to the specified CRTC, given a user request with format. This is
322 * the 2nd version of the addfb ioctl, which supports multi-planar framebuffers
337 return -EOPNOTSUPP; in drm_mode_addfb2()
343 drm_dbg_kms(dev, "[FB:%d]\n", fb->base.id); in drm_mode_addfb2()
344 r->fb_id = fb->base.id; in drm_mode_addfb2()
346 /* Transfer ownership to the filp for reaping on close */ in drm_mode_addfb2()
347 mutex_lock(&file_priv->fbs_lock); in drm_mode_addfb2()
348 list_add(&fb->filp_head, &file_priv->fbs); in drm_mode_addfb2()
349 mutex_unlock(&file_priv->fbs_lock); in drm_mode_addfb2()
358 if (!dev->mode_config.quirk_addfb_prefer_host_byte_order) { in drm_mode_addfb2_ioctl()
361 * quirk_addfb_prefer_host_byte_order quirk to make in drm_mode_addfb2_ioctl()
368 * then. So block it to make userspace fallback to in drm_mode_addfb2_ioctl()
372 return -EOPNOTSUPP; in drm_mode_addfb2_ioctl()
387 while (!list_empty(&arg->fbs)) { in drm_mode_rmfb_work_fn()
389 list_first_entry(&arg->fbs, typeof(*fb), filp_head); in drm_mode_rmfb_work_fn()
391 drm_dbg_kms(fb->dev, in drm_mode_rmfb_work_fn()
392 "Removing [FB:%d] from all active usage due to RMFB ioctl\n", in drm_mode_rmfb_work_fn()
393 fb->base.id); in drm_mode_rmfb_work_fn()
394 list_del_init(&fb->filp_head); in drm_mode_rmfb_work_fn()
405 mutex_lock(&file_priv->fbs_lock); in drm_mode_closefb()
406 list_for_each_entry(fbl, &file_priv->fbs, filp_head) in drm_mode_closefb()
411 mutex_unlock(&file_priv->fbs_lock); in drm_mode_closefb()
412 return -ENOENT; in drm_mode_closefb()
415 list_del_init(&fb->filp_head); in drm_mode_closefb()
416 mutex_unlock(&file_priv->fbs_lock); in drm_mode_closefb()
425 * drm_mode_rmfb - remove an FB from the configuration
427 * @fb_id: id of framebuffer to remove
432 * Called by the user via ioctl, or by an in-kernel client.
444 return -EOPNOTSUPP; in drm_mode_rmfb()
448 return -ENOENT; in drm_mode_rmfb()
457 * drm_framebuffer_remove may fail with -EINTR on pending signals, in drm_mode_rmfb()
458 * so run this in a separate stack as there's no way to correctly in drm_mode_rmfb()
466 drm_WARN_ON(dev, !list_empty(&fb->filp_head)); in drm_mode_rmfb()
467 list_add_tail(&fb->filp_head, &arg.fbs); in drm_mode_rmfb()
494 return -EOPNOTSUPP; in drm_mode_closefb_ioctl()
496 if (r->pad) in drm_mode_closefb_ioctl()
497 return -EINVAL; in drm_mode_closefb_ioctl()
499 fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); in drm_mode_closefb_ioctl()
501 return -ENOENT; in drm_mode_closefb_ioctl()
509 * drm_mode_getfb - get FB info
529 return -EOPNOTSUPP; in drm_mode_getfb()
531 fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); in drm_mode_getfb()
533 return -ENOENT; in drm_mode_getfb()
535 /* Multi-planar framebuffers need getfb2. */ in drm_mode_getfb()
536 if (fb->format->num_planes > 1) { in drm_mode_getfb()
537 ret = -EINVAL; in drm_mode_getfb()
541 if (!fb->funcs->create_handle) { in drm_mode_getfb()
542 ret = -ENODEV; in drm_mode_getfb()
546 r->height = fb->height; in drm_mode_getfb()
547 r->width = fb->width; in drm_mode_getfb()
548 r->depth = fb->format->depth; in drm_mode_getfb()
549 r->bpp = drm_format_info_bpp(fb->format, 0); in drm_mode_getfb()
550 r->pitch = fb->pitches[0]; in drm_mode_getfb()
553 * buffer-handle to non-master processes! For in drm_mode_getfb()
554 * backwards-compatibility reasons, we cannot make GET_FB() privileged, in drm_mode_getfb()
555 * so just return an invalid handle for non-masters. in drm_mode_getfb()
558 r->handle = 0; in drm_mode_getfb()
563 ret = fb->funcs->create_handle(fb, file_priv, &r->handle); in drm_mode_getfb()
571 * drm_mode_getfb2_ioctl - get extended FB info
592 return -EINVAL; in drm_mode_getfb2_ioctl()
594 fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); in drm_mode_getfb2_ioctl()
596 return -ENOENT; in drm_mode_getfb2_ioctl()
598 /* For multi-plane framebuffers, we require the driver to place the in drm_mode_getfb2_ioctl()
599 * GEM objects directly in the drm_framebuffer. For single-plane in drm_mode_getfb2_ioctl()
600 * framebuffers, we can fall back to create_handle. in drm_mode_getfb2_ioctl()
602 if (!fb->obj[0] && in drm_mode_getfb2_ioctl()
603 (fb->format->num_planes > 1 || !fb->funcs->create_handle)) { in drm_mode_getfb2_ioctl()
604 ret = -ENODEV; in drm_mode_getfb2_ioctl()
608 r->height = fb->height; in drm_mode_getfb2_ioctl()
609 r->width = fb->width; in drm_mode_getfb2_ioctl()
610 r->pixel_format = fb->format->format; in drm_mode_getfb2_ioctl()
612 r->flags = 0; in drm_mode_getfb2_ioctl()
613 if (!dev->mode_config.fb_modifiers_not_supported) in drm_mode_getfb2_ioctl()
614 r->flags |= DRM_MODE_FB_MODIFIERS; in drm_mode_getfb2_ioctl()
616 for (i = 0; i < ARRAY_SIZE(r->handles); i++) { in drm_mode_getfb2_ioctl()
617 r->handles[i] = 0; in drm_mode_getfb2_ioctl()
618 r->pitches[i] = 0; in drm_mode_getfb2_ioctl()
619 r->offsets[i] = 0; in drm_mode_getfb2_ioctl()
620 r->modifier[i] = 0; in drm_mode_getfb2_ioctl()
623 for (i = 0; i < fb->format->num_planes; i++) { in drm_mode_getfb2_ioctl()
624 r->pitches[i] = fb->pitches[i]; in drm_mode_getfb2_ioctl()
625 r->offsets[i] = fb->offsets[i]; in drm_mode_getfb2_ioctl()
626 if (!dev->mode_config.fb_modifiers_not_supported) in drm_mode_getfb2_ioctl()
627 r->modifier[i] = fb->modifier; in drm_mode_getfb2_ioctl()
631 * buffer-handle to non master/root processes! To match GET_FB() in drm_mode_getfb2_ioctl()
640 for (i = 0; i < fb->format->num_planes; i++) { in drm_mode_getfb2_ioctl()
647 if (fb->obj[i] == fb->obj[j]) { in drm_mode_getfb2_ioctl()
648 r->handles[i] = r->handles[j]; in drm_mode_getfb2_ioctl()
653 if (r->handles[i]) in drm_mode_getfb2_ioctl()
656 if (fb->obj[i]) { in drm_mode_getfb2_ioctl()
657 ret = drm_gem_handle_create(file_priv, fb->obj[i], in drm_mode_getfb2_ioctl()
658 &r->handles[i]); in drm_mode_getfb2_ioctl()
661 ret = fb->funcs->create_handle(fb, file_priv, in drm_mode_getfb2_ioctl()
662 &r->handles[i]); in drm_mode_getfb2_ioctl()
671 /* Delete any previously-created handles on failure. */ in drm_mode_getfb2_ioctl()
672 for (i = 0; i < ARRAY_SIZE(r->handles); i++) { in drm_mode_getfb2_ioctl()
675 if (r->handles[i]) in drm_mode_getfb2_ioctl()
676 drm_gem_handle_delete(file_priv, r->handles[i]); in drm_mode_getfb2_ioctl()
678 /* Zero out any handles identical to the one we just in drm_mode_getfb2_ioctl()
681 for (j = i + 1; j < ARRAY_SIZE(r->handles); j++) { in drm_mode_getfb2_ioctl()
682 if (r->handles[j] == r->handles[i]) in drm_mode_getfb2_ioctl()
683 r->handles[j] = 0; in drm_mode_getfb2_ioctl()
693 * drm_mode_dirtyfb_ioctl - flush frontbuffer rendering on an FB
700 * this ioctl to flush out the changes on manual-update display outputs, e.g.
701 * usb display-link, mipi manual update panels or edp panel self refresh modes.
703 * Modesetting drivers which always update the frontbuffer do not need to
723 return -EOPNOTSUPP; in drm_mode_dirtyfb_ioctl()
725 fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); in drm_mode_dirtyfb_ioctl()
727 return -ENOENT; in drm_mode_dirtyfb_ioctl()
729 num_clips = r->num_clips; in drm_mode_dirtyfb_ioctl()
730 clips_ptr = (struct drm_clip_rect __user *)(unsigned long)r->clips_ptr; in drm_mode_dirtyfb_ioctl()
733 ret = -EINVAL; in drm_mode_dirtyfb_ioctl()
737 flags = DRM_MODE_FB_DIRTY_FLAGS & r->flags; in drm_mode_dirtyfb_ioctl()
741 ret = -EINVAL; in drm_mode_dirtyfb_ioctl()
747 ret = -EINVAL; in drm_mode_dirtyfb_ioctl()
752 ret = -ENOMEM; in drm_mode_dirtyfb_ioctl()
759 ret = -EFAULT; in drm_mode_dirtyfb_ioctl()
764 if (fb->funcs->dirty) { in drm_mode_dirtyfb_ioctl()
765 ret = fb->funcs->dirty(fb, file_priv, flags, r->color, in drm_mode_dirtyfb_ioctl()
768 ret = -ENOSYS; in drm_mode_dirtyfb_ioctl()
780 * drm_fb_release - remove and free the FBs on this file
799 * list any more, so no need to grab fpriv->fbs_lock. And we need to in drm_fb_release()
803 * Note that a real deadlock between fpriv->fbs_lock and the modeset in drm_fb_release()
807 list_for_each_entry_safe(fb, tfb, &priv->fbs, filp_head) { in drm_fb_release()
809 list_move_tail(&fb->filp_head, &arg.fbs); in drm_fb_release()
811 list_del_init(&fb->filp_head); in drm_fb_release()
813 /* This drops the fpriv->fbs reference. */ in drm_fb_release()
831 struct drm_device *dev = fb->dev; in drm_framebuffer_free()
833 drm_WARN_ON(dev, !list_empty(&fb->filp_head)); in drm_framebuffer_free()
839 drm_mode_object_unregister(dev, &fb->base); in drm_framebuffer_free()
841 fb->funcs->destroy(fb); in drm_framebuffer_free()
846 * drm_framebuffer_init - initialize a framebuffer
848 * @fb: framebuffer to be initialized
852 * functions & device file and adds it to the master fd list.
856 * by other users. Which means by this point the fb _must_ be fully set up -
870 if (WARN_ON_ONCE(fb->dev != dev || !fb->format)) in drm_framebuffer_init()
871 return -EINVAL; in drm_framebuffer_init()
873 for (i = 0; i < fb->format->num_planes; i++) { in drm_framebuffer_init()
874 if (drm_WARN_ON_ONCE(dev, fb->internal_flags & DRM_FRAMEBUFFER_HAS_HANDLE_REF(i))) in drm_framebuffer_init()
875 fb->internal_flags &= ~DRM_FRAMEBUFFER_HAS_HANDLE_REF(i); in drm_framebuffer_init()
876 if (fb->obj[i]) { in drm_framebuffer_init()
877 exists = drm_gem_object_handle_get_if_exists_unlocked(fb->obj[i]); in drm_framebuffer_init()
879 fb->internal_flags |= DRM_FRAMEBUFFER_HAS_HANDLE_REF(i); in drm_framebuffer_init()
883 INIT_LIST_HEAD(&fb->filp_head); in drm_framebuffer_init()
885 fb->funcs = funcs; in drm_framebuffer_init()
886 strscpy(fb->comm, current->comm); in drm_framebuffer_init()
888 ret = __drm_mode_object_add(dev, &fb->base, DRM_MODE_OBJECT_FB, in drm_framebuffer_init()
893 mutex_lock(&dev->mode_config.fb_lock); in drm_framebuffer_init()
894 dev->mode_config.num_fb++; in drm_framebuffer_init()
895 list_add(&fb->head, &dev->mode_config.fb_list); in drm_framebuffer_init()
896 mutex_unlock(&dev->mode_config.fb_lock); in drm_framebuffer_init()
898 drm_mode_object_register(dev, &fb->base); in drm_framebuffer_init()
903 for (i = 0; i < fb->format->num_planes; i++) { in drm_framebuffer_init()
904 if (fb->internal_flags & DRM_FRAMEBUFFER_HAS_HANDLE_REF(i)) { in drm_framebuffer_init()
905 drm_gem_object_handle_put_unlocked(fb->obj[i]); in drm_framebuffer_init()
906 fb->internal_flags &= ~DRM_FRAMEBUFFER_HAS_HANDLE_REF(i); in drm_framebuffer_init()
914 * drm_framebuffer_lookup - look up a drm framebuffer and grab a reference
916 * @file_priv: drm file to check for lease against.
919 * If successful, this grabs an additional reference to the framebuffer -
920 * callers need to make sure to eventually unreference the returned framebuffer
938 * drm_framebuffer_unregister_private - unregister a private fb from the lookup idr
939 * @fb: fb to unregister
941 * Drivers need to call this when cleaning up driver-private framebuffers, e.g.
943 * i.e. the object may not be destroyed through this call (since it'll lead to a
946 * NOTE: This function is deprecated. For driver-private framebuffers it is not
947 * recommended to embed a framebuffer struct info fbdev struct, instead, a
949 * when the framebuffer is to be cleaned up.
958 dev = fb->dev; in drm_framebuffer_unregister_private()
961 drm_mode_object_unregister(dev, &fb->base); in drm_framebuffer_unregister_private()
966 * drm_framebuffer_cleanup - remove a framebuffer object
967 * @fb: framebuffer to remove
969 * Cleanup framebuffer. This function is intended to be used from the drivers
970 * &drm_framebuffer_funcs.destroy callback. It can also be used to clean up
973 * Note that this function does not remove the fb from active usage - if it is
975 * the id and get back -EINVAL. Obviously no concern at driver unload time.
977 * Also, the framebuffer will not be removed from the lookup idr - for
978 * user-created framebuffers this will happen in the rmfb ioctl. For
979 * driver-private objects (e.g. for fbdev) drivers need to explicitly call
984 struct drm_device *dev = fb->dev; in drm_framebuffer_cleanup()
987 for (i = 0; i < fb->format->num_planes; i++) { in drm_framebuffer_cleanup()
988 if (fb->internal_flags & DRM_FRAMEBUFFER_HAS_HANDLE_REF(i)) in drm_framebuffer_cleanup()
989 drm_gem_object_handle_put_unlocked(fb->obj[i]); in drm_framebuffer_cleanup()
992 mutex_lock(&dev->mode_config.fb_lock); in drm_framebuffer_cleanup()
993 list_del(&fb->head); in drm_framebuffer_cleanup()
994 dev->mode_config.num_fb--; in drm_framebuffer_cleanup()
995 mutex_unlock(&dev->mode_config.fb_lock); in drm_framebuffer_cleanup()
1002 struct drm_device *dev = fb->dev; in atomic_remove_fb()
1016 ret = -ENOMEM; in atomic_remove_fb()
1019 state->acquire_ctx = &ctx; in atomic_remove_fb()
1030 if (plane->state->fb != fb) in atomic_remove_fb()
1035 plane->base.id, plane->name, fb->base.id); in atomic_remove_fb()
1043 if (disable_crtcs && plane_state->crtc->primary == plane) { in atomic_remove_fb()
1048 plane_state->crtc->base.id, in atomic_remove_fb()
1049 plane_state->crtc->name, fb->base.id); in atomic_remove_fb()
1051 crtc_state = drm_atomic_get_existing_crtc_state(state, plane_state->crtc); in atomic_remove_fb()
1053 ret = drm_atomic_add_affected_connectors(state, plane_state->crtc); in atomic_remove_fb()
1057 crtc_state->active = false; in atomic_remove_fb()
1083 if (ret == -EDEADLK) { in atomic_remove_fb()
1095 if (ret == -EINVAL && !disable_crtcs) { in atomic_remove_fb()
1105 struct drm_device *dev = fb->dev; in legacy_remove_fb()
1112 if (crtc->primary->fb == fb) { in legacy_remove_fb()
1115 crtc->base.id, crtc->name, fb->base.id); in legacy_remove_fb()
1119 DRM_ERROR("failed to reset crtc %p when fb was deleted\n", crtc); in legacy_remove_fb()
1124 if (plane->fb == fb) { in legacy_remove_fb()
1127 plane->base.id, plane->name, fb->base.id); in legacy_remove_fb()
1135 * drm_framebuffer_remove - remove and unreference a framebuffer object
1136 * @fb: framebuffer to remove
1139 * using @fb, removes it, setting it to NULL. Then drops the reference to the
1140 * passed-in framebuffer. Might take the modeset locks.
1143 * last reference to the framebuffer. It is also guaranteed to not take the
1153 dev = fb->dev; in drm_framebuffer_remove()
1155 drm_WARN_ON(dev, !list_empty(&fb->filp_head)); in drm_framebuffer_remove()
1160 * longer need, try to optimize this away. in drm_framebuffer_remove()
1167 * Note that userspace could try to race with use and instate a new in drm_framebuffer_remove()
1169 * in-use fb with fb-id == 0. Userspace is allowed to shoot its own foot in drm_framebuffer_remove()
1190 drm_printf_indent(p, indent, "allocated by = %s\n", fb->comm); in drm_framebuffer_print_info()
1193 drm_printf_indent(p, indent, "format=%p4cc\n", &fb->format->format); in drm_framebuffer_print_info()
1194 drm_printf_indent(p, indent, "modifier=0x%llx\n", fb->modifier); in drm_framebuffer_print_info()
1195 drm_printf_indent(p, indent, "size=%ux%u\n", fb->width, fb->height); in drm_framebuffer_print_info()
1198 for (i = 0; i < fb->format->num_planes; i++) { in drm_framebuffer_print_info()
1200 drm_format_info_plane_width(fb->format, fb->width, i), in drm_framebuffer_print_info()
1201 drm_format_info_plane_height(fb->format, fb->height, i)); in drm_framebuffer_print_info()
1202 drm_printf_indent(p, indent + 1, "pitch[%u]=%u\n", i, fb->pitches[i]); in drm_framebuffer_print_info()
1203 drm_printf_indent(p, indent + 1, "offset[%u]=%u\n", i, fb->offsets[i]); in drm_framebuffer_print_info()
1205 fb->obj[i] ? "" : "(null)"); in drm_framebuffer_print_info()
1206 if (fb->obj[i]) in drm_framebuffer_print_info()
1207 drm_gem_print_info(p, indent + 2, fb->obj[i]); in drm_framebuffer_print_info()
1214 struct drm_debugfs_entry *entry = m->private; in drm_framebuffer_info()
1215 struct drm_device *dev = entry->dev; in drm_framebuffer_info()
1219 mutex_lock(&dev->mode_config.fb_lock); in drm_framebuffer_info()
1221 drm_printf(&p, "framebuffer[%u]:\n", fb->base.id); in drm_framebuffer_info()
1224 mutex_unlock(&dev->mode_config.fb_lock); in drm_framebuffer_info()