Commit 13626cb9 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'drm-patches' of ssh://master.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6

* 'drm-patches' of ssh://master.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6:
  via invalid device ids removal
  radeon: Commit the ring after each partial texture upload blit.
  i915: fix vbl swap allocation size.
  drm: Replace DRM_IOCTL_ARGS with (dev, data, file_priv) and remove DRM_DEVICE.
  drm: remove XFREE86_VERSION macros.
  drm: Replace filp in ioctl arguments with drm_file *file_priv.
  drm: Remove DRM_ERR OS macro.
parents 37ca506a ace3dff5
...@@ -63,27 +63,9 @@ ...@@ -63,27 +63,9 @@
#define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size) #define DRM_IOC(dir, group, nr, size) _IOC(dir, group, nr, size)
#endif #endif
#define XFREE86_VERSION(major,minor,patch,snap) \
((major << 16) | (minor << 8) | patch)
#ifndef CONFIG_XFREE86_VERSION
#define CONFIG_XFREE86_VERSION XFREE86_VERSION(4,1,0,0)
#endif
#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0)
#define DRM_PROC_DEVICES "/proc/devices"
#define DRM_PROC_MISC "/proc/misc"
#define DRM_PROC_DRM "/proc/drm"
#define DRM_DEV_DRM "/dev/drm"
#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP)
#define DRM_DEV_UID 0
#define DRM_DEV_GID 0
#endif
#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0)
#define DRM_MAJOR 226 #define DRM_MAJOR 226
#define DRM_MAX_MINOR 15 #define DRM_MAX_MINOR 15
#endif
#define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */ #define DRM_NAME "drm" /**< Name in kernel, /dev, and /proc */
#define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */ #define DRM_MIN_ORDER 5 /**< At least 2^5 bytes = 32 bytes */
#define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */ #define DRM_MAX_ORDER 22 /**< Up to 2^22 bytes = 4MB */
......
This diff is collapsed.
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
* Get AGP information. * Get AGP information.
* *
* \param inode device inode. * \param inode device inode.
* \param filp file pointer. * \param file_priv DRM file private.
* \param cmd command. * \param cmd command.
* \param arg pointer to a (output) drm_agp_info structure. * \param arg pointer to a (output) drm_agp_info structure.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
...@@ -71,20 +71,16 @@ int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info) ...@@ -71,20 +71,16 @@ int drm_agp_info(struct drm_device *dev, struct drm_agp_info *info)
EXPORT_SYMBOL(drm_agp_info); EXPORT_SYMBOL(drm_agp_info);
int drm_agp_info_ioctl(struct inode *inode, struct file *filp, int drm_agp_info_ioctl(struct drm_device *dev, void *data,
unsigned int cmd, unsigned long arg) struct drm_file *file_priv)
{ {
struct drm_file *priv = filp->private_data; struct drm_agp_info *info = data;
struct drm_device *dev = priv->head->dev;
struct drm_agp_info info;
int err; int err;
err = drm_agp_info(dev, &info); err = drm_agp_info(dev, info);
if (err) if (err)
return err; return err;
if (copy_to_user((struct drm_agp_info __user *) arg, &info, sizeof(info)))
return -EFAULT;
return 0; return 0;
} }
...@@ -115,7 +111,7 @@ EXPORT_SYMBOL(drm_agp_acquire); ...@@ -115,7 +111,7 @@ EXPORT_SYMBOL(drm_agp_acquire);
* Acquire the AGP device (ioctl). * Acquire the AGP device (ioctl).
* *
* \param inode device inode. * \param inode device inode.
* \param filp file pointer. * \param file_priv DRM file private.
* \param cmd command. * \param cmd command.
* \param arg user argument. * \param arg user argument.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
...@@ -123,12 +119,10 @@ EXPORT_SYMBOL(drm_agp_acquire); ...@@ -123,12 +119,10 @@ EXPORT_SYMBOL(drm_agp_acquire);
* Verifies the AGP device hasn't been acquired before and calls * Verifies the AGP device hasn't been acquired before and calls
* \c agp_backend_acquire. * \c agp_backend_acquire.
*/ */
int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp, int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
unsigned int cmd, unsigned long arg) struct drm_file *file_priv)
{ {
struct drm_file *priv = filp->private_data; return drm_agp_acquire((struct drm_device *) file_priv->head->dev);
return drm_agp_acquire((struct drm_device *) priv->head->dev);
} }
/** /**
...@@ -149,12 +143,9 @@ int drm_agp_release(struct drm_device * dev) ...@@ -149,12 +143,9 @@ int drm_agp_release(struct drm_device * dev)
} }
EXPORT_SYMBOL(drm_agp_release); EXPORT_SYMBOL(drm_agp_release);
int drm_agp_release_ioctl(struct inode *inode, struct file *filp, int drm_agp_release_ioctl(struct drm_device *dev, void *data,
unsigned int cmd, unsigned long arg) struct drm_file *file_priv)
{ {
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
return drm_agp_release(dev); return drm_agp_release(dev);
} }
...@@ -182,24 +173,19 @@ int drm_agp_enable(struct drm_device * dev, struct drm_agp_mode mode) ...@@ -182,24 +173,19 @@ int drm_agp_enable(struct drm_device * dev, struct drm_agp_mode mode)
EXPORT_SYMBOL(drm_agp_enable); EXPORT_SYMBOL(drm_agp_enable);
int drm_agp_enable_ioctl(struct inode *inode, struct file *filp, int drm_agp_enable_ioctl(struct drm_device *dev, void *data,
unsigned int cmd, unsigned long arg) struct drm_file *file_priv)
{ {
struct drm_file *priv = filp->private_data; struct drm_agp_mode *mode = data;
struct drm_device *dev = priv->head->dev;
struct drm_agp_mode mode;
if (copy_from_user(&mode, (struct drm_agp_mode __user *) arg, sizeof(mode)))
return -EFAULT;
return drm_agp_enable(dev, mode); return drm_agp_enable(dev, *mode);
} }
/** /**
* Allocate AGP memory. * Allocate AGP memory.
* *
* \param inode device inode. * \param inode device inode.
* \param filp file pointer. * \param file_priv file private pointer.
* \param cmd command. * \param cmd command.
* \param arg pointer to a drm_agp_buffer structure. * \param arg pointer to a drm_agp_buffer structure.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
...@@ -241,35 +227,13 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request) ...@@ -241,35 +227,13 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request)
} }
EXPORT_SYMBOL(drm_agp_alloc); EXPORT_SYMBOL(drm_agp_alloc);
int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_agp_buffer request;
struct drm_agp_buffer __user *argp = (void __user *)arg;
int err;
if (copy_from_user(&request, argp, sizeof(request)))
return -EFAULT;
err = drm_agp_alloc(dev, &request); int drm_agp_alloc_ioctl(struct drm_device *dev, void *data,
if (err) struct drm_file *file_priv)
return err; {
struct drm_agp_buffer *request = data;
if (copy_to_user(argp, &request, sizeof(request))) {
struct drm_agp_mem *entry;
list_for_each_entry(entry, &dev->agp->memory, head) {
if (entry->handle == request.handle)
break;
}
list_del(&entry->head);
drm_free_agp(entry->memory, entry->pages);
drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
return -EFAULT;
}
return 0; return drm_agp_alloc(dev, request);
} }
/** /**
...@@ -297,7 +261,7 @@ static struct drm_agp_mem *drm_agp_lookup_entry(struct drm_device * dev, ...@@ -297,7 +261,7 @@ static struct drm_agp_mem *drm_agp_lookup_entry(struct drm_device * dev,
* Unbind AGP memory from the GATT (ioctl). * Unbind AGP memory from the GATT (ioctl).
* *
* \param inode device inode. * \param inode device inode.
* \param filp file pointer. * \param file_priv DRM file private.
* \param cmd command. * \param cmd command.
* \param arg pointer to a drm_agp_binding structure. * \param arg pointer to a drm_agp_binding structure.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
...@@ -323,25 +287,20 @@ int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request) ...@@ -323,25 +287,20 @@ int drm_agp_unbind(struct drm_device *dev, struct drm_agp_binding *request)
} }
EXPORT_SYMBOL(drm_agp_unbind); EXPORT_SYMBOL(drm_agp_unbind);
int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_agp_binding request;
if (copy_from_user int drm_agp_unbind_ioctl(struct drm_device *dev, void *data,
(&request, (struct drm_agp_binding __user *) arg, sizeof(request))) struct drm_file *file_priv)
return -EFAULT; {
struct drm_agp_binding *request = data;
return drm_agp_unbind(dev, &request); return drm_agp_unbind(dev, request);
} }
/** /**
* Bind AGP memory into the GATT (ioctl) * Bind AGP memory into the GATT (ioctl)
* *
* \param inode device inode. * \param inode device inode.
* \param filp file pointer. * \param file_priv DRM file private.
* \param cmd command. * \param cmd command.
* \param arg pointer to a drm_agp_binding structure. * \param arg pointer to a drm_agp_binding structure.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
...@@ -372,25 +331,20 @@ int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request) ...@@ -372,25 +331,20 @@ int drm_agp_bind(struct drm_device *dev, struct drm_agp_binding *request)
} }
EXPORT_SYMBOL(drm_agp_bind); EXPORT_SYMBOL(drm_agp_bind);
int drm_agp_bind_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_agp_binding request;
if (copy_from_user int drm_agp_bind_ioctl(struct drm_device *dev, void *data,
(&request, (struct drm_agp_binding __user *) arg, sizeof(request))) struct drm_file *file_priv)
return -EFAULT; {
struct drm_agp_binding *request = data;
return drm_agp_bind(dev, &request); return drm_agp_bind(dev, request);
} }
/** /**
* Free AGP memory (ioctl). * Free AGP memory (ioctl).
* *
* \param inode device inode. * \param inode device inode.
* \param filp file pointer. * \param file_priv DRM file private.
* \param cmd command. * \param cmd command.
* \param arg pointer to a drm_agp_buffer structure. * \param arg pointer to a drm_agp_buffer structure.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
...@@ -419,18 +373,14 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) ...@@ -419,18 +373,14 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request)
} }
EXPORT_SYMBOL(drm_agp_free); EXPORT_SYMBOL(drm_agp_free);
int drm_agp_free_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_agp_buffer request;
if (copy_from_user
(&request, (struct drm_agp_buffer __user *) arg, sizeof(request)))
return -EFAULT;
return drm_agp_free(dev, &request); int drm_agp_free_ioctl(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_agp_buffer *request = data;
return drm_agp_free(dev, request);
} }
/** /**
......
...@@ -128,42 +128,38 @@ static int drm_remove_magic(struct drm_device * dev, drm_magic_t magic) ...@@ -128,42 +128,38 @@ static int drm_remove_magic(struct drm_device * dev, drm_magic_t magic)
* Get a unique magic number (ioctl). * Get a unique magic number (ioctl).
* *
* \param inode device inode. * \param inode device inode.
* \param filp file pointer. * \param file_priv DRM file private.
* \param cmd command. * \param cmd command.
* \param arg pointer to a resulting drm_auth structure. * \param arg pointer to a resulting drm_auth structure.
* \return zero on success, or a negative number on failure. * \return zero on success, or a negative number on failure.
* *
* If there is a magic number in drm_file::magic then use it, otherwise * If there is a magic number in drm_file::magic then use it, otherwise
* searches an unique non-zero magic number and add it associating it with \p * searches an unique non-zero magic number and add it associating it with \p
* filp. * file_priv.
*/ */
int drm_getmagic(struct inode *inode, struct file *filp, int drm_getmagic(struct drm_device *dev, void *data, struct drm_file *file_priv)
unsigned int cmd, unsigned long arg)
{ {
static drm_magic_t sequence = 0; static drm_magic_t sequence = 0;
static DEFINE_SPINLOCK(lock); static DEFINE_SPINLOCK(lock);
struct drm_file *priv = filp->private_data; struct drm_auth *auth = data;
struct drm_device *dev = priv->head->dev;
struct drm_auth auth;
/* Find unique magic */ /* Find unique magic */
if (priv->magic) { if (file_priv->magic) {
auth.magic = priv->magic; auth->magic = file_priv->magic;
} else { } else {
do { do {
spin_lock(&lock); spin_lock(&lock);
if (!sequence) if (!sequence)
++sequence; /* reserve 0 */ ++sequence; /* reserve 0 */
auth.magic = sequence++; auth->magic = sequence++;
spin_unlock(&lock); spin_unlock(&lock);
} while (drm_find_file(dev, auth.magic)); } while (drm_find_file(dev, auth->magic));
priv->magic = auth.magic; file_priv->magic = auth->magic;
drm_add_magic(dev, priv, auth.magic); drm_add_magic(dev, file_priv, auth->magic);
} }
DRM_DEBUG("%u\n", auth.magic); DRM_DEBUG("%u\n", auth->magic);
if (copy_to_user((struct drm_auth __user *) arg, &auth, sizeof(auth)))
return -EFAULT;
return 0; return 0;
} }
...@@ -171,27 +167,23 @@ int drm_getmagic(struct inode *inode, struct file *filp, ...@@ -171,27 +167,23 @@ int drm_getmagic(struct inode *inode, struct file *filp,
* Authenticate with a magic. * Authenticate with a magic.
* *
* \param inode device inode. * \param inode device inode.
* \param filp file pointer. * \param file_priv DRM file private.
* \param cmd command. * \param cmd command.
* \param arg pointer to a drm_auth structure. * \param arg pointer to a drm_auth structure.
* \return zero if authentication successed, or a negative number otherwise. * \return zero if authentication successed, or a negative number otherwise.
* *
* Checks if \p filp is associated with the magic number passed in \arg. * Checks if \p file_priv is associated with the magic number passed in \arg.
*/ */
int drm_authmagic(struct inode *inode, struct file *filp, int drm_authmagic(struct drm_device *dev, void *data,
unsigned int cmd, unsigned long arg) struct drm_file *file_priv)
{ {
struct drm_file *priv = filp->private_data; struct drm_auth *auth = data;
struct drm_device *dev = priv->head->dev;
struct drm_auth auth;
struct drm_file *file; struct drm_file *file;
if (copy_from_user(&auth, (struct drm_auth __user *) arg, sizeof(auth))) DRM_DEBUG("%u\n", auth->magic);
return -EFAULT; if ((file = drm_find_file(dev, auth->magic))) {
DRM_DEBUG("%u\n", auth.magic);
if ((file = drm_find_file(dev, auth.magic))) {
file->authenticated = 1; file->authenticated = 1;
drm_remove_magic(dev, auth.magic); drm_remove_magic(dev, auth->magic);
return 0; return 0;
} }
return -EINVAL; return -EINVAL;
......
This diff is collapsed.
This diff is collapsed.
...@@ -136,7 +136,7 @@ void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf) ...@@ -136,7 +136,7 @@ void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf)
buf->waiting = 0; buf->waiting = 0;
buf->pending = 0; buf->pending = 0;
buf->filp = NULL; buf->file_priv = NULL;
buf->used = 0; buf->used = 0;
if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE)
...@@ -148,11 +148,12 @@ void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf) ...@@ -148,11 +148,12 @@ void drm_free_buffer(struct drm_device *dev, struct drm_buf * buf)
/** /**
* Reclaim the buffers. * Reclaim the buffers.
* *
* \param filp file pointer. * \param file_priv DRM file private.
* *
* Frees each buffer associated with \p filp not already on the hardware. * Frees each buffer associated with \p file_priv not already on the hardware.
*/ */
void drm_core_reclaim_buffers(struct drm_device *dev, struct file *filp) void drm_core_reclaim_buffers(struct drm_device *dev,
struct drm_file *file_priv)
{ {
struct drm_device_dma *dma = dev->dma; struct drm_device_dma *dma = dev->dma;
int i; int i;
...@@ -160,7 +161,7 @@ void drm_core_reclaim_buffers(struct drm_device *dev, struct file *filp) ...@@ -160,7 +161,7 @@ void drm_core_reclaim_buffers(struct drm_device *dev, struct file *filp)
if (!dma) if (!dma)
return; return;
for (i = 0; i < dma->buf_count; i++) { for (i = 0; i < dma->buf_count; i++) {
if (dma->buflist[i]->filp == filp) { if (dma->buflist[i]->file_priv == file_priv) {
switch (dma->buflist[i]->list) { switch (dma->buflist[i]->list) {
case DRM_LIST_NONE: case DRM_LIST_NONE:
drm_free_buffer(dev, dma->buflist[i]); drm_free_buffer(dev, dma->buflist[i]);
......
...@@ -40,11 +40,10 @@ ...@@ -40,11 +40,10 @@
/** /**
* Allocate drawable ID and memory to store information about it. * Allocate drawable ID and memory to store information about it.
*/ */
int drm_adddraw(DRM_IOCTL_ARGS) int drm_adddraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
{ {
DRM_DEVICE;
unsigned long irqflags; unsigned long irqflags;
struct drm_draw draw; struct drm_draw *draw = data;
int new_id = 0; int new_id = 0;
int ret; int ret;
...@@ -63,11 +62,9 @@ int drm_adddraw(DRM_IOCTL_ARGS) ...@@ -63,11 +62,9 @@ int drm_adddraw(DRM_IOCTL_ARGS)
spin_unlock_irqrestore(&dev->drw_lock, irqflags); spin_unlock_irqrestore(&dev->drw_lock, irqflags);
draw.handle = new_id; draw->handle = new_id;
DRM_DEBUG("%d\n", draw.handle); DRM_DEBUG("%d\n", draw->handle);
DRM_COPY_TO_USER_IOCTL((struct drm_draw __user *)data, draw, sizeof(draw));
return 0; return 0;
} }
...@@ -75,72 +72,64 @@ int drm_adddraw(DRM_IOCTL_ARGS) ...@@ -75,72 +72,64 @@ int drm_adddraw(DRM_IOCTL_ARGS)
/** /**
* Free drawable ID and memory to store information about it. * Free drawable ID and memory to store information about it.
*/ */
int drm_rmdraw(DRM_IOCTL_ARGS) int drm_rmdraw(struct drm_device *dev, void *data, struct drm_file *file_priv)
{ {
DRM_DEVICE; struct drm_draw *draw = data;
struct drm_draw draw;
unsigned long irqflags; unsigned long irqflags;
DRM_COPY_FROM_USER_IOCTL(draw, (struct drm_draw __user *) data,
sizeof(draw));
spin_lock_irqsave(&dev->drw_lock, irqflags); spin_lock_irqsave(&dev->drw_lock, irqflags);
drm_free(drm_get_drawable_info(dev, draw.handle), drm_free(drm_get_drawable_info(dev, draw->handle),
sizeof(struct drm_drawable_info), DRM_MEM_BUFS); sizeof(struct drm_drawable_info), DRM_MEM_BUFS);
idr_remove(&dev->drw_idr, draw.handle); idr_remove(&dev->drw_idr, draw->handle);
spin_unlock_irqrestore(&dev->drw_lock, irqflags); spin_unlock_irqrestore(&dev->drw_lock, irqflags);
DRM_DEBUG("%d\n", draw.handle); DRM_DEBUG("%d\n", draw->handle);
return 0; return 0;
} }
int drm_update_drawable_info(DRM_IOCTL_ARGS) int drm_update_drawable_info(struct drm_device *dev, void *data, struct drm_file *file_priv)
{ {
DRM_DEVICE; struct drm_update_draw *update = data;
struct drm_update_draw update;
unsigned long irqflags; unsigned long irqflags;
struct drm_clip_rect *rects; struct drm_clip_rect *rects;
struct drm_drawable_info *info; struct drm_drawable_info *info;
int err; int err;
DRM_COPY_FROM_USER_IOCTL(update, (struct drm_update_draw __user *) data, info = idr_find(&dev->drw_idr, update->handle);
sizeof(update));
info = idr_find(&dev->drw_idr, update.handle);
if (!info) { if (!info) {
info = drm_calloc(1, sizeof(*info), DRM_MEM_BUFS); info = drm_calloc(1, sizeof(*info), DRM_MEM_BUFS);
if (!info) if (!info)
return -ENOMEM; return -ENOMEM;
if (IS_ERR(idr_replace(&dev->drw_idr, info, update.handle))) { if (IS_ERR(idr_replace(&dev->drw_idr, info, update->handle))) {
DRM_ERROR("No such drawable %d\n", update.handle); DRM_ERROR("No such drawable %d\n", update->handle);
drm_free(info, sizeof(*info), DRM_MEM_BUFS); drm_free(info, sizeof(*info), DRM_MEM_BUFS);
return -EINVAL; return -EINVAL;
} }
} }
switch (update.type) { switch (update->type) {
case DRM_DRAWABLE_CLIPRECTS: case DRM_DRAWABLE_CLIPRECTS:
if (update.num != info->num_rects) { if (update->num != info->num_rects) {
rects = drm_alloc(update.num * sizeof(struct drm_clip_rect), rects = drm_alloc(update->num * sizeof(struct drm_clip_rect),
DRM_MEM_BUFS); DRM_MEM_BUFS);
} else } else
rects = info->rects; rects = info->rects;
if (update.num && !rects) { if (update->num && !rects) {
DRM_ERROR("Failed to allocate cliprect memory\n"); DRM_ERROR("Failed to allocate cliprect memory\n");
err = DRM_ERR(ENOMEM); err = -ENOMEM;
goto error; goto error;
} }
if (update.num && DRM_COPY_FROM_USER(rects, if (update->num && DRM_COPY_FROM_USER(rects,
(struct drm_clip_rect __user *) (struct drm_clip_rect __user *)
(unsigned long)update.data, (unsigned long)update->data,
update.num * update->num *
sizeof(*rects))) { sizeof(*rects))) {
DRM_ERROR("Failed to copy cliprects from userspace\n"); DRM_ERROR("Failed to copy cliprects from userspace\n");
err = DRM_ERR(EFAULT); err = -EFAULT;
goto error; goto error;
} }
...@@ -152,23 +141,23 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS) ...@@ -152,23 +141,23 @@ int drm_update_drawable_info(DRM_IOCTL_ARGS)
} }
info->rects = rects; info->rects = rects;
info->num_rects = update.num; info->num_rects = update->num;
spin_unlock_irqrestore(&dev->drw_lock, irqflags); spin_unlock_irqrestore(&dev->drw_lock, irqflags);
DRM_DEBUG("Updated %d cliprects for drawable %d\n", DRM_DEBUG("Updated %d cliprects for drawable %d\n",
info->num_rects, update.handle); info->num_rects, update->handle);
break; break;
default: default:
DRM_ERROR("Invalid update type %d\n", update.type); DRM_ERROR("Invalid update type %d\n", update->type);
return DRM_ERR(EINVAL); return -EINVAL;
} }
return 0; return 0;
error: error:
if (rects != info->rects) if (rects != info->rects)
drm_free(rects, update.num * sizeof(struct drm_clip_rect), drm_free(rects, update->num * sizeof(struct drm_clip_rect),
DRM_MEM_BUFS); DRM_MEM_BUFS);
return err; return err;
......
This diff is collapsed.
...@@ -242,6 +242,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp, ...@@ -242,6 +242,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
memset(priv, 0, sizeof(*priv)); memset(priv, 0, sizeof(*priv));
filp->private_data = priv; filp->private_data = priv;
priv->filp = filp;
priv->uid = current->euid; priv->uid = current->euid;
priv->pid = current->pid; priv->pid = current->pid;
priv->minor = minor; priv->minor = minor;
...@@ -312,7 +313,7 @@ EXPORT_SYMBOL(drm_fasync); ...@@ -312,7 +313,7 @@ EXPORT_SYMBOL(drm_fasync);
* Release file. * Release file.
* *
* \param inode device inode * \param inode device inode
* \param filp file pointer. * \param file_priv DRM file private.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
* *
* If the hardware lock is held then free it, and take it again for the kernel * If the hardware lock is held then free it, and take it again for the kernel
...@@ -322,29 +323,28 @@ EXPORT_SYMBOL(drm_fasync); ...@@ -322,29 +323,28 @@ EXPORT_SYMBOL(drm_fasync);
*/ */
int drm_release(struct inode *inode, struct file *filp) int drm_release(struct inode *inode, struct file *filp)
{ {
struct drm_file *priv = filp->private_data; struct drm_file *file_priv = filp->private_data;
struct drm_device *dev; struct drm_device *dev = file_priv->head->dev;
int retcode = 0; int retcode = 0;
lock_kernel(); lock_kernel();
dev = priv->head->dev;
DRM_DEBUG("open_count = %d\n", dev->open_count); DRM_DEBUG("open_count = %d\n", dev->open_count);
if (dev->driver->preclose) if (dev->driver->preclose)
dev->driver->preclose(dev, filp); dev->driver->preclose(dev, file_priv);
/* ======================================================== /* ========================================================
* Begin inline drm_release * Begin inline drm_release
*/ */
DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n", DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
current->pid, (long)old_encode_dev(priv->head->device), current->pid, (long)old_encode_dev(file_priv->head->device),
dev->open_count); dev->open_count);
if (dev->driver->reclaim_buffers_locked && dev->lock.hw_lock) { if (dev->driver->reclaim_buffers_locked && dev->lock.hw_lock) {
if (drm_i_have_hw_lock(filp)) { if (drm_i_have_hw_lock(dev, file_priv)) {
dev->driver->reclaim_buffers_locked(dev, filp); dev->driver->reclaim_buffers_locked(dev, file_priv);
} else { } else {
unsigned long _end=jiffies + 3*DRM_HZ; unsigned long _end=jiffies + 3*DRM_HZ;
int locked = 0; int locked = 0;
...@@ -370,7 +370,7 @@ int drm_release(struct inode *inode, struct file *filp) ...@@ -370,7 +370,7 @@ int drm_release(struct inode *inode, struct file *filp)
"\tI will go on reclaiming the buffers anyway.\n"); "\tI will go on reclaiming the buffers anyway.\n");
} }
dev->driver->reclaim_buffers_locked(dev, filp); dev->driver->reclaim_buffers_locked(dev, file_priv);
drm_idlelock_release(&dev->lock); drm_idlelock_release(&dev->lock);
} }
} }
...@@ -378,12 +378,12 @@ int drm_release(struct inode *inode, struct file *filp) ...@@ -378,12 +378,12 @@ int drm_release(struct inode *inode, struct file *filp)
if (dev->driver->reclaim_buffers_idlelocked && dev->lock.hw_lock) { if (dev->driver->reclaim_buffers_idlelocked && dev->lock.hw_lock) {
drm_idlelock_take(&dev->lock); drm_idlelock_take(&dev->lock);
dev->driver->reclaim_buffers_idlelocked(dev, filp); dev->driver->reclaim_buffers_idlelocked(dev, file_priv);
drm_idlelock_release(&dev->lock); drm_idlelock_release(&dev->lock);
} }
if (drm_i_have_hw_lock(filp)) { if (drm_i_have_hw_lock(dev, file_priv)) {
DRM_DEBUG("File %p released, freeing lock for context %d\n", DRM_DEBUG("File %p released, freeing lock for context %d\n",
filp, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); filp, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
...@@ -394,7 +394,7 @@ int drm_release(struct inode *inode, struct file *filp) ...@@ -394,7 +394,7 @@ int drm_release(struct inode *inode, struct file *filp)
if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) && if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) &&
!dev->driver->reclaim_buffers_locked) { !dev->driver->reclaim_buffers_locked) {
dev->driver->reclaim_buffers(dev, filp); dev->driver->reclaim_buffers(dev, file_priv);
} }
drm_fasync(-1, filp, 0); drm_fasync(-1, filp, 0);
...@@ -404,7 +404,7 @@ int drm_release(struct inode *inode, struct file *filp) ...@@ -404,7 +404,7 @@ int drm_release(struct inode *inode, struct file *filp)
struct drm_ctx_list *pos, *n; struct drm_ctx_list *pos, *n;
list_for_each_entry_safe(pos, n, &dev->ctxlist, head) { list_for_each_entry_safe(pos, n, &dev->ctxlist, head) {
if (pos->tag == priv && if (pos->tag == file_priv &&
pos->handle != DRM_KERNEL_CONTEXT) { pos->handle != DRM_KERNEL_CONTEXT) {
if (dev->driver->context_dtor) if (dev->driver->context_dtor)
dev->driver->context_dtor(dev, dev->driver->context_dtor(dev,
...@@ -421,18 +421,18 @@ int drm_release(struct inode *inode, struct file *filp) ...@@ -421,18 +421,18 @@ int drm_release(struct inode *inode, struct file *filp)
mutex_unlock(&dev->ctxlist_mutex); mutex_unlock(&dev->ctxlist_mutex);
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
if (priv->remove_auth_on_close == 1) { if (file_priv->remove_auth_on_close == 1) {
struct drm_file *temp; struct drm_file *temp;
list_for_each_entry(temp, &dev->filelist, lhead) list_for_each_entry(temp, &dev->filelist, lhead)
temp->authenticated = 0; temp->authenticated = 0;
} }
list_del(&priv->lhead); list_del(&file_priv->lhead);
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
if (dev->driver->postclose) if (dev->driver->postclose)
dev->driver->postclose(dev, priv); dev->driver->postclose(dev, file_priv);
drm_free(priv, sizeof(*priv), DRM_MEM_FILES); drm_free(file_priv, sizeof(*file_priv), DRM_MEM_FILES);
/* ======================================================== /* ========================================================
* End inline drm_release * End inline drm_release
......
...@@ -1040,7 +1040,7 @@ drm_ioctl_compat_t *drm_compat_ioctls[] = { ...@@ -1040,7 +1040,7 @@ drm_ioctl_compat_t *drm_compat_ioctls[] = {
* Called whenever a 32-bit process running under a 64-bit kernel * Called whenever a 32-bit process running under a 64-bit kernel
* performs an ioctl on /dev/drm. * performs an ioctl on /dev/drm.
* *
* \param filp file pointer. * \param file_priv DRM file private.
* \param cmd command. * \param cmd command.
* \param arg user argument. * \param arg user argument.
* \return zero on success or negative number on failure. * \return zero on success or negative number on failure.
......
This diff is collapsed.
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
* Get interrupt from bus id. * Get interrupt from bus id.
* *
* \param inode device inode. * \param inode device inode.
* \param filp file pointer. * \param file_priv DRM file private.
* \param cmd command. * \param cmd command.
* \param arg user argument, pointing to a drm_irq_busid structure. * \param arg user argument, pointing to a drm_irq_busid structure.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
...@@ -50,30 +50,24 @@ ...@@ -50,30 +50,24 @@
* This IOCTL is deprecated, and will now return EINVAL for any busid not equal * This IOCTL is deprecated, and will now return EINVAL for any busid not equal
* to that of the device that this DRM instance attached to. * to that of the device that this DRM instance attached to.
*/ */
int drm_irq_by_busid(struct inode *inode, struct file *filp, int drm_irq_by_busid(struct drm_device *dev, void *data,
unsigned int cmd, unsigned long arg) struct drm_file *file_priv)
{ {
struct drm_file *priv = filp->private_data; struct drm_irq_busid *p = data;
struct drm_device *dev = priv->head->dev;
struct drm_irq_busid __user *argp = (void __user *)arg;
struct drm_irq_busid p;
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
return -EINVAL; return -EINVAL;
if (copy_from_user(&p, argp, sizeof(p))) if ((p->busnum >> 8) != drm_get_pci_domain(dev) ||
return -EFAULT; (p->busnum & 0xff) != dev->pdev->bus->number ||
p->devnum != PCI_SLOT(dev->pdev->devfn) || p->funcnum != PCI_FUNC(dev->pdev->devfn))
if ((p.busnum >> 8) != drm_get_pci_domain(dev) ||
(p.busnum & 0xff) != dev->pdev->bus->number ||
p.devnum != PCI_SLOT(dev->pdev->devfn) || p.funcnum != PCI_FUNC(dev->pdev->devfn))
return -EINVAL; return -EINVAL;
p.irq = dev->irq; p->irq = dev->irq;
DRM_DEBUG("%d:%d:%d => IRQ %d\n", p->busnum, p->devnum, p->funcnum,
p->irq);
DRM_DEBUG("%d:%d:%d => IRQ %d\n", p.busnum, p.devnum, p.funcnum, p.irq);
if (copy_to_user(argp, &p, sizeof(p)))
return -EFAULT;
return 0; return 0;
} }
...@@ -187,31 +181,27 @@ EXPORT_SYMBOL(drm_irq_uninstall); ...@@ -187,31 +181,27 @@ EXPORT_SYMBOL(drm_irq_uninstall);
* IRQ control ioctl. * IRQ control ioctl.
* *
* \param inode device inode. * \param inode device inode.
* \param filp file pointer. * \param file_priv DRM file private.
* \param cmd command. * \param cmd command.
* \param arg user argument, pointing to a drm_control structure. * \param arg user argument, pointing to a drm_control structure.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
* *
* Calls irq_install() or irq_uninstall() according to \p arg. * Calls irq_install() or irq_uninstall() according to \p arg.
*/ */
int drm_control(struct inode *inode, struct file *filp, int drm_control(struct drm_device *dev, void *data,
unsigned int cmd, unsigned long arg) struct drm_file *file_priv)
{ {
struct drm_file *priv = filp->private_data; struct drm_control *ctl = data;
struct drm_device *dev = priv->head->dev;
struct drm_control ctl;
/* if we haven't irq we fallback for compatibility reasons - this used to be a separate function in drm_dma.h */ /* if we haven't irq we fallback for compatibility reasons - this used to be a separate function in drm_dma.h */
if (copy_from_user(&ctl, (struct drm_control __user *) arg, sizeof(ctl)))
return -EFAULT;
switch (ctl.func) { switch (ctl->func) {
case DRM_INST_HANDLER: case DRM_INST_HANDLER:
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
return 0; return 0;
if (dev->if_version < DRM_IF_VERSION(1, 2) && if (dev->if_version < DRM_IF_VERSION(1, 2) &&
ctl.irq != dev->irq) ctl->irq != dev->irq)
return -EINVAL; return -EINVAL;
return drm_irq_install(dev); return drm_irq_install(dev);
case DRM_UNINST_HANDLER: case DRM_UNINST_HANDLER:
...@@ -227,7 +217,7 @@ int drm_control(struct inode *inode, struct file *filp, ...@@ -227,7 +217,7 @@ int drm_control(struct inode *inode, struct file *filp,
* Wait for VBLANK. * Wait for VBLANK.
* *
* \param inode device inode. * \param inode device inode.
* \param filp file pointer. * \param file_priv DRM file private.
* \param cmd command. * \param cmd command.
* \param data user argument, pointing to a drm_wait_vblank structure. * \param data user argument, pointing to a drm_wait_vblank structure.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
...@@ -242,31 +232,25 @@ int drm_control(struct inode *inode, struct file *filp, ...@@ -242,31 +232,25 @@ int drm_control(struct inode *inode, struct file *filp,
* *
* If a signal is not requested, then calls vblank_wait(). * If a signal is not requested, then calls vblank_wait().
*/ */
int drm_wait_vblank(DRM_IOCTL_ARGS) int drm_wait_vblank(struct drm_device *dev, void *data, struct drm_file *file_priv)
{ {
struct drm_file *priv = filp->private_data; union drm_wait_vblank *vblwait = data;
struct drm_device *dev = priv->head->dev;
union drm_wait_vblank __user *argp = (void __user *)data;
union drm_wait_vblank vblwait;
struct timeval now; struct timeval now;
int ret = 0; int ret = 0;
unsigned int flags, seq; unsigned int flags, seq;
if (!dev->irq) if ((!dev->irq) || (!dev->irq_enabled))
return -EINVAL; return -EINVAL;
if (copy_from_user(&vblwait, argp, sizeof(vblwait))) if (vblwait->request.type &
return -EFAULT;
if (vblwait.request.type &
~(_DRM_VBLANK_TYPES_MASK | _DRM_VBLANK_FLAGS_MASK)) { ~(_DRM_VBLANK_TYPES_MASK | _DRM_VBLANK_FLAGS_MASK)) {
DRM_ERROR("Unsupported type value 0x%x, supported mask 0x%x\n", DRM_ERROR("Unsupported type value 0x%x, supported mask 0x%x\n",
vblwait.request.type, vblwait->request.type,
(_DRM_VBLANK_TYPES_MASK | _DRM_VBLANK_FLAGS_MASK)); (_DRM_VBLANK_TYPES_MASK | _DRM_VBLANK_FLAGS_MASK));
return -EINVAL; return -EINVAL;
} }
flags = vblwait.request.type & _DRM_VBLANK_FLAGS_MASK; flags = vblwait->request.type & _DRM_VBLANK_FLAGS_MASK;
if (!drm_core_check_feature(dev, (flags & _DRM_VBLANK_SECONDARY) ? if (!drm_core_check_feature(dev, (flags & _DRM_VBLANK_SECONDARY) ?
DRIVER_IRQ_VBL2 : DRIVER_IRQ_VBL)) DRIVER_IRQ_VBL2 : DRIVER_IRQ_VBL))
...@@ -275,10 +259,10 @@ int drm_wait_vblank(DRM_IOCTL_ARGS) ...@@ -275,10 +259,10 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
seq = atomic_read((flags & _DRM_VBLANK_SECONDARY) ? &dev->vbl_received2 seq = atomic_read((flags & _DRM_VBLANK_SECONDARY) ? &dev->vbl_received2
: &dev->vbl_received); : &dev->vbl_received);
switch (vblwait.request.type & _DRM_VBLANK_TYPES_MASK) { switch (vblwait->request.type & _DRM_VBLANK_TYPES_MASK) {
case _DRM_VBLANK_RELATIVE: case _DRM_VBLANK_RELATIVE:
vblwait.request.sequence += seq; vblwait->request.sequence += seq;
vblwait.request.type &= ~_DRM_VBLANK_RELATIVE; vblwait->request.type &= ~_DRM_VBLANK_RELATIVE;
case _DRM_VBLANK_ABSOLUTE: case _DRM_VBLANK_ABSOLUTE:
break; break;
default: default:
...@@ -286,8 +270,8 @@ int drm_wait_vblank(DRM_IOCTL_ARGS) ...@@ -286,8 +270,8 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
} }
if ((flags & _DRM_VBLANK_NEXTONMISS) && if ((flags & _DRM_VBLANK_NEXTONMISS) &&
(seq - vblwait.request.sequence) <= (1<<23)) { (seq - vblwait->request.sequence) <= (1<<23)) {
vblwait.request.sequence = seq + 1; vblwait->request.sequence = seq + 1;
} }
if (flags & _DRM_VBLANK_SIGNAL) { if (flags & _DRM_VBLANK_SIGNAL) {
...@@ -303,12 +287,13 @@ int drm_wait_vblank(DRM_IOCTL_ARGS) ...@@ -303,12 +287,13 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
* that case * that case
*/ */
list_for_each_entry(vbl_sig, vbl_sigs, head) { list_for_each_entry(vbl_sig, vbl_sigs, head) {
if (vbl_sig->sequence == vblwait.request.sequence if (vbl_sig->sequence == vblwait->request.sequence
&& vbl_sig->info.si_signo == vblwait.request.signal && vbl_sig->info.si_signo ==
vblwait->request.signal
&& vbl_sig->task == current) { && vbl_sig->task == current) {
spin_unlock_irqrestore(&dev->vbl_lock, spin_unlock_irqrestore(&dev->vbl_lock,
irqflags); irqflags);
vblwait.reply.sequence = seq; vblwait->reply.sequence = seq;
goto done; goto done;
} }
} }
...@@ -330,8 +315,8 @@ int drm_wait_vblank(DRM_IOCTL_ARGS) ...@@ -330,8 +315,8 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
memset((void *)vbl_sig, 0, sizeof(*vbl_sig)); memset((void *)vbl_sig, 0, sizeof(*vbl_sig));
vbl_sig->sequence = vblwait.request.sequence; vbl_sig->sequence = vblwait->request.sequence;
vbl_sig->info.si_signo = vblwait.request.signal; vbl_sig->info.si_signo = vblwait->request.signal;
vbl_sig->task = current; vbl_sig->task = current;
spin_lock_irqsave(&dev->vbl_lock, irqflags); spin_lock_irqsave(&dev->vbl_lock, irqflags);
...@@ -340,25 +325,22 @@ int drm_wait_vblank(DRM_IOCTL_ARGS) ...@@ -340,25 +325,22 @@ int drm_wait_vblank(DRM_IOCTL_ARGS)
spin_unlock_irqrestore(&dev->vbl_lock, irqflags); spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
vblwait.reply.sequence = seq; vblwait->reply.sequence = seq;
} else { } else {
if (flags & _DRM_VBLANK_SECONDARY) { if (flags & _DRM_VBLANK_SECONDARY) {
if (dev->driver->vblank_wait2) if (dev->driver->vblank_wait2)
ret = dev->driver->vblank_wait2(dev, &vblwait.request.sequence); ret = dev->driver->vblank_wait2(dev, &vblwait->request.sequence);
} else if (dev->driver->vblank_wait) } else if (dev->driver->vblank_wait)
ret = ret =
dev->driver->vblank_wait(dev, dev->driver->vblank_wait(dev,
&vblwait.request.sequence); &vblwait->request.sequence);
do_gettimeofday(&now); do_gettimeofday(&now);
vblwait.reply.tval_sec = now.tv_sec; vblwait->reply.tval_sec = now.tv_sec;
vblwait.reply.tval_usec = now.tv_usec; vblwait->reply.tval_usec = now.tv_usec;
} }
done: done:
if (copy_to_user(argp, &vblwait, sizeof(vblwait)))
return -EFAULT;
return ret; return ret;
} }
......
...@@ -41,39 +41,33 @@ static int drm_notifier(void *priv); ...@@ -41,39 +41,33 @@ static int drm_notifier(void *priv);
* Lock ioctl. * Lock ioctl.
* *
* \param inode device inode. * \param inode device inode.
* \param filp file pointer. * \param file_priv DRM file private.
* \param cmd command. * \param cmd command.
* \param arg user argument, pointing to a drm_lock structure. * \param arg user argument, pointing to a drm_lock structure.
* \return zero on success or negative number on failure. * \return zero on success or negative number on failure.
* *
* Add the current task to the lock wait queue, and attempt to take to lock. * Add the current task to the lock wait queue, and attempt to take to lock.
*/ */
int drm_lock(struct inode *inode, struct file *filp, int drm_lock(struct drm_device *dev, void *data, 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;
DECLARE_WAITQUEUE(entry, current); DECLARE_WAITQUEUE(entry, current);
struct drm_lock lock; struct drm_lock *lock = data;
int ret = 0; int ret = 0;
++priv->lock_count; ++file_priv->lock_count;
if (copy_from_user(&lock, (struct drm_lock __user *) arg, sizeof(lock))) if (lock->context == DRM_KERNEL_CONTEXT) {
return -EFAULT;
if (lock.context == DRM_KERNEL_CONTEXT) {
DRM_ERROR("Process %d using kernel context %d\n", DRM_ERROR("Process %d using kernel context %d\n",
current->pid, lock.context); current->pid, lock->context);
return -EINVAL; return -EINVAL;
} }
DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
lock.context, current->pid, lock->context, current->pid,
dev->lock.hw_lock->lock, lock.flags); dev->lock.hw_lock->lock, lock->flags);
if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE)) if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE))
if (lock.context < 0) if (lock->context < 0)
return -EINVAL; return -EINVAL;
add_wait_queue(&dev->lock.lock_queue, &entry); add_wait_queue(&dev->lock.lock_queue, &entry);
...@@ -87,8 +81,8 @@ int drm_lock(struct inode *inode, struct file *filp, ...@@ -87,8 +81,8 @@ int drm_lock(struct inode *inode, struct file *filp,
ret = -EINTR; ret = -EINTR;
break; break;
} }
if (drm_lock_take(&dev->lock, lock.context)) { if (drm_lock_take(&dev->lock, lock->context)) {
dev->lock.filp = filp; dev->lock.file_priv = file_priv;
dev->lock.lock_time = jiffies; dev->lock.lock_time = jiffies;
atomic_inc(&dev->counts[_DRM_STAT_LOCKS]); atomic_inc(&dev->counts[_DRM_STAT_LOCKS]);
break; /* Got lock */ break; /* Got lock */
...@@ -107,7 +101,8 @@ int drm_lock(struct inode *inode, struct file *filp, ...@@ -107,7 +101,8 @@ int drm_lock(struct inode *inode, struct file *filp,
__set_current_state(TASK_RUNNING); __set_current_state(TASK_RUNNING);
remove_wait_queue(&dev->lock.lock_queue, &entry); remove_wait_queue(&dev->lock.lock_queue, &entry);
DRM_DEBUG( "%d %s\n", lock.context, ret ? "interrupted" : "has lock" ); DRM_DEBUG("%d %s\n", lock->context,
ret ? "interrupted" : "has lock");
if (ret) return ret; if (ret) return ret;
sigemptyset(&dev->sigmask); sigemptyset(&dev->sigmask);
...@@ -115,24 +110,26 @@ int drm_lock(struct inode *inode, struct file *filp, ...@@ -115,24 +110,26 @@ int drm_lock(struct inode *inode, struct file *filp,
sigaddset(&dev->sigmask, SIGTSTP); sigaddset(&dev->sigmask, SIGTSTP);
sigaddset(&dev->sigmask, SIGTTIN); sigaddset(&dev->sigmask, SIGTTIN);
sigaddset(&dev->sigmask, SIGTTOU); sigaddset(&dev->sigmask, SIGTTOU);
dev->sigdata.context = lock.context; dev->sigdata.context = lock->context;
dev->sigdata.lock = dev->lock.hw_lock; dev->sigdata.lock = dev->lock.hw_lock;
block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask);
if (dev->driver->dma_ready && (lock.flags & _DRM_LOCK_READY)) if (dev->driver->dma_ready && (lock->flags & _DRM_LOCK_READY))
dev->driver->dma_ready(dev); dev->driver->dma_ready(dev);
if (dev->driver->dma_quiescent && (lock.flags & _DRM_LOCK_QUIESCENT)) { if (dev->driver->dma_quiescent && (lock->flags & _DRM_LOCK_QUIESCENT))
{
if (dev->driver->dma_quiescent(dev)) { if (dev->driver->dma_quiescent(dev)) {
DRM_DEBUG("%d waiting for DMA quiescent\n", lock.context); DRM_DEBUG("%d waiting for DMA quiescent\n",
return DRM_ERR(EBUSY); lock->context);
return -EBUSY;
} }
} }
if (dev->driver->kernel_context_switch && if (dev->driver->kernel_context_switch &&
dev->last_context != lock.context) { dev->last_context != lock->context) {
dev->driver->kernel_context_switch(dev, dev->last_context, dev->driver->kernel_context_switch(dev, dev->last_context,
lock.context); lock->context);
} }
return 0; return 0;
...@@ -142,27 +139,21 @@ int drm_lock(struct inode *inode, struct file *filp, ...@@ -142,27 +139,21 @@ int drm_lock(struct inode *inode, struct file *filp,
* Unlock ioctl. * Unlock ioctl.
* *
* \param inode device inode. * \param inode device inode.
* \param filp file pointer. * \param file_priv DRM file private.
* \param cmd command. * \param cmd command.
* \param arg user argument, pointing to a drm_lock structure. * \param arg user argument, pointing to a drm_lock structure.
* \return zero on success or negative number on failure. * \return zero on success or negative number on failure.
* *
* Transfer and free the lock. * Transfer and free the lock.
*/ */
int drm_unlock(struct inode *inode, struct file *filp, int drm_unlock(struct drm_device *dev, void *data, struct drm_file *file_priv)
unsigned int cmd, unsigned long arg)
{ {
struct drm_file *priv = filp->private_data; struct drm_lock *lock = data;
struct drm_device *dev = priv->head->dev;
struct drm_lock lock;
unsigned long irqflags; unsigned long irqflags;
if (copy_from_user(&lock, (struct drm_lock __user *) arg, sizeof(lock))) if (lock->context == DRM_KERNEL_CONTEXT) {
return -EFAULT;
if (lock.context == DRM_KERNEL_CONTEXT) {
DRM_ERROR("Process %d using kernel context %d\n", DRM_ERROR("Process %d using kernel context %d\n",
current->pid, lock.context); current->pid, lock->context);
return -EINVAL; return -EINVAL;
} }
...@@ -184,7 +175,7 @@ int drm_unlock(struct inode *inode, struct file *filp, ...@@ -184,7 +175,7 @@ int drm_unlock(struct inode *inode, struct file *filp,
if (dev->driver->kernel_context_switch_unlock) if (dev->driver->kernel_context_switch_unlock)
dev->driver->kernel_context_switch_unlock(dev); dev->driver->kernel_context_switch_unlock(dev);
else { else {
if (drm_lock_free(&dev->lock,lock.context)) { if (drm_lock_free(&dev->lock,lock->context)) {
/* FIXME: Should really bail out here. */ /* FIXME: Should really bail out here. */
} }
} }
...@@ -257,7 +248,7 @@ static int drm_lock_transfer(struct drm_lock_data *lock_data, ...@@ -257,7 +248,7 @@ static int drm_lock_transfer(struct drm_lock_data *lock_data,
unsigned int old, new, prev; unsigned int old, new, prev;
volatile unsigned int *lock = &lock_data->hw_lock->lock; volatile unsigned int *lock = &lock_data->hw_lock->lock;
lock_data->filp = NULL; lock_data->file_priv = NULL;
do { do {
old = *lock; old = *lock;
new = context | _DRM_LOCK_HELD; new = context | _DRM_LOCK_HELD;
...@@ -390,13 +381,11 @@ void drm_idlelock_release(struct drm_lock_data *lock_data) ...@@ -390,13 +381,11 @@ void drm_idlelock_release(struct drm_lock_data *lock_data)
EXPORT_SYMBOL(drm_idlelock_release); EXPORT_SYMBOL(drm_idlelock_release);
int drm_i_have_hw_lock(struct file *filp) int drm_i_have_hw_lock(struct drm_device *dev, struct drm_file *file_priv)
{ {
DRM_DEVICE; return (file_priv->lock_count && dev->lock.hw_lock &&
return (priv->lock_count && dev->lock.hw_lock &&
_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) &&
dev->lock.filp == filp); dev->lock.file_priv == file_priv);
} }
EXPORT_SYMBOL(drm_i_have_hw_lock); EXPORT_SYMBOL(drm_i_have_hw_lock);
...@@ -6,11 +6,6 @@ ...@@ -6,11 +6,6 @@
#include <linux/interrupt.h> /* For task queue support */ #include <linux/interrupt.h> /* For task queue support */
#include <linux/delay.h> #include <linux/delay.h>
/** File pointer type */
#define DRMFILE struct file *
/** Ioctl arguments */
#define DRM_IOCTL_ARGS struct inode *inode, struct file *filp, unsigned int cmd, unsigned long data
#define DRM_ERR(d) -(d)
/** Current process ID */ /** Current process ID */
#define DRM_CURRENTPID current->pid #define DRM_CURRENTPID current->pid
#define DRM_SUSER(p) capable(CAP_SYS_ADMIN) #define DRM_SUSER(p) capable(CAP_SYS_ADMIN)
...@@ -33,9 +28,6 @@ ...@@ -33,9 +28,6 @@
#define DRM_WRITEMEMORYBARRIER() wmb() #define DRM_WRITEMEMORYBARRIER() wmb()
/** Read/write memory barrier */ /** Read/write memory barrier */
#define DRM_MEMORYBARRIER() mb() #define DRM_MEMORYBARRIER() mb()
/** DRM device local declaration */
#define DRM_DEVICE struct drm_file *priv = filp->private_data; \
struct drm_device *dev = priv->head->dev
/** IRQ handler arguments and return type and values */ /** IRQ handler arguments and return type and values */
#define DRM_IRQ_ARGS int irq, void *arg #define DRM_IRQ_ARGS int irq, void *arg
...@@ -94,8 +86,6 @@ static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size) ...@@ -94,8 +86,6 @@ static __inline__ int mtrr_del(int reg, unsigned long base, unsigned long size)
#define DRM_GET_USER_UNCHECKED(val, uaddr) \ #define DRM_GET_USER_UNCHECKED(val, uaddr) \
__get_user(val, uaddr) __get_user(val, uaddr)
#define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data
#define DRM_HZ HZ #define DRM_HZ HZ
#define DRM_WAIT_ON( ret, queue, timeout, condition ) \ #define DRM_WAIT_ON( ret, queue, timeout, condition ) \
......
...@@ -236,10 +236,8 @@ ...@@ -236,10 +236,8 @@
{0x1106, 0x3022, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x1106, 0x3022, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
{0x1106, 0x3118, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VIA_PRO_GROUP_A}, \ {0x1106, 0x3118, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VIA_PRO_GROUP_A}, \
{0x1106, 0x3122, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x1106, 0x3122, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
{0x1106, 0x7204, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
{0x1106, 0x7205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x1106, 0x7205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
{0x1106, 0x3108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x1106, 0x3108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
{0x1106, 0x3304, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
{0x1106, 0x3344, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x1106, 0x3344, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
{0x1106, 0x3343, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \ {0x1106, 0x3343, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
{0x1106, 0x3230, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VIA_DX9_0}, \ {0x1106, 0x3230, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VIA_DX9_0}, \
......
...@@ -62,13 +62,8 @@ void drm_sg_cleanup(struct drm_sg_mem * entry) ...@@ -62,13 +62,8 @@ void drm_sg_cleanup(struct drm_sg_mem * entry)
# define ScatterHandle(x) (unsigned int)(x) # define ScatterHandle(x) (unsigned int)(x)
#endif #endif
int drm_sg_alloc(struct inode *inode, struct file *filp, int drm_sg_alloc(struct drm_device *dev, struct drm_scatter_gather * request)
unsigned int cmd, unsigned long arg)
{ {
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
struct drm_scatter_gather __user *argp = (void __user *)arg;
struct drm_scatter_gather request;
struct drm_sg_mem *entry; struct drm_sg_mem *entry;
unsigned long pages, i, j; unsigned long pages, i, j;
...@@ -80,17 +75,13 @@ int drm_sg_alloc(struct inode *inode, struct file *filp, ...@@ -80,17 +75,13 @@ int drm_sg_alloc(struct inode *inode, struct file *filp,
if (dev->sg) if (dev->sg)
return -EINVAL; return -EINVAL;
if (copy_from_user(&request, argp, sizeof(request)))
return -EFAULT;
entry = drm_alloc(sizeof(*entry), DRM_MEM_SGLISTS); entry = drm_alloc(sizeof(*entry), DRM_MEM_SGLISTS);
if (!entry) if (!entry)
return -ENOMEM; return -ENOMEM;
memset(entry, 0, sizeof(*entry)); memset(entry, 0, sizeof(*entry));
pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE; DRM_DEBUG("sg size=%ld pages=%ld\n", request->size, pages);
DRM_DEBUG("sg size=%ld pages=%ld\n", request.size, pages);
entry->pages = pages; entry->pages = pages;
entry->pagelist = drm_alloc(pages * sizeof(*entry->pagelist), entry->pagelist = drm_alloc(pages * sizeof(*entry->pagelist),
...@@ -142,12 +133,7 @@ int drm_sg_alloc(struct inode *inode, struct file *filp, ...@@ -142,12 +133,7 @@ int drm_sg_alloc(struct inode *inode, struct file *filp,
SetPageReserved(entry->pagelist[j]); SetPageReserved(entry->pagelist[j]);
} }
request.handle = entry->handle; request->handle = entry->handle;
if (copy_to_user(argp, &request, sizeof(request))) {
drm_sg_cleanup(entry);
return -EFAULT;
}
dev->sg = entry; dev->sg = entry;
...@@ -197,27 +183,31 @@ int drm_sg_alloc(struct inode *inode, struct file *filp, ...@@ -197,27 +183,31 @@ int drm_sg_alloc(struct inode *inode, struct file *filp,
drm_sg_cleanup(entry); drm_sg_cleanup(entry);
return -ENOMEM; return -ENOMEM;
} }
EXPORT_SYMBOL(drm_sg_alloc);
int drm_sg_free(struct inode *inode, struct file *filp, int drm_sg_alloc_ioctl(struct drm_device *dev, void *data,
unsigned int cmd, unsigned long arg) struct drm_file *file_priv)
{ {
struct drm_file *priv = filp->private_data; struct drm_scatter_gather *request = data;
struct drm_device *dev = priv->head->dev;
struct drm_scatter_gather request; return drm_sg_alloc(dev, request);
}
int drm_sg_free(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_scatter_gather *request = data;
struct drm_sg_mem *entry; struct drm_sg_mem *entry;
if (!drm_core_check_feature(dev, DRIVER_SG)) if (!drm_core_check_feature(dev, DRIVER_SG))
return -EINVAL; return -EINVAL;
if (copy_from_user(&request,
(struct drm_scatter_gather __user *) arg,
sizeof(request)))
return -EFAULT;
entry = dev->sg; entry = dev->sg;
dev->sg = NULL; dev->sg = NULL;
if (!entry || entry->handle != request.handle) if (!entry || entry->handle != request->handle)
return -EINVAL; return -EINVAL;
DRM_DEBUG("sg free virtual = %p\n", entry->virtual); DRM_DEBUG("sg free virtual = %p\n", entry->virtual);
......
...@@ -463,7 +463,7 @@ static void drm_vm_close(struct vm_area_struct *vma) ...@@ -463,7 +463,7 @@ static void drm_vm_close(struct vm_area_struct *vma)
/** /**
* mmap DMA memory. * mmap DMA memory.
* *
* \param filp file pointer. * \param file_priv DRM file private.
* \param vma virtual memory area. * \param vma virtual memory area.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
* *
...@@ -533,7 +533,7 @@ EXPORT_SYMBOL(drm_core_get_reg_ofs); ...@@ -533,7 +533,7 @@ EXPORT_SYMBOL(drm_core_get_reg_ofs);
/** /**
* mmap DMA memory. * mmap DMA memory.
* *
* \param filp file pointer. * \param file_priv DRM file private.
* \param vma virtual memory area. * \param vma virtual memory area.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
* *
......
This diff is collapsed.
...@@ -102,13 +102,8 @@ typedef enum _drm_i810_init_func { ...@@ -102,13 +102,8 @@ typedef enum _drm_i810_init_func {
/* This is the init structure after v1.2 */ /* This is the init structure after v1.2 */
typedef struct _drm_i810_init { typedef struct _drm_i810_init {
drm_i810_init_func_t func; drm_i810_init_func_t func;
#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0)
int ring_map_idx;
int buffer_map_idx;
#else
unsigned int mmio_offset; unsigned int mmio_offset;
unsigned int buffers_offset; unsigned int buffers_offset;
#endif
int sarea_priv_offset; int sarea_priv_offset;
unsigned int ring_start; unsigned int ring_start;
unsigned int ring_end; unsigned int ring_end;
......
...@@ -117,15 +117,16 @@ typedef struct drm_i810_private { ...@@ -117,15 +117,16 @@ typedef struct drm_i810_private {
/* i810_dma.c */ /* i810_dma.c */
extern int i810_driver_dma_quiescent(struct drm_device * dev); extern int i810_driver_dma_quiescent(struct drm_device * dev);
extern void i810_driver_reclaim_buffers_locked(struct drm_device * dev, extern void i810_driver_reclaim_buffers_locked(struct drm_device * dev,
struct file *filp); struct drm_file *file_priv);
extern int i810_driver_load(struct drm_device *, unsigned long flags); extern int i810_driver_load(struct drm_device *, unsigned long flags);
extern void i810_driver_lastclose(struct drm_device * dev); extern void i810_driver_lastclose(struct drm_device * dev);
extern void i810_driver_preclose(struct drm_device * dev, DRMFILE filp); extern void i810_driver_preclose(struct drm_device * dev,
struct drm_file *file_priv);
extern void i810_driver_reclaim_buffers_locked(struct drm_device * dev, extern void i810_driver_reclaim_buffers_locked(struct drm_device * dev,
struct file *filp); struct drm_file *file_priv);
extern int i810_driver_device_is_agp(struct drm_device * dev); extern int i810_driver_device_is_agp(struct drm_device * dev);
extern drm_ioctl_desc_t i810_ioctls[]; extern struct drm_ioctl_desc i810_ioctls[];
extern int i810_max_ioctl; extern int i810_max_ioctl;
#define I810_BASE(reg) ((unsigned long) \ #define I810_BASE(reg) ((unsigned long) \
......
This diff is collapsed.
...@@ -122,24 +122,25 @@ typedef struct drm_i830_private { ...@@ -122,24 +122,25 @@ typedef struct drm_i830_private {
} drm_i830_private_t; } drm_i830_private_t;
extern drm_ioctl_desc_t i830_ioctls[]; extern struct drm_ioctl_desc i830_ioctls[];
extern int i830_max_ioctl; extern int i830_max_ioctl;
/* i830_irq.c */ /* i830_irq.c */
extern int i830_irq_emit(struct inode *inode, struct file *filp, extern int i830_irq_emit(struct drm_device *dev, void *data,
unsigned int cmd, unsigned long arg); struct drm_file *file_priv);
extern int i830_irq_wait(struct inode *inode, struct file *filp, extern int i830_irq_wait(struct drm_device *dev, void *data,
unsigned int cmd, unsigned long arg); struct drm_file *file_priv);
extern irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS); extern irqreturn_t i830_driver_irq_handler(DRM_IRQ_ARGS);
extern void i830_driver_irq_preinstall(struct drm_device * dev); extern void i830_driver_irq_preinstall(struct drm_device * dev);
extern void i830_driver_irq_postinstall(struct drm_device * dev); extern void i830_driver_irq_postinstall(struct drm_device * dev);
extern void i830_driver_irq_uninstall(struct drm_device * dev); extern void i830_driver_irq_uninstall(struct drm_device * dev);
extern int i830_driver_load(struct drm_device *, unsigned long flags); extern int i830_driver_load(struct drm_device *, unsigned long flags);
extern void i830_driver_preclose(struct drm_device * dev, DRMFILE filp); extern void i830_driver_preclose(struct drm_device * dev,
struct drm_file *file_priv);
extern void i830_driver_lastclose(struct drm_device * dev); extern void i830_driver_lastclose(struct drm_device * dev);
extern void i830_driver_reclaim_buffers_locked(struct drm_device * dev, extern void i830_driver_reclaim_buffers_locked(struct drm_device * dev,
struct file *filp); struct drm_file *file_priv);
extern int i830_driver_dma_quiescent(struct drm_device * dev); extern int i830_driver_dma_quiescent(struct drm_device * dev);
extern int i830_driver_device_is_agp(struct drm_device * dev); extern int i830_driver_device_is_agp(struct drm_device * dev);
......
...@@ -114,29 +114,23 @@ static int i830_wait_irq(struct drm_device * dev, int irq_nr) ...@@ -114,29 +114,23 @@ static int i830_wait_irq(struct drm_device * dev, int irq_nr)
/* Needs the lock as it touches the ring. /* Needs the lock as it touches the ring.
*/ */
int i830_irq_emit(struct inode *inode, struct file *filp, unsigned int cmd, int i830_irq_emit(struct drm_device *dev, void *data,
unsigned long arg) struct drm_file *file_priv)
{ {
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
drm_i830_private_t *dev_priv = dev->dev_private; drm_i830_private_t *dev_priv = dev->dev_private;
drm_i830_irq_emit_t emit; drm_i830_irq_emit_t *emit = data;
int result; int result;
LOCK_TEST_WITH_RETURN(dev, filp); LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return -EINVAL; return -EINVAL;
} }
if (copy_from_user
(&emit, (drm_i830_irq_emit_t __user *) arg, sizeof(emit)))
return -EFAULT;
result = i830_emit_irq(dev); result = i830_emit_irq(dev);
if (copy_to_user(emit.irq_seq, &result, sizeof(int))) { if (copy_to_user(emit->irq_seq, &result, sizeof(int))) {
DRM_ERROR("copy_to_user\n"); DRM_ERROR("copy_to_user\n");
return -EFAULT; return -EFAULT;
} }
...@@ -146,24 +140,18 @@ int i830_irq_emit(struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -146,24 +140,18 @@ int i830_irq_emit(struct inode *inode, struct file *filp, unsigned int cmd,
/* Doesn't need the hardware lock. /* Doesn't need the hardware lock.
*/ */
int i830_irq_wait(struct inode *inode, struct file *filp, unsigned int cmd, int i830_irq_wait(struct drm_device *dev, void *data,
unsigned long arg) struct drm_file *file_priv)
{ {
struct drm_file *priv = filp->private_data;
struct drm_device *dev = priv->head->dev;
drm_i830_private_t *dev_priv = dev->dev_private; drm_i830_private_t *dev_priv = dev->dev_private;
drm_i830_irq_wait_t irqwait; drm_i830_irq_wait_t *irqwait = data;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return -EINVAL; return -EINVAL;
} }
if (copy_from_user(&irqwait, (drm_i830_irq_wait_t __user *) arg, return i830_wait_irq(dev, irqwait->irq_seq);
sizeof(irqwait)))
return -EFAULT;
return i830_wait_irq(dev, irqwait.irq_seq);
} }
/* drm_dma.h hooks /* drm_dma.h hooks
......
This diff is collapsed.
...@@ -70,7 +70,7 @@ struct mem_block { ...@@ -70,7 +70,7 @@ struct mem_block {
struct mem_block *prev; struct mem_block *prev;
int start; int start;
int size; int size;
DRMFILE filp; /* 0: free, -1: heap, other: real files */ struct drm_file *file_priv; /* NULL: free, -1: heap, other: real files */
}; };
typedef struct _drm_i915_vbl_swap { typedef struct _drm_i915_vbl_swap {
...@@ -116,21 +116,24 @@ typedef struct drm_i915_private { ...@@ -116,21 +116,24 @@ typedef struct drm_i915_private {
unsigned int swaps_pending; unsigned int swaps_pending;
} drm_i915_private_t; } drm_i915_private_t;
extern drm_ioctl_desc_t i915_ioctls[]; extern struct drm_ioctl_desc i915_ioctls[];
extern int i915_max_ioctl; extern int i915_max_ioctl;
/* i915_dma.c */ /* i915_dma.c */
extern void i915_kernel_lost_context(struct drm_device * dev); extern void i915_kernel_lost_context(struct drm_device * dev);
extern int i915_driver_load(struct drm_device *, unsigned long flags); extern int i915_driver_load(struct drm_device *, unsigned long flags);
extern void i915_driver_lastclose(struct drm_device * dev); extern void i915_driver_lastclose(struct drm_device * dev);
extern void i915_driver_preclose(struct drm_device * dev, DRMFILE filp); extern void i915_driver_preclose(struct drm_device *dev,
struct drm_file *file_priv);
extern int i915_driver_device_is_agp(struct drm_device * dev); extern int i915_driver_device_is_agp(struct drm_device * dev);
extern long i915_compat_ioctl(struct file *filp, unsigned int cmd, extern long i915_compat_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg); unsigned long arg);
/* i915_irq.c */ /* i915_irq.c */
extern int i915_irq_emit(DRM_IOCTL_ARGS); extern int i915_irq_emit(struct drm_device *dev, void *data,
extern int i915_irq_wait(DRM_IOCTL_ARGS); struct drm_file *file_priv);
extern int i915_irq_wait(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int i915_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence); extern int i915_driver_vblank_wait(struct drm_device *dev, unsigned int *sequence);
extern int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence); extern int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence);
...@@ -138,18 +141,25 @@ extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS); ...@@ -138,18 +141,25 @@ extern irqreturn_t i915_driver_irq_handler(DRM_IRQ_ARGS);
extern void i915_driver_irq_preinstall(struct drm_device * dev); extern void i915_driver_irq_preinstall(struct drm_device * dev);
extern void i915_driver_irq_postinstall(struct drm_device * dev); extern void i915_driver_irq_postinstall(struct drm_device * dev);
extern void i915_driver_irq_uninstall(struct drm_device * dev); extern void i915_driver_irq_uninstall(struct drm_device * dev);
extern int i915_vblank_pipe_set(DRM_IOCTL_ARGS); extern int i915_vblank_pipe_set(struct drm_device *dev, void *data,
extern int i915_vblank_pipe_get(DRM_IOCTL_ARGS); struct drm_file *file_priv);
extern int i915_vblank_swap(DRM_IOCTL_ARGS); extern int i915_vblank_pipe_get(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int i915_vblank_swap(struct drm_device *dev, void *data,
struct drm_file *file_priv);
/* i915_mem.c */ /* i915_mem.c */
extern int i915_mem_alloc(DRM_IOCTL_ARGS); extern int i915_mem_alloc(struct drm_device *dev, void *data,
extern int i915_mem_free(DRM_IOCTL_ARGS); struct drm_file *file_priv);
extern int i915_mem_init_heap(DRM_IOCTL_ARGS); extern int i915_mem_free(struct drm_device *dev, void *data,
extern int i915_mem_destroy_heap(DRM_IOCTL_ARGS); struct drm_file *file_priv);
extern int i915_mem_init_heap(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int i915_mem_destroy_heap(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern void i915_mem_takedown(struct mem_block **heap); extern void i915_mem_takedown(struct mem_block **heap);
extern void i915_mem_release(struct drm_device * dev, extern void i915_mem_release(struct drm_device * dev,
DRMFILE filp, struct mem_block *heap); struct drm_file *file_priv, struct mem_block *heap);
#define I915_READ(reg) DRM_READ32(dev_priv->mmio_map, (reg)) #define I915_READ(reg) DRM_READ32(dev_priv->mmio_map, (reg))
#define I915_WRITE(reg,val) DRM_WRITE32(dev_priv->mmio_map, (reg), (val)) #define I915_WRITE(reg,val) DRM_WRITE32(dev_priv->mmio_map, (reg), (val))
......
...@@ -311,7 +311,7 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr) ...@@ -311,7 +311,7 @@ static int i915_wait_irq(struct drm_device * dev, int irq_nr)
DRM_WAIT_ON(ret, dev_priv->irq_queue, 3 * DRM_HZ, DRM_WAIT_ON(ret, dev_priv->irq_queue, 3 * DRM_HZ,
READ_BREADCRUMB(dev_priv) >= irq_nr); READ_BREADCRUMB(dev_priv) >= irq_nr);
if (ret == DRM_ERR(EBUSY)) { if (ret == -EBUSY) {
DRM_ERROR("%s: EBUSY -- rec: %d emitted: %d\n", DRM_ERROR("%s: EBUSY -- rec: %d emitted: %d\n",
__FUNCTION__, __FUNCTION__,
READ_BREADCRUMB(dev_priv), (int)dev_priv->counter); READ_BREADCRUMB(dev_priv), (int)dev_priv->counter);
...@@ -330,7 +330,7 @@ static int i915_driver_vblank_do_wait(struct drm_device *dev, unsigned int *sequ ...@@ -330,7 +330,7 @@ static int i915_driver_vblank_do_wait(struct drm_device *dev, unsigned int *sequ
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ, DRM_WAIT_ON(ret, dev->vbl_queue, 3 * DRM_HZ,
...@@ -355,28 +355,25 @@ int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence) ...@@ -355,28 +355,25 @@ int i915_driver_vblank_wait2(struct drm_device *dev, unsigned int *sequence)
/* Needs the lock as it touches the ring. /* Needs the lock as it touches the ring.
*/ */
int i915_irq_emit(DRM_IOCTL_ARGS) int i915_irq_emit(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{ {
DRM_DEVICE;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
drm_i915_irq_emit_t emit; drm_i915_irq_emit_t *emit = data;
int result; int result;
LOCK_TEST_WITH_RETURN(dev, filp); LOCK_TEST_WITH_RETURN(dev, file_priv);
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(emit, (drm_i915_irq_emit_t __user *) data,
sizeof(emit));
result = i915_emit_irq(dev); result = i915_emit_irq(dev);
if (DRM_COPY_TO_USER(emit.irq_seq, &result, sizeof(int))) { if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) {
DRM_ERROR("copy_to_user\n"); DRM_ERROR("copy_to_user\n");
return DRM_ERR(EFAULT); return -EFAULT;
} }
return 0; return 0;
...@@ -384,21 +381,18 @@ int i915_irq_emit(DRM_IOCTL_ARGS) ...@@ -384,21 +381,18 @@ int i915_irq_emit(DRM_IOCTL_ARGS)
/* Doesn't need the hardware lock. /* Doesn't need the hardware lock.
*/ */
int i915_irq_wait(DRM_IOCTL_ARGS) int i915_irq_wait(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{ {
DRM_DEVICE;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
drm_i915_irq_wait_t irqwait; drm_i915_irq_wait_t *irqwait = data;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(irqwait, (drm_i915_irq_wait_t __user *) data, return i915_wait_irq(dev, irqwait->irq_seq);
sizeof(irqwait));
return i915_wait_irq(dev, irqwait.irq_seq);
} }
static void i915_enable_interrupt (struct drm_device *dev) static void i915_enable_interrupt (struct drm_device *dev)
...@@ -417,64 +411,60 @@ static void i915_enable_interrupt (struct drm_device *dev) ...@@ -417,64 +411,60 @@ static void i915_enable_interrupt (struct drm_device *dev)
/* Set the vblank monitor pipe /* Set the vblank monitor pipe
*/ */
int i915_vblank_pipe_set(DRM_IOCTL_ARGS) int i915_vblank_pipe_set(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{ {
DRM_DEVICE;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
drm_i915_vblank_pipe_t pipe; drm_i915_vblank_pipe_t *pipe = data;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(pipe, (drm_i915_vblank_pipe_t __user *) data, if (pipe->pipe & ~(DRM_I915_VBLANK_PIPE_A|DRM_I915_VBLANK_PIPE_B)) {
sizeof(pipe));
if (pipe.pipe & ~(DRM_I915_VBLANK_PIPE_A|DRM_I915_VBLANK_PIPE_B)) {
DRM_ERROR("%s called with invalid pipe 0x%x\n", DRM_ERROR("%s called with invalid pipe 0x%x\n",
__FUNCTION__, pipe.pipe); __FUNCTION__, pipe->pipe);
return DRM_ERR(EINVAL); return -EINVAL;
} }
dev_priv->vblank_pipe = pipe.pipe; dev_priv->vblank_pipe = pipe->pipe;
i915_enable_interrupt (dev); i915_enable_interrupt (dev);
return 0; return 0;
} }
int i915_vblank_pipe_get(DRM_IOCTL_ARGS) int i915_vblank_pipe_get(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{ {
DRM_DEVICE;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
drm_i915_vblank_pipe_t pipe; drm_i915_vblank_pipe_t *pipe = data;
u16 flag; u16 flag;
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __FUNCTION__); DRM_ERROR("%s called with no initialization\n", __FUNCTION__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
flag = I915_READ(I915REG_INT_ENABLE_R); flag = I915_READ(I915REG_INT_ENABLE_R);
pipe.pipe = 0; pipe->pipe = 0;
if (flag & VSYNC_PIPEA_FLAG) if (flag & VSYNC_PIPEA_FLAG)
pipe.pipe |= DRM_I915_VBLANK_PIPE_A; pipe->pipe |= DRM_I915_VBLANK_PIPE_A;
if (flag & VSYNC_PIPEB_FLAG) if (flag & VSYNC_PIPEB_FLAG)
pipe.pipe |= DRM_I915_VBLANK_PIPE_B; pipe->pipe |= DRM_I915_VBLANK_PIPE_B;
DRM_COPY_TO_USER_IOCTL((drm_i915_vblank_pipe_t __user *) data, pipe,
sizeof(pipe));
return 0; return 0;
} }
/** /**
* Schedule buffer swap at given vertical blank. * Schedule buffer swap at given vertical blank.
*/ */
int i915_vblank_swap(DRM_IOCTL_ARGS) int i915_vblank_swap(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{ {
DRM_DEVICE;
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
drm_i915_vblank_swap_t swap; drm_i915_vblank_swap_t *swap = data;
drm_i915_vbl_swap_t *vbl_swap; drm_i915_vbl_swap_t *vbl_swap;
unsigned int pipe, seqtype, curseq; unsigned int pipe, seqtype, curseq;
unsigned long irqflags; unsigned long irqflags;
...@@ -482,38 +472,35 @@ int i915_vblank_swap(DRM_IOCTL_ARGS) ...@@ -482,38 +472,35 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
if (!dev_priv) { if (!dev_priv) {
DRM_ERROR("%s called with no initialization\n", __func__); DRM_ERROR("%s called with no initialization\n", __func__);
return DRM_ERR(EINVAL); return -EINVAL;
} }
if (dev_priv->sarea_priv->rotation) { if (dev_priv->sarea_priv->rotation) {
DRM_DEBUG("Rotation not supported\n"); DRM_DEBUG("Rotation not supported\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
DRM_COPY_FROM_USER_IOCTL(swap, (drm_i915_vblank_swap_t __user *) data, if (swap->seqtype & ~(_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE |
sizeof(swap));
if (swap.seqtype & ~(_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE |
_DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)) { _DRM_VBLANK_SECONDARY | _DRM_VBLANK_NEXTONMISS)) {
DRM_ERROR("Invalid sequence type 0x%x\n", swap.seqtype); DRM_ERROR("Invalid sequence type 0x%x\n", swap->seqtype);
return DRM_ERR(EINVAL); return -EINVAL;
} }
pipe = (swap.seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0; pipe = (swap->seqtype & _DRM_VBLANK_SECONDARY) ? 1 : 0;
seqtype = swap.seqtype & (_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE); seqtype = swap->seqtype & (_DRM_VBLANK_RELATIVE | _DRM_VBLANK_ABSOLUTE);
if (!(dev_priv->vblank_pipe & (1 << pipe))) { if (!(dev_priv->vblank_pipe & (1 << pipe))) {
DRM_ERROR("Invalid pipe %d\n", pipe); DRM_ERROR("Invalid pipe %d\n", pipe);
return DRM_ERR(EINVAL); return -EINVAL;
} }
spin_lock_irqsave(&dev->drw_lock, irqflags); spin_lock_irqsave(&dev->drw_lock, irqflags);
if (!drm_get_drawable_info(dev, swap.drawable)) { if (!drm_get_drawable_info(dev, swap->drawable)) {
spin_unlock_irqrestore(&dev->drw_lock, irqflags); spin_unlock_irqrestore(&dev->drw_lock, irqflags);
DRM_DEBUG("Invalid drawable ID %d\n", swap.drawable); DRM_DEBUG("Invalid drawable ID %d\n", swap->drawable);
return DRM_ERR(EINVAL); return -EINVAL;
} }
spin_unlock_irqrestore(&dev->drw_lock, irqflags); spin_unlock_irqrestore(&dev->drw_lock, irqflags);
...@@ -521,14 +508,14 @@ int i915_vblank_swap(DRM_IOCTL_ARGS) ...@@ -521,14 +508,14 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
curseq = atomic_read(pipe ? &dev->vbl_received2 : &dev->vbl_received); curseq = atomic_read(pipe ? &dev->vbl_received2 : &dev->vbl_received);
if (seqtype == _DRM_VBLANK_RELATIVE) if (seqtype == _DRM_VBLANK_RELATIVE)
swap.sequence += curseq; swap->sequence += curseq;
if ((curseq - swap.sequence) <= (1<<23)) { if ((curseq - swap->sequence) <= (1<<23)) {
if (swap.seqtype & _DRM_VBLANK_NEXTONMISS) { if (swap->seqtype & _DRM_VBLANK_NEXTONMISS) {
swap.sequence = curseq + 1; swap->sequence = curseq + 1;
} else { } else {
DRM_DEBUG("Missed target sequence\n"); DRM_DEBUG("Missed target sequence\n");
return DRM_ERR(EINVAL); return -EINVAL;
} }
} }
...@@ -537,9 +524,9 @@ int i915_vblank_swap(DRM_IOCTL_ARGS) ...@@ -537,9 +524,9 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
list_for_each(list, &dev_priv->vbl_swaps.head) { list_for_each(list, &dev_priv->vbl_swaps.head) {
vbl_swap = list_entry(list, drm_i915_vbl_swap_t, head); vbl_swap = list_entry(list, drm_i915_vbl_swap_t, head);
if (vbl_swap->drw_id == swap.drawable && if (vbl_swap->drw_id == swap->drawable &&
vbl_swap->pipe == pipe && vbl_swap->pipe == pipe &&
vbl_swap->sequence == swap.sequence) { vbl_swap->sequence == swap->sequence) {
spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags); spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags);
DRM_DEBUG("Already scheduled\n"); DRM_DEBUG("Already scheduled\n");
return 0; return 0;
...@@ -550,21 +537,21 @@ int i915_vblank_swap(DRM_IOCTL_ARGS) ...@@ -550,21 +537,21 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
if (dev_priv->swaps_pending >= 100) { if (dev_priv->swaps_pending >= 100) {
DRM_DEBUG("Too many swaps queued\n"); DRM_DEBUG("Too many swaps queued\n");
return DRM_ERR(EBUSY); return -EBUSY;
} }
vbl_swap = drm_calloc(1, sizeof(vbl_swap), DRM_MEM_DRIVER); vbl_swap = drm_calloc(1, sizeof(*vbl_swap), DRM_MEM_DRIVER);
if (!vbl_swap) { if (!vbl_swap) {
DRM_ERROR("Failed to allocate memory to queue swap\n"); DRM_ERROR("Failed to allocate memory to queue swap\n");
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
DRM_DEBUG("\n"); DRM_DEBUG("\n");
vbl_swap->drw_id = swap.drawable; vbl_swap->drw_id = swap->drawable;
vbl_swap->pipe = pipe; vbl_swap->pipe = pipe;
vbl_swap->sequence = swap.sequence; vbl_swap->sequence = swap->sequence;
spin_lock_irqsave(&dev_priv->swaps_lock, irqflags); spin_lock_irqsave(&dev_priv->swaps_lock, irqflags);
...@@ -573,9 +560,6 @@ int i915_vblank_swap(DRM_IOCTL_ARGS) ...@@ -573,9 +560,6 @@ int i915_vblank_swap(DRM_IOCTL_ARGS)
spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags); spin_unlock_irqrestore(&dev_priv->swaps_lock, irqflags);
DRM_COPY_TO_USER_IOCTL((drm_i915_vblank_swap_t __user *) data, swap,
sizeof(swap));
return 0; return 0;
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -148,15 +148,20 @@ typedef struct drm_mga_private { ...@@ -148,15 +148,20 @@ typedef struct drm_mga_private {
unsigned int agp_size; unsigned int agp_size;
} drm_mga_private_t; } drm_mga_private_t;
extern drm_ioctl_desc_t mga_ioctls[]; extern struct drm_ioctl_desc mga_ioctls[];
extern int mga_max_ioctl; extern int mga_max_ioctl;
/* mga_dma.c */ /* mga_dma.c */
extern int mga_dma_bootstrap(DRM_IOCTL_ARGS); extern int mga_dma_bootstrap(struct drm_device *dev, void *data,
extern int mga_dma_init(DRM_IOCTL_ARGS); struct drm_file *file_priv);
extern int mga_dma_flush(DRM_IOCTL_ARGS); extern int mga_dma_init(struct drm_device *dev, void *data,
extern int mga_dma_reset(DRM_IOCTL_ARGS); struct drm_file *file_priv);
extern int mga_dma_buffers(DRM_IOCTL_ARGS); extern int mga_dma_flush(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int mga_dma_reset(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int mga_dma_buffers(struct drm_device *dev, void *data,
struct drm_file *file_priv);
extern int mga_driver_load(struct drm_device *dev, unsigned long flags); extern int mga_driver_load(struct drm_device *dev, unsigned long flags);
extern int mga_driver_unload(struct drm_device * dev); extern int mga_driver_unload(struct drm_device * dev);
extern void mga_driver_lastclose(struct drm_device * dev); extern void mga_driver_lastclose(struct drm_device * dev);
...@@ -245,7 +250,7 @@ do { \ ...@@ -245,7 +250,7 @@ do { \
dev_priv->prim.high_mark ) { \ dev_priv->prim.high_mark ) { \
if ( MGA_DMA_DEBUG ) \ if ( MGA_DMA_DEBUG ) \
DRM_INFO( "%s: wrap...\n", __FUNCTION__ ); \ DRM_INFO( "%s: wrap...\n", __FUNCTION__ ); \
return DRM_ERR(EBUSY); \ return -EBUSY; \
} \ } \
} \ } \
} while (0) } while (0)
...@@ -256,7 +261,7 @@ do { \ ...@@ -256,7 +261,7 @@ do { \
if ( mga_do_wait_for_idle( dev_priv ) < 0 ) { \ if ( mga_do_wait_for_idle( dev_priv ) < 0 ) { \
if ( MGA_DMA_DEBUG ) \ if ( MGA_DMA_DEBUG ) \
DRM_INFO( "%s: wrap...\n", __FUNCTION__ ); \ DRM_INFO( "%s: wrap...\n", __FUNCTION__ ); \
return DRM_ERR(EBUSY); \ return -EBUSY; \
} \ } \
mga_do_dma_wrap_end( dev_priv ); \ mga_do_dma_wrap_end( dev_priv ); \
} \ } \
......
This diff is collapsed.
...@@ -141,7 +141,7 @@ int mga_warp_install_microcode(drm_mga_private_t * dev_priv) ...@@ -141,7 +141,7 @@ int mga_warp_install_microcode(drm_mga_private_t * dev_priv)
if (size > dev_priv->warp->size) { if (size > dev_priv->warp->size) {
DRM_ERROR("microcode too large! (%u > %lu)\n", DRM_ERROR("microcode too large! (%u > %lu)\n",
size, dev_priv->warp->size); size, dev_priv->warp->size);
return DRM_ERR(ENOMEM); return -ENOMEM;
} }
switch (dev_priv->chipset) { switch (dev_priv->chipset) {
...@@ -151,7 +151,7 @@ int mga_warp_install_microcode(drm_mga_private_t * dev_priv) ...@@ -151,7 +151,7 @@ int mga_warp_install_microcode(drm_mga_private_t * dev_priv)
case MGA_CARD_TYPE_G200: case MGA_CARD_TYPE_G200:
return mga_warp_install_g200_microcode(dev_priv); return mga_warp_install_g200_microcode(dev_priv);
default: default:
return DRM_ERR(EINVAL); return -EINVAL;
} }
} }
...@@ -177,7 +177,7 @@ int mga_warp_init(drm_mga_private_t * dev_priv) ...@@ -177,7 +177,7 @@ int mga_warp_init(drm_mga_private_t * dev_priv)
MGA_WRITE(MGA_WVRTXSZ, 7); MGA_WRITE(MGA_WVRTXSZ, 7);
break; break;
default: default:
return DRM_ERR(EINVAL); return -EINVAL;
} }
MGA_WRITE(MGA_WMISC, (MGA_WUCODECACHE_ENABLE | MGA_WRITE(MGA_WMISC, (MGA_WUCODECACHE_ENABLE |
...@@ -186,7 +186,7 @@ int mga_warp_init(drm_mga_private_t * dev_priv) ...@@ -186,7 +186,7 @@ int mga_warp_init(drm_mga_private_t * dev_priv)
if (wmisc != WMISC_EXPECTED) { if (wmisc != WMISC_EXPECTED) {
DRM_ERROR("WARP engine config failed! 0x%x != 0x%x\n", DRM_ERROR("WARP engine config failed! 0x%x != 0x%x\n",
wmisc, WMISC_EXPECTED); wmisc, WMISC_EXPECTED);
return DRM_ERR(EINVAL); return -EINVAL;
} }
return 0; return 0;
......
This diff is collapsed.
...@@ -222,11 +222,7 @@ typedef struct drm_r128_init { ...@@ -222,11 +222,7 @@ typedef struct drm_r128_init {
R128_INIT_CCE = 0x01, R128_INIT_CCE = 0x01,
R128_CLEANUP_CCE = 0x02 R128_CLEANUP_CCE = 0x02
} func; } func;
#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0)
int sarea_priv_offset;
#else
unsigned long sarea_priv_offset; unsigned long sarea_priv_offset;
#endif
int is_pci; int is_pci;
int cce_mode; int cce_mode;
int cce_secure; int cce_secure;
...@@ -240,21 +236,12 @@ typedef struct drm_r128_init { ...@@ -240,21 +236,12 @@ typedef struct drm_r128_init {
unsigned int depth_offset, depth_pitch; unsigned int depth_offset, depth_pitch;
unsigned int span_offset; unsigned int span_offset;
#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0)
unsigned int fb_offset;
unsigned int mmio_offset;
unsigned int ring_offset;
unsigned int ring_rptr_offset;
unsigned int buffers_offset;
unsigned int agp_textures_offset;
#else
unsigned long fb_offset; unsigned long fb_offset;
unsigned long mmio_offset; unsigned long mmio_offset;
unsigned long ring_offset; unsigned long ring_offset;
unsigned long ring_rptr_offset; unsigned long ring_rptr_offset;
unsigned long buffers_offset; unsigned long buffers_offset;
unsigned long agp_textures_offset; unsigned long agp_textures_offset;
#endif
} drm_r128_init_t; } drm_r128_init_t;
typedef struct drm_r128_cce_stop { typedef struct drm_r128_cce_stop {
...@@ -264,15 +251,10 @@ typedef struct drm_r128_cce_stop { ...@@ -264,15 +251,10 @@ typedef struct drm_r128_cce_stop {
typedef struct drm_r128_clear { typedef struct drm_r128_clear {
unsigned int flags; unsigned int flags;
#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0)
int x, y, w, h;
#endif
unsigned int clear_color; unsigned int clear_color;
unsigned int clear_depth; unsigned int clear_depth;
#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0)
unsigned int color_mask; unsigned int color_mask;
unsigned int depth_mask; unsigned int depth_mask;
#endif
} drm_r128_clear_t; } drm_r128_clear_t;
typedef struct drm_r128_vertex { typedef struct drm_r128_vertex {
......
...@@ -129,18 +129,18 @@ typedef struct drm_r128_buf_priv { ...@@ -129,18 +129,18 @@ typedef struct drm_r128_buf_priv {
drm_r128_freelist_t *list_entry; drm_r128_freelist_t *list_entry;
} drm_r128_buf_priv_t; } drm_r128_buf_priv_t;
extern drm_ioctl_desc_t r128_ioctls[]; extern struct drm_ioctl_desc r128_ioctls[];
extern int r128_max_ioctl; extern int r128_max_ioctl;
/* r128_cce.c */ /* r128_cce.c */
extern int r128_cce_init(DRM_IOCTL_ARGS); extern int r128_cce_init(struct drm_device *dev, void *data, struct drm_file *file_priv);
extern int r128_cce_start(DRM_IOCTL_ARGS); extern int r128_cce_start(struct drm_device *dev, void *data, struct drm_file *file_priv);
extern int r128_cce_stop(DRM_IOCTL_ARGS); extern int r128_cce_stop(struct drm_device *dev, void *data, struct drm_file *file_priv);
extern int r128_cce_reset(DRM_IOCTL_ARGS); extern int r128_cce_reset(struct drm_device *dev, void *data, struct drm_file *file_priv);
extern int r128_cce_idle(DRM_IOCTL_ARGS); extern int r128_cce_idle(struct drm_device *dev, void *data, struct drm_file *file_priv);
extern int r128_engine_reset(DRM_IOCTL_ARGS); extern int r128_engine_reset(struct drm_device *dev, void *data, struct drm_file *file_priv);
extern int r128_fullscreen(DRM_IOCTL_ARGS); extern int r128_fullscreen(struct drm_device *dev, void *data, struct drm_file *file_priv);
extern int r128_cce_buffers(DRM_IOCTL_ARGS); extern int r128_cce_buffers(struct drm_device *dev, void *data, struct drm_file *file_priv);
extern void r128_freelist_reset(struct drm_device * dev); extern void r128_freelist_reset(struct drm_device * dev);
...@@ -156,7 +156,8 @@ extern void r128_driver_irq_preinstall(struct drm_device * dev); ...@@ -156,7 +156,8 @@ extern void r128_driver_irq_preinstall(struct drm_device * dev);
extern void r128_driver_irq_postinstall(struct drm_device * dev); extern void r128_driver_irq_postinstall(struct drm_device * dev);
extern void r128_driver_irq_uninstall(struct drm_device * dev); extern void r128_driver_irq_uninstall(struct drm_device * dev);
extern void r128_driver_lastclose(struct drm_device * dev); extern void r128_driver_lastclose(struct drm_device * dev);
extern void r128_driver_preclose(struct drm_device * dev, DRMFILE filp); extern void r128_driver_preclose(struct drm_device * dev,
struct drm_file *file_priv);
extern long r128_compat_ioctl(struct file *filp, unsigned int cmd, extern long r128_compat_ioctl(struct file *filp, unsigned int cmd,
unsigned long arg); unsigned long arg);
...@@ -428,7 +429,7 @@ do { \ ...@@ -428,7 +429,7 @@ do { \
DRM_UDELAY(1); \ DRM_UDELAY(1); \
} \ } \
DRM_ERROR( "ring space check failed!\n" ); \ DRM_ERROR( "ring space check failed!\n" ); \
return DRM_ERR(EBUSY); \ return -EBUSY; \
} \ } \
__ring_space_done: \ __ring_space_done: \
; \ ; \
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -42,7 +42,7 @@ static int sis_driver_load(struct drm_device *dev, unsigned long chipset) ...@@ -42,7 +42,7 @@ static int sis_driver_load(struct drm_device *dev, unsigned long chipset)
dev_priv = drm_calloc(1, sizeof(drm_sis_private_t), DRM_MEM_DRIVER); dev_priv = drm_calloc(1, sizeof(drm_sis_private_t), DRM_MEM_DRIVER);
if (dev_priv == NULL) if (dev_priv == NULL)
return DRM_ERR(ENOMEM); return -ENOMEM;
dev->dev_private = (void *)dev_priv; dev->dev_private = (void *)dev_priv;
dev_priv->chipset = chipset; dev_priv->chipset = chipset;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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