Commit f42ecb28 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'drm-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (35 commits)
  drm/radeon/kms: add definitions for v4 power tables
  drm/radeon/kms: never combine LVDS with another encoder
  drm/radeon/kms: Check module arguments to be valid V2
  drm/radeon/kms: Avoid crash when trying to cleanup uninitialized structure
  drm/radeon/kms: add cvt mode if we only have lvds w/h and no edid (v4)
  drm/radeon/kms: add 3DC compression support
  drm/radeon/kms: allow rendering while no colorbuffer is set on r300
  drm/radeon/kms: enable memory clock reading on legacy (V2)
  drm/radeon/kms: prevent parallel AtomBIOS calls
  drm/radeon/kms: set proper default tv standard
  drm/radeon/kms: fix legacy rmx
  drm/radeon/kms/atom: fill in proper defines for digital setup
  drm/kms: silencing a false positive warning.
  drm/mm: fix logic for selection of best fit block
  drm/vmwgfx: Use TTM handles instead of SIDs as user-space surface handles.
  drm/vmwgfx: Return -ERESTARTSYS when interrupted by a signal.
  drm/vmwgfx: Fix unlocked ioctl and add proper access control
  drm/radeon: fix build on 64-bit with some compilers.
  drivers/gpu: Use kzalloc for allocating only one thing
  DRM: Rename clamp variable
  ...
parents 119eecc8 d94a5108
Loading
Loading
Loading
Loading
+10 −3
Original line number Original line Diff line number Diff line
@@ -434,11 +434,11 @@ static int drm_version(struct drm_device *dev, void *data,
 * Looks up the ioctl function in the ::ioctls table, checking for root
 * Looks up the ioctl function in the ::ioctls table, checking for root
 * previleges if so required, and dispatches to the respective function.
 * previleges if so required, and dispatches to the respective function.
 */
 */
int drm_ioctl(struct inode *inode, struct file *filp,
long drm_ioctl(struct file *filp,
	      unsigned int cmd, unsigned long arg)
	      unsigned int cmd, unsigned long arg)
{
{
	struct drm_file *file_priv = filp->private_data;
	struct drm_file *file_priv = filp->private_data;
	struct drm_device *dev = file_priv->minor->dev;
	struct drm_device *dev;
	struct drm_ioctl_desc *ioctl;
	struct drm_ioctl_desc *ioctl;
	drm_ioctl_t *func;
	drm_ioctl_t *func;
	unsigned int nr = DRM_IOCTL_NR(cmd);
	unsigned int nr = DRM_IOCTL_NR(cmd);
@@ -446,6 +446,7 @@ int drm_ioctl(struct inode *inode, struct file *filp,
	char stack_kdata[128];
	char stack_kdata[128];
	char *kdata = NULL;
	char *kdata = NULL;


	dev = file_priv->minor->dev;
	atomic_inc(&dev->ioctl_count);
	atomic_inc(&dev->ioctl_count);
	atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]);
	atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]);
	++file_priv->ioctl_count;
	++file_priv->ioctl_count;
@@ -501,7 +502,13 @@ int drm_ioctl(struct inode *inode, struct file *filp,
				goto err_i1;
				goto err_i1;
			}
			}
		}
		}
		if (ioctl->flags & DRM_UNLOCKED)
			retcode = func(dev, kdata, file_priv);
			retcode = func(dev, kdata, file_priv);
		else {
			lock_kernel();
			retcode = func(dev, kdata, file_priv);
			unlock_kernel();
		}


		if (cmd & IOC_OUT) {
		if (cmd & IOC_OUT) {
			if (copy_to_user((void __user *)arg, kdata,
			if (copy_to_user((void __user *)arg, kdata,
+1 −1
Original line number Original line Diff line number Diff line
@@ -913,7 +913,7 @@ static int drm_cvt_modes(struct drm_connector *connector,
	const int rates[] = { 60, 85, 75, 60, 50 };
	const int rates[] = { 60, 85, 75, 60, 50 };


	for (i = 0; i < 4; i++) {
	for (i = 0; i < 4; i++) {
		int width, height;
		int uninitialized_var(width), height;
		cvt = &(timing->data.other_data.data.cvt[i]);
		cvt = &(timing->data.other_data.data.cvt[i]);


		height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 8) + 1) * 2;
		height = (cvt->code[0] + ((cvt->code[1] & 0xf0) << 8) + 1) * 2;
+30 −59
Original line number Original line Diff line number Diff line
@@ -104,7 +104,7 @@ static int compat_drm_version(struct file *file, unsigned int cmd,
			  &version->desc))
			  &version->desc))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file,
			DRM_IOCTL_VERSION, (unsigned long)version);
			DRM_IOCTL_VERSION, (unsigned long)version);
	if (err)
	if (err)
		return err;
		return err;
@@ -145,8 +145,7 @@ static int compat_drm_getunique(struct file *file, unsigned int cmd,
			  &u->unique))
			  &u->unique))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_GET_UNIQUE, (unsigned long)u);
			DRM_IOCTL_GET_UNIQUE, (unsigned long)u);
	if (err)
	if (err)
		return err;
		return err;


@@ -174,8 +173,7 @@ static int compat_drm_setunique(struct file *file, unsigned int cmd,
			  &u->unique))
			  &u->unique))
		return -EFAULT;
		return -EFAULT;


	return drm_ioctl(file->f_path.dentry->d_inode, file,
	return drm_ioctl(file, DRM_IOCTL_SET_UNIQUE, (unsigned long)u);
			 DRM_IOCTL_SET_UNIQUE, (unsigned long)u);
}
}


typedef struct drm_map32 {
typedef struct drm_map32 {
@@ -205,8 +203,7 @@ static int compat_drm_getmap(struct file *file, unsigned int cmd,
	if (__put_user(idx, &map->offset))
	if (__put_user(idx, &map->offset))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_GET_MAP, (unsigned long)map);
			DRM_IOCTL_GET_MAP, (unsigned long)map);
	if (err)
	if (err)
		return err;
		return err;


@@ -246,8 +243,7 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd,
	    || __put_user(m32.flags, &map->flags))
	    || __put_user(m32.flags, &map->flags))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_ADD_MAP, (unsigned long)map);
			DRM_IOCTL_ADD_MAP, (unsigned long)map);
	if (err)
	if (err)
		return err;
		return err;


@@ -284,8 +280,7 @@ static int compat_drm_rmmap(struct file *file, unsigned int cmd,
	if (__put_user((void *)(unsigned long)handle, &map->handle))
	if (__put_user((void *)(unsigned long)handle, &map->handle))
		return -EFAULT;
		return -EFAULT;


	return drm_ioctl(file->f_path.dentry->d_inode, file,
	return drm_ioctl(file, DRM_IOCTL_RM_MAP, (unsigned long)map);
			 DRM_IOCTL_RM_MAP, (unsigned long)map);
}
}


typedef struct drm_client32 {
typedef struct drm_client32 {
@@ -314,8 +309,7 @@ static int compat_drm_getclient(struct file *file, unsigned int cmd,
	if (__put_user(idx, &client->idx))
	if (__put_user(idx, &client->idx))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_GET_CLIENT, (unsigned long)client);
			DRM_IOCTL_GET_CLIENT, (unsigned long)client);
	if (err)
	if (err)
		return err;
		return err;


@@ -351,8 +345,7 @@ static int compat_drm_getstats(struct file *file, unsigned int cmd,
	if (!access_ok(VERIFY_WRITE, stats, sizeof(*stats)))
	if (!access_ok(VERIFY_WRITE, stats, sizeof(*stats)))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_GET_STATS, (unsigned long)stats);
			DRM_IOCTL_GET_STATS, (unsigned long)stats);
	if (err)
	if (err)
		return err;
		return err;


@@ -395,8 +388,7 @@ static int compat_drm_addbufs(struct file *file, unsigned int cmd,
	    || __put_user(agp_start, &buf->agp_start))
	    || __put_user(agp_start, &buf->agp_start))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_ADD_BUFS, (unsigned long)buf);
			DRM_IOCTL_ADD_BUFS, (unsigned long)buf);
	if (err)
	if (err)
		return err;
		return err;


