aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/i915_dma.c')
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index ea85d71cab04..d71c89f8802e 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -588,9 +588,15 @@ static int i915_quiescent(struct drm_device * dev)
588static int i915_flush_ioctl(struct drm_device *dev, void *data, 588static int i915_flush_ioctl(struct drm_device *dev, void *data,
589 struct drm_file *file_priv) 589 struct drm_file *file_priv)
590{ 590{
591 LOCK_TEST_WITH_RETURN(dev, file_priv); 591 int ret;
592
593 RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
592 594
593 return i915_quiescent(dev); 595 mutex_lock(&dev->struct_mutex);
596 ret = i915_quiescent(dev);
597 mutex_unlock(&dev->struct_mutex);
598
599 return ret;
594} 600}
595 601
596static int i915_batchbuffer(struct drm_device *dev, void *data, 602static int i915_batchbuffer(struct drm_device *dev, void *data,
@@ -611,14 +617,16 @@ static int i915_batchbuffer(struct drm_device *dev, void *data,
611 DRM_DEBUG("i915 batchbuffer, start %x used %d cliprects %d\n", 617 DRM_DEBUG("i915 batchbuffer, start %x used %d cliprects %d\n",
612 batch->start, batch->used, batch->num_cliprects); 618 batch->start, batch->used, batch->num_cliprects);
613 619
614 LOCK_TEST_WITH_RETURN(dev, file_priv); 620 RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
615 621
616 if (batch->num_cliprects && DRM_VERIFYAREA_READ(batch->cliprects, 622 if (batch->num_cliprects && DRM_VERIFYAREA_READ(batch->cliprects,
617 batch->num_cliprects * 623 batch->num_cliprects *
618 sizeof(struct drm_clip_rect))) 624 sizeof(struct drm_clip_rect)))
619 return -EFAULT; 625 return -EFAULT;
620 626
627 mutex_lock(&dev->struct_mutex);
621 ret = i915_dispatch_batchbuffer(dev, batch); 628 ret = i915_dispatch_batchbuffer(dev, batch);
629 mutex_unlock(&dev->struct_mutex);
622 630
623 sarea_priv->last_dispatch = (int)hw_status[5]; 631 sarea_priv->last_dispatch = (int)hw_status[5];
624 return ret; 632 return ret;
@@ -637,7 +645,7 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
637 DRM_DEBUG("i915 cmdbuffer, buf %p sz %d cliprects %d\n", 645 DRM_DEBUG("i915 cmdbuffer, buf %p sz %d cliprects %d\n",
638 cmdbuf->buf, cmdbuf->sz, cmdbuf->num_cliprects); 646 cmdbuf->buf, cmdbuf->sz, cmdbuf->num_cliprects);
639 647
640 LOCK_TEST_WITH_RETURN(dev, file_priv); 648 RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
641 649
642 if (cmdbuf->num_cliprects && 650 if (cmdbuf->num_cliprects &&
643 DRM_VERIFYAREA_READ(cmdbuf->cliprects, 651 DRM_VERIFYAREA_READ(cmdbuf->cliprects,
@@ -647,7 +655,9 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
647 return -EFAULT; 655 return -EFAULT;
648 } 656 }
649 657
658 mutex_lock(&dev->struct_mutex);
650 ret = i915_dispatch_cmdbuffer(dev, cmdbuf); 659 ret = i915_dispatch_cmdbuffer(dev, cmdbuf);
660 mutex_unlock(&dev->struct_mutex);
651 if (ret) { 661 if (ret) {
652 DRM_ERROR("i915_dispatch_cmdbuffer failed\n"); 662 DRM_ERROR("i915_dispatch_cmdbuffer failed\n");
653 return ret; 663 return ret;
@@ -660,11 +670,17 @@ static int i915_cmdbuffer(struct drm_device *dev, void *data,
660static int i915_flip_bufs(struct drm_device *dev, void *data, 670static int i915_flip_bufs(struct drm_device *dev, void *data,
661 struct drm_file *file_priv) 671 struct drm_file *file_priv)
662{ 672{
673 int ret;
674
663 DRM_DEBUG("%s\n", __func__); 675 DRM_DEBUG("%s\n", __func__);
664 676
665 LOCK_TEST_WITH_RETURN(dev, file_priv); 677 RING_LOCK_TEST_WITH_RETURN(dev, file_priv);
666 678
667 return i915_dispatch_flip(dev); 679 mutex_lock(&dev->struct_mutex);
680 ret = i915_dispatch_flip(dev);
681 mutex_unlock(&dev->struct_mutex);
682
683 return ret;
668} 684}
669 685
670static int i915_getparam(struct drm_device *dev, void *data, 686static int i915_getparam(struct drm_device *dev, void *data,