• Home
  • Raw
  • Download

Lines Matching refs:fb

410 int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb,  in drm_framebuffer_init()  argument
416 kref_init(&fb->refcount); in drm_framebuffer_init()
417 INIT_LIST_HEAD(&fb->filp_head); in drm_framebuffer_init()
418 fb->dev = dev; in drm_framebuffer_init()
419 fb->funcs = funcs; in drm_framebuffer_init()
421 ret = drm_mode_object_get(dev, &fb->base, DRM_MODE_OBJECT_FB); in drm_framebuffer_init()
426 list_add(&fb->head, &dev->mode_config.fb_list); in drm_framebuffer_init()
436 struct drm_framebuffer *fb) in __drm_framebuffer_unregister() argument
439 idr_remove(&dev->mode_config.crtc_idr, fb->base.id); in __drm_framebuffer_unregister()
442 fb->base.id = 0; in __drm_framebuffer_unregister()
447 struct drm_framebuffer *fb = in drm_framebuffer_free() local
449 struct drm_device *dev = fb->dev; in drm_framebuffer_free()
456 if (fb->base.id) { in drm_framebuffer_free()
458 __drm_framebuffer_unregister(dev, fb); in drm_framebuffer_free()
462 fb->funcs->destroy(fb); in drm_framebuffer_free()
469 struct drm_framebuffer *fb; in __drm_framebuffer_lookup() local
474 fb = NULL; in __drm_framebuffer_lookup()
476 fb = obj_to_fb(obj); in __drm_framebuffer_lookup()
479 return fb; in __drm_framebuffer_lookup()
494 struct drm_framebuffer *fb; in drm_framebuffer_lookup() local
497 fb = __drm_framebuffer_lookup(dev, id); in drm_framebuffer_lookup()
498 if (fb) { in drm_framebuffer_lookup()
499 if (!kref_get_unless_zero(&fb->refcount)) in drm_framebuffer_lookup()
500 fb = NULL; in drm_framebuffer_lookup()
504 return fb; in drm_framebuffer_lookup()
514 void drm_framebuffer_unreference(struct drm_framebuffer *fb) in drm_framebuffer_unreference() argument
516 DRM_DEBUG("%p: FB ID: %d (%d)\n", fb, fb->base.id, atomic_read(&fb->refcount.refcount)); in drm_framebuffer_unreference()
517 kref_put(&fb->refcount, drm_framebuffer_free); in drm_framebuffer_unreference()
527 void drm_framebuffer_reference(struct drm_framebuffer *fb) in drm_framebuffer_reference() argument
529 DRM_DEBUG("%p: FB ID: %d (%d)\n", fb, fb->base.id, atomic_read(&fb->refcount.refcount)); in drm_framebuffer_reference()
530 kref_get(&fb->refcount); in drm_framebuffer_reference()
543 void drm_framebuffer_unregister_private(struct drm_framebuffer *fb) in drm_framebuffer_unregister_private() argument
545 struct drm_device *dev = fb->dev; in drm_framebuffer_unregister_private()
549 __drm_framebuffer_unregister(dev, fb); in drm_framebuffer_unregister_private()
571 void drm_framebuffer_cleanup(struct drm_framebuffer *fb) in drm_framebuffer_cleanup() argument
573 struct drm_device *dev = fb->dev; in drm_framebuffer_cleanup()
576 list_del(&fb->head); in drm_framebuffer_cleanup()
594 void drm_framebuffer_remove(struct drm_framebuffer *fb) in drm_framebuffer_remove() argument
596 struct drm_device *dev = fb->dev; in drm_framebuffer_remove()
602 WARN_ON(!list_empty(&fb->filp_head)); in drm_framebuffer_remove()
619 if (atomic_read(&fb->refcount.refcount) > 1) { in drm_framebuffer_remove()
623 if (crtc->primary->fb == fb) { in drm_framebuffer_remove()
627 set.fb = NULL; in drm_framebuffer_remove()
635 if (plane->fb == fb) in drm_framebuffer_remove()
641 drm_framebuffer_unreference(fb); in drm_framebuffer_remove()
1278 if (!plane->fb) in drm_plane_force_disable()
1281 plane->old_fb = plane->fb; in drm_plane_force_disable()
1291 plane->fb = NULL; in drm_plane_force_disable()
1694 struct drm_framebuffer *fb; in drm_mode_getresources() local
1727 list_for_each_entry(fb, &file_priv->fbs, filp_head) { in drm_mode_getresources()
1728 if (put_user(fb->base.id, fb_id + copied)) { in drm_mode_getresources()
1896 if (crtc->primary->fb) in drm_mode_getcrtc()
1897 crtc_resp->fb_id = crtc->primary->fb->base.id; in drm_mode_getcrtc()
2217 if (plane->fb) in drm_mode_getplane()
2218 plane_resp->fb_id = plane->fb->base.id; in drm_mode_getplane()
2258 struct drm_framebuffer *fb, in __setplane_internal() argument
2270 if (!fb) { in __setplane_internal()
2271 plane->old_fb = plane->fb; in __setplane_internal()
2275 plane->fb = NULL; in __setplane_internal()
2291 if (fb->pixel_format == plane->format_types[i]) in __setplane_internal()
2295 drm_get_format_name(fb->pixel_format)); in __setplane_internal()
2300 fb_width = fb->width << 16; in __setplane_internal()
2301 fb_height = fb->height << 16; in __setplane_internal()
2318 plane->old_fb = plane->fb; in __setplane_internal()
2319 ret = plane->funcs->update_plane(plane, crtc, fb, in __setplane_internal()
2324 plane->fb = fb; in __setplane_internal()
2325 fb = NULL; in __setplane_internal()
2331 if (fb) in __setplane_internal()
2332 drm_framebuffer_unreference(fb); in __setplane_internal()
2342 struct drm_framebuffer *fb, in setplane_internal() argument
2352 ret = __setplane_internal(plane, crtc, fb, in setplane_internal()
2380 struct drm_framebuffer *fb = NULL; in drm_mode_setplane() local
2410 fb = drm_framebuffer_lookup(dev, plane_req->fb_id); in drm_mode_setplane()
2411 if (!fb) { in drm_mode_setplane()
2431 return setplane_internal(plane, crtc, fb, in drm_mode_setplane()
2451 struct drm_framebuffer *fb; in drm_mode_set_config_internal() local
2461 tmp->primary->old_fb = tmp->primary->fb; in drm_mode_set_config_internal()
2463 fb = set->fb; in drm_mode_set_config_internal()
2468 crtc->primary->fb = fb; in drm_mode_set_config_internal()
2472 if (tmp->primary->fb) in drm_mode_set_config_internal()
2473 drm_framebuffer_reference(tmp->primary->fb); in drm_mode_set_config_internal()
2495 const struct drm_framebuffer *fb) in drm_crtc_check_viewport() argument
2514 if (hdisplay > fb->width || in drm_crtc_check_viewport()
2515 vdisplay > fb->height || in drm_crtc_check_viewport()
2516 x > fb->width - hdisplay || in drm_crtc_check_viewport()
2517 y > fb->height - vdisplay) { in drm_crtc_check_viewport()
2519 fb->width, fb->height, hdisplay, vdisplay, x, y, in drm_crtc_check_viewport()
2548 struct drm_framebuffer *fb = NULL; in drm_mode_setcrtc() local
2578 if (!crtc->primary->fb) { in drm_mode_setcrtc()
2583 fb = crtc->primary->fb; in drm_mode_setcrtc()
2585 drm_framebuffer_reference(fb); in drm_mode_setcrtc()
2587 fb = drm_framebuffer_lookup(dev, crtc_req->fb_id); in drm_mode_setcrtc()
2588 if (!fb) { in drm_mode_setcrtc()
2611 mode, fb); in drm_mode_setcrtc()
2623 if (crtc_req->count_connectors > 0 && (!mode || !fb)) { in drm_mode_setcrtc()
2675 set.fb = fb; in drm_mode_setcrtc()
2679 if (fb) in drm_mode_setcrtc()
2680 drm_framebuffer_unreference(fb); in drm_mode_setcrtc()
2712 struct drm_framebuffer *fb = NULL; in drm_mode_cursor_universal() local
2735 fb = internal_framebuffer_create(dev, &fbreq, file_priv); in drm_mode_cursor_universal()
2736 if (IS_ERR(fb)) { in drm_mode_cursor_universal()
2738 return PTR_ERR(fb); in drm_mode_cursor_universal()
2741 fb = NULL; in drm_mode_cursor_universal()
2744 fb = crtc->cursor->fb; in drm_mode_cursor_universal()
2745 if (fb) in drm_mode_cursor_universal()
2746 drm_framebuffer_reference(fb); in drm_mode_cursor_universal()
2757 if (fb) { in drm_mode_cursor_universal()
2758 crtc_w = fb->width; in drm_mode_cursor_universal()
2759 crtc_h = fb->height; in drm_mode_cursor_universal()
2760 src_w = fb->width << 16; in drm_mode_cursor_universal()
2761 src_h = fb->height << 16; in drm_mode_cursor_universal()
2768 ret = __setplane_internal(crtc->cursor, crtc, fb, in drm_mode_cursor_universal()
2950 struct drm_framebuffer *fb; in drm_mode_addfb() local
2970 fb = dev->mode_config.funcs->fb_create(dev, file_priv, &r); in drm_mode_addfb()
2971 if (IS_ERR(fb)) { in drm_mode_addfb()
2973 return PTR_ERR(fb); in drm_mode_addfb()
2977 or->fb_id = fb->base.id; in drm_mode_addfb()
2978 list_add(&fb->filp_head, &file_priv->fbs); in drm_mode_addfb()
2979 DRM_DEBUG_KMS("[FB:%d]\n", fb->base.id); in drm_mode_addfb()
3114 struct drm_framebuffer *fb; in internal_framebuffer_create() local
3137 fb = dev->mode_config.funcs->fb_create(dev, file_priv, r); in internal_framebuffer_create()
3138 if (IS_ERR(fb)) { in internal_framebuffer_create()
3140 return fb; in internal_framebuffer_create()
3143 return fb; in internal_framebuffer_create()
3165 struct drm_framebuffer *fb; in drm_mode_addfb2() local
3170 fb = internal_framebuffer_create(dev, r, file_priv); in drm_mode_addfb2()
3171 if (IS_ERR(fb)) in drm_mode_addfb2()
3172 return PTR_ERR(fb); in drm_mode_addfb2()
3176 DRM_DEBUG_KMS("[FB:%d]\n", fb->base.id); in drm_mode_addfb2()
3178 r->fb_id = fb->base.id; in drm_mode_addfb2()
3179 list_add(&fb->filp_head, &file_priv->fbs); in drm_mode_addfb2()
3201 struct drm_framebuffer *fb = NULL; in drm_mode_rmfb() local
3211 fb = __drm_framebuffer_lookup(dev, *id); in drm_mode_rmfb()
3212 if (!fb) in drm_mode_rmfb()
3216 if (fb == fbl) in drm_mode_rmfb()
3222 __drm_framebuffer_unregister(dev, fb); in drm_mode_rmfb()
3224 list_del_init(&fb->filp_head); in drm_mode_rmfb()
3228 drm_framebuffer_remove(fb); in drm_mode_rmfb()
3256 struct drm_framebuffer *fb; in drm_mode_getfb() local
3262 fb = drm_framebuffer_lookup(dev, r->fb_id); in drm_mode_getfb()
3263 if (!fb) in drm_mode_getfb()
3266 r->height = fb->height; in drm_mode_getfb()
3267 r->width = fb->width; in drm_mode_getfb()
3268 r->depth = fb->depth; in drm_mode_getfb()
3269 r->bpp = fb->bits_per_pixel; in drm_mode_getfb()
3270 r->pitch = fb->pitches[0]; in drm_mode_getfb()
3271 if (fb->funcs->create_handle) { in drm_mode_getfb()
3274 ret = fb->funcs->create_handle(fb, file_priv, in drm_mode_getfb()
3289 drm_framebuffer_unreference(fb); in drm_mode_getfb()
3319 struct drm_framebuffer *fb; in drm_mode_dirtyfb_ioctl() local
3327 fb = drm_framebuffer_lookup(dev, r->fb_id); in drm_mode_dirtyfb_ioctl()
3328 if (!fb) in drm_mode_dirtyfb_ioctl()
3366 if (fb->funcs->dirty) { in drm_mode_dirtyfb_ioctl()
3367 ret = fb->funcs->dirty(fb, file_priv, flags, r->color, in drm_mode_dirtyfb_ioctl()
3376 drm_framebuffer_unreference(fb); in drm_mode_dirtyfb_ioctl()
3396 struct drm_framebuffer *fb, *tfb; in drm_fb_release() local
3408 list_for_each_entry_safe(fb, tfb, &priv->fbs, filp_head) { in drm_fb_release()
3412 __drm_framebuffer_unregister(dev, fb); in drm_fb_release()
3415 list_del_init(&fb->filp_head); in drm_fb_release()
3418 drm_framebuffer_remove(fb); in drm_fb_release()
4581 struct drm_framebuffer *fb = NULL; in drm_mode_page_flip_ioctl() local
4601 if (crtc->primary->fb == NULL) { in drm_mode_page_flip_ioctl()
4613 fb = drm_framebuffer_lookup(dev, page_flip->fb_id); in drm_mode_page_flip_ioctl()
4614 if (!fb) { in drm_mode_page_flip_ioctl()
4619 ret = drm_crtc_check_viewport(crtc, crtc->x, crtc->y, &crtc->mode, fb); in drm_mode_page_flip_ioctl()
4623 if (crtc->primary->fb->pixel_format != fb->pixel_format) { in drm_mode_page_flip_ioctl()
4656 crtc->primary->old_fb = crtc->primary->fb; in drm_mode_page_flip_ioctl()
4657 ret = crtc->funcs->page_flip(crtc, fb, e, page_flip->flags); in drm_mode_page_flip_ioctl()
4674 WARN_ON(crtc->primary->fb != fb); in drm_mode_page_flip_ioctl()
4676 fb = NULL; in drm_mode_page_flip_ioctl()
4680 if (fb) in drm_mode_page_flip_ioctl()
4681 drm_framebuffer_unreference(fb); in drm_mode_page_flip_ioctl()
5133 struct drm_framebuffer *fb, *fbt; in drm_mode_config_cleanup() local
5172 list_for_each_entry_safe(fb, fbt, &dev->mode_config.fb_list, head) { in drm_mode_config_cleanup()
5173 drm_framebuffer_remove(fb); in drm_mode_config_cleanup()