summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Skeggs <bskeggs@redhat.com>2009-03-18 10:25:22 +1000
committerBen Skeggs <bskeggs@redhat.com>2009-03-18 10:25:22 +1000
commit6169e3a6012d55522fc8028a5674891a5a99d935 (patch)
tree3d08d380643784dcef30a8d416957e6fe2dd1450
parent2e2e8575b1ed4703653a72ac2b60b75316c388d7 (diff)
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.
-rw-r--r--libdrm/nouveau/nouveau_bo.c23
1 files 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;