Lines Matching full:fb
4 Subject: [PATCH 60/92] backend-drm: Support getting drm fb from dmabuf
7 Try to import dmabuf to drm fb directly when GBM fd-import not working.
11 libweston/backend-drm/fb.c | 50 +++++++++++++++++++++++---------------
14 diff --git a/libweston/backend-drm/fb.c b/libweston/backend-drm/fb.c
16 --- a/libweston/backend-drm/fb.c
17 +++ b/libweston/backend-drm/fb.c
20 drm_fb_destroy_dmabuf(struct drm_fb *fb)
24 - if (fb->bo)
25 + if (fb->bo) {
28 gbm_bo_destroy(fb->bo);
31 + for (i = 0; i < fb->num_planes; i++) {
32 + struct drm_gem_close arg = { fb->handles[i], };
33 + drmIoctl(fb->fd, DRM_IOCTL_GEM_CLOSE, &arg);
37 drm_fb_destroy(fb);
42 fb->bo = gbm_bo_import(backend->gbm, GBM_BO_IMPORT_FD_MODIFIER,
44 - if (!fb->bo) {
51 fb->width = dmabuf->attributes.width;
52 fb->height = dmabuf->attributes.height;
53 fb->modifier = dmabuf->attributes.modifier[0];
57 fb->num_planes = dmabuf->attributes.n_planes;
61 - handle = gbm_bo_get_handle_for_plane(fb->bo, i);
66 + if (fb->bo) {
67 + for (i = 0; i < fb->num_planes; i++) {
70 + handle = gbm_bo_get_handle_for_plane(fb->bo, i);
76 + fb->handles[i] = handle.u32;
79 + for (i = 0; i < fb->num_planes; i++) {
80 + if (drmPrimeFDToHandle(fb->fd, import_mod.fds[i],
81 + &fb->handles[i])) {
87 - fb->handles[i] = handle.u32;
90 if (drm_fb_addfb(device, fb) != 0) {