diff options
-rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 190 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_drv.c | 4 | ||||
-rw-r--r-- | include/drm/drm_crtc.h | 15 | ||||
-rw-r--r-- | include/uapi/drm/drm.h | 4 |
4 files changed, 4 insertions, 209 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 | */ | ||
2624 | static 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 | |||
2631 | int 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 | } | ||
2667 | EXPORT_SYMBOL(drm_mode_attachmode_crtc); | ||
2668 | |||
2669 | static 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 | |||
2692 | int 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 | } | ||
2701 | EXPORT_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 | */ | ||
2715 | int 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); | ||
2751 | out: | ||
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 | */ | ||
2768 | int 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); | ||
2797 | out: | ||
2798 | drm_modeset_unlock_all(dev); | ||
2799 | return ret; | ||
2800 | } | ||
2801 | |||
2802 | struct drm_property *drm_property_create(struct drm_device *dev, int flags, | 2612 | struct 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 | { |
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index 80c68957e7cf..8d4f29075af5 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -150,8 +150,8 @@ static const struct drm_ioctl_desc drm_ioctls[] = { | |||
150 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETGAMMA, drm_mode_gamma_set_ioctl, DRM_MASTER|DRM_UNLOCKED), | 150 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETGAMMA, drm_mode_gamma_set_ioctl, DRM_MASTER|DRM_UNLOCKED), |
151 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETENCODER, drm_mode_getencoder, DRM_CONTROL_ALLOW|DRM_UNLOCKED), | 151 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETENCODER, drm_mode_getencoder, DRM_CONTROL_ALLOW|DRM_UNLOCKED), |
152 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCONNECTOR, drm_mode_getconnector, DRM_CONTROL_ALLOW|DRM_UNLOCKED), | 152 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCONNECTOR, drm_mode_getconnector, DRM_CONTROL_ALLOW|DRM_UNLOCKED), |
153 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_ATTACHMODE, drm_mode_attachmode_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), | 153 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_ATTACHMODE, drm_noop, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), |
154 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_DETACHMODE, drm_mode_detachmode_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), | 154 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_DETACHMODE, drm_noop, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), |
155 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPERTY, drm_mode_getproperty_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED), | 155 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPERTY, drm_mode_getproperty_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED), |
156 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPROPERTY, drm_mode_connector_property_set_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), | 156 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPROPERTY, drm_mode_connector_property_set_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW|DRM_UNLOCKED), |
157 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPBLOB, drm_mode_getblob_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED), | 157 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPBLOB, drm_mode_getblob_ioctl, DRM_CONTROL_ALLOW|DRM_UNLOCKED), |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index cf474498cee0..adb3f9b625f6 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -554,7 +554,6 @@ enum drm_connector_force { | |||
554 | * @probed_modes: list of modes derived directly from the display | 554 | * @probed_modes: list of modes derived directly from the display |
555 | * @display_info: information about attached display (e.g. from EDID) | 555 | * @display_info: information about attached display (e.g. from EDID) |
556 | * @funcs: connector control functions | 556 | * @funcs: connector control functions |
557 | * @user_modes: user added mode list | ||
558 | * @edid_blob_ptr: DRM property containing EDID if present | 557 | * @edid_blob_ptr: DRM property containing EDID if present |
559 | * @properties: property tracking for this connector | 558 | * @properties: property tracking for this connector |
560 | * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling | 559 | * @polled: a %DRM_CONNECTOR_POLL_<foo> value for core driven polling |
@@ -598,7 +597,6 @@ struct drm_connector { | |||
598 | struct drm_display_info display_info; | 597 | struct drm_display_info display_info; |
599 | const struct drm_connector_funcs *funcs; | 598 | const struct drm_connector_funcs *funcs; |
600 | 599 | ||
601 | struct list_head user_modes; | ||
602 | struct drm_property_blob *edid_blob_ptr; | 600 | struct drm_property_blob *edid_blob_ptr; |
603 | struct drm_object_properties properties; | 601 | struct drm_object_properties properties; |
604 | 602 | ||
@@ -927,11 +925,6 @@ extern int drm_mode_width(const struct drm_display_mode *mode); | |||
927 | extern int drm_mode_height(const struct drm_display_mode *mode); | 925 | extern int drm_mode_height(const struct drm_display_mode *mode); |
928 | 926 | ||
929 | /* for us by fb module */ | 927 | /* for us by fb module */ |
930 | extern int drm_mode_attachmode_crtc(struct drm_device *dev, | ||
931 | struct drm_crtc *crtc, | ||
932 | const struct drm_display_mode *mode); | ||
933 | extern int drm_mode_detachmode_crtc(struct drm_device *dev, struct drm_display_mode *mode); | ||
934 | |||
935 | extern struct drm_display_mode *drm_mode_create(struct drm_device *dev); | 928 | extern struct drm_display_mode *drm_mode_create(struct drm_device *dev); |
936 | extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode); | 929 | extern void drm_mode_destroy(struct drm_device *dev, struct drm_display_mode *mode); |
937 | extern void drm_mode_list_concat(struct list_head *head, | 930 | extern void drm_mode_list_concat(struct list_head *head, |
@@ -1040,14 +1033,6 @@ extern int drm_mode_getfb(struct drm_device *dev, | |||
1040 | void *data, struct drm_file *file_priv); | 1033 | void *data, struct drm_file *file_priv); |
1041 | extern int drm_mode_dirtyfb_ioctl(struct drm_device *dev, | 1034 | extern int drm_mode_dirtyfb_ioctl(struct drm_device *dev, |
1042 | void *data, struct drm_file *file_priv); | 1035 | void *data, struct drm_file *file_priv); |
1043 | extern int drm_mode_addmode_ioctl(struct drm_device *dev, | ||
1044 | void *data, struct drm_file *file_priv); | ||
1045 | extern int drm_mode_rmmode_ioctl(struct drm_device *dev, | ||
1046 | void *data, struct drm_file *file_priv); | ||
1047 | extern int drm_mode_attachmode_ioctl(struct drm_device *dev, | ||
1048 | void *data, struct drm_file *file_priv); | ||
1049 | extern int drm_mode_detachmode_ioctl(struct drm_device *dev, | ||
1050 | void *data, struct drm_file *file_priv); | ||
1051 | 1036 | ||
1052 | extern int drm_mode_getproperty_ioctl(struct drm_device *dev, | 1037 | extern int drm_mode_getproperty_ioctl(struct drm_device *dev, |
1053 | void *data, struct drm_file *file_priv); | 1038 | void *data, struct drm_file *file_priv); |
diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h index 73a99e4664be..5a57be68bab7 100644 --- a/include/uapi/drm/drm.h +++ b/include/uapi/drm/drm.h | |||
@@ -711,8 +711,8 @@ struct drm_prime_handle { | |||
711 | #define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) | 711 | #define DRM_IOCTL_MODE_SETGAMMA DRM_IOWR(0xA5, struct drm_mode_crtc_lut) |
712 | #define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) | 712 | #define DRM_IOCTL_MODE_GETENCODER DRM_IOWR(0xA6, struct drm_mode_get_encoder) |
713 | #define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) | 713 | #define DRM_IOCTL_MODE_GETCONNECTOR DRM_IOWR(0xA7, struct drm_mode_get_connector) |
714 | #define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) | 714 | #define DRM_IOCTL_MODE_ATTACHMODE DRM_IOWR(0xA8, struct drm_mode_mode_cmd) /* deprecated (never worked) */ |
715 | #define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) | 715 | #define DRM_IOCTL_MODE_DETACHMODE DRM_IOWR(0xA9, struct drm_mode_mode_cmd) /* deprecated (never worked) */ |
716 | 716 | ||
717 | #define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) | 717 | #define DRM_IOCTL_MODE_GETPROPERTY DRM_IOWR(0xAA, struct drm_mode_get_property) |
718 | #define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) | 718 | #define DRM_IOCTL_MODE_SETPROPERTY DRM_IOWR(0xAB, struct drm_mode_connector_set_property) |