summaryrefslogtreecommitdiff
path: root/linux-core/drm_bo.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-02-20 13:27:10 +1000
committerDave Airlie <airlied@linux.ie>2008-03-06 05:31:50 +1000
commit180c9188f4cb7163f1e3e7d5098eaabf29a98540 (patch)
tree71a6af7b47fa72f354d46a0340463265ec350dbd /linux-core/drm_bo.c
parent12574590cdf7871755d1939463ca6898251fd0d1 (diff)
drm/ttm: add ioctl to get back memory managed area sized
taken from modesetting branch but could be useful outside it.
Diffstat (limited to 'linux-core/drm_bo.c')
-rw-r--r--linux-core/drm_bo.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/linux-core/drm_bo.c b/linux-core/drm_bo.c
index 95802fe2..b67946eb 100644
--- a/linux-core/drm_bo.c
+++ b/linux-core/drm_bo.c
@@ -2283,6 +2283,7 @@ int drm_bo_init_mm(struct drm_device *dev,
}
man->has_type = 1;
man->use_type = 1;
+ man->size = p_size;
INIT_LIST_HEAD(&man->lru);
INIT_LIST_HEAD(&man->pinned);
@@ -2553,6 +2554,42 @@ int drm_mm_unlock_ioctl(struct drm_device *dev,
return 0;
}
+int drm_mm_info_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv)
+{
+ struct drm_mm_info_arg *arg = data;
+ struct drm_buffer_manager *bm = &dev->bm;
+ struct drm_bo_driver *driver = dev->driver->bo_driver;
+ struct drm_mem_type_manager *man;
+ int ret = 0;
+ int mem_type = arg->mem_type;
+
+ if (!driver) {
+ DRM_ERROR("Buffer objects are not supported by this driver\n");
+ return -EINVAL;
+ }
+
+ if (mem_type >= DRM_BO_MEM_TYPES) {
+ DRM_ERROR("Illegal memory type %d\n", arg->mem_type);
+ return -EINVAL;
+ }
+
+ mutex_lock(&dev->struct_mutex);
+ if (!bm->initialized) {
+ DRM_ERROR("DRM memory manager was not initialized\n");
+ ret = -EINVAL;
+ goto out;
+ }
+
+
+ man = &bm->man[arg->mem_type];
+
+ arg->p_size = man->size;
+
+out:
+ mutex_unlock(&dev->struct_mutex);
+
+ return ret;
+}
/*
* buffer object vm functions.
*/