aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-12-11 10:28:34 -0500
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-01-20 16:17:11 -0500
commit2fd5eabab02d9cdade04397eae0bfd49f452cdba (patch)
tree4100bb2ef31de7d4aa730d9e56c6660e129dc099 /drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
parent623f9783027ef0a948205f17792c9e1fcedb61c6 (diff)
drm/vmwgfx: add proper framebuffer refcounting
Afact vmwgfx already has all the right refcounting implemented on the backing storage, and we only need to ensure that the drm fb doesn't disappear untimely. So holding onto the fb reference from _lookup until vmw_kms_present has completed should be enough. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c')
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
index 1b8f428accae..c509d40c4897 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c
@@ -171,8 +171,6 @@ int vmw_present_ioctl(struct drm_device *dev, void *data,
171 ret = -EINVAL; 171 ret = -EINVAL;
172 goto out_no_fb; 172 goto out_no_fb;
173 } 173 }
174 /* fb is protect by the mode_config lock, so drop the ref immediately */
175 drm_framebuffer_unreference(fb);
176 vfb = vmw_framebuffer_to_vfb(fb); 174 vfb = vmw_framebuffer_to_vfb(fb);
177 175
178 ret = ttm_read_lock(&vmaster->lock, true); 176 ret = ttm_read_lock(&vmaster->lock, true);
@@ -197,6 +195,7 @@ int vmw_present_ioctl(struct drm_device *dev, void *data,
197out_no_surface: 195out_no_surface:
198 ttm_read_unlock(&vmaster->lock); 196 ttm_read_unlock(&vmaster->lock);
199out_no_ttm_lock: 197out_no_ttm_lock:
198 drm_framebuffer_unreference(fb);
200out_no_fb: 199out_no_fb:
201 drm_modeset_unlock_all(dev); 200 drm_modeset_unlock_all(dev);
202out_no_copy: 201out_no_copy:
@@ -256,14 +255,12 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data,
256 ret = -EINVAL; 255 ret = -EINVAL;
257 goto out_no_fb; 256 goto out_no_fb;
258 } 257 }
259 /* fb is protect by the mode_config lock, so drop the ref immediately */
260 drm_framebuffer_unreference(fb);
261 258
262 vfb = vmw_framebuffer_to_vfb(fb); 259 vfb = vmw_framebuffer_to_vfb(fb);
263 if (!vfb->dmabuf) { 260 if (!vfb->dmabuf) {
264 DRM_ERROR("Framebuffer not dmabuf backed.\n"); 261 DRM_ERROR("Framebuffer not dmabuf backed.\n");
265 ret = -EINVAL; 262 ret = -EINVAL;
266 goto out_no_fb; 263 goto out_no_ttm_lock;
267 } 264 }
268 265
269 ret = ttm_read_lock(&vmaster->lock, true); 266 ret = ttm_read_lock(&vmaster->lock, true);
@@ -276,6 +273,7 @@ int vmw_present_readback_ioctl(struct drm_device *dev, void *data,
276 273
277 ttm_read_unlock(&vmaster->lock); 274 ttm_read_unlock(&vmaster->lock);
278out_no_ttm_lock: 275out_no_ttm_lock:
276 drm_framebuffer_unreference(fb);
279out_no_fb: 277out_no_fb:
280 drm_modeset_unlock_all(dev); 278 drm_modeset_unlock_all(dev);
281out_no_copy: 279out_no_copy: