Lines Matching refs:fb
78 const struct drm_framebuffer *fb) in drm_framebuffer_check_src_coords() argument
82 fb_width = fb->width << 16; in drm_framebuffer_check_src_coords()
83 fb_height = fb->height << 16; 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()
275 struct drm_framebuffer *fb; in drm_internal_framebuffer_create() local
304 fb = dev->mode_config.funcs->fb_create(dev, file_priv, r); in drm_internal_framebuffer_create()
305 if (IS_ERR(fb)) { in drm_internal_framebuffer_create()
307 return fb; in drm_internal_framebuffer_create()
310 return fb; in drm_internal_framebuffer_create()
333 struct drm_framebuffer *fb; in drm_mode_addfb2() local
338 fb = drm_internal_framebuffer_create(dev, r, file_priv); in drm_mode_addfb2()
339 if (IS_ERR(fb)) in drm_mode_addfb2()
340 return PTR_ERR(fb); in drm_mode_addfb2()
342 drm_dbg_kms(dev, "[FB:%d]\n", fb->base.id); in drm_mode_addfb2()
343 r->fb_id = fb->base.id; in drm_mode_addfb2()
347 list_add(&fb->filp_head, &file_priv->fbs); in drm_mode_addfb2()
387 struct drm_framebuffer *fb = in drm_mode_rmfb_work_fn() local
388 list_first_entry(&arg->fbs, typeof(*fb), filp_head); in drm_mode_rmfb_work_fn()
390 drm_dbg_kms(fb->dev, in drm_mode_rmfb_work_fn()
392 fb->base.id); in drm_mode_rmfb_work_fn()
393 list_del_init(&fb->filp_head); in drm_mode_rmfb_work_fn()
394 drm_framebuffer_remove(fb); in drm_mode_rmfb_work_fn()
398 static int drm_mode_closefb(struct drm_framebuffer *fb, in drm_mode_closefb() argument
406 if (fb == fbl) in drm_mode_closefb()
414 list_del_init(&fb->filp_head); in drm_mode_closefb()
418 drm_framebuffer_put(fb); in drm_mode_closefb()
439 struct drm_framebuffer *fb; in drm_mode_rmfb() local
445 fb = drm_framebuffer_lookup(dev, file_priv, fb_id); in drm_mode_rmfb()
446 if (!fb) in drm_mode_rmfb()
449 ret = drm_mode_closefb(fb, file_priv); in drm_mode_rmfb()
451 drm_framebuffer_put(fb); in drm_mode_rmfb()
460 if (drm_framebuffer_read_refcount(fb) > 1) { in drm_mode_rmfb()
465 drm_WARN_ON(dev, !list_empty(&fb->filp_head)); in drm_mode_rmfb()
466 list_add_tail(&fb->filp_head, &arg.fbs); in drm_mode_rmfb()
472 drm_framebuffer_put(fb); in drm_mode_rmfb()
489 struct drm_framebuffer *fb; in drm_mode_closefb_ioctl() local
498 fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); in drm_mode_closefb_ioctl()
499 if (!fb) in drm_mode_closefb_ioctl()
502 ret = drm_mode_closefb(fb, file_priv); in drm_mode_closefb_ioctl()
503 drm_framebuffer_put(fb); in drm_mode_closefb_ioctl()
524 struct drm_framebuffer *fb; in drm_mode_getfb() local
530 fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); in drm_mode_getfb()
531 if (!fb) in drm_mode_getfb()
535 if (fb->format->num_planes > 1) { in drm_mode_getfb()
540 if (!fb->funcs->create_handle) { in drm_mode_getfb()
545 r->height = fb->height; in drm_mode_getfb()
546 r->width = fb->width; in drm_mode_getfb()
547 r->depth = fb->format->depth; in drm_mode_getfb()
548 r->bpp = drm_format_info_bpp(fb->format, 0); in drm_mode_getfb()
549 r->pitch = fb->pitches[0]; in drm_mode_getfb()
562 ret = fb->funcs->create_handle(fb, file_priv, &r->handle); in drm_mode_getfb()
565 drm_framebuffer_put(fb); in drm_mode_getfb()
586 struct drm_framebuffer *fb; in drm_mode_getfb2_ioctl() local
593 fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); in drm_mode_getfb2_ioctl()
594 if (!fb) in drm_mode_getfb2_ioctl()
601 if (!fb->obj[0] && in drm_mode_getfb2_ioctl()
602 (fb->format->num_planes > 1 || !fb->funcs->create_handle)) { in drm_mode_getfb2_ioctl()
607 r->height = fb->height; in drm_mode_getfb2_ioctl()
608 r->width = fb->width; in drm_mode_getfb2_ioctl()
609 r->pixel_format = fb->format->format; in drm_mode_getfb2_ioctl()
622 for (i = 0; i < fb->format->num_planes; i++) { in drm_mode_getfb2_ioctl()
623 r->pitches[i] = fb->pitches[i]; in drm_mode_getfb2_ioctl()
624 r->offsets[i] = fb->offsets[i]; in drm_mode_getfb2_ioctl()
626 r->modifier[i] = fb->modifier; in drm_mode_getfb2_ioctl()
639 for (i = 0; i < fb->format->num_planes; i++) { in drm_mode_getfb2_ioctl()
646 if (fb->obj[i] == fb->obj[j]) { in drm_mode_getfb2_ioctl()
655 if (fb->obj[i]) { in drm_mode_getfb2_ioctl()
656 ret = drm_gem_handle_create(file_priv, fb->obj[i], in drm_mode_getfb2_ioctl()
660 ret = fb->funcs->create_handle(fb, file_priv, in drm_mode_getfb2_ioctl()
687 drm_framebuffer_put(fb); in drm_mode_getfb2_ioctl()
716 struct drm_framebuffer *fb; in drm_mode_dirtyfb_ioctl() local
724 fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); in drm_mode_dirtyfb_ioctl()
725 if (!fb) in drm_mode_dirtyfb_ioctl()
763 if (fb->funcs->dirty) { in drm_mode_dirtyfb_ioctl()
764 ret = fb->funcs->dirty(fb, file_priv, flags, r->color, in drm_mode_dirtyfb_ioctl()
773 drm_framebuffer_put(fb); in drm_mode_dirtyfb_ioctl()
791 struct drm_framebuffer *fb, *tfb; in drm_fb_release() local
806 list_for_each_entry_safe(fb, tfb, &priv->fbs, filp_head) { in drm_fb_release()
807 if (drm_framebuffer_read_refcount(fb) > 1) { in drm_fb_release()
808 list_move_tail(&fb->filp_head, &arg.fbs); in drm_fb_release()
810 list_del_init(&fb->filp_head); in drm_fb_release()
813 drm_framebuffer_put(fb); in drm_fb_release()
828 struct drm_framebuffer *fb = in drm_framebuffer_free() local
830 struct drm_device *dev = fb->dev; in drm_framebuffer_free()
832 drm_WARN_ON(dev, !list_empty(&fb->filp_head)); in drm_framebuffer_free()
838 drm_mode_object_unregister(dev, &fb->base); in drm_framebuffer_free()
840 fb->funcs->destroy(fb); in drm_framebuffer_free()
862 int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb, in drm_framebuffer_init() argument
867 if (WARN_ON_ONCE(fb->dev != dev || !fb->format)) in drm_framebuffer_init()
870 INIT_LIST_HEAD(&fb->filp_head); in drm_framebuffer_init()
872 fb->funcs = funcs; in drm_framebuffer_init()
873 strscpy(fb->comm, current->comm); in drm_framebuffer_init()
875 ret = __drm_mode_object_add(dev, &fb->base, DRM_MODE_OBJECT_FB, in drm_framebuffer_init()
882 list_add(&fb->head, &dev->mode_config.fb_list); in drm_framebuffer_init()
885 drm_mode_object_register(dev, &fb->base); in drm_framebuffer_init()
906 struct drm_framebuffer *fb = NULL; in drm_framebuffer_lookup() local
910 fb = obj_to_fb(obj); in drm_framebuffer_lookup()
911 return fb; in drm_framebuffer_lookup()
929 void drm_framebuffer_unregister_private(struct drm_framebuffer *fb) in drm_framebuffer_unregister_private() argument
933 if (!fb) in drm_framebuffer_unregister_private()
936 dev = fb->dev; in drm_framebuffer_unregister_private()
939 drm_mode_object_unregister(dev, &fb->base); in drm_framebuffer_unregister_private()
960 void drm_framebuffer_cleanup(struct drm_framebuffer *fb) in drm_framebuffer_cleanup() argument
962 struct drm_device *dev = fb->dev; in drm_framebuffer_cleanup()
965 list_del(&fb->head); in drm_framebuffer_cleanup()
971 static int atomic_remove_fb(struct drm_framebuffer *fb) in atomic_remove_fb() argument
974 struct drm_device *dev = fb->dev; in atomic_remove_fb()
1002 if (plane->state->fb != fb) in atomic_remove_fb()
1007 plane->base.id, plane->name, fb->base.id); in atomic_remove_fb()
1021 plane_state->crtc->name, fb->base.id); in atomic_remove_fb()
1075 static void legacy_remove_fb(struct drm_framebuffer *fb) in legacy_remove_fb() argument
1077 struct drm_device *dev = fb->dev; in legacy_remove_fb()
1084 if (crtc->primary->fb == fb) { in legacy_remove_fb()
1087 crtc->base.id, crtc->name, fb->base.id); in legacy_remove_fb()
1096 if (plane->fb == fb) { in legacy_remove_fb()
1099 plane->base.id, plane->name, fb->base.id); in legacy_remove_fb()
1118 void drm_framebuffer_remove(struct drm_framebuffer *fb) in drm_framebuffer_remove() argument
1122 if (!fb) in drm_framebuffer_remove()
1125 dev = fb->dev; in drm_framebuffer_remove()
1127 drm_WARN_ON(dev, !list_empty(&fb->filp_head)); in drm_framebuffer_remove()
1144 if (drm_framebuffer_read_refcount(fb) > 1) { in drm_framebuffer_remove()
1146 int ret = atomic_remove_fb(fb); in drm_framebuffer_remove()
1150 legacy_remove_fb(fb); in drm_framebuffer_remove()
1153 drm_framebuffer_put(fb); in drm_framebuffer_remove()
1158 const struct drm_framebuffer *fb) in drm_framebuffer_print_info() argument
1162 drm_printf_indent(p, indent, "allocated by = %s\n", fb->comm); in drm_framebuffer_print_info()
1164 drm_framebuffer_read_refcount(fb)); in drm_framebuffer_print_info()
1165 drm_printf_indent(p, indent, "format=%p4cc\n", &fb->format->format); in drm_framebuffer_print_info()
1166 drm_printf_indent(p, indent, "modifier=0x%llx\n", fb->modifier); in drm_framebuffer_print_info()
1167 drm_printf_indent(p, indent, "size=%ux%u\n", fb->width, fb->height); in drm_framebuffer_print_info()
1170 for (i = 0; i < fb->format->num_planes; i++) { in drm_framebuffer_print_info()
1172 drm_format_info_plane_width(fb->format, fb->width, i), in drm_framebuffer_print_info()
1173 drm_format_info_plane_height(fb->format, fb->height, i)); in drm_framebuffer_print_info()
1174 drm_printf_indent(p, indent + 1, "pitch[%u]=%u\n", i, fb->pitches[i]); in drm_framebuffer_print_info()
1175 drm_printf_indent(p, indent + 1, "offset[%u]=%u\n", i, fb->offsets[i]); in drm_framebuffer_print_info()
1177 fb->obj[i] ? "" : "(null)"); in drm_framebuffer_print_info()
1178 if (fb->obj[i]) in drm_framebuffer_print_info()
1179 drm_gem_print_info(p, indent + 2, fb->obj[i]); in drm_framebuffer_print_info()
1189 struct drm_framebuffer *fb; in drm_framebuffer_info() local
1192 drm_for_each_fb(fb, dev) { in drm_framebuffer_info()
1193 drm_printf(&p, "framebuffer[%u]:\n", fb->base.id); in drm_framebuffer_info()
1194 drm_framebuffer_print_info(&p, 1, fb); in drm_framebuffer_info()