broadcom/vc5: Don't forget to get the BO offset when opening a dmabuf.
authorEric Anholt <eric@anholt.net>
Wed, 24 Jan 2018 03:23:01 +0000 (14:23 +1100)
committerEric Anholt <eric@anholt.net>
Sat, 27 Jan 2018 08:40:14 +0000 (19:40 +1100)
Fixes black display in DRI due to storing to 0x00000000.

src/gallium/drivers/vc5/vc5_bufmgr.c

index c6c06dcfda7e75ffc083e041ea908428d76b4e1e..5e068400fd81dc12f4473e9a2f809a111f26aa72 100644 (file)
@@ -348,6 +348,18 @@ vc5_bo_open_handle(struct vc5_screen *screen,
         bo->name = "winsys";
         bo->private = false;
 
+        struct drm_vc5_get_bo_offset get = {
+                .handle = handle,
+        };
+        int ret = vc5_ioctl(screen->fd, DRM_IOCTL_VC5_GET_BO_OFFSET, &get);
+        if (ret) {
+                fprintf(stderr, "Failed to get BO offset: %s\n",
+                        strerror(errno));
+                free(bo);
+                return NULL;
+        }
+        bo->offset = get.offset;
+
 #ifdef USE_VC5_SIMULATOR
         vc5_simulator_open_from_handle(screen->fd, winsys_stride,
                                        bo->handle, bo->size);