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 <boris.brezillon@collabora.com>
This commit is contained in:
Boris Brezillon
2019-07-02 12:53:17 +02:00
parent aa5bc35f31
commit 8d4afcdacc
3 changed files with 20 additions and 19 deletions

View File

@@ -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;