aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_drv.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-11-07 17:05:41 -0500
committerDave Airlie <airlied@linux.ie>2008-12-29 02:47:23 -0500
commitf453ba0460742ad027ae0c4c7d61e62817b3e7ef (patch)
tree29e6ecacd6e8971aa62e1825d77f2c1876ac3eb2 /drivers/gpu/drm/drm_drv.c
parentde151cf67ce52ed2d88083daa5e60c7858947329 (diff)
DRM: add mode setting support
Add mode setting support to the DRM layer. This is a fairly big chunk of work that allows DRM drivers to provide full output control and configuration capabilities to userspace. It was motivated by several factors: - the fb layer's APIs aren't suited for anything but simple configurations - coordination between the fb layer, DRM layer, and various userspace drivers is poor to non-existent (radeonfb excepted) - user level mode setting drivers makes displaying panic & oops messages more difficult - suspend/resume of graphics state is possible in many more configurations with kernel level support This commit just adds the core DRM part of the mode setting APIs. Driver specific commits using these new structure and APIs will follow. Co-authors: Jesse Barnes <jbarnes@virtuousgeek.org>, Jakob Bornecrantz <jakob@tungstengraphics.com> Contributors: Alan Hourihane <alanh@tungstengraphics.com>, Maarten Maathuis <madman2003@gmail.com> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Eric Anholt <eric@anholt.net> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/drm_drv.c')
-rw-r--r--drivers/gpu/drm/drm_drv.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 98a781375f6..0b9f3164a3b 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -126,6 +126,26 @@ static struct drm_ioctl_desc drm_ioctls[] = {
126 DRM_IOCTL_DEF(DRM_IOCTL_GEM_CLOSE, drm_gem_close_ioctl, 0), 126 DRM_IOCTL_DEF(DRM_IOCTL_GEM_CLOSE, drm_gem_close_ioctl, 0),
127 DRM_IOCTL_DEF(DRM_IOCTL_GEM_FLINK, drm_gem_flink_ioctl, DRM_AUTH), 127 DRM_IOCTL_DEF(DRM_IOCTL_GEM_FLINK, drm_gem_flink_ioctl, DRM_AUTH),
128 DRM_IOCTL_DEF(DRM_IOCTL_GEM_OPEN, drm_gem_open_ioctl, DRM_AUTH), 128 DRM_IOCTL_DEF(DRM_IOCTL_GEM_OPEN, drm_gem_open_ioctl, DRM_AUTH),
129
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),
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),
134 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),
136 DRM_IOCTL_DEF(DRM_IOCTL_MODE_RMFB, drm_mode_rmfb, DRM_MASTER|DRM_CONTROL_ALLOW),
137 DRM_IOCTL_DEF(DRM_IOCTL_MODE_GETFB, drm_mode_getfb, DRM_MASTER|DRM_CONTROL_ALLOW),
138
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),
142 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),
144
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_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),
129}; 149};
130 150
131#define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls ) 151#define DRM_CORE_IOCTL_COUNT ARRAY_SIZE( drm_ioctls )
@@ -150,7 +170,7 @@ int drm_lastclose(struct drm_device * dev)
150 dev->driver->lastclose(dev); 170 dev->driver->lastclose(dev);
151 DRM_DEBUG("driver lastclose completed\n"); 171 DRM_DEBUG("driver lastclose completed\n");
152 172
153 if (dev->irq_enabled) 173 if (dev->irq_enabled && !drm_core_check_feature(dev, DRIVER_MODESET))
154 drm_irq_uninstall(dev); 174 drm_irq_uninstall(dev);
155 175
156 mutex_lock(&dev->struct_mutex); 176 mutex_lock(&dev->struct_mutex);
@@ -160,7 +180,8 @@ int drm_lastclose(struct drm_device * dev)
160 del_timer(&dev->timer); 180 del_timer(&dev->timer);
161 181
162 /* Clear AGP information */ 182 /* Clear AGP information */
163 if (drm_core_has_AGP(dev) && dev->agp) { 183 if (drm_core_has_AGP(dev) && dev->agp &&
184 !drm_core_check_feature(dev, DRIVER_MODESET)) {
164 struct drm_agp_mem *entry, *tempe; 185 struct drm_agp_mem *entry, *tempe;
165 186
166 /* Remove AGP resources, but leave dev->agp 187 /* Remove AGP resources, but leave dev->agp
@@ -179,7 +200,8 @@ int drm_lastclose(struct drm_device * dev)
179 dev->agp->acquired = 0; 200 dev->agp->acquired = 0;
180 dev->agp->enabled = 0; 201 dev->agp->enabled = 0;
181 } 202 }
182 if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg) { 203 if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg &&
204 !drm_core_check_feature(dev, DRIVER_MODESET)) {
183 drm_sg_cleanup(dev->sg); 205 drm_sg_cleanup(dev->sg);
184 dev->sg = NULL; 206 dev->sg = NULL;
185 } 207 }
@@ -206,7 +228,8 @@ int drm_lastclose(struct drm_device * dev)
206 } 228 }
207 dev->queue_count = 0; 229 dev->queue_count = 0;
208 230
209 if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) 231 if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) &&
232 !drm_core_check_feature(dev, DRIVER_MODESET))
210 drm_dma_takedown(dev); 233 drm_dma_takedown(dev);
211 234
212 dev->dev_mapping = NULL; 235 dev->dev_mapping = NULL;
@@ -307,6 +330,9 @@ static void drm_cleanup(struct drm_device * dev)
307 drm_ht_remove(&dev->map_hash); 330 drm_ht_remove(&dev->map_hash);
308 drm_ctxbitmap_cleanup(dev); 331 drm_ctxbitmap_cleanup(dev);
309 332
333 if (drm_core_check_feature(dev, DRIVER_MODESET))
334 drm_put_minor(&dev->control);
335
310 if (driver->driver_features & DRIVER_GEM) 336 if (driver->driver_features & DRIVER_GEM)
311 drm_gem_destroy(dev); 337 drm_gem_destroy(dev);
312 338