aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/drm_fops.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_fops.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_fops.c')
-rw-r--r--drivers/gpu/drm/drm_fops.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c
index 3a6c439652a5..3733e36d135e 100644
--- a/drivers/gpu/drm/drm_fops.c
+++ b/drivers/gpu/drm/drm_fops.c
@@ -35,7 +35,6 @@
35 */ 35 */
36 36
37#include "drmP.h" 37#include "drmP.h"
38#include "drm_sarea.h"
39#include <linux/poll.h> 38#include <linux/poll.h>
40#include <linux/smp_lock.h> 39#include <linux/smp_lock.h>
41 40
@@ -55,10 +54,12 @@ static int drm_setup(struct drm_device * dev)
55 54
56 atomic_set(&dev->ioctl_count, 0); 55 atomic_set(&dev->ioctl_count, 0);
57 atomic_set(&dev->vma_count, 0); 56 atomic_set(&dev->vma_count, 0);
58 dev->buf_use = 0;
59 atomic_set(&dev->buf_alloc, 0);
60 57
61 if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) { 58 if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) &&
59 !drm_core_check_feature(dev, DRIVER_MODESET)) {
60 dev->buf_use = 0;
61 atomic_set(&dev->buf_alloc, 0);
62
62 i = drm_dma_setup(dev); 63 i = drm_dma_setup(dev);
63 if (i < 0) 64 if (i < 0)
64 return i; 65 return i;
@@ -138,14 +139,14 @@ int drm_open(struct inode *inode, struct file *filp)
138 } 139 }
139 spin_unlock(&dev->count_lock); 140 spin_unlock(&dev->count_lock);
140 } 141 }
141
142out: 142out:
143 mutex_lock(&dev->struct_mutex); 143 mutex_lock(&dev->struct_mutex);
144 if (dev->dev_mapping == NULL) 144 if (minor->type == DRM_MINOR_LEGACY) {
145 dev->dev_mapping = inode->i_mapping; 145 BUG_ON((dev->dev_mapping != NULL) &&
146 else if (dev->dev_mapping != inode->i_mapping) 146 (dev->dev_mapping != inode->i_mapping));
147 WARN(1, "dev->dev_mapping not inode mapping (%p expected %p)\n", 147 if (dev->dev_mapping == NULL)
148 dev->dev_mapping, inode->i_mapping); 148 dev->dev_mapping = inode->i_mapping;
149 }
149 mutex_unlock(&dev->struct_mutex); 150 mutex_unlock(&dev->struct_mutex);
150 151
151 return retcode; 152 return retcode;
@@ -251,6 +252,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
251 priv->lock_count = 0; 252 priv->lock_count = 0;
252 253
253 INIT_LIST_HEAD(&priv->lhead); 254 INIT_LIST_HEAD(&priv->lhead);
255 INIT_LIST_HEAD(&priv->fbs);
254 256
255 if (dev->driver->driver_features & DRIVER_GEM) 257 if (dev->driver->driver_features & DRIVER_GEM)
256 drm_gem_open(dev, priv); 258 drm_gem_open(dev, priv);