@@ -427,8 +419,7 @@ static int compat_drm_markbufs(struct file *file, unsigned int cmd,
	    || __put_user(b32.high_mark, &buf->high_mark))
	    || __put_user(b32.high_mark, &buf->high_mark))
		return -EFAULT;
		return -EFAULT;


	return drm_ioctl(file->f_path.dentry->d_inode, file,
	return drm_ioctl(file, DRM_IOCTL_MARK_BUFS, (unsigned long)buf);
			 DRM_IOCTL_MARK_BUFS, (unsigned long)buf);
}
}


typedef struct drm_buf_info32 {
typedef struct drm_buf_info32 {
@@ -469,8 +460,7 @@ static int compat_drm_infobufs(struct file *file, unsigned int cmd,
	    || __put_user(list, &request->list))
	    || __put_user(list, &request->list))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_INFO_BUFS, (unsigned long)request);
			DRM_IOCTL_INFO_BUFS, (unsigned long)request);
	if (err)
	if (err)
		return err;
		return err;


@@ -531,8 +521,7 @@ static int compat_drm_mapbufs(struct file *file, unsigned int cmd,
	    || __put_user(list, &request->list))
	    || __put_user(list, &request->list))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_MAP_BUFS, (unsigned long)request);
			DRM_IOCTL_MAP_BUFS, (unsigned long)request);
	if (err)
	if (err)
		return err;
		return err;


@@ -578,8 +567,7 @@ static int compat_drm_freebufs(struct file *file, unsigned int cmd,
			  &request->list))
			  &request->list))
		return -EFAULT;
		return -EFAULT;


	return drm_ioctl(file->f_path.dentry->d_inode, file,
	return drm_ioctl(file, DRM_IOCTL_FREE_BUFS, (unsigned long)request);
			 DRM_IOCTL_FREE_BUFS, (unsigned long)request);
}
}


typedef struct drm_ctx_priv_map32 {
typedef struct drm_ctx_priv_map32 {
@@ -605,8 +593,7 @@ static int compat_drm_setsareactx(struct file *file, unsigned int cmd,
			  &request->handle))
			  &request->handle))
		return -EFAULT;
		return -EFAULT;


	return drm_ioctl(file->f_path.dentry->d_inode, file,
	return drm_ioctl(file, DRM_IOCTL_SET_SAREA_CTX, (unsigned long)request);
			 DRM_IOCTL_SET_SAREA_CTX, (unsigned long)request);
}
}


static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
@@ -628,8 +615,7 @@ static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
	if (__put_user(ctx_id, &request->ctx_id))
	if (__put_user(ctx_id, &request->ctx_id))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_GET_SAREA_CTX, (unsigned long)request);
			DRM_IOCTL_GET_SAREA_CTX, (unsigned long)request);
	if (err)
	if (err)
		return err;
		return err;


@@ -664,8 +650,7 @@ static int compat_drm_resctx(struct file *file, unsigned int cmd,
			  &res->contexts))
			  &res->contexts))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_RES_CTX, (unsigned long)res);
			DRM_IOCTL_RES_CTX, (unsigned long)res);
	if (err)
	if (err)
		return err;
		return err;


@@ -718,8 +703,7 @@ static int compat_drm_dma(struct file *file, unsigned int cmd,
			  &d->request_sizes))
			  &d->request_sizes))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_DMA, (unsigned long)d);
			DRM_IOCTL_DMA, (unsigned long)d);
	if (err)
	if (err)
		return err;
		return err;


@@ -751,8 +735,7 @@ static int compat_drm_agp_enable(struct file *file, unsigned int cmd,
	if (put_user(m32.mode, &mode->mode))
	if (put_user(m32.mode, &mode->mode))
		return -EFAULT;
		return -EFAULT;


	return drm_ioctl(file->f_path.dentry->d_inode, file,
	return drm_ioctl(file, DRM_IOCTL_AGP_ENABLE, (unsigned long)mode);
			 DRM_IOCTL_AGP_ENABLE, (unsigned long)mode);
}
}


typedef struct drm_agp_info32 {
typedef struct drm_agp_info32 {
@@ -781,8 +764,7 @@ static int compat_drm_agp_info(struct file *file, unsigned int cmd,
	if (!access_ok(VERIFY_WRITE, info, sizeof(*info)))
	if (!access_ok(VERIFY_WRITE, info, sizeof(*info)))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_AGP_INFO, (unsigned long)info);
			DRM_IOCTL_AGP_INFO, (unsigned long)info);
	if (err)
	if (err)
		return err;
		return err;


@@ -827,16 +809,14 @@ static int compat_drm_agp_alloc(struct file *file, unsigned int cmd,
	    || __put_user(req32.type, &request->type))
	    || __put_user(req32.type, &request->type))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_AGP_ALLOC, (unsigned long)request);
			DRM_IOCTL_AGP_ALLOC, (unsigned long)request);
	if (err)
	if (err)
		return err;
		return err;


	if (__get_user(req32.handle, &request->handle)
	if (__get_user(req32.handle, &request->handle)
	    || __get_user(req32.physical, &request->physical)
	    || __get_user(req32.physical, &request->physical)
	    || copy_to_user(argp, &req32, sizeof(req32))) {
	    || copy_to_user(argp, &req32, sizeof(req32))) {
		drm_ioctl(file->f_path.dentry->d_inode, file,
		drm_ioctl(file, DRM_IOCTL_AGP_FREE, (unsigned long)request);
			  DRM_IOCTL_AGP_FREE, (unsigned long)request);
		return -EFAULT;
		return -EFAULT;
	}
	}


@@ -856,8 +836,7 @@ static int compat_drm_agp_free(struct file *file, unsigned int cmd,
	    || __put_user(handle, &request->handle))
	    || __put_user(handle, &request->handle))
		return -EFAULT;
		return -EFAULT;


	return drm_ioctl(file->f_path.dentry->d_inode, file,
	return drm_ioctl(file, DRM_IOCTL_AGP_FREE, (unsigned long)request);
			 DRM_IOCTL_AGP_FREE, (unsigned long)request);
}
}


typedef struct drm_agp_binding32 {
typedef struct drm_agp_binding32 {
@@ -881,8 +860,7 @@ static int compat_drm_agp_bind(struct file *file, unsigned int cmd,
	    || __put_user(req32.offset, &request->offset))
	    || __put_user(req32.offset, &request->offset))
		return -EFAULT;
		return -EFAULT;


	return drm_ioctl(file->f_path.dentry->d_inode, file,
	return drm_ioctl(file, DRM_IOCTL_AGP_BIND, (unsigned long)request);
			 DRM_IOCTL_AGP_BIND, (unsigned long)request);
}
}


static int compat_drm_agp_unbind(struct file *file, unsigned int cmd,
static int compat_drm_agp_unbind(struct file *file, unsigned int cmd,
@@ -898,8 +876,7 @@ static int compat_drm_agp_unbind(struct file *file, unsigned int cmd,
	    || __put_user(handle, &request->handle))
	    || __put_user(handle, &request->handle))
		return -EFAULT;
		return -EFAULT;


	return drm_ioctl(file->f_path.dentry->d_inode, file,
	return drm_ioctl(file, DRM_IOCTL_AGP_UNBIND, (unsigned long)request);
			 DRM_IOCTL_AGP_UNBIND, (unsigned long)request);
}
}
#endif				/* __OS_HAS_AGP */
#endif				/* __OS_HAS_AGP */


@@ -923,8 +900,7 @@ static int compat_drm_sg_alloc(struct file *file, unsigned int cmd,
	    || __put_user(x, &request->size))
	    || __put_user(x, &request->size))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_SG_ALLOC, (unsigned long)request);
			DRM_IOCTL_SG_ALLOC, (unsigned long)request);
	if (err)
	if (err)
		return err;
		return err;


