drm/vmwgfx: Use a per-device semaphore for reservation protection
Don't use a per-master semaphore (ttm lock) for reservation protection, but rather a per-device semaphore. This is needed since clients connecting using render nodes aren't master aware. The ttm lock used should probably be replaced with a reader-write semaphore once the function down_xx_interruptible() is available. Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
@@ -596,7 +596,6 @@ static int vmw_framebuffer_surface_dirty(struct drm_framebuffer *framebuffer,
|
||||
unsigned num_clips)
|
||||
{
|
||||
struct vmw_private *dev_priv = vmw_priv(framebuffer->dev);
|
||||
struct vmw_master *vmaster = vmw_master(file_priv->master);
|
||||
struct vmw_framebuffer_surface *vfbs =
|
||||
vmw_framebuffer_to_vfbs(framebuffer);
|
||||
struct drm_clip_rect norect;
|
||||
@@ -611,7 +610,7 @@ static int vmw_framebuffer_surface_dirty(struct drm_framebuffer *framebuffer,
|
||||
|
||||
drm_modeset_lock_all(dev_priv->dev);
|
||||
|
||||
ret = ttm_read_lock(&vmaster->lock, true);
|
||||
ret = ttm_read_lock(&dev_priv->reservation_sem, true);
|
||||
if (unlikely(ret != 0)) {
|
||||
drm_modeset_unlock_all(dev_priv->dev);
|
||||
return ret;
|
||||
@@ -632,7 +631,7 @@ static int vmw_framebuffer_surface_dirty(struct drm_framebuffer *framebuffer,
|
||||
flags, color,
|
||||
clips, num_clips, inc, NULL);
|
||||
|
||||
ttm_read_unlock(&vmaster->lock);
|
||||
ttm_read_unlock(&dev_priv->reservation_sem);
|
||||
|
||||
drm_modeset_unlock_all(dev_priv->dev);
|
||||
|
||||
@@ -954,7 +953,6 @@ static int vmw_framebuffer_dmabuf_dirty(struct drm_framebuffer *framebuffer,
|
||||
unsigned num_clips)
|
||||
{
|
||||
struct vmw_private *dev_priv = vmw_priv(framebuffer->dev);
|
||||
struct vmw_master *vmaster = vmw_master(file_priv->master);
|
||||
struct vmw_framebuffer_dmabuf *vfbd =
|
||||
vmw_framebuffer_to_vfbd(framebuffer);
|
||||
struct drm_clip_rect norect;
|
||||
@@ -962,7 +960,7 @@ static int vmw_framebuffer_dmabuf_dirty(struct drm_framebuffer *framebuffer,
|
||||
|
||||
drm_modeset_lock_all(dev_priv->dev);
|
||||
|
||||
ret = ttm_read_lock(&vmaster->lock, true);
|
||||
ret = ttm_read_lock(&dev_priv->reservation_sem, true);
|
||||
if (unlikely(ret != 0)) {
|
||||
drm_modeset_unlock_all(dev_priv->dev);
|
||||
return ret;
|
||||
@@ -989,7 +987,7 @@ static int vmw_framebuffer_dmabuf_dirty(struct drm_framebuffer *framebuffer,
|
||||
clips, num_clips, increment, NULL);
|
||||
}
|
||||
|
||||
ttm_read_unlock(&vmaster->lock);
|
||||
ttm_read_unlock(&dev_priv->reservation_sem);
|
||||
|
||||
drm_modeset_unlock_all(dev_priv->dev);
|
||||
|
||||
@@ -2022,7 +2020,6 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
|
||||
struct vmw_private *dev_priv = vmw_priv(dev);
|
||||
struct drm_vmw_update_layout_arg *arg =
|
||||
(struct drm_vmw_update_layout_arg *)data;
|
||||
struct vmw_master *vmaster = vmw_master(file_priv->master);
|
||||
void __user *user_rects;
|
||||
struct drm_vmw_rect *rects;
|
||||
unsigned rects_size;
|
||||
@@ -2030,7 +2027,7 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
|
||||
int i;
|
||||
struct drm_mode_config *mode_config = &dev->mode_config;
|
||||
|
||||
ret = ttm_read_lock(&vmaster->lock, true);
|
||||
ret = ttm_read_lock(&dev_priv->reservation_sem, true);
|
||||
if (unlikely(ret != 0))
|
||||
return ret;
|
||||
|
||||
@@ -2072,6 +2069,6 @@ int vmw_kms_update_layout_ioctl(struct drm_device *dev, void *data,
|
||||
out_free:
|
||||
kfree(rects);
|
||||
out_unlock:
|
||||
ttm_read_unlock(&vmaster->lock);
|
||||
ttm_read_unlock(&dev_priv->reservation_sem);
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user