diff options
author | Jesse Barnes <jbarnes@virtuousgeek.org> | 2008-11-05 13:31:53 -0500 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2008-12-29 02:47:22 -0500 |
commit | a2c0a97b784f837300f7b0869c82ab712c600952 (patch) | |
tree | aca1cdf3d32e1cfa7387350483f6a70c74a24ffd /drivers/gpu/drm/drm_vm.c | |
parent | a9587470f753d670d910293ecbf1c7b66c99de50 (diff) |
drm: GEM mmap support
Add core support for mapping of GEM objects. Drivers should provide a
vm_operations_struct if they want to support page faulting of objects.
The code for handling GEM object offsets was taken from TTM, which was
written by Thomas Hellström.
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_vm.c')
-rw-r--r-- | drivers/gpu/drm/drm_vm.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/gpu/drm/drm_vm.c b/drivers/gpu/drm/drm_vm.c index c234c6f24a8d..3ffae021d280 100644 --- a/drivers/gpu/drm/drm_vm.c +++ b/drivers/gpu/drm/drm_vm.c | |||
@@ -267,6 +267,9 @@ static void drm_vm_shm_close(struct vm_area_struct *vma) | |||
267 | dmah.size = map->size; | 267 | dmah.size = map->size; |
268 | __drm_pci_free(dev, &dmah); | 268 | __drm_pci_free(dev, &dmah); |
269 | break; | 269 | break; |
270 | case _DRM_GEM: | ||
271 | DRM_ERROR("tried to rmmap GEM object\n"); | ||
272 | break; | ||
270 | } | 273 | } |
271 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); | 274 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); |
272 | } | 275 | } |
@@ -399,7 +402,7 @@ static struct vm_operations_struct drm_vm_sg_ops = { | |||
399 | * Create a new drm_vma_entry structure as the \p vma private data entry and | 402 | * Create a new drm_vma_entry structure as the \p vma private data entry and |
400 | * add it to drm_device::vmalist. | 403 | * add it to drm_device::vmalist. |
401 | */ | 404 | */ |
402 | static void drm_vm_open_locked(struct vm_area_struct *vma) | 405 | void drm_vm_open_locked(struct vm_area_struct *vma) |
403 | { | 406 | { |
404 | struct drm_file *priv = vma->vm_file->private_data; | 407 | struct drm_file *priv = vma->vm_file->private_data; |
405 | struct drm_device *dev = priv->minor->dev; | 408 | struct drm_device *dev = priv->minor->dev; |
@@ -540,7 +543,7 @@ EXPORT_SYMBOL(drm_core_get_reg_ofs); | |||
540 | * according to the mapping type and remaps the pages. Finally sets the file | 543 | * according to the mapping type and remaps the pages. Finally sets the file |
541 | * pointer and calls vm_open(). | 544 | * pointer and calls vm_open(). |
542 | */ | 545 | */ |
543 | static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) | 546 | int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma) |
544 | { | 547 | { |
545 | struct drm_file *priv = filp->private_data; | 548 | struct drm_file *priv = filp->private_data; |
546 | struct drm_device *dev = priv->minor->dev; | 549 | struct drm_device *dev = priv->minor->dev; |