diff options
author | Lajos Molnar <molnar@ti.com> | 2011-06-09 19:03:40 -0400 |
---|---|---|
committer | Paolo Pisati <paolo.pisati@canonical.com> | 2012-08-17 04:19:05 -0400 |
commit | 9738e24afc9dc2da2e5c3931f5857fd7352a5c4c (patch) | |
tree | 5d70ede02d35cf117aaa777da952aec2759e72f2 | |
parent | 5b191eabfebfdb7ae950c73ac325d7857b977e92 (diff) |
OMAP: TILER: Expose 1D mapping/unmapping operations
Expose kernel methods to map a set of physical pages into TILER 1D
(reserve area + pin memory), and free those areas.
Signed-off-by: Lajos Molnar <molnar@ti.com>
-rw-r--r-- | arch/arm/mach-omap2/include/mach/tiler.h | 24 | ||||
-rw-r--r-- | drivers/media/video/tiler/_tiler.h | 16 | ||||
-rw-r--r-- | drivers/media/video/tiler/tiler-iface.c | 2 | ||||
-rw-r--r-- | drivers/media/video/tiler/tiler-main.c | 18 |
4 files changed, 45 insertions, 15 deletions
diff --git a/arch/arm/mach-omap2/include/mach/tiler.h b/arch/arm/mach-omap2/include/mach/tiler.h index aef6dab0222..20a1b362459 100644 --- a/arch/arm/mach-omap2/include/mach/tiler.h +++ b/arch/arm/mach-omap2/include/mach/tiler.h | |||
@@ -354,6 +354,30 @@ s32 tilview_rotate(struct tiler_view_t *view, s32 rotation); | |||
354 | s32 tilview_flip(struct tiler_view_t *view, bool flip_x, bool flip_y); | 354 | s32 tilview_flip(struct tiler_view_t *view, bool flip_x, bool flip_y); |
355 | 355 | ||
356 | /* | 356 | /* |
357 | * -------------------- TILER hooks for ION/HWC migration -------------------- | ||
358 | */ | ||
359 | |||
360 | /* type of tiler memory */ | ||
361 | enum tiler_memtype { | ||
362 | TILER_MEM_ALLOCED, /* tiler allocated the memory */ | ||
363 | TILER_MEM_GOT_PAGES, /* tiler used get_user_pages */ | ||
364 | TILER_MEM_USING, /* tiler is using the pages */ | ||
365 | }; | ||
366 | |||
367 | /* physical pages to pin - mem must be kmalloced */ | ||
368 | struct tiler_pa_info { | ||
369 | u32 num_pg; /* number of pages in page-list */ | ||
370 | u32 *mem; /* list of phys page addresses */ | ||
371 | enum tiler_memtype memtype; /* how we got physical pages */ | ||
372 | }; | ||
373 | |||
374 | typedef struct mem_info *tiler_blk_handle; | ||
375 | |||
376 | /* NOTE: this will take ownership pa->mem (will free it) */ | ||
377 | tiler_blk_handle tiler_map_1d_block(struct tiler_pa_info *pa); | ||
378 | void tiler_free_block(tiler_blk_handle block); | ||
379 | |||
380 | /* | ||
357 | * ---------------------------- IOCTL Definitions ---------------------------- | 381 | * ---------------------------- IOCTL Definitions ---------------------------- |
358 | */ | 382 | */ |
359 | 383 | ||
diff --git a/drivers/media/video/tiler/_tiler.h b/drivers/media/video/tiler/_tiler.h index 372444c4d45..742b31596d7 100644 --- a/drivers/media/video/tiler/_tiler.h +++ b/drivers/media/video/tiler/_tiler.h | |||
@@ -57,20 +57,6 @@ struct area_info { | |||
57 | struct gid_info *gi; /* link to parent, if still alive */ | 57 | struct gid_info *gi; /* link to parent, if still alive */ |
58 | }; | 58 | }; |
59 | 59 | ||
60 | /* type of tiler memory */ | ||
61 | enum tiler_memtype { | ||
62 | TILER_MEM_ALLOCED, /* tiler allocated the memory */ | ||
63 | TILER_MEM_GOT_PAGES, /* tiler used get_user_pages */ | ||
64 | TILER_MEM_USING, /* tiler is using the pages */ | ||
65 | }; | ||
66 | |||
67 | /* physical pages to pin */ | ||
68 | struct tiler_pa_info { | ||
69 | u32 num_pg; /* number of pages in page-list */ | ||
70 | u32 *mem; /* list of phys page addresses */ | ||
71 | enum tiler_memtype memtype; /* how we got physical pages */ | ||
72 | }; | ||
73 | |||
74 | /* info for a block */ | 60 | /* info for a block */ |
75 | struct mem_info { | 61 | struct mem_info { |
76 | struct list_head global; /* reserved / global blocks */ | 62 | struct list_head global; /* reserved / global blocks */ |
@@ -156,4 +142,6 @@ void tiler_iface_init(struct tiler_ops *tiler); | |||
156 | void tiler_geom_init(struct tiler_ops *tiler); | 142 | void tiler_geom_init(struct tiler_ops *tiler); |
157 | void tiler_reserve_init(struct tiler_ops *tiler); | 143 | void tiler_reserve_init(struct tiler_ops *tiler); |
158 | 144 | ||
145 | struct process_info *__get_pi(pid_t pid, bool kernel); | ||
146 | |||
159 | #endif | 147 | #endif |
diff --git a/drivers/media/video/tiler/tiler-iface.c b/drivers/media/video/tiler/tiler-iface.c index eb396c58c81..1c4894a8139 100644 --- a/drivers/media/video/tiler/tiler-iface.c +++ b/drivers/media/video/tiler/tiler-iface.c | |||
@@ -183,7 +183,7 @@ static void _m_unregister_buf(struct __buf_info *_b) | |||
183 | */ | 183 | */ |
184 | 184 | ||
185 | /* get process info, and increment refs for device tracking */ | 185 | /* get process info, and increment refs for device tracking */ |
186 | static struct process_info *__get_pi(pid_t pid, bool kernel) | 186 | struct process_info *__get_pi(pid_t pid, bool kernel) |
187 | { | 187 | { |
188 | struct process_info *pi; | 188 | struct process_info *pi; |
189 | 189 | ||
diff --git a/drivers/media/video/tiler/tiler-main.c b/drivers/media/video/tiler/tiler-main.c index 93f66777ff1..c6e729d3c57 100644 --- a/drivers/media/video/tiler/tiler-main.c +++ b/drivers/media/video/tiler/tiler-main.c | |||
@@ -1360,6 +1360,24 @@ static void __exit tiler_exit(void) | |||
1360 | class_destroy(tilerdev_class); | 1360 | class_destroy(tilerdev_class); |
1361 | } | 1361 | } |
1362 | 1362 | ||
1363 | tiler_blk_handle tiler_map_1d_block(struct tiler_pa_info *pa) | ||
1364 | { | ||
1365 | struct mem_info *mi = NULL; | ||
1366 | struct tiler_pa_info *pa_tmp = kmemdup(pa, sizeof(*pa), GFP_KERNEL); | ||
1367 | s32 res = map_any_block(TILFMT_PAGE, pa->num_pg << PAGE_SHIFT, 1, 0, 0, | ||
1368 | __get_pi(0, true), &mi, pa_tmp); | ||
1369 | return res ? ERR_PTR(res) : mi; | ||
1370 | } | ||
1371 | EXPORT_SYMBOL(tiler_map_1d_block); | ||
1372 | |||
1373 | void tiler_free_block(tiler_blk_handle block) | ||
1374 | { | ||
1375 | mutex_lock(&mtx); | ||
1376 | _m_try_free(block); | ||
1377 | mutex_unlock(&mtx); | ||
1378 | } | ||
1379 | EXPORT_SYMBOL(tiler_free_block); | ||
1380 | |||
1363 | MODULE_LICENSE("GPL v2"); | 1381 | MODULE_LICENSE("GPL v2"); |
1364 | MODULE_AUTHOR("Lajos Molnar <molnar@ti.com>"); | 1382 | MODULE_AUTHOR("Lajos Molnar <molnar@ti.com>"); |
1365 | MODULE_AUTHOR("David Sin <davidsin@ti.com>"); | 1383 | MODULE_AUTHOR("David Sin <davidsin@ti.com>"); |