vc4: Don't return a vc4 BO handle on a renderonly screen.
authorEric Anholt <eric@anholt.net>
Thu, 25 Oct 2018 16:17:17 +0000 (09:17 -0700)
committerEric Anholt <eric@anholt.net>
Fri, 16 Nov 2018 05:11:44 +0000 (21:11 -0800)
The handles exported need to be on the KMS device's fd, anything else is
failure.  Also, this code is assuming that the scanout resource has been
created already, so assert it.

src/gallium/drivers/vc4/vc4_resource.c

index 2509456b957959b241f533bbece41f767601f4e7..e82fbeaafcced90dd090a95ac05c361786f1fabc 100644 (file)
@@ -319,8 +319,10 @@ vc4_resource_get_handle(struct pipe_screen *pscreen,
 
                 return vc4_bo_flink(rsc->bo, &whandle->handle);
         case WINSYS_HANDLE_TYPE_KMS:
-                if (screen->ro && renderonly_get_handle(rsc->scanout, whandle))
-                        return TRUE;
+                if (screen->ro) {
+                        assert(rsc->scanout);
+                        return renderonly_get_handle(rsc->scanout, whandle);
+                }
                 whandle->handle = rsc->bo->handle;
                 return TRUE;
         case WINSYS_HANDLE_TYPE_FD: