aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_crtc.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2013-04-26 10:40:28 -0400
committerDave Airlie <airlied@redhat.com>2013-04-29 20:03:07 -0400
commitc55b6b3da25aa3af36ec51a13a4ed15fef0d7a73 (patch)
tree240e093507676748e5cd1b52433d7e10523b5636 /drivers/gpu/drm/drm_crtc.c
parentea9cbb063ce7509d98febdc756e77d6b69a10b56 (diff)
drm: Kill user_modes list and the associated ioctls
There is no way to use modes added to the user_modes list. We never look at the contents of said list in the kernel, and the only operations userspace can do are attach and detach. So the only "benefit" of this interface is wasting kernel memory. Fortunately it seems no real user space application ever used these ioctls. So just kill them. Also remove the prototypes for the non-existing drm_mode_addmode_ioctl() and drm_mode_rmmode_ioctl() functions. v2: Use drm_noop instead of completely removing the ioctls Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r--drivers/gpu/drm/drm_crtc.c190
1 files changed, 0 insertions, 190 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 287cd82f9d75..3a8f7e6db295 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -703,7 +703,6 @@ int drm_connector_init(struct drm_device *dev,
703 connector->connector_type = connector_type; 703 connector->connector_type = connector_type;
704 connector->connector_type_id = 704 connector->connector_type_id =
705 ++drm_connector_enum_list[connector_type].count; /* TODO */ 705 ++drm_connector_enum_list[connector_type].count; /* TODO */
706 INIT_LIST_HEAD(&connector->user_modes);
707 INIT_LIST_HEAD(&connector->probed_modes); 706 INIT_LIST_HEAD(&connector->probed_modes);
708 INIT_LIST_HEAD(&connector->modes); 707 INIT_LIST_HEAD(&connector->modes);
709 connector->edid_blob_ptr = NULL; 708 connector->edid_blob_ptr = NULL;
@@ -744,9 +743,6 @@ void drm_connector_cleanup(struct drm_connector *connector)
744 list_for_each_entry_safe(mode, t, &connector->modes, head) 743 list_for_each_entry_safe(mode, t, &connector->modes, head)
745 drm_mode_remove(connector, mode); 744 drm_mode_remove(connector, mode);
746 745
747 list_for_each_entry_safe(mode, t, &connector->user_modes, head)
748 drm_mode_remove(connector, mode);
749
750 drm_mode_object_put(dev, &connector->base); 746 drm_mode_object_put(dev, &connector->base);
751 list_del(&connector->head); 747 list_del(&connector->head);
752 dev->mode_config.num_connector--; 748 dev->mode_config.num_connector--;
@@ -2613,192 +2609,6 @@ void drm_fb_release(struct drm_file *priv)
2613 mutex_unlock(&priv->fbs_lock); 2609 mutex_unlock(&priv->fbs_lock);
2614} 2610}
2615 2611
2616/**
2617 * drm_mode_attachmode - add a mode to the user mode list
2618 * @dev: DRM device
2619 * @connector: connector to add the mode to
2620 * @mode: mode to add
2621 *
2622 * Add @mode to @connector's user mode list.
2623 */
2624static void drm_mode_attachmode(struct drm_device *dev,
2625 struct drm_connector *connector,
2626 struct drm_display_mode *mode)
2627{
2628 list_add_tail(&mode->head, &connector->user_modes);
2629}
2630
2631int drm_mode_attachmode_crtc(struct drm_device *dev, struct drm_crtc *crtc,
2632 const struct drm_display_mode *mode)
2633{
2634 struct drm_connector *connector;
2635 int ret = 0;
2636 struct drm_display_mode *dup_mode, *next;
2637 LIST_HEAD(list);
2638
2639 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
2640 if (!connector->encoder)
2641 continue;
2642 if (connector->encoder->crtc == crtc) {
2643 dup_mode = drm_mode_duplicate(dev, mode);
2644 if (!dup_mode) {
2645 ret = -ENOMEM;
2646 goto out;
2647 }
2648 list_add_tail(&dup_mode->head, &list);
2649 }
2650 }
2651
2652 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
2653 if (!connector->encoder)
2654 continue;
2655 if (connector->encoder->crtc == crtc)
2656 list_move_tail(list.next, &connector->user_modes);
2657 }
2658
2659 WARN_ON(!list_empty(&list));
2660
2661 out:
2662 list_for_each_entry_safe(dup_mode, next, &list, head)
2663 drm_mode_destroy(dev, dup_mode);
2664
2665 return ret;
2666}
2667EXPORT_SYMBOL(drm_mode_attachmode_crtc);
2668
2669static int drm_mode_detachmode(struct drm_device *dev,
2670 struct drm_connector *connector,
2671 struct drm_display_mode *mode)
2672{
2673 int found = 0;
2674 int ret = 0;
2675 struct drm_display_mode *match_mode, *t;
2676
2677 list_for_each_entry_safe(match_mode, t, &connector->user_modes, head) {
2678 if (drm_mode_equal(match_mode, mode)) {
2679 list_del(&match_mode->head);
2680 drm_mode_destroy(dev, match_mode);
2681 found = 1;
2682 break;
2683 }
2684 }
2685
2686 if (!found)
2687 ret = -EINVAL;
2688
2689 return ret;
2690}
2691
2692int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode)
2693{
2694 struct drm_connector *connector;
2695
2696 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
2697 drm_mode_detachmode(dev, connector, mode);
2698 }
2699 return 0;
2700}
2701EXPORT_SYMBOL(drm_mode_detachmode_crtc);
2702
2703/**
2704 * drm_fb_attachmode - Attach a user mode to an connector
2705 * @dev: drm device for the ioctl
2706 * @data: data pointer for the ioctl
2707 * @file_priv: drm file for the ioctl call
2708 *
2709 * This attaches a user specified mode to an connector.
2710 * Called by the user via ioctl.
2711 *
2712 * RETURNS:
2713 * Zero on success, errno on failure.
2714 */
2715int drm_mode_attachmode_ioctl(struct drm_device *dev,
2716 void *data, struct drm_file *file_priv)
2717{
2718 struct drm_mode_mode_cmd *mode_cmd = data;
2719 struct drm_connector *connector;
2720 struct drm_display_mode *mode;
2721 struct drm_mode_object *obj;
2722 struct drm_mode_modeinfo *umode = &mode_cmd->mode;
2723 int ret;
2724
2725 if (!drm_core_check_feature(dev, DRIVER_MODESET))
2726 return -EINVAL;
2727
2728 drm_modeset_lock_all(dev);
2729
2730 obj = drm_mode_object_find(dev, mode_cmd->connector_id, DRM_MODE_OBJECT_CONNECTOR);
2731 if (!obj) {
2732 ret = -EINVAL;
2733 goto out;
2734 }
2735 connector = obj_to_connector(obj);
2736
2737 mode = drm_mode_create(dev);
2738 if (!mode) {
2739 ret = -ENOMEM;
2740 goto out;
2741 }
2742
2743 ret = drm_crtc_convert_umode(mode, umode);
2744 if (ret) {
2745 DRM_DEBUG_KMS("Invalid mode\n");
2746 drm_mode_destroy(dev, mode);
2747 goto out;
2748 }
2749
2750 drm_mode_attachmode(dev, connector, mode);
2751out:
2752 drm_modeset_unlock_all(dev);
2753 return ret;
2754}
2755
2756
2757/**
2758 * drm_fb_detachmode - Detach a user specified mode from an connector
2759 * @dev: drm device for the ioctl
2760 * @data: data pointer for the ioctl
2761 * @file_priv: drm file for the ioctl call
2762 *
2763 * Called by the user via ioctl.
2764 *
2765 * RETURNS:
2766 * Zero on success, errno on failure.
2767 */
2768int drm_mode_detachmode_ioctl(struct drm_device *dev,
2769 void *data, struct drm_file *file_priv)
2770{
2771 struct drm_mode_object *obj;
2772 struct drm_mode_mode_cmd *mode_cmd = data;
2773 struct drm_connector *connector;
2774 struct drm_display_mode mode;
2775 struct drm_mode_modeinfo *umode = &mode_cmd->mode;
2776 int ret;
2777
2778 if (!drm_core_check_feature(dev, DRIVER_MODESET))
2779 return -EINVAL;
2780
2781 drm_modeset_lock_all(dev);
2782
2783 obj = drm_mode_object_find(dev, mode_cmd->connector_id, DRM_MODE_OBJECT_CONNECTOR);
2784 if (!obj) {
2785 ret = -EINVAL;
2786 goto out;
2787 }
2788 connector = obj_to_connector(obj);
2789
2790 ret = drm_crtc_convert_umode(&mode, umode);
2791 if (ret) {
2792 DRM_DEBUG_KMS("Invalid mode\n");
2793 goto out;
2794 }
2795
2796 ret = drm_mode_detachmode(dev, connector, &mode);
2797out:
2798 drm_modeset_unlock_all(dev);
2799 return ret;
2800}
2801
2802struct drm_property *drm_property_create(struct drm_device *dev, int flags, 2612struct drm_property *drm_property_create(struct drm_device *dev, int flags,
2803 const char *name, int num_values) 2613 const char *name, int num_values)
2804{ 2614{