diff options
author | rnoland <rnoland@FreeBSD.org> | 2008-08-23 20:59:12 +0000 |
---|---|---|
committer | rnoland <rnoland@FreeBSD.org> | 2008-08-23 20:59:12 +0000 |
commit | 8ebfdfe248e93b41d01041a5ec069bf5761f8741 (patch) | |
tree | 702bd8b6b1d2549932511454499d13cba551297c /sys/dev/drm/drm_dma.c | |
parent | cd5da88fc1464a435965660ff2af024771c4333b (diff) | |
download | FreeBSD-src-8ebfdfe248e93b41d01041a5ec069bf5761f8741.zip FreeBSD-src-8ebfdfe248e93b41d01041a5ec069bf5761f8741.tar.gz |
Update drm kernel drivers.
This is a sync to mesa/drm pre-gem, with a few fixes on top of that.
It also contains one local patch supplied by kib@ that I can't apply to
git.master shared code.
Approved by: flz
Obtained from: mesa/drm git.master
MFC after: 2 weeks
Diffstat (limited to 'sys/dev/drm/drm_dma.c')
-rw-r--r-- | sys/dev/drm/drm_dma.c | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/sys/dev/drm/drm_dma.c b/sys/dev/drm/drm_dma.c index a8661ca..1ba3fdf 100644 --- a/sys/dev/drm/drm_dma.c +++ b/sys/dev/drm/drm_dma.c @@ -1,6 +1,3 @@ -/* drm_dma.c -- DMA IOCTL and function support -*- linux-c -*- - * Created: Fri Mar 19 14:30:16 1999 by faith@valinux.com - */ /*- * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. @@ -34,21 +31,29 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +/** @file drm_dma.c + * Support code for DMA buffer management. + * + * The implementation used to be significantly more complicated, but the + * complexity has been moved into the drivers as different buffer management + * schemes evolved. + */ + #include "dev/drm/drmP.h" -int drm_dma_setup(drm_device_t *dev) +int drm_dma_setup(struct drm_device *dev) { dev->dma = malloc(sizeof(*dev->dma), M_DRM, M_NOWAIT | M_ZERO); if (dev->dma == NULL) - return DRM_ERR(ENOMEM); + return ENOMEM; - DRM_SPININIT(dev->dma_lock, "drmdma"); + DRM_SPININIT(&dev->dma_lock, "drmdma"); return 0; } -void drm_dma_takedown(drm_device_t *dev) +void drm_dma_takedown(struct drm_device *dev) { drm_device_dma_t *dma = dev->dma; int i, j; @@ -83,27 +88,27 @@ void drm_dma_takedown(drm_device_t *dev) free(dma->pagelist, M_DRM); free(dev->dma, M_DRM); dev->dma = NULL; - DRM_SPINUNINIT(dev->dma_lock); + DRM_SPINUNINIT(&dev->dma_lock); } -void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf) +void drm_free_buffer(struct drm_device *dev, drm_buf_t *buf) { if (!buf) return; buf->pending = 0; - buf->filp = NULL; + buf->file_priv= NULL; buf->used = 0; } -void drm_reclaim_buffers(drm_device_t *dev, DRMFILE filp) +void drm_reclaim_buffers(struct drm_device *dev, struct drm_file *file_priv) { drm_device_dma_t *dma = dev->dma; int i; if (!dma) return; for (i = 0; i < dma->buf_count; i++) { - if (dma->buflist[i]->filp == filp) { + if (dma->buflist[i]->file_priv == file_priv) { switch (dma->buflist[i]->list) { case DRM_LIST_NONE: drm_free_buffer(dev, dma->buflist[i]); @@ -120,12 +125,12 @@ void drm_reclaim_buffers(drm_device_t *dev, DRMFILE filp) } /* Call into the driver-specific DMA handler */ -int drm_dma(DRM_IOCTL_ARGS) +int drm_dma(struct drm_device *dev, void *data, struct drm_file *file_priv) { - DRM_DEVICE; if (dev->driver.dma_ioctl) { - return dev->driver.dma_ioctl(kdev, cmd, data, flags, p, filp); + /* shared code returns -errno */ + return -dev->driver.dma_ioctl(dev, data, file_priv); } else { DRM_DEBUG("DMA ioctl on driver with no dma handler\n"); return EINVAL; |