Merge git://proxy01.pd.intel.com:9419/git/mesa/drm into crestline
commit
8398b99d8d
|
@ -1182,11 +1182,6 @@ static inline drm_mm_t *drm_get_mm(drm_mm_node_t *block)
|
||||||
return block->mm;
|
return block->mm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev);
|
extern void drm_core_ioremap(struct drm_map *map, struct drm_device *dev);
|
||||||
extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev);
|
extern void drm_core_ioremapfree(struct drm_map *map, struct drm_device *dev);
|
||||||
|
|
||||||
|
|
|
@ -442,7 +442,7 @@ void drm_exit(struct drm_driver *driver)
|
||||||
EXPORT_SYMBOL(drm_exit);
|
EXPORT_SYMBOL(drm_exit);
|
||||||
|
|
||||||
/** File operations structure */
|
/** File operations structure */
|
||||||
static struct file_operations drm_stub_fops = {
|
static const struct file_operations drm_stub_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
.open = drm_stub_open
|
.open = drm_stub_open
|
||||||
};
|
};
|
||||||
|
@ -591,21 +591,20 @@ int drm_ioctl(struct inode *inode, struct file *filp,
|
||||||
current->pid, cmd, nr, (long)old_encode_dev(priv->head->device),
|
current->pid, cmd, nr, (long)old_encode_dev(priv->head->device),
|
||||||
priv->authenticated);
|
priv->authenticated);
|
||||||
|
|
||||||
if (nr >= DRIVER_IOCTL_COUNT &&
|
if ((nr >= DRIVER_IOCTL_COUNT) &&
|
||||||
(nr < DRM_COMMAND_BASE || nr >= DRM_COMMAND_END))
|
((nr < DRM_COMMAND_BASE) || (nr >= DRM_COMMAND_END)))
|
||||||
goto err_i1;
|
goto err_i1;
|
||||||
if ((nr >= DRM_COMMAND_BASE) && (nr < DRM_COMMAND_END)
|
if ((nr >= DRM_COMMAND_BASE) && (nr < DRM_COMMAND_END)
|
||||||
&& (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls))
|
&& (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls))
|
||||||
ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE];
|
ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE];
|
||||||
else if (nr >= DRM_COMMAND_END || nr < DRM_COMMAND_BASE)
|
else if ((nr >= DRM_COMMAND_END) || (nr < DRM_COMMAND_BASE))
|
||||||
ioctl = &drm_ioctls[nr];
|
ioctl = &drm_ioctls[nr];
|
||||||
else
|
else
|
||||||
goto err_i1;
|
goto err_i1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
func = ioctl->func;
|
func = ioctl->func;
|
||||||
if ((nr == DRM_IOCTL_NR(DRM_IOCTL_DMA)) && dev->driver->dma_ioctl) /* Local override? */
|
/* is there a local override? */
|
||||||
|
if ((nr == DRM_IOCTL_NR(DRM_IOCTL_DMA)) && dev->driver->dma_ioctl)
|
||||||
func = dev->driver->dma_ioctl;
|
func = dev->driver->dma_ioctl;
|
||||||
|
|
||||||
if (!func) {
|
if (!func) {
|
||||||
|
|
|
@ -379,19 +379,11 @@ static void drm_object_release(struct file *filp) {
|
||||||
head = &priv->user_objects;
|
head = &priv->user_objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for(i=0; i<_DRM_NO_REF_TYPES; ++i) {
|
for(i=0; i<_DRM_NO_REF_TYPES; ++i) {
|
||||||
drm_ht_remove(&priv->refd_object_hash[i]);
|
drm_ht_remove(&priv->refd_object_hash[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Release file.
|
* Release file.
|
||||||
*
|
*
|
||||||
|
|
|
@ -138,12 +138,12 @@ static int drm_set_busid(drm_device_t * dev)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
if (dev->unique != NULL)
|
if (dev->unique != NULL)
|
||||||
return EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
dev->unique_len = 40;
|
dev->unique_len = 40;
|
||||||
dev->unique = drm_alloc(dev->unique_len + 1, DRM_MEM_DRIVER);
|
dev->unique = drm_alloc(dev->unique_len + 1, DRM_MEM_DRIVER);
|
||||||
if (dev->unique == NULL)
|
if (dev->unique == NULL)
|
||||||
return ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
len = snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d",
|
len = snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d",
|
||||||
drm_get_pci_domain(dev),
|
drm_get_pci_domain(dev),
|
||||||
|
@ -156,7 +156,7 @@ static int drm_set_busid(drm_device_t * dev)
|
||||||
dev->devname = drm_alloc(strlen(dev->driver->pci_driver.name) + dev->unique_len + 2,
|
dev->devname = drm_alloc(strlen(dev->driver->pci_driver.name) + dev->unique_len + 2,
|
||||||
DRM_MEM_DRIVER);
|
DRM_MEM_DRIVER);
|
||||||
if (dev->devname == NULL)
|
if (dev->devname == NULL)
|
||||||
return ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
sprintf(dev->devname, "%s@%s", dev->driver->pci_driver.name, dev->unique);
|
sprintf(dev->devname, "%s@%s", dev->driver->pci_driver.name, dev->unique);
|
||||||
|
|
||||||
|
@ -343,7 +343,7 @@ int drm_setversion(DRM_IOCTL_ARGS)
|
||||||
if (sv.drm_di_major != -1) {
|
if (sv.drm_di_major != -1) {
|
||||||
if (sv.drm_di_major != DRM_IF_MAJOR ||
|
if (sv.drm_di_major != DRM_IF_MAJOR ||
|
||||||
sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR)
|
sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR)
|
||||||
return EINVAL;
|
return -EINVAL;
|
||||||
if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_di_minor);
|
if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_di_minor);
|
||||||
dev->if_version = max(if_version, dev->if_version);
|
dev->if_version = max(if_version, dev->if_version);
|
||||||
if (sv.drm_di_minor >= 1) {
|
if (sv.drm_di_minor >= 1) {
|
||||||
|
@ -357,7 +357,7 @@ int drm_setversion(DRM_IOCTL_ARGS)
|
||||||
if (sv.drm_dd_major != -1) {
|
if (sv.drm_dd_major != -1) {
|
||||||
if (sv.drm_dd_major != dev->driver->major ||
|
if (sv.drm_dd_major != dev->driver->major ||
|
||||||
sv.drm_dd_minor < 0 || sv.drm_dd_minor > dev->driver->minor)
|
sv.drm_dd_minor < 0 || sv.drm_dd_minor > dev->driver->minor)
|
||||||
return EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
if (dev->driver->set_version)
|
if (dev->driver->set_version)
|
||||||
dev->driver->set_version(dev, &sv);
|
dev->driver->set_version(dev, &sv);
|
||||||
|
|
|
@ -213,6 +213,49 @@ void drm_free_pages(unsigned long address, int order, int area)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __OS_HAS_AGP
|
#if __OS_HAS_AGP
|
||||||
|
static void *agp_remap(unsigned long offset, unsigned long size,
|
||||||
|
drm_device_t * dev)
|
||||||
|
{
|
||||||
|
unsigned long *phys_addr_map, i, num_pages =
|
||||||
|
PAGE_ALIGN(size) / PAGE_SIZE;
|
||||||
|
struct drm_agp_mem *agpmem;
|
||||||
|
struct page **page_map;
|
||||||
|
void *addr;
|
||||||
|
|
||||||
|
size = PAGE_ALIGN(size);
|
||||||
|
|
||||||
|
#ifdef __alpha__
|
||||||
|
offset -= dev->hose->mem_space->start;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
for (agpmem = dev->agp->memory; agpmem; agpmem = agpmem->next)
|
||||||
|
if (agpmem->bound <= offset
|
||||||
|
&& (agpmem->bound + (agpmem->pages << PAGE_SHIFT)) >=
|
||||||
|
(offset + size))
|
||||||
|
break;
|
||||||
|
if (!agpmem)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* OK, we're mapping AGP space on a chipset/platform on which memory accesses by
|
||||||
|
* the CPU do not get remapped by the GART. We fix this by using the kernel's
|
||||||
|
* page-table instead (that's probably faster anyhow...).
|
||||||
|
*/
|
||||||
|
/* note: use vmalloc() because num_pages could be large... */
|
||||||
|
page_map = vmalloc(num_pages * sizeof(struct page *));
|
||||||
|
if (!page_map)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
phys_addr_map =
|
||||||
|
agpmem->memory->memory + (offset - agpmem->bound) / PAGE_SIZE;
|
||||||
|
for (i = 0; i < num_pages; ++i)
|
||||||
|
page_map[i] = pfn_to_page(phys_addr_map[i] >> PAGE_SHIFT);
|
||||||
|
addr = vmap(page_map, num_pages, VM_IOREMAP, PAGE_AGP);
|
||||||
|
vfree(page_map);
|
||||||
|
|
||||||
|
return addr;
|
||||||
|
}
|
||||||
|
|
||||||
/** Wrapper around agp_allocate_memory() */
|
/** Wrapper around agp_allocate_memory() */
|
||||||
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11)
|
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,11)
|
||||||
DRM_AGP_MEM *drm_alloc_agp(drm_device_t *dev, int pages, u32 type)
|
DRM_AGP_MEM *drm_alloc_agp(drm_device_t *dev, int pages, u32 type)
|
||||||
|
@ -243,7 +286,15 @@ int drm_unbind_agp(DRM_AGP_MEM * handle)
|
||||||
{
|
{
|
||||||
return drm_agp_unbind_memory(handle);
|
return drm_agp_unbind_memory(handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else /* __OS_HAS_AGP*/
|
||||||
|
static void *agp_remap(unsigned long offset, unsigned long size,
|
||||||
|
drm_device_t * dev)
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
#endif /* agp */
|
#endif /* agp */
|
||||||
|
|
||||||
#endif /* debug_memory */
|
#endif /* debug_memory */
|
||||||
|
|
||||||
void drm_core_ioremap(struct drm_map *map, struct drm_device *dev)
|
void drm_core_ioremap(struct drm_map *map, struct drm_device *dev)
|
||||||
|
|
|
@ -57,83 +57,6 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* Find the drm_map that covers the range [offset, offset+size).
|
|
||||||
*/
|
|
||||||
static inline drm_map_t *drm_lookup_map(unsigned long offset,
|
|
||||||
unsigned long size, drm_device_t * dev)
|
|
||||||
{
|
|
||||||
struct list_head *list;
|
|
||||||
drm_map_list_t *r_list;
|
|
||||||
drm_map_t *map;
|
|
||||||
|
|
||||||
list_for_each(list, &dev->maplist->head) {
|
|
||||||
r_list = (drm_map_list_t *) list;
|
|
||||||
map = r_list->map;
|
|
||||||
if (!map)
|
|
||||||
continue;
|
|
||||||
if (map->offset <= offset
|
|
||||||
&& (offset + size) <= (map->offset + map->size))
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void *agp_remap(unsigned long offset, unsigned long size,
|
|
||||||
drm_device_t * dev)
|
|
||||||
{
|
|
||||||
unsigned long *phys_addr_map, i, num_pages =
|
|
||||||
PAGE_ALIGN(size) / PAGE_SIZE;
|
|
||||||
struct drm_agp_mem *agpmem;
|
|
||||||
struct page **page_map;
|
|
||||||
void *addr;
|
|
||||||
|
|
||||||
size = PAGE_ALIGN(size);
|
|
||||||
|
|
||||||
#ifdef __alpha__
|
|
||||||
offset -= dev->hose->mem_space->start;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (agpmem = dev->agp->memory; agpmem; agpmem = agpmem->next)
|
|
||||||
if (agpmem->bound <= offset
|
|
||||||
&& (agpmem->bound + (agpmem->pages << PAGE_SHIFT)) >=
|
|
||||||
(offset + size))
|
|
||||||
break;
|
|
||||||
if (!agpmem)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* OK, we're mapping AGP space on a chipset/platform on which memory accesses by
|
|
||||||
* the CPU do not get remapped by the GART. We fix this by using the kernel's
|
|
||||||
* page-table instead (that's probably faster anyhow...).
|
|
||||||
*/
|
|
||||||
/* note: use vmalloc() because num_pages could be large... */
|
|
||||||
page_map = vmalloc(num_pages * sizeof(struct page *));
|
|
||||||
if (!page_map)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
phys_addr_map =
|
|
||||||
agpmem->memory->memory + (offset - agpmem->bound) / PAGE_SIZE;
|
|
||||||
for (i = 0; i < num_pages; ++i)
|
|
||||||
page_map[i] = pfn_to_page(phys_addr_map[i] >> PAGE_SHIFT);
|
|
||||||
addr = vmap(page_map, num_pages, VM_IOREMAP, PAGE_AGP);
|
|
||||||
vfree(page_map);
|
|
||||||
|
|
||||||
return addr;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* __OS_HAS_AGP */
|
#else /* __OS_HAS_AGP */
|
||||||
|
|
||||||
static inline drm_map_t *drm_lookup_map(unsigned long offset,
|
|
||||||
unsigned long size, drm_device_t * dev)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void *agp_remap(unsigned long offset, unsigned long size,
|
|
||||||
drm_device_t * dev)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -137,8 +137,6 @@ static drm_mm_node_t *drm_mm_split_at_start(drm_mm_node_t *parent,
|
||||||
return child;
|
return child;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
drm_mm_node_t *drm_mm_get_block(drm_mm_node_t * parent,
|
drm_mm_node_t *drm_mm_get_block(drm_mm_node_t * parent,
|
||||||
unsigned long size, unsigned alignment)
|
unsigned long size, unsigned alignment)
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,7 +75,7 @@ static struct drm_proc_list {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#define DRM_PROC_ENTRIES (sizeof(drm_proc_list)/sizeof(drm_proc_list[0]))
|
#define DRM_PROC_ENTRIES ARRAY_SIZE(drm_proc_list)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the DRI proc filesystem for a device.
|
* Initialize the DRI proc filesystem for a device.
|
||||||
|
|
|
@ -131,7 +131,7 @@ static int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct file_operations i810_buffer_fops = {
|
static const struct file_operations i810_buffer_fops = {
|
||||||
.open = drm_open,
|
.open = drm_open,
|
||||||
.release = drm_release,
|
.release = drm_release,
|
||||||
.ioctl = drm_ioctl,
|
.ioctl = drm_ioctl,
|
||||||
|
|
|
@ -117,7 +117,7 @@ static int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct file_operations i830_buffer_fops = {
|
static const struct file_operations i830_buffer_fops = {
|
||||||
.open = drm_open,
|
.open = drm_open,
|
||||||
.release = drm_release,
|
.release = drm_release,
|
||||||
.ioctl = drm_ioctl,
|
.ioctl = drm_ioctl,
|
||||||
|
|
Loading…
Reference in New Issue