Skip to content

Commit

Permalink
Merge 'drm-3264' branch of rsync://rsync.kernel.org/pub/scm/linux/ker…
Browse files Browse the repository at this point in the history
…nel/git/airlied/drm-2.6
  • Loading branch information
Linus Torvalds committed Jun 26, 2005
2 parents bf82322 + 9a18664 commit 8678887
Show file tree
Hide file tree
Showing 8 changed files with 1,501 additions and 10 deletions.
5 changes: 5 additions & 0 deletions drivers/char/drm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ radeon-objs := radeon_drv.o radeon_cp.o radeon_state.o radeon_mem.o radeon_irq.o
ffb-objs := ffb_drv.o ffb_context.o
sis-objs := sis_drv.o sis_ds.o sis_mm.o

ifeq ($(CONFIG_COMPAT),y)
drm-objs += drm_ioc32.o
radeon-objs += radeon_ioc32.o
endif

obj-$(CONFIG_DRM) += drm.o
obj-$(CONFIG_DRM_GAMMA) += gamma.o
obj-$(CONFIG_DRM_TDFX) += tdfx.o
Expand Down
5 changes: 5 additions & 0 deletions drivers/char/drm/drmP.h
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,9 @@ do { \
typedef int drm_ioctl_t( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg );

typedef int drm_ioctl_compat_t(struct file *filp, unsigned int cmd,
unsigned long arg);

typedef struct drm_ioctl_desc {
drm_ioctl_t *func;
int auth_needed;
Expand Down Expand Up @@ -775,6 +778,8 @@ extern int drm_version(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern long drm_compat_ioctl(struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_takedown(drm_device_t * dev);

/* Device support (drm_fops.h) */
Expand Down
25 changes: 18 additions & 7 deletions drivers/char/drm/drm_bufs.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@ int drm_order( unsigned long size )
}
EXPORT_SYMBOL(drm_order);

#ifdef CONFIG_COMPAT
/*
* Used to allocate 32-bit handles for _DRM_SHM regions
* The 0x10000000 value is chosen to be out of the way of
* FB/register and GART physical addresses.
*/
static unsigned int map32_handle = 0x10000000;
#endif

/**
* Ioctl to specify a range of memory that is available for mapping by a non-root process.
*
Expand Down Expand Up @@ -187,16 +196,18 @@ int drm_addmap( struct inode *inode, struct file *filp,

down(&dev->struct_sem);
list_add(&list->head, &dev->maplist->head);
#ifdef CONFIG_COMPAT
/* Assign a 32-bit handle for _DRM_SHM mappings */
/* We do it here so that dev->struct_sem protects the increment */
if (map->type == _DRM_SHM)
map->offset = map32_handle += PAGE_SIZE;
#endif
up(&dev->struct_sem);

if ( copy_to_user( argp, map, sizeof(*map) ) )
return -EFAULT;
if ( map->type != _DRM_SHM ) {
if ( copy_to_user( &argp->handle,
&map->offset,
sizeof(map->offset) ) )
return -EFAULT;
}
if (copy_to_user(&argp->handle, &map->offset, sizeof(map->offset)))
return -EFAULT;
return 0;
}

Expand Down Expand Up @@ -240,7 +251,7 @@ int drm_rmmap(struct inode *inode, struct file *filp,
r_list = list_entry(list, drm_map_list_t, head);

if(r_list->map &&
r_list->map->handle == request.handle &&
r_list->map->offset == (unsigned long) request.handle &&
r_list->map->flags & _DRM_REMOVABLE) break;
}

Expand Down
6 changes: 3 additions & 3 deletions drivers/char/drm/drm_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ int drm_getsareactx(struct inode *inode, struct file *filp,
map = dev->context_sareas[request.ctx_id];
up(&dev->struct_sem);

request.handle = map->handle;
request.handle = (void *) map->offset;
if (copy_to_user(argp, &request, sizeof(request)))
return -EFAULT;
return 0;
Expand Down Expand Up @@ -261,8 +261,8 @@ int drm_setsareactx(struct inode *inode, struct file *filp,
down(&dev->struct_sem);
list_for_each(list, &dev->maplist->head) {
r_list = list_entry(list, drm_map_list_t, head);
if(r_list->map &&
r_list->map->handle == request.handle)
if (r_list->map
&& r_list->map->offset == (unsigned long) request.handle)
goto found;
}
bad:
Expand Down
Loading

0 comments on commit 8678887

Please sign in to comment.