Lines Matching refs:fb
77 const struct drm_framebuffer *fb) in drm_framebuffer_check_src_coords() argument
81 fb_width = fb->width << 16; in drm_framebuffer_check_src_coords()
82 fb_height = fb->height << 16; in drm_framebuffer_check_src_coords()
95 fb->width, fb->height); in drm_framebuffer_check_src_coords()
295 struct drm_framebuffer *fb; in drm_internal_framebuffer_create() local
324 fb = dev->mode_config.funcs->fb_create(dev, file_priv, r); in drm_internal_framebuffer_create()
325 if (IS_ERR(fb)) { in drm_internal_framebuffer_create()
327 return fb; in drm_internal_framebuffer_create()
330 return fb; in drm_internal_framebuffer_create()
353 struct drm_framebuffer *fb; in drm_mode_addfb2() local
358 fb = drm_internal_framebuffer_create(dev, r, file_priv); in drm_mode_addfb2()
359 if (IS_ERR(fb)) in drm_mode_addfb2()
360 return PTR_ERR(fb); in drm_mode_addfb2()
362 DRM_DEBUG_KMS("[FB:%d]\n", fb->base.id); in drm_mode_addfb2()
363 r->fb_id = fb->base.id; in drm_mode_addfb2()
367 list_add(&fb->filp_head, &file_priv->fbs); in drm_mode_addfb2()
407 struct drm_framebuffer *fb = in drm_mode_rmfb_work_fn() local
408 list_first_entry(&arg->fbs, typeof(*fb), filp_head); in drm_mode_rmfb_work_fn()
410 list_del_init(&fb->filp_head); in drm_mode_rmfb_work_fn()
411 drm_framebuffer_remove(fb); in drm_mode_rmfb_work_fn()
431 struct drm_framebuffer *fb = NULL; in drm_mode_rmfb() local
438 fb = drm_framebuffer_lookup(dev, file_priv, fb_id); in drm_mode_rmfb()
439 if (!fb) in drm_mode_rmfb()
444 if (fb == fbl) in drm_mode_rmfb()
451 list_del_init(&fb->filp_head); in drm_mode_rmfb()
455 drm_framebuffer_put(fb); in drm_mode_rmfb()
464 if (drm_framebuffer_read_refcount(fb) > 1) { in drm_mode_rmfb()
469 list_add_tail(&fb->filp_head, &arg.fbs); in drm_mode_rmfb()
475 drm_framebuffer_put(fb); in drm_mode_rmfb()
480 drm_framebuffer_put(fb); in drm_mode_rmfb()
509 struct drm_framebuffer *fb; in drm_mode_getfb() local
515 fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); in drm_mode_getfb()
516 if (!fb) in drm_mode_getfb()
520 if (fb->format->num_planes > 1) { in drm_mode_getfb()
525 if (!fb->funcs->create_handle) { in drm_mode_getfb()
530 r->height = fb->height; in drm_mode_getfb()
531 r->width = fb->width; in drm_mode_getfb()
532 r->depth = fb->format->depth; in drm_mode_getfb()
533 r->bpp = fb->format->cpp[0] * 8; in drm_mode_getfb()
534 r->pitch = fb->pitches[0]; in drm_mode_getfb()
547 ret = fb->funcs->create_handle(fb, file_priv, &r->handle); in drm_mode_getfb()
550 drm_framebuffer_put(fb); in drm_mode_getfb()
580 struct drm_framebuffer *fb; in drm_mode_dirtyfb_ioctl() local
588 fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); in drm_mode_dirtyfb_ioctl()
589 if (!fb) in drm_mode_dirtyfb_ioctl()
627 if (fb->funcs->dirty) { in drm_mode_dirtyfb_ioctl()
628 ret = fb->funcs->dirty(fb, file_priv, flags, r->color, in drm_mode_dirtyfb_ioctl()
637 drm_framebuffer_put(fb); in drm_mode_dirtyfb_ioctl()
655 struct drm_framebuffer *fb, *tfb; in drm_fb_release() local
670 list_for_each_entry_safe(fb, tfb, &priv->fbs, filp_head) { in drm_fb_release()
671 if (drm_framebuffer_read_refcount(fb) > 1) { in drm_fb_release()
672 list_move_tail(&fb->filp_head, &arg.fbs); in drm_fb_release()
674 list_del_init(&fb->filp_head); in drm_fb_release()
677 drm_framebuffer_put(fb); in drm_fb_release()
692 struct drm_framebuffer *fb = in drm_framebuffer_free() local
694 struct drm_device *dev = fb->dev; in drm_framebuffer_free()
700 drm_mode_object_unregister(dev, &fb->base); in drm_framebuffer_free()
702 fb->funcs->destroy(fb); in drm_framebuffer_free()
723 int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb, in drm_framebuffer_init() argument
728 if (WARN_ON_ONCE(fb->dev != dev || !fb->format)) in drm_framebuffer_init()
731 INIT_LIST_HEAD(&fb->filp_head); in drm_framebuffer_init()
733 fb->funcs = funcs; in drm_framebuffer_init()
734 strcpy(fb->comm, current->comm); in drm_framebuffer_init()
736 ret = __drm_mode_object_add(dev, &fb->base, DRM_MODE_OBJECT_FB, in drm_framebuffer_init()
743 list_add(&fb->head, &dev->mode_config.fb_list); in drm_framebuffer_init()
746 drm_mode_object_register(dev, &fb->base); in drm_framebuffer_init()
767 struct drm_framebuffer *fb = NULL; in drm_framebuffer_lookup() local
771 fb = obj_to_fb(obj); in drm_framebuffer_lookup()
772 return fb; in drm_framebuffer_lookup()
790 void drm_framebuffer_unregister_private(struct drm_framebuffer *fb) in drm_framebuffer_unregister_private() argument
794 if (!fb) in drm_framebuffer_unregister_private()
797 dev = fb->dev; in drm_framebuffer_unregister_private()
800 drm_mode_object_unregister(dev, &fb->base); in drm_framebuffer_unregister_private()
821 void drm_framebuffer_cleanup(struct drm_framebuffer *fb) in drm_framebuffer_cleanup() argument
823 struct drm_device *dev = fb->dev; in drm_framebuffer_cleanup()
826 list_del(&fb->head); in drm_framebuffer_cleanup()
832 static int atomic_remove_fb(struct drm_framebuffer *fb) in atomic_remove_fb() argument
835 struct drm_device *dev = fb->dev; in atomic_remove_fb()
863 if (plane->state->fb != fb) in atomic_remove_fb()
927 static void legacy_remove_fb(struct drm_framebuffer *fb) in legacy_remove_fb() argument
929 struct drm_device *dev = fb->dev; in legacy_remove_fb()
936 if (crtc->primary->fb == fb) { in legacy_remove_fb()
944 if (plane->fb == fb) in legacy_remove_fb()
962 void drm_framebuffer_remove(struct drm_framebuffer *fb) in drm_framebuffer_remove() argument
966 if (!fb) in drm_framebuffer_remove()
969 dev = fb->dev; in drm_framebuffer_remove()
971 WARN_ON(!list_empty(&fb->filp_head)); in drm_framebuffer_remove()
988 if (drm_framebuffer_read_refcount(fb) > 1) { in drm_framebuffer_remove()
990 int ret = atomic_remove_fb(fb); in drm_framebuffer_remove()
993 legacy_remove_fb(fb); in drm_framebuffer_remove()
996 drm_framebuffer_put(fb); in drm_framebuffer_remove()
1010 const struct drm_framebuffer *fb, int plane) in drm_framebuffer_plane_width() argument
1012 if (plane >= fb->format->num_planes) in drm_framebuffer_plane_width()
1015 return fb_plane_width(width, fb->format, plane); in drm_framebuffer_plane_width()
1029 const struct drm_framebuffer *fb, int plane) in drm_framebuffer_plane_height() argument
1031 if (plane >= fb->format->num_planes) in drm_framebuffer_plane_height()
1034 return fb_plane_height(height, fb->format, plane); in drm_framebuffer_plane_height()
1039 const struct drm_framebuffer *fb) in drm_framebuffer_print_info() argument
1044 drm_printf_indent(p, indent, "allocated by = %s\n", fb->comm); in drm_framebuffer_print_info()
1046 drm_framebuffer_read_refcount(fb)); in drm_framebuffer_print_info()
1048 drm_get_format_name(fb->format->format, &format_name)); in drm_framebuffer_print_info()
1049 drm_printf_indent(p, indent, "modifier=0x%llx\n", fb->modifier); in drm_framebuffer_print_info()
1050 drm_printf_indent(p, indent, "size=%ux%u\n", fb->width, fb->height); in drm_framebuffer_print_info()
1053 for (i = 0; i < fb->format->num_planes; i++) { in drm_framebuffer_print_info()
1055 drm_framebuffer_plane_width(fb->width, fb, i), in drm_framebuffer_print_info()
1056 drm_framebuffer_plane_height(fb->height, fb, i)); in drm_framebuffer_print_info()
1057 drm_printf_indent(p, indent + 1, "pitch[%u]=%u\n", i, fb->pitches[i]); in drm_framebuffer_print_info()
1058 drm_printf_indent(p, indent + 1, "offset[%u]=%u\n", i, fb->offsets[i]); in drm_framebuffer_print_info()
1060 fb->obj[i] ? "" : "(null)"); in drm_framebuffer_print_info()
1061 if (fb->obj[i]) in drm_framebuffer_print_info()
1062 drm_gem_print_info(p, indent + 2, fb->obj[i]); in drm_framebuffer_print_info()
1072 struct drm_framebuffer *fb; in drm_framebuffer_info() local
1075 drm_for_each_fb(fb, dev) { in drm_framebuffer_info()
1076 drm_printf(&p, "framebuffer[%u]:\n", fb->base.id); in drm_framebuffer_info()
1077 drm_framebuffer_print_info(&p, 1, fb); in drm_framebuffer_info()