make build against 2.6.20 hopefully

This commit is contained in:
Dave Airlie 2007-01-01 11:30:38 +11:00
parent 87faf62fae
commit 2dcbf6a599
5 changed files with 36 additions and 6 deletions

View file

@ -794,7 +794,11 @@ typedef struct drm_buffer_manager{
struct list_head pinned[DRM_BO_MEM_TYPES];
struct list_head unfenced;
struct list_head ddestroy;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
struct work_struct wq;
#else
struct delayed_work wq;
#endif
uint32_t fence_type;
unsigned long cur_pages;
atomic_t count;

View file

@ -352,10 +352,20 @@ static void drm_bo_delayed_delete(drm_device_t * dev, int remove_all)
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
static void drm_bo_delayed_workqueue(void *data)
#else
static void drm_bo_delayed_workqueue(struct work_struct *work)
#endif
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
drm_device_t *dev = (drm_device_t *) data;
drm_buffer_manager_t *bm = &dev->bm;
#else
drm_buffer_manager_t *bm = container_of(work, drm_buffer_manager_t, wq.work);
drm_device_t *dev = container_of(bm, drm_device_t, bm);
#endif
DRM_DEBUG("Delayed delete Worker\n");
@ -1904,7 +1914,11 @@ int drm_bo_driver_init(drm_device_t * dev)
if (ret)
goto out_unlock;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&bm->wq, &drm_bo_delayed_workqueue, dev);
#else
INIT_DELAYED_WORK(&bm->wq, drm_bo_delayed_workqueue);
#endif
bm->initialized = 1;
bm->nice_mode = 1;
atomic_set(&bm->count, 0);

View file

@ -158,7 +158,7 @@ static __inline__ void *kcalloc(size_t nmemb, size_t size, int flags)
#include <linux/mm.h>
#include <asm/page.h>
#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)) && \
#if ((LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21)) && \
(LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)))
#define DRM_ODD_MM_COMPAT
#endif
@ -208,7 +208,7 @@ extern struct page *drm_vm_ttm_fault(struct vm_area_struct *vma,
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
/*
* Hopefully, real NOPAGE_RETRY functionality will be in 2.6.19.

View file

@ -159,9 +159,9 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
}
#endif /* __OS_HAS_AGP */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) || \
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) || \
LINUX_VERSION_CODE < KERNEL_VERSION(2,6,15))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20))
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21))
static
#endif
struct page *drm_vm_ttm_fault(struct vm_area_struct *vma,
@ -508,7 +508,7 @@ static struct vm_operations_struct drm_vm_sg_ops = {
.close = drm_vm_close,
};
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21))
static struct vm_operations_struct drm_vm_ttm_ops = {
.nopage = drm_vm_ttm_nopage,
.open = drm_vm_ttm_open_wrapper,

View file

@ -498,10 +498,18 @@ via_dmablit_timer(unsigned long data)
static void
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
via_dmablit_workqueue(void *data)
#else
via_dmablit_workqueue(struct work_struct *work)
#endif
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
drm_via_blitq_t *blitq = (drm_via_blitq_t *) data;
drm_device_t *dev = blitq->dev;
#else
drm_via_blitq_t *blitq = container_of(work, drm_via_blitq_t, wq);
#endif
drm_device_t *dev = blitq->dev;
unsigned long irqsave;
drm_via_sg_info_t *cur_sg;
int cur_released;
@ -569,7 +577,11 @@ via_init_dmablit(drm_device_t *dev)
DRM_INIT_WAITQUEUE(blitq->blit_queue + j);
}
DRM_INIT_WAITQUEUE(&blitq->busy_queue);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
INIT_WORK(&blitq->wq, via_dmablit_workqueue, blitq);
#else
INIT_WORK(&blitq->wq, via_dmablit_workqueue);
#endif
init_timer(&blitq->poll_timer);
blitq->poll_timer.function = &via_dmablit_timer;
blitq->poll_timer.data = (unsigned long) blitq;