summaryrefslogtreecommitdiff
path: root/linux-core/drmP.h
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2007-01-31 14:50:57 +0100
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2007-01-31 14:50:57 +0100
commit3024f23c6551e219b0236041a8205bf1bc60ed94 (patch)
tree87bd9deef4a55bf887a8c0978a5ad18412bc13e5 /linux-core/drmP.h
parent07fabc3fd8f00006e6117081f5183a826a6d2bbb (diff)
memory manager: Make device driver aware of different memory types.
Memory types are either fixed (on-card or pre-bound AGP) or not fixed (dynamically bound) to an aperture. They also carry information about: 1) Whether they can be mapped cached. 2) Whether they are at all mappable. 3) Whether they need an ioremap to be accessible from kernel space. In this way VRAM memory and, for example, pre-bound AGP appear identical to the memory manager. This also makes support for unmappable VRAM simple to implement.
Diffstat (limited to 'linux-core/drmP.h')
-rw-r--r--linux-core/drmP.h29
1 files changed, 22 insertions, 7 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 9c748e6e..c0064bb7 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -650,17 +650,30 @@ typedef struct drm_ref_object {
#include "drm_ttm.h"
+
+typedef struct drm_mem_type_manager {
+ int has_type;
+ int use_type;
+ drm_mm_t manager;
+ struct list_head lru;
+ struct list_head pinned;
+ uint32_t flags;
+ unsigned long io_offset;
+ unsigned long io_size;
+ void *io_addr;
+} drm_mem_type_manager_t;
+
/*
* buffer object driver
*/
typedef struct drm_bo_driver{
- int cached[DRM_BO_MEM_TYPES];
- drm_local_map_t *iomap[DRM_BO_MEM_TYPES];
drm_ttm_backend_t *(*create_ttm_backend_entry)
(struct drm_device *dev);
int (*fence_type)(uint32_t flags, uint32_t *class, uint32_t *type);
int (*invalidate_caches)(struct drm_device *dev, uint32_t flags);
+ int (*init_mem_type)(struct drm_device *dev, uint32_t type,
+ drm_mem_type_manager_t *man);
} drm_bo_driver_t;
@@ -782,16 +795,18 @@ typedef struct drm_fence_manager{
atomic_t count;
} drm_fence_manager_t;
+#define _DRM_FLAG_MEMTYPE_FIXED 0x00000001 /* Fixed (on-card) PCI memory */
+#define _DRM_FLAG_MEMTYPE_MAPPABLE 0x00000002 /* Memory mappable */
+#define _DRM_FLAG_MEMTYPE_CACHED 0x00000004 /* Supports cached binding */
+#define _DRM_FLAG_NEEDS_IOREMAP 0x00000008 /* Fixed memory needs ioremap
+ before kernel access. */
+
typedef struct drm_buffer_manager{
struct mutex init_mutex;
int nice_mode;
int initialized;
drm_file_t *last_to_validate;
- int has_type[DRM_BO_MEM_TYPES];
- int use_type[DRM_BO_MEM_TYPES];
- drm_mm_t manager[DRM_BO_MEM_TYPES];
- struct list_head lru[DRM_BO_MEM_TYPES];
- struct list_head pinned[DRM_BO_MEM_TYPES];
+ drm_mem_type_manager_t man[DRM_BO_MEM_TYPES];
struct list_head unfenced;
struct list_head ddestroy;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)