aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/i915_dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/i915_dma.c')
-rw-r--r--drivers/char/drm/i915_dma.c52
1 files changed, 33 insertions, 19 deletions
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c
index f3aa0c370127..9140703da1ba 100644
--- a/drivers/char/drm/i915_dma.c
+++ b/drivers/char/drm/i915_dma.c
@@ -1,7 +1,6 @@
1/* i915_dma.c -- DMA support for the I915 -*- linux-c -*- 1/* i915_dma.c -- DMA support for the I915 -*- linux-c -*-
2 */ 2 */
3/************************************************************************** 3/*
4 *
5 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas. 4 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * All Rights Reserved. 5 * All Rights Reserved.
7 * 6 *
@@ -25,7 +24,7 @@
25 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 * 26 *
28 **************************************************************************/ 27 */
29 28
30#include "drmP.h" 29#include "drmP.h"
31#include "drm.h" 30#include "drm.h"
@@ -196,7 +195,7 @@ static int i915_initialize(drm_device_t * dev,
196 return 0; 195 return 0;
197} 196}
198 197
199static int i915_resume(drm_device_t * dev) 198static int i915_dma_resume(drm_device_t * dev)
200{ 199{
201 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private; 200 drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
202 201
@@ -253,7 +252,7 @@ static int i915_dma_init(DRM_IOCTL_ARGS)
253 retcode = i915_dma_cleanup(dev); 252 retcode = i915_dma_cleanup(dev);
254 break; 253 break;
255 case I915_RESUME_DMA: 254 case I915_RESUME_DMA:
256 retcode = i915_resume(dev); 255 retcode = i915_dma_resume(dev);
257 break; 256 break;
258 default: 257 default:
259 retcode = -EINVAL; 258 retcode = -EINVAL;
@@ -654,6 +653,9 @@ static int i915_getparam(DRM_IOCTL_ARGS)
654 case I915_PARAM_ALLOW_BATCHBUFFER: 653 case I915_PARAM_ALLOW_BATCHBUFFER:
655 value = dev_priv->allow_batchbuffer ? 1 : 0; 654 value = dev_priv->allow_batchbuffer ? 1 : 0;
656 break; 655 break;
656 case I915_PARAM_LAST_DISPATCH:
657 value = READ_BREADCRUMB(dev_priv);
658 break;
657 default: 659 default:
658 DRM_ERROR("Unkown parameter %d\n", param.param); 660 DRM_ERROR("Unkown parameter %d\n", param.param);
659 return DRM_ERR(EINVAL); 661 return DRM_ERR(EINVAL);
@@ -699,7 +701,19 @@ static int i915_setparam(DRM_IOCTL_ARGS)
699 return 0; 701 return 0;
700} 702}
701 703
702void i915_driver_pretakedown(drm_device_t * dev) 704int i915_driver_load(drm_device_t *dev, unsigned long flags)
705{
706 /* i915 has 4 more counters */
707 dev->counters += 4;
708 dev->types[6] = _DRM_STAT_IRQ;
709 dev->types[7] = _DRM_STAT_PRIMARY;
710 dev->types[8] = _DRM_STAT_SECONDARY;
711 dev->types[9] = _DRM_STAT_DMA;
712
713 return 0;
714}
715
716void i915_driver_lastclose(drm_device_t * dev)
703{ 717{
704 if (dev->dev_private) { 718 if (dev->dev_private) {
705 drm_i915_private_t *dev_priv = dev->dev_private; 719 drm_i915_private_t *dev_priv = dev->dev_private;
@@ -708,7 +722,7 @@ void i915_driver_pretakedown(drm_device_t * dev)
708 i915_dma_cleanup(dev); 722 i915_dma_cleanup(dev);
709} 723}
710 724
711void i915_driver_prerelease(drm_device_t * dev, DRMFILE filp) 725void i915_driver_preclose(drm_device_t * dev, DRMFILE filp)
712{ 726{
713 if (dev->dev_private) { 727 if (dev->dev_private) {
714 drm_i915_private_t *dev_priv = dev->dev_private; 728 drm_i915_private_t *dev_priv = dev->dev_private;
@@ -717,18 +731,18 @@ void i915_driver_prerelease(drm_device_t * dev, DRMFILE filp)
717} 731}
718 732
719drm_ioctl_desc_t i915_ioctls[] = { 733drm_ioctl_desc_t i915_ioctls[] = {
720 [DRM_IOCTL_NR(DRM_I915_INIT)] = {i915_dma_init, 1, 1}, 734 [DRM_IOCTL_NR(DRM_I915_INIT)] = {i915_dma_init, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
721 [DRM_IOCTL_NR(DRM_I915_FLUSH)] = {i915_flush_ioctl, 1, 0}, 735 [DRM_IOCTL_NR(DRM_I915_FLUSH)] = {i915_flush_ioctl, DRM_AUTH},
722 [DRM_IOCTL_NR(DRM_I915_FLIP)] = {i915_flip_bufs, 1, 0}, 736 [DRM_IOCTL_NR(DRM_I915_FLIP)] = {i915_flip_bufs, DRM_AUTH},
723 [DRM_IOCTL_NR(DRM_I915_BATCHBUFFER)] = {i915_batchbuffer, 1, 0}, 737 [DRM_IOCTL_NR(DRM_I915_BATCHBUFFER)] = {i915_batchbuffer, DRM_AUTH},
724 [DRM_IOCTL_NR(DRM_I915_IRQ_EMIT)] = {i915_irq_emit, 1, 0}, 738 [DRM_IOCTL_NR(DRM_I915_IRQ_EMIT)] = {i915_irq_emit, DRM_AUTH},
725 [DRM_IOCTL_NR(DRM_I915_IRQ_WAIT)] = {i915_irq_wait, 1, 0}, 739 [DRM_IOCTL_NR(DRM_I915_IRQ_WAIT)] = {i915_irq_wait, DRM_AUTH},
726 [DRM_IOCTL_NR(DRM_I915_GETPARAM)] = {i915_getparam, 1, 0}, 740 [DRM_IOCTL_NR(DRM_I915_GETPARAM)] = {i915_getparam, DRM_AUTH},
727 [DRM_IOCTL_NR(DRM_I915_SETPARAM)] = {i915_setparam, 1, 1}, 741 [DRM_IOCTL_NR(DRM_I915_SETPARAM)] = {i915_setparam, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
728 [DRM_IOCTL_NR(DRM_I915_ALLOC)] = {i915_mem_alloc, 1, 0}, 742 [DRM_IOCTL_NR(DRM_I915_ALLOC)] = {i915_mem_alloc, DRM_AUTH},
729 [DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, 1, 0}, 743 [DRM_IOCTL_NR(DRM_I915_FREE)] = {i915_mem_free, DRM_AUTH},
730 [DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, 1, 1}, 744 [DRM_IOCTL_NR(DRM_I915_INIT_HEAP)] = {i915_mem_init_heap, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
731 [DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, 1, 0} 745 [DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, DRM_AUTH}
732}; 746};
733 747
734int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls); 748int i915_max_ioctl = DRM_ARRAY_SIZE(i915_ioctls);