Lines Matching full:fb
70 const struct drm_framebuffer *fb) in drm_framebuffer_check_src_coords() argument
74 fb_width = fb->width << 16; in drm_framebuffer_check_src_coords()
75 fb_height = fb->height << 16; in drm_framebuffer_check_src_coords()
77 /* Make sure source coordinates are inside the fb. */ in drm_framebuffer_check_src_coords()
83 "%u.%06ux%u.%06u+%u.%06u+%u.%06u (fb %ux%u)\n", in drm_framebuffer_check_src_coords()
88 fb->width, fb->height); in drm_framebuffer_check_src_coords()
96 * drm_mode_addfb - add an FB to the graphics configuration
101 * Add a new FB to the specified CRTC, given a user request. This is the
212 DRM_DEBUG_KMS("bad fb modifier %llu for plane %d\n", in framebuffer_check()
219 DRM_DEBUG_KMS("bad fb modifier %llu for plane %d\n", in framebuffer_check()
278 struct drm_framebuffer *fb; in drm_internal_framebuffer_create() local
299 DRM_DEBUG_KMS("driver does not support fb modifiers\n"); in drm_internal_framebuffer_create()
307 fb = dev->mode_config.funcs->fb_create(dev, file_priv, r); in drm_internal_framebuffer_create()
308 if (IS_ERR(fb)) { in drm_internal_framebuffer_create()
310 return fb; in drm_internal_framebuffer_create()
313 return fb; in drm_internal_framebuffer_create()
317 * drm_mode_addfb2 - add an FB to the graphics configuration
322 * Add a new FB to the specified CRTC, given a user request with format. This is
335 struct drm_framebuffer *fb; in drm_mode_addfb2() local
340 fb = drm_internal_framebuffer_create(dev, r, file_priv); in drm_mode_addfb2()
341 if (IS_ERR(fb)) in drm_mode_addfb2()
342 return PTR_ERR(fb); in drm_mode_addfb2()
344 DRM_DEBUG_KMS("[FB:%d]\n", fb->base.id); in drm_mode_addfb2()
345 r->fb_id = fb->base.id; in drm_mode_addfb2()
349 list_add(&fb->filp_head, &file_priv->fbs); in drm_mode_addfb2()
365 struct drm_framebuffer *fb = in drm_mode_rmfb_work_fn() local
366 list_first_entry(&arg->fbs, typeof(*fb), filp_head); in drm_mode_rmfb_work_fn()
368 list_del_init(&fb->filp_head); in drm_mode_rmfb_work_fn()
369 drm_framebuffer_remove(fb); in drm_mode_rmfb_work_fn()
374 * drm_mode_rmfb - remove an FB from the configuration
379 * Remove the specified FB.
389 struct drm_framebuffer *fb = NULL; in drm_mode_rmfb() local
396 fb = drm_framebuffer_lookup(dev, file_priv, fb_id); in drm_mode_rmfb()
397 if (!fb) in drm_mode_rmfb()
402 if (fb == fbl) in drm_mode_rmfb()
409 list_del_init(&fb->filp_head); in drm_mode_rmfb()
413 drm_framebuffer_put(fb); in drm_mode_rmfb()
420 * handle this after the fb is already removed from the lookup table. in drm_mode_rmfb()
422 if (drm_framebuffer_read_refcount(fb) > 1) { in drm_mode_rmfb()
427 list_add_tail(&fb->filp_head, &arg.fbs); in drm_mode_rmfb()
433 drm_framebuffer_put(fb); in drm_mode_rmfb()
438 drm_framebuffer_put(fb); in drm_mode_rmfb()
451 * drm_mode_getfb - get FB info
456 * Lookup the FB given its ID and return info about it.
467 struct drm_framebuffer *fb; in drm_mode_getfb() local
473 fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); in drm_mode_getfb()
474 if (!fb) in drm_mode_getfb()
478 if (fb->format->num_planes > 1) { in drm_mode_getfb()
483 if (!fb->funcs->create_handle) { in drm_mode_getfb()
488 r->height = fb->height; in drm_mode_getfb()
489 r->width = fb->width; in drm_mode_getfb()
490 r->depth = fb->format->depth; in drm_mode_getfb()
491 r->bpp = fb->format->cpp[0] * 8; in drm_mode_getfb()
492 r->pitch = fb->pitches[0]; in drm_mode_getfb()
505 ret = fb->funcs->create_handle(fb, file_priv, &r->handle); in drm_mode_getfb()
508 drm_framebuffer_put(fb); in drm_mode_getfb()
514 * drm_mode_dirtyfb_ioctl - flush frontbuffer rendering on an FB
519 * Lookup the FB and flush out the damaged area supplied by userspace as a clip
538 struct drm_framebuffer *fb; in drm_mode_dirtyfb_ioctl() local
546 fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); in drm_mode_dirtyfb_ioctl()
547 if (!fb) in drm_mode_dirtyfb_ioctl()
585 if (fb->funcs->dirty) { in drm_mode_dirtyfb_ioctl()
586 ret = fb->funcs->dirty(fb, file_priv, flags, r->color, in drm_mode_dirtyfb_ioctl()
595 drm_framebuffer_put(fb); in drm_mode_dirtyfb_ioctl()
613 struct drm_framebuffer *fb, *tfb; in drm_fb_release() local
619 * When the file gets released that means no one else can access the fb in drm_fb_release()
628 list_for_each_entry_safe(fb, tfb, &priv->fbs, filp_head) { in drm_fb_release()
629 if (drm_framebuffer_read_refcount(fb) > 1) { in drm_fb_release()
630 list_move_tail(&fb->filp_head, &arg.fbs); in drm_fb_release()
632 list_del_init(&fb->filp_head); in drm_fb_release()
635 drm_framebuffer_put(fb); in drm_fb_release()
650 struct drm_framebuffer *fb = in drm_framebuffer_free() local
652 struct drm_device *dev = fb->dev; in drm_framebuffer_free()
658 drm_mode_object_unregister(dev, &fb->base); in drm_framebuffer_free()
660 fb->funcs->destroy(fb); in drm_framebuffer_free()
666 * @fb: framebuffer to be initialized
673 * This functions publishes the fb and makes it available for concurrent access
674 * by other users. Which means by this point the fb _must_ be fully set up -
675 * since all the fb attributes are invariant over its lifetime, no further
681 int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb, in drm_framebuffer_init() argument
686 if (WARN_ON_ONCE(fb->dev != dev || !fb->format)) in drm_framebuffer_init()
689 INIT_LIST_HEAD(&fb->filp_head); in drm_framebuffer_init()
691 fb->funcs = funcs; in drm_framebuffer_init()
692 strcpy(fb->comm, current->comm); in drm_framebuffer_init()
694 ret = __drm_mode_object_add(dev, &fb->base, DRM_MODE_OBJECT_FB, in drm_framebuffer_init()
701 list_add(&fb->head, &dev->mode_config.fb_list); in drm_framebuffer_init()
704 drm_mode_object_register(dev, &fb->base); in drm_framebuffer_init()
714 * @id: id of the fb object
725 struct drm_framebuffer *fb = NULL; in drm_framebuffer_lookup() local
729 fb = obj_to_fb(obj); in drm_framebuffer_lookup()
730 return fb; in drm_framebuffer_lookup()
735 * drm_framebuffer_unregister_private - unregister a private fb from the lookup idr
736 * @fb: fb to unregister
748 void drm_framebuffer_unregister_private(struct drm_framebuffer *fb) in drm_framebuffer_unregister_private() argument
752 if (!fb) in drm_framebuffer_unregister_private()
755 dev = fb->dev; in drm_framebuffer_unregister_private()
757 /* Mark fb as reaped and drop idr ref. */ in drm_framebuffer_unregister_private()
758 drm_mode_object_unregister(dev, &fb->base); in drm_framebuffer_unregister_private()
764 * @fb: framebuffer to remove
770 * Note that this function does not remove the fb from active usage - if it is
779 void drm_framebuffer_cleanup(struct drm_framebuffer *fb) in drm_framebuffer_cleanup() argument
781 struct drm_device *dev = fb->dev; in drm_framebuffer_cleanup()
784 list_del(&fb->head); in drm_framebuffer_cleanup()
790 static int atomic_remove_fb(struct drm_framebuffer *fb) in atomic_remove_fb() argument
793 struct drm_device *dev = fb->dev; in atomic_remove_fb()
821 if (plane->state->fb != fb) in atomic_remove_fb()
885 static void legacy_remove_fb(struct drm_framebuffer *fb) in legacy_remove_fb() argument
887 struct drm_device *dev = fb->dev; in legacy_remove_fb()
894 if (crtc->primary->fb == fb) { in legacy_remove_fb()
897 DRM_ERROR("failed to reset crtc %p when fb was deleted\n", crtc); in legacy_remove_fb()
902 if (plane->fb == fb) in legacy_remove_fb()
910 * @fb: framebuffer to remove
913 * using @fb, removes it, setting it to NULL. Then drops the reference to the
920 void drm_framebuffer_remove(struct drm_framebuffer *fb) in drm_framebuffer_remove() argument
924 if (!fb) in drm_framebuffer_remove()
927 dev = fb->dev; in drm_framebuffer_remove()
929 WARN_ON(!list_empty(&fb->filp_head)); in drm_framebuffer_remove()
943 * in-use fb with fb-id == 0. Userspace is allowed to shoot its own foot in drm_framebuffer_remove()
946 if (drm_framebuffer_read_refcount(fb) > 1) { in drm_framebuffer_remove()
948 int ret = atomic_remove_fb(fb); in drm_framebuffer_remove()
951 legacy_remove_fb(fb); in drm_framebuffer_remove()
954 drm_framebuffer_put(fb); in drm_framebuffer_remove()
961 * @fb: the framebuffer
968 const struct drm_framebuffer *fb, int plane) in drm_framebuffer_plane_width() argument
970 if (plane >= fb->format->num_planes) in drm_framebuffer_plane_width()
973 return fb_plane_width(width, fb->format, plane); in drm_framebuffer_plane_width()
980 * @fb: the framebuffer
987 const struct drm_framebuffer *fb, int plane) in drm_framebuffer_plane_height() argument
989 if (plane >= fb->format->num_planes) in drm_framebuffer_plane_height()
992 return fb_plane_height(height, fb->format, plane); in drm_framebuffer_plane_height()
997 const struct drm_framebuffer *fb) in drm_framebuffer_print_info() argument
1002 drm_printf_indent(p, indent, "allocated by = %s\n", fb->comm); in drm_framebuffer_print_info()
1004 drm_framebuffer_read_refcount(fb)); in drm_framebuffer_print_info()
1006 drm_get_format_name(fb->format->format, &format_name)); in drm_framebuffer_print_info()
1007 drm_printf_indent(p, indent, "modifier=0x%llx\n", fb->modifier); in drm_framebuffer_print_info()
1008 drm_printf_indent(p, indent, "size=%ux%u\n", fb->width, fb->height); in drm_framebuffer_print_info()
1011 for (i = 0; i < fb->format->num_planes; i++) { in drm_framebuffer_print_info()
1013 drm_framebuffer_plane_width(fb->width, fb, i), in drm_framebuffer_print_info()
1014 drm_framebuffer_plane_height(fb->height, fb, i)); in drm_framebuffer_print_info()
1015 drm_printf_indent(p, indent + 1, "pitch[%u]=%u\n", i, fb->pitches[i]); in drm_framebuffer_print_info()
1016 drm_printf_indent(p, indent + 1, "offset[%u]=%u\n", i, fb->offsets[i]); in drm_framebuffer_print_info()
1018 fb->obj[i] ? "" : "(null)"); in drm_framebuffer_print_info()
1019 if (fb->obj[i]) in drm_framebuffer_print_info()
1020 drm_gem_print_info(p, indent + 2, fb->obj[i]); in drm_framebuffer_print_info()
1030 struct drm_framebuffer *fb; in drm_framebuffer_info() local
1033 drm_for_each_fb(fb, dev) { in drm_framebuffer_info()
1034 drm_printf(&p, "framebuffer[%u]:\n", fb->base.id); in drm_framebuffer_info()
1035 drm_framebuffer_print_info(&p, 1, fb); in drm_framebuffer_info()