Skip to content

Commit

Permalink
drm: major update from CVS for radeon and core
Browse files Browse the repository at this point in the history
This patch pull in a lot of changes from CVS to the main core DRM,
and updates the radeon driver to 1.21.0 that supports r300 texrect
and radeon card type ioctl.

Signed-off-by: Dave Airlie <airlied@linux.ie>
  • Loading branch information
Dave Airlie authored and Dave Airlie committed Jan 2, 2006
1 parent b0cae66 commit d985c10
Show file tree
Hide file tree
Showing 12 changed files with 366 additions and 381 deletions.
18 changes: 6 additions & 12 deletions drivers/char/drm/drmP.h
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ struct drm_driver {
int (*kernel_context_switch) (struct drm_device * dev, int old,
int new);
void (*kernel_context_switch_unlock) (struct drm_device * dev,
drm_lock_t * lock);
drm_lock_t *lock);
int (*vblank_wait) (struct drm_device * dev, unsigned int *sequence);
int (*dri_library_name) (struct drm_device *dev, char *buf);

Expand All @@ -574,12 +574,11 @@ struct drm_driver {
void (*irq_postinstall) (struct drm_device * dev);
void (*irq_uninstall) (struct drm_device * dev);
void (*reclaim_buffers) (struct drm_device * dev, struct file * filp);
void (*reclaim_buffers_locked) (struct drm_device *drv,
void (*reclaim_buffers_locked) (struct drm_device *dev,
struct file *filp);
unsigned long (*get_map_ofs) (drm_map_t * map);
unsigned long (*get_reg_ofs) (struct drm_device * dev);
void (*set_version) (struct drm_device * dev, drm_set_version_t * sv);
int (*version) (drm_version_t * version);

int major;
int minor;
Expand Down Expand Up @@ -774,10 +773,6 @@ static inline int drm_mtrr_del(int handle, unsigned long offset,
/** \name Internal function definitions */
/*@{*/

/* Misc. support (drm_init.h) */
extern int drm_flags;
extern void drm_parse_options(char *s);

/* Driver support (drm_drv.h) */
extern int drm_init(struct drm_driver *driver);
extern void drm_exit(struct drm_driver *driver);
Expand Down Expand Up @@ -831,6 +826,8 @@ extern int drm_getstats(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_setversion(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_noop(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);

/* Context IOCTL support (drm_context.h) */
extern int drm_resctx(struct inode *inode, struct file *filp,
Expand Down Expand Up @@ -869,10 +866,6 @@ extern int drm_getmagic(struct inode *inode, struct file *filp,
extern int drm_authmagic(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);

/* Placeholder for ioctls past */
extern int drm_noop(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);

/* Locking IOCTL support (drm_lock.h) */
extern int drm_lock(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
Expand All @@ -885,6 +878,7 @@ extern int drm_lock_free(drm_device_t * dev,
/* Buffer management support (drm_bufs.h) */
extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request);
extern int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request);
extern int drm_addbufs_fb(drm_device_t *dev, drm_buf_desc_t *request);
extern int drm_addmap(drm_device_t * dev, unsigned int offset,
unsigned int size, drm_map_type_t type,
drm_map_flags_t flags, drm_local_map_t ** map_ptr);
Expand Down Expand Up @@ -920,8 +914,8 @@ extern void drm_core_reclaim_buffers(drm_device_t * dev, struct file *filp);
/* IRQ support (drm_irq.h) */
extern int drm_control(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_irq_uninstall(drm_device_t * dev);
extern irqreturn_t drm_irq_handler(DRM_IRQ_ARGS);
extern int drm_irq_uninstall(drm_device_t * dev);
extern void drm_driver_irq_preinstall(drm_device_t * dev);
extern void drm_driver_irq_postinstall(drm_device_t * dev);
extern void drm_driver_irq_uninstall(drm_device_t * dev);
Expand Down
10 changes: 6 additions & 4 deletions drivers/char/drm/drm_agpsupport.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* \file drm_agpsupport.h
* \file drm_agpsupport.c
* DRM support for AGP/GART backend
*
* \author Rickard E. (Rik) Faith <faith@valinux.com>
Expand Down Expand Up @@ -91,7 +91,7 @@ int drm_agp_info_ioctl(struct inode *inode, struct file *filp,
/**
* Acquire the AGP device.
*
* \param dev DRM device that is to acquire AGP
* \param dev DRM device that is to acquire AGP.
* \return zero on success or a negative number on failure.
*
* Verifies the AGP device hasn't been acquired before and calls
Expand Down Expand Up @@ -134,7 +134,7 @@ int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp,
/**
* Release the AGP device.
*
* \param dev DRM device that is to release AGP
* \param dev DRM device that is to release AGP.
* \return zero on success or a negative number on failure.
*
* Verifies the AGP device has been acquired and calls \c agp_backend_release.
Expand All @@ -147,7 +147,6 @@ int drm_agp_release(drm_device_t * dev)
dev->agp->acquired = 0;
return 0;
}

EXPORT_SYMBOL(drm_agp_release);

int drm_agp_release_ioctl(struct inode *inode, struct file *filp,
Expand Down Expand Up @@ -447,6 +446,9 @@ int drm_agp_free_ioctl(struct inode *inode, struct file *filp,
*
* \return pointer to a drm_agp_head structure.
*
* Gets the drm_agp_t structure which is made available by the agpgart module
* via the inter_module_* functions. Creates and initializes a drm_agp_head
* structure.
*/
drm_agp_head_t *drm_agp_init(drm_device_t * dev)
{
Expand Down
47 changes: 32 additions & 15 deletions drivers/char/drm/drm_bufs.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,22 +36,21 @@
#include <linux/vmalloc.h>
#include "drmP.h"

unsigned long drm_get_resource_start(drm_device_t * dev, unsigned int resource)
unsigned long drm_get_resource_start(drm_device_t *dev, unsigned int resource)
{
return pci_resource_start(dev->pdev, resource);
}

EXPORT_SYMBOL(drm_get_resource_start);

unsigned long drm_get_resource_len(drm_device_t * dev, unsigned int resource)
unsigned long drm_get_resource_len(drm_device_t *dev, unsigned int resource)
{
return pci_resource_len(dev->pdev, resource);
}

EXPORT_SYMBOL(drm_get_resource_len);

static drm_map_list_t *drm_find_matching_map(drm_device_t * dev,
drm_local_map_t * map)
static drm_map_list_t *drm_find_matching_map(drm_device_t *dev,
drm_local_map_t *map)
{
struct list_head *list;

Expand All @@ -74,7 +73,7 @@ static drm_map_list_t *drm_find_matching_map(drm_device_t * dev,

#ifdef _LP64
static __inline__ unsigned int HandleID(unsigned long lhandle,
drm_device_t * dev)
drm_device_t *dev)
{
static unsigned int map32_handle = START_RANGE;
unsigned int hash;
Expand Down Expand Up @@ -301,6 +300,9 @@ int drm_addmap_ioctl(struct inode *inode, struct file *filp,
return -EFAULT;
}

if (!(capable(CAP_SYS_ADMIN) || map.type == _DRM_AGP))
return -EPERM;

err = drm_addmap_core(dev, map.offset, map.size, map.type, map.flags,
&maplist);

Expand Down Expand Up @@ -332,7 +334,7 @@ int drm_addmap_ioctl(struct inode *inode, struct file *filp,
*
* \sa drm_addmap
*/
int drm_rmmap_locked(drm_device_t * dev, drm_local_map_t * map)
int drm_rmmap_locked(drm_device_t *dev, drm_local_map_t *map)
{
struct list_head *list;
drm_map_list_t *r_list = NULL;
Expand Down Expand Up @@ -384,10 +386,9 @@ int drm_rmmap_locked(drm_device_t * dev, drm_local_map_t * map)

return 0;
}

EXPORT_SYMBOL(drm_rmmap_locked);

int drm_rmmap(drm_device_t * dev, drm_local_map_t * map)
int drm_rmmap(drm_device_t *dev, drm_local_map_t *map)
{
int ret;

Expand All @@ -397,7 +398,6 @@ int drm_rmmap(drm_device_t * dev, drm_local_map_t * map)

return ret;
}

EXPORT_SYMBOL(drm_rmmap);

/* The rmmap ioctl appears to be unnecessary. All mappings are torn down on
Expand Down Expand Up @@ -548,7 +548,7 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request)
DRM_DEBUG("count: %d\n", count);
DRM_DEBUG("order: %d\n", order);
DRM_DEBUG("size: %d\n", size);
DRM_DEBUG("agp_offset: %lu\n", agp_offset);
DRM_DEBUG("agp_offset: %lx\n", agp_offset);
DRM_DEBUG("alignment: %d\n", alignment);
DRM_DEBUG("page_order: %d\n", page_order);
DRM_DEBUG("total: %d\n", total);
Expand Down Expand Up @@ -649,6 +649,8 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request)
}

dma->buf_count += entry->buf_count;
dma->seg_count += entry->seg_count;
dma->page_count += byte_count >> PAGE_SHIFT;
dma->byte_count += byte_count;

DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
Expand All @@ -664,7 +666,6 @@ int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request)
atomic_dec(&dev->buf_alloc);
return 0;
}

EXPORT_SYMBOL(drm_addbufs_agp);
#endif /* __OS_HAS_AGP */

Expand All @@ -689,9 +690,13 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request)

if (!drm_core_check_feature(dev, DRIVER_PCI_DMA))
return -EINVAL;

if (!dma)
return -EINVAL;

if (!capable(CAP_SYS_ADMIN))
return -EPERM;

count = request->count;
order = drm_order(request->size);
size = 1 << order;
Expand Down Expand Up @@ -882,7 +887,6 @@ int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request)
return 0;

}

EXPORT_SYMBOL(drm_addbufs_pci);

static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request)
Expand All @@ -908,6 +912,9 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request)
if (!dma)
return -EINVAL;

if (!capable(CAP_SYS_ADMIN))
return -EPERM;

count = request->count;
order = drm_order(request->size);
size = 1 << order;
Expand Down Expand Up @@ -1026,6 +1033,8 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request)
}

dma->buf_count += entry->buf_count;
dma->seg_count += entry->seg_count;
dma->page_count += byte_count >> PAGE_SHIFT;
dma->byte_count += byte_count;

DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
Expand All @@ -1042,7 +1051,7 @@ static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request)
return 0;
}

static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request)
int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request)
{
drm_device_dma_t *dma = dev->dma;
drm_buf_entry_t *entry;
Expand All @@ -1065,6 +1074,9 @@ static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request)
if (!dma)
return -EINVAL;

if (!capable(CAP_SYS_ADMIN))
return -EPERM;

count = request->count;
order = drm_order(request->size);
size = 1 << order;
Expand Down Expand Up @@ -1181,6 +1193,8 @@ static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request)
}

dma->buf_count += entry->buf_count;
dma->seg_count += entry->seg_count;
dma->page_count += byte_count >> PAGE_SHIFT;
dma->byte_count += byte_count;

DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
Expand All @@ -1196,6 +1210,8 @@ static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request)
atomic_dec(&dev->buf_alloc);
return 0;
}
EXPORT_SYMBOL(drm_addbufs_fb);


/**
* Add buffers for DMA transfers (ioctl).
Expand Down Expand Up @@ -1577,5 +1593,6 @@ int drm_order(unsigned long size)

return order;
}

EXPORT_SYMBOL(drm_order);


Loading

0 comments on commit d985c10

Please sign in to comment.