From 7cc8185ca32c94b2ad1eeb770ef16145929963d4 Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Tue, 30 May 2023 09:15:07 -0700 Subject: [PATCH] freedreno/drm: Don't try to export suballoc bo Suballoc BOs don't have a real handle, so attempting to dmabuf export won't work. Likewise for handle or flink-name export. Signed-off-by: Rob Clark Part-of: --- src/freedreno/drm/freedreno_bo.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/freedreno/drm/freedreno_bo.c b/src/freedreno/drm/freedreno_bo.c index 9145518d916..3f15f52e799 100644 --- a/src/freedreno/drm/freedreno_bo.c +++ b/src/freedreno/drm/freedreno_bo.c @@ -490,6 +490,9 @@ bo_flush(struct fd_bo *bo) int fd_bo_get_name(struct fd_bo *bo, uint32_t *name) { + if (suballoc_bo(bo)) + return -1; + if (!bo->name) { struct drm_gem_flink req = { .handle = bo->handle, @@ -517,6 +520,8 @@ fd_bo_get_name(struct fd_bo *bo, uint32_t *name) uint32_t fd_bo_handle(struct fd_bo *bo) { + if (suballoc_bo(bo)) + return 0; bo->bo_reuse = NO_CACHE; bo->alloc_flags |= FD_BO_SHARED; bo_flush(bo); @@ -528,6 +533,9 @@ fd_bo_dmabuf(struct fd_bo *bo) { int ret, prime_fd; + if (suballoc_bo(bo)) + return -1; + ret = drmPrimeHandleToFD(bo->dev->fd, bo->handle, DRM_CLOEXEC | DRM_RDWR, &prime_fd); if (ret) {