1
2
3
4
5
6
7
8 #ifndef _PSB_GTT_H_
9 #define _PSB_GTT_H_
10
11 #include <drm/drm_gem.h>
12
13
14 struct psb_gtt {
15 uint32_t gatt_start;
16 uint32_t mmu_gatt_start;
17 uint32_t gtt_start;
18 uint32_t gtt_phys_start;
19 unsigned gtt_pages;
20 unsigned gatt_pages;
21 unsigned long stolen_size;
22 unsigned long vram_stolen_size;
23 struct rw_semaphore sem;
24 };
25
26
27 extern int psb_gtt_init(struct drm_device *dev, int resume);
28 extern void psb_gtt_takedown(struct drm_device *dev);
29
30
31 struct gtt_range {
32 struct resource resource;
33 u32 offset;
34 struct drm_gem_object gem;
35 int in_gart;
36 bool stolen;
37 bool mmapping;
38 struct page **pages;
39 int npage;
40 int roll;
41 };
42
43 #define to_gtt_range(x) container_of(x, struct gtt_range, gem)
44
45 extern struct gtt_range *psb_gtt_alloc_range(struct drm_device *dev, int len,
46 const char *name, int backed,
47 u32 align);
48 extern void psb_gtt_kref_put(struct gtt_range *gt);
49 extern void psb_gtt_free_range(struct drm_device *dev, struct gtt_range *gt);
50 extern int psb_gtt_pin(struct gtt_range *gt);
51 extern void psb_gtt_unpin(struct gtt_range *gt);
52 extern void psb_gtt_roll(struct drm_device *dev,
53 struct gtt_range *gt, int roll);
54 extern int psb_gtt_restore(struct drm_device *dev);
55 #endif