mirror of
https://gitlab.freedesktop.org/mesa/drm.git
synced 2025-12-24 17:10:13 +01:00
drm: move drm_head to drm_minor and fix up users
This commit is contained in:
parent
219ba5cd9a
commit
10937cf20b
23 changed files with 147 additions and 145 deletions
|
|
@ -412,13 +412,12 @@ enum drm_ref_type {
|
|||
struct drm_file {
|
||||
int authenticated;
|
||||
int master;
|
||||
int minor;
|
||||
pid_t pid;
|
||||
uid_t uid;
|
||||
drm_magic_t magic;
|
||||
unsigned long ioctl_count;
|
||||
struct list_head lhead;
|
||||
struct drm_head *head;
|
||||
struct drm_minor *minor;
|
||||
int remove_auth_on_close;
|
||||
unsigned long lock_count;
|
||||
|
||||
|
|
@ -690,16 +689,19 @@ struct drm_driver {
|
|||
struct pci_driver pci_driver;
|
||||
};
|
||||
|
||||
#define DRM_MINOR_UNASSIGNED 0
|
||||
#define DRM_MINOR_CONTROL 1
|
||||
#define DRM_MINOR_RENDER 2
|
||||
/**
|
||||
* DRM head structure. This structure represent a video head on a card
|
||||
* that may contain multiple heads. Embed one per head of these in the
|
||||
* private drm_device structure.
|
||||
* DRM minor structure. This structure represents a drm minor number.
|
||||
*/
|
||||
struct drm_head {
|
||||
struct drm_minor {
|
||||
int minor; /**< Minor device number */
|
||||
struct drm_device *dev;
|
||||
struct proc_dir_entry *dev_root; /**< proc directory entry */
|
||||
int type; /**< Control or render */
|
||||
dev_t device; /**< Device number for mknod */
|
||||
struct drm_device *dev;
|
||||
/* for render nodes */
|
||||
struct proc_dir_entry *dev_root; /**< proc directory entry */
|
||||
struct class_device *dev_class;
|
||||
};
|
||||
|
||||
|
|
@ -830,7 +832,10 @@ struct drm_device {
|
|||
struct drm_driver *driver;
|
||||
drm_local_map_t *agp_buffer_map;
|
||||
unsigned int agp_buffer_token;
|
||||
struct drm_head primary; /**< primary screen head */
|
||||
|
||||
/* minor number for control node */
|
||||
struct drm_minor control;
|
||||
struct drm_minor primary; /**< primary screen head */
|
||||
|
||||
struct drm_fence_manager fm;
|
||||
struct drm_buffer_manager bm;
|
||||
|
|
@ -1153,10 +1158,10 @@ extern void drm_agp_chipset_flush(struct drm_device *dev);
|
|||
extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
|
||||
struct drm_driver *driver);
|
||||
extern int drm_put_dev(struct drm_device *dev);
|
||||
extern int drm_put_head(struct drm_head * head);
|
||||
extern int drm_put_head(struct drm_minor *minor);
|
||||
extern unsigned int drm_debug; /* 1 to enable debug output */
|
||||
extern unsigned int drm_cards_limit;
|
||||
extern struct drm_head **drm_heads;
|
||||
extern unsigned int drm_minors_limit;
|
||||
extern struct drm_minor **drm_minors;
|
||||
extern struct class *drm_class;
|
||||
extern struct proc_dir_entry *drm_proc_root;
|
||||
|
||||
|
|
@ -1193,7 +1198,7 @@ extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t *dmah);
|
|||
struct drm_sysfs_class;
|
||||
extern struct class *drm_sysfs_create(struct module *owner, char *name);
|
||||
extern void drm_sysfs_destroy(void);
|
||||
extern int drm_sysfs_device_add(struct drm_device *dev, struct drm_head *head);
|
||||
extern int drm_sysfs_device_add(struct drm_device *dev, struct drm_minor *minor);
|
||||
extern void drm_sysfs_device_remove(struct drm_device *dev);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ EXPORT_SYMBOL(drm_agp_acquire);
|
|||
int drm_agp_acquire_ioctl(struct drm_device *dev, void *data,
|
||||
struct drm_file *file_priv)
|
||||
{
|
||||
return drm_agp_acquire((struct drm_device *) file_priv->head->dev);
|
||||
return drm_agp_acquire((struct drm_device *) file_priv->minor->dev);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1164,7 +1164,7 @@ static int drm_buffer_object_map(struct drm_file *file_priv, uint32_t handle,
|
|||
struct drm_bo_info_rep *rep)
|
||||
{
|
||||
struct drm_buffer_object *bo;
|
||||
struct drm_device *dev = file_priv->head->dev;
|
||||
struct drm_device *dev = file_priv->minor->dev;
|
||||
int ret = 0;
|
||||
int no_wait = hint & DRM_BO_HINT_DONT_BLOCK;
|
||||
|
||||
|
|
@ -1236,7 +1236,7 @@ out:
|
|||
|
||||
static int drm_buffer_object_unmap(struct drm_file *file_priv, uint32_t handle)
|
||||
{
|
||||
struct drm_device *dev = file_priv->head->dev;
|
||||
struct drm_device *dev = file_priv->minor->dev;
|
||||
struct drm_buffer_object *bo;
|
||||
struct drm_ref_object *ro;
|
||||
int ret = 0;
|
||||
|
|
@ -1543,7 +1543,7 @@ int drm_bo_handle_validate(struct drm_file *file_priv, uint32_t handle,
|
|||
struct drm_bo_info_rep *rep,
|
||||
struct drm_buffer_object **bo_rep)
|
||||
{
|
||||
struct drm_device *dev = file_priv->head->dev;
|
||||
struct drm_device *dev = file_priv->minor->dev;
|
||||
struct drm_buffer_object *bo;
|
||||
int ret;
|
||||
int no_wait = hint & DRM_BO_HINT_DONT_BLOCK;
|
||||
|
|
@ -1581,7 +1581,7 @@ EXPORT_SYMBOL(drm_bo_handle_validate);
|
|||
static int drm_bo_handle_info(struct drm_file *file_priv, uint32_t handle,
|
||||
struct drm_bo_info_rep *rep)
|
||||
{
|
||||
struct drm_device *dev = file_priv->head->dev;
|
||||
struct drm_device *dev = file_priv->minor->dev;
|
||||
struct drm_buffer_object *bo;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
|
@ -1604,7 +1604,7 @@ static int drm_bo_handle_wait(struct drm_file *file_priv, uint32_t handle,
|
|||
uint32_t hint,
|
||||
struct drm_bo_info_rep *rep)
|
||||
{
|
||||
struct drm_device *dev = file_priv->head->dev;
|
||||
struct drm_device *dev = file_priv->minor->dev;
|
||||
struct drm_buffer_object *bo;
|
||||
int no_wait = hint & DRM_BO_HINT_DONT_BLOCK;
|
||||
int ret;
|
||||
|
|
@ -1717,7 +1717,7 @@ EXPORT_SYMBOL(drm_buffer_object_create);
|
|||
static int drm_bo_add_user_object(struct drm_file *file_priv,
|
||||
struct drm_buffer_object *bo, int shareable)
|
||||
{
|
||||
struct drm_device *dev = file_priv->head->dev;
|
||||
struct drm_device *dev = file_priv->minor->dev;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
|
@ -1757,7 +1757,7 @@ int drm_bo_create_ioctl(struct drm_device *dev, void *data, struct drm_file *fil
|
|||
if (bo_type == drm_bo_type_user)
|
||||
req->mask &= ~DRM_BO_FLAG_SHAREABLE;
|
||||
|
||||
ret = drm_buffer_object_create(file_priv->head->dev,
|
||||
ret = drm_buffer_object_create(file_priv->minor->dev,
|
||||
req->size, bo_type, req->mask,
|
||||
req->hint, req->page_alignment,
|
||||
req->buffer_start, &entry);
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ int drm_bo_write_lock(struct drm_bo_lock *lock, struct drm_file *file_priv)
|
|||
* while holding it.
|
||||
*/
|
||||
|
||||
dev = file_priv->head->dev;
|
||||
dev = file_priv->minor->dev;
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
ret = drm_add_user_object(file_priv, &lock->base, 0);
|
||||
lock->base.remove = &drm_bo_write_lock_remove;
|
||||
|
|
@ -156,7 +156,7 @@ int drm_bo_write_lock(struct drm_bo_lock *lock, struct drm_file *file_priv)
|
|||
|
||||
int drm_bo_write_unlock(struct drm_bo_lock *lock, struct drm_file *file_priv)
|
||||
{
|
||||
struct drm_device *dev = file_priv->head->dev;
|
||||
struct drm_device *dev = file_priv->minor->dev;
|
||||
struct drm_ref_object *ro;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
|
|
|||
|
|
@ -356,7 +356,7 @@ void drm_crtc_probe_single_output_modes(struct drm_output *output, int maxX, int
|
|||
}
|
||||
|
||||
|
||||
drm_mode_prune_invalid(dev, &output->modes, true);
|
||||
drm_mode_prune_invalid(dev, &output->modes, TRUE);
|
||||
|
||||
if (list_empty(&output->modes)) {
|
||||
struct drm_display_mode *stdmode;
|
||||
|
|
@ -510,7 +510,7 @@ bool drm_crtc_set_mode(struct drm_crtc *crtc, struct drm_display_mode *mode,
|
|||
|
||||
/* XXX free adjustedmode */
|
||||
drm_mode_destroy(dev, adjusted_mode);
|
||||
ret = true;
|
||||
ret = TRUE;
|
||||
/* TODO */
|
||||
// if (scrn->pScreen)
|
||||
// drm_crtc_set_screen_sub_pixel_order(dev);
|
||||
|
|
@ -1781,7 +1781,7 @@ out:
|
|||
void drm_fb_release(struct file *filp)
|
||||
{
|
||||
struct drm_file *priv = filp->private_data;
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
struct drm_framebuffer *fb, *tfb;
|
||||
|
||||
mutex_lock(&dev->mode_config.mutex);
|
||||
|
|
|
|||
|
|
@ -432,19 +432,19 @@ void drm_exit(struct drm_driver *driver)
|
|||
{
|
||||
int i;
|
||||
struct drm_device *dev = NULL;
|
||||
struct drm_head *head;
|
||||
struct drm_minor *minor;
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
if (drm_fb_loaded) {
|
||||
for (i = 0; i < drm_cards_limit; i++) {
|
||||
head = drm_heads[i];
|
||||
if (!head)
|
||||
for (i = 0; i < drm_minors_limit; i++) {
|
||||
minor = drm_minors[i];
|
||||
if (!minor)
|
||||
continue;
|
||||
if (!head->dev)
|
||||
if (!minor->dev)
|
||||
continue;
|
||||
if (head->dev->driver != driver)
|
||||
if (minor->dev->driver != driver)
|
||||
continue;
|
||||
dev = head->dev;
|
||||
dev = minor->dev;
|
||||
if (dev) {
|
||||
/* release the pci driver */
|
||||
if (dev->pdev)
|
||||
|
|
@ -495,10 +495,10 @@ static int __init drm_core_init(void)
|
|||
drm_init_memctl(avail_memctl_mem/2, avail_memctl_mem*3/4, si.mem_unit);
|
||||
|
||||
ret = -ENOMEM;
|
||||
drm_cards_limit =
|
||||
(drm_cards_limit < DRM_MAX_MINOR + 1 ? drm_cards_limit : DRM_MAX_MINOR + 1);
|
||||
drm_heads = drm_calloc(drm_cards_limit, sizeof(*drm_heads), DRM_MEM_STUB);
|
||||
if (!drm_heads)
|
||||
drm_minors_limit =
|
||||
(drm_minors_limit < DRM_MAX_MINOR + 1 ? drm_minors_limit : DRM_MAX_MINOR + 1);
|
||||
drm_minors = drm_calloc(drm_minors_limit, sizeof(*drm_minors), DRM_MEM_STUB);
|
||||
if (!drm_minors)
|
||||
goto err_p1;
|
||||
|
||||
if (register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops))
|
||||
|
|
@ -528,7 +528,7 @@ err_p3:
|
|||
drm_sysfs_destroy();
|
||||
err_p2:
|
||||
unregister_chrdev(DRM_MAJOR, "drm");
|
||||
drm_free(drm_heads, sizeof(*drm_heads) * drm_cards_limit, DRM_MEM_STUB);
|
||||
drm_free(drm_minors, sizeof(*drm_minors) * drm_minors_limit, DRM_MEM_STUB);
|
||||
err_p1:
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -540,7 +540,7 @@ static void __exit drm_core_exit(void)
|
|||
|
||||
unregister_chrdev(DRM_MAJOR, "drm");
|
||||
|
||||
drm_free(drm_heads, sizeof(*drm_heads) * drm_cards_limit, DRM_MEM_STUB);
|
||||
drm_free(drm_minors, sizeof(*drm_minors) * drm_minors_limit, DRM_MEM_STUB);
|
||||
}
|
||||
|
||||
module_init(drm_core_init);
|
||||
|
|
@ -600,7 +600,7 @@ EXPORT_SYMBOL(drm_ioctl);
|
|||
long drm_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
struct drm_file *file_priv = filp->private_data;
|
||||
struct drm_device *dev = file_priv->head->dev;
|
||||
struct drm_device *dev = file_priv->minor->dev;
|
||||
struct drm_ioctl_desc *ioctl;
|
||||
drm_ioctl_t *func;
|
||||
unsigned int nr = DRM_IOCTL_NR(cmd);
|
||||
|
|
@ -612,7 +612,7 @@ long drm_unlocked_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
|
|||
++file_priv->ioctl_count;
|
||||
|
||||
DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
|
||||
current->pid, cmd, nr, (long)old_encode_dev(file_priv->head->device),
|
||||
current->pid, cmd, nr, (long)old_encode_dev(file_priv->minor->device),
|
||||
file_priv->authenticated);
|
||||
|
||||
if ((nr >= DRM_CORE_IOCTL_COUNT) &&
|
||||
|
|
|
|||
|
|
@ -516,7 +516,7 @@ static int drm_fence_object_init(struct drm_device *dev, uint32_t fence_class,
|
|||
int drm_fence_add_user_object(struct drm_file *priv,
|
||||
struct drm_fence_object *fence, int shareable)
|
||||
{
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
|
@ -612,7 +612,7 @@ void drm_fence_manager_takedown(struct drm_device *dev)
|
|||
struct drm_fence_object *drm_lookup_fence_object(struct drm_file *priv,
|
||||
uint32_t handle)
|
||||
{
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
struct drm_user_object *uo;
|
||||
struct drm_fence_object *fence;
|
||||
|
||||
|
|
|
|||
|
|
@ -131,13 +131,13 @@ int drm_open(struct inode *inode, struct file *filp)
|
|||
int minor = iminor(inode);
|
||||
int retcode = 0;
|
||||
|
||||
if (!((minor >= 0) && (minor < drm_cards_limit)))
|
||||
if (!((minor >= 0) && (minor < drm_minors_limit)))
|
||||
return -ENODEV;
|
||||
|
||||
if (!drm_heads[minor])
|
||||
if (!drm_minors[minor])
|
||||
return -ENODEV;
|
||||
|
||||
if (!(dev = drm_heads[minor]->dev))
|
||||
if (!(dev = drm_minors[minor]->dev))
|
||||
return -ENODEV;
|
||||
|
||||
retcode = drm_open_helper(inode, filp, dev);
|
||||
|
|
@ -182,13 +182,13 @@ int drm_stub_open(struct inode *inode, struct file *filp)
|
|||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
if (!((minor >= 0) && (minor < drm_cards_limit)))
|
||||
if (!((minor >= 0) && (minor < drm_minors_limit)))
|
||||
return -ENODEV;
|
||||
|
||||
if (!drm_heads[minor])
|
||||
if (!drm_minors[minor])
|
||||
return -ENODEV;
|
||||
|
||||
if (!(dev = drm_heads[minor]->dev))
|
||||
if (!(dev = drm_minors[minor]->dev))
|
||||
return -ENODEV;
|
||||
|
||||
old_fops = filp->f_op;
|
||||
|
|
@ -254,8 +254,7 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
|
|||
priv->filp = filp;
|
||||
priv->uid = current->euid;
|
||||
priv->pid = current->pid;
|
||||
priv->minor = minor;
|
||||
priv->head = drm_heads[minor];
|
||||
priv->minor = drm_minors[minor];
|
||||
priv->ioctl_count = 0;
|
||||
/* for compatibility root is always authenticated */
|
||||
priv->authenticated = capable(CAP_SYS_ADMIN);
|
||||
|
|
@ -321,11 +320,11 @@ static int drm_open_helper(struct inode *inode, struct file *filp,
|
|||
int drm_fasync(int fd, struct file *filp, int on)
|
||||
{
|
||||
struct drm_file *priv = filp->private_data;
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
int retcode;
|
||||
|
||||
DRM_DEBUG("fd = %d, device = 0x%lx\n", fd,
|
||||
(long)old_encode_dev(priv->head->device));
|
||||
(long)old_encode_dev(priv->minor->device));
|
||||
retcode = fasync_helper(fd, filp, on, &dev->buf_async);
|
||||
if (retcode < 0)
|
||||
return retcode;
|
||||
|
|
@ -375,7 +374,7 @@ static void drm_object_release(struct file *filp)
|
|||
int drm_release(struct inode *inode, struct file *filp)
|
||||
{
|
||||
struct drm_file *file_priv = filp->private_data;
|
||||
struct drm_device *dev = file_priv->head->dev;
|
||||
struct drm_device *dev = file_priv->minor->dev;
|
||||
int retcode = 0;
|
||||
|
||||
lock_kernel();
|
||||
|
|
@ -390,7 +389,7 @@ int drm_release(struct inode *inode, struct file *filp)
|
|||
*/
|
||||
|
||||
DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
|
||||
current->pid, (long)old_encode_dev(file_priv->head->device),
|
||||
current->pid, (long)old_encode_dev(file_priv->minor->device),
|
||||
dev->open_count);
|
||||
|
||||
if (dev->driver->reclaim_buffers_locked && dev->lock.hw_lock) {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
int drm_add_user_object(struct drm_file *priv, struct drm_user_object *item,
|
||||
int shareable)
|
||||
{
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
int ret;
|
||||
|
||||
DRM_ASSERT_LOCKED(&dev->struct_mutex);
|
||||
|
|
@ -58,7 +58,7 @@ EXPORT_SYMBOL(drm_add_user_object);
|
|||
|
||||
struct drm_user_object *drm_lookup_user_object(struct drm_file *priv, uint32_t key)
|
||||
{
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
struct drm_hash_item *hash;
|
||||
int ret;
|
||||
struct drm_user_object *item;
|
||||
|
|
@ -85,7 +85,7 @@ EXPORT_SYMBOL(drm_lookup_user_object);
|
|||
|
||||
static void drm_deref_user_object(struct drm_file *priv, struct drm_user_object *item)
|
||||
{
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
int ret;
|
||||
|
||||
if (atomic_dec_and_test(&item->refcount)) {
|
||||
|
|
@ -121,7 +121,7 @@ int drm_add_ref_object(struct drm_file *priv, struct drm_user_object *referenced
|
|||
struct drm_ref_object *item;
|
||||
struct drm_open_hash *ht = &priv->refd_object_hash[ref_action];
|
||||
|
||||
DRM_ASSERT_LOCKED(&priv->head->dev->struct_mutex);
|
||||
DRM_ASSERT_LOCKED(&priv->minor->dev->struct_mutex);
|
||||
if (!referenced_object->shareable && priv != referenced_object->owner) {
|
||||
DRM_ERROR("Not allowed to reference this object\n");
|
||||
return -EINVAL;
|
||||
|
|
@ -178,7 +178,7 @@ struct drm_ref_object *drm_lookup_ref_object(struct drm_file *priv,
|
|||
struct drm_hash_item *hash;
|
||||
int ret;
|
||||
|
||||
DRM_ASSERT_LOCKED(&priv->head->dev->struct_mutex);
|
||||
DRM_ASSERT_LOCKED(&priv->minor->dev->struct_mutex);
|
||||
ret = drm_ht_find_item(&priv->refd_object_hash[ref_action],
|
||||
(unsigned long)referenced_object, &hash);
|
||||
if (ret)
|
||||
|
|
@ -212,7 +212,7 @@ void drm_remove_ref_object(struct drm_file *priv, struct drm_ref_object *item)
|
|||
struct drm_open_hash *ht = &priv->refd_object_hash[item->unref_action];
|
||||
enum drm_ref_type unref_action;
|
||||
|
||||
DRM_ASSERT_LOCKED(&priv->head->dev->struct_mutex);
|
||||
DRM_ASSERT_LOCKED(&priv->minor->dev->struct_mutex);
|
||||
unref_action = item->unref_action;
|
||||
if (atomic_dec_and_test(&item->refcount)) {
|
||||
ret = drm_ht_remove_item(ht, &item->hash);
|
||||
|
|
@ -239,7 +239,7 @@ EXPORT_SYMBOL(drm_remove_ref_object);
|
|||
int drm_user_object_ref(struct drm_file *priv, uint32_t user_token,
|
||||
enum drm_object_type type, struct drm_user_object **object)
|
||||
{
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
struct drm_user_object *uo;
|
||||
struct drm_hash_item *hash;
|
||||
int ret;
|
||||
|
|
@ -269,7 +269,7 @@ out_err:
|
|||
int drm_user_object_unref(struct drm_file *priv, uint32_t user_token,
|
||||
enum drm_object_type type)
|
||||
{
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
struct drm_user_object *uo;
|
||||
struct drm_ref_object *ro;
|
||||
int ret;
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ static struct drm_proc_list {
|
|||
* "/proc/dri/%minor%/", and each entry in proc_list as
|
||||
* "/proc/dri/%minor%/%name%".
|
||||
*/
|
||||
int drm_proc_init(struct drm_device * dev, int minor,
|
||||
int drm_proc_init(struct drm_device *dev, int minor,
|
||||
struct proc_dir_entry *root, struct proc_dir_entry **dev_root)
|
||||
{
|
||||
struct proc_dir_entry *ent;
|
||||
|
|
@ -535,7 +535,7 @@ static int drm__clients_info(char *buf, char **start, off_t offset,
|
|||
list_for_each_entry(priv, &dev->filelist, lhead) {
|
||||
DRM_PROC_PRINT("%c %3d %5d %5d %10u %10lu\n",
|
||||
priv->authenticated ? 'y' : 'n',
|
||||
priv->minor,
|
||||
priv->minor->minor,
|
||||
priv->pid,
|
||||
priv->uid, priv->magic, priv->ioctl_count);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,20 +37,20 @@
|
|||
#include "drmP.h"
|
||||
#include "drm_core.h"
|
||||
|
||||
unsigned int drm_cards_limit = 16; /* Enough for one machine */
|
||||
unsigned int drm_minors_limit = 16; /* Enough for one machine */
|
||||
unsigned int drm_debug = 0; /* 1 to enable debug output */
|
||||
EXPORT_SYMBOL(drm_debug);
|
||||
|
||||
MODULE_AUTHOR(CORE_AUTHOR);
|
||||
MODULE_DESCRIPTION(CORE_DESC);
|
||||
MODULE_LICENSE("GPL and additional rights");
|
||||
MODULE_PARM_DESC(cards_limit, "Maximum number of graphics cards");
|
||||
MODULE_PARM_DESC(minors_limit, "Maximum number of graphics cards");
|
||||
MODULE_PARM_DESC(debug, "Enable debug output");
|
||||
|
||||
module_param_named(cards_limit, drm_cards_limit, int, 0444);
|
||||
module_param_named(minors_limit, drm_minors_limit, int, 0444);
|
||||
module_param_named(debug, drm_debug, int, 0600);
|
||||
|
||||
struct drm_head **drm_heads;
|
||||
struct drm_minor **drm_minors;
|
||||
struct class *drm_class;
|
||||
struct proc_dir_entry *drm_proc_root;
|
||||
|
||||
|
|
@ -160,48 +160,48 @@ error_out_unreg:
|
|||
* create the proc init entry via proc_init(). This routines assigns
|
||||
* minor numbers to secondary heads of multi-headed cards
|
||||
*/
|
||||
static int drm_get_head(struct drm_device * dev, struct drm_head * head)
|
||||
static int drm_get_head(struct drm_device * dev, struct drm_minor *minor)
|
||||
{
|
||||
struct drm_head **heads = drm_heads;
|
||||
struct drm_minor **minors = drm_minors;
|
||||
int ret;
|
||||
int minor;
|
||||
int index;
|
||||
|
||||
DRM_DEBUG("\n");
|
||||
|
||||
for (minor = 0; minor < drm_cards_limit; minor++, heads++) {
|
||||
if (!*heads) {
|
||||
for (index = 0; index < drm_minors_limit; index++, minors++) {
|
||||
if (!*minors) {
|
||||
|
||||
*head = (struct drm_head) {
|
||||
*minor = (struct drm_minor) {
|
||||
.dev = dev,
|
||||
.device = MKDEV(DRM_MAJOR, minor),
|
||||
.minor = minor,
|
||||
.device = MKDEV(DRM_MAJOR, index),
|
||||
.minor = index,
|
||||
};
|
||||
if ((ret =
|
||||
drm_proc_init(dev, minor, drm_proc_root,
|
||||
&head->dev_root))) {
|
||||
drm_proc_init(dev, index, drm_proc_root,
|
||||
&minor->dev_root))) {
|
||||
printk(KERN_ERR
|
||||
"DRM: Failed to initialize /proc/dri.\n");
|
||||
goto err_g1;
|
||||
}
|
||||
|
||||
ret = drm_sysfs_device_add(dev, head);
|
||||
ret = drm_sysfs_device_add(dev, minor);
|
||||
if (ret) {
|
||||
printk(KERN_ERR
|
||||
"DRM: Error sysfs_device_add.\n");
|
||||
goto err_g2;
|
||||
}
|
||||
*heads = head;
|
||||
*minors = minor;
|
||||
|
||||
DRM_DEBUG("new minor assigned %d\n", minor);
|
||||
DRM_DEBUG("new minor assigned %d\n", index);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
DRM_ERROR("out of minors\n");
|
||||
return -ENOMEM;
|
||||
err_g2:
|
||||
drm_proc_cleanup(minor, drm_proc_root, head->dev_root);
|
||||
drm_proc_cleanup(index, drm_proc_root, minor->dev_root);
|
||||
err_g1:
|
||||
*head = (struct drm_head) {
|
||||
*minor = (struct drm_minor) {
|
||||
.dev = NULL};
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -309,17 +309,18 @@ int drm_put_dev(struct drm_device * dev)
|
|||
* last minor released.
|
||||
*
|
||||
*/
|
||||
int drm_put_head(struct drm_head * head)
|
||||
int drm_put_minor(struct drm_minor *minor)
|
||||
{
|
||||
int minor = head->minor;
|
||||
int index = minor->minor;
|
||||
|
||||
DRM_DEBUG("release secondary minor %d\n", minor);
|
||||
DRM_DEBUG("release secondary minor %d\n", index);
|
||||
|
||||
drm_proc_cleanup(minor, drm_proc_root, head->dev_root);
|
||||
drm_sysfs_device_remove(head->dev);
|
||||
drm_proc_cleanup(index, drm_proc_root, minor->dev_root);
|
||||
drm_sysfs_device_remove(minor->dev);
|
||||
|
||||
*head = (struct drm_head) {.dev = NULL};
|
||||
*minor = (struct drm_minor) {.type = DRM_MINOR_UNASSIGNED,
|
||||
.dev = NULL};
|
||||
|
||||
drm_heads[minor] = NULL;
|
||||
drm_minors[index] = NULL;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ static void drm_sysfs_device_release(struct device *dev)
|
|||
* as the parent for the Linux device, and make sure it has a file containing
|
||||
* the driver we're using (for userspace compatibility).
|
||||
*/
|
||||
int drm_sysfs_device_add(struct drm_device *dev, struct drm_head *head)
|
||||
int drm_sysfs_device_add(struct drm_device *dev, struct drm_minor *minor)
|
||||
{
|
||||
int err;
|
||||
int i, j;
|
||||
|
|
@ -162,8 +162,8 @@ int drm_sysfs_device_add(struct drm_device *dev, struct drm_head *head)
|
|||
dev->dev.parent = &dev->pdev->dev;
|
||||
dev->dev.class = drm_class;
|
||||
dev->dev.release = drm_sysfs_device_release;
|
||||
dev->dev.devt = head->device;
|
||||
snprintf(dev->dev.bus_id, BUS_ID_SIZE, "card%d", head->minor);
|
||||
dev->dev.devt = minor->device;
|
||||
snprintf(dev->dev.bus_id, BUS_ID_SIZE, "card%d", minor->minor);
|
||||
|
||||
err = device_register(&dev->dev);
|
||||
if (err) {
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
|
|||
unsigned long address)
|
||||
{
|
||||
struct drm_file *priv = vma->vm_file->private_data;
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
struct drm_map *map = NULL;
|
||||
struct drm_map_list *r_list;
|
||||
struct drm_hash_item *hash;
|
||||
|
|
@ -204,7 +204,7 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma,
|
|||
static void drm_vm_shm_close(struct vm_area_struct *vma)
|
||||
{
|
||||
struct drm_file *priv = vma->vm_file->private_data;
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
struct drm_vma_entry *pt, *temp;
|
||||
struct drm_map *map;
|
||||
struct drm_map_list *r_list;
|
||||
|
|
@ -286,7 +286,7 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
|
|||
unsigned long address)
|
||||
{
|
||||
struct drm_file *priv = vma->vm_file->private_data;
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
struct drm_device_dma *dma = dev->dma;
|
||||
unsigned long offset;
|
||||
unsigned long page_nr;
|
||||
|
|
@ -323,7 +323,7 @@ static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma,
|
|||
{
|
||||
struct drm_map *map = (struct drm_map *) vma->vm_private_data;
|
||||
struct drm_file *priv = vma->vm_file->private_data;
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
struct drm_sg_mem *entry = dev->sg;
|
||||
unsigned long offset;
|
||||
unsigned long map_offset;
|
||||
|
|
@ -419,7 +419,7 @@ static struct vm_operations_struct drm_vm_sg_ops = {
|
|||
static void drm_vm_open_locked(struct vm_area_struct *vma)
|
||||
{
|
||||
struct drm_file *priv = vma->vm_file->private_data;
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
struct drm_vma_entry *vma_entry;
|
||||
|
||||
DRM_DEBUG("0x%08lx,0x%08lx\n",
|
||||
|
|
@ -437,7 +437,7 @@ static void drm_vm_open_locked(struct vm_area_struct *vma)
|
|||
static void drm_vm_open(struct vm_area_struct *vma)
|
||||
{
|
||||
struct drm_file *priv = vma->vm_file->private_data;
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
drm_vm_open_locked(vma);
|
||||
|
|
@ -455,7 +455,7 @@ static void drm_vm_open(struct vm_area_struct *vma)
|
|||
static void drm_vm_close(struct vm_area_struct *vma)
|
||||
{
|
||||
struct drm_file *priv = vma->vm_file->private_data;
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
struct drm_vma_entry *pt, *temp;
|
||||
|
||||
DRM_DEBUG("0x%08lx,0x%08lx\n",
|
||||
|
|
@ -491,7 +491,7 @@ static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
|
|||
struct drm_device_dma *dma;
|
||||
unsigned long length = vma->vm_end - vma->vm_start;
|
||||
|
||||
dev = priv->head->dev;
|
||||
dev = priv->minor->dev;
|
||||
dma = dev->dma;
|
||||
DRM_DEBUG("start = 0x%lx, end = 0x%lx, page offset = 0x%lx\n",
|
||||
vma->vm_start, vma->vm_end, vma->vm_pgoff);
|
||||
|
|
@ -556,7 +556,7 @@ EXPORT_SYMBOL(drm_core_get_reg_ofs);
|
|||
static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
|
||||
{
|
||||
struct drm_file *priv = filp->private_data;
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
struct drm_map *map = NULL;
|
||||
unsigned long offset = 0;
|
||||
struct drm_hash_item *hash;
|
||||
|
|
@ -677,7 +677,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
|
|||
int drm_mmap(struct file *filp, struct vm_area_struct *vma)
|
||||
{
|
||||
struct drm_file *priv = filp->private_data;
|
||||
struct drm_device *dev = priv->head->dev;
|
||||
struct drm_device *dev = priv->minor->dev;
|
||||
int ret;
|
||||
|
||||
mutex_lock(&dev->struct_mutex);
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
|
|||
drm_i810_buf_priv_t *buf_priv;
|
||||
|
||||
lock_kernel();
|
||||
dev = priv->head->dev;
|
||||
dev = priv->minor->dev;
|
||||
dev_priv = dev->dev_private;
|
||||
buf = dev_priv->mmap_buffer;
|
||||
buf_priv = buf->dev_private;
|
||||
|
|
@ -141,7 +141,7 @@ static const struct file_operations i810_buffer_fops = {
|
|||
|
||||
static int i810_map_buffer(struct drm_buf * buf, struct drm_file *file_priv)
|
||||
{
|
||||
struct drm_device *dev = file_priv->head->dev;
|
||||
struct drm_device *dev = file_priv->minor->dev;
|
||||
drm_i810_buf_priv_t *buf_priv = buf->dev_private;
|
||||
drm_i810_private_t *dev_priv = dev->dev_private;
|
||||
const struct file_operations *old_fops;
|
||||
|
|
|
|||
|
|
@ -461,7 +461,7 @@ static void intel_crtc_dpms(struct drm_crtc *crtc, int mode)
|
|||
intel_crtc_load_lut(crtc);
|
||||
|
||||
/* Give the overlay scaler a chance to enable if it's on this pipe */
|
||||
//intel_crtc_dpms_video(crtc, true); TODO
|
||||
//intel_crtc_dpms_video(crtc, TRUE); TODO
|
||||
break;
|
||||
case DPMSModeOff:
|
||||
/* Give the overlay scaler a chance to disable if it's on this pipe */
|
||||
|
|
@ -699,19 +699,19 @@ static void intel_crtc_mode_set(struct drm_crtc *crtc,
|
|||
|
||||
switch (intel_output->type) {
|
||||
case INTEL_OUTPUT_LVDS:
|
||||
is_lvds = true;
|
||||
is_lvds = TRUE;
|
||||
break;
|
||||
case INTEL_OUTPUT_SDVO:
|
||||
is_sdvo = true;
|
||||
is_sdvo = TRUE;
|
||||
break;
|
||||
case INTEL_OUTPUT_DVO:
|
||||
is_dvo = true;
|
||||
is_dvo = TRUE;
|
||||
break;
|
||||
case INTEL_OUTPUT_TVOUT:
|
||||
is_tv = true;
|
||||
is_tv = TRUE;
|
||||
break;
|
||||
case INTEL_OUTPUT_ANALOG:
|
||||
is_crt = true;
|
||||
is_crt = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,6 @@ klibdrminclude_HEADERS = \
|
|||
nouveau_drm.h \
|
||||
r128_drm.h \
|
||||
radeon_drm.h \
|
||||
radeon_ms_drm.h \
|
||||
savage_drm.h \
|
||||
sis_drm.h \
|
||||
via_drm.h \
|
||||
|
|
|
|||
|
|
@ -780,7 +780,7 @@ int i915_process_relocs(struct drm_file *file_priv,
|
|||
struct drm_i915_validate_buffer *buffers,
|
||||
uint32_t num_buffers)
|
||||
{
|
||||
struct drm_device *dev = file_priv->head->dev;
|
||||
struct drm_device *dev = file_priv->minor->dev;
|
||||
struct drm_buffer_object *reloc_list_object;
|
||||
uint32_t cur_handle = *reloc_buf_handle;
|
||||
uint32_t *reloc_page;
|
||||
|
|
@ -866,7 +866,7 @@ static int i915_exec_reloc(struct drm_file *file_priv, drm_handle_t buf_handle,
|
|||
struct drm_i915_validate_buffer *buffers,
|
||||
uint32_t buf_count)
|
||||
{
|
||||
struct drm_device *dev = file_priv->head->dev;
|
||||
struct drm_device *dev = file_priv->minor->dev;
|
||||
struct i915_relocatee_info relocatee;
|
||||
int ret = 0;
|
||||
int b;
|
||||
|
|
@ -926,7 +926,7 @@ int i915_validate_buffer_list(struct drm_file *file_priv,
|
|||
unsigned long next = 0;
|
||||
int ret = 0;
|
||||
unsigned buf_count = 0;
|
||||
struct drm_device *dev = file_priv->head->dev;
|
||||
struct drm_device *dev = file_priv->minor->dev;
|
||||
uint32_t buf_reloc_handle, buf_handle;
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -87,6 +87,17 @@ enum radeon_monitor_type {
|
|||
MT_STV = 5
|
||||
};
|
||||
|
||||
enum radeon_connector_type {
|
||||
CONNECTOR_NONE,
|
||||
CONNECTOR_PROPRIETARY,
|
||||
CONNECTOR_VGA,
|
||||
CONNECTOR_DVI_I,
|
||||
CONNECTOR_DVI_D,
|
||||
CONNECTOR_CTV,
|
||||
CONNECTOR_STV,
|
||||
CONNECTOR_UNSUPPORTED
|
||||
};
|
||||
|
||||
enum radeon_output_type {
|
||||
OUTPUT_NONE,
|
||||
OUTPUT_DAC1,
|
||||
|
|
@ -120,6 +131,7 @@ struct radeon_ms_connector {
|
|||
int crtc;
|
||||
uint32_t i2c_reg;
|
||||
char outputs[RADEON_MAX_OUTPUTS];
|
||||
char name[32];
|
||||
};
|
||||
|
||||
struct radeon_ms_output {
|
||||
|
|
@ -447,7 +459,8 @@ int radeon_ms_wait_for_idle(struct drm_device *dev);
|
|||
/* radeon_ms_i2c.c */
|
||||
void radeon_ms_i2c_destroy(struct radeon_ms_i2c *i2c);
|
||||
struct radeon_ms_i2c *radeon_ms_i2c_create(struct drm_device *dev,
|
||||
const uint32_t reg, int type);
|
||||
const uint32_t reg,
|
||||
const char *name);
|
||||
|
||||
/* radeon_ms_irq.c */
|
||||
void radeon_ms_irq_emit(struct drm_device *dev);
|
||||
|
|
|
|||
|
|
@ -369,8 +369,8 @@ int radeon_ms_dac2_mode_set(struct radeon_ms_output *output,
|
|||
case CHIP_R420:
|
||||
case CHIP_R430:
|
||||
case CHIP_R480:
|
||||
if (connector->type != ConnectorComposite &&
|
||||
connector->type != ConnectorSVIDEO) {
|
||||
if (connector->type != CONNECTOR_CTV &&
|
||||
connector->type != CONNECTOR_STV) {
|
||||
state->dac_cntl2 |= DAC_CNTL2__DAC2_CLK_SEL;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,12 +57,4 @@ struct drm_radeon_execbuffer {
|
|||
struct drm_fence_arg fence_arg;
|
||||
};
|
||||
|
||||
#define RADEON_MS_MAX_SAREA_CLIPRECTS 16
|
||||
|
||||
struct drm_radeon_ms_sarea {
|
||||
/* the cliprects */
|
||||
struct drm_clip_rect boxes[RADEON_MS_MAX_SAREA_CLIPRECTS];
|
||||
unsigned int nbox;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -58,17 +58,19 @@ static struct radeon_ms_output radeon_ms_dac2 = {
|
|||
};
|
||||
|
||||
static struct radeon_ms_connector radeon_ms_vga = {
|
||||
NULL, NULL, NULL, ConnectorVGA, MT_NONE, 0, GPIO_DDC1,
|
||||
NULL, NULL, NULL, CONNECTOR_VGA, MT_NONE, 0, GPIO_DDC1,
|
||||
{
|
||||
0, -1, -1, -1, -1, -1, -1, -1
|
||||
}
|
||||
},
|
||||
"VGA"
|
||||
};
|
||||
|
||||
static struct radeon_ms_connector radeon_ms_dvi_i_2 = {
|
||||
NULL, NULL, NULL, ConnectorDVII, MT_NONE, 0, GPIO_DDC2,
|
||||
NULL, NULL, NULL, CONNECTOR_DVI_I, MT_NONE, 0, GPIO_DDC2,
|
||||
{
|
||||
1, -1, -1, -1, -1, -1, -1, -1
|
||||
}
|
||||
},
|
||||
"DVI-I"
|
||||
};
|
||||
|
||||
static struct radeon_ms_properties properties[] = {
|
||||
|
|
|
|||
|
|
@ -219,7 +219,8 @@ static void set_data(void *i2c_priv, int data)
|
|||
*
|
||||
*/
|
||||
struct radeon_ms_i2c *radeon_ms_i2c_create(struct drm_device *dev,
|
||||
const uint32_t reg, int type)
|
||||
const uint32_t reg,
|
||||
const char *name)
|
||||
{
|
||||
struct radeon_ms_i2c *i2c;
|
||||
int ret;
|
||||
|
|
@ -232,17 +233,7 @@ struct radeon_ms_i2c *radeon_ms_i2c_create(struct drm_device *dev,
|
|||
|
||||
i2c->drm_dev = dev;
|
||||
i2c->reg = reg;
|
||||
switch (type) {
|
||||
case ConnectorVGA:
|
||||
snprintf(i2c->adapter.name, I2C_NAME_SIZE, "radeon-VGA");
|
||||
break;
|
||||
case ConnectorDVII:
|
||||
snprintf(i2c->adapter.name, I2C_NAME_SIZE, "radeon-DVII");
|
||||
break;
|
||||
default:
|
||||
snprintf(i2c->adapter.name, I2C_NAME_SIZE, "radeon-UNKNOWN");
|
||||
break;
|
||||
}
|
||||
snprintf(i2c->adapter.name, I2C_NAME_SIZE, "radeon-%s", name);
|
||||
i2c->adapter.owner = THIS_MODULE;
|
||||
/* fixme need to take a look at what its needed for */
|
||||
i2c->adapter.id = I2C_HW_B_RADEON;
|
||||
|
|
|
|||
|
|
@ -249,14 +249,14 @@ int radeon_ms_connectors_from_properties(struct drm_device *dev)
|
|||
dev_priv->properties->connectors[i],
|
||||
sizeof(struct radeon_ms_connector));
|
||||
connector->i2c = radeon_ms_i2c_create(dev,
|
||||
connector->i2c_reg, connector->type);
|
||||
connector->i2c_reg, connector->name);
|
||||
if (connector->i2c == NULL) {
|
||||
radeon_ms_connectors_destroy(dev);
|
||||
return -ENOMEM;
|
||||
}
|
||||
output = drm_output_create(dev,
|
||||
&radeon_ms_output_funcs,
|
||||
connector->type);
|
||||
connector->name);
|
||||
if (output == NULL) {
|
||||
radeon_ms_connectors_destroy(dev);
|
||||
return -EINVAL;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue