aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drmP.h
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas@tungstengraphics.com>2006-08-07 07:30:28 -0400
committerDave Airlie <airlied@linux.ie>2006-09-21 15:32:31 -0400
commit3a1bd924f36da202e480a0e0174b2878c0924a05 (patch)
treeffae75227509c612a12dc1abb4f9b717de185054 /drivers/char/drm/drmP.h
parentb9b603dd1c99a68e65ad51cda25379441df2e17b (diff)
drm: add simple DRM memory manager, and hash table
This adds the DRM hashtable and simple memory manager implementations from Tungsten Graphics, this is NOT the new memory manager, this is a replacement for the SIS and VIA memory managers. Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/drmP.h')
-rw-r--r--drivers/char/drm/drmP.h33
1 files changed, 32 insertions, 1 deletions
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 4f0de974c191..c93985bb91a2 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -79,6 +79,7 @@
79#define __OS_HAS_MTRR (defined(CONFIG_MTRR)) 79#define __OS_HAS_MTRR (defined(CONFIG_MTRR))
80 80
81#include "drm_os_linux.h" 81#include "drm_os_linux.h"
82#include "drm_hashtab.h"
82 83
83/***********************************************************************/ 84/***********************************************************************/
84/** \name DRM template customization defaults */ 85/** \name DRM template customization defaults */
@@ -134,7 +135,9 @@
134#define DRM_MEM_CTXBITMAP 18 135#define DRM_MEM_CTXBITMAP 18
135#define DRM_MEM_STUB 19 136#define DRM_MEM_STUB 19
136#define DRM_MEM_SGLISTS 20 137#define DRM_MEM_SGLISTS 20
137#define DRM_MEM_CTXLIST 21 138#define DRM_MEM_CTXLIST 21
139#define DRM_MEM_MM 22
140#define DRM_MEM_HASHTAB 23
138 141
139#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8) 142#define DRM_MAX_CTXBITMAP (PAGE_SIZE * 8)
140 143
@@ -515,6 +518,22 @@ typedef struct ati_pcigart_info {
515 drm_local_map_t mapping; 518 drm_local_map_t mapping;
516} drm_ati_pcigart_info; 519} drm_ati_pcigart_info;
517 520
521/*
522 * Generic memory manager structs
523 */
524typedef struct drm_mm_node {
525 struct list_head fl_entry;
526 struct list_head ml_entry;
527 int free;
528 unsigned long start;
529 unsigned long size;
530 void *private;
531} drm_mm_node_t;
532
533typedef struct drm_mm {
534 drm_mm_node_t root_node;
535} drm_mm_t;
536
518/** 537/**
519 * DRM driver structure. This structure represent the common code for 538 * DRM driver structure. This structure represent the common code for
520 * a family of cards. There will one drm_device for each card present 539 * a family of cards. There will one drm_device for each card present
@@ -1001,6 +1020,18 @@ extern struct class_device *drm_sysfs_device_add(struct class *cs,
1001 drm_head_t *head); 1020 drm_head_t *head);
1002extern void drm_sysfs_device_remove(struct class_device *class_dev); 1021extern void drm_sysfs_device_remove(struct class_device *class_dev);
1003 1022
1023/*
1024 * Basic memory manager support (drm_mm.c)
1025 */
1026extern drm_mm_node_t *drm_mm_get_block(drm_mm_node_t * parent,
1027 unsigned long size,
1028 unsigned alignment);
1029extern void drm_mm_put_block(drm_mm_t *mm, drm_mm_node_t *cur);
1030extern drm_mm_node_t *drm_mm_search_free(const drm_mm_t *mm, unsigned long size,
1031 unsigned alignment, int best_match);
1032extern int drm_mm_init(drm_mm_t *mm, unsigned long start, unsigned long size);
1033extern void drm_mm_takedown(drm_mm_t *mm);
1034
1004/* Inline replacements for DRM_IOREMAP macros */ 1035/* Inline replacements for DRM_IOREMAP macros */
1005static __inline__ void drm_core_ioremap(struct drm_map *map, 1036static __inline__ void drm_core_ioremap(struct drm_map *map,
1006 struct drm_device *dev) 1037 struct drm_device *dev)