Lines Matching full:fb
279 int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb, in drm_framebuffer_init() argument
284 refcount_init(&fb->refcount, 1); in drm_framebuffer_init()
286 ret = drm_mode_object_get(dev, &fb->base, DRM_MODE_OBJECT_FB); in drm_framebuffer_init()
290 fb->dev = dev; in drm_framebuffer_init()
291 fb->funcs = funcs; in drm_framebuffer_init()
293 list_add(&fb->head, &dev->mode_config.fb_list); in drm_framebuffer_init()
299 static void drm_framebuffer_free(struct drm_framebuffer *fb) in drm_framebuffer_free() argument
301 fb->funcs->destroy(fb); in drm_framebuffer_free()
310 void drm_framebuffer_unreference(struct drm_framebuffer *fb) in drm_framebuffer_unreference() argument
312 struct drm_device *dev = fb->dev; in drm_framebuffer_unreference()
313 DRM_DEBUG("FB ID: %d\n", fb->base.id); in drm_framebuffer_unreference()
316 if (refcount_release(&fb->refcount)) in drm_framebuffer_unreference()
317 drm_framebuffer_free(fb); in drm_framebuffer_unreference()
322 * drm_framebuffer_reference - incr the fb refcnt
324 void drm_framebuffer_reference(struct drm_framebuffer *fb) in drm_framebuffer_reference() argument
326 DRM_DEBUG("FB ID: %d\n", fb->base.id); in drm_framebuffer_reference()
327 refcount_acquire(&fb->refcount); in drm_framebuffer_reference()
333 * @fb: framebuffer to remove
338 * Scans all the CRTCs in @dev's mode_config. If they're using @fb, removes
341 void drm_framebuffer_cleanup(struct drm_framebuffer *fb) in drm_framebuffer_cleanup() argument
343 struct drm_device *dev = fb->dev; in drm_framebuffer_cleanup()
346 * debugging is nice to keep around the list of fb's that are in drm_framebuffer_cleanup()
351 drm_mode_object_put(dev, &fb->base); in drm_framebuffer_cleanup()
352 list_del(&fb->head); in drm_framebuffer_cleanup()
359 * @fb: framebuffer to remove
365 * using @fb, removes it, setting it to NULL.
367 void drm_framebuffer_remove(struct drm_framebuffer *fb) in drm_framebuffer_remove() argument
369 struct drm_device *dev = fb->dev; in drm_framebuffer_remove()
377 if (crtc->fb == fb) { in drm_framebuffer_remove()
381 set.fb = NULL; in drm_framebuffer_remove()
384 DRM_ERROR("failed to reset crtc %p when fb was deleted\n", crtc); in drm_framebuffer_remove()
389 if (plane->fb == fb) { in drm_framebuffer_remove()
393 DRM_ERROR("failed to disable plane with busy fb\n"); in drm_framebuffer_remove()
394 /* disconnect the plane from the fb and crtc: */ in drm_framebuffer_remove()
395 plane->fb = NULL; in drm_framebuffer_remove()
400 list_del(&fb->filp_head); in drm_framebuffer_remove()
402 drm_framebuffer_unreference(fb); in drm_framebuffer_remove()
1058 struct drm_framebuffer *fb, *fbt; in drm_mode_config_cleanup() local
1083 list_for_each_entry_safe(fb, fbt, &dev->mode_config.fb_list, head) { in drm_mode_config_cleanup()
1084 drm_framebuffer_remove(fb); in drm_mode_config_cleanup()
1202 struct drm_framebuffer *fb; in drm_mode_getresources() local
1258 list_for_each_entry(fb, &file_priv->fbs, filp_head) { in drm_mode_getresources()
1259 if (put_user(fb->base.id, fb_id + copied)) { in drm_mode_getresources()
1408 if (crtc->fb) in drm_mode_getcrtc()
1409 crtc_resp->fb_id = crtc->fb->base.id; in drm_mode_getcrtc()
1664 * current fb, etc.
1692 if (plane->fb) in drm_mode_getplane()
1693 plane_resp->fb_id = plane->fb->base.id; in drm_mode_getplane()
1731 * Set plane info, including placement, fb, scaling, and other factors.
1732 * Or pass a NULL fb to disable.
1741 struct drm_framebuffer *fb; in drm_mode_setplane() local
1752 * First, find the plane, crtc, and fb objects. If not available, in drm_mode_setplane()
1765 /* No fb means shut it down */ in drm_mode_setplane()
1769 plane->fb = NULL; in drm_mode_setplane()
1791 fb = obj_to_fb(obj); in drm_mode_setplane()
1793 /* Check whether this plane supports the fb pixel format. */ in drm_mode_setplane()
1795 if (fb->pixel_format == plane->format_types[i]) in drm_mode_setplane()
1798 DRM_DEBUG_KMS("Invalid pixel format 0x%08x\n", fb->pixel_format); in drm_mode_setplane()
1803 fb_width = fb->width << 16; in drm_mode_setplane()
1804 fb_height = fb->height << 16; in drm_mode_setplane()
1806 /* Make sure source coordinates are inside the fb. */ in drm_mode_setplane()
1837 ret = plane->funcs->update_plane(plane, crtc, fb, in drm_mode_setplane()
1844 plane->fb = fb; in drm_mode_setplane()
1878 struct drm_framebuffer *fb = NULL; in drm_mode_setcrtc() local
1906 /* If we pass -1, set the mode with the currently bound fb */ in drm_mode_setcrtc()
1908 if (!crtc->fb) { in drm_mode_setcrtc()
1909 DRM_DEBUG_KMS("CRTC doesn't have current FB\n"); in drm_mode_setcrtc()
1913 fb = crtc->fb; in drm_mode_setcrtc()
1918 DRM_DEBUG_KMS("Unknown FB ID%d\n", in drm_mode_setcrtc()
1923 fb = obj_to_fb(obj); in drm_mode_setcrtc()
1950 if (hdisplay > fb->width || in drm_mode_setcrtc()
1951 vdisplay > fb->height || in drm_mode_setcrtc()
1952 crtc_req->x > fb->width - hdisplay || in drm_mode_setcrtc()
1953 crtc_req->y > fb->height - vdisplay) { in drm_mode_setcrtc()
1954 DRM_DEBUG_KMS("Invalid fb size %ux%u for CRTC viewport %ux%u+%d+%d%s.\n", in drm_mode_setcrtc()
1955 fb->width, fb->height, in drm_mode_setcrtc()
1969 if (crtc_req->count_connectors > 0 && (!mode || !fb)) { in drm_mode_setcrtc()
1970 DRM_DEBUG_KMS("Count connectors is %d but no mode or fb set\n", in drm_mode_setcrtc()
2019 set.fb = fb; in drm_mode_setcrtc()
2112 * drm_mode_addfb - add an FB to the graphics configuration
2121 * Add a new FB to the specified CRTC, given a user request.
2134 struct drm_framebuffer *fb; in drm_mode_addfb() local
2159 ret = dev->mode_config.funcs->fb_create(dev, file_priv, &r, &fb); in drm_mode_addfb()
2165 or->fb_id = fb->base.id; in drm_mode_addfb()
2166 list_add(&fb->filp_head, &file_priv->fbs); in drm_mode_addfb()
2167 DRM_DEBUG_KMS("[FB:%d]\n", fb->base.id); in drm_mode_addfb()
2295 * drm_mode_addfb2 - add an FB to the graphics configuration
2304 * Add a new FB to the specified CRTC, given a user request with format.
2316 struct drm_framebuffer *fb; in drm_mode_addfb2() local
2344 ret = dev->mode_config.funcs->fb_create(dev, file_priv, r, &fb); in drm_mode_addfb2()
2350 r->fb_id = fb->base.id; in drm_mode_addfb2()
2351 list_add(&fb->filp_head, &file_priv->fbs); in drm_mode_addfb2()
2352 DRM_DEBUG_KMS("[FB:%d]\n", fb->base.id); in drm_mode_addfb2()
2360 * drm_mode_rmfb - remove an FB from the configuration
2369 * Remove the FB specified by the user.
2380 struct drm_framebuffer *fb = NULL; in drm_mode_rmfb() local
2396 fb = obj_to_fb(obj); in drm_mode_rmfb()
2399 if (fb == fbl) in drm_mode_rmfb()
2407 drm_framebuffer_remove(fb); in drm_mode_rmfb()
2415 * drm_mode_getfb - get FB info
2424 * Lookup the FB given its ID and return info about it.
2436 struct drm_framebuffer *fb; in drm_mode_getfb() local
2448 fb = obj_to_fb(obj); in drm_mode_getfb()
2450 r->height = fb->height; in drm_mode_getfb()
2451 r->width = fb->width; in drm_mode_getfb()
2452 r->depth = fb->depth; in drm_mode_getfb()
2453 r->bpp = fb->bits_per_pixel; in drm_mode_getfb()
2454 r->pitch = fb->pitches[0]; in drm_mode_getfb()
2456 fb->funcs->create_handle(fb, file_priv, &r->handle); in drm_mode_getfb()
2470 struct drm_framebuffer *fb; in drm_mode_dirtyfb_ioctl() local
2484 fb = obj_to_fb(obj); in drm_mode_dirtyfb_ioctl()
2517 if (fb->funcs->dirty) { in drm_mode_dirtyfb_ioctl()
2518 ret = fb->funcs->dirty(fb, file_priv, flags, r->color, in drm_mode_dirtyfb_ioctl()
2550 struct drm_framebuffer *fb, *tfb; in drm_fb_release() local
2553 list_for_each_entry_safe(fb, tfb, &priv->fbs, filp_head) { in drm_fb_release()
2554 drm_framebuffer_remove(fb); in drm_fb_release()
3531 struct drm_framebuffer *fb; in drm_mode_page_flip_ioctl() local
3549 if (crtc->fb == NULL) { in drm_mode_page_flip_ioctl()
3564 fb = obj_to_fb(obj); in drm_mode_page_flip_ioctl()
3576 if (hdisplay > fb->width || in drm_mode_page_flip_ioctl()
3577 vdisplay > fb->height || in drm_mode_page_flip_ioctl()
3578 crtc->x > fb->width - hdisplay || in drm_mode_page_flip_ioctl()
3579 crtc->y > fb->height - vdisplay) { in drm_mode_page_flip_ioctl()
3580 DRM_DEBUG_KMS("Invalid fb size %ux%u for CRTC viewport %ux%u+%d+%d%s.\n", in drm_mode_page_flip_ioctl()
3581 fb->width, fb->height, hdisplay, vdisplay, crtc->x, crtc->y, in drm_mode_page_flip_ioctl()
3607 ret = crtc->funcs->page_flip(crtc, fb, e); in drm_mode_page_flip_ioctl()