diff options
author | David Sin <davidsin@ti.com> | 2010-06-14 10:26:27 -0500 |
---|---|---|
committer | Ricardo Perez Olivares <x0081762@ti.com> | 2010-09-14 19:26:27 -0500 |
commit | f841aeb37cb695a61a1dcd4fd10e928d7bf5ff07 (patch) | |
tree | 3121ff2fcfe592d5bed9406ee6062df923f19ddd /drivers/media | |
parent | 117ab1799f2dcb4baecd790d5870e5006a343926 (diff) |
TILER: Limit the amount of pages available in the free page stack
Add logic to cap the total amount of pages to keep on hand.
Signed-off-by: David Sin <davidsin@ti.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/dmm/tmm_pat.c | 19 | ||||
-rw-r--r-- | drivers/media/video/tiler/tiler.c | 5 |
2 files changed, 20 insertions, 4 deletions
diff --git a/drivers/media/video/dmm/tmm_pat.c b/drivers/media/video/dmm/tmm_pat.c index 5b5053a83c1f..eddf3820b19b 100644 --- a/drivers/media/video/dmm/tmm_pat.c +++ b/drivers/media/video/dmm/tmm_pat.c @@ -31,6 +31,12 @@ #define MAX 16 #define DMM_PAGE 0x1000 +/* Max pages in free page stack */ +#define PAGE_CAP (256 * 40) + +/* Number of pages currently allocated */ +static unsigned long count; + /** * Used to keep track of mem per * dmm_get_pages call. @@ -109,6 +115,7 @@ static u32 fill_page_stack(struct mem *mem, struct mutex *mtx) outer_flush_range(m->pa, m->pa + DMM_PAGE); mutex_lock(mtx); + count++; list_add(&m->list, &mem->list); mutex_unlock(mtx); } @@ -239,8 +246,15 @@ static void tmm_pat_free_pages(struct tmm *tmm, u32 *list) f = list_entry(pos, struct fast, list); if (f->pa[0] == list[0]) { for (i = 0; i < f->num; i++) { - list_add(&((struct mem *)f->mem[i])->list, - &pvt->free_list.list); + if (count < PAGE_CAP) { + list_add( + &((struct mem *)f->mem[i])->list, + &pvt->free_list.list); + } else { + __free_page( + ((struct mem *)f->mem[i])->pg); + count--; + } } list_del(pos); kfree(f->pa); @@ -289,6 +303,7 @@ struct tmm *tmm_pat_init(u32 pat_id) INIT_LIST_HEAD(&pvt->fast_list.list); mutex_init(&pvt->mtx); + count = 0; if (list_empty_careful(&pvt->free_list.list)) if (fill_page_stack(&pvt->free_list, &pvt->mtx)) goto error; diff --git a/drivers/media/video/tiler/tiler.c b/drivers/media/video/tiler/tiler.c index bd35248c47ee..a463d72050e0 100644 --- a/drivers/media/video/tiler/tiler.c +++ b/drivers/media/video/tiler/tiler.c @@ -1497,8 +1497,9 @@ static s32 __init tiler_init(void) TMM_SET(TILFMT_32BIT, tmm_pat); TMM_SET(TILFMT_PAGE, tmm_pat); - /* Array of physical pages for PAT programming, which must be a 16-byte - aligned physical address + /** + * Array of physical pages for PAT programming, which must be a 16-byte + * aligned physical address */ dmac_va = dma_alloc_coherent(NULL, TILER_WIDTH * TILER_HEIGHT * sizeof(*dmac_va), &dmac_pa, GFP_ATOMIC); |