Lines Matching full: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()
85 /* Make sure source coordinates are inside the fb. */ in drm_framebuffer_check_src_coords()
90 drm_dbg_kms(fb->dev, "Invalid source coordinates " in drm_framebuffer_check_src_coords()
91 "%u.%06ux%u.%06u+%u.%06u+%u.%06u (fb %ux%u)\n", in drm_framebuffer_check_src_coords()
96 fb->width, fb->height); in drm_framebuffer_check_src_coords()
104 * drm_mode_addfb - add an FB to the graphics configuration
109 * Add a new FB to the specified CRTC, given a user request. This is the
226 drm_dbg_kms(dev, "bad fb modifier %llu for plane %d\n", in framebuffer_check()
233 drm_dbg_kms(dev, "bad fb modifier %llu for plane %d\n", in framebuffer_check()
292 struct drm_framebuffer *fb; in drm_internal_framebuffer_create() local
313 drm_dbg_kms(dev, "driver does not support fb modifiers\n"); in drm_internal_framebuffer_create()
321 fb = dev->mode_config.funcs->fb_create(dev, file_priv, r); in drm_internal_framebuffer_create()
322 if (IS_ERR(fb)) { in drm_internal_framebuffer_create()
324 return fb; in drm_internal_framebuffer_create()
327 return fb; in drm_internal_framebuffer_create()
332 * drm_mode_addfb2 - add an FB to the graphics configuration
337 * Add a new FB to the specified CRTC, given a user request with format. This is
350 struct drm_framebuffer *fb; in drm_mode_addfb2() local
355 fb = drm_internal_framebuffer_create(dev, r, file_priv); in drm_mode_addfb2()
356 if (IS_ERR(fb)) in drm_mode_addfb2()
357 return PTR_ERR(fb); in drm_mode_addfb2()
359 drm_dbg_kms(dev, "[FB:%d]\n", fb->base.id); in drm_mode_addfb2()
360 r->fb_id = fb->base.id; in drm_mode_addfb2()
364 list_add(&fb->filp_head, &file_priv->fbs); in drm_mode_addfb2()
404 struct drm_framebuffer *fb = in drm_mode_rmfb_work_fn() local
405 list_first_entry(&arg->fbs, typeof(*fb), filp_head); in drm_mode_rmfb_work_fn()
407 drm_dbg_kms(fb->dev, in drm_mode_rmfb_work_fn()
408 "Removing [FB:%d] from all active usage due to RMFB ioctl\n", in drm_mode_rmfb_work_fn()
409 fb->base.id); 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()
416 * drm_mode_rmfb - remove an FB from the configuration
421 * Remove the specified FB.
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()
462 * handle this after the fb is already removed from the lookup table. 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()
493 * drm_mode_getfb - get FB info
498 * Lookup the FB given its ID and return info about it.
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 = drm_format_info_bpp(fb->format, 0); 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()
555 * drm_mode_getfb2_ioctl - get extended FB info
560 * Lookup the FB given its ID and return info about it.
571 struct drm_framebuffer *fb; in drm_mode_getfb2_ioctl() local
578 fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); in drm_mode_getfb2_ioctl()
579 if (!fb) in drm_mode_getfb2_ioctl()
586 if (!fb->obj[0] && in drm_mode_getfb2_ioctl()
587 (fb->format->num_planes > 1 || !fb->funcs->create_handle)) { in drm_mode_getfb2_ioctl()
592 r->height = fb->height; in drm_mode_getfb2_ioctl()
593 r->width = fb->width; in drm_mode_getfb2_ioctl()
594 r->pixel_format = fb->format->format; in drm_mode_getfb2_ioctl()
607 for (i = 0; i < fb->format->num_planes; i++) { in drm_mode_getfb2_ioctl()
608 r->pitches[i] = fb->pitches[i]; in drm_mode_getfb2_ioctl()
609 r->offsets[i] = fb->offsets[i]; in drm_mode_getfb2_ioctl()
611 r->modifier[i] = fb->modifier; in drm_mode_getfb2_ioctl()
624 for (i = 0; i < fb->format->num_planes; i++) { in drm_mode_getfb2_ioctl()
631 if (fb->obj[i] == fb->obj[j]) { in drm_mode_getfb2_ioctl()
640 if (fb->obj[i]) { in drm_mode_getfb2_ioctl()
641 ret = drm_gem_handle_create(file_priv, fb->obj[i], in drm_mode_getfb2_ioctl()
645 ret = fb->funcs->create_handle(fb, file_priv, in drm_mode_getfb2_ioctl()
672 drm_framebuffer_put(fb); in drm_mode_getfb2_ioctl()
677 * drm_mode_dirtyfb_ioctl - flush frontbuffer rendering on an FB
682 * Lookup the FB and flush out the damaged area supplied by userspace as a clip
701 struct drm_framebuffer *fb; in drm_mode_dirtyfb_ioctl() local
709 fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id); in drm_mode_dirtyfb_ioctl()
710 if (!fb) in drm_mode_dirtyfb_ioctl()
748 if (fb->funcs->dirty) { in drm_mode_dirtyfb_ioctl()
749 ret = fb->funcs->dirty(fb, file_priv, flags, r->color, in drm_mode_dirtyfb_ioctl()
758 drm_framebuffer_put(fb); in drm_mode_dirtyfb_ioctl()
776 struct drm_framebuffer *fb, *tfb; in drm_fb_release() local
782 * When the file gets released that means no one else can access the fb in drm_fb_release()
791 list_for_each_entry_safe(fb, tfb, &priv->fbs, filp_head) { in drm_fb_release()
792 if (drm_framebuffer_read_refcount(fb) > 1) { in drm_fb_release()
793 list_move_tail(&fb->filp_head, &arg.fbs); in drm_fb_release()
795 list_del_init(&fb->filp_head); in drm_fb_release()
798 drm_framebuffer_put(fb); in drm_fb_release()
813 struct drm_framebuffer *fb = in drm_framebuffer_free() local
815 struct drm_device *dev = fb->dev; in drm_framebuffer_free()
821 drm_mode_object_unregister(dev, &fb->base); in drm_framebuffer_free()
823 fb->funcs->destroy(fb); in drm_framebuffer_free()
829 * @fb: framebuffer to be initialized
836 * This functions publishes the fb and makes it available for concurrent access
837 * by other users. Which means by this point the fb _must_ be fully set up -
838 * since all the fb attributes are invariant over its lifetime, no further
844 int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb, in drm_framebuffer_init() argument
849 if (WARN_ON_ONCE(fb->dev != dev || !fb->format)) in drm_framebuffer_init()
852 INIT_LIST_HEAD(&fb->filp_head); in drm_framebuffer_init()
854 fb->funcs = funcs; in drm_framebuffer_init()
855 strcpy(fb->comm, current->comm); in drm_framebuffer_init()
857 ret = __drm_mode_object_add(dev, &fb->base, DRM_MODE_OBJECT_FB, in drm_framebuffer_init()
864 list_add(&fb->head, &dev->mode_config.fb_list); in drm_framebuffer_init()
867 drm_mode_object_register(dev, &fb->base); in drm_framebuffer_init()
877 * @id: id of the fb object
888 struct drm_framebuffer *fb = NULL; in drm_framebuffer_lookup() local
892 fb = obj_to_fb(obj); in drm_framebuffer_lookup()
893 return fb; in drm_framebuffer_lookup()
898 * drm_framebuffer_unregister_private - unregister a private fb from the lookup idr
899 * @fb: fb to unregister
911 void drm_framebuffer_unregister_private(struct drm_framebuffer *fb) in drm_framebuffer_unregister_private() argument
915 if (!fb) in drm_framebuffer_unregister_private()
918 dev = fb->dev; in drm_framebuffer_unregister_private()
920 /* Mark fb as reaped and drop idr ref. */ in drm_framebuffer_unregister_private()
921 drm_mode_object_unregister(dev, &fb->base); in drm_framebuffer_unregister_private()
927 * @fb: framebuffer to remove
933 * Note that this function does not remove the fb from active usage - if it is
942 void drm_framebuffer_cleanup(struct drm_framebuffer *fb) in drm_framebuffer_cleanup() argument
944 struct drm_device *dev = fb->dev; in drm_framebuffer_cleanup()
947 list_del(&fb->head); in drm_framebuffer_cleanup()
953 static int atomic_remove_fb(struct drm_framebuffer *fb) in atomic_remove_fb() argument
956 struct drm_device *dev = fb->dev; in atomic_remove_fb()
984 if (plane->state->fb != fb) in atomic_remove_fb()
988 "Disabling [PLANE:%d:%s] because [FB:%d] is removed\n", in atomic_remove_fb()
989 plane->base.id, plane->name, fb->base.id); in atomic_remove_fb()
1001 "Disabling [CRTC:%d:%s] because [FB:%d] is removed\n", in atomic_remove_fb()
1003 plane_state->crtc->name, fb->base.id); in atomic_remove_fb()
1057 static void legacy_remove_fb(struct drm_framebuffer *fb) in legacy_remove_fb() argument
1059 struct drm_device *dev = fb->dev; in legacy_remove_fb()
1066 if (crtc->primary->fb == fb) { in legacy_remove_fb()
1068 "Disabling [CRTC:%d:%s] because [FB:%d] is removed\n", in legacy_remove_fb()
1069 crtc->base.id, crtc->name, fb->base.id); in legacy_remove_fb()
1073 DRM_ERROR("failed to reset crtc %p when fb was deleted\n", crtc); in legacy_remove_fb()
1078 if (plane->fb == fb) { in legacy_remove_fb()
1080 "Disabling [PLANE:%d:%s] because [FB:%d] is removed\n", in legacy_remove_fb()
1081 plane->base.id, plane->name, fb->base.id); in legacy_remove_fb()
1090 * @fb: framebuffer to remove
1093 * using @fb, removes it, setting it to NULL. Then drops the reference to the
1100 void drm_framebuffer_remove(struct drm_framebuffer *fb) in drm_framebuffer_remove() argument
1104 if (!fb) in drm_framebuffer_remove()
1107 dev = fb->dev; in drm_framebuffer_remove()
1109 WARN_ON(!list_empty(&fb->filp_head)); in drm_framebuffer_remove()
1123 * in-use fb with fb-id == 0. Userspace is allowed to shoot its own foot in drm_framebuffer_remove()
1126 if (drm_framebuffer_read_refcount(fb) > 1) { in drm_framebuffer_remove()
1128 int ret = atomic_remove_fb(fb); in drm_framebuffer_remove()
1132 legacy_remove_fb(fb); in drm_framebuffer_remove()
1135 drm_framebuffer_put(fb); in drm_framebuffer_remove()
1142 * @fb: the framebuffer
1149 const struct drm_framebuffer *fb, int plane) in drm_framebuffer_plane_width() argument
1151 if (plane >= fb->format->num_planes) in drm_framebuffer_plane_width()
1154 return fb_plane_width(width, fb->format, plane); in drm_framebuffer_plane_width()
1161 * @fb: the framebuffer
1168 const struct drm_framebuffer *fb, int plane) in drm_framebuffer_plane_height() argument
1170 if (plane >= fb->format->num_planes) in drm_framebuffer_plane_height()
1173 return fb_plane_height(height, fb->format, plane); in drm_framebuffer_plane_height()
1178 const struct drm_framebuffer *fb) in drm_framebuffer_print_info() argument
1182 drm_printf_indent(p, indent, "allocated by = %s\n", fb->comm); in drm_framebuffer_print_info()
1184 drm_framebuffer_read_refcount(fb)); in drm_framebuffer_print_info()
1185 drm_printf_indent(p, indent, "format=%p4cc\n", &fb->format->format); in drm_framebuffer_print_info()
1186 drm_printf_indent(p, indent, "modifier=0x%llx\n", fb->modifier); in drm_framebuffer_print_info()
1187 drm_printf_indent(p, indent, "size=%ux%u\n", fb->width, fb->height); in drm_framebuffer_print_info()
1190 for (i = 0; i < fb->format->num_planes; i++) { in drm_framebuffer_print_info()
1192 drm_framebuffer_plane_width(fb->width, fb, i), in drm_framebuffer_print_info()
1193 drm_framebuffer_plane_height(fb->height, fb, i)); in drm_framebuffer_print_info()
1194 drm_printf_indent(p, indent + 1, "pitch[%u]=%u\n", i, fb->pitches[i]); in drm_framebuffer_print_info()
1195 drm_printf_indent(p, indent + 1, "offset[%u]=%u\n", i, fb->offsets[i]); in drm_framebuffer_print_info()
1197 fb->obj[i] ? "" : "(null)"); in drm_framebuffer_print_info()
1198 if (fb->obj[i]) in drm_framebuffer_print_info()
1199 drm_gem_print_info(p, indent + 2, fb->obj[i]); in drm_framebuffer_print_info()
1209 struct drm_framebuffer *fb; in drm_framebuffer_info() local
1212 drm_for_each_fb(fb, dev) { in drm_framebuffer_info()
1213 drm_printf(&p, "framebuffer[%u]:\n", fb->base.id); in drm_framebuffer_info()
1214 drm_framebuffer_print_info(&p, 1, fb); in drm_framebuffer_info()