#if __OS_HAS_AGP
/**
- * Pointer to the drm_agp_t structure made available by the agpgart module.
- */
-const drm_agp_t *drm_agp = NULL;
-
-/**
* AGP information ioctl.
*
* \param inode device inode.
DRM_AGP_KERN *kern;
drm_agp_info_t info;
- if (!dev->agp || !dev->agp->acquired || !drm_agp->copy_info)
+ if (!dev->agp || !dev->agp->acquired)
return -EINVAL;
kern = &dev->agp->agp_info;
* \return zero on success or a negative number on failure.
*
* Verifies the AGP device hasn't been acquired before and calls
- * drm_agp->acquire().
+ * agp_backend_acquire().
*/
int drm_agp_acquire(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
return -ENODEV;
if (dev->agp->acquired)
return -EBUSY;
- if (!drm_agp->acquire)
- return -EINVAL;
#ifndef VMAP_4_ARGS
if (dev->agp->cant_use_aperture)
return -EINVAL;
#endif
- if ((retcode = drm_agp->acquire()))
+ if ((retcode = agp_backend_acquire()))
return retcode;
dev->agp->acquired = 1;
return 0;
* \param arg user argument.
* \return zero on success or a negative number on failure.
*
- * Verifies the AGP device has been acquired and calls drm_agp->release().
+ * Verifies the AGP device has been acquired and calls agp_backend_release().
*/
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->head->dev;
- if (!dev->agp || !dev->agp->acquired || !drm_agp->release)
+ if (!dev->agp || !dev->agp->acquired)
return -EINVAL;
- drm_agp->release();
+ agp_backend_release();
dev->agp->acquired = 0;
return 0;
/**
* Release the AGP device.
*
- * Calls drm_agp->release().
+ * Calls agp_backend_release().
*/
void drm_agp_do_release(void)
{
- if (drm_agp->release)
- drm_agp->release();
+ agp_backend_release();
}
/**
* \return zero on success or a negative number on failure.
*
* Verifies the AGP device has been acquired but not enabled, and calls
- * drm_agp->enable().
+ * agp_enable().
*/
int drm_agp_enable(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
drm_device_t *dev = priv->head->dev;
drm_agp_mode_t mode;
- if (!dev->agp || !dev->agp->acquired || !drm_agp->enable)
+ if (!dev->agp || !dev->agp->acquired)
return -EINVAL;
if (copy_from_user(&mode, (drm_agp_mode_t __user *) arg, sizeof(mode)))
return -EFAULT;
dev->agp->mode = mode.mode;
- drm_agp->enable(mode.mode);
+ agp_enable(mode.mode);
dev->agp->base = dev->agp->agp_info.aper_base;
dev->agp->enabled = 1;
return 0;
int retcode;
int page;
- if (!dev->agp || !dev->agp->acquired || !drm_agp->bind_memory)
+ if (!dev->agp || !dev->agp->acquired)
return -EINVAL;
if (copy_from_user
(&request, (drm_agp_binding_t __user *) arg, sizeof(request)))
{
drm_agp_head_t *head = NULL;
- if (drm_agp) {
- if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
- return NULL;
- memset((void *)head, 0, sizeof(*head));
- drm_agp->copy_info(&head->agp_info);
- if (head->agp_info.chipset == NOT_SUPPORTED) {
- drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS);
- return NULL;
- }
- head->memory = NULL;
-#if LINUX_VERSION_CODE <= 0x020408
- head->cant_use_aperture = 0;
- head->page_mask = ~(0xfff);
-#else
- head->cant_use_aperture = head->agp_info.cant_use_aperture;
- head->page_mask = head->agp_info.page_mask;
-#endif
+ if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
+ return NULL;
+ memset((void *)head, 0, sizeof(*head));
+ agp_copy_info(&head->agp_info);
+ if (head->agp_info.chipset == NOT_SUPPORTED) {
+ drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS);
+ return NULL;
}
+ head->memory = NULL;
+ head->cant_use_aperture = head->agp_info.cant_use_aperture;
+ head->page_mask = head->agp_info.page_mask;
return head;
}
-/** Calls drm_agp->allocate_memory() */
+/** Calls agp_allocate_memory() */
DRM_AGP_MEM *drm_agp_allocate_memory(size_t pages, u32 type)
{
- if (!drm_agp->allocate_memory)
- return NULL;
- return drm_agp->allocate_memory(pages, type);
+ return agp_allocate_memory(pages, type);
}
-/** Calls drm_agp->free_memory() */
+/** Calls agp_free_memory() */
int drm_agp_free_memory(DRM_AGP_MEM * handle)
{
- if (!handle || !drm_agp->free_memory)
+ if (!handle)
return 0;
- drm_agp->free_memory(handle);
+ agp_free_memory(handle);
return 1;
}
-/** Calls drm_agp->bind_memory() */
+/** Calls agp_bind_memory() */
int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start)
{
- if (!handle || !drm_agp->bind_memory)
+ if (!handle)
return -EINVAL;
- return drm_agp->bind_memory(handle, start);
+ return agp_bind_memory(handle, start);
}
-/** Calls drm_agp->unbind_memory() */
+/** Calls agp_unbind_memory() */
int drm_agp_unbind_memory(DRM_AGP_MEM * handle)
{
- if (!handle || !drm_agp->unbind_memory)
+ if (!handle)
return -EINVAL;
- return drm_agp->unbind_memory(handle);
+ return agp_unbind_memory(handle);
}
#endif /* __OS_HAS_AGP */