From 6169e3a6012d55522fc8028a5674891a5a99d935 Mon Sep 17 00:00:00 2001 From: Ben Skeggs Date: Wed, 18 Mar 2009 10:25:22 +1000 Subject: libdrm/nouveau: implement bo_handle_get for !mm_enabled bo_handle_ref on !mm_enabled treats handle as an offset, make bo_handle_get do the same rather than failing. --- libdrm/nouveau/nouveau_bo.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/libdrm/nouveau/nouveau_bo.c b/libdrm/nouveau/nouveau_bo.c index 6b9877fc..e8232ef2 100644 --- a/libdrm/nouveau/nouveau_bo.c +++ b/libdrm/nouveau/nouveau_bo.c @@ -347,24 +347,25 @@ nouveau_bo_handle_get(struct nouveau_bo *bo, uint32_t *handle) if (!bo || !handle) return -EINVAL; - if (!nvdev->mm_enabled) - return -ENODEV; - if (!nvbo->global_handle) { struct drm_gem_flink req; ret = nouveau_bo_kalloc(nvbo, NULL); if (ret) return ret; - - req.handle = nvbo->handle; - ret = ioctl(nvdev->fd, DRM_IOCTL_GEM_FLINK, &req); - if (ret) { - nouveau_bo_kfree(nvbo); - return ret; + + if (nvdev->mm_enabled) { + req.handle = nvbo->handle; + ret = ioctl(nvdev->fd, DRM_IOCTL_GEM_FLINK, &req); + if (ret) { + nouveau_bo_kfree(nvbo); + return ret; + } + + nvbo->global_handle = req.name; + } else { + nvbo->global_handle = nvbo->offset; } - - nvbo->global_handle = req.name; } *handle = nvbo->global_handle; -- cgit v1.2.3