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;
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 */
+ 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 */
- dev_t device; /**< Device number for mknod */
struct class_device *dev_class;
};
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;
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;
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);
/*
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);
}
/**
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;
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;
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;
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);
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;
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);
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);
* 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;
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);
}
- 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;
/* 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);
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);
{
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)
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))
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;
}
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);
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);
++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) &&
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);
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;
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);
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;
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);
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;
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();
*/
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) {
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);
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;
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)) {
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;
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)
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);
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;
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;
* "/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;
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);
}
#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;
* 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;
}
* 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;
}
* 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;
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) {
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;
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;
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;
{
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;
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",
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);
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",
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);
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;
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);
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;
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;
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 */
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;
}
}
nouveau_drm.h \
r128_drm.h \
radeon_drm.h \
- radeon_ms_drm.h \
savage_drm.h \
sis_drm.h \
via_drm.h \
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;
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;
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;
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,
int crtc;
uint32_t i2c_reg;
char outputs[RADEON_MAX_OUTPUTS];
+ char name[32];
};
struct radeon_ms_output {
/* 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);
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;
}
}
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
};
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[] = {
*
*/
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;
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;
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;