Commit acf8294f authored by Dave Airlie's avatar Dave Airlie

Merge branch 'drm-next' of git://people.freedesktop.org/~dvdhrm/linux into drm-next

bunch of cleanups
* 'drm-next' of git://people.freedesktop.org/~dvdhrm/linux:
  drm: mark drm_context support as legacy
  drm: make sysfs device always available for minors
  drm: make minor->index available early
  drm: merge drm_drv.c into drm_ioctl.c
  drm: move module initialization to drm_stub.c
  drm: don't de-authenticate clients on master-close
  drm: drop redundant drm_file->is_master
  drm: extract legacy ctxbitmap flushing
parents 5b215bcf e7b96070
...@@ -6,7 +6,7 @@ ccflags-y := -Iinclude/drm ...@@ -6,7 +6,7 @@ ccflags-y := -Iinclude/drm
drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \ drm-y := drm_auth.o drm_buffer.o drm_bufs.o drm_cache.o \
drm_context.o drm_dma.o \ drm_context.o drm_dma.o \
drm_drv.o drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \ drm_fops.o drm_gem.o drm_ioctl.o drm_irq.o \
drm_lock.o drm_memory.o drm_stub.o drm_vm.o \ drm_lock.o drm_memory.o drm_stub.o drm_vm.o \
drm_agpsupport.o drm_scatter.o drm_pci.o \ drm_agpsupport.o drm_scatter.o drm_pci.o \
drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \ drm_platform.o drm_sysfs.o drm_hashtab.o drm_mm.o \
......
/**
* \file drm_context.c
* IOCTLs for generic contexts
*
* \author Rickard E. (Rik) Faith <faith@valinux.com>
* \author Gareth Hughes <gareth@valinux.com>
*/
/* /*
* Created: Fri Nov 24 18:31:37 2000 by gareth@valinux.com * Legacy: Generic DRM Contexts
* *
* Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas.
* Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California.
* All Rights Reserved. * All Rights Reserved.
* *
* Author: Rickard E. (Rik) Faith <faith@valinux.com>
* Author: Gareth Hughes <gareth@valinux.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation * to deal in the Software without restriction, including without limitation
...@@ -33,14 +28,14 @@ ...@@ -33,14 +28,14 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
/*
* ChangeLog:
* 2001-11-16 Torsten Duwe <duwe@caldera.de>
* added context constructor/destructor hooks,
* needed by SiS driver's memory management.
*/
#include <drm/drmP.h> #include <drm/drmP.h>
#include "drm_legacy.h"
struct drm_ctx_list {
struct list_head head;
drm_context_t handle;
struct drm_file *tag;
};
/******************************************************************/ /******************************************************************/
/** \name Context bitmap support */ /** \name Context bitmap support */
...@@ -56,7 +51,7 @@ ...@@ -56,7 +51,7 @@
* in drm_device::ctx_idr, while holding the drm_device::struct_mutex * in drm_device::ctx_idr, while holding the drm_device::struct_mutex
* lock. * lock.
*/ */
void drm_ctxbitmap_free(struct drm_device * dev, int ctx_handle) void drm_legacy_ctxbitmap_free(struct drm_device * dev, int ctx_handle)
{ {
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
idr_remove(&dev->ctx_idr, ctx_handle); idr_remove(&dev->ctx_idr, ctx_handle);
...@@ -72,7 +67,7 @@ void drm_ctxbitmap_free(struct drm_device * dev, int ctx_handle) ...@@ -72,7 +67,7 @@ void drm_ctxbitmap_free(struct drm_device * dev, int ctx_handle)
* Allocate a new idr from drm_device::ctx_idr while holding the * Allocate a new idr from drm_device::ctx_idr while holding the
* drm_device::struct_mutex lock. * drm_device::struct_mutex lock.
*/ */
static int drm_ctxbitmap_next(struct drm_device * dev) static int drm_legacy_ctxbitmap_next(struct drm_device * dev)
{ {
int ret; int ret;
...@@ -90,7 +85,7 @@ static int drm_ctxbitmap_next(struct drm_device * dev) ...@@ -90,7 +85,7 @@ static int drm_ctxbitmap_next(struct drm_device * dev)
* *
* Initialise the drm_device::ctx_idr * Initialise the drm_device::ctx_idr
*/ */
int drm_ctxbitmap_init(struct drm_device * dev) int drm_legacy_ctxbitmap_init(struct drm_device * dev)
{ {
idr_init(&dev->ctx_idr); idr_init(&dev->ctx_idr);
return 0; return 0;
...@@ -104,13 +99,43 @@ int drm_ctxbitmap_init(struct drm_device * dev) ...@@ -104,13 +99,43 @@ int drm_ctxbitmap_init(struct drm_device * dev)
* Free all idr members using drm_ctx_sarea_free helper function * Free all idr members using drm_ctx_sarea_free helper function
* while holding the drm_device::struct_mutex lock. * while holding the drm_device::struct_mutex lock.
*/ */
void drm_ctxbitmap_cleanup(struct drm_device * dev) void drm_legacy_ctxbitmap_cleanup(struct drm_device * dev)
{ {
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
idr_destroy(&dev->ctx_idr); idr_destroy(&dev->ctx_idr);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
} }
/**
* drm_ctxbitmap_flush() - Flush all contexts owned by a file
* @dev: DRM device to operate on
* @file: Open file to flush contexts for
*
* This iterates over all contexts on @dev and drops them if they're owned by
* @file. Note that after this call returns, new contexts might be added if
* the file is still alive.
*/
void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file)
{
struct drm_ctx_list *pos, *tmp;
mutex_lock(&dev->ctxlist_mutex);
list_for_each_entry_safe(pos, tmp, &dev->ctxlist, head) {
if (pos->tag == file &&
pos->handle != DRM_KERNEL_CONTEXT) {
if (dev->driver->context_dtor)
dev->driver->context_dtor(dev, pos->handle);
drm_legacy_ctxbitmap_free(dev, pos->handle);
list_del(&pos->head);
kfree(pos);
}
}
mutex_unlock(&dev->ctxlist_mutex);
}
/*@}*/ /*@}*/
/******************************************************************/ /******************************************************************/
...@@ -129,8 +154,8 @@ void drm_ctxbitmap_cleanup(struct drm_device * dev) ...@@ -129,8 +154,8 @@ void drm_ctxbitmap_cleanup(struct drm_device * dev)
* Gets the map from drm_device::ctx_idr with the handle specified and * Gets the map from drm_device::ctx_idr with the handle specified and
* returns its handle. * returns its handle.
*/ */
int drm_getsareactx(struct drm_device *dev, void *data, int drm_legacy_getsareactx(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_ctx_priv_map *request = data; struct drm_ctx_priv_map *request = data;
struct drm_local_map *map; struct drm_local_map *map;
...@@ -173,8 +198,8 @@ int drm_getsareactx(struct drm_device *dev, void *data, ...@@ -173,8 +198,8 @@ int drm_getsareactx(struct drm_device *dev, void *data,
* Searches the mapping specified in \p arg and update the entry in * Searches the mapping specified in \p arg and update the entry in
* drm_device::ctx_idr with it. * drm_device::ctx_idr with it.
*/ */
int drm_setsareactx(struct drm_device *dev, void *data, int drm_legacy_setsareactx(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_ctx_priv_map *request = data; struct drm_ctx_priv_map *request = data;
struct drm_local_map *map = NULL; struct drm_local_map *map = NULL;
...@@ -273,8 +298,8 @@ static int drm_context_switch_complete(struct drm_device *dev, ...@@ -273,8 +298,8 @@ static int drm_context_switch_complete(struct drm_device *dev,
* \param arg user argument pointing to a drm_ctx_res structure. * \param arg user argument pointing to a drm_ctx_res structure.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
*/ */
int drm_resctx(struct drm_device *dev, void *data, int drm_legacy_resctx(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_ctx_res *res = data; struct drm_ctx_res *res = data;
struct drm_ctx ctx; struct drm_ctx ctx;
...@@ -304,16 +329,16 @@ int drm_resctx(struct drm_device *dev, void *data, ...@@ -304,16 +329,16 @@ int drm_resctx(struct drm_device *dev, void *data,
* *
* Get a new handle for the context and copy to userspace. * Get a new handle for the context and copy to userspace.
*/ */
int drm_addctx(struct drm_device *dev, void *data, int drm_legacy_addctx(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_ctx_list *ctx_entry; struct drm_ctx_list *ctx_entry;
struct drm_ctx *ctx = data; struct drm_ctx *ctx = data;
ctx->handle = drm_ctxbitmap_next(dev); ctx->handle = drm_legacy_ctxbitmap_next(dev);
if (ctx->handle == DRM_KERNEL_CONTEXT) { if (ctx->handle == DRM_KERNEL_CONTEXT) {
/* Skip kernel's context and get a new one. */ /* Skip kernel's context and get a new one. */
ctx->handle = drm_ctxbitmap_next(dev); ctx->handle = drm_legacy_ctxbitmap_next(dev);
} }
DRM_DEBUG("%d\n", ctx->handle); DRM_DEBUG("%d\n", ctx->handle);
if (ctx->handle == -1) { if (ctx->handle == -1) {
...@@ -348,7 +373,8 @@ int drm_addctx(struct drm_device *dev, void *data, ...@@ -348,7 +373,8 @@ int drm_addctx(struct drm_device *dev, void *data,
* \param arg user argument pointing to a drm_ctx structure. * \param arg user argument pointing to a drm_ctx structure.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
*/ */
int drm_getctx(struct drm_device *dev, void *data, struct drm_file *file_priv) int drm_legacy_getctx(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{ {
struct drm_ctx *ctx = data; struct drm_ctx *ctx = data;
...@@ -369,8 +395,8 @@ int drm_getctx(struct drm_device *dev, void *data, struct drm_file *file_priv) ...@@ -369,8 +395,8 @@ int drm_getctx(struct drm_device *dev, void *data, struct drm_file *file_priv)
* *
* Calls context_switch(). * Calls context_switch().
*/ */
int drm_switchctx(struct drm_device *dev, void *data, int drm_legacy_switchctx(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_ctx *ctx = data; struct drm_ctx *ctx = data;
...@@ -389,8 +415,8 @@ int drm_switchctx(struct drm_device *dev, void *data, ...@@ -389,8 +415,8 @@ int drm_switchctx(struct drm_device *dev, void *data,
* *
* Calls context_switch_complete(). * Calls context_switch_complete().
*/ */
int drm_newctx(struct drm_device *dev, void *data, int drm_legacy_newctx(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_ctx *ctx = data; struct drm_ctx *ctx = data;
...@@ -411,8 +437,8 @@ int drm_newctx(struct drm_device *dev, void *data, ...@@ -411,8 +437,8 @@ int drm_newctx(struct drm_device *dev, void *data,
* *
* If not the special kernel context, calls ctxbitmap_free() to free the specified context. * If not the special kernel context, calls ctxbitmap_free() to free the specified context.
*/ */
int drm_rmctx(struct drm_device *dev, void *data, int drm_legacy_rmctx(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_ctx *ctx = data; struct drm_ctx *ctx = data;
...@@ -420,7 +446,7 @@ int drm_rmctx(struct drm_device *dev, void *data, ...@@ -420,7 +446,7 @@ int drm_rmctx(struct drm_device *dev, void *data,
if (ctx->handle != DRM_KERNEL_CONTEXT) { if (ctx->handle != DRM_KERNEL_CONTEXT) {
if (dev->driver->context_dtor) if (dev->driver->context_dtor)
dev->driver->context_dtor(dev, ctx->handle); dev->driver->context_dtor(dev, ctx->handle);
drm_ctxbitmap_free(dev, ctx->handle); drm_legacy_ctxbitmap_free(dev, ctx->handle);
} }
mutex_lock(&dev->ctxlist_mutex); mutex_lock(&dev->ctxlist_mutex);
......
...@@ -3244,7 +3244,7 @@ int drm_mode_getfb(struct drm_device *dev, ...@@ -3244,7 +3244,7 @@ int drm_mode_getfb(struct drm_device *dev,
r->bpp = fb->bits_per_pixel; r->bpp = fb->bits_per_pixel;
r->pitch = fb->pitches[0]; r->pitch = fb->pitches[0];
if (fb->funcs->create_handle) { if (fb->funcs->create_handle) {
if (file_priv->is_master || capable(CAP_SYS_ADMIN) || if (drm_is_master(file_priv) || capable(CAP_SYS_ADMIN) ||
drm_is_control_client(file_priv)) { drm_is_control_client(file_priv)) {
ret = fb->funcs->create_handle(fb, file_priv, ret = fb->funcs->create_handle(fb, file_priv,
&r->handle); &r->handle);
......
This diff is collapsed.
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
#include <linux/poll.h> #include <linux/poll.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include "drm_legacy.h"
/* from BKL pushdown */ /* from BKL pushdown */
DEFINE_MUTEX(drm_global_mutex); DEFINE_MUTEX(drm_global_mutex);
...@@ -111,45 +112,6 @@ int drm_open(struct inode *inode, struct file *filp) ...@@ -111,45 +112,6 @@ int drm_open(struct inode *inode, struct file *filp)
} }
EXPORT_SYMBOL(drm_open); EXPORT_SYMBOL(drm_open);
/**
* File \c open operation.
*
* \param inode device inode.
* \param filp file pointer.
*
* Puts the dev->fops corresponding to the device minor number into
* \p filp, call the \c open method, and restore the file operations.
*/
int drm_stub_open(struct inode *inode, struct file *filp)
{
struct drm_device *dev;
struct drm_minor *minor;
int err = -ENODEV;
const struct file_operations *new_fops;
DRM_DEBUG("\n");
mutex_lock(&drm_global_mutex);
minor = drm_minor_acquire(iminor(inode));
if (IS_ERR(minor))
goto out_unlock;
dev = minor->dev;
new_fops = fops_get(dev->driver->fops);
if (!new_fops)
goto out_release;
replace_fops(filp, new_fops);
if (filp->f_op->open)
err = filp->f_op->open(inode, filp);
out_release:
drm_minor_release(minor);
out_unlock:
mutex_unlock(&drm_global_mutex);
return err;
}
/** /**
* Check whether DRI will run on this CPU. * Check whether DRI will run on this CPU.
* *
...@@ -199,8 +161,7 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor) ...@@ -199,8 +161,7 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
priv->minor = minor; priv->minor = minor;
/* for compatibility root is always authenticated */ /* for compatibility root is always authenticated */
priv->always_authenticated = capable(CAP_SYS_ADMIN); priv->authenticated = capable(CAP_SYS_ADMIN);
priv->authenticated = priv->always_authenticated;
priv->lock_count = 0; priv->lock_count = 0;
INIT_LIST_HEAD(&priv->lhead); INIT_LIST_HEAD(&priv->lhead);
...@@ -233,7 +194,6 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor) ...@@ -233,7 +194,6 @@ static int drm_open_helper(struct file *filp, struct drm_minor *minor)
goto out_close; goto out_close;
} }
priv->is_master = 1;
/* take another reference for the copy in the local file priv */ /* take another reference for the copy in the local file priv */
priv->master = drm_master_get(priv->minor->master); priv->master = drm_master_get(priv->minor->master);
priv->authenticated = 1; priv->authenticated = 1;
...@@ -461,44 +421,18 @@ int drm_release(struct inode *inode, struct file *filp) ...@@ -461,44 +421,18 @@ int drm_release(struct inode *inode, struct file *filp)
if (dev->driver->driver_features & DRIVER_GEM) if (dev->driver->driver_features & DRIVER_GEM)
drm_gem_release(dev, file_priv); drm_gem_release(dev, file_priv);
mutex_lock(&dev->ctxlist_mutex); drm_legacy_ctxbitmap_flush(dev, file_priv);
if (!list_empty(&dev->ctxlist)) {
struct drm_ctx_list *pos, *n;
list_for_each_entry_safe(pos, n, &dev->ctxlist, head) {
if (pos->tag == file_priv &&
pos->handle != DRM_KERNEL_CONTEXT) {
if (dev->driver->context_dtor)
dev->driver->context_dtor(dev,
pos->handle);
drm_ctxbitmap_free(dev, pos->handle);
list_del(&pos->head);
kfree(pos);
}
}
}
mutex_unlock(&dev->ctxlist_mutex);
mutex_lock(&dev->master_mutex); mutex_lock(&dev->master_mutex);
if (file_priv->is_master) { if (drm_is_master(file_priv)) {
struct drm_master *master = file_priv->master; struct drm_master *master = file_priv->master;
struct drm_file *temp;
mutex_lock(&dev->struct_mutex);
list_for_each_entry(temp, &dev->filelist, lhead) {
if ((temp->master == file_priv->master) &&
(temp != file_priv))
temp->authenticated = temp->always_authenticated;
}
/** /**
* Since the master is disappearing, so is the * Since the master is disappearing, so is the
* possibility to lock. * possibility to lock.
*/ */
mutex_lock(&dev->struct_mutex);
if (master->lock.hw_lock) { if (master->lock.hw_lock) {
if (dev->sigdata.lock == master->lock.hw_lock) if (dev->sigdata.lock == master->lock.hw_lock)
dev->sigdata.lock = NULL; dev->sigdata.lock = NULL;
...@@ -519,7 +453,6 @@ int drm_release(struct inode *inode, struct file *filp) ...@@ -519,7 +453,6 @@ int drm_release(struct inode *inode, struct file *filp)
/* drop the master reference held by the file priv */ /* drop the master reference held by the file priv */
if (file_priv->master) if (file_priv->master)
drm_master_put(&file_priv->master); drm_master_put(&file_priv->master);
file_priv->is_master = 0;
mutex_unlock(&dev->master_mutex); mutex_unlock(&dev->master_mutex);
if (dev->driver->postclose) if (dev->driver->postclose)
......
This diff is collapsed.
#ifndef __DRM_LEGACY_H__
#define __DRM_LEGACY_H__
/*
* Copyright (c) 2014 David Herrmann <dh.herrmann@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
struct drm_device;
struct drm_file;
/*
* Generic DRM Contexts
*/
#define DRM_KERNEL_CONTEXT 0
#define DRM_RESERVED_CONTEXTS 1
int drm_legacy_ctxbitmap_init(struct drm_device *dev);
void drm_legacy_ctxbitmap_cleanup(struct drm_device *dev);
void drm_legacy_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
void drm_legacy_ctxbitmap_flush(struct drm_device *dev, struct drm_file *file);
int drm_legacy_resctx(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_addctx(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_getctx(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_switchctx(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_newctx(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_rmctx(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_setsareactx(struct drm_device *d, void *v, struct drm_file *f);
int drm_legacy_getsareactx(struct drm_device *d, void *v, struct drm_file *f);
#endif /* __DRM_LEGACY_H__ */
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <linux/export.h> #include <linux/export.h>
#include <drm/drmP.h> #include <drm/drmP.h>
#include "drm_legacy.h"
static int drm_notifier(void *priv); static int drm_notifier(void *priv);
...@@ -111,7 +112,7 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv) ...@@ -111,7 +112,7 @@ int drm_lock(struct drm_device *dev, void *data, struct drm_file *file_priv)
/* don't set the block all signals on the master process for now /* don't set the block all signals on the master process for now
* really probably not the correct answer but lets us debug xkb * really probably not the correct answer but lets us debug xkb
* xserver for now */ * xserver for now */
if (!file_priv->is_master) { if (!drm_is_master(file_priv)) {
sigemptyset(&dev->sigmask); sigemptyset(&dev->sigmask);
sigaddset(&dev->sigmask, SIGSTOP); sigaddset(&dev->sigmask, SIGSTOP);
sigaddset(&dev->sigmask, SIGTSTP); sigaddset(&dev->sigmask, SIGTSTP);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
* DEALINGS IN THE SOFTWARE. * DEALINGS IN THE SOFTWARE.
*/ */
#include <linux/debugfs.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
...@@ -33,6 +34,7 @@ ...@@ -33,6 +34,7 @@
#include <linux/slab.h> #include <linux/slab.h>
#include <drm/drmP.h> #include <drm/drmP.h>
#include <drm/drm_core.h> #include <drm/drm_core.h>
#include "drm_legacy.h"
unsigned int drm_debug = 0; /* 1 to enable debug output */ unsigned int drm_debug = 0; /* 1 to enable debug output */
EXPORT_SYMBOL(drm_debug); EXPORT_SYMBOL(drm_debug);
...@@ -61,10 +63,10 @@ module_param_named(timestamp_precision_usec, drm_timestamp_precision, int, 0600) ...@@ -61,10 +63,10 @@ module_param_named(timestamp_precision_usec, drm_timestamp_precision, int, 0600)
module_param_named(timestamp_monotonic, drm_timestamp_monotonic, int, 0600); module_param_named(timestamp_monotonic, drm_timestamp_monotonic, int, 0600);
static DEFINE_SPINLOCK(drm_minor_lock); static DEFINE_SPINLOCK(drm_minor_lock);
struct idr drm_minors_idr; static struct idr drm_minors_idr;
struct class *drm_class; struct class *drm_class;
struct dentry *drm_debugfs_root; static struct dentry *drm_debugfs_root;
int drm_err(const char *func, const char *format, ...) int drm_err(const char *func, const char *format, ...)
{ {
...@@ -177,7 +179,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data, ...@@ -177,7 +179,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
int ret = 0; int ret = 0;
mutex_lock(&dev->master_mutex); mutex_lock(&dev->master_mutex);
if (file_priv->is_master) if (drm_is_master(file_priv))
goto out_unlock; goto out_unlock;
if (file_priv->minor->master) { if (file_priv->minor->master) {
...@@ -191,13 +193,10 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data, ...@@ -191,13 +193,10 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
} }
file_priv->minor->master = drm_master_get(file_priv->master); file_priv->minor->master = drm_master_get(file_priv->master);
file_priv->is_master = 1;
if (dev->driver->master_set) { if (dev->driver->master_set) {
ret = dev->driver->master_set(dev, file_priv, false); ret = dev->driver->master_set(dev, file_priv, false);
if (unlikely(ret != 0)) { if (unlikely(ret != 0))
file_priv->is_master = 0;
drm_master_put(&file_priv->minor->master); drm_master_put(&file_priv->minor->master);
}
} }
out_unlock: out_unlock:
...@@ -211,7 +210,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data, ...@@ -211,7 +210,7 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
int ret = -EINVAL; int ret = -EINVAL;
mutex_lock(&dev->master_mutex); mutex_lock(&dev->master_mutex);
if (!file_priv->is_master) if (!drm_is_master(file_priv))
goto out_unlock; goto out_unlock;
if (!file_priv->minor->master) if (!file_priv->minor->master)
...@@ -221,7 +220,6 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data, ...@@ -221,7 +220,6 @@ int drm_dropmaster_ioctl(struct drm_device *dev, void *data,
if (dev->driver->master_drop) if (dev->driver->master_drop)
dev->driver->master_drop(dev, file_priv, false); dev->driver->master_drop(dev, file_priv, false);
drm_master_put(&file_priv->minor->master); drm_master_put(&file_priv->minor->master);
file_priv->is_master = 0;
out_unlock: out_unlock:
mutex_unlock(&dev->master_mutex); mutex_unlock(&dev->master_mutex);
...@@ -259,6 +257,8 @@ static struct drm_minor **drm_minor_get_slot(struct drm_device *dev, ...@@ -259,6 +257,8 @@ static struct drm_minor **drm_minor_get_slot(struct drm_device *dev,
static int drm_minor_alloc(struct drm_device *dev, unsigned int type) static int drm_minor_alloc(struct drm_device *dev, unsigned int type)
{ {
struct drm_minor *minor; struct drm_minor *minor;
unsigned long flags;
int r;
minor = kzalloc(sizeof(*minor), GFP_KERNEL); minor = kzalloc(sizeof(*minor), GFP_KERNEL);
if (!minor) if (!minor)
...@@ -267,77 +267,92 @@ static int drm_minor_alloc(struct drm_device *dev, unsigned int type) ...@@ -267,77 +267,92 @@ static int drm_minor_alloc(struct drm_device *dev, unsigned int type)
minor->type = type; minor->type = type;
minor->dev = dev; minor->dev = dev;
idr_preload(GFP_KERNEL);
spin_lock_irqsave(&drm_minor_lock, flags);
r = idr_alloc(&drm_minors_idr,
NULL,
64 * type,
64 * (type + 1),
GFP_NOWAIT);
spin_unlock_irqrestore(&drm_minor_lock, flags);
idr_preload_end();
if (r < 0)
goto err_free;
minor->index = r;
minor->kdev = drm_sysfs_minor_alloc(minor);
if (IS_ERR(minor->kdev)) {
r = PTR_ERR(minor->kdev);
goto err_index;
}
*drm_minor_get_slot(dev, type) = minor; *drm_minor_get_slot(dev, type) = minor;
return 0; return 0;
err_index:
spin_lock_irqsave(&drm_minor_lock, flags);
idr_remove(&drm_minors_idr, minor->index);
spin_unlock_irqrestore(&drm_minor_lock, flags);
err_free:
kfree(minor);
return r;
} }
static void drm_minor_free(struct drm_device *dev, unsigned int type) static void drm_minor_free(struct drm_device *dev, unsigned int type)
{ {
struct drm_minor **slot; struct drm_minor **slot, *minor;
unsigned long flags;
slot = drm_minor_get_slot(dev, type); slot = drm_minor_get_slot(dev, type);
if (*slot) { minor = *slot;
drm_mode_group_destroy(&(*slot)->mode_group); if (!minor)
kfree(*slot); return;
*slot = NULL;
} drm_mode_group_destroy(&minor->mode_group);
put_device(minor->kdev);
spin_lock_irqsave(&drm_minor_lock, flags);
idr_remove(&drm_minors_idr, minor->index);
spin_unlock_irqrestore(&drm_minor_lock, flags);
kfree(minor);
*slot = NULL;
} }
static int drm_minor_register(struct drm_device *dev, unsigned int type) static int drm_minor_register(struct drm_device *dev, unsigned int type)
{ {
struct drm_minor *new_minor; struct drm_minor *minor;
unsigned long flags; unsigned long flags;
int ret; int ret;
int minor_id;
DRM_DEBUG("\n"); DRM_DEBUG("\n");
new_minor = *drm_minor_get_slot(dev, type); minor = *drm_minor_get_slot(dev, type);
if (!new_minor) if (!minor)
return 0; return 0;
idr_preload(GFP_KERNEL); ret = drm_debugfs_init(minor, minor->index, drm_debugfs_root);
spin_lock_irqsave(&drm_minor_lock, flags);
minor_id = idr_alloc(&drm_minors_idr,
NULL,
64 * type,
64 * (type + 1),
GFP_NOWAIT);
spin_unlock_irqrestore(&drm_minor_lock, flags);
idr_preload_end();
if (minor_id < 0)
return minor_id;
new_minor->index = minor_id;
ret = drm_debugfs_init(new_minor, minor_id, drm_debugfs_root);
if (ret) { if (ret) {
DRM_ERROR("DRM: Failed to initialize /sys/kernel/debug/dri.\n"); DRM_ERROR("DRM: Failed to initialize /sys/kernel/debug/dri.\n");
goto err_id; return ret;
} }
ret = drm_sysfs_device_add(new_minor); ret = device_add(minor->kdev);
if (ret) { if (ret)
DRM_ERROR("DRM: Error sysfs_device_add.\n");
goto err_debugfs; goto err_debugfs;
}
/* replace NULL with @minor so lookups will succeed from now on */ /* replace NULL with @minor so lookups will succeed from now on */
spin_lock_irqsave(&drm_minor_lock, flags); spin_lock_irqsave(&drm_minor_lock, flags);
idr_replace(&drm_minors_idr, new_minor, new_minor->index); idr_replace(&drm_minors_idr, minor, minor->index);
spin_unlock_irqrestore(&drm_minor_lock, flags); spin_unlock_irqrestore(&drm_minor_lock, flags);
DRM_DEBUG("new minor assigned %d\n", minor_id); DRM_DEBUG("new minor registered %d\n", minor->index);
return 0; return 0;
err_debugfs: err_debugfs:
drm_debugfs_cleanup(new_minor); drm_debugfs_cleanup(minor);
err_id:
spin_lock_irqsave(&drm_minor_lock, flags);
idr_remove(&drm_minors_idr, minor_id);
spin_unlock_irqrestore(&drm_minor_lock, flags);
new_minor->index = 0;
return ret; return ret;
} }
...@@ -347,16 +362,17 @@ static void drm_minor_unregister(struct drm_device *dev, unsigned int type) ...@@ -347,16 +362,17 @@ static void drm_minor_unregister(struct drm_device *dev, unsigned int type)
unsigned long flags; unsigned long flags;
minor = *drm_minor_get_slot(dev, type); minor = *drm_minor_get_slot(dev, type);
if (!minor || !minor->kdev) if (!minor || !device_is_registered(minor->kdev))
return; return;
/* replace @minor with NULL so lookups will fail from now on */
spin_lock_irqsave(&drm_minor_lock, flags); spin_lock_irqsave(&drm_minor_lock, flags);
idr_remove(&drm_minors_idr, minor->index); idr_replace(&drm_minors_idr, NULL, minor->index);
spin_unlock_irqrestore(&drm_minor_lock, flags); spin_unlock_irqrestore(&drm_minor_lock, flags);
minor->index = 0;
device_del(minor->kdev);
dev_set_drvdata(minor->kdev, NULL); /* safety belt */
drm_debugfs_cleanup(minor); drm_debugfs_cleanup(minor);
drm_sysfs_device_remove(minor);
} }
/** /**
...@@ -589,7 +605,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver, ...@@ -589,7 +605,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
if (drm_ht_create(&dev->map_hash, 12)) if (drm_ht_create(&dev->map_hash, 12))
goto err_minors; goto err_minors;
ret = drm_ctxbitmap_init(dev); ret = drm_legacy_ctxbitmap_init(dev);
if (ret) { if (ret) {
DRM_ERROR("Cannot allocate memory for context bitmap.\n"); DRM_ERROR("Cannot allocate memory for context bitmap.\n");
goto err_ht; goto err_ht;
...@@ -606,7 +622,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver, ...@@ -606,7 +622,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
return dev; return dev;
err_ctxbitmap: err_ctxbitmap:
drm_ctxbitmap_cleanup(dev); drm_legacy_ctxbitmap_cleanup(dev);
err_ht: err_ht:
drm_ht_remove(&dev->map_hash); drm_ht_remove(&dev->map_hash);
err_minors: err_minors:
...@@ -628,7 +644,7 @@ static void drm_dev_release(struct kref *ref) ...@@ -628,7 +644,7 @@ static void drm_dev_release(struct kref *ref)
if (dev->driver->driver_features & DRIVER_GEM) if (dev->driver->driver_features & DRIVER_GEM)
drm_gem_destroy(dev); drm_gem_destroy(dev);
drm_ctxbitmap_cleanup(dev); drm_legacy_ctxbitmap_cleanup(dev);
drm_ht_remove(&dev->map_hash); drm_ht_remove(&dev->map_hash);
drm_fs_inode_free(dev->anon_inode); drm_fs_inode_free(dev->anon_inode);
...@@ -791,3 +807,115 @@ int drm_dev_set_unique(struct drm_device *dev, const char *fmt, ...) ...@@ -791,3 +807,115 @@ int drm_dev_set_unique(struct drm_device *dev, const char *fmt, ...)
return dev->unique ? 0 : -ENOMEM; return dev->unique ? 0 : -ENOMEM;
} }
EXPORT_SYMBOL(drm_dev_set_unique); EXPORT_SYMBOL(drm_dev_set_unique);
/*
* DRM Core
* The DRM core module initializes all global DRM objects and makes them
* available to drivers. Once setup, drivers can probe their respective
* devices.
* Currently, core management includes:
* - The "DRM-Global" key/value database
* - Global ID management for connectors
* - DRM major number allocation
* - DRM minor management
* - DRM sysfs class
* - DRM debugfs root
*
* Furthermore, the DRM core provides dynamic char-dev lookups. For each
* interface registered on a DRM device, you can request minor numbers from DRM
* core. DRM core takes care of major-number management and char-dev
* registration. A stub ->open() callback forwards any open() requests to the
* registered minor.
*/
static int drm_stub_open(struct inode *inode, struct file *filp)
{
const struct file_operations *new_fops;
struct drm_minor *minor;
int err;
DRM_DEBUG("\n");
mutex_lock(&drm_global_mutex);
minor = drm_minor_acquire(iminor(inode));
if (IS_ERR(minor)) {
err = PTR_ERR(minor);
goto out_unlock;
}
new_fops = fops_get(minor->dev->driver->fops);
if (!new_fops) {
err = -ENODEV;
goto out_release;
}
replace_fops(filp, new_fops);
if (filp->f_op->open)
err = filp->f_op->open(inode, filp);
else
err = 0;
out_release:
drm_minor_release(minor);
out_unlock:
mutex_unlock(&drm_global_mutex);
return err;
}
static const struct file_operations drm_stub_fops = {
.owner = THIS_MODULE,
.open = drm_stub_open,
.llseek = noop_llseek,
};
static int __init drm_core_init(void)
{
int ret = -ENOMEM;
drm_global_init();
drm_connector_ida_init();
idr_init(&drm_minors_idr);
if (register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops))
goto err_p1;
drm_class = drm_sysfs_create(THIS_MODULE, "drm");
if (IS_ERR(drm_class)) {
printk(KERN_ERR "DRM: Error creating drm class.\n");
ret = PTR_ERR(drm_class);
goto err_p2;
}
drm_debugfs_root = debugfs_create_dir("dri", NULL);
if (!drm_debugfs_root) {
DRM_ERROR("Cannot create /sys/kernel/debug/dri\n");
ret = -1;
goto err_p3;
}
DRM_INFO("Initialized %s %d.%d.%d %s\n",
CORE_NAME, CORE_MAJOR, CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE);
return 0;
err_p3:
drm_sysfs_destroy();
err_p2:
unregister_chrdev(DRM_MAJOR, "drm");
idr_destroy(&drm_minors_idr);
err_p1:
return ret;
}
static void __exit drm_core_exit(void)
{
debugfs_remove(drm_debugfs_root);
drm_sysfs_destroy();
unregister_chrdev(DRM_MAJOR, "drm");
drm_connector_ida_destroy();
idr_destroy(&drm_minors_idr);
}
module_init(drm_core_init);
module_exit(drm_core_exit);
...@@ -493,71 +493,55 @@ static void drm_sysfs_release(struct device *dev) ...@@ -493,71 +493,55 @@ static void drm_sysfs_release(struct device *dev)
} }
/** /**
* drm_sysfs_device_add - adds a class device to sysfs for a character driver * drm_sysfs_minor_alloc() - Allocate sysfs device for given minor
* @dev: DRM device to be added * @minor: minor to allocate sysfs device for
* @head: DRM head in question
* *
* Add a DRM device to the DRM's device model class. We use @dev's PCI device * This allocates a new sysfs device for @minor and returns it. The device is
* as the parent for the Linux device, and make sure it has a file containing * not registered nor linked. The caller has to use device_add() and
* the driver we're using (for userspace compatibility). * device_del() to register and unregister it.
*
* Note that dev_get_drvdata() on the new device will return the minor.
* However, the device does not hold a ref-count to the minor nor to the
* underlying drm_device. This is unproblematic as long as you access the
* private data only in sysfs callbacks. device_del() disables those
* synchronously, so they cannot be called after you cleanup a minor.
*/ */
int drm_sysfs_device_add(struct drm_minor *minor) struct device *drm_sysfs_minor_alloc(struct drm_minor *minor)
{ {
char *minor_str; const char *minor_str;
struct device *kdev;
int r; int r;
if (minor->type == DRM_MINOR_CONTROL) if (minor->type == DRM_MINOR_CONTROL)
minor_str = "controlD%d"; minor_str = "controlD%d";
else if (minor->type == DRM_MINOR_RENDER) else if (minor->type == DRM_MINOR_RENDER)
minor_str = "renderD%d"; minor_str = "renderD%d";
else else
minor_str = "card%d"; minor_str = "card%d";
minor->kdev = kzalloc(sizeof(*minor->kdev), GFP_KERNEL); kdev = kzalloc(sizeof(*kdev), GFP_KERNEL);
if (!minor->kdev) { if (!kdev)
r = -ENOMEM; return ERR_PTR(-ENOMEM);
goto error;
} device_initialize(kdev);
kdev->devt = MKDEV(DRM_MAJOR, minor->index);
device_initialize(minor->kdev); kdev->class = drm_class;
minor->kdev->devt = MKDEV(DRM_MAJOR, minor->index); kdev->type = &drm_sysfs_device_minor;
minor->kdev->class = drm_class; kdev->parent = minor->dev->dev;
minor->kdev->type = &drm_sysfs_device_minor; kdev->release = drm_sysfs_release;
minor->kdev->parent = minor->dev->dev; dev_set_drvdata(kdev, minor);
minor->kdev->release = drm_sysfs_release;
dev_set_drvdata(minor->kdev, minor); r = dev_set_name(kdev, minor_str, minor->index);
r = dev_set_name(minor->kdev, minor_str, minor->index);
if (r < 0) if (r < 0)
goto error; goto err_free;
r = device_add(minor->kdev);
if (r < 0)
goto error;
return 0;
error: return kdev;
DRM_ERROR("device create failed %d\n", r);
put_device(minor->kdev);
return r;
}
/** err_free:
* drm_sysfs_device_remove - remove DRM device put_device(kdev);
* @dev: DRM device to remove return ERR_PTR(r);
*
* This call unregisters and cleans up a class device that was created with a
* call to drm_sysfs_device_add()
*/
void drm_sysfs_device_remove(struct drm_minor *minor)
{
if (minor->kdev)
device_unregister(minor->kdev);
minor->kdev = NULL;
} }
/** /**
* drm_class_device_register - Register a struct device in the drm class. * drm_class_device_register - Register a struct device in the drm class.
* *
......
...@@ -1260,7 +1260,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, ...@@ -1260,7 +1260,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
flags = 0; flags = 0;
if (args->flags & I915_EXEC_SECURE) { if (args->flags & I915_EXEC_SECURE) {
if (!file->is_master || !capable(CAP_SYS_ADMIN)) if (!drm_is_master(file) || !capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
flags |= I915_DISPATCH_SECURE; flags |= I915_DISPATCH_SECURE;
...@@ -1369,7 +1369,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data, ...@@ -1369,7 +1369,7 @@ i915_gem_do_execbuffer(struct drm_device *dev, void *data,
ret = i915_parse_cmds(ring, ret = i915_parse_cmds(ring,
batch_obj, batch_obj,
args->batch_start_offset, args->batch_start_offset,
file->is_master); drm_is_master(file));
if (ret) if (ret)
goto err; goto err;
......
...@@ -990,7 +990,7 @@ static struct vmw_master *vmw_master_check(struct drm_device *dev, ...@@ -990,7 +990,7 @@ static struct vmw_master *vmw_master_check(struct drm_device *dev,
if (unlikely(ret != 0)) if (unlikely(ret != 0))
return ERR_PTR(-ERESTARTSYS); return ERR_PTR(-ERESTARTSYS);
if (file_priv->is_master) { if (drm_is_master(file_priv)) {
mutex_unlock(&dev->master_mutex); mutex_unlock(&dev->master_mutex);
return NULL; return NULL;
} }
......
...@@ -182,7 +182,7 @@ static void imx_drm_driver_preclose(struct drm_device *drm, ...@@ -182,7 +182,7 @@ static void imx_drm_driver_preclose(struct drm_device *drm,
{ {
int i; int i;
if (!file->is_master) if (!drm_is_master(file))
return; return;
for (i = 0; i < MAX_CRTC; i++) for (i = 0; i < MAX_CRTC; i++)
......
...@@ -151,8 +151,6 @@ int drm_err(const char *func, const char *format, ...); ...@@ -151,8 +151,6 @@ int drm_err(const char *func, const char *format, ...);
also include looping detection. */ also include looping detection. */
#define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */ #define DRM_MAGIC_HASH_ORDER 4 /**< Size of key hash table. Must be power of 2. */
#define DRM_KERNEL_CONTEXT 0 /**< Change drm_resctx if changed */
#define DRM_RESERVED_CONTEXTS 1 /**< Change drm_resctx if changed */
#define DRM_MAP_HASH_OFFSET 0x10000000 #define DRM_MAP_HASH_OFFSET 0x10000000
...@@ -385,10 +383,7 @@ struct drm_prime_file_private { ...@@ -385,10 +383,7 @@ struct drm_prime_file_private {
/** File private data */ /** File private data */
struct drm_file { struct drm_file {
unsigned always_authenticated :1;
unsigned authenticated :1; unsigned authenticated :1;
/* Whether we're master for a minor. Protected by master_mutex */
unsigned is_master :1;
/* true when the client has asked us to expose stereo 3D mode flags */ /* true when the client has asked us to expose stereo 3D mode flags */
unsigned stereo_allowed :1; unsigned stereo_allowed :1;
/* /*
...@@ -538,15 +533,6 @@ struct drm_map_list { ...@@ -538,15 +533,6 @@ struct drm_map_list {
struct drm_master *master; struct drm_master *master;
}; };
/**
* Context handle list
*/
struct drm_ctx_list {
struct list_head head; /**< list head */
drm_context_t handle; /**< context handle */
struct drm_file *tag; /**< associated fd private data */
};
/* location of GART table */ /* location of GART table */
#define DRM_ATI_GART_MAIN 1 #define DRM_ATI_GART_MAIN 1
#define DRM_ATI_GART_FB 2 #define DRM_ATI_GART_FB 2
...@@ -1034,7 +1020,7 @@ struct drm_device { ...@@ -1034,7 +1020,7 @@ struct drm_device {
/** \name Locks */ /** \name Locks */
/*@{ */ /*@{ */
struct mutex struct_mutex; /**< For others */ struct mutex struct_mutex; /**< For others */
struct mutex master_mutex; /**< For drm_minor::master and drm_file::is_master */ struct mutex master_mutex; /**< For drm_minor::master */
/*@} */ /*@} */
/** \name Usage Counters */ /** \name Usage Counters */
...@@ -1172,6 +1158,21 @@ static inline bool drm_is_primary_client(const struct drm_file *file_priv) ...@@ -1172,6 +1158,21 @@ static inline bool drm_is_primary_client(const struct drm_file *file_priv)
return file_priv->minor->type == DRM_MINOR_LEGACY; return file_priv->minor->type == DRM_MINOR_LEGACY;
} }
/**
* drm_is_master() - Check whether a DRM open-file is DRM-Master
* @file: DRM open-file context
*
* This checks whether a DRM open-file context is owner of the master context
* attached to it. If a file owns a master context, it's called DRM-Master.
* Per DRM device, only one such file can be DRM-Master at a time.
*
* Returns: True if the file is DRM-Master, otherwise false.
*/
static inline bool drm_is_master(const struct drm_file *file)
{
return file->master && file->master == file->minor->master;
}
/******************************************************************/ /******************************************************************/
/** \name Internal function definitions */ /** \name Internal function definitions */
/*@{*/ /*@{*/
...@@ -1187,7 +1188,6 @@ extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags); ...@@ -1187,7 +1188,6 @@ extern bool drm_ioctl_flags(unsigned int nr, unsigned int *flags);
/* Device support (drm_fops.h) */ /* Device support (drm_fops.h) */
extern struct mutex drm_global_mutex; extern struct mutex drm_global_mutex;
extern int drm_open(struct inode *inode, struct file *filp); extern int drm_open(struct inode *inode, struct file *filp);
extern int drm_stub_open(struct inode *inode, struct file *filp);
extern ssize_t drm_read(struct file *filp, char __user *buffer, extern ssize_t drm_read(struct file *filp, char __user *buffer,
size_t count, loff_t *offset); size_t count, loff_t *offset);
extern int drm_release(struct inode *inode, struct file *filp); extern int drm_release(struct inode *inode, struct file *filp);
...@@ -1225,29 +1225,6 @@ extern int drm_setversion(struct drm_device *dev, void *data, ...@@ -1225,29 +1225,6 @@ extern int drm_setversion(struct drm_device *dev, void *data,
extern int drm_noop(struct drm_device *dev, void *data, extern int drm_noop(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
/* Context IOCTL support (drm_context.h) */
extern int drm_resctx(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int drm_addctx(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int drm_getctx(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int drm_switchctx(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int drm_newctx(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int drm_rmctx(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int drm_ctxbitmap_init(struct drm_device *dev);
extern void drm_ctxbitmap_cleanup(struct drm_device *dev);
extern void drm_ctxbitmap_free(struct drm_device *dev, int ctx_handle);
extern int drm_setsareactx(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int drm_getsareactx(struct drm_device *dev, void *data,
struct drm_file *file_priv);
/* Authentication IOCTL support (drm_auth.h) */ /* Authentication IOCTL support (drm_auth.h) */
extern int drm_getmagic(struct drm_device *dev, void *data, extern int drm_getmagic(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
...@@ -1373,9 +1350,6 @@ extern unsigned int drm_timestamp_precision; ...@@ -1373,9 +1350,6 @@ extern unsigned int drm_timestamp_precision;
extern unsigned int drm_timestamp_monotonic; extern unsigned int drm_timestamp_monotonic;
extern struct class *drm_class; extern struct class *drm_class;
extern struct dentry *drm_debugfs_root;
extern struct idr drm_minors_idr;
extern struct drm_local_map *drm_getsarea(struct drm_device *dev); extern struct drm_local_map *drm_getsarea(struct drm_device *dev);
...@@ -1493,9 +1467,8 @@ extern int drm_pci_set_unique(struct drm_device *dev, ...@@ -1493,9 +1467,8 @@ extern int drm_pci_set_unique(struct drm_device *dev,
struct drm_sysfs_class; struct drm_sysfs_class;
extern struct class *drm_sysfs_create(struct module *owner, char *name); extern struct class *drm_sysfs_create(struct module *owner, char *name);
extern void drm_sysfs_destroy(void); extern void drm_sysfs_destroy(void);
extern int drm_sysfs_device_add(struct drm_minor *minor); extern struct device *drm_sysfs_minor_alloc(struct drm_minor *minor);
extern void drm_sysfs_hotplug_event(struct drm_device *dev); extern void drm_sysfs_hotplug_event(struct drm_device *dev);
extern void drm_sysfs_device_remove(struct drm_minor *minor);
extern int drm_sysfs_connector_add(struct drm_connector *connector); extern int drm_sysfs_connector_add(struct drm_connector *connector);
extern void drm_sysfs_connector_remove(struct drm_connector *connector); extern void drm_sysfs_connector_remove(struct drm_connector *connector);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment