aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_stub.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_stub.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_stub.c')
-rw-r--r--drivers/gpu/drm/drm_stub.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index ea7f9e5d47fa..5ca132afa4f2 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -57,6 +57,14 @@ static int drm_minor_get_id(struct drm_device *dev, int type)
57 int ret; 57 int ret;
58 int base = 0, limit = 63; 58 int base = 0, limit = 63;
59 59
60 if (type == DRM_MINOR_CONTROL) {
61 base += 64;
62 limit = base + 127;
63 } else if (type == DRM_MINOR_RENDER) {
64 base += 128;
65 limit = base + 255;
66 }
67
60again: 68again:
61 if (idr_pre_get(&drm_minors_idr, GFP_KERNEL) == 0) { 69 if (idr_pre_get(&drm_minors_idr, GFP_KERNEL) == 0) {
62 DRM_ERROR("Out of memory expanding drawable idr\n"); 70 DRM_ERROR("Out of memory expanding drawable idr\n");
@@ -362,12 +370,28 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
362 printk(KERN_ERR "DRM: Fill_in_dev failed.\n"); 370 printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
363 goto err_g2; 371 goto err_g2;
364 } 372 }
373
374 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
375 ret = drm_get_minor(dev, &dev->control, DRM_MINOR_CONTROL);
376 if (ret)
377 goto err_g2;
378 }
379
365 if ((ret = drm_get_minor(dev, &dev->primary, DRM_MINOR_LEGACY))) 380 if ((ret = drm_get_minor(dev, &dev->primary, DRM_MINOR_LEGACY)))
366 goto err_g2; 381 goto err_g3;
367 382
368 if (dev->driver->load) 383 if (dev->driver->load) {
369 if ((ret = dev->driver->load(dev, ent->driver_data))) 384 ret = dev->driver->load(dev, ent->driver_data);
385 if (ret)
370 goto err_g3; 386 goto err_g3;
387 }
388
389 /* setup the grouping for the legacy output */
390 if (drm_core_check_feature(dev, DRIVER_MODESET)) {
391 ret = drm_mode_group_init_legacy_group(dev, &dev->primary->mode_group);
392 if (ret)
393 goto err_g3;
394 }
371 395
372 list_add_tail(&dev->driver_item, &driver->device_list); 396 list_add_tail(&dev->driver_item, &driver->device_list);
373 397