diff options
Diffstat (limited to 'drivers/char/drm/r128_cce.c')
-rw-r--r-- | drivers/char/drm/r128_cce.c | 62 |
1 files changed, 22 insertions, 40 deletions
diff --git a/drivers/char/drm/r128_cce.c b/drivers/char/drm/r128_cce.c index 4dc8acc6eb61..7d550aba165e 100644 --- a/drivers/char/drm/r128_cce.c +++ b/drivers/char/drm/r128_cce.c | |||
@@ -625,21 +625,17 @@ int r128_do_cleanup_cce(struct drm_device * dev) | |||
625 | return 0; | 625 | return 0; |
626 | } | 626 | } |
627 | 627 | ||
628 | int r128_cce_init(DRM_IOCTL_ARGS) | 628 | int r128_cce_init(struct drm_device *dev, void *data, struct drm_file *file_priv) |
629 | { | 629 | { |
630 | DRM_DEVICE; | 630 | drm_r128_init_t *init = data; |
631 | drm_r128_init_t init; | ||
632 | 631 | ||
633 | DRM_DEBUG("\n"); | 632 | DRM_DEBUG("\n"); |
634 | 633 | ||
635 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 634 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
636 | 635 | ||
637 | DRM_COPY_FROM_USER_IOCTL(init, (drm_r128_init_t __user *) data, | 636 | switch (init->func) { |
638 | sizeof(init)); | ||
639 | |||
640 | switch (init.func) { | ||
641 | case R128_INIT_CCE: | 637 | case R128_INIT_CCE: |
642 | return r128_do_init_cce(dev, &init); | 638 | return r128_do_init_cce(dev, init); |
643 | case R128_CLEANUP_CCE: | 639 | case R128_CLEANUP_CCE: |
644 | return r128_do_cleanup_cce(dev); | 640 | return r128_do_cleanup_cce(dev); |
645 | } | 641 | } |
@@ -647,9 +643,8 @@ int r128_cce_init(DRM_IOCTL_ARGS) | |||
647 | return -EINVAL; | 643 | return -EINVAL; |
648 | } | 644 | } |
649 | 645 | ||
650 | int r128_cce_start(DRM_IOCTL_ARGS) | 646 | int r128_cce_start(struct drm_device *dev, void *data, struct drm_file *file_priv) |
651 | { | 647 | { |
652 | DRM_DEVICE; | ||
653 | drm_r128_private_t *dev_priv = dev->dev_private; | 648 | drm_r128_private_t *dev_priv = dev->dev_private; |
654 | DRM_DEBUG("\n"); | 649 | DRM_DEBUG("\n"); |
655 | 650 | ||
@@ -668,30 +663,26 @@ int r128_cce_start(DRM_IOCTL_ARGS) | |||
668 | /* Stop the CCE. The engine must have been idled before calling this | 663 | /* Stop the CCE. The engine must have been idled before calling this |
669 | * routine. | 664 | * routine. |
670 | */ | 665 | */ |
671 | int r128_cce_stop(DRM_IOCTL_ARGS) | 666 | int r128_cce_stop(struct drm_device *dev, void *data, struct drm_file *file_priv) |
672 | { | 667 | { |
673 | DRM_DEVICE; | ||
674 | drm_r128_private_t *dev_priv = dev->dev_private; | 668 | drm_r128_private_t *dev_priv = dev->dev_private; |
675 | drm_r128_cce_stop_t stop; | 669 | drm_r128_cce_stop_t *stop = data; |
676 | int ret; | 670 | int ret; |
677 | DRM_DEBUG("\n"); | 671 | DRM_DEBUG("\n"); |
678 | 672 | ||
679 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 673 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
680 | 674 | ||
681 | DRM_COPY_FROM_USER_IOCTL(stop, (drm_r128_cce_stop_t __user *) data, | ||
682 | sizeof(stop)); | ||
683 | |||
684 | /* Flush any pending CCE commands. This ensures any outstanding | 675 | /* Flush any pending CCE commands. This ensures any outstanding |
685 | * commands are exectuted by the engine before we turn it off. | 676 | * commands are exectuted by the engine before we turn it off. |
686 | */ | 677 | */ |
687 | if (stop.flush) { | 678 | if (stop->flush) { |
688 | r128_do_cce_flush(dev_priv); | 679 | r128_do_cce_flush(dev_priv); |
689 | } | 680 | } |
690 | 681 | ||
691 | /* If we fail to make the engine go idle, we return an error | 682 | /* If we fail to make the engine go idle, we return an error |
692 | * code so that the DRM ioctl wrapper can try again. | 683 | * code so that the DRM ioctl wrapper can try again. |
693 | */ | 684 | */ |
694 | if (stop.idle) { | 685 | if (stop->idle) { |
695 | ret = r128_do_cce_idle(dev_priv); | 686 | ret = r128_do_cce_idle(dev_priv); |
696 | if (ret) | 687 | if (ret) |
697 | return ret; | 688 | return ret; |
@@ -711,9 +702,8 @@ int r128_cce_stop(DRM_IOCTL_ARGS) | |||
711 | 702 | ||
712 | /* Just reset the CCE ring. Called as part of an X Server engine reset. | 703 | /* Just reset the CCE ring. Called as part of an X Server engine reset. |
713 | */ | 704 | */ |
714 | int r128_cce_reset(DRM_IOCTL_ARGS) | 705 | int r128_cce_reset(struct drm_device *dev, void *data, struct drm_file *file_priv) |
715 | { | 706 | { |
716 | DRM_DEVICE; | ||
717 | drm_r128_private_t *dev_priv = dev->dev_private; | 707 | drm_r128_private_t *dev_priv = dev->dev_private; |
718 | DRM_DEBUG("\n"); | 708 | DRM_DEBUG("\n"); |
719 | 709 | ||
@@ -732,9 +722,8 @@ int r128_cce_reset(DRM_IOCTL_ARGS) | |||
732 | return 0; | 722 | return 0; |
733 | } | 723 | } |
734 | 724 | ||
735 | int r128_cce_idle(DRM_IOCTL_ARGS) | 725 | int r128_cce_idle(struct drm_device *dev, void *data, struct drm_file *file_priv) |
736 | { | 726 | { |
737 | DRM_DEVICE; | ||
738 | drm_r128_private_t *dev_priv = dev->dev_private; | 727 | drm_r128_private_t *dev_priv = dev->dev_private; |
739 | DRM_DEBUG("\n"); | 728 | DRM_DEBUG("\n"); |
740 | 729 | ||
@@ -747,9 +736,8 @@ int r128_cce_idle(DRM_IOCTL_ARGS) | |||
747 | return r128_do_cce_idle(dev_priv); | 736 | return r128_do_cce_idle(dev_priv); |
748 | } | 737 | } |
749 | 738 | ||
750 | int r128_engine_reset(DRM_IOCTL_ARGS) | 739 | int r128_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv) |
751 | { | 740 | { |
752 | DRM_DEVICE; | ||
753 | DRM_DEBUG("\n"); | 741 | DRM_DEBUG("\n"); |
754 | 742 | ||
755 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 743 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
@@ -757,7 +745,7 @@ int r128_engine_reset(DRM_IOCTL_ARGS) | |||
757 | return r128_do_engine_reset(dev); | 745 | return r128_do_engine_reset(dev); |
758 | } | 746 | } |
759 | 747 | ||
760 | int r128_fullscreen(DRM_IOCTL_ARGS) | 748 | int r128_fullscreen(struct drm_device *dev, void *data, struct drm_file *file_priv) |
761 | { | 749 | { |
762 | return -EINVAL; | 750 | return -EINVAL; |
763 | } | 751 | } |
@@ -912,41 +900,35 @@ static int r128_cce_get_buffers(struct drm_device * dev, | |||
912 | return 0; | 900 | return 0; |
913 | } | 901 | } |
914 | 902 | ||
915 | int r128_cce_buffers(DRM_IOCTL_ARGS) | 903 | int r128_cce_buffers(struct drm_device *dev, void *data, struct drm_file *file_priv) |
916 | { | 904 | { |
917 | DRM_DEVICE; | ||
918 | struct drm_device_dma *dma = dev->dma; | 905 | struct drm_device_dma *dma = dev->dma; |
919 | int ret = 0; | 906 | int ret = 0; |
920 | struct drm_dma __user *argp = (void __user *)data; | 907 | struct drm_dma *d = data; |
921 | struct drm_dma d; | ||
922 | 908 | ||
923 | LOCK_TEST_WITH_RETURN(dev, file_priv); | 909 | LOCK_TEST_WITH_RETURN(dev, file_priv); |
924 | 910 | ||
925 | DRM_COPY_FROM_USER_IOCTL(d, argp, sizeof(d)); | ||
926 | |||
927 | /* Please don't send us buffers. | 911 | /* Please don't send us buffers. |
928 | */ | 912 | */ |
929 | if (d.send_count != 0) { | 913 | if (d->send_count != 0) { |
930 | DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", | 914 | DRM_ERROR("Process %d trying to send %d buffers via drmDMA\n", |
931 | DRM_CURRENTPID, d.send_count); | 915 | DRM_CURRENTPID, d->send_count); |
932 | return -EINVAL; | 916 | return -EINVAL; |
933 | } | 917 | } |
934 | 918 | ||
935 | /* We'll send you buffers. | 919 | /* We'll send you buffers. |
936 | */ | 920 | */ |
937 | if (d.request_count < 0 || d.request_count > dma->buf_count) { | 921 | if (d->request_count < 0 || d->request_count > dma->buf_count) { |
938 | DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", | 922 | DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", |
939 | DRM_CURRENTPID, d.request_count, dma->buf_count); | 923 | DRM_CURRENTPID, d->request_count, dma->buf_count); |
940 | return -EINVAL; | 924 | return -EINVAL; |
941 | } | 925 | } |
942 | 926 | ||
943 | d.granted_count = 0; | 927 | d->granted_count = 0; |
944 | 928 | ||
945 | if (d.request_count) { | 929 | if (d->request_count) { |
946 | ret = r128_cce_get_buffers(dev, file_priv, &d); | 930 | ret = r128_cce_get_buffers(dev, file_priv, d); |
947 | } | 931 | } |
948 | 932 | ||
949 | DRM_COPY_TO_USER_IOCTL(argp, d, sizeof(d)); | ||
950 | |||
951 | return ret; | 933 | return ret; |
952 | } | 934 | } |