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.
main
Ben Skeggs 2009-03-18 10:25:22 +10:00
parent 2e2e8575b1
commit 6169e3a601
1 changed files with 12 additions and 11 deletions

View File

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