diff options
author | Rik Faith <faith@alephnull.com> | 1999-12-17 17:20:31 +0000 |
---|---|---|
committer | Rik Faith <faith@alephnull.com> | 1999-12-17 17:20:31 +0000 |
commit | 4302fe7ce0e57b11bcfc5bca57b6d517c668867c (patch) | |
tree | 72f34c2c40b1c18604f97bd09fd235473cf2418f | |
parent | 5cce83d83861c08866b1c0229e83f610da67ab9a (diff) |
Wrap all agp/gart module functions in DRM API
-rw-r--r-- | linux-core/drmP.h | 42 | ||||
-rw-r--r-- | linux-core/r128_drv.c | 9 | ||||
-rw-r--r-- | linux/agpsupport.c | 246 | ||||
-rw-r--r-- | linux/drm.h | 46 | ||||
-rw-r--r-- | linux/drmP.h | 42 | ||||
-rw-r--r-- | linux/r128_drv.c | 9 | ||||
-rw-r--r-- | shared-core/drm.h | 46 | ||||
-rw-r--r-- | shared/drm.h | 46 |
8 files changed, 427 insertions, 59 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h index f8f46191..bed720ce 100644 --- a/linux-core/drmP.h +++ b/linux-core/drmP.h @@ -1,6 +1,6 @@ /* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@dict.org - * Revised: Mon Dec 13 14:18:42 1999 by faith@dict.org + * Revised: Fri Dec 17 06:22:04 1999 by faith@dict.org * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All rights reserved. @@ -390,15 +390,23 @@ typedef struct drm_device_dma { #ifdef DRM_AGP typedef struct drm_agp_mem { - agp_memory *handle; + unsigned long handle; + agp_memory *memory; + unsigned long bound; /* address */ + int pages; + struct drm_agp_mem *prev; struct drm_agp_mem *next; } drm_agp_mem_t; -typedef struct drm_agp_info { - agp_kern_info agp_info; - const char *chipset; - drm_agp_mem_t *memory; -} drm_agp_info_t; +typedef struct drm_agp_head { + agp_kern_info agp_info; + const char *chipset; + drm_agp_mem_t *memory; + unsigned long mode; + int enabled; + int acquired; + unsigned long base; +} drm_agp_head_t; typedef struct { void (*free_memory)(agp_memory *); @@ -494,7 +502,7 @@ typedef struct drm_device { wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */ #ifdef DRM_AGP - drm_agp_info_t *agp; + drm_agp_head_t *agp; #endif } drm_device_t; @@ -686,7 +694,23 @@ extern int drm_flush_block_and_flush(drm_device_t *dev, int context, #ifdef DRM_AGP /* AGP/GART support (agpsupport.c) */ -extern drm_agp_info_t *drm_agp_init(void); +extern drm_agp_head_t *drm_agp_init(void); +extern int drm_agp_acquire(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_agp_release(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_agp_enable(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_agp_info(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_agp_alloc(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_agp_free(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_agp_unbind(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_agp_bind(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); #endif #endif #endif diff --git a/linux-core/r128_drv.c b/linux-core/r128_drv.c index eccfb7b6..deba3711 100644 --- a/linux-core/r128_drv.c +++ b/linux-core/r128_drv.c @@ -1,6 +1,6 @@ /* r128_drv.c -- ATI Rage 128 driver -*- linux-c -*- * Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com - * Revised: Mon Dec 13 14:12:33 1999 by faith@precisioninsight.com + * Revised: Fri Dec 17 06:23:07 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. @@ -228,6 +228,13 @@ static int r128_takedown(drm_device_t *dev) } dev->magiclist[i].head = dev->magiclist[i].tail = NULL; } + + /* Clear AGP information */ + if (dev->agp) { + /* FIXME -- free other information, too */ + drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); + dev->agp = NULL; + } /* Clear vma list (only built for debugging) */ if (dev->vmalist) { diff --git a/linux/agpsupport.c b/linux/agpsupport.c index 71866ed9..caffbd92 100644 --- a/linux/agpsupport.c +++ b/linux/agpsupport.c @@ -1,6 +1,6 @@ /* agpsupport.c -- DRM support for AGP/GART backend -*- linux-c -*- * Created: Mon Dec 13 09:56:45 1999 by faith@precisioninsight.com - * Revised: Mon Dec 13 15:26:28 1999 by faith@precisioninsight.com + * Revised: Fri Dec 17 06:22:05 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. @@ -34,6 +34,9 @@ drm_agp_func_t drm_agp = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL }; +/* The C standard says that 'void *' is not guaranteed to hold a function + pointer, so we use this union to define a generic pointer that is + guaranteed to hold any of the function pointers we care about. */ typedef union { void (*free_memory)(agp_memory *); agp_memory *(*allocate_memory)(size_t, u32); @@ -63,29 +66,200 @@ static drm_agp_fill_t drm_agp_fill[] = { { NULL, NULL } }; -int drm_agp_free(agp_memory *handle) +int drm_agp_info(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) { + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + agp_kern_info *kern; + drm_agp_info_t info; + + if (!dev->agp->acquired || !drm_agp.copy_info) return -EINVAL; + + kern = &dev->agp->agp_info; + info.agp_version_major = kern->version.major; + info.agp_version_minor = kern->version.minor; + info.mode = kern->mode; + info.aperture_base = kern->aper_base; + info.aperture_size = kern->aper_size * 1024 * 1024; + info.memory_allowed = kern->max_memory << PAGE_SHIFT; + info.memory_used = kern->current_memory << PAGE_SHIFT; + info.id_vendor = kern->device->vendor; + info.id_device = kern->device->device; + + copy_to_user_ret((drm_agp_info_t *)arg, &info, sizeof(info), -EFAULT); + return 0; +} + +int drm_agp_acquire(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + int retcode; + + if (dev->agp->acquired || !drm_agp.acquire) return -EINVAL; + if ((retcode = (*drm_agp.acquire)())) return retcode; + dev->agp->acquired = 1; + return 0; +} + +int drm_agp_release(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + + if (!dev->agp->acquired || !drm_agp.release) return -EINVAL; + (*drm_agp.release)(); + dev->agp->acquired = 0; + return 0; + +} + +int drm_agp_enable(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_agp_mode_t mode; + + if (!dev->agp->acquired || !drm_agp.enable) return -EINVAL; + + copy_from_user_ret(&mode, (drm_agp_mode_t *)arg, sizeof(mode), + -EFAULT); + + dev->agp->mode = mode.mode; + (*drm_agp.enable)(mode.mode); + dev->agp->base = dev->agp->agp_info.aper_base; + dev->agp->enabled = 1; + return 0; +} + +int drm_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_agp_buffer_t request; + drm_agp_mem_t *entry; + agp_memory *memory; + unsigned long pages; + + if (!dev->agp->acquired) return -EINVAL; + copy_from_user_ret(&request, (drm_agp_buffer_t *)arg, sizeof(request), + -EFAULT); + if (!(entry = drm_alloc(sizeof(*entry), DRM_MEM_AGPLISTS))) + return -ENOMEM; + + pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE; + if (!(memory = drm_alloc_agp(request.size))) { + drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); + return -ENOMEM; + } + + entry->handle = (unsigned long)memory->memory; + entry->memory = memory; + entry->bound = 0; + entry->pages = pages; + entry->prev = NULL; + entry->next = dev->agp->memory; + if (dev->agp->memory) dev->agp->memory->prev = entry; + dev->agp->memory = entry; + + request.handle = entry->handle; + if (copy_to_user((drm_agp_buffer_t *)arg, &request, sizeof(request))) { + dev->agp->memory = entry->next; + dev->agp->memory->prev = NULL; + drm_free_agp(memory, request.size); + drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); + return -EFAULT; + } return 0; } -agp_memory *allocate_memory(size_t page_count, u32 type) { return NULL; } -int bind_memory(agp_memory *curr, off_t pg_start) { return -EINVAL; } -int unbind_memory(agp_memory *curr) { return -EINVAL; } -void enable(u32 mode) { return; } -int acquire(void); - void (*release)(void); - void (*copy_info)(agp_kern_info *); +static drm_agp_mem_t *drm_agp_lookup_entry(drm_device_t *dev, + unsigned long handle) +{ + drm_agp_mem_t *entry; + + for (entry = dev->agp->memory; entry; entry = entry->next) { + if (entry->handle == handle) return entry; + } + return NULL; +} -unsigned long drm_agp_alloc(unsigned long page_count) +static int drm_agp_unbind_entry(drm_device_t *dev, drm_agp_mem_t *entry) { + if (!dev->agp->acquired || !drm_agp.unbind_memory) return -EINVAL; + return (*drm_agp.unbind_memory)(entry->memory); +} + +int drm_agp_unbind(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_agp_binding_t request; + drm_agp_mem_t *entry; + + if (!dev->agp->acquired) return -EINVAL; + copy_from_user_ret(&request, (drm_agp_binding_t *)arg, sizeof(request), + -EFAULT); + if (!(entry = drm_agp_lookup_entry(dev, request.handle))) + return -EINVAL; + if (!entry->bound) return -EINVAL; + return drm_agp_unbind_entry(dev, entry); +} + +int drm_agp_bind(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_agp_binding_t request; + drm_agp_mem_t *entry; + int retcode; + int page; + + if (!dev->agp->acquired || !drm_agp.bind_memory) return -EINVAL; + copy_from_user_ret(&request, (drm_agp_binding_t *)arg, sizeof(request), + -EFAULT); + if (!(entry = drm_agp_lookup_entry(dev, request.handle))) + return -EINVAL; + if (entry->bound) return -EINVAL; + page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE; + if ((retcode = (*drm_agp.bind_memory)(entry->memory, page))) + return retcode; + entry->bound = dev->agp->base + (page << PAGE_SHIFT); return 0; } +int drm_agp_free(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_agp_buffer_t request; + drm_agp_mem_t *entry; + + if (!dev->agp->acquired) return -EINVAL; + copy_from_user_ret(&request, (drm_agp_buffer_t *)arg, sizeof(request), + -EFAULT); + if (!(entry = drm_agp_lookup_entry(dev, request.handle))) + return -EINVAL; + drm_agp_unbind_entry(dev, entry); + entry->prev->next = entry->next; + entry->next->prev = entry->prev; + drm_free_agp(entry->memory, entry->pages); + drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); + return 0; +} -drm_agp_info_t *drm_agp_init(void) +drm_agp_head_t *drm_agp_init(void) { drm_agp_fill_t *fill; - drm_agp_info_t *info = NULL; + drm_agp_head_t *head = NULL; int agp_available = 1; for (fill = &drm_agp_fill[0]; fill->name; fill++) { @@ -96,33 +270,33 @@ drm_agp_info_t *drm_agp_init(void) } if (agp_available) { - if (!(info = drm_alloc(sizeof(*info), DRM_MEM_AGPLISTS))) + if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS))) return NULL; - (*drm_agp.copy_info)(&info->agp_info); - info->memory = NULL; - switch (info->agp_info.chipset) { - case INTEL_GENERIC: info->chipset = "Intel"; break; - case INTEL_LX: info->chipset = "Intel 440LX"; break; - case INTEL_BX: info->chipset = "Intel 440BX"; break; - case INTEL_GX: info->chipset = "Intel 440GX"; break; - case INTEL_I810: info->chipset = "Intel i810"; break; - case VIA_GENERIC: info->chipset = "VIA"; break; - case VIA_VP3: info->chipset = "VIA VP3"; break; - case VIA_MVP3: info->chipset = "VIA MVP3"; break; - case VIA_APOLLO_PRO: info->chipset = "VIA Apollo Pro"; break; - case SIS_GENERIC: info->chipset = "SiS"; break; - case AMD_GENERIC: info->chipset = "AMD"; break; - case AMD_IRONGATE: info->chipset = "AMD Irongate"; break; - case ALI_GENERIC: info->chipset = "ALi"; break; - case ALI_M1541: info->chipset = "ALi M1541"; break; + (*drm_agp.copy_info)(&head->agp_info); + head->memory = NULL; + switch (head->agp_info.chipset) { + case INTEL_GENERIC: head->chipset = "Intel"; break; + case INTEL_LX: head->chipset = "Intel 440LX"; break; + case INTEL_BX: head->chipset = "Intel 440BX"; break; + case INTEL_GX: head->chipset = "Intel 440GX"; break; + case INTEL_I810: head->chipset = "Intel i810"; break; + case VIA_GENERIC: head->chipset = "VIA"; break; + case VIA_VP3: head->chipset = "VIA VP3"; break; + case VIA_MVP3: head->chipset = "VIA MVP3"; break; + case VIA_APOLLO_PRO: head->chipset = "VIA Apollo Pro"; break; + case SIS_GENERIC: head->chipset = "SiS"; break; + case AMD_GENERIC: head->chipset = "AMD"; break; + case AMD_IRONGATE: head->chipset = "AMD Irongate"; break; + case ALI_GENERIC: head->chipset = "ALi"; break; + case ALI_M1541: head->chipset = "ALi M1541"; break; default: } DRM_INFO("AGP %d.%d on %s @ 0x%08lx %dMB\n", - info->agp_info.version.major, - info->agp_info.version.minor, - info->chipset, - info->agp_info.aper_base, - info->agp_info.aper_size); + head->agp_info.version.major, + head->agp_info.version.minor, + head->chipset, + head->agp_info.aper_base, + head->agp_info.aper_size); } - return info; + return head; } diff --git a/linux/drm.h b/linux/drm.h index 320db51e..fce73143 100644 --- a/linux/drm.h +++ b/linux/drm.h @@ -1,6 +1,6 @@ /* drm.h -- Header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com - * Revised: Mon Dec 6 17:11:19 1999 by faith@precisioninsight.com + * Revised: Fri Dec 17 06:09:37 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All rights reserved. @@ -238,6 +238,42 @@ typedef struct drm_irq_busid { int funcnum; } drm_irq_busid_t; +typedef struct drm_agp_mode { + unsigned long mode; +} drm_agp_mode_t; + + /* For drm_agp_alloc -- allocated a buffer */ +typedef struct drm_agp_buffer { + unsigned long size; /* In bytes -- will round to page boundary */ + unsigned long handle; /* Used for BIND/UNBIND ioctls */ +} drm_agp_buffer_t; + + /* For drm_agp_bind */ +typedef struct drm_agp_binding { + unsigned long handle; /* From drm_agp_buffer */ + unsigned long offset; /* In bytes -- will round to page boundary */ +} drm_agp_binding_t; + + /* For drm_addmap */ +typedef struct drm_agp_region { + unsigned long size; /* In bytes -- will round to page boundary */ + unsigned long handle; /* Used for mmap */ +} drm_agp_region_t; + +typedef struct drm_agp_info { + int agp_version_major; + int agp_version_minor; + unsigned long mode; + unsigned long aperture_base; /* physical address */ + unsigned long aperture_size; /* bytes */ + unsigned long memory_allowed; /* bytes */ + unsigned long memory_used; + + /* PCI information */ + unsigned short id_vendor; + unsigned short id_device; +} drm_agp_info_t; + #define DRM_IOCTL_BASE 'd' #define DRM_IOCTL_NR(n) _IOC_NR(n) #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) @@ -277,4 +313,12 @@ typedef struct drm_irq_busid { #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, drm_lock_t) #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, drm_lock_t) +#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) +#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) +#define DRM_IOCTL_AGP_ENABLE DRM_IOR( 0x32, drm_agp_mode_t) +#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x33, drm_agp_buffer_t) +#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x34, drm_agp_buffer_t) +#define DRM_IOCTL_AGP_BIND DRM_IOWR(0x35, drm_agp_region_t) +#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x36, drm_agp_region_t) + #endif diff --git a/linux/drmP.h b/linux/drmP.h index f8f46191..bed720ce 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -1,6 +1,6 @@ /* drmP.h -- Private header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@dict.org - * Revised: Mon Dec 13 14:18:42 1999 by faith@dict.org + * Revised: Fri Dec 17 06:22:04 1999 by faith@dict.org * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All rights reserved. @@ -390,15 +390,23 @@ typedef struct drm_device_dma { #ifdef DRM_AGP typedef struct drm_agp_mem { - agp_memory *handle; + unsigned long handle; + agp_memory *memory; + unsigned long bound; /* address */ + int pages; + struct drm_agp_mem *prev; struct drm_agp_mem *next; } drm_agp_mem_t; -typedef struct drm_agp_info { - agp_kern_info agp_info; - const char *chipset; - drm_agp_mem_t *memory; -} drm_agp_info_t; +typedef struct drm_agp_head { + agp_kern_info agp_info; + const char *chipset; + drm_agp_mem_t *memory; + unsigned long mode; + int enabled; + int acquired; + unsigned long base; +} drm_agp_head_t; typedef struct { void (*free_memory)(agp_memory *); @@ -494,7 +502,7 @@ typedef struct drm_device { wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */ #ifdef DRM_AGP - drm_agp_info_t *agp; + drm_agp_head_t *agp; #endif } drm_device_t; @@ -686,7 +694,23 @@ extern int drm_flush_block_and_flush(drm_device_t *dev, int context, #ifdef DRM_AGP /* AGP/GART support (agpsupport.c) */ -extern drm_agp_info_t *drm_agp_init(void); +extern drm_agp_head_t *drm_agp_init(void); +extern int drm_agp_acquire(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_agp_release(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_agp_enable(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_agp_info(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_agp_alloc(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_agp_free(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_agp_unbind(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int drm_agp_bind(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); #endif #endif #endif diff --git a/linux/r128_drv.c b/linux/r128_drv.c index eccfb7b6..deba3711 100644 --- a/linux/r128_drv.c +++ b/linux/r128_drv.c @@ -1,6 +1,6 @@ /* r128_drv.c -- ATI Rage 128 driver -*- linux-c -*- * Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com - * Revised: Mon Dec 13 14:12:33 1999 by faith@precisioninsight.com + * Revised: Fri Dec 17 06:23:07 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All Rights Reserved. @@ -228,6 +228,13 @@ static int r128_takedown(drm_device_t *dev) } dev->magiclist[i].head = dev->magiclist[i].tail = NULL; } + + /* Clear AGP information */ + if (dev->agp) { + /* FIXME -- free other information, too */ + drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); + dev->agp = NULL; + } /* Clear vma list (only built for debugging) */ if (dev->vmalist) { diff --git a/shared-core/drm.h b/shared-core/drm.h index 320db51e..fce73143 100644 --- a/shared-core/drm.h +++ b/shared-core/drm.h @@ -1,6 +1,6 @@ /* drm.h -- Header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com - * Revised: Mon Dec 6 17:11:19 1999 by faith@precisioninsight.com + * Revised: Fri Dec 17 06:09:37 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All rights reserved. @@ -238,6 +238,42 @@ typedef struct drm_irq_busid { int funcnum; } drm_irq_busid_t; +typedef struct drm_agp_mode { + unsigned long mode; +} drm_agp_mode_t; + + /* For drm_agp_alloc -- allocated a buffer */ +typedef struct drm_agp_buffer { + unsigned long size; /* In bytes -- will round to page boundary */ + unsigned long handle; /* Used for BIND/UNBIND ioctls */ +} drm_agp_buffer_t; + + /* For drm_agp_bind */ +typedef struct drm_agp_binding { + unsigned long handle; /* From drm_agp_buffer */ + unsigned long offset; /* In bytes -- will round to page boundary */ +} drm_agp_binding_t; + + /* For drm_addmap */ +typedef struct drm_agp_region { + unsigned long size; /* In bytes -- will round to page boundary */ + unsigned long handle; /* Used for mmap */ +} drm_agp_region_t; + +typedef struct drm_agp_info { + int agp_version_major; + int agp_version_minor; + unsigned long mode; + unsigned long aperture_base; /* physical address */ + unsigned long aperture_size; /* bytes */ + unsigned long memory_allowed; /* bytes */ + unsigned long memory_used; + + /* PCI information */ + unsigned short id_vendor; + unsigned short id_device; +} drm_agp_info_t; + #define DRM_IOCTL_BASE 'd' #define DRM_IOCTL_NR(n) _IOC_NR(n) #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) @@ -277,4 +313,12 @@ typedef struct drm_irq_busid { #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, drm_lock_t) #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, drm_lock_t) +#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) +#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) +#define DRM_IOCTL_AGP_ENABLE DRM_IOR( 0x32, drm_agp_mode_t) +#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x33, drm_agp_buffer_t) +#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x34, drm_agp_buffer_t) +#define DRM_IOCTL_AGP_BIND DRM_IOWR(0x35, drm_agp_region_t) +#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x36, drm_agp_region_t) + #endif diff --git a/shared/drm.h b/shared/drm.h index 320db51e..fce73143 100644 --- a/shared/drm.h +++ b/shared/drm.h @@ -1,6 +1,6 @@ /* drm.h -- Header for Direct Rendering Manager -*- linux-c -*- * Created: Mon Jan 4 10:05:05 1999 by faith@precisioninsight.com - * Revised: Mon Dec 6 17:11:19 1999 by faith@precisioninsight.com + * Revised: Fri Dec 17 06:09:37 1999 by faith@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * All rights reserved. @@ -238,6 +238,42 @@ typedef struct drm_irq_busid { int funcnum; } drm_irq_busid_t; +typedef struct drm_agp_mode { + unsigned long mode; +} drm_agp_mode_t; + + /* For drm_agp_alloc -- allocated a buffer */ +typedef struct drm_agp_buffer { + unsigned long size; /* In bytes -- will round to page boundary */ + unsigned long handle; /* Used for BIND/UNBIND ioctls */ +} drm_agp_buffer_t; + + /* For drm_agp_bind */ +typedef struct drm_agp_binding { + unsigned long handle; /* From drm_agp_buffer */ + unsigned long offset; /* In bytes -- will round to page boundary */ +} drm_agp_binding_t; + + /* For drm_addmap */ +typedef struct drm_agp_region { + unsigned long size; /* In bytes -- will round to page boundary */ + unsigned long handle; /* Used for mmap */ +} drm_agp_region_t; + +typedef struct drm_agp_info { + int agp_version_major; + int agp_version_minor; + unsigned long mode; + unsigned long aperture_base; /* physical address */ + unsigned long aperture_size; /* bytes */ + unsigned long memory_allowed; /* bytes */ + unsigned long memory_used; + + /* PCI information */ + unsigned short id_vendor; + unsigned short id_device; +} drm_agp_info_t; + #define DRM_IOCTL_BASE 'd' #define DRM_IOCTL_NR(n) _IOC_NR(n) #define DRM_IO(nr) _IO(DRM_IOCTL_BASE,nr) @@ -277,4 +313,12 @@ typedef struct drm_irq_busid { #define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, drm_lock_t) #define DRM_IOCTL_FINISH DRM_IOW( 0x2c, drm_lock_t) +#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) +#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) +#define DRM_IOCTL_AGP_ENABLE DRM_IOR( 0x32, drm_agp_mode_t) +#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x33, drm_agp_buffer_t) +#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x34, drm_agp_buffer_t) +#define DRM_IOCTL_AGP_BIND DRM_IOWR(0x35, drm_agp_region_t) +#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x36, drm_agp_region_t) + #endif |