aboutsummaryrefslogtreecommitdiff
path: root/linux-core/drm_context.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2007-07-20 06:39:25 -0700
committerEric Anholt <eric@anholt.net>2007-07-20 13:39:45 -0700
commitc1119b1b092527fbb6950d0b5e51e076ddb00f29 (patch)
tree1d4b0f26e40d572e4c92eb4ebde88e60b9b137e5 /linux-core/drm_context.c
parent35de4868361ce1fb515cf33f27e6be4c59b07f89 (diff)
Replace filp in ioctl arguments with drm_file *file_priv.
As a fallout, replace filp storage with file_priv storage for "unique identifier of a client" all over the DRM. There is a 1:1 mapping, so this should be a noop. This could be a minor performance improvement, as everything on Linux dereferenced filp to get file_priv anyway, while only the mmap ioctls went the other direction.
Diffstat (limited to 'linux-core/drm_context.c')
-rw-r--r--linux-core/drm_context.c56
1 files changed, 25 insertions, 31 deletions
diff --git a/linux-core/drm_context.c b/linux-core/drm_context.c
index a0b1a7ec..76e13f65 100644
--- a/linux-core/drm_context.c
+++ b/linux-core/drm_context.c
@@ -132,7 +132,7 @@ void drm_ctxbitmap_cleanup(struct drm_device *dev)
* Get per-context SAREA.
*
* \param inode device inode.
- * \param filp file pointer.
+ * \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx_priv_map structure.
* \return zero on success or a negative number on failure.
@@ -140,11 +140,10 @@ void drm_ctxbitmap_cleanup(struct drm_device *dev)
* Gets the map from drm_device::ctx_idr with the handle specified and
* returns its handle.
*/
-int drm_getsareactx(struct inode *inode, struct file *filp,
+int drm_getsareactx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
- struct drm_file *priv = filp->private_data;
- struct drm_device *dev = priv->head->dev;
+ struct drm_device *dev = file_priv->head->dev;
struct drm_ctx_priv_map __user *argp = (void __user *)arg;
struct drm_ctx_priv_map request;
struct drm_map *map;
@@ -183,7 +182,7 @@ int drm_getsareactx(struct inode *inode, struct file *filp,
* Set per-context SAREA.
*
* \param inode device inode.
- * \param filp file pointer.
+ * \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx_priv_map structure.
* \return zero on success or a negative number on failure.
@@ -191,11 +190,10 @@ int drm_getsareactx(struct inode *inode, struct file *filp,
* Searches the mapping specified in \p arg and update the entry in
* drm_device::ctx_idr with it.
*/
-int drm_setsareactx(struct inode *inode, struct file *filp,
+int drm_setsareactx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
- struct drm_file *priv = filp->private_data;
- struct drm_device *dev = priv->head->dev;
+ struct drm_device *dev = file_priv->head->dev;
struct drm_ctx_priv_map request;
struct drm_map *map = NULL;
struct drm_map_list *r_list = NULL;
@@ -293,12 +291,12 @@ static int drm_context_switch_complete(struct drm_device *dev, int new)
* Reserve contexts.
*
* \param inode device inode.
- * \param filp file pointer.
+ * \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx_res structure.
* \return zero on success or a negative number on failure.
*/
-int drm_resctx(struct inode *inode, struct file *filp,
+int drm_resctx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_ctx_res res;
@@ -328,18 +326,17 @@ int drm_resctx(struct inode *inode, struct file *filp,
* Add context.
*
* \param inode device inode.
- * \param filp file pointer.
+ * \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx structure.
* \return zero on success or a negative number on failure.
*
* Get a new handle for the context and copy to userspace.
*/
-int drm_addctx(struct inode *inode, struct file *filp,
+int drm_addctx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
- struct drm_file *priv = filp->private_data;
- struct drm_device *dev = priv->head->dev;
+ struct drm_device *dev = file_priv->head->dev;
struct drm_ctx_list *ctx_entry;
struct drm_ctx __user *argp = (void __user *)arg;
struct drm_ctx ctx;
@@ -375,7 +372,7 @@ int drm_addctx(struct inode *inode, struct file *filp,
INIT_LIST_HEAD(&ctx_entry->head);
ctx_entry->handle = ctx.handle;
- ctx_entry->tag = priv;
+ ctx_entry->tag = file_priv;
mutex_lock(&dev->ctxlist_mutex);
list_add(&ctx_entry->head, &dev->ctxlist);
@@ -387,7 +384,7 @@ int drm_addctx(struct inode *inode, struct file *filp,
return 0;
}
-int drm_modctx(struct inode *inode, struct file *filp,
+int drm_modctx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
/* This does nothing */
@@ -398,12 +395,12 @@ int drm_modctx(struct inode *inode, struct file *filp,
* Get context.
*
* \param inode device inode.
- * \param filp file pointer.
+ * \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx structure.
* \return zero on success or a negative number on failure.
*/
-int drm_getctx(struct inode *inode, struct file *filp,
+int drm_getctx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
struct drm_ctx __user *argp = (void __user *)arg;
@@ -424,18 +421,17 @@ int drm_getctx(struct inode *inode, struct file *filp,
* Switch context.
*
* \param inode device inode.
- * \param filp file pointer.
+ * \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx structure.
* \return zero on success or a negative number on failure.
*
* Calls context_switch().
*/
-int drm_switchctx(struct inode *inode, struct file *filp,
+int drm_switchctx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
- struct drm_file *priv = filp->private_data;
- struct drm_device *dev = priv->head->dev;
+ struct drm_device *dev = file_priv->head->dev;
struct drm_ctx ctx;
if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx)))
@@ -449,18 +445,17 @@ int drm_switchctx(struct inode *inode, struct file *filp,
* New context.
*
* \param inode device inode.
- * \param filp file pointer.
+ * \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx structure.
* \return zero on success or a negative number on failure.
*
* Calls context_switch_complete().
*/
-int drm_newctx(struct inode *inode, struct file *filp,
+int drm_newctx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
- struct drm_file *priv = filp->private_data;
- struct drm_device *dev = priv->head->dev;
+ struct drm_device *dev = file_priv->head->dev;
struct drm_ctx ctx;
if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx)))
@@ -476,18 +471,17 @@ int drm_newctx(struct inode *inode, struct file *filp,
* Remove context.
*
* \param inode device inode.
- * \param filp file pointer.
+ * \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument pointing to a drm_ctx structure.
* \return zero on success or a negative number on failure.
*
* If not the special kernel context, calls ctxbitmap_free() to free the specified context.
*/
-int drm_rmctx(struct inode *inode, struct file *filp,
+int drm_rmctx(struct inode *inode, struct drm_file *file_priv,
unsigned int cmd, unsigned long arg)
{
- struct drm_file *priv = filp->private_data;
- struct drm_device *dev = priv->head->dev;
+ struct drm_device *dev = file_priv->head->dev;
struct drm_ctx ctx;
if (copy_from_user(&ctx, (struct drm_ctx __user *) arg, sizeof(ctx)))
@@ -495,7 +489,7 @@ int drm_rmctx(struct inode *inode, struct file *filp,
DRM_DEBUG("%d\n", ctx.handle);
if (ctx.handle == DRM_KERNEL_CONTEXT + 1) {
- priv->remove_auth_on_close = 1;
+ file_priv->remove_auth_on_close = 1;
}
if (ctx.handle != DRM_KERNEL_CONTEXT) {
if (dev->driver->context_dtor)