diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2012-07-18 03:17:09 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2012-10-02 23:12:53 -0400 |
commit | 8be21a6402baa502cd6475e137760afdb2b5dba8 (patch) | |
tree | f64e53b12cf06a50718f13a614dbd7b477418787 | |
parent | 017e6e2955a8b290653aa71bd321609d0d4b1486 (diff) |
drm/nouveau: pull nouveau_bo definitions into their own header
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bo.h | 92 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_channel.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_drv.h | 87 |
4 files changed, 97 insertions, 90 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.h b/drivers/gpu/drm/nouveau/nouveau_bo.h new file mode 100644 index 000000000000..a0a889cbf5ca --- /dev/null +++ b/drivers/gpu/drm/nouveau/nouveau_bo.h | |||
@@ -0,0 +1,92 @@ | |||
1 | #ifndef __NOUVEAU_BO_H__ | ||
2 | #define __NOUVEAU_BO_H__ | ||
3 | |||
4 | struct nouveau_channel; | ||
5 | struct nouveau_vma; | ||
6 | |||
7 | struct nouveau_tile_reg { | ||
8 | bool used; | ||
9 | struct nouveau_fence *fence; | ||
10 | }; | ||
11 | |||
12 | struct nouveau_bo { | ||
13 | struct ttm_buffer_object bo; | ||
14 | struct ttm_placement placement; | ||
15 | u32 valid_domains; | ||
16 | u32 placements[3]; | ||
17 | u32 busy_placements[3]; | ||
18 | struct ttm_bo_kmap_obj kmap; | ||
19 | struct list_head head; | ||
20 | |||
21 | /* protected by ttm_bo_reserve() */ | ||
22 | struct drm_file *reserved_by; | ||
23 | struct list_head entry; | ||
24 | int pbbo_index; | ||
25 | bool validate_mapped; | ||
26 | |||
27 | struct list_head vma_list; | ||
28 | unsigned page_shift; | ||
29 | |||
30 | u32 tile_mode; | ||
31 | u32 tile_flags; | ||
32 | struct nouveau_tile_reg *tile; | ||
33 | |||
34 | struct drm_gem_object *gem; | ||
35 | int pin_refcnt; | ||
36 | |||
37 | struct ttm_bo_kmap_obj dma_buf_vmap; | ||
38 | int vmapping_count; | ||
39 | }; | ||
40 | |||
41 | static inline struct nouveau_bo * | ||
42 | nouveau_bo(struct ttm_buffer_object *bo) | ||
43 | { | ||
44 | return container_of(bo, struct nouveau_bo, bo); | ||
45 | } | ||
46 | |||
47 | static inline int | ||
48 | nouveau_bo_ref(struct nouveau_bo *ref, struct nouveau_bo **pnvbo) | ||
49 | { | ||
50 | struct nouveau_bo *prev; | ||
51 | |||
52 | if (!pnvbo) | ||
53 | return -EINVAL; | ||
54 | prev = *pnvbo; | ||
55 | |||
56 | *pnvbo = ref ? nouveau_bo(ttm_bo_reference(&ref->bo)) : NULL; | ||
57 | if (prev) { | ||
58 | struct ttm_buffer_object *bo = &prev->bo; | ||
59 | |||
60 | ttm_bo_unref(&bo); | ||
61 | } | ||
62 | |||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | extern struct ttm_bo_driver nouveau_bo_driver; | ||
67 | |||
68 | void nouveau_bo_move_init(struct nouveau_channel *); | ||
69 | int nouveau_bo_new(struct drm_device *, int size, int align, u32 flags, | ||
70 | u32 tile_mode, u32 tile_flags, struct sg_table *sg, | ||
71 | struct nouveau_bo **); | ||
72 | int nouveau_bo_pin(struct nouveau_bo *, u32 flags); | ||
73 | int nouveau_bo_unpin(struct nouveau_bo *); | ||
74 | int nouveau_bo_map(struct nouveau_bo *); | ||
75 | void nouveau_bo_unmap(struct nouveau_bo *); | ||
76 | void nouveau_bo_placement_set(struct nouveau_bo *, u32 type, u32 busy); | ||
77 | u16 nouveau_bo_rd16(struct nouveau_bo *, unsigned index); | ||
78 | void nouveau_bo_wr16(struct nouveau_bo *, unsigned index, u16 val); | ||
79 | u32 nouveau_bo_rd32(struct nouveau_bo *, unsigned index); | ||
80 | void nouveau_bo_wr32(struct nouveau_bo *, unsigned index, u32 val); | ||
81 | void nouveau_bo_fence(struct nouveau_bo *, struct nouveau_fence *); | ||
82 | int nouveau_bo_validate(struct nouveau_bo *, bool interruptible, | ||
83 | bool no_wait_reserve, bool no_wait_gpu); | ||
84 | |||
85 | struct nouveau_vma * | ||
86 | nouveau_bo_vma_find(struct nouveau_bo *, struct nouveau_vm *); | ||
87 | |||
88 | int nouveau_bo_vma_add(struct nouveau_bo *, struct nouveau_vm *, | ||
89 | struct nouveau_vma *); | ||
90 | void nouveau_bo_vma_del(struct nouveau_bo *, struct nouveau_vma *); | ||
91 | |||
92 | #endif | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_channel.c b/drivers/gpu/drm/nouveau/nouveau_channel.c index b7c2423a2536..fd4d9513585e 100644 --- a/drivers/gpu/drm/nouveau/nouveau_channel.c +++ b/drivers/gpu/drm/nouveau/nouveau_channel.c | |||
@@ -32,6 +32,10 @@ | |||
32 | #include "nouveau_fence.h" | 32 | #include "nouveau_fence.h" |
33 | #include "nouveau_software.h" | 33 | #include "nouveau_software.h" |
34 | 34 | ||
35 | MODULE_PARM_DESC(vram_pushbuf, "Force DMA push buffers to be in VRAM"); | ||
36 | int nouveau_vram_pushbuf; | ||
37 | module_param_named(vram_pushbuf, nouveau_vram_pushbuf, int, 0400); | ||
38 | |||
35 | static int | 39 | static int |
36 | nouveau_channel_pushbuf_init(struct nouveau_channel *chan) | 40 | nouveau_channel_pushbuf_init(struct nouveau_channel *chan) |
37 | { | 41 | { |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.c b/drivers/gpu/drm/nouveau/nouveau_drv.c index 561bc00c4851..4b90f12575b9 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.c +++ b/drivers/gpu/drm/nouveau/nouveau_drv.c | |||
@@ -43,10 +43,6 @@ MODULE_PARM_DESC(modeset, "Enable kernel modesetting"); | |||
43 | int nouveau_modeset = -1; | 43 | int nouveau_modeset = -1; |
44 | module_param_named(modeset, nouveau_modeset, int, 0400); | 44 | module_param_named(modeset, nouveau_modeset, int, 0400); |
45 | 45 | ||
46 | MODULE_PARM_DESC(vram_pushbuf, "Force DMA push buffers to be in VRAM"); | ||
47 | int nouveau_vram_pushbuf; | ||
48 | module_param_named(vram_pushbuf, nouveau_vram_pushbuf, int, 0400); | ||
49 | |||
50 | MODULE_PARM_DESC(vram_notify, "Force DMA notifiers to be in VRAM"); | 46 | MODULE_PARM_DESC(vram_notify, "Force DMA notifiers to be in VRAM"); |
51 | int nouveau_vram_notify = 0; | 47 | int nouveau_vram_notify = 0; |
52 | module_param_named(vram_notify, nouveau_vram_notify, int, 0400); | 48 | module_param_named(vram_notify, nouveau_vram_notify, int, 0400); |
diff --git a/drivers/gpu/drm/nouveau/nouveau_drv.h b/drivers/gpu/drm/nouveau/nouveau_drv.h index 760af9286819..2374bb6f3c91 100644 --- a/drivers/gpu/drm/nouveau/nouveau_drv.h +++ b/drivers/gpu/drm/nouveau/nouveau_drv.h | |||
@@ -104,50 +104,12 @@ struct nouveau_mem; | |||
104 | #define NOUVEAU_MAX_CHANNEL_NR 4096 | 104 | #define NOUVEAU_MAX_CHANNEL_NR 4096 |
105 | #define NOUVEAU_MAX_TILE_NR 15 | 105 | #define NOUVEAU_MAX_TILE_NR 15 |
106 | 106 | ||
107 | struct nouveau_tile_reg { | 107 | #include "nouveau_bo.h" |
108 | bool used; | ||
109 | struct nouveau_fence *fence; | ||
110 | }; | ||
111 | |||
112 | struct nouveau_bo { | ||
113 | struct ttm_buffer_object bo; | ||
114 | struct ttm_placement placement; | ||
115 | u32 valid_domains; | ||
116 | u32 placements[3]; | ||
117 | u32 busy_placements[3]; | ||
118 | struct ttm_bo_kmap_obj kmap; | ||
119 | struct list_head head; | ||
120 | |||
121 | /* protected by ttm_bo_reserve() */ | ||
122 | struct drm_file *reserved_by; | ||
123 | struct list_head entry; | ||
124 | int pbbo_index; | ||
125 | bool validate_mapped; | ||
126 | |||
127 | struct list_head vma_list; | ||
128 | unsigned page_shift; | ||
129 | |||
130 | uint32_t tile_mode; | ||
131 | uint32_t tile_flags; | ||
132 | struct nouveau_tile_reg *tile; | ||
133 | |||
134 | struct drm_gem_object *gem; | ||
135 | int pin_refcnt; | ||
136 | |||
137 | struct ttm_bo_kmap_obj dma_buf_vmap; | ||
138 | int vmapping_count; | ||
139 | }; | ||
140 | 108 | ||
141 | #define nouveau_bo_tile_layout(nvbo) \ | 109 | #define nouveau_bo_tile_layout(nvbo) \ |
142 | ((nvbo)->tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK) | 110 | ((nvbo)->tile_flags & NOUVEAU_GEM_TILE_LAYOUT_MASK) |
143 | 111 | ||
144 | static inline struct nouveau_bo * | 112 | static inline struct nouveau_bo * |
145 | nouveau_bo(struct ttm_buffer_object *bo) | ||
146 | { | ||
147 | return container_of(bo, struct nouveau_bo, bo); | ||
148 | } | ||
149 | |||
150 | static inline struct nouveau_bo * | ||
151 | nouveau_gem_object(struct drm_gem_object *gem) | 113 | nouveau_gem_object(struct drm_gem_object *gem) |
152 | { | 114 | { |
153 | return gem ? gem->driver_private : NULL; | 115 | return gem ? gem->driver_private : NULL; |
@@ -591,25 +553,6 @@ nouveau_bdev(struct ttm_bo_device *bd) | |||
591 | return container_of(bd, struct drm_nouveau_private, ttm.bdev); | 553 | return container_of(bd, struct drm_nouveau_private, ttm.bdev); |
592 | } | 554 | } |
593 | 555 | ||
594 | static inline int | ||
595 | nouveau_bo_ref(struct nouveau_bo *ref, struct nouveau_bo **pnvbo) | ||
596 | { | ||
597 | struct nouveau_bo *prev; | ||
598 | |||
599 | if (!pnvbo) | ||
600 | return -EINVAL; | ||
601 | prev = *pnvbo; | ||
602 | |||
603 | *pnvbo = ref ? nouveau_bo(ttm_bo_reference(&ref->bo)) : NULL; | ||
604 | if (prev) { | ||
605 | struct ttm_buffer_object *bo = &prev->bo; | ||
606 | |||
607 | ttm_bo_unref(&bo); | ||
608 | } | ||
609 | |||
610 | return 0; | ||
611 | } | ||
612 | |||
613 | /* nouveau_drv.c */ | 556 | /* nouveau_drv.c */ |
614 | extern int nouveau_modeset; | 557 | extern int nouveau_modeset; |
615 | extern int nouveau_duallink; | 558 | extern int nouveau_duallink; |
@@ -931,34 +874,6 @@ void nvd0_display_flip_stop(struct drm_crtc *); | |||
931 | int nvd0_display_flip_next(struct drm_crtc *, struct drm_framebuffer *, | 874 | int nvd0_display_flip_next(struct drm_crtc *, struct drm_framebuffer *, |
932 | struct nouveau_channel *, u32 swap_interval); | 875 | struct nouveau_channel *, u32 swap_interval); |
933 | 876 | ||
934 | /* nouveau_bo.c */ | ||
935 | extern struct ttm_bo_driver nouveau_bo_driver; | ||
936 | extern void nouveau_bo_move_init(struct nouveau_channel *); | ||
937 | extern int nouveau_bo_new(struct drm_device *, int size, int align, | ||
938 | uint32_t flags, uint32_t tile_mode, | ||
939 | uint32_t tile_flags, | ||
940 | struct sg_table *sg, | ||
941 | struct nouveau_bo **); | ||
942 | extern int nouveau_bo_pin(struct nouveau_bo *, uint32_t flags); | ||
943 | extern int nouveau_bo_unpin(struct nouveau_bo *); | ||
944 | extern int nouveau_bo_map(struct nouveau_bo *); | ||
945 | extern void nouveau_bo_unmap(struct nouveau_bo *); | ||
946 | extern void nouveau_bo_placement_set(struct nouveau_bo *, uint32_t type, | ||
947 | uint32_t busy); | ||
948 | extern u16 nouveau_bo_rd16(struct nouveau_bo *nvbo, unsigned index); | ||
949 | extern void nouveau_bo_wr16(struct nouveau_bo *nvbo, unsigned index, u16 val); | ||
950 | extern u32 nouveau_bo_rd32(struct nouveau_bo *nvbo, unsigned index); | ||
951 | extern void nouveau_bo_wr32(struct nouveau_bo *nvbo, unsigned index, u32 val); | ||
952 | extern void nouveau_bo_fence(struct nouveau_bo *, struct nouveau_fence *); | ||
953 | extern int nouveau_bo_validate(struct nouveau_bo *, bool interruptible, | ||
954 | bool no_wait_reserve, bool no_wait_gpu); | ||
955 | |||
956 | extern struct nouveau_vma * | ||
957 | nouveau_bo_vma_find(struct nouveau_bo *, struct nouveau_vm *); | ||
958 | extern int nouveau_bo_vma_add(struct nouveau_bo *, struct nouveau_vm *, | ||
959 | struct nouveau_vma *); | ||
960 | extern void nouveau_bo_vma_del(struct nouveau_bo *, struct nouveau_vma *); | ||
961 | |||
962 | /* nouveau_gem.c */ | 877 | /* nouveau_gem.c */ |
963 | extern int nouveau_gem_new(struct drm_device *, int size, int align, | 878 | extern int nouveau_gem_new(struct drm_device *, int size, int align, |
964 | uint32_t domain, uint32_t tile_mode, | 879 | uint32_t domain, uint32_t tile_mode, |