diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2011-06-06 23:28:11 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2011-06-23 02:00:32 -0400 |
commit | e758a3111914af7ee4351be86f1ac0efe87ed06e (patch) | |
tree | 9dce97ce592f8feb4f96cc1f145fe3e05becc04e /drivers/gpu/drm/nouveau | |
parent | 3d483d575bfba52eae04bf2575239642c26c355a (diff) |
drm/nouveau: fixup gem_info ioctl to return client-specific bo virtual
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/nouveau')
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_gem.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index 2d1de2427bc3..05ca72ed7e30 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c | |||
@@ -123,21 +123,28 @@ nouveau_gem_new(struct drm_device *dev, int size, int align, uint32_t domain, | |||
123 | } | 123 | } |
124 | 124 | ||
125 | static int | 125 | static int |
126 | nouveau_gem_info(struct drm_gem_object *gem, struct drm_nouveau_gem_info *rep) | 126 | nouveau_gem_info(struct drm_file *file_priv, struct drm_gem_object *gem, |
127 | struct drm_nouveau_gem_info *rep) | ||
127 | { | 128 | { |
128 | struct drm_nouveau_private *dev_priv = gem->dev->dev_private; | 129 | struct nouveau_fpriv *fpriv = nouveau_fpriv(file_priv); |
129 | struct nouveau_bo *nvbo = nouveau_gem_object(gem); | 130 | struct nouveau_bo *nvbo = nouveau_gem_object(gem); |
131 | struct nouveau_vma *vma; | ||
130 | 132 | ||
131 | if (nvbo->bo.mem.mem_type == TTM_PL_TT) | 133 | if (nvbo->bo.mem.mem_type == TTM_PL_TT) |
132 | rep->domain = NOUVEAU_GEM_DOMAIN_GART; | 134 | rep->domain = NOUVEAU_GEM_DOMAIN_GART; |
133 | else | 135 | else |
134 | rep->domain = NOUVEAU_GEM_DOMAIN_VRAM; | 136 | rep->domain = NOUVEAU_GEM_DOMAIN_VRAM; |
135 | 137 | ||
138 | rep->offset = nvbo->bo.offset; | ||
139 | if (fpriv->vm) { | ||
140 | vma = nouveau_bo_vma_find(nvbo, fpriv->vm); | ||
141 | if (!vma) | ||
142 | return -EINVAL; | ||
143 | |||
144 | rep->offset = vma->offset; | ||
145 | } | ||
146 | |||
136 | rep->size = nvbo->bo.mem.num_pages << PAGE_SHIFT; | 147 | rep->size = nvbo->bo.mem.num_pages << PAGE_SHIFT; |
137 | if (dev_priv->card_type < NV_50) | ||
138 | rep->offset = nvbo->bo.offset; | ||
139 | else | ||
140 | rep->offset = nvbo->vma.offset; | ||
141 | rep->map_handle = nvbo->bo.addr_space_offset; | 148 | rep->map_handle = nvbo->bo.addr_space_offset; |
142 | rep->tile_mode = nvbo->tile_mode; | 149 | rep->tile_mode = nvbo->tile_mode; |
143 | rep->tile_flags = nvbo->tile_flags; | 150 | rep->tile_flags = nvbo->tile_flags; |
@@ -167,14 +174,15 @@ nouveau_gem_ioctl_new(struct drm_device *dev, void *data, | |||
167 | if (ret) | 174 | if (ret) |
168 | return ret; | 175 | return ret; |
169 | 176 | ||
170 | ret = nouveau_gem_info(nvbo->gem, &req->info); | ||
171 | if (ret) | ||
172 | goto out; | ||
173 | |||
174 | ret = drm_gem_handle_create(file_priv, nvbo->gem, &req->info.handle); | 177 | ret = drm_gem_handle_create(file_priv, nvbo->gem, &req->info.handle); |
178 | if (ret == 0) { | ||
179 | ret = nouveau_gem_info(file_priv, nvbo->gem, &req->info); | ||
180 | if (ret) | ||
181 | drm_gem_handle_delete(file_priv, req->info.handle); | ||
182 | } | ||
183 | |||
175 | /* drop reference from allocate - handle holds it now */ | 184 | /* drop reference from allocate - handle holds it now */ |
176 | drm_gem_object_unreference_unlocked(nvbo->gem); | 185 | drm_gem_object_unreference_unlocked(nvbo->gem); |
177 | out: | ||
178 | return ret; | 186 | return ret; |
179 | } | 187 | } |
180 | 188 | ||
@@ -800,7 +808,7 @@ nouveau_gem_ioctl_info(struct drm_device *dev, void *data, | |||
800 | if (!gem) | 808 | if (!gem) |
801 | return -ENOENT; | 809 | return -ENOENT; |
802 | 810 | ||
803 | ret = nouveau_gem_info(gem, req); | 811 | ret = nouveau_gem_info(file_priv, gem, req); |
804 | drm_gem_object_unreference_unlocked(gem); | 812 | drm_gem_object_unreference_unlocked(gem); |
805 | return ret; | 813 | return ret; |
806 | } | 814 | } |