backend-drm: Fix for gbm modifiers when they are not available.
authorNicholas Niro <blowfist@xroutine.net>
Wed, 30 Oct 2019 01:50:54 +0000 (21:50 -0400)
committerNicholas Niro <blowfist@xroutine.net>
Tue, 12 Nov 2019 17:57:09 +0000 (12:57 -0500)
When the HAVE_GBM_MODIFIERS is unset, make the code drop back
to a single plane version like other places in the code.

libweston/backend-drm/fb.c

index 1eb4a9eb7c8ca44fcffb105dce7158443c70f53a..0132053e49e48b001c78971006c9b68a219058b8 100644 (file)
@@ -342,6 +342,7 @@ drm_fb_get_from_dmabuf(struct linux_dmabuf_buffer *dmabuf,
                goto err_free;
        }
 
+#ifdef HAVE_GBM_MODIFIERS
        fb->num_planes = dmabuf->attributes.n_planes;
        for (i = 0; i < dmabuf->attributes.n_planes; i++) {
                union gbm_bo_handle handle;
@@ -351,6 +352,20 @@ drm_fb_get_from_dmabuf(struct linux_dmabuf_buffer *dmabuf,
                        goto err_free;
                fb->handles[i] = handle.u32;
        }
+#else /* NOT HAVE_GBM_MODIFIERS */
+       {
+               union gbm_bo_handle handle;
+
+               fb->num_planes = 1;
+
+               handle = gbm_bo_get_handle(fb->bo);
+
+               if (handle.s32 == -1)
+                       goto err_free;
+               fb->handles[0] = handle.u32;
+       }
+#endif /* NOT HAVE_GBM_MODIFIERS */
+
 
        if (drm_fb_addfb(backend, fb) != 0)
                goto err_free;