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_fops.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_fops.c')
-rw-r--r-- | drivers/gpu/drm/drm_fops.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index f2285237df49..3a6c439652a5 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -133,11 +133,21 @@ int drm_open(struct inode *inode, struct file *filp) | |||
133 | spin_lock(&dev->count_lock); | 133 | spin_lock(&dev->count_lock); |
134 | if (!dev->open_count++) { | 134 | if (!dev->open_count++) { |
135 | spin_unlock(&dev->count_lock); | 135 | spin_unlock(&dev->count_lock); |
136 | return drm_setup(dev); | 136 | retcode = drm_setup(dev); |
137 | goto out; | ||
137 | } | 138 | } |
138 | spin_unlock(&dev->count_lock); | 139 | spin_unlock(&dev->count_lock); |
139 | } | 140 | } |
140 | 141 | ||
142 | out: | ||
143 | mutex_lock(&dev->struct_mutex); | ||
144 | if (dev->dev_mapping == NULL) | ||
145 | dev->dev_mapping = inode->i_mapping; | ||
146 | else if (dev->dev_mapping != inode->i_mapping) | ||
147 | WARN(1, "dev->dev_mapping not inode mapping (%p expected %p)\n", | ||
148 | dev->dev_mapping, inode->i_mapping); | ||
149 | mutex_unlock(&dev->struct_mutex); | ||
150 | |||
141 | return retcode; | 151 | return retcode; |
142 | } | 152 | } |
143 | EXPORT_SYMBOL(drm_open); | 153 | EXPORT_SYMBOL(drm_open); |