diff options
author | David Sin <davidsin@ti.com> | 2012-04-09 16:22:12 -0700 |
---|---|---|
committer | Ziyann <jaraidaniel@gmail.com> | 2014-10-01 12:57:53 +0200 |
commit | 515683156da37d94d86bb8aa24ad1b2058cd3b25 (patch) | |
tree | ad1cb9532f6668bd29cff42337699fa81df08adb | |
parent | c22f663b73431aba82ea4242211038b9fcae9a3f (diff) | |
download | kernel_samsung_tuna-515683156da37d94d86bb8aa24ad1b2058cd3b25.zip kernel_samsung_tuna-515683156da37d94d86bb8aa24ad1b2058cd3b25.tar.gz kernel_samsung_tuna-515683156da37d94d86bb8aa24ad1b2058cd3b25.tar.bz2 |
gcx: use uncached memory for command buffer.
currently, we are using cached mem for the cmdbuf,
which requires expensive flush calls before queuing to the 2d hw.
Change-Id: Ib4bbb1979c9329a7937a10105d7e82ad4f096cf7
Signed-off-by: David Sin <davidsin@ti.com>
-rw-r--r-- | drivers/misc/gcx/gccore/gccmdbuf.c | 10 | ||||
-rw-r--r-- | drivers/misc/gcx/gccore/gcmain.c | 51 |
2 files changed, 13 insertions, 48 deletions
diff --git a/drivers/misc/gcx/gccore/gccmdbuf.c b/drivers/misc/gcx/gccore/gccmdbuf.c index 24ea947..bd335ed 100644 --- a/drivers/misc/gcx/gccore/gccmdbuf.c +++ b/drivers/misc/gcx/gccore/gccmdbuf.c @@ -106,7 +106,7 @@ enum gcerror cmdbuf_map(struct mmu2dcontext *ctxt) struct mmu2dphysmem mem; struct mmu2darena *mapped; pte_t physpages[GC_CMD_BUF_PAGES]; - unsigned char *logical; + unsigned char *physical; int i; GCPRINT(GCDBGFILTER, GCZONE_MAPPING, "++" GC_MOD_PREFIX @@ -117,10 +117,10 @@ enum gcerror cmdbuf_map(struct mmu2dcontext *ctxt) "command buffer has data!\n", __func__, __LINE__); - logical = (unsigned char *) cmdbuf.page.logical; + physical = (unsigned char *) cmdbuf.page.physical; for (i = 0; i < GC_CMD_BUF_PAGES; i += 1) { - physpages[i] = page_to_phys(virt_to_page(logical)); - logical += PAGE_SIZE; + physpages[i] = (pte_t)physical; + physical += PAGE_SIZE; } mem.base = (u32) cmdbuf.page.logical; @@ -270,6 +270,8 @@ int cmdbuf_flush(void *logical) /* Write address register. */ gc_write_reg(GCREG_CMD_BUFFER_ADDR_Address, base); + wmb(); + /* Write control register. */ gc_write_reg(GCREG_CMD_BUFFER_CTRL_Address, SETFIELDVAL(0, GCREG_CMD_BUFFER_CTRL, ENABLE, ENABLE) | diff --git a/drivers/misc/gcx/gccore/gcmain.c b/drivers/misc/gcx/gccore/gcmain.c index a910eaf..d8e8582 100644 --- a/drivers/misc/gcx/gccore/gcmain.c +++ b/drivers/misc/gcx/gccore/gcmain.c @@ -171,9 +171,11 @@ static enum gcerror find_context(struct gccontextmap **context, int create) if (gcerror != GCERR_NONE) goto free_map_ctx; +#if MMU_ENABLE gcerror = cmdbuf_map(&curr->context->mmu); if (gcerror != GCERR_NONE) goto free_2d_ctx; +#endif curr->context->mmu_dirty = true; @@ -291,8 +293,7 @@ void gc_write_reg(unsigned int address, unsigned int data) enum gcerror gc_alloc_pages(struct gcpage *p, unsigned int size) { enum gcerror gcerror; - void *logical; - int order, count; + int order; p->pages = NULL; p->logical = NULL; @@ -312,31 +313,13 @@ enum gcerror gc_alloc_pages(struct gcpage *p, unsigned int size) GCPRINT(GCDBGFILTER, GCZONE_PAGE, GC_MOD_PREFIX "order=%d\n", __func__, __LINE__, order); - p->pages = alloc_pages(GFP_KERNEL, order); - if (p->pages == NULL) { + p->logical = dma_alloc_coherent(NULL, p->size, &p->physical, + GFP_KERNEL); + if (!p->logical) { gcerror = GCERR_OOPM; goto fail; } - p->physical = page_to_phys(p->pages); - p->logical = (unsigned int *) page_address(p->pages); - - if (p->logical == NULL) { - gcerror = GCERR_PMMAP; - goto fail; - } - - /* Reserve pages. */ - logical = p->logical; - count = p->size / PAGE_SIZE; - - while (count) { - SetPageReserved(virt_to_page(logical)); - - logical = (unsigned char *) logical + PAGE_SIZE; - count -= 1; - } - GCPRINT(GCDBGFILTER, GCZONE_PAGE, GC_MOD_PREFIX "container = 0x%08X\n", __func__, __LINE__, (unsigned int) p); @@ -387,27 +370,10 @@ void gc_free_pages(struct gcpage *p) __func__, __LINE__, p->size); if (p->logical != NULL) { - void *logical; - int count; - - logical = p->logical; - count = p->size / PAGE_SIZE; - - while (count) { - ClearPageReserved(virt_to_page(logical)); - - logical = (unsigned char *) logical + PAGE_SIZE; - count -= 1; - } - + dma_free_coherent(NULL, p->size, p->logical, p->physical); p->logical = NULL; } - if (p->pages != NULL) { - __free_pages(p->pages, p->order); - p->pages = NULL; - } - p->physical = ~0UL; p->order = 0; p->size = 0; @@ -434,9 +400,6 @@ void gc_flush_pages(struct gcpage *p) GCPRINT(GCDBGFILTER, GCZONE_PAGE, GC_MOD_PREFIX "size=%d\n", __func__, __LINE__, p->size); - - dmac_flush_range(p->logical, (unsigned char *) p->logical + p->size); - outer_flush_range(p->physical, p->physical + p->size); } /******************************************************************************* |