@@ -950,8 +926,7 @@ static int compat_drm_sg_free(struct file *file, unsigned int cmd,
	    || __put_user(x << PAGE_SHIFT, &request->handle))
	    || __put_user(x << PAGE_SHIFT, &request->handle))
		return -EFAULT;
		return -EFAULT;


	return drm_ioctl(file->f_path.dentry->d_inode, file,
	return drm_ioctl(file, DRM_IOCTL_SG_FREE, (unsigned long)request);
			 DRM_IOCTL_SG_FREE, (unsigned long)request);
}
}


#if defined(CONFIG_X86) || defined(CONFIG_IA64)
#if defined(CONFIG_X86) || defined(CONFIG_IA64)
@@ -981,8 +956,7 @@ static int compat_drm_update_draw(struct file *file, unsigned int cmd,
	    __put_user(update32.data, &request->data))
	    __put_user(update32.data, &request->data))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_UPDATE_DRAW, (unsigned long)request);
			DRM_IOCTL_UPDATE_DRAW, (unsigned long)request);
	return err;
	return err;
}
}
#endif
#endif
@@ -1023,8 +997,7 @@ static int compat_drm_wait_vblank(struct file *file, unsigned int cmd,
	    || __put_user(req32.request.signal, &request->request.signal))
	    || __put_user(req32.request.signal, &request->request.signal))
		return -EFAULT;
		return -EFAULT;


	err = drm_ioctl(file->f_path.dentry->d_inode, file,
	err = drm_ioctl(file, DRM_IOCTL_WAIT_VBLANK, (unsigned long)request);
			DRM_IOCTL_WAIT_VBLANK, (unsigned long)request);
	if (err)
	if (err)
		return err;
		return err;


@@ -1094,16 +1067,14 @@ long drm_compat_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
	 * than always failing.
	 * than always failing.
	 */
	 */
	if (nr >= ARRAY_SIZE(drm_compat_ioctls))
	if (nr >= ARRAY_SIZE(drm_compat_ioctls))
		return drm_ioctl(filp->f_dentry->d_inode, filp, cmd, arg);
		return drm_ioctl(filp, cmd, arg);


	fn = drm_compat_ioctls[nr];
	fn = drm_compat_ioctls[nr];


	lock_kernel();		/* XXX for now */
	if (fn != NULL)
	if (fn != NULL)
		ret = (*fn) (filp, cmd, arg);
		ret = (*fn) (filp, cmd, arg);
	else
	else
		ret = drm_ioctl(filp->f_path.dentry->d_inode, filp, cmd, arg);
		ret = drm_ioctl(filp, cmd, arg);
	unlock_kernel();


	return ret;
	return ret;
}
}
+2 −2
Original line number Original line Diff line number Diff line
@@ -358,7 +358,7 @@ struct drm_mm_node *drm_mm_search_free(const struct drm_mm *mm,
		if (entry->size >= size + wasted) {
		if (entry->size >= size + wasted) {
			if (!best_match)
			if (!best_match)
				return entry;
				return entry;
			if (size < best_size) {
			if (entry->size < best_size) {
				best = entry;
				best = entry;
				best_size = entry->size;
				best_size = entry->size;
			}
			}
@@ -408,7 +408,7 @@ struct drm_mm_node *drm_mm_search_free_in_range(const struct drm_mm *mm,
		if (entry->size >= size + wasted) {
		if (entry->size >= size + wasted) {
			if (!best_match)
			if (!best_match)
				return entry;
				return entry;
			if (size < best_size) {
			if (entry->size < best_size) {
				best = entry;
				best = entry;
				best_size = entry->size;
				best_size = entry->size;
			}
			}
+5 −0
Original line number Original line Diff line number Diff line
@@ -408,6 +408,11 @@ static int ch7006_probe(struct i2c_client *client, const struct i2c_device_id *i


	ch7006_info(client, "Detected version ID: %x\n", val);
	ch7006_info(client, "Detected version ID: %x\n", val);


	/* I don't know what this is for, but otherwise I get no
	 * signal.
	 */
	ch7006_write(client, 0x3d, 0x0);

	return 0;
	return 0;


fail:
fail:
Loading