diff options
author | Boris Brezillon <[email protected]> | 2019-07-02 12:53:17 +0200 |
---|---|---|
committer | Boris Brezillon <[email protected]> | 2019-07-02 14:58:51 +0200 |
commit | 8d4afcdacc16822d38318f8e7e0148566d2af9ec (patch) | |
tree | f5ad5e71c4036bc36a5072f41c0688d9eb74953f /src/gallium/drivers/panfrost/pan_resource.c | |
parent | aa5bc35f31863fd15219849bc09826fe5be3a2ba (diff) |
panfrost: Avoid passing winsys handles to import/export BO funcs
Let's keep a clear split between ioctl wrappers and the rest of the
driver. All the import BO function need is a dmabuf FD and the screen
object, and the export one should only take care of generating a dmabuf
FD out of a BO object. Winsys handle manipulation should stay in the
resource.c file.
Signed-off-by: Boris Brezillon <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost/pan_resource.c')
-rw-r--r-- | src/gallium/drivers/panfrost/pan_resource.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c index 8901aeee09b..f86617f80c2 100644 --- a/src/gallium/drivers/panfrost/pan_resource.c +++ b/src/gallium/drivers/panfrost/pan_resource.c @@ -70,7 +70,7 @@ panfrost_resource_from_handle(struct pipe_screen *pscreen, pipe_reference_init(&prsc->reference, 1); prsc->screen = pscreen; - rsc->bo = panfrost_drm_import_bo(screen, whandle); + rsc->bo = panfrost_drm_import_bo(screen, whandle->handle); rsc->slices[0].stride = whandle->stride; rsc->slices[0].initialized = true; @@ -120,10 +120,16 @@ panfrost_resource_get_handle(struct pipe_screen *pscreen, handle->handle = args.fd; return TRUE; - } else - return panfrost_drm_export_bo(screen, rsrc->bo->gem_handle, - rsrc->slices[0].stride, - handle); + } else { + int fd = panfrost_drm_export_bo(screen, rsrc->bo); + + if (fd < 0) + return FALSE; + + handle->handle = fd; + handle->stride = rsrc->slices[0].stride; + return TRUE; + } } return FALSE; |