diff options
author | Jakob Bornecrantz <jakob@tungstengraphics.com> | 2008-12-18 23:50:50 -0500 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2008-12-29 02:47:25 -0500 |
commit | e0c8463a8b00b467611607df0ff369d062528875 (patch) | |
tree | aad7aa34fc650d4ef6ae4268397d7fc2740d50e1 /drivers | |
parent | df989374a9f5356ee815baa1ba6916671a701da2 (diff) |
drm: sanitise drm modesetting API + remove unused hotplug
The initially merged modesetting API has some uglies in it, this
cleans up the struct members and ioctl ordering for initial submission.
It also removes the unneeded hotplug infrastructure.
airlied:- I've pulled this patch in from git modesetting-gem tree.
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 21 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_crtc_helper.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/drm_drv.c | 20 |
3 files changed, 14 insertions, 29 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 2e880240477e..ece947d3b25b 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -804,7 +804,6 @@ void drm_mode_config_init(struct drm_device *dev) | |||
804 | dev->mode_config.num_connector = 0; | 804 | dev->mode_config.num_connector = 0; |
805 | dev->mode_config.num_crtc = 0; | 805 | dev->mode_config.num_crtc = 0; |
806 | dev->mode_config.num_encoder = 0; | 806 | dev->mode_config.num_encoder = 0; |
807 | dev->mode_config.hotplug_counter = 0; | ||
808 | } | 807 | } |
809 | EXPORT_SYMBOL(drm_mode_config_init); | 808 | EXPORT_SYMBOL(drm_mode_config_init); |
810 | 809 | ||
@@ -900,16 +899,6 @@ void drm_mode_config_cleanup(struct drm_device *dev) | |||
900 | } | 899 | } |
901 | EXPORT_SYMBOL(drm_mode_config_cleanup); | 900 | EXPORT_SYMBOL(drm_mode_config_cleanup); |
902 | 901 | ||
903 | int drm_mode_hotplug_ioctl(struct drm_device *dev, | ||
904 | void *data, struct drm_file *file_priv) | ||
905 | { | ||
906 | struct drm_mode_hotplug *arg = data; | ||
907 | |||
908 | arg->counter = dev->mode_config.hotplug_counter; | ||
909 | |||
910 | return 0; | ||
911 | } | ||
912 | |||
913 | /** | 902 | /** |
914 | * drm_crtc_convert_to_umode - convert a drm_display_mode into a modeinfo | 903 | * drm_crtc_convert_to_umode - convert a drm_display_mode into a modeinfo |
915 | * @out: drm_mode_modeinfo struct to return to the user | 904 | * @out: drm_mode_modeinfo struct to return to the user |
@@ -1543,9 +1532,9 @@ int drm_mode_cursor_ioctl(struct drm_device *dev, | |||
1543 | } | 1532 | } |
1544 | 1533 | ||
1545 | mutex_lock(&dev->mode_config.mutex); | 1534 | mutex_lock(&dev->mode_config.mutex); |
1546 | obj = drm_mode_object_find(dev, req->crtc, DRM_MODE_OBJECT_CRTC); | 1535 | obj = drm_mode_object_find(dev, req->crtc_id, DRM_MODE_OBJECT_CRTC); |
1547 | if (!obj) { | 1536 | if (!obj) { |
1548 | DRM_DEBUG("Unknown CRTC ID %d\n", req->crtc); | 1537 | DRM_DEBUG("Unknown CRTC ID %d\n", req->crtc_id); |
1549 | ret = -EINVAL; | 1538 | ret = -EINVAL; |
1550 | goto out; | 1539 | goto out; |
1551 | } | 1540 | } |
@@ -1622,7 +1611,7 @@ int drm_mode_addfb(struct drm_device *dev, | |||
1622 | goto out; | 1611 | goto out; |
1623 | } | 1612 | } |
1624 | 1613 | ||
1625 | r->buffer_id = fb->base.id; | 1614 | r->fb_id = fb->base.id; |
1626 | list_add(&fb->filp_head, &file_priv->fbs); | 1615 | list_add(&fb->filp_head, &file_priv->fbs); |
1627 | 1616 | ||
1628 | out: | 1617 | out: |
@@ -1714,7 +1703,7 @@ int drm_mode_getfb(struct drm_device *dev, | |||
1714 | int ret = 0; | 1703 | int ret = 0; |
1715 | 1704 | ||
1716 | mutex_lock(&dev->mode_config.mutex); | 1705 | mutex_lock(&dev->mode_config.mutex); |
1717 | obj = drm_mode_object_find(dev, r->buffer_id, DRM_MODE_OBJECT_FB); | 1706 | obj = drm_mode_object_find(dev, r->fb_id, DRM_MODE_OBJECT_FB); |
1718 | if (!obj) { | 1707 | if (!obj) { |
1719 | DRM_ERROR("invalid framebuffer id\n"); | 1708 | DRM_ERROR("invalid framebuffer id\n"); |
1720 | ret = -EINVAL; | 1709 | ret = -EINVAL; |
@@ -2326,7 +2315,7 @@ int drm_mode_replacefb(struct drm_device *dev, | |||
2326 | 2315 | ||
2327 | /* right replace the current bo attached to this fb with a new bo */ | 2316 | /* right replace the current bo attached to this fb with a new bo */ |
2328 | mutex_lock(&dev->mode_config.mutex); | 2317 | mutex_lock(&dev->mode_config.mutex); |
2329 | obj = drm_mode_object_find(dev, r->buffer_id, DRM_MODE_OBJECT_FB); | 2318 | obj = drm_mode_object_find(dev, r->fb_id, DRM_MODE_OBJECT_FB); |
2330 | if (!obj) { | 2319 | if (!obj) { |
2331 | ret = -EINVAL; | 2320 | ret = -EINVAL; |
2332 | goto out; | 2321 | goto out; |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index f914044ad971..58e335967617 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -780,8 +780,6 @@ EXPORT_SYMBOL(drm_helper_initial_config); | |||
780 | */ | 780 | */ |
781 | int drm_helper_hotplug_stage_two(struct drm_device *dev) | 781 | int drm_helper_hotplug_stage_two(struct drm_device *dev) |
782 | { | 782 | { |
783 | dev->mode_config.hotplug_counter++; | ||
784 | |||
785 | drm_helper_plugged_event(dev); | 783 | drm_helper_plugged_event(dev); |
786 | 784 | ||
787 | return 0; | 785 | return 0; |
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c index c6e338282588..7eb0e09fc73b 100644 --- a/drivers/gpu/drm/drm_drv.c +++ b/drivers/gpu/drm/drm_drv.c | |||
@@ -129,23 +129,21 @@ static struct drm_ioctl_desc drm_ioctls[] = { | |||
129 | 129 | ||
130 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETRESOURCES, drm_mode_getresources, DRM_MASTER|DRM_CONTROL_ALLOW), | 130 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETRESOURCES, drm_mode_getresources, DRM_MASTER|DRM_CONTROL_ALLOW), |
131 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, DRM_MASTER|DRM_CONTROL_ALLOW), | 131 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCRTC, drm_mode_getcrtc, DRM_MASTER|DRM_CONTROL_ALLOW), |
132 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCONNECTOR, drm_mode_getconnector, DRM_MASTER|DRM_CONTROL_ALLOW), | ||
133 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETCRTC, drm_mode_setcrtc, DRM_MASTER|DRM_CONTROL_ALLOW), | 132 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETCRTC, drm_mode_setcrtc, DRM_MASTER|DRM_CONTROL_ALLOW), |
134 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_CURSOR, drm_mode_cursor_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), | 133 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_CURSOR, drm_mode_cursor_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), |
135 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB, drm_mode_addfb, DRM_MASTER|DRM_CONTROL_ALLOW), | 134 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETGAMMA, drm_mode_gamma_get_ioctl, DRM_MASTER), |
136 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb, DRM_MASTER|DRM_CONTROL_ALLOW), | 135 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETGAMMA, drm_mode_gamma_set_ioctl, DRM_MASTER), |
137 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, DRM_MASTER|DRM_CONTROL_ALLOW), | 136 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETENCODER, drm_mode_getencoder, DRM_MASTER|DRM_CONTROL_ALLOW), |
138 | 137 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETCONNECTOR, drm_mode_getconnector, DRM_MASTER|DRM_CONTROL_ALLOW), | |
139 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPROPERTY, drm_mode_connector_property_set_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), | ||
140 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPBLOB, drm_mode_getblob_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), | ||
141 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_ATTACHMODE, drm_mode_attachmode_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), | 138 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_ATTACHMODE, drm_mode_attachmode_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), |
142 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_DETACHMODE, drm_mode_detachmode_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), | 139 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_DETACHMODE, drm_mode_detachmode_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), |
143 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPERTY, drm_mode_getproperty_ioctl, DRM_MASTER | DRM_CONTROL_ALLOW), | 140 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPERTY, drm_mode_getproperty_ioctl, DRM_MASTER | DRM_CONTROL_ALLOW), |
144 | 141 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETPROPERTY, drm_mode_connector_property_set_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), | |
142 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETPROPBLOB, drm_mode_getblob_ioctl, DRM_MASTER|DRM_CONTROL_ALLOW), | ||
143 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, DRM_MASTER|DRM_CONTROL_ALLOW), | ||
144 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_ADDFB, drm_mode_addfb, DRM_MASTER|DRM_CONTROL_ALLOW), | ||
145 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb, DRM_MASTER|DRM_CONTROL_ALLOW), | ||
145 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_REPLACEFB, drm_mode_replacefb, DRM_MASTER|DRM_ROOT_ONLY|DRM_CONTROL_ALLOW), | 146 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_REPLACEFB, drm_mode_replacefb, DRM_MASTER|DRM_ROOT_ONLY|DRM_CONTROL_ALLOW), |
146 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETENCODER, drm_mode_getencoder, DRM_MASTER|DRM_CONTROL_ALLOW), | ||
147 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETGAMMA, drm_mode_gamma_get_ioctl, DRM_MASTER), | ||
148 | DRM_IOCTL_DEF(DRM_IOCTL_MODE_SETGAMMA, drm_mode_gamma_set_ioctl, DRM_MASTER), | ||
149 | }; | 147 | }; |
150 | 148 | ||
151 | #define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls ) | 149 | #define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls ) |