From 4d2a4455b4e7bc65952aa6167c34b488c4ca3b8d Mon Sep 17 00:00:00 2001 From: Gareth Hughes Date: Wed, 24 Jan 2001 15:34:46 +0000 Subject: - Misc cleanups. - Fix drmR128Clear parameters (Radeon to follow). - Add some helper macros to r128/radeon kernel modules. --- linux/drmP.h | 51 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 15 deletions(-) (limited to 'linux/drmP.h') diff --git a/linux/drmP.h b/linux/drmP.h index affeae70..9a8fe61f 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -23,10 +23,10 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * * Authors: * Rickard E. (Rik) Faith - * + * */ #ifndef _DRM_P_H_ @@ -284,6 +284,27 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, len += sprintf(&buf[len], fmt , ##arg); \ if (len > DRM_PROC_LIMIT) { ret; return len; } + /* Mapping helper macros */ +#define DRM_IOREMAP(map) \ + (map)->handle = drm_ioremap( (map)->offset, (map)->size ) + +#define DRM_IOREMAPFREE(map) \ + do { \ + if ( (map)->handle && (map)->size ) \ + drm_ioremapfree( (map)->handle, (map)->size ); \ + } while (0) + +#define DRM_FIND_MAP(map, o) \ + do { \ + int i; \ + for ( i = 0 ; i < dev->map_count ; i++ ) { \ + if ( dev->maplist[i]->offset == o ) { \ + map = dev->maplist[i]; \ + break; \ + } \ + } \ + } while (0) + /* Internal types and structures */ #define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) #define DRM_MIN(a,b) ((a)<(b)?(a):(b)) @@ -304,7 +325,7 @@ typedef struct drm_ioctl_desc { typedef struct drm_devstate { pid_t owner; /* X server pid holding x_lock */ - + } drm_devstate_t; typedef struct drm_magic_entry { @@ -365,14 +386,14 @@ typedef struct drm_buf { #define DRM_DMA_HISTOGRAM_NEXT(current) ((current)*10) typedef struct drm_histogram { atomic_t total; - + atomic_t queued_to_dispatched[DRM_DMA_HISTOGRAM_SLOTS]; atomic_t dispatched_to_completed[DRM_DMA_HISTOGRAM_SLOTS]; atomic_t completed_to_freed[DRM_DMA_HISTOGRAM_SLOTS]; - + atomic_t queued_to_completed[DRM_DMA_HISTOGRAM_SLOTS]; atomic_t queued_to_freed[DRM_DMA_HISTOGRAM_SLOTS]; - + atomic_t dma[DRM_DMA_HISTOGRAM_SLOTS]; atomic_t schedule[DRM_DMA_HISTOGRAM_SLOTS]; atomic_t ctx[DRM_DMA_HISTOGRAM_SLOTS]; @@ -396,7 +417,7 @@ typedef struct drm_freelist { int initialized; /* Freelist in use */ atomic_t count; /* Number of free buffers */ drm_buf_t *next; /* End pointer */ - + wait_queue_head_t waiting; /* Processes waiting on free bufs */ int low_mark; /* Low water mark */ int high_mark; /* High water mark */ @@ -462,7 +483,7 @@ typedef struct drm_device_dma { atomic_t total_prio; /* Total DRM_DMA_PRIORITY */ atomic_t total_bytes; /* Total bytes DMA'd */ atomic_t total_dmas; /* Total DMA buffers dispatched */ - + atomic_t total_missed_dma; /* Missed drm_do_dma */ atomic_t total_missed_lock; /* Missed lock in drm_do_dma */ atomic_t total_missed_free; /* Missed drm_free_this_buffer */ @@ -475,7 +496,7 @@ typedef struct drm_device_dma { drm_buf_entry_t bufs[DRM_MAX_ORDER+1]; int buf_count; drm_buf_t **buflist; /* Vector of pointers info bufs */ - int seg_count; + int seg_count; int page_count; unsigned long *pagelist; unsigned long byte_count; @@ -523,7 +544,7 @@ typedef struct drm_device { int unique_len; /* Length of unique field */ dev_t device; /* Device number for mknod */ char *devname; /* For /proc/interrupts */ - + int blocked; /* Blocked due to VC switch? */ struct proc_dir_entry *root; /* Root for this device's entries */ @@ -544,7 +565,7 @@ typedef struct drm_device { atomic_t total_ioctl; atomic_t total_irq; /* Total interruptions */ atomic_t total_ctx; /* Total context switches */ - + atomic_t total_locks; atomic_t total_unlocks; atomic_t total_contends; @@ -585,7 +606,7 @@ typedef struct drm_device { #if DRM_DMA_HISTOGRAM drm_histogram_t histo; #endif - + /* Callback to X server for context switch and for heavy-handed reset. */ char buf[DRM_BSZ]; /* Output buffer */ @@ -595,7 +616,7 @@ typedef struct drm_device { struct fasync_struct *buf_async;/* Processes waiting for SIGIO */ wait_queue_head_t buf_readers; /* Processes waiting to read */ wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */ - + #if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) drm_agp_head_t *agp; #endif -- cgit v1.2